[Libreoffice-commits] .: 2 commits - sw/source
August Sodora
augsod at kemper.freedesktop.org
Thu Jan 12 19:18:18 PST 2012
sw/source/ui/envelp/label1.cxx | 28 +++++++++++-----------------
sw/source/ui/envelp/labfmt.cxx | 10 ++++------
sw/source/ui/inc/initui.hxx | 9 +++++----
sw/source/ui/inc/label.hxx | 6 +++---
sw/source/ui/utlui/initui.cxx | 35 ++++++++++++++---------------------
5 files changed, 37 insertions(+), 51 deletions(-)
New commits:
commit dea42954b5e9a22f0d498cad0cc3c373ec5940e8
Author: August Sodora <augsod at gmail.com>
Date: Thu Jan 12 21:28:57 2012 -0500
SvStringsDtor->std::vector
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index dcf87de..b1bde75 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -108,10 +108,7 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
SfxTabDialog( pParent, SW_RES(DLG_LAB), &rSet, sal_False ),
pNewDBMgr(pDBMgr),
pPrtPage(0),
-
aTypeIds( 50, 10 ),
- aMakes ( 5, 0 ),
-
pRecs ( new SwLabRecs() ),
sBusinessCardDlg(SW_RES(ST_BUSINESSCARDDLG)),
sFormat(SW_RES(ST_FIRSTPAGE_LAB)),
@@ -171,13 +168,13 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
const rtl::OUString* pMan = rMan.getConstArray();
for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++)
{
- aMakes.Insert( new String(pMan[nMan]), aMakes.Count() );
+ aMakes.push_back(pMan[nMan]);
if ( pMan[nMan] == aItem.aLstMake )
nLstGroup = (sal_uInt16) nMan;
}
- if ( aMakes.Count() )
- _ReplaceGroup( *aMakes[nLstGroup] );
+ if ( !aMakes.empty() )
+ _ReplaceGroup( aMakes[nLstGroup] );
if (pExampleSet)
pExampleSet->Put(aItem);
@@ -284,15 +281,15 @@ SwLabPage::SwLabPage(Window* pParent, const SfxItemSet& rSet) :
InitDatabaseBox();
- sal_uInt16 nLstGroup = 0;
+ size_t nLstGroup = 0;
- const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
- for (sal_uInt16 i = 0; i < nCount; ++i)
+ const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().size();
+ for(size_t i = 0; i < nCount; ++i)
{
- String &rStr = *GetParent()->Makes()[i];
+ rtl::OUString& rStr = GetParent()->Makes()[i];
aMakeBox.InsertEntry( rStr );
- if ( rStr == String(aItem.aLstMake) )
+ if ( rStr == aItem.aLstMake)
nLstGroup = i;
}
@@ -578,15 +575,12 @@ void SwLabPage::Reset(const SfxItemSet& rSet)
aAddrBox .Check ( aItem.bAddr );
aWritingEdit.SetText ( aWriting.ConvertLineEnd() );
- const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
- for (sal_uInt16 i = 0; i < nCount; ++i)
+ for(std::vector<rtl::OUString>::const_iterator i = GetParent()->Makes().begin(); i != GetParent()->Makes().end(); ++i)
{
- String &rStr = *GetParent()->Makes()[i];
- if(aMakeBox.GetEntryPos(String(rStr)) == LISTBOX_ENTRY_NOTFOUND)
- aMakeBox.InsertEntry( rStr );
+ if(aMakeBox.GetEntryPos(String(*i)) == LISTBOX_ENTRY_NOTFOUND)
+ aMakeBox.InsertEntry(*i);
}
-
aMakeBox .SelectEntry( aItem.aMake );
//save the current type
String sType(aItem.aType);
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index aac84d8..2aa1e3b 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -552,15 +552,13 @@ IMPL_LINK( SwLabFmtPage, SaveHdl, PushButton *, EMPTYARG )
{
bModified = sal_False;
const Sequence<OUString>& rMan = GetParent()->GetLabelsConfig().GetManufacturers();
- SvStringsDtor& rMakes = GetParent()->Makes();
- if(rMakes.Count() < (sal_uInt16)rMan.getLength())
+ std::vector<rtl::OUString>& rMakes(GetParent()->Makes());
+ if(rMakes.size() < (sal_uInt16)rMan.getLength())
{
- rMakes.DeleteAndDestroy(0, rMakes.Count());
+ rMakes.clear();
const OUString* pMan = rMan.getConstArray();
for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++)
- {
- rMakes.Insert( new String(pMan[nMan]), rMakes.Count() );
- }
+ rMakes.push_back(pMan[nMan]);
}
aMakeFI.SetText(aItem.aMake);
aTypeFI.SetText(aItem.aType);
diff --git a/sw/source/ui/inc/label.hxx b/sw/source/ui/inc/label.hxx
index 1824e49..8d8780a 100644
--- a/sw/source/ui/inc/label.hxx
+++ b/sw/source/ui/inc/label.hxx
@@ -48,7 +48,7 @@ class SwLabDlg : public SfxTabDialog
SwLabPrtPage* pPrtPage;
std::vector<sal_uInt16> aTypeIds;
- SvStringsDtor aMakes;
+ std::vector<rtl::OUString> aMakes;
SwLabRecs* pRecs;
String aLstGroup;
@@ -74,8 +74,8 @@ public:
std::vector<sal_uInt16> &TypeIds() { return aTypeIds; }
const std::vector<sal_uInt16> &TypeIds() const { return aTypeIds; }
- SvStringsDtor &Makes() { return aMakes; }
- const SvStringsDtor &Makes() const { return aMakes; }
+ std::vector<rtl::OUString> &Makes() { return aMakes; }
+ const std::vector<rtl::OUString> &Makes() const { return aMakes; }
Printer *GetPrt();
inline void ReplaceGroup( const String &rMake );
commit ab5986d4d04127fea8800345d5c0674a77bbe9df
Author: August Sodora <augsod at gmail.com>
Date: Thu Jan 12 21:15:24 2012 -0500
SvStringsDtor->std::vector
diff --git a/sw/source/ui/inc/initui.hxx b/sw/source/ui/inc/initui.hxx
index 77b4413..45cc25f 100644
--- a/sw/source/ui/inc/initui.hxx
+++ b/sw/source/ui/inc/initui.hxx
@@ -31,12 +31,13 @@
#include "tools/solar.h"
#include "swdllapi.h"
+#include <vector>
+
/*
* Forward Declarations
*/
class String;
class SwThesaurus;
-class SvStringsDtor;
/*
* Extern Definitions
@@ -57,10 +58,10 @@ SW_DLLPUBLIC String* GetOldDrwCat();
SW_DLLPUBLIC String* GetCurrGlosGroup();
SW_DLLPUBLIC void SetCurrGlosGroup(String* pStr);
-extern SvStringsDtor* pDBNameList;
+extern std::vector<String>* pDBNameList;
-extern SvStringsDtor* pAuthFieldNameList;
-extern SvStringsDtor* pAuthFieldTypeList;
+extern std::vector<String>* pAuthFieldNameList;
+extern std::vector<String>* pAuthFieldTypeList;
// provides textblock management
class SwGlossaries;
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx
index d34ac78..8f64d8a 100644
--- a/sw/source/ui/utlui/initui.cxx
+++ b/sw/source/ui/utlui/initui.cxx
@@ -26,8 +26,6 @@
*
************************************************************************/
-
-
#include <unotools/localedatawrapper.hxx>
#include <viewsh.hxx>
#include <initui.hxx>
@@ -86,10 +84,10 @@ void SetCurrGlosGroup(String* pStr)
pCurrGlosGroup = pStr;
}
-SvStringsDtor* pDBNameList = 0;
+std::vector<String>* pDBNameList = 0;
-SvStringsDtor* pAuthFieldNameList = 0;
-SvStringsDtor* pAuthFieldTypeList = 0;
+std::vector<String>* pAuthFieldNameList = 0;
+std::vector<String>* pAuthFieldTypeList = 0;
/*--------------------------------------------------------------------
Beschreibung: UI beenden
@@ -128,7 +126,7 @@ void _InitUI()
{
// ShellResource gibt der CORE die Moeglichkeit mit Resourcen zu arbeiten
ViewShell::SetShellRes( new ShellResource );
- pDBNameList = new SvStringsDtor( 5, 5 );
+ pDBNameList = new std::vector<String>;
SwEditWin::_InitStaticData();
}
@@ -277,29 +275,24 @@ const String& SwAuthorityFieldType::GetAuthFieldName(ToxAuthorityField eType)
{
if(!pAuthFieldNameList)
{
- pAuthFieldNameList = new SvStringsDtor(AUTH_FIELD_END, 1);
- for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
- {
- String* pTmp = new String(SW_RES(STR_AUTH_FIELD_START + i));
- pAuthFieldNameList->Insert(pTmp, pAuthFieldNameList->Count());
- }
+ pAuthFieldNameList = new std::vector<String>;
+ pAuthFieldNameList->reserve(AUTH_FIELD_END);
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i)
+ pAuthFieldNameList->push_back(String(SW_RES(STR_AUTH_FIELD_START + i)));
}
- return *pAuthFieldNameList->GetObject( static_cast< sal_uInt16 >(eType) );
+ return (*pAuthFieldNameList)[static_cast< sal_uInt16 >(eType)];
}
const String& SwAuthorityFieldType::GetAuthTypeName(ToxAuthorityType eType)
{
if(!pAuthFieldTypeList)
{
- pAuthFieldTypeList = new SvStringsDtor(AUTH_TYPE_END, 1);
- for(sal_uInt16 i = 0; i < AUTH_TYPE_END; i++)
- pAuthFieldTypeList->Insert(
- new String(SW_RES(STR_AUTH_TYPE_START + i)),
- pAuthFieldTypeList->Count());
+ pAuthFieldTypeList = new std::vector<String>;
+ pAuthFieldTypeList->reserve(AUTH_TYPE_END);
+ for(sal_uInt16 i = 0; i < AUTH_TYPE_END; ++i)
+ pAuthFieldTypeList->push_back(String(SW_RES(STR_AUTH_TYPE_START + i)));
}
- return *pAuthFieldTypeList->GetObject( static_cast< sal_uInt16 >(eType) );
+ return (*pAuthFieldTypeList)[static_cast< sal_uInt16 >(eType)];
}
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list