diff options
author | Krisztian Pinter <pin.terminator@gmail.com> | 2014-07-31 10:56:58 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2014-09-17 10:19:52 +0200 |
commit | cb02490a1e35886bc2dc4a9889fdd6db742e5899 (patch) | |
tree | e20120eb28b0d489aade231185eaccdff398dc14 | |
parent | b39f15cfcc28266c5c680d19eaa394960cb7c0ff (diff) |
Make .soc loading lazy
Change-Id: If7475d6c46faaa6f6f6cde494990e6573b3aadff
-rw-r--r-- | include/svx/Palette.hxx | 3 | ||||
-rw-r--r-- | svx/source/tbxctrls/Palette.cxx | 19 |
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: */ |