summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrisztian Pinter <pin.terminator@gmail.com>2014-07-30 19:45:37 +0200
committerKrisztian Pinter <pin.terminator@gmail.com>2014-07-30 19:45:37 +0200
commitd1cd50957750a534d6ec1ba8a21bca1e3b8fe931 (patch)
tree93980223de91a33f2aef637a6625a1672549158e
parent0e72d33fca02f4eb965dd49a26f1a6f610196175 (diff)
Change vector<Palette*> to ptr_vector<Palette>
Change-Id: I1f2832235e8d2ea3517efdce809970ed5f1c6769
-rw-r--r--include/svx/PaletteManager.hxx6
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx16
2 files changed, 9 insertions, 13 deletions
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 9d40d48426be..e4144f96ca9c 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -25,12 +25,14 @@
#include <svx/tbxcolorupdate.hxx>
#include <tools/urlobj.hxx>
+#include <comphelper/processfactory.hxx>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <comphelper/processfactory.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
class PaletteManager
{
@@ -41,7 +43,7 @@ class PaletteManager
svx::ToolboxButtonColorUpdater* mpBtnUpdater;
Color mLastColor;
- std::vector<Palette*> maPalettes;
+ boost::ptr_vector<Palette> maPalettes;
public:
PaletteManager();
~PaletteManager();
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index da80f23db37d..98ae0b2dea29 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -41,20 +41,14 @@ PaletteManager::PaletteManager() :
PaletteManager::~PaletteManager()
{
- for( std::vector<Palette*>::iterator it = maPalettes.begin();
- it != maPalettes.end();
- ++it)
- {
- delete *it;
- }
}
void PaletteManager::LoadPalettes()
{
+ maPalettes.clear();
OUString aPalPath = SvtPathOptions().GetPalettePath();
osl::Directory aDir(aPalPath);
- maPalettes.clear();
osl::DirectoryItem aDirItem;
osl::FileStatus aFileStat( osl_FileStatus_Mask_FileName |
osl_FileStatus_Mask_FileURL |
@@ -116,7 +110,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
}
else
{
- maPalettes[mnCurrentPalette-1]->LoadColorSet( rColorSet );
+ maPalettes[mnCurrentPalette-1].LoadColorSet( rColorSet );
mnColorCount = rColorSet.GetItemCount();
}
}
@@ -127,11 +121,11 @@ std::vector<OUString> PaletteManager::GetPaletteList()
aPaletteNames.push_back( STR_DEFAULT_PAL );
- for( std::vector<Palette*>::iterator it = maPalettes.begin();
+ for( boost::ptr_vector<Palette>::iterator it = maPalettes.begin();
it != maPalettes.end();
++it)
{
- aPaletteNames.push_back( (*it)->GetName() );
+ aPaletteNames.push_back( (*it).GetName() );
}
aPaletteNames.push_back( STR_DOC_COLORS );
@@ -161,7 +155,7 @@ OUString PaletteManager::GetPaletteName()
else if( mnCurrentPalette == mnNumOfPalettes - 1 )
return OUString( STR_DOC_COLORS );
else
- return maPalettes[mnCurrentPalette - 1]->GetName();
+ return maPalettes[mnCurrentPalette - 1].GetName();
}
const Color& PaletteManager::GetLastColor()