diff options
-rw-r--r-- | cui/source/tabpages/tabarea.cxx | 9 | ||||
-rw-r--r-- | cui/source/tabpages/tabline.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 22 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 22 | ||||
-rw-r--r-- | cui/source/tabpages/tpgradnt.cxx | 22 | ||||
-rw-r--r-- | cui/source/tabpages/tphatch.cxx | 22 | ||||
-rw-r--r-- | cui/source/tabpages/tplnedef.cxx | 22 | ||||
-rw-r--r-- | cui/source/tabpages/tplneend.cxx | 23 | ||||
-rw-r--r-- | extras/Package_palettes.mk | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/util/XPathSettings.idl | 3 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/Paths.xcu | 3 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 | ||||
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 67 | ||||
-rw-r--r-- | svx/source/xoutdev/xtable.cxx | 54 |
14 files changed, 234 insertions, 54 deletions
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx index 7ecc83618bbd..1bdaa179baf2 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 aa99b2cd447b..6049c8cdd1df 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 0d11116b9533..71c23e614918 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 94231c5f0f32..50b74de0b673 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 e737410c36cb..380f36a625ea 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 bad1e714cbf6..0060b36d848e 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 6694a549ce5a..38a7c7f246be 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 aff55b93eefa..478ab46c529b 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 bc317e2465a9..5cf4c6104bd7 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 5f202a369dd6..d54c12269299 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 6d739e67d72f..965a629ac790 100644 --- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu @@ -124,6 +124,9 @@ </node> </node> <node oor:name="Palette" oor:op="fuse" oor:mandatory="true"> + <node oor:name="InternalPaths"> + <node oor:name="$(insturl)/@LIBO_SHARE_FOLDER@/palette" oor:op="fuse"/> + </node> <prop oor:name="WritePath"> <value>$(userurl)/config</value> </prop> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 0bc0dc8bd54a..8922889bc932 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -1642,12 +1642,15 @@ </info> <value>$(progpath)</value> </prop> - <prop oor:name="Palette" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="Palette" oor:type="oor:string-list" oor:nillable="false"> <info> <desc>Specifies the path to the palette files *.SOB to *.SOF containing user-defined colors and patterns.</desc> </info> - <value>$(userurl)/config</value> + <value> + <it>$(insturl)/@LIBO_SHARE_FOLDER@/palette</it> + <it>$(userurl)/config</it> + </value> </prop> <prop oor:name="Plugin" oor:type="oor:string-list" oor:nillable="false"> <info> diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 109f934f1b3b..3334afc3e6bc 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -27,6 +27,8 @@ #include <svtools/colrdlg.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <stack> +#include <set> 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<OUString> aDirs; + sal_Int32 nIndex = 0; + do + { + aDirs.push(aPalPaths.getToken(0, ';', nIndex)); + } + while (nIndex >= 0); + + std::set<OUString> 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 5e35be97a2c7..b3f1416d8ceb 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -25,6 +25,7 @@ #include <svx/xpool.hxx> #include <svx/svdobj.hxx> #include <svx/svdpool.hxx> +#include <stack> using namespace com::sun::star; @@ -224,23 +225,41 @@ bool XPropertyList::Load() if( mbListDirty ) { mbListDirty = false; + std::stack<OUString> 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; } |