summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrisztian Pinter <pin.terminator@gmail.com>2014-07-31 10:56:58 +0200
committerKrisztian Pinter <pin.terminator@gmail.com>2014-07-31 10:56:58 +0200
commit771b951a806d956c2ae2dc7b64cb6e15f4839630 (patch)
tree595ba6dae1ddba5739ad75b96cd58b6830c9acba
parentd1cd50957750a534d6ec1ba8a21bca1e3b8fe931 (diff)
Make .soc loading lazy
Change-Id: If7475d6c46faaa6f6f6cde494990e6573b3aadff
-rw-r--r--include/svx/Palette.hxx3
-rw-r--r--svx/source/tbxctrls/Palette.cxx19
2 files changed, 15 insertions, 7 deletions
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index 2be4eb205adc..11a34623ca51 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -65,7 +65,8 @@ public:
class PaletteSOC : public Palette
{
- //TODO add lazy loading
+ bool mbLoadedPalette;
+ OUString maFPath;
OUString maName;
XColorListRef mpColorList;
public:
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index 95ebb589735c..496e0fcc678e 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -173,11 +173,11 @@ OString lcl_getToken(const OString& rStr, sal_Int32& index)
// PaletteSOC ------------------------------------------------------------------
-PaletteSOC::PaletteSOC( const OUString &rFPath, const OUString &rFName )
+PaletteSOC::PaletteSOC( const OUString &rFPath, const OUString &rFName ) :
+ mbLoadedPalette( false ),
+ maFPath( rFPath ),
+ maName( rFName )
{
- maName = rFName;
- mpColorList = XPropertyList::AsColorList(XPropertyList::CreatePropertyListFromURL(XCOLOR_LIST, rFPath));
- mpColorList->Load();
}
PaletteSOC::~PaletteSOC()
@@ -191,13 +191,20 @@ const OUString& PaletteSOC::GetName()
void PaletteSOC::LoadColorSet( SvxColorValueSet& rColorSet )
{
+ if( !mbLoadedPalette )
+ {
+ mbLoadedPalette = true;
+ mpColorList = XPropertyList::AsColorList(XPropertyList::CreatePropertyListFromURL(XCOLOR_LIST, maFPath));
+ mpColorList->Load();
+ }
rColorSet.Clear();
- rColorSet.addEntriesForXColorList( *mpColorList );
+ if( mpColorList.is() )
+ rColorSet.addEntriesForXColorList( *mpColorList );
}
bool PaletteSOC::IsValid()
{
- return mpColorList.is();
+ return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */