From 94f0bb8cfd8fe43334ab727473c1577965b074e2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Jun 07 2015 14:43:01 +0000 Subject: Resolves: tdf#89905 don't copy palettes from shared --- diff --git a/0001-Resolves-tdf-89905-don-t-copy-palettes-from-shared-t.patch b/0001-Resolves-tdf-89905-don-t-copy-palettes-from-shared-t.patch new file mode 100644 index 0000000..4dc0a71 --- /dev/null +++ b/0001-Resolves-tdf-89905-don-t-copy-palettes-from-shared-t.patch @@ -0,0 +1,599 @@ +From f47aa0dbb17a998bdeb01036b9fd9ba0b74b8704 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Sat, 6 Jun 2015 14:24:46 +0100 +Subject: [PATCH] Resolves: tdf#89905 don't copy palettes from shared to user + +make this a multi-path element with a shared read-only location +and a user read/write location and don't copy the presets, instead +just keep them in the shared location + +Now an admin can copy extra palettes into the shared location +and they magically appear in the user deployments + +Change-Id: I7585789c0c59941094f6128368df94b834d3c2a2 +(cherry picked from commit 29202a16d9f1934684c7d0978112849f2a21fe2f) + +Related: tdf#89905 these PalettePath uses appear to really be UserConfigPath + +which is the same path at the moment + +Change-Id: Ifdefa478003a2b5cc5c065b1942194dda1275f5e +(cherry picked from commit 2c3bf6bfc244517a0134e320acaa1f720703d8f2) +--- + cui/source/tabpages/tabarea.cxx | 9 ++- + cui/source/tabpages/tabline.cxx | 10 +++- + cui/source/tabpages/tpbitmap.cxx | 22 ++++++- + cui/source/tabpages/tpcolor.cxx | 22 ++++++- + cui/source/tabpages/tpgradnt.cxx | 22 ++++++- + cui/source/tabpages/tphatch.cxx | 22 ++++++- + cui/source/tabpages/tplnedef.cxx | 22 ++++++- + cui/source/tabpages/tplneend.cxx | 23 +++++++- + extras/Package_palettes.mk | 2 +- + offapi/com/sun/star/util/XPathSettings.idl | 3 +- + .../registry/data/org/openoffice/Office/Paths.xcu | 3 + + .../schema/org/openoffice/Office/Common.xcs | 7 ++- + sd/source/ui/dlg/PhotoAlbumDialog.cxx | 2 +- + svx/source/sidebar/nbdtmg.cxx | 4 +- + svx/source/tbxctrls/PaletteManager.cxx | 67 +++++++++++++++------- + svx/source/xoutdev/xtable.cxx | 54 ++++++++++++----- + 16 files changed, 237 insertions(+), 57 deletions(-) + +diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx +index 7ecc836..1bdaa17 100644 +--- a/cui/source/tabpages/tabarea.cxx ++++ b/cui/source/tabpages/tabarea.cxx +@@ -142,7 +142,14 @@ void SvxAreaTabDialog::SavePalettes() + + // save the tables when they have been changed + +- const OUString aPath( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aPath; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aPath = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); + + if( mnHatchingListState & ChangeType::MODIFIED ) + { +diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx +index aa99b2c..6049c8c 100644 +--- a/cui/source/tabpages/tabline.cxx ++++ b/cui/source/tabpages/tabline.cxx +@@ -130,8 +130,14 @@ void SvxLineTabDialog::SavePalettes() + } + + // Save the tables when they have been changed +- +- const OUString aPath( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aPath; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aPath = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); + + if( nDashListState & ChangeType::MODIFIED ) + { +diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx +index 0d11116..71c23e6 100644 +--- a/cui/source/tabpages/tpbitmap.cxx ++++ b/cui/source/tabpages/tpbitmap.cxx +@@ -795,7 +795,16 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickLoadHdl_Impl) + ::sfx2::FileDialogHelper aDlg( com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); + OUString aStrFilterType( "*.sob" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( aDlg.Execute() == ERRCODE_NONE ) +@@ -875,7 +884,16 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickSaveHdl_Impl) + OUString aStrFilterType( "*.sob" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + DBG_ASSERT( aFile.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); + + if( !pBitmapList->GetName().isEmpty() ) +diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx +index 94231c5..50b74de 100644 +--- a/cui/source/tabpages/tpcolor.cxx ++++ b/cui/source/tabpages/tpcolor.cxx +@@ -142,7 +142,16 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickLoadHdl_Impl) + OUString aStrFilterType( XPropertyList::GetDefaultExtFilter( meType ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( aDlg.Execute() == ERRCODE_NONE ) +@@ -202,7 +211,16 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickSaveHdl_Impl) + OUString aStrFilterType( XPropertyList::GetDefaultExtFilter( meType ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + DBG_ASSERT( aFile.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); + + XPropertyListRef pList = GetList(); +diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx +index e737410..380f36a 100644 +--- a/cui/source/tabpages/tpgradnt.cxx ++++ b/cui/source/tabpages/tpgradnt.cxx +@@ -655,7 +655,16 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickLoadHdl_Impl) + ::sfx2::FileDialogHelper aDlg( com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); + OUString aStrFilterType( "*.sog" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) +@@ -739,7 +748,16 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickSaveHdl_Impl) + OUString aStrFilterType( "*.sog" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + DBG_ASSERT( aFile.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); + + if( !pGradientList->GetName().isEmpty() ) +diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx +index bad1e71..0060b36 100644 +--- a/cui/source/tabpages/tphatch.cxx ++++ b/cui/source/tabpages/tphatch.cxx +@@ -692,7 +692,16 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickLoadHdl_Impl) + ::sfx2::FileDialogHelper aDlg( com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); + OUString aStrFilterType( "*.soh" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) +@@ -765,7 +774,16 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickSaveHdl_Impl) + OUString aStrFilterType( "*.soh" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + DBG_ASSERT( aFile.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); + + if( !pHatchingList->GetName().isEmpty() ) +diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx +index 6694a54..38a7c7f 100644 +--- a/cui/source/tabpages/tplnedef.cxx ++++ b/cui/source/tabpages/tplnedef.cxx +@@ -761,7 +761,16 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl) + ::sfx2::FileDialogHelper aDlg( com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); + OUString aStrFilterType( "*.sod" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) +@@ -821,7 +830,16 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl) + OUString aStrFilterType( "*.sod" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + DBG_ASSERT( aFile.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); + + if( !pDashList->GetName().isEmpty() ) +diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx +index aff55b9..478ab46 100644 +--- a/cui/source/tabpages/tplneend.cxx ++++ b/cui/source/tabpages/tplneend.cxx +@@ -573,7 +573,17 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl) + ::sfx2::FileDialogHelper aDlg(com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); + OUString aStrFilterType( "*.soe" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( aDlg.Execute() == ERRCODE_NONE ) +@@ -633,7 +643,16 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl) + OUString aStrFilterType( "*.soe" ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ OUString aPalettePath(SvtPathOptions().GetPalettePath()); ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = aPalettePath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aFile(aLastDir); + DBG_ASSERT( aFile.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); + + if( !pLineEndList->GetName().isEmpty() ) +diff --git a/extras/Package_palettes.mk b/extras/Package_palettes.mk +index bc317e2..5cf4c61 100644 +--- a/extras/Package_palettes.mk ++++ b/extras/Package_palettes.mk +@@ -9,7 +9,7 @@ + + $(eval $(call gb_Package_Package,extras_palettes,$(SRCDIR)/extras/source/palettes)) + +-$(eval $(call gb_Package_add_files,extras_palettes,$(LIBO_SHARE_PRESETS_FOLDER)/config,\ ++$(eval $(call gb_Package_add_files,extras_palettes,$(LIBO_SHARE_FOLDER)/palette,\ + arrowhd.soe \ + classic.sog \ + cmyk.soc \ +diff --git a/offapi/com/sun/star/util/XPathSettings.idl b/offapi/com/sun/star/util/XPathSettings.idl +index 5f202a3..d54c122 100644 +--- a/offapi/com/sun/star/util/XPathSettings.idl ++++ b/offapi/com/sun/star/util/XPathSettings.idl +@@ -89,7 +89,8 @@ published interface XPathSettings + [attribute] string Module; + + /** This is the path to the palette files *.SOB to *.SOF containing +- user-defined colors and patterns. */ ++ user-defined colors and patterns. The value can be more than ++ one path separated by a semicolon.*/ + [attribute] string Palette; + + /** Plugins are saved in these directories. The value can be more than +diff --git a/officecfg/registry/data/org/openoffice/Office/Paths.xcu b/officecfg/registry/data/org/openoffice/Office/Paths.xcu +index 6d739e6..965a629 100644 +--- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu ++++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu +@@ -124,6 +124,9 @@ + + + ++ ++ ++ + + $(userurl)/config + +diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs +index 0bc0dc8..8922889 100644 +--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs ++++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs +@@ -1642,12 +1642,15 @@ + + $(progpath) + +- ++ + + Specifies the path to the palette files *.SOB to *.SOF + containing user-defined colors and patterns. + +- $(userurl)/config ++ ++ $(insturl)/@LIBO_SHARE_FOLDER@/palette ++ $(userurl)/config ++ + + + +diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx +index d5dcd09..b29ea21 100644 +--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx ++++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx +@@ -480,7 +480,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl) + // Read configuration + OUString sUrl(officecfg::Office::Impress::Pictures::Path::get()); + +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ INetURLObject aFile( SvtPathOptions().GetUserConfigPath() ); + if (!sUrl.isEmpty()) + aDlg.SetDisplayDirectory(sUrl); + else +diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx +index 7c7e2c4..9570c2b 100644 +--- a/svx/source/sidebar/nbdtmg.cxx ++++ b/svx/source/sidebar/nbdtmg.cxx +@@ -157,7 +157,7 @@ void NBOTypeMgrBase::ImplLoad(const OUString& filename) + bIsLoading = true; + SfxMapUnit eOldCoreUnit=eCoreUnit; + eCoreUnit = SFX_MAPUNIT_100TH_MM; +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ INetURLObject aFile( SvtPathOptions().GetUserConfigPath() ); + aFile.Append( filename); + std::unique_ptr xIStm(::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::READ )); + if( xIStm ) { +@@ -196,7 +196,7 @@ void NBOTypeMgrBase::ImplStore(const OUString& filename) + if (bIsLoading) return; + SfxMapUnit eOldCoreUnit=eCoreUnit; + eCoreUnit = SFX_MAPUNIT_100TH_MM; +- INetURLObject aFile( SvtPathOptions().GetPalettePath() ); ++ INetURLObject aFile( SvtPathOptions().GetUserConfigPath() ); + aFile.Append( filename); + std::unique_ptr xOStm(::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::WRITE )); + if( xOStm ) { +diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx +index 109f934..3334afc 100644 +--- a/svx/source/tbxctrls/PaletteManager.cxx ++++ b/svx/source/tbxctrls/PaletteManager.cxx +@@ -27,6 +27,8 @@ + #include + #include + #include ++#include ++#include + + PaletteManager::PaletteManager() : + mnMaxRecentColors(Application::GetSettings().GetStyleSettings().GetColorValueSetColumnCount()), +@@ -47,31 +49,52 @@ PaletteManager::~PaletteManager() + void PaletteManager::LoadPalettes() + { + maPalettes.clear(); +- OUString aPalPath = SvtPathOptions().GetPalettePath(); +- +- osl::Directory aDir(aPalPath); +- osl::DirectoryItem aDirItem; +- osl::FileStatus aFileStat( osl_FileStatus_Mask_FileName | +- osl_FileStatus_Mask_FileURL | +- osl_FileStatus_Mask_Type ); +- if( aDir.open() == osl::FileBase::E_None ) ++ OUString aPalPaths = SvtPathOptions().GetPalettePath(); ++ ++ std::stack aDirs; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aDirs.push(aPalPaths.getToken(0, ';', nIndex)); ++ } ++ while (nIndex >= 0); ++ ++ std::set aNames; ++ //try all entries palette path list user first, then ++ //system, ignoring duplicate file names ++ while (!aDirs.empty()) + { +- while( aDir.getNextItem(aDirItem) == osl::FileBase::E_None ) ++ OUString aPalPath = aDirs.top(); ++ aDirs.pop(); ++ ++ osl::Directory aDir(aPalPath); ++ osl::DirectoryItem aDirItem; ++ osl::FileStatus aFileStat( osl_FileStatus_Mask_FileName | ++ osl_FileStatus_Mask_FileURL | ++ osl_FileStatus_Mask_Type ); ++ if( aDir.open() == osl::FileBase::E_None ) + { +- aDirItem.getFileStatus(aFileStat); +- if(aFileStat.isRegular() || aFileStat.isLink()) ++ while( aDir.getNextItem(aDirItem) == osl::FileBase::E_None ) + { +- OUString aFName = aFileStat.getFileName(); +- Palette* pPalette = 0; +- if( aFName.endsWithIgnoreAsciiCase(".gpl") ) +- pPalette = new PaletteGPL( aFileStat.getFileURL(), aFName ); +- else if( aFName.endsWithIgnoreAsciiCase(".soc") ) +- pPalette = new PaletteSOC( aFileStat.getFileURL(), aFName ); +- else if ( aFName.endsWithIgnoreAsciiCase(".ase") ) +- pPalette = new PaletteASE( aFileStat.getFileURL(), aFName ); +- +- if( pPalette && pPalette->IsValid() ) +- maPalettes.push_back( pPalette ); ++ aDirItem.getFileStatus(aFileStat); ++ if(aFileStat.isRegular() || aFileStat.isLink()) ++ { ++ OUString aFName = aFileStat.getFileName(); ++ if (aNames.find(aFName) == aNames.end()) ++ { ++ Palette* pPalette = 0; ++ if( aFName.endsWithIgnoreAsciiCase(".gpl") ) ++ pPalette = new PaletteGPL( aFileStat.getFileURL(), aFName ); ++ else if( aFName.endsWithIgnoreAsciiCase(".soc") ) ++ pPalette = new PaletteSOC( aFileStat.getFileURL(), aFName ); ++ else if ( aFName.endsWithIgnoreAsciiCase(".ase") ) ++ pPalette = new PaletteASE( aFileStat.getFileURL(), aFName ); ++ ++ if( pPalette && pPalette->IsValid() ) ++ maPalettes.push_back( pPalette ); ++ aNames.insert(aFName); ++ } ++ } + } + } + } +diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx +index 5e35be9..b3f1416d 100644 +--- a/svx/source/xoutdev/xtable.cxx ++++ b/svx/source/xoutdev/xtable.cxx +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + using namespace com::sun::star; + +@@ -224,23 +225,41 @@ bool XPropertyList::Load() + if( mbListDirty ) + { + mbListDirty = false; ++ std::stack aDirs; + +- INetURLObject aURL( maPath ); +- +- if( INetProtocol::NotValid == aURL.GetProtocol() ) ++ sal_Int32 nIndex = 0; ++ do + { +- DBG_ASSERT( maPath.isEmpty(), "invalid URL" ); +- return false; ++ aDirs.push(maPath.getToken(0, ';', nIndex)); + } ++ while (nIndex >= 0); ++ ++ //try all entries palette path list working back to front until one ++ //succeeds ++ while (!aDirs.empty()) ++ { ++ OUString aPath(aDirs.top()); ++ aDirs.pop(); ++ ++ INetURLObject aURL(aPath); ++ ++ if( INetProtocol::NotValid == aURL.GetProtocol() ) ++ { ++ DBG_ASSERT( aPath.isEmpty(), "invalid URL" ); ++ return false; ++ } + +- aURL.Append( maName ); ++ aURL.Append( maName ); + +- if( aURL.getExtension().isEmpty() ) +- aURL.setExtension( GetDefaultExt() ); ++ if( aURL.getExtension().isEmpty() ) ++ aURL.setExtension( GetDefaultExt() ); + +- return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), maReferer, +- uno::Reference < embed::XStorage >(), +- createInstance(), NULL ); ++ bool bRet = SvxXMLXTableImport::load(aURL.GetMainURL(INetURLObject::NO_DECODE), ++ maReferer, uno::Reference < embed::XStorage >(), ++ createInstance(), NULL ); ++ if (bRet) ++ return bRet; ++ } + } + return false; + } +@@ -256,11 +275,20 @@ bool XPropertyList::LoadFrom( const uno::Reference < embed::XStorage > &xStorage + + bool XPropertyList::Save() + { +- INetURLObject aURL( maPath ); ++ //save to the last path in the palette path list ++ OUString aLastDir; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ aLastDir = maPath.getToken(0, ';', nIndex); ++ } ++ while (nIndex >= 0); ++ ++ INetURLObject aURL(aLastDir); + + if( INetProtocol::NotValid == aURL.GetProtocol() ) + { +- DBG_ASSERT( maPath.isEmpty(), "invalid URL" ); ++ DBG_ASSERT( aLastDir.isEmpty(), "invalid URL" ); + return false; + } + +-- +2.4.0 + diff --git a/libreoffice.spec b/libreoffice.spec index d2ff036..ea29982 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -325,6 +325,8 @@ Patch14: 0001-never-run-autogen.sh.patch Patch15: 0001-add-X-TryExec-entries-to-desktop-files.patch # not upstreamed Patch16: 0001-disable-PSD-import-test-which-deadlocks-on-ARM.patch +# upstreamed +Patch17: 0001-Resolves-tdf-89905-don-t-copy-palettes-from-shared-t.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice