summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-02-01 12:58:45 +0000
committerNoel Power <noel.power@novell.com>2012-02-01 13:01:55 +0000
commite8b7f1faaf3b0fd837a236a4a53d0f7392723713 (patch)
tree629c59b4b78696a394c822e2183b24dfc891748c /sd
parentfd33c0b1cf23020b27db25895eeb380653d734b6 (diff)
convert SdPresLayoutDlg from tools/list.hxx to boost::ptr_vector
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/dlg/sdpreslt.cxx43
-rw-r--r--sd/source/ui/inc/sdpreslt.hxx5
2 files changed, 19 insertions, 29 deletions
diff --git a/sd/source/ui/dlg/sdpreslt.cxx b/sd/source/ui/dlg/sdpreslt.cxx
index 98f2df59f067..db30dff577c2 100644
--- a/sd/source/ui/dlg/sdpreslt.cxx
+++ b/sd/source/ui/dlg/sdpreslt.cxx
@@ -76,8 +76,6 @@ SdPresLayoutDlg::SdPresLayoutDlg(
{
FreeResource();
- mpLayoutNames = new List;
-
maVS.SetDoubleClickHdl(LINK(this, SdPresLayoutDlg, ClickLayoutHdl));
maBtnLoad.SetClickHdl(LINK(this, SdPresLayoutDlg, ClickLoadHdl));
@@ -92,14 +90,6 @@ SdPresLayoutDlg::SdPresLayoutDlg(
SdPresLayoutDlg::~SdPresLayoutDlg()
{
- String* pName = (String*)mpLayoutNames->First();
- while (pName)
- {
- delete pName;
- pName = (String*)mpLayoutNames->Next();
- }
-
- delete mpLayoutNames;
}
/*************************************************************************
@@ -131,10 +121,10 @@ void SdPresLayoutDlg::Reset()
FillValueSet();
- mnLayoutCount = mpLayoutNames->Count();
+ mnLayoutCount = maLayoutNames.size();
for( nName = 0; nName < mnLayoutCount; nName++ )
{
- if (*((String*)mpLayoutNames->GetObject(nName)) == maName)
+ if (maLayoutNames[nName] == maName)
break;
}
DBG_ASSERT(nName < mnLayoutCount, "Layout nicht gefunden");
@@ -161,11 +151,11 @@ void SdPresLayoutDlg::GetAttr(SfxItemSet& rOutAttrs)
{
aLayoutName = maName;
aLayoutName.Append( DOCUMENT_TOKEN );
- aLayoutName.Append( *(String*)mpLayoutNames->GetObject( nId - 1 ) );
+ aLayoutName.Append( maLayoutNames[ nId - 1 ] );
}
else
{
- aLayoutName = *(String*)mpLayoutNames->GetObject( nId - 1 );
+ aLayoutName = maLayoutNames[ nId - 1 ];
if( aLayoutName == maStrNone )
aLayoutName.Erase(); // so wird "- keine -" codiert (s.u.)
}
@@ -202,10 +192,10 @@ void SdPresLayoutDlg::FillValueSet()
{
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ) );
- mpLayoutNames->Insert(new String(aLayoutName), LIST_APPEND);
+ maLayoutNames.push_back(new String(aLayoutName));
Bitmap aBitmap(mpDocSh->GetPagePreviewBitmap(pMaster, 90));
- maVS.InsertItem((sal_uInt16)mpLayoutNames->Count(), aBitmap, aLayoutName);
+ maVS.InsertItem((sal_uInt16)maLayoutNames.size(), aBitmap, aLayoutName);
}
}
@@ -274,21 +264,20 @@ IMPL_LINK(SdPresLayoutDlg, ClickLoadHdl, void *, EMPTYARG)
{
// Pruefen, ob Vorlage schon vorhanden
sal_Bool bExists = sal_False;
- String* pName = (String*)mpLayoutNames->First();
String aCompareStr( maName );
if( maName.Len() == 0 )
aCompareStr = maStrNone;
- while( pName && !bExists )
+ sal_uInt16 aPos = 0;
+ for (boost::ptr_vector<String>::iterator it = maLayoutNames.begin();
+ it != maLayoutNames.end() && !bExists; ++it, ++aPos)
{
- if( aCompareStr == *pName )
+ if( aCompareStr == *it )
{
bExists = sal_True;
// Vorlage selektieren
- sal_uInt16 nId = (sal_uInt16) mpLayoutNames->GetCurPos() + 1;
- maVS.SelectItem( nId );
+ maVS.SelectItem( aPos + 1 );
}
- pName = (String*)mpLayoutNames->Next();
}
if( !bExists )
@@ -313,10 +302,10 @@ IMPL_LINK(SdPresLayoutDlg, ClickLoadHdl, void *, EMPTYARG)
{
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ) );
- mpLayoutNames->Insert(new String(aLayoutName), LIST_APPEND);
+ maLayoutNames.push_back(new String(aLayoutName));
Bitmap aBitmap(pTemplDocSh->GetPagePreviewBitmap(pMaster, 90));
- maVS.InsertItem((sal_uInt16)mpLayoutNames->Count(), aBitmap, aLayoutName);
+ maVS.InsertItem((sal_uInt16)maLayoutNames.size(), aBitmap, aLayoutName);
}
}
}
@@ -330,15 +319,15 @@ IMPL_LINK(SdPresLayoutDlg, ClickLoadHdl, void *, EMPTYARG)
else
{
// leeres Layout
- mpLayoutNames->Insert( new String( maStrNone ), LIST_APPEND );
- maVS.InsertItem( (sal_uInt16) mpLayoutNames->Count(),
+ maLayoutNames.push_back( new String( maStrNone ) );
+ maVS.InsertItem( (sal_uInt16) maLayoutNames.size(),
Bitmap( SdResId( BMP_FOIL_NONE ) ), maStrNone );
}
if (!bCancel)
{
// Vorlage selektieren
- maVS.SelectItem( (sal_uInt16) mpLayoutNames->Count() );
+ maVS.SelectItem( (sal_uInt16) maLayoutNames.size() );
}
}
}
diff --git a/sd/source/ui/inc/sdpreslt.hxx b/sd/source/ui/inc/sdpreslt.hxx
index d0a62d5813e9..db744714ce35 100644
--- a/sd/source/ui/inc/sdpreslt.hxx
+++ b/sd/source/ui/inc/sdpreslt.hxx
@@ -29,10 +29,11 @@
#ifndef SD_PRES_LAYOUT_DLG_HXX
#define SD_PRES_LAYOUT_DLG_HXX
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
-#include <tools/list.hxx>
#include <svtools/valueset.hxx>
class SfxItemSet;
@@ -75,7 +76,7 @@ private:
const SfxItemSet& mrOutAttrs;
- List* mpLayoutNames;
+ boost::ptr_vector<String> maLayoutNames;
String maName; // Layoutname oder Dateiname
long mnLayoutCount; // Anzahl, der im Dokument vorhandenen MasterPages