[Libreoffice-commits] .: 3 commits - sw/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sun May 22 22:53:34 PDT 2011
sw/source/ui/fmtui/tmpdlg.cxx | 23 ++++++++---------------
sw/source/ui/misc/num.cxx | 10 +++-------
sw/source/ui/shells/basesh.cxx | 28 ++++++++++++++--------------
3 files changed, 25 insertions(+), 36 deletions(-)
New commits:
commit 46282704171c44ea4711a016514c86b47585edb4
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sat May 21 18:56:04 2011 -0430
Replace List for std::vector<String>.
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 93f1915..c802f1b 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -505,10 +505,10 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
case TP_PAGE_STD:
if(0 == (nHtmlMode & HTMLMODE_ON ))
{
- List aList;
- String* pNew = new String;
- SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, *pNew );
- aList.Insert( pNew, (sal_uLong)0 );
+ std::vector<String> aList;
+ String aNew;
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
+ aList.push_back( aNew );
if( pWrtShell )
{
SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
@@ -517,15 +517,12 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
while(pFirstStyle)
{
- aList.Insert( new String(pFirstStyle->GetName()),
- aList.Count());
+ aList.push_back( pFirstStyle->GetName() );
pFirstStyle = pStyleSheetPool->Next();
}
}
aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
rPage.PageCreated(aSet);
- for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
- delete (String*)aList.Remove(i);
}
break;
@@ -557,19 +554,15 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
::FillCharStyleListBox(rCharFmtLB, pDocShell);
- List aList;
+
+ std::vector<String> aList;
for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
- {
+ aList.push_back( rCharFmtLB.GetEntry(j) );
- aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
- }
aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
rPage.PageCreated(aSet);
- for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
- delete (XubString*)aList.Remove(i);
- aList.Clear();
}
break;
case RID_SVXPAGE_NUM_POSITION:
commit 0bf0dc29e6441a15c1716f01969c88b72b5b8b59
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sat May 21 18:50:49 2011 -0430
Replace List with std::vector<String>.
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 6507bcf..2b8f5e7 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -991,20 +991,16 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
::FillCharStyleListBox(rCharFmtLB, pDocShell);
- List aList;
+
+ std::vector<String> aList;
for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
- {
+ aList.push_back( String(rCharFmtLB.GetEntry(j)));
- aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
- }
aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) );
rPage.PageCreated(aSet);
- for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
- delete (XubString*)aList.Remove(i);
- aList.Clear();
}
break;
case RID_SVXPAGE_NUM_POSITION:
commit 3c7b0e68e05c866afa503157fed1d2aca3f9d5d7
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sat May 21 18:47:21 2011 -0430
Replace List with std::vector<String>.
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 6351356..ae621c6 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -2693,12 +2693,12 @@ void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
{
int nSel = rSh.GetSelectionType();
SfxStringListItem aLst( nWhich );
- List *pLst = aLst.GetList();
+ std::vector<String> &rLst = aLst.GetList();
nParagraphPos = nGraphicPos = nOlePos = nFramePos = nTablePos =
nTableRowPos = nTableCellPos = nPagePos =
nHeaderPos = nFooterPos = 0;
sal_uInt8 nPos = 1;
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PAGE ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_PAGE ) );
nPagePos = nPos++;
sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
sal_Bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
@@ -2706,57 +2706,57 @@ void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
(nSel & nsSelectionType::SEL_TXT) )
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PARAGRAPH ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_PARAGRAPH ) );
nParagraphPos = nPos++;
}
if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
nSel & (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) )
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_TABLE ) );
nTablePos = nPos++;
if(!bHtmlMode)
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_ROW ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_ROW ) );
nTableRowPos = nPos++;
}
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_CELL), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_CELL) );
nTableCellPos = nPos++;
}
if(!bHtmlMode)
{
if ( nSel & nsSelectionType::SEL_FRM )
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FRAME ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_FRAME ) );
nFramePos = nPos++;
}
if ( nSel & nsSelectionType::SEL_GRF )
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_GRAPHIC ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_GRAPHIC ) );
nGraphicPos = nPos++;
}
if ( nSel & nsSelectionType::SEL_OLE )
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_OLE ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_OLE ) );
nOlePos = nPos++;
}
const sal_uInt16 nType = rSh.GetFrmType(0,sal_True);
if ( nType & FRMTYPE_HEADER )
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_HEADER ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_HEADER ) );
nHeaderPos = nPos++;
}
if ( nType & FRMTYPE_FOOTER )
{
- pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FOOTER ), pLst->Count() );
+ rLst.push_back( SW_RESSTR( STR_SWBG_FOOTER ) );
nFooterPos = nPos;
}
}
- if ( pLst->Count() )
- rSet.Put( aLst );
- else
+ if ( rLst.empty() )
rSet.DisableItem( nWhich );
+ else
+ rSet.Put( aLst );
break;
}
}
More information about the Libreoffice-commits
mailing list