[Libreoffice-commits] .: 19 commits - basctl/source cui/source sfx2/source svtools/inc svtools/source sw/inc sw/source
Michael Stahl
mst at kemper.freedesktop.org
Wed Jul 4 14:26:10 PDT 2012
basctl/source/basicide/baside2b.cxx | 4 -
cui/source/options/fontsubs.cxx | 4 -
cui/source/options/optfltr.cxx | 8 +-
cui/source/tabpages/autocdlg.cxx | 8 +-
sfx2/source/appl/linkmgr2.cxx | 8 +-
svtools/inc/svtools/ivctrl.hxx | 1
svtools/inc/svtools/svlbox.hxx | 16 ++--
svtools/inc/svtools/svtreebx.hxx | 4 -
svtools/source/contnr/imivctl.hxx | 45 ++++++-----
svtools/source/contnr/imivctl1.cxx | 78 ++++++++------------
svtools/source/contnr/imivctl2.cxx | 139 +++++++++++++++---------------------
svtools/source/contnr/svimpbox.cxx | 6 -
svtools/source/contnr/svlbox.cxx | 13 +--
svtools/source/contnr/svtabbx.cxx | 2
svtools/source/contnr/svtreebx.cxx | 66 ++++++++---------
sw/inc/acmplwrd.hxx | 5 +
sw/inc/calc.hxx | 8 +-
sw/inc/expfld.hxx | 8 +-
sw/inc/txatritr.hxx | 4 -
sw/source/core/bastyp/calc.cxx | 16 ++--
sw/source/core/bastyp/init.cxx | 8 +-
sw/source/core/doc/acmplwrd.cxx | 110 ++++++++++++----------------
sw/source/core/doc/docdesc.cxx | 11 +-
sw/source/core/doc/docedt.cxx | 25 +++---
sw/source/core/doc/docredln.cxx | 22 ++---
sw/source/core/doc/doctxm.cxx | 17 +---
sw/source/core/fields/fldlst.cxx | 12 +--
sw/source/core/fields/usrfld.cxx | 2
sw/source/core/inc/mvsave.hxx | 2
sw/source/core/txtnode/txatritr.cxx | 25 +++---
30 files changed, 314 insertions(+), 363 deletions(-)
New commits:
commit 488ae25fc8c7624d502d28cc5195395d887e34b0
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 28 12:23:29 2012 +0200
Convert local var from SvPtrarr to std::vector
Change-Id: If19e08f88844d0aec7ad537a8f99e52b96c1a409
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 7bd60b3..147ade7 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -321,7 +321,7 @@ void LinkManager::UpdateAllLinks(
{
// First make a copy of the array in order to update links
// links in ... no contact between them!
- SvPtrarr aTmpArr( 255 );
+ std::vector<SvBaseLink*> aTmpArr;
sal_uInt16 n;
for( n = 0; n < aLinkTbl.size(); ++n )
{
@@ -331,12 +331,12 @@ void LinkManager::UpdateAllLinks(
Remove( n-- );
continue;
}
- aTmpArr.Insert( pLink, aTmpArr.Count() );
+ aTmpArr.push_back( pLink );
}
- for( n = 0; n < aTmpArr.Count(); ++n )
+ for( n = 0; n < aTmpArr.size(); ++n )
{
- SvBaseLink* pLink = (SvBaseLink*)aTmpArr[ n ];
+ SvBaseLink* pLink = aTmpArr[ n ];
// search first in the array after the entry
sal_uInt16 nFndPos = USHRT_MAX;
commit 8ae16bb0017c0f499b10731c4a0b637aeeb58a30
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 28 11:48:11 2012 +0200
Remove unused forward declarations
Change-Id: I30514b3ff2d63b039496b1e336447ed129ca6a18
diff --git a/svtools/inc/svtools/ivctrl.hxx b/svtools/inc/svtools/ivctrl.hxx
index 46e8cc7..ed2ccd8 100644
--- a/svtools/inc/svtools/ivctrl.hxx
+++ b/svtools/inc/svtools/ivctrl.hxx
@@ -37,7 +37,6 @@
#include <vcl/image.hxx>
#include <vcl/seleng.hxx>
-class SvPtrarr;
class ResId;
class Point;
class SvxIconChoiceCtrl_Impl;
commit ebde6c7e3e816980dfe32086783a165f3d0019b1
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 28 11:02:42 2012 +0200
Convert aItems field of SvLBoxEntry class from SvPtrarr to std::vector
Change-Id: I96d676ded52ebdf0f68b051b06cecf717d56e813
diff --git a/svtools/inc/svtools/svlbox.hxx b/svtools/inc/svtools/svlbox.hxx
index 92aa946..ea18d05 100644
--- a/svtools/inc/svtools/svlbox.hxx
+++ b/svtools/inc/svtools/svlbox.hxx
@@ -183,24 +183,28 @@ class SVT_DLLPUBLIC SvLBoxEntry : public SvListEntry
{
friend class SvLBox;
- SvPtrarr aItems;
- void* pUserData;
- sal_uInt16 nEntryFlags;
+ std::vector<SvLBoxItem*> aItems;
+ void* pUserData;
+ sal_uInt16 nEntryFlags;
SVT_DLLPRIVATE void DeleteItems_Impl();
public:
SvLBoxEntry();
virtual ~SvLBoxEntry();
- sal_uInt16 ItemCount() const { return (sal_uInt16)aItems.Count(); }
+ sal_uInt16 ItemCount() const { return (sal_uInt16)aItems.size(); }
// DARF NUR GERUFEN WERDEN, WENN DER EINTRAG NOCH NICHT IM MODEL
// EINGEFUEGT IST, DA SONST FUER DAS ITEM KEINE VIEW-ABHAENGIGEN
// DATEN ALLOZIERT WERDEN!
void AddItem( SvLBoxItem* pItem );
void ReplaceItem( SvLBoxItem* pNewItem, sal_uInt16 nPos );
- SvLBoxItem* GetItem( sal_uInt16 nPos ) const { return (SvLBoxItem*)aItems.GetObject(nPos ); }
+ SvLBoxItem* GetItem( sal_uInt16 nPos ) const { return aItems[nPos]; }
SvLBoxItem* GetFirstItem( sal_uInt16 nId );
- sal_uInt16 GetPos( SvLBoxItem* pItem ) const { return aItems.GetPos( pItem ); }
+ sal_uInt16 GetPos( SvLBoxItem* pItem ) const
+ {
+ std::vector<SvLBoxItem*>::const_iterator it = std::find( aItems.begin(), aItems.end(), pItem );
+ return it == aItems.end() ? USHRT_MAX : it - aItems.begin();
+ }
void* GetUserData() const { return pUserData; }
void SetUserData( void* pPtr ) { pUserData = pPtr; }
virtual void Clone( SvListEntry* pSource );
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx
index 617428d..d0d30ad 100644
--- a/svtools/source/contnr/svlbox.cxx
+++ b/svtools/source/contnr/svlbox.cxx
@@ -408,21 +408,21 @@ SvLBoxEntry::~SvLBoxEntry()
void SvLBoxEntry::DeleteItems_Impl()
{
DBG_CHKTHIS(SvLBoxEntry,0);
- sal_uInt16 nCount = aItems.Count();
+ sal_uInt16 nCount = aItems.size();
while( nCount )
{
nCount--;
- SvLBoxItem* pItem = (SvLBoxItem*)aItems.GetObject( nCount );
+ SvLBoxItem* pItem = aItems[ nCount ];
delete pItem;
}
- aItems.Remove(0, aItems.Count() );
+ aItems.clear();
}
void SvLBoxEntry::AddItem( SvLBoxItem* pItem )
{
DBG_CHKTHIS(SvLBoxEntry,0);
- aItems.Insert( pItem, aItems.Count() );
+ aItems.push_back( pItem );
}
void SvLBoxEntry::Clone( SvListEntry* pSource )
@@ -461,15 +461,14 @@ void SvLBoxEntry::ReplaceItem( SvLBoxItem* pNewItem, sal_uInt16 nPos )
SvLBoxItem* pOld = GetItem( nPos );
if ( pOld )
{
- aItems.Remove( nPos );
- aItems.Insert( pNewItem, nPos );
+ aItems[ nPos ] = pNewItem;
delete pOld;
}
}
SvLBoxItem* SvLBoxEntry::GetFirstItem( sal_uInt16 nId )
{
- sal_uInt16 nCount = aItems.Count();
+ sal_uInt16 nCount = aItems.size();
sal_uInt16 nCur = 0;
SvLBoxItem* pItem;
while( nCur < nCount )
commit a87c24fcfe1d8842d892185d6f9f2e07c52c3804
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 28 10:06:59 2012 +0200
Convert aTabs field in SvTreeListBox from SvPtrarr to std::vector
Change-Id: I901c6df67fc95cfb2ac3ea15e69a47c5fc3161b6
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index d674fd1..3313995 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1769,10 +1769,10 @@ WatchTreeListBox::~WatchTreeListBox()
void WatchTreeListBox::SetTabs()
{
SvHeaderTabListBox::SetTabs();
- sal_uInt16 nTabCount_ = aTabs.Count();
+ sal_uInt16 nTabCount_ = aTabs.size();
for( sal_uInt16 i = 0 ; i < nTabCount_ ; i++ )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(i);
+ SvLBoxTab* pTab = aTabs[i];
if( i == 2 )
pTab->nFlags |= SV_LBOXTAB_EDITABLE;
else
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index 191799f..7f65c50 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -468,11 +468,11 @@ void SvxFontSubstCheckListBox::SetTabs()
SvxSimpleTable::SetTabs();
sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ SvLBoxTab* pTab = aTabs[1];
pTab->nFlags &= ~nAdjust;
pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
- pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ pTab = aTabs[2];
pTab->nFlags &= ~nAdjust;
pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
}
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index 5300a84..5a6474e 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -322,15 +322,15 @@ void OfaMSFilterTabPage2::MSFltrSimpleTable::SetTabs()
SvxSimpleTable::SetTabs();
sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
- if( aTabs.Count() > 1 )
+ if( aTabs.size() > 1 )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ SvLBoxTab* pTab = aTabs[1];
pTab->nFlags &= ~nAdjust;
pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
}
- if( aTabs.Count() > 2 )
+ if( aTabs.size() > 2 )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ SvLBoxTab* pTab = aTabs[2];
pTab->nFlags &= ~nAdjust;
pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
}
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index c459791..2643aa4 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -808,15 +808,15 @@ void OfaACorrCheckListBox::SetTabs()
SvxSimpleTable::SetTabs();
sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
- if( aTabs.Count() > 1 )
+ if( aTabs.size() > 1 )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ SvLBoxTab* pTab = aTabs[1];
pTab->nFlags &= ~nAdjust;
pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
}
- if( aTabs.Count() > 2 )
+ if( aTabs.size() > 2 )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ SvLBoxTab* pTab = aTabs[2];
pTab->nFlags &= ~nAdjust;
pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
}
diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx
index b6f1bab..b656bdb 100644
--- a/svtools/inc/svtools/svtreebx.hxx
+++ b/svtools/inc/svtools/svtreebx.hxx
@@ -115,7 +115,7 @@ protected:
void EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
const Point& rMousePos );
- SvPtrarr aTabs;
+ std::vector<SvLBoxTab*> aTabs;
// berechnet abhaengig von TreeList-Style & Bitmap-Groessen
// alle Tabulatoren neu; wird beim Einfuegen/Austauschen von
@@ -124,7 +124,7 @@ protected:
void SetTabs_Impl();
void AddTab( long nPos,sal_uInt16 nFlags=SV_LBOXTAB_ADJUST_LEFT,
void* pUserData = 0 );
- sal_uInt16 TabCount() const { return aTabs.Count(); }
+ sal_uInt16 TabCount() const { return aTabs.size(); }
SvLBoxTab* GetFirstDynamicTab() const;
SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
SvLBoxTab* GetFirstTab( sal_uInt16 nFlagMask, sal_uInt16& rTabPos );
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 9b0baec..21a0e4a 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -3285,14 +3285,14 @@ sal_Bool SvImpLBox::SetMostRight( SvLBoxEntry* pEntry )
nFlags &= ~F_IGNORE_CHANGED_TABS;
}
- sal_uInt16 nLastTab = pView->aTabs.Count() - 1;
+ sal_uInt16 nLastTab = pView->aTabs.size() - 1;
sal_uInt16 nLastItem = pEntry->ItemCount() - 1;
- if( nLastTab != USHRT_MAX && nLastItem != USHRT_MAX )
+ if( !pView->aTabs.empty() && nLastItem != USHRT_MAX )
{
if( nLastItem < nLastTab )
nLastTab = nLastItem;
- SvLBoxTab* pTab = (SvLBoxTab*)pView->aTabs[ nLastTab ];
+ SvLBoxTab* pTab = pView->aTabs[ nLastTab ];
SvLBoxItem* pItem = pEntry->GetItem( nLastTab );
long nTabPos = pView->GetTabPos( pEntry, pTab );
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index ad14ca3..ad019f4 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -543,7 +543,7 @@ long SvTabListBox::GetLogicTab( sal_uInt16 nTab )
((SvTabListBox*)this)->SetTabs();
DBG_ASSERT(nTab<nTabCount,"GetTabPos:Invalid Tab");
- return ((SvLBoxTab*)aTabs.GetObject( nTab ))->GetPos();
+ return aTabs[ nTab ]->GetPos();
}
// class SvHeaderTabListBoxImpl ------------------------------------------
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index d57f8b6..fe513db 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -1255,10 +1255,10 @@ void SvTreeListBox::EditItemText( SvLBoxEntry* pEntry, SvLBoxString* pItem,
aPos.X() = GetTabPos( pEntry, pTab );
long nOutputWidth = pImp->GetOutputSize().Width();
Size aSize( nOutputWidth - aPos.X(), aItemSize.Height() );
- sal_uInt16 nPos = aTabs.GetPos( pTab );
- if( nPos+1 < aTabs.Count() )
+ sal_uInt16 nPos = std::find( aTabs.begin(), aTabs.end(), pTab ) - aTabs.begin();
+ if( nPos+1 < (sal_uInt16)aTabs.size() )
{
- SvLBoxTab* pRightTab = (SvLBoxTab*)aTabs.GetObject( nPos + 1 );
+ SvLBoxTab* pRightTab = aTabs[ nPos + 1 ];
long nRight = GetTabPos( pEntry, pRightTab );
if( nRight <= nOutputWidth )
aSize.Width() = nRight - aPos.X();
@@ -1525,16 +1525,16 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl
SvViewDataEntry* pViewDataEntry = GetViewDataEntry( pEntry );
- sal_uInt16 nTabCount = aTabs.Count();
+ sal_uInt16 nTabCount = aTabs.size();
sal_uInt16 nItemCount = pEntry->ItemCount();
sal_uInt16 nCurTab = 0;
sal_uInt16 nCurItem = 0;
while( nCurTab < nTabCount && nCurItem < nItemCount )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject( nCurTab );
+ SvLBoxTab* pTab = aTabs[ nCurTab ];
sal_uInt16 nNextTab = nCurTab + 1;
- SvLBoxTab* pNextTab = nNextTab < nTabCount ? (SvLBoxTab*)aTabs.GetObject(nNextTab) : 0;
+ SvLBoxTab* pNextTab = nNextTab < nTabCount ? aTabs[nNextTab] : 0;
SvLBoxItem* pItem = nCurItem < nItemCount ? pEntry->GetItem(nCurItem) : 0;
sal_uInt16 nFlags = pTab->nFlags;
@@ -1704,7 +1704,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl
do
{
nNextTab++;
- pNextTab = nNextTab < nTabCount ? (SvLBoxTab*)aTabs.GetObject(nNextTab) : 0;
+ pNextTab = nNextTab < nTabCount ? aTabs[nNextTab] : 0;
} while( pNextTab && pNextTab->IsDynamic() );
if( !pNextTab || (GetTabPos( pEntry, pNextTab ) > nDynTabPos) )
@@ -1795,9 +1795,9 @@ Rectangle SvTreeListBox::GetFocusRect( SvLBoxEntry* pEntry, long nLine )
if( pTab )
nTabPos = GetTabPos( pEntry, pTab );
long nNextTabPos;
- if( pTab && nCurTab < aTabs.Count() - 1 )
+ if( pTab && nCurTab < aTabs.size() - 1 )
{
- SvLBoxTab* pNextTab = (SvLBoxTab*)aTabs.GetObject( nCurTab + 1 );
+ SvLBoxTab* pNextTab = aTabs[ nCurTab + 1 ];
nNextTabPos = GetTabPos( pEntry, pNextTab );
}
else
@@ -1835,8 +1835,8 @@ Rectangle SvTreeListBox::GetFocusRect( SvLBoxEntry* pEntry, long nLine )
sal_uInt16 nLastTab;
SvLBoxTab* pLastTab = GetLastTab(SV_LBOXTAB_SHOW_SELECTION,nLastTab);
nLastTab++;
- if( nLastTab < aTabs.Count() ) // is there another one?
- pLastTab = (SvLBoxTab*)aTabs.GetObject( nLastTab );
+ if( nLastTab < aTabs.size() ) // is there another one?
+ pLastTab = aTabs[ nLastTab ];
else
pLastTab = 0; // select whole width
aSize.Width() = pLastTab ? pLastTab->GetPos() : 0x0fffffff;
@@ -1892,9 +1892,9 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvLBoxEntry* pEntry, long nX,
{
DBG_CHKTHIS(SvTreeListBox,0);
SvLBoxItem* pItemClicked = 0;
- sal_uInt16 nTabCount = aTabs.Count();
+ sal_uInt16 nTabCount = aTabs.size();
sal_uInt16 nItemCount = pEntry->ItemCount();
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(0);
+ SvLBoxTab* pTab = aTabs.front();
SvLBoxItem* pItem = pEntry->GetItem(0);
sal_uInt16 nNextItem = 1;
nX -= GetMapMode().GetOrigin().X();
@@ -1903,7 +1903,7 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvLBoxEntry* pEntry, long nX,
while( 1 )
{
- SvLBoxTab* pNextTab=nNextItem<nTabCount ? (SvLBoxTab*)aTabs.GetObject(nNextItem) : 0;
+ SvLBoxTab* pNextTab=nNextItem<nTabCount ? aTabs[nNextItem] : 0;
long nStart = GetTabPos( pEntry, pTab );
long nNextTabPos;
@@ -1940,7 +1940,7 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvLBoxEntry* pEntry, long nX,
}
if( nNextItem >= nItemCount || nNextItem >= nTabCount)
break;
- pTab = (SvLBoxTab*)aTabs.GetObject( nNextItem );
+ pTab = aTabs[ nNextItem ];
pItem = pEntry->GetItem( nNextItem );
nNextItem++;
}
@@ -1965,10 +1965,10 @@ void SvTreeListBox::AddTab(long nTabPos,sal_uInt16 nFlags,void* pUserData )
nFocusWidth = -1;
SvLBoxTab* pTab = new SvLBoxTab( nTabPos, nFlags );
pTab->SetUserData( pUserData );
- aTabs.Insert( pTab, aTabs.Count() );
+ aTabs.push_back( pTab );
if( nTreeFlags & TREEFLAG_USESEL )
{
- sal_uInt16 nPos = aTabs.Count() - 1;
+ sal_uInt16 nPos = aTabs.size() - 1;
if( nPos >= nFirstSelTab && nPos <= nLastSelTab )
pTab->nFlags |= SV_LBOXTAB_SHOW_SELECTION;
else
@@ -1984,10 +1984,10 @@ SvLBoxTab* SvTreeListBox::GetFirstDynamicTab( sal_uInt16& rPos ) const
{
DBG_CHKTHIS(SvTreeListBox,0);
sal_uInt16 nCurTab = 0;
- sal_uInt16 nTabCount = aTabs.Count();
+ sal_uInt16 nTabCount = aTabs.size();
while( nCurTab < nTabCount )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(nCurTab);
+ SvLBoxTab* pTab = aTabs[nCurTab];
if( pTab->nFlags & SV_LBOXTAB_DYNAMIC )
{
rPos = nCurTab;
@@ -2008,20 +2008,20 @@ SvLBoxTab* SvTreeListBox::GetTab( SvLBoxEntry* pEntry, SvLBoxItem* pItem) const
{
DBG_CHKTHIS(SvTreeListBox,0);
sal_uInt16 nPos = pEntry->GetPos( pItem );
- return (SvLBoxTab*)aTabs.GetObject( nPos );
+ return aTabs[ nPos ];
}
void SvTreeListBox::ClearTabList()
{
DBG_CHKTHIS(SvTreeListBox,0);
- sal_uInt16 nTabCount = aTabs.Count();
+ sal_uInt16 nTabCount = aTabs.size();
while( nTabCount )
{
nTabCount--;
- SvLBoxTab* pDelTab = (SvLBoxTab*)aTabs.GetObject( nTabCount );
+ SvLBoxTab* pDelTab = aTabs[ nTabCount ];
delete pDelTab;
}
- aTabs.Remove(0,aTabs.Count());
+ aTabs.clear();
}
@@ -2154,10 +2154,10 @@ void SvTreeListBox::RemoveParentKeepChildren( SvLBoxEntry* pParent )
SvLBoxTab* SvTreeListBox::GetFirstTab( sal_uInt16 nFlagMask, sal_uInt16& rPos )
{
- sal_uInt16 nTabCount = aTabs.Count();
+ sal_uInt16 nTabCount = aTabs.size();
for( sal_uInt16 nPos = 0; nPos < nTabCount; nPos++ )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject( nPos );
+ SvLBoxTab* pTab = aTabs[ nPos ];
if( (pTab->nFlags & nFlagMask) )
{
rPos = nPos;
@@ -2170,17 +2170,15 @@ SvLBoxTab* SvTreeListBox::GetFirstTab( sal_uInt16 nFlagMask, sal_uInt16& rPos )
SvLBoxTab* SvTreeListBox::GetLastTab( sal_uInt16 nFlagMask, sal_uInt16& rTabPos )
{
- short nTabCount = (short)aTabs.Count();
- if( nTabCount )
+ sal_uInt16 nPos = (sal_uInt16)aTabs.size();
+ while( nPos )
{
- for( short nPos = nTabCount-1; nPos >= 0; nPos-- )
+ --nPos;
+ SvLBoxTab* pTab = aTabs[ nPos ];
+ if( (pTab->nFlags & nFlagMask) )
{
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject( (sal_uInt16)nPos );
- if( (pTab->nFlags & nFlagMask) )
- {
- rTabPos = (sal_uInt16)nPos;
- return pTab;
- }
+ rTabPos = nPos;
+ return pTab;
}
}
rTabPos = 0xffff;
commit 09a61733bf4352edfc7fe341e9342594557ed02f
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jul 4 23:03:55 2012 +0200
fix previous STL conversion commit:
- the reverse_iterator actually points to the element preceding the
original "it", so on the first iteration it shouldn't be incremented,
as that has happened implicitly already
- it's best to use iterators to iterate over maps
- also fix some pre-existing operator delete[] mismatch
Change-Id: I969d1b79eb970792ee8b0578347ffb59d5a64379
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index 19f7bdb..a45dafe 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -576,8 +576,8 @@ typedef std::map<sal_uInt16, SvxIconChoiceCtrlEntryPtrVec> IconChoiceMap;
class IcnCursor_Impl
{
SvxIconChoiceCtrl_Impl* pView;
- IconChoiceMap* pColumns;
- IconChoiceMap* pRows;
+ boost::scoped_ptr<IconChoiceMap> pColumns;
+ boost::scoped_ptr<IconChoiceMap> pRows;
long nCols;
long nRows;
short nDeltaWidth;
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index b52607f..d480977 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -2985,9 +2985,11 @@ void SvxIconChoiceCtrl_Impl::AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart )
{
IconChoiceMap aLists;
pImpCursor->CreateGridAjustData( aLists, pStart );
- const sal_uInt16 nCount = aLists.size();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- AdjustAtGrid( aLists[ nCur ], pStart );
+ for (IconChoiceMap::const_iterator iter = aLists.begin();
+ iter != aLists.end(); ++iter)
+ {
+ AdjustAtGrid(iter->second, pStart);
+ }
IcnCursor_Impl::DestroyGridAdjustData( aLists );
CheckScrollBars();
}
diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx
index 0b381c6..de19b97 100644
--- a/svtools/source/contnr/imivctl2.cxx
+++ b/svtools/source/contnr/imivctl2.cxx
@@ -31,8 +31,6 @@
IcnCursor_Impl::IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner )
{
pView = pOwner;
- pColumns = 0;
- pRows = 0;
pCurEntry = 0;
nDeltaWidth = 0;
nDeltaHeight= 0;
@@ -42,8 +40,6 @@ IcnCursor_Impl::IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner )
IcnCursor_Impl::~IcnCursor_Impl()
{
- delete[] pColumns;
- delete[] pRows;
}
sal_uInt16 IcnCursor_Impl::GetSortListPos( SvxIconChoiceCtrlEntryPtrVec& rList, long nValue,
@@ -79,8 +75,8 @@ void IcnCursor_Impl::ImplCreate()
SetDeltas();
- pColumns = new IconChoiceMap;
- pRows = new IconChoiceMap;
+ pColumns.reset(new IconChoiceMap);
+ pRows.reset(new IconChoiceMap);
size_t nCount = pView->aEntries.size();
for( size_t nCur = 0; nCur < nCount; nCur++ )
@@ -117,10 +113,8 @@ void IcnCursor_Impl::Clear()
{
if( pColumns )
{
- delete[] pColumns;
- delete[] pRows;
- pColumns = 0;
- pRows = 0;
+ pColumns.reset();
+ pRows.reset();
pCurEntry = 0;
nDeltaWidth = 0;
nDeltaHeight = 0;
@@ -159,12 +153,13 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol, sal_uInt16 nT
else
{
SvxIconChoiceCtrlEntryPtrVec::const_reverse_iterator it2(it);
- while( ++it2 != rList.rend() )
+ while (it2 != rList.rend())
{
SvxIconChoiceCtrlEntry* pEntry = *it2;
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
if( rRect.Top() < rRefRect.Top() )
return pEntry;
+ ++it2;
}
return 0;
}
@@ -233,12 +228,13 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow, sal_uInt16 nL
else
{
SvxIconChoiceCtrlEntryPtrVec::const_reverse_iterator it2(it);
- while( ++it2 != rList.rend() )
+ while (it2 != rList.rend())
{
- SvxIconChoiceCtrlEntry* pEntry = *it;
+ SvxIconChoiceCtrlEntry* pEntry = *it2;
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
if( rRect.Left() < rRefRect.Left() )
return pEntry;
+ ++it2;
}
return 0;
}
commit 2c09f1c0a7747a625c375028d02a30c0c0e1a893
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 28 08:21:54 2012 +0200
Convert SvPtrarr to std::vector<SvxIconChoiceCtrlEntry*>
Change-Id: I70a3907f659f26817bca5c7049a0f301ae5f10ed
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index 96512aa..19f7bdb 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -39,7 +39,6 @@
#include <limits.h>
#include <svtools/ivctrl.hxx>
-#include <svl/svarray.hxx>
#include <boost/ptr_container/ptr_map.hpp>
class IcnCursor_Impl;
@@ -159,6 +158,7 @@ public:
//
typedef boost::ptr_map<sal_uInt16, SvxIconChoiceCtrlColumnInfo> SvxIconChoiceCtrlColumnInfoMap;
+typedef std::vector<SvxIconChoiceCtrlEntry*> SvxIconChoiceCtrlEntryPtrVec;
class SvxIconChoiceCtrl_Impl
{
@@ -288,7 +288,7 @@ class SvxIconChoiceCtrl_Impl
Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const;
void ClipAtVirtOutRect( Rectangle& rRect ) const;
- void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
+ void AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
Point AdjustAtGrid(
const Rectangle& rCenterRect, // balance point of object (typically Bmp-Rect)
const Rectangle& rBoundRect
@@ -571,11 +571,13 @@ public:
// ----------------------------------------------------------------------------------------------
+typedef std::map<sal_uInt16, SvxIconChoiceCtrlEntryPtrVec> IconChoiceMap;
+
class IcnCursor_Impl
{
SvxIconChoiceCtrl_Impl* pView;
- SvPtrarr* pColumns;
- SvPtrarr* pRows;
+ IconChoiceMap* pColumns;
+ IconChoiceMap* pRows;
long nCols;
long nRows;
short nDeltaWidth;
@@ -585,14 +587,17 @@ class IcnCursor_Impl
void ImplCreate();
void Create() { if( !pColumns ) ImplCreate(); }
- sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
+ sal_uInt16 GetSortListPos(
+ SvxIconChoiceCtrlEntryPtrVec& rList,
+ long nValue,
+ int bVertical);
SvxIconChoiceCtrlEntry* SearchCol(
sal_uInt16 nCol,
sal_uInt16 nTop,
sal_uInt16 nBottom,
sal_uInt16 nPref,
- sal_Bool bDown,
- sal_Bool bSimple
+ bool bDown,
+ bool bSimple
);
SvxIconChoiceCtrlEntry* SearchRow(
@@ -600,8 +605,8 @@ class IcnCursor_Impl
sal_uInt16 nRight,
sal_uInt16 nLeft,
sal_uInt16 nPref,
- sal_Bool bRight,
- sal_Bool bSimple
+ bool bRight,
+ bool bSimple
);
public:
@@ -617,8 +622,8 @@ public:
// Creates a list of entries for every row (height = nGridDY) sorted by
// BoundRect.Left(). A list may be empty. The lists become the property of
// the caller and have to be deleted with DestroyGridAdjustData.
- void CreateGridAjustData( SvPtrarr& pLists, SvxIconChoiceCtrlEntry* pRow=0);
- static void DestroyGridAdjustData( SvPtrarr& rLists );
+ void CreateGridAjustData( IconChoiceMap& pLists, SvxIconChoiceCtrlEntry* pRow=0);
+ static void DestroyGridAdjustData( IconChoiceMap& rLists );
};
// ----------------------------------------------------------------------------------------------
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index e762253..b52607f 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -2983,19 +2983,19 @@ IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, EditTimeoutHdl)
// else: align all entries of the row from pStart on (including pStart)
void SvxIconChoiceCtrl_Impl::AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart )
{
- SvPtrarr aLists;
+ IconChoiceMap aLists;
pImpCursor->CreateGridAjustData( aLists, pStart );
- const sal_uInt16 nCount = aLists.Count();
+ const sal_uInt16 nCount = aLists.size();
for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- AdjustAtGrid( *(SvPtrarr*)aLists[ nCur ], pStart );
+ AdjustAtGrid( aLists[ nCur ], pStart );
IcnCursor_Impl::DestroyGridAdjustData( aLists );
CheckScrollBars();
}
// align a row, might expand width, doesn't break the line
-void SvxIconChoiceCtrl_Impl::AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart )
+void SvxIconChoiceCtrl_Impl::AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow, SvxIconChoiceCtrlEntry* pStart )
{
- if( !rRow.Count() )
+ if( rRow.empty() )
return;
sal_Bool bGo;
@@ -3005,9 +3005,9 @@ void SvxIconChoiceCtrl_Impl::AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCt
bGo = sal_False;
long nCurRight = 0;
- for( sal_uInt16 nCur = 0; nCur < rRow.Count(); nCur++ )
+ for( sal_uInt16 nCur = 0; nCur < rRow.size(); nCur++ )
{
- SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)rRow[ nCur ];
+ SvxIconChoiceCtrlEntry* pCur = rRow[ nCur ];
if( !bGo && pCur == pStart )
bGo = sal_True;
diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx
index 0bb77a9..0b381c6 100644
--- a/svtools/source/contnr/imivctl2.cxx
+++ b/svtools/source/contnr/imivctl2.cxx
@@ -46,10 +46,10 @@ IcnCursor_Impl::~IcnCursor_Impl()
delete[] pRows;
}
-sal_uInt16 IcnCursor_Impl::GetSortListPos( SvPtrarr* pList, long nValue,
+sal_uInt16 IcnCursor_Impl::GetSortListPos( SvxIconChoiceCtrlEntryPtrVec& rList, long nValue,
int bVertical )
{
- sal_uInt16 nCount = (sal_uInt16)pList->Count();
+ sal_uInt16 nCount = rList.size();
if( !nCount )
return 0;
@@ -57,8 +57,7 @@ sal_uInt16 IcnCursor_Impl::GetSortListPos( SvPtrarr* pList, long nValue,
long nPrevValue = LONG_MIN;
while( nCount )
{
- const Rectangle& rRect=
- pView->GetEntryBoundRect((SvxIconChoiceCtrlEntry*)(pList->GetObject(nCurPos)));
+ const Rectangle& rRect = pView->GetEntryBoundRect( rList[nCurPos] );
long nCurValue;
if( bVertical )
nCurValue = rRect.Top();
@@ -70,7 +69,7 @@ sal_uInt16 IcnCursor_Impl::GetSortListPos( SvPtrarr* pList, long nValue,
nCount--;
nCurPos++;
}
- return pList->Count();
+ return rList.size();
}
void IcnCursor_Impl::ImplCreate()
@@ -80,8 +79,8 @@ void IcnCursor_Impl::ImplCreate()
SetDeltas();
- pColumns = new SvPtrarr[ nCols ];
- pRows = new SvPtrarr[ nRows ];
+ pColumns = new IconChoiceMap;
+ pRows = new IconChoiceMap;
size_t nCount = pView->aEntries.size();
for( size_t nCur = 0; nCur < nCount; nCur++ )
@@ -98,11 +97,13 @@ void IcnCursor_Impl::ImplCreate()
if( nX >= nCols )
nX = sal::static_int_cast< short >(nCols - 1);
- sal_uInt16 nIns = GetSortListPos( &pColumns[nX], rRect.Top(), sal_True );
- pColumns[ nX ].Insert( pEntry, nIns );
+ SvxIconChoiceCtrlEntryPtrVec& rColEntry = (*pColumns)[nX];
+ sal_uInt16 nIns = GetSortListPos( rColEntry, rRect.Top(), sal_True );
+ rColEntry.insert( rColEntry.begin() + nIns, pEntry );
- nIns = GetSortListPos( &pRows[nY], rRect.Left(), sal_False );
- pRows[ nY ].Insert( pEntry, nIns );
+ SvxIconChoiceCtrlEntryPtrVec& rRowEntry = (*pRows)[nY];
+ nIns = GetSortListPos( rRowEntry, rRect.Left(), sal_False );
+ rRowEntry.insert( rRowEntry.begin() + nIns, pEntry );
pEntry->nX = nX;
pEntry->nY = nY;
@@ -126,12 +127,15 @@ void IcnCursor_Impl::Clear()
}
}
-SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,
- sal_uInt16, sal_Bool bDown, sal_Bool bSimple )
+SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol, sal_uInt16 nTop, sal_uInt16 nBottom,
+ sal_uInt16, bool bDown, bool bSimple )
{
- DBG_ASSERT(pCurEntry,"SearchCol: No reference entry");
- SvPtrarr* pList = &(pColumns[ nCol ]);
- const sal_uInt16 nCount = pList->Count();
+ DBG_ASSERT(pCurEntry, "SearchCol: No reference entry");
+ IconChoiceMap::iterator mapIt = pColumns->find( nCol );
+ if ( mapIt == pColumns->end() )
+ return 0;
+ SvxIconChoiceCtrlEntryPtrVec& rList = mapIt->second;
+ const sal_uInt16 nCount = rList.size();
if( !nCount )
return 0;
@@ -139,14 +143,13 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol,sal_uInt16 nTo
if( bSimple )
{
- sal_uInt16 nListPos = pList->GetPos( pCurEntry );
- DBG_ASSERT(nListPos!=0xffff,"Entry not in Col-List");
+ SvxIconChoiceCtrlEntryPtrVec::const_iterator it = std::find( rList.begin(), rList.end(), pCurEntry );
+ DBG_ASSERT( it != rList.end(), "Entry not in Col-List" );
if( bDown )
{
- while( nListPos < nCount-1 )
+ while( ++it != rList.end() )
{
- nListPos++;
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
+ SvxIconChoiceCtrlEntry* pEntry = *it;
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
if( rRect.Top() > rRefRect.Top() )
return pEntry;
@@ -155,16 +158,13 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol,sal_uInt16 nTo
}
else
{
- while( nListPos )
+ SvxIconChoiceCtrlEntryPtrVec::const_reverse_iterator it2(it);
+ while( ++it2 != rList.rend() )
{
- nListPos--;
- if( nListPos < nCount )
- {
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
- const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
- if( rRect.Top() < rRefRect.Top() )
- return pEntry;
- }
+ SvxIconChoiceCtrlEntry* pEntry = *it2;
+ const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
+ if( rRect.Top() < rRefRect.Top() )
+ return pEntry;
}
return 0;
}
@@ -180,7 +180,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol,sal_uInt16 nTo
SvxIconChoiceCtrlEntry* pResult = 0;
for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pList->GetObject( nCur ));
+ SvxIconChoiceCtrlEntry* pEntry = rList[ nCur ];
if( pEntry != pCurEntry )
{
sal_uInt16 nY = pEntry->nY;
@@ -201,12 +201,15 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol,sal_uInt16 nTo
return pResult;
}
-SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow,sal_uInt16 nLeft,sal_uInt16 nRight,
- sal_uInt16, sal_Bool bRight, sal_Bool bSimple )
+SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow, sal_uInt16 nLeft, sal_uInt16 nRight,
+ sal_uInt16, bool bRight, bool bSimple )
{
DBG_ASSERT(pCurEntry,"SearchRow: No reference entry");
- SvPtrarr* pList = &(pRows[ nRow ]);
- const sal_uInt16 nCount = pList->Count();
+ IconChoiceMap::iterator mapIt = pRows->find( nRow );
+ if ( mapIt == pRows->end() )
+ return 0;
+ SvxIconChoiceCtrlEntryPtrVec& rList = mapIt->second;
+ const sal_uInt16 nCount = rList.size();
if( !nCount )
return 0;
@@ -214,14 +217,13 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow,sal_uInt16 nLe
if( bSimple )
{
- sal_uInt16 nListPos = pList->GetPos( pCurEntry );
- DBG_ASSERT(nListPos!=0xffff,"Entry not in Row-List");
+ SvxIconChoiceCtrlEntryPtrVec::const_iterator it = std::find( rList.begin(), rList.end(), pCurEntry );
+ DBG_ASSERT( it != rList.end(), "Entry not in Row-List" );
if( bRight )
{
- while( nListPos < nCount-1 )
+ while( ++it != rList.end() )
{
- nListPos++;
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
+ SvxIconChoiceCtrlEntry* pEntry = *it;
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
if( rRect.Left() > rRefRect.Left() )
return pEntry;
@@ -230,16 +232,13 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow,sal_uInt16 nLe
}
else
{
- while( nListPos )
+ SvxIconChoiceCtrlEntryPtrVec::const_reverse_iterator it2(it);
+ while( ++it2 != rList.rend() )
{
- nListPos--;
- if( nListPos < nCount )
- {
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
- const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
- if( rRect.Left() < rRefRect.Left() )
- return pEntry;
- }
+ SvxIconChoiceCtrlEntry* pEntry = *it;
+ const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
+ if( rRect.Left() < rRefRect.Left() )
+ return pEntry;
}
return 0;
}
@@ -255,7 +254,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow,sal_uInt16 nLe
SvxIconChoiceCtrlEntry* pResult = 0;
for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pList->GetObject( nCur ));
+ SvxIconChoiceCtrlEntry* pEntry = rList[ nCur ];
if( pEntry != pCurEntry )
{
sal_uInt16 nX = pEntry->nX;
@@ -488,7 +487,7 @@ void IcnCursor_Impl::SetDeltas()
}
}
-void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEntry* pRefEntry)
+void IcnCursor_Impl::CreateGridAjustData( IconChoiceMap& rLists, SvxIconChoiceCtrlEntry* pRefEntry)
{
if( !pRefEntry )
{
@@ -497,19 +496,14 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt
if( !nGridRows )
return;
- for( sal_uInt16 nCurList = 0; nCurList < nGridRows; nCurList++ )
- {
- SvPtrarr* pRow = new SvPtrarr;
- rLists.Insert( (void*)pRow, nCurList );
- }
const size_t nCount = pView->aEntries.size();
for( size_t nCur = 0; nCur < nCount; nCur++ )
{
SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ];
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
- sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False);
- ((SvPtrarr*)rLists[ nY ])->Insert( pEntry, nIns );
+ sal_uInt16 nIns = GetSortListPos( rLists[nY], rRect.Left(), sal_False );
+ rLists[ nY ].insert( rLists[ nY ].begin() + nIns, pEntry );
}
}
else
@@ -519,8 +513,7 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt
Rectangle rRefRect( pView->CalcBmpRect( pRefEntry ) );
//const Rectangle& rRefRect = pView->GetEntryBoundRect( pRefEntry );
short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY );
- SvPtrarr* pRow = new SvPtrarr;
- rLists.Insert( (void*)pRow, 0 );
+ SvxIconChoiceCtrlEntryPtrVec& rRow = rLists[0];
size_t nCount = pView->aEntries.size();
for( size_t nCur = 0; nCur < nCount; nCur++ )
{
@@ -530,23 +523,17 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
if( nY == nRefRow )
{
- sal_uInt16 nIns = GetSortListPos( pRow, rRect.Left(), sal_False );
- pRow->Insert( pEntry, nIns );
+ sal_uInt16 nIns = GetSortListPos( rRow, rRect.Left(), sal_False );
+ rRow.insert( rRow.begin() + nIns, pEntry );
}
}
}
}
//static
-void IcnCursor_Impl::DestroyGridAdjustData( SvPtrarr& rLists )
+void IcnCursor_Impl::DestroyGridAdjustData( IconChoiceMap& rLists )
{
- const sal_uInt16 nCount = rLists.Count();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- SvPtrarr* pArr = (SvPtrarr*)rLists[ nCur ];
- delete pArr;
- }
- rLists.Remove( 0, rLists.Count() );
+ rLists.clear();
}
IcnGridMap_Impl::IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView)
commit a6edbee5f827c8b8f1dde87933f54aae18dc2863
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jul 4 22:07:13 2012 +0200
fix previous STL conversion commit:
Change-Id: I08c346dff3d62240a24091f569f04be2f517b7b0
SwAutoCompleteWord::InsertWord: pNew has to be inserted in both branches
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 7128102..c1600ef 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -277,9 +277,7 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
if( aWordLst.Insert( pNew, nInsPos ) )
{
bRet = sal_True;
- if( aLRULst.size() < nMaxCount )
- aLRULst.push_front( pNew );
- else
+ if (aLRULst.size() >= nMaxCount)
{
// the last one needs to be removed
// so that there is space for the first one
@@ -288,6 +286,7 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
aWordLst.Remove( pDel );
delete pDel;
}
+ aLRULst.push_front(pNew);
}
else
{
commit 8cf33f0d2beb3808de671f1578711a19c0cbe351
Author: Noel Grandin <noel at peralex.com>
Date: Wed Jun 27 18:06:17 2012 +0200
Convert Svptrarr to std::deque<SwAutoCompleteString*>
And convert some salBool to bool.
Change-Id: I57248b2a316009d0b4e6f5d24963a361312bafd9
diff --git a/sw/inc/acmplwrd.hxx b/sw/inc/acmplwrd.hxx
index c51bb80..34d9abc 100644
--- a/sw/inc/acmplwrd.hxx
+++ b/sw/inc/acmplwrd.hxx
@@ -33,13 +33,16 @@
class SwDoc;
class SwAutoCompleteWord_Impl;
class SwAutoCompleteClient;
+class SwAutoCompleteString;
+
+typedef std::deque<SwAutoCompleteString*> SwAutoCompleteStringPtrDeque;
class SwAutoCompleteWord
{
friend class SwAutoCompleteClient;
SvStringsISortDtor aWordLst; // contains extended strings carrying source information
- SvPtrarr aLRULst;
+ SwAutoCompleteStringPtrDeque aLRULst;
SwAutoCompleteWord_Impl* pImpl;
sal_uInt16 nMaxCount, nMinWrdLen;
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 363de4c..7128102 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -97,7 +97,7 @@ class SwAutoCompleteString : public String
~SwAutoCompleteString();
void AddDocument(const SwDoc& rDoc);
//returns true if last document reference has been removed
- sal_Bool RemoveDocument(const SwDoc& rDoc);
+ bool RemoveDocument(const SwDoc& rDoc);
#if OSL_DEBUG_LEVEL > 0
static sal_uLong GetElementCount() {return nSwAutoCompleteStringCount;}
#endif
@@ -201,32 +201,29 @@ SwAutoCompleteString::~SwAutoCompleteString()
void SwAutoCompleteString::AddDocument(const SwDoc& rDoc)
{
- SwDocPtrVector::iterator aIt;
- for(aIt = aSourceDocs.begin(); aIt != aSourceDocs.end(); ++aIt)
+ for(SwDocPtrVector::iterator aIt = aSourceDocs.begin(); aIt != aSourceDocs.end(); ++aIt)
{
- if(*aIt == &rDoc)
+ if( *aIt == &rDoc )
return;
}
- SwDocPtr pNew = &rDoc;
- aSourceDocs.push_back(pNew);
+ aSourceDocs.push_back(&rDoc);
}
-sal_Bool SwAutoCompleteString::RemoveDocument(const SwDoc& rDoc)
+bool SwAutoCompleteString::RemoveDocument(const SwDoc& rDoc)
{
- SwDocPtrVector::iterator aIt;
- for(aIt = aSourceDocs.begin(); aIt != aSourceDocs.end(); ++aIt)
+ for(SwDocPtrVector::iterator aIt = aSourceDocs.begin(); aIt != aSourceDocs.end(); ++aIt)
{
- if(*aIt == &rDoc)
+ if( *aIt == &rDoc )
{
aSourceDocs.erase(aIt);
return aSourceDocs.empty();
}
}
- return sal_False;
+ return false;
}
SwAutoCompleteWord::SwAutoCompleteWord( sal_uInt16 nWords, sal_uInt16 nMWrdLen )
- : aWordLst( 0 ), aLRULst( 0 ),
+ : aWordLst( 0 ),
pImpl(new SwAutoCompleteWord_Impl(*this)),
nMaxCount( nWords ),
nMinWrdLen( nMWrdLen ),
@@ -274,46 +271,40 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
if( !bLockWordLst && nWrdLen >= nMinWrdLen )
{
- SwAutoCompleteString* pAutoString;
- StringPtr pNew = pAutoString = new SwAutoCompleteString( aNewWord, 0, nWrdLen );
- pAutoString->AddDocument(rDoc);
+ SwAutoCompleteString* pNew = new SwAutoCompleteString( aNewWord, 0, nWrdLen );
+ pNew->AddDocument(rDoc);
sal_uInt16 nInsPos;
if( aWordLst.Insert( pNew, nInsPos ) )
{
bRet = sal_True;
- if( aLRULst.Count() < nMaxCount )
- aLRULst.Insert( pNew, 0 );
+ if( aLRULst.size() < nMaxCount )
+ aLRULst.push_front( pNew );
else
{
// the last one needs to be removed
// so that there is space for the first one
- String* pDel = (String*)aLRULst[ nMaxCount - 1 ];
-
- void** ppData = (void**)aLRULst.GetData();
- memmove( ppData+1, ppData, (nMaxCount - 1) * sizeof( void* ));
- *ppData = pNew;
-
+ SwAutoCompleteString* pDel = aLRULst.back();
+ aLRULst.pop_back();
aWordLst.Remove( pDel );
- delete (SwAutoCompleteString*)pDel;
+ delete pDel;
}
}
else
{
- delete (SwAutoCompleteString*)pNew;
+ delete pNew;
// then move "up"
- pNew = aWordLst[ nInsPos ];
+ pNew = (SwAutoCompleteString*)aWordLst[ nInsPos ];
// add the document to the already inserted string
- SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)pNew;
- pCurrent->AddDocument(rDoc);
+ pNew->AddDocument(rDoc);
- nInsPos = aLRULst.GetPos( (void*)pNew );
- OSL_ENSURE( USHRT_MAX != nInsPos, "String not found" );
- if( nInsPos )
+ // move pNew to the front of the LRU list
+ SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pNew );
+ OSL_ENSURE( aLRULst.end() != it, "String not found" );
+ if ( aLRULst.begin() != it && aLRULst.end() != it )
{
- void** ppData = (void**)aLRULst.GetData();
- memmove( ppData+1, ppData, nInsPos * sizeof( void* ) );
- *ppData = pNew;
+ aLRULst.erase( it );
+ aLRULst.push_front( pNew );
}
}
}
@@ -322,19 +313,19 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
void SwAutoCompleteWord::SetMaxCount( sal_uInt16 nNewMax )
{
- if( nNewMax < nMaxCount && aLRULst.Count() > nNewMax )
+ if( nNewMax < nMaxCount && aLRULst.size() > nNewMax )
{
// remove the trailing ones
sal_uInt16 nLRUIndex = nNewMax-1;
- while( nNewMax < aWordLst.Count() && nLRUIndex < aLRULst.Count())
+ while( nNewMax < aWordLst.Count() && nLRUIndex < aLRULst.size())
{
- sal_uInt16 nPos = aWordLst.GetPos( (String*)aLRULst[ nLRUIndex++ ] );
+ sal_uInt16 nPos = aWordLst.GetPos( aLRULst[ nLRUIndex++ ] );
OSL_ENSURE( USHRT_MAX != nPos, "String not found" );
- void * pDel = aWordLst[nPos];
- aWordLst.Remove(nPos);
- delete (SwAutoCompleteString*)pDel;
+ SwAutoCompleteString* pDel = (SwAutoCompleteString*) aWordLst[nPos];
+ aWordLst.Remove( nPos );
+ delete pDel;
}
- aLRULst.Remove( nNewMax-1, aLRULst.Count() - nNewMax );
+ aLRULst.erase( aLRULst.begin() + nNewMax - 1, aLRULst.end() );
}
nMaxCount = nNewMax;
}
@@ -347,14 +338,14 @@ void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
for( sal_uInt16 nPos = 0; nPos < aWordLst.Count(); ++nPos )
if( aWordLst[ nPos ]->Len() < n )
{
- void* pDel = aWordLst[ nPos ];
+ SwAutoCompleteString* pDel = (SwAutoCompleteString*) aWordLst[ nPos ];
aWordLst.Remove(nPos);
- sal_uInt16 nDelPos = aLRULst.GetPos( pDel );
- OSL_ENSURE( USHRT_MAX != nDelPos, "String not found" );
- aLRULst.Remove( nDelPos );
+ SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
+ OSL_ENSURE( aLRULst.end() != it, "String not found" );
+ aLRULst.erase( it );
--nPos;
- delete (SwAutoCompleteString*)pDel;
+ delete pDel;
}
}
@@ -385,13 +376,13 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst )
const StringPtr pStr = rNewLst[ nNewPos ];
while( aWordLst[ nMyPos ] != pStr )
{
- void* pDel = aWordLst[ nMyPos ];
+ SwAutoCompleteString* pDel = (SwAutoCompleteString*) aWordLst[ nMyPos ];
aWordLst.Remove(nMyPos);
- sal_uInt16 nPos = aLRULst.GetPos( pDel );
- OSL_ENSURE( USHRT_MAX != nPos, "String not found" );
- aLRULst.Remove( nPos );
- delete (SwAutoCompleteString*)pDel;
+ SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
+ OSL_ENSURE( aLRULst.end() != it, "String not found" );
+ aLRULst.erase( it );
+ delete pDel;
if( nMyPos >= --nMyLen )
break;
}
@@ -402,11 +393,11 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst )
// clear LRU array first then delete the string object
for( ; nNewPos < nMyLen; ++nNewPos )
{
- void* pDel = aWordLst[ nNewPos ];
- sal_uInt16 nPos = aLRULst.GetPos( pDel );
- OSL_ENSURE( USHRT_MAX != nPos, "String not found" );
- aLRULst.Remove( nPos );
- delete (SwAutoCompleteString*)pDel;
+ SwAutoCompleteString* pDel = (SwAutoCompleteString*) aWordLst[ nNewPos ];
+ SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
+ OSL_ENSURE( aLRULst.end() != it, "String not found" );
+ aLRULst.erase( it );
+ delete pDel;
}
// remove from array
aWordLst.Remove( nMyPos, nMyLen - nMyPos );
@@ -425,9 +416,9 @@ void SwAutoCompleteWord::DocumentDying(const SwDoc& rDoc)
if(pCurrent->RemoveDocument(rDoc) && bDelete)
{
aWordLst.Remove( nPos - 1 );
- sal_uInt16 nLRUPos = aLRULst.GetPos( (void*)pCurrent );
- OSL_ENSURE(nLRUPos < USHRT_MAX, "word not found in LRU list" );
- aLRULst.Remove( nLRUPos );
+ SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pCurrent );
+ OSL_ENSURE( aLRULst.end() != it, "word not found in LRU list" );
+ aLRULst.erase( it );
delete pCurrent;
}
}
commit df5cdeb4b39e8df3f9623d6de87732fcd17cb355
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jul 4 21:49:05 2012 +0200
fix previous STL conversion commit:
SvxIconChoiceCtrl_Impl::GetColumn: pColumns is now a map, so don't test
the index against the size, but check the index only via find.
Change-Id: I9451000f8c2fe7a7b0c745f3b8c8d61e35879b43
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index eeff926..e762253 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -3741,7 +3741,7 @@ void SvxIconChoiceCtrl_Impl::SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCt
const SvxIconChoiceCtrlColumnInfo* SvxIconChoiceCtrl_Impl::GetColumn( sal_uInt16 nIndex ) const
{
- if( !pColumns || nIndex >= pColumns->size() )
+ if (!pColumns)
return 0;
SvxIconChoiceCtrlColumnInfoMap::const_iterator it = pColumns->find( nIndex );
if( it == pColumns->end() )
commit 8d89d1a4a73835a0859de8a6bfabe22eb49e45f2
Author: Noel Grandin <noel at peralex.com>
Date: Wed Jun 27 10:27:36 2012 +0200
Convert Svptrarr to boost::ptr_map<sal_uInt16, SvxIconChoiceCtrlColumnInfo>
Much better than trying to make an array behave like a map
Change-Id: Ifbebc9a98b475788f0db349954bc6aba18fddf18
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index f3c6aed..96512aa 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -40,6 +40,7 @@
#include <svtools/ivctrl.hxx>
#include <svl/svarray.hxx>
+#include <boost/ptr_container/ptr_map.hpp>
class IcnCursor_Impl;
class SvtIconChoiceCtrl;
@@ -156,6 +157,9 @@ public:
//
// Implementation-class of IconChoiceCtrl
//
+
+typedef boost::ptr_map<sal_uInt16, SvxIconChoiceCtrlColumnInfo> SvxIconChoiceCtrlColumnInfoMap;
+
class SvxIconChoiceCtrl_Impl
{
friend class IcnCursor_Impl;
@@ -188,7 +192,7 @@ class SvxIconChoiceCtrl_Impl
long nMaxVirtWidth; // max. width aVirtOutputSize for ALIGN_TOP
long nMaxVirtHeight; // max. height aVirtOutputSize for ALIGN_LEFT
SvxIconChoiceCtrlEntryList_impl* pZOrderList;
- SvPtrarr* pColumns;
+ SvxIconChoiceCtrlColumnInfoMap* pColumns;
IcnViewEdit_Impl* pEdit;
WinBits nWinBits;
long nMaxBoundHeight; // height of highest BoundRects
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 26ee6bc..eeff926 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -3718,36 +3718,17 @@ void SvxIconChoiceCtrl_Impl::ClearColumnList()
if( !pColumns )
return;
- const sal_uInt16 nCount = pColumns->Count();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- SvxIconChoiceCtrlColumnInfo* pInfo = (SvxIconChoiceCtrlColumnInfo*)
- pColumns->GetObject( nCur );
- delete pInfo;
- }
+ pColumns->clear();
DELETEZ(pColumns);
}
void SvxIconChoiceCtrl_Impl::SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& rInfo)
{
if( !pColumns )
- pColumns = new SvPtrarr;
- while( pColumns->Count() < nIndex + 1 )
- pColumns->Insert( (void*)0, pColumns->Count() );
+ pColumns = new SvxIconChoiceCtrlColumnInfoMap;
- SvxIconChoiceCtrlColumnInfo* pInfo =
- (SvxIconChoiceCtrlColumnInfo*)pColumns->GetObject(nIndex);
- if( !pInfo )
- {
- pInfo = new SvxIconChoiceCtrlColumnInfo( rInfo );
- pColumns->Insert( (void*)pInfo, nIndex );
- }
- else
- {
- delete pInfo;
- pInfo = new SvxIconChoiceCtrlColumnInfo( rInfo );
- pColumns->Replace( pInfo, nIndex );
- }
+ SvxIconChoiceCtrlColumnInfo* pInfo = new SvxIconChoiceCtrlColumnInfo( rInfo );
+ pColumns->insert( nIndex, pInfo );
// HACK: Detail mode is not yet fully implemented, this workaround makes it
// fly with a single column
@@ -3760,9 +3741,12 @@ void SvxIconChoiceCtrl_Impl::SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCt
const SvxIconChoiceCtrlColumnInfo* SvxIconChoiceCtrl_Impl::GetColumn( sal_uInt16 nIndex ) const
{
- if( !pColumns || nIndex >= pColumns->Count() )
+ if( !pColumns || nIndex >= pColumns->size() )
+ return 0;
+ SvxIconChoiceCtrlColumnInfoMap::const_iterator it = pColumns->find( nIndex );
+ if( it == pColumns->end() )
return 0;
- return (const SvxIconChoiceCtrlColumnInfo*)pColumns->GetObject( nIndex );
+ return it->second;
}
void SvxIconChoiceCtrl_Impl::DrawHighlightFrame(
commit 7ce275e463584283c62b915cb798edcf8f0d8ef1
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 17:34:33 2012 +0200
Convert Svptrarr to std::vector<Rectangle*>
And also convert some sal_Bool to bool
Change-Id: I9af69118cf1020d806a16b8f0ffdeb01120d404a
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index 2125780..f3c6aed 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -168,7 +168,7 @@ class SvxIconChoiceCtrl_Impl
ScrollBar aHorSBar;
ScrollBarBox aScrBarBox;
Rectangle aCurSelectionRect;
- SvPtrarr aSelectedRectList;
+ std::vector<Rectangle*> aSelectedRectList;
Timer aEditTimer; // for editing in place
Timer aAutoArrangeTimer;
Timer aDocRectChangedTimer;
@@ -264,7 +264,7 @@ class SvxIconChoiceCtrl_Impl
SvxIconChoiceCtrlEntry* pEntry1,
SvxIconChoiceCtrlEntry* pEntry2,
sal_Bool bAdd = sal_True,
- SvPtrarr* pOtherRects = 0
+ std::vector<Rectangle*>* pOtherRects = 0
);
void SelectRange(
@@ -473,15 +473,15 @@ public:
void HideDDIcon();
- sal_Bool IsOver(
- SvPtrarr* pSelectedRectList,
+ bool IsOver(
+ std::vector<Rectangle*>* pSelectedRectList,
const Rectangle& rEntryBoundRect
) const;
void SelectRect(
const Rectangle&,
- sal_Bool bAdd = sal_True,
- SvPtrarr* pOtherRects = 0
+ bool bAdd = true,
+ std::vector<Rectangle*>* pOtherRects = 0
);
sal_Bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index c5d33ce..26ee6bc 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -2743,7 +2743,7 @@ static Rectangle GetHotSpot( const Rectangle& rRect )
}
void SvxIconChoiceCtrl_Impl::SelectRect( SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry2,
- sal_Bool bAdd, SvPtrarr* pOtherRects )
+ sal_Bool bAdd, std::vector<Rectangle*>* pOtherRects )
{
DBG_ASSERT(pEntry1 && pEntry2,"SelectEntry: Invalid Entry-Ptr");
Rectangle aRect( GetEntryBoundRect( pEntry1 ) );
@@ -2751,8 +2751,8 @@ void SvxIconChoiceCtrl_Impl::SelectRect( SvxIconChoiceCtrlEntry* pEntry1, SvxIco
SelectRect( aRect, bAdd, pOtherRects );
}
-void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
- SvPtrarr* pOtherRects )
+void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, bool bAdd,
+ std::vector<Rectangle*>* pOtherRects )
{
aCurSelectionRect = rRect;
if( !pZOrderList || !pZOrderList->size() )
@@ -2768,7 +2768,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
Rectangle aRect( rRect );
aRect.Justify();
- sal_Bool bCalcOverlap = (bAdd && pOtherRects && pOtherRects->Count()) ? sal_True : sal_False;
+ bool bCalcOverlap = (bAdd && pOtherRects && !pOtherRects->empty()) ? true : false;
sal_Bool bResetClipRegion = sal_False;
if( !pView->IsClipRegion() )
@@ -2894,16 +2894,16 @@ void SvxIconChoiceCtrl_Impl::SelectRange(
}
}
-sal_Bool SvxIconChoiceCtrl_Impl::IsOver( SvPtrarr* pRectList, const Rectangle& rBoundRect ) const
+bool SvxIconChoiceCtrl_Impl::IsOver( std::vector<Rectangle*>* pRectList, const Rectangle& rBoundRect ) const
{
- const sal_uInt16 nCount = pRectList->Count();
+ const sal_uInt16 nCount = pRectList->size();
for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
{
- Rectangle* pRect = (Rectangle*)pRectList->GetObject( nCur );
+ Rectangle* pRect = (*pRectList)[ nCur ];
if( rBoundRect.IsOver( *pRect ))
- return sal_True;
+ return true;
}
- return sal_False;
+ return false;
}
void SvxIconChoiceCtrl_Impl::AddSelectedRect( SvxIconChoiceCtrlEntry* pEntry1,
@@ -2919,18 +2919,18 @@ void SvxIconChoiceCtrl_Impl::AddSelectedRect( const Rectangle& rRect )
{
Rectangle* pRect = new Rectangle( rRect );
pRect->Justify();
- aSelectedRectList.Insert( (void*)pRect, aSelectedRectList.Count() );
+ aSelectedRectList.push_back( pRect );
}
void SvxIconChoiceCtrl_Impl::ClearSelectedRectList()
{
- const sal_uInt16 nCount = aSelectedRectList.Count();
+ const sal_uInt16 nCount = aSelectedRectList.size();
for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
{
- Rectangle* pRect = (Rectangle*)aSelectedRectList.GetObject( nCur );
+ Rectangle* pRect = aSelectedRectList[ nCur ];
delete pRect;
}
- aSelectedRectList.Remove( 0, aSelectedRectList.Count() );
+ aSelectedRectList.clear();
}
IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, AutoArrangeHdl)
commit b1a59ddfc8ad8177fb5310e8c58e2138c2305f20
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jun 26 14:19:46 2012 +0200
Convert Svptrarr to std::vector<SwPosition*>
Change-Id: I0e6db9fb0e628cc0d4e6556c71542bd0efc48a86
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 14df0e5..90f5e8c 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -666,16 +666,16 @@ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx
const SwPosition* pEnd;
SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetCntntNode(), nCnt ));
const SwRedline* pRedl = pDest->GetRedline( aSrcPos, &nFndPos );
- while( nFndPos-- && *( pEnd = ( pRedl =
- pDest->GetRedlineTbl()[ nFndPos ] )->End() ) == aSrcPos && *pRedl->Start() < aSrcPos )
+ while( nFndPos--
+ && *( pEnd = ( pRedl = pDest->GetRedlineTbl()[ nFndPos ] )->End() ) == aSrcPos
+ && *pRedl->Start() < aSrcPos )
{
if( !pSavArr )
{
- pSavArr = new SvPtrarr( 2 );
+ pSavArr = new std::vector<SwPosition*>;
pSavIdx = new SwNodeIndex( rInsIdx, -1 );
}
- void* p = (void*)pEnd;
- pSavArr->Insert( p, pSavArr->Count() );
+ pSavArr->push_back( (SwPosition*)pEnd );
}
}
}
@@ -695,8 +695,8 @@ void _SaveRedlEndPosForRestore::_Restore()
if( pNode )
{
SwPosition aPos( *pSavIdx, SwIndex( pNode, nSavCntnt ));
- for( sal_uInt16 n = pSavArr->Count(); n; )
- *((SwPosition*)pSavArr->GetObject( --n )) = aPos;
+ for( sal_uInt16 n = pSavArr->size(); n; )
+ *(*pSavArr)[ --n ] = aPos;
}
}
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index 1e68cae..fd91329 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -195,7 +195,7 @@ public:
class _SaveRedlEndPosForRestore
{
- SvPtrarr* pSavArr;
+ std::vector<SwPosition*>* pSavArr;
SwNodeIndex* pSavIdx;
xub_StrLen nSavCntnt;
commit 7a2206ce0d78a26acff3d60b471cfcc93e827559
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 16:24:29 2012 +0200
Convert Svptrarr to std::vector<const SwUserFieldType*>
Also convert method return type from sal_Bool to bool
Change-Id: I259e99709297d4c3b9b74643920e2afefa469a93
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 69ab36a..191480c 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -28,7 +28,6 @@
#ifndef _CALC_HXX
#define _CALC_HXX
-#include <svl/svarray.hxx>
#include <unotools/syslocale.hxx>
#ifndef __SBX_SBXVALUE //autogen
@@ -40,6 +39,7 @@ class CharClass;
class LocaleDataWrapper;
class SwFieldType;
class SwDoc;
+class SwUserFieldType;
#define TBLSZ 47 // should be a prime, because of hash table
@@ -176,7 +176,7 @@ class SwCalc
SwHash* VarTable[ TBLSZ ];
String aVarName, sCurrSym;
String sCommand;
- SvPtrarr aRekurStk;
+ std::vector<const SwUserFieldType*> aRekurStk;
SwSbxValue nLastLeft;
SwSbxValue nNumberValue;
SwCalcExp aErrExpr;
@@ -221,8 +221,8 @@ public:
void VarChange( const String& rStr, double );
SwHash** GetVarTable() { return VarTable; }
- sal_Bool Push( const VoidPtr pPtr );
- void Pop( const VoidPtr pPtr );
+ bool Push(const SwUserFieldType* pUserFieldType);
+ void Pop();
void SetCalcError( SwCalcError eErr ) { eError = eErr; }
sal_Bool IsCalcError() const { return 0 != eError; }
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 6250178..a4676ec 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -634,20 +634,20 @@ void SwCalc::VarChange( const String& rStr, const SwSbxValue& rValue )
}
}
-sal_Bool SwCalc::Push( const VoidPtr pPtr )
+bool SwCalc::Push( const SwUserFieldType* pUserFieldType )
{
- if( USHRT_MAX != aRekurStk.GetPos( pPtr ) )
- return sal_False;
+ if( aRekurStk.end() != std::find(aRekurStk.begin(), aRekurStk.end(), pUserFieldType ) )
+ return false;
- aRekurStk.Insert( pPtr, aRekurStk.Count() );
- return sal_True;
+ aRekurStk.push_back( pUserFieldType );
+ return true;
}
-void SwCalc::Pop( const VoidPtr )
+void SwCalc::Pop()
{
- OSL_ENSURE( aRekurStk.Count(), "SwCalc: Pop on an invalid pointer" );
+ OSL_ENSURE( aRekurStk.size(), "SwCalc: Pop on an invalid pointer" );
- aRekurStk.Remove( aRekurStk.Count() - 1 );
+ aRekurStk.pop_back();
}
SwCalcOper SwCalc::GetToken()
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 5495a7a..7457fc7 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -247,7 +247,7 @@ double SwUserFieldType::GetValue( SwCalc& rCalc )
return 0;
}
nValue = rCalc.Calculate( aContent ).GetDouble();
- rCalc.Pop( this );
+ rCalc.Pop();
if( !rCalc.IsCalcError() )
bValidValue = sal_True;
commit 485e097ba8cc55a49188ec239042a92b8c160104
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 16:09:52 2012 +0200
Convert Svptrarr to std::set<const SwTxtFld*>
Change-Id: I71bfd2075c7dd7a97fd5553c8e55e614d6be4cf3
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 0b908df..c15e0a2 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -28,10 +28,10 @@
#ifndef SW_EXPFLD_HXX
#define SW_EXPFLD_HXX
-#include <svl/svarray.hxx>
#include "swdllapi.h"
#include <fldbas.hxx>
#include <cellfml.hxx>
+#include <set>
class SfxPoolItem;
class SwTxtNode;
@@ -356,9 +356,9 @@ public:
void RemoveUnselectedFlds();
private:
- SwEditShell* pSh;
- _SetGetExpFlds* pSrtLst;
- SvPtrarr aTmpLst;
+ SwEditShell* pSh;
+ _SetGetExpFlds* pSrtLst;
+ std::set<const SwTxtFld*> aTmpLst;
};
// Implementation in tblcalc.cxx.
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index cf90dc5..8b7aa5c 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -78,8 +78,7 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, sal_Bool bBuildTmpLst )
{
if( bBuildTmpLst )
{
- VoidPtr pTmp = (VoidPtr)pTxtFld;
- aTmpLst.Insert( pTmp, aTmpLst.Count() );
+ aTmpLst.insert( pTxtFld );
}
else
{
@@ -171,25 +170,24 @@ sal_uInt16 SwInputFieldList::BuildSortLst()
const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
if( rTxtNode.GetNodes().IsDocNodes() )
{
- VoidPtr pTmp = (VoidPtr)pTxtFld;
// nicht in der TempListe vorhanden, also in die SortListe
// aufnehemen
- sal_uInt16 nFndPos = aTmpLst.GetPos( pTmp );
- if( USHRT_MAX == nFndPos )
+ std::set<const SwTxtFld*>::iterator it = aTmpLst.find( pTxtFld );
+ if( aTmpLst.end() == it )
{
SwNodeIndex aIdx( rTxtNode );
_SetGetExpFld* pNew = new _SetGetExpFld(aIdx, pTxtFld );
pSrtLst->Insert( pNew );
}
else
- aTmpLst.Remove( nFndPos );
+ aTmpLst.erase( it );
}
}
}
}
// die Pointer werden nicht mehr gebraucht
- aTmpLst.Remove( 0, aTmpLst.Count() );
+ aTmpLst.clear();
return pSrtLst->Count();
}
commit 6485258bc00de0bc1db9a0b146437a08c93970aa
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 15:05:31 2012 +0200
Convert Svptrarr to std::deque<const SwTxtAttr*>
Change-Id: I527814582214401a1f7dd9c192e6aa96e45f7819
diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx
index 63c2020..fd2c2fe 100644
--- a/sw/inc/txatritr.hxx
+++ b/sw/inc/txatritr.hxx
@@ -21,9 +21,9 @@
#include <tools/solar.h>
#include <sal/types.h>
-#include <svl/svarray.hxx>
#include <editeng/langitem.hxx>
#include <hintids.hxx>
+#include <deque>
class String;
class SwTxtNode;
@@ -53,7 +53,7 @@ public:
class SwTxtAttrIterator
{
SwScriptIterator aSIter;
- SvPtrarr aStack;
+ std::deque<const SwTxtAttr*> aStack;
const SwTxtNode& rTxtNd;
const SfxPoolItem *pParaItem, *pCurItem;
xub_StrLen nChgPos;
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index d51dbf5..5391295 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -109,25 +109,25 @@ sal_Bool SwTxtAttrIterator::Next()
if( nChgPos < aSIter.GetText().Len() )
{
bRet = sal_True;
- if( aStack.Count() )
+ if( !aStack.empty() )
{
do {
- const SwTxtAttr* pHt = (SwTxtAttr*)aStack[ 0 ];
+ const SwTxtAttr* pHt = aStack.front();
sal_uInt16 nEndPos = *pHt->GetEnd();
if( nChgPos >= nEndPos )
- aStack.Remove( 0 );
+ aStack.pop_front();
else
break;
- } while( aStack.Count() );
+ } while( !aStack.empty() );
}
- if( aStack.Count() )
+ if( !aStack.empty() )
{
sal_uInt16 nSavePos = nAttrPos;
SearchNextChg();
- if( aStack.Count() )
+ if( !aStack.empty() )
{
- const SwTxtAttr* pHt = (SwTxtAttr*)aStack[ 0 ];
+ const SwTxtAttr* pHt = aStack.front();
sal_uInt16 nEndPos = *pHt->GetEnd();
if( nChgPos >= nEndPos )
{
@@ -144,7 +144,7 @@ sal_Bool SwTxtAttrIterator::Next()
else
pCurItem = &pHt->GetAttr();
- aStack.Remove( 0 );
+ aStack.pop_front();
}
}
}
@@ -156,13 +156,12 @@ sal_Bool SwTxtAttrIterator::Next()
void SwTxtAttrIterator::AddToStack( const SwTxtAttr& rAttr )
{
- void* pAdd = (void*)&rAttr;
sal_uInt16 nIns = 0, nEndPos = *rAttr.GetEnd();
- for( ; nIns < aStack.Count(); ++nIns )
- if( *((SwTxtAttr*)aStack[ nIns ] )->GetEnd() > nEndPos )
+ for( ; nIns < aStack.size(); ++nIns )
+ if( *aStack[ nIns ]->GetEnd() > nEndPos )
break;
- aStack.Insert( pAdd, nIns );
+ aStack.insert( aStack.begin() + nIns, &rAttr );
}
void SwTxtAttrIterator::SearchNextChg()
@@ -175,7 +174,7 @@ void SwTxtAttrIterator::SearchNextChg()
nAttrPos = 0; // must be restart at the beginning, because
// some attributes can start before or inside
// the current scripttype!
- aStack.Remove( 0, aStack.Count() );
+ aStack.clear();
}
if( !pParaItem )
{
commit 457a537bdb24ff67a9bfc3d7426678ac6829d821
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 14:44:56 2012 +0200
Convert Svptrarr to std::vector<SvGlobalName*>
Change-Id: Iafd2dc1d4bf4bf3dd875a33a37ea9038f3e083fe
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 4213cbf..1bfd194 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -434,7 +434,7 @@ const sal_Char* pMarkToOutline = "outline";
const sal_Char* pMarkToGraphic = "graphic";
const sal_Char* pMarkToOLE = "ole";
-SvPtrarr *pGlobalOLEExcludeList = 0;
+std::vector<SvGlobalName*> *pGlobalOLEExcludeList = 0;
SwAutoCompleteWord* SwDoc::pACmpltWords = 0;
@@ -715,7 +715,7 @@ void _InitCore()
SwSelPaintRects::pMapMode = new MapMode;
SwFntObj::pPixMap = new MapMode;
- pGlobalOLEExcludeList = new SvPtrarr;
+ pGlobalOLEExcludeList = new std::vector<SvGlobalName*>;
const SvxSwAutoFmtFlags& rAFlags = SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags();
SwDoc::pACmpltWords = new SwAutoCompleteWord( rAFlags.nAutoCmpltListLen,
@@ -803,8 +803,8 @@ void _FinitCore()
delete[] SwAttrPool::pVersionMap5;
delete[] SwAttrPool::pVersionMap6;
- for ( sal_uInt16 i = 0; i < pGlobalOLEExcludeList->Count(); ++i )
- delete (SvGlobalName*)(*pGlobalOLEExcludeList)[i];
+ for ( sal_uInt16 i = 0; i < pGlobalOLEExcludeList->size(); ++i )
+ delete (*pGlobalOLEExcludeList)[i];
delete pGlobalOLEExcludeList;
}
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index cc1be24..7fefd9a 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -675,7 +675,7 @@ void SwDoc::PrtDataChanged()
// about printer changes. Thereby saving loading a lot of objects (luckily all foreign
// objects are mapped to one ID).
// Initialisation and deinitialisation can be found in init.cxx
-extern SvPtrarr *pGlobalOLEExcludeList;
+extern std::vector<SvGlobalName*> *pGlobalOLEExcludeList;
void SwDoc::PrtOLENotify( sal_Bool bAll )
{
@@ -738,11 +738,10 @@ void SwDoc::PrtOLENotify( sal_Bool bAll )
sal_Bool bFound = sal_False;
for ( sal_uInt16 j = 0;
- j < pGlobalOLEExcludeList->Count() && !bFound;
+ j < pGlobalOLEExcludeList->size() && !bFound;
++j )
{
- bFound = *(SvGlobalName*)(*pGlobalOLEExcludeList)[j] ==
- aName;
+ bFound = *(*pGlobalOLEExcludeList)[j] == aName;
}
if ( bFound )
continue;
@@ -751,9 +750,7 @@ void SwDoc::PrtOLENotify( sal_Bool bAll )
// If it doesn't want to be informed
if ( xObj.is() )
{
- pGlobalOLEExcludeList->Insert(
- new SvGlobalName( aName ),
- pGlobalOLEExcludeList->Count() );
+ pGlobalOLEExcludeList->push_back( new SvGlobalName( aName ) );
}
}
delete pNodes;
commit df436372344ffa8ae12a64606cde54d4b4ea7a6a
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 14:38:13 2012 +0200
Convert Svptrarr to std::vector<SwRedline*>
Change-Id: I0185a08d2ebb6751b802972f14bf46edfc63c9e7
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index d5fca9e..14df0e5 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -1125,7 +1125,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
}
_SaveRedlines aSaveRedl;
- SvPtrarr aSavRedlInsPosArr( 0 );
+ std::vector<SwRedline*> aSavRedlInsPosArr;
if( DOC_MOVEREDLINES & eMvFlags && GetRedlineTbl().Count() )
{
lcl_SaveRedlines( rRange, aSaveRedl );
@@ -1142,8 +1142,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
pREnd = pTmp->End();
if( pREnd->nNode == rPos && pRStt->nNode < rPos )
{
- void* p = pTmp;
- aSavRedlInsPosArr.Insert( p, aSavRedlInsPosArr.Count() );
+ aSavRedlInsPosArr.push_back( pTmp );
}
} while( pRStt->nNode < rPos && ++nRedlPos < GetRedlineTbl().Count());
}
@@ -1192,12 +1191,12 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
++pBkmk)
pBkmk->SetInDoc(this, aIdx);
- if( aSavRedlInsPosArr.Count() )
+ if( !aSavRedlInsPosArr.empty() )
{
SwNode* pNewNd = &aIdx.GetNode();
- for( sal_uInt16 n = 0; n < aSavRedlInsPosArr.Count(); ++n )
+ for( sal_uInt16 n = 0; n < aSavRedlInsPosArr.size(); ++n )
{
- SwRedline* pTmp = (SwRedline*)aSavRedlInsPosArr[ n ];
+ SwRedline* pTmp = aSavRedlInsPosArr[ n ];
if( USHRT_MAX != GetRedlineTbl().GetPos( pTmp ) )
{
SwPosition* pEnd = pTmp->End();
commit 6b35f10b83a8142644a2831bae63f5aa566ed635
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 14:35:39 2012 +0200
Convert Svptrarr to std::vector<SwPosition*>
Change-Id: I1527f6c319d536286e1dc12c8c9ffa3b6a0e3713
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index b32ae8b..88c3749 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -3545,7 +3545,7 @@ void SwRedline::MoveFromSection()
{
SwDoc* pDoc = GetDoc();
const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
- SvPtrarr aBeforeArr( 16 ), aBehindArr( 16 );
+ std::vector<SwPosition*> aBeforeArr, aBehindArr;
sal_uInt16 nMyPos = rTbl.GetPos( this );
OSL_ENSURE( this, "this is not in the array?" );
sal_Bool bBreak = sal_False;
@@ -3556,14 +3556,12 @@ void SwRedline::MoveFromSection()
bBreak = sal_True;
if( rTbl[ n ]->GetBound(sal_True) == *GetPoint() )
{
- void* pTmp = &rTbl[ n ]->GetBound(sal_True);
- aBehindArr.Insert( pTmp, aBehindArr.Count());
+ aBehindArr.push_back( &rTbl[ n ]->GetBound(sal_True) );
bBreak = sal_False;
}
if( rTbl[ n ]->GetBound(sal_False) == *GetPoint() )
{
- void* pTmp = &rTbl[ n ]->GetBound(sal_False);
- aBehindArr.Insert( pTmp, aBehindArr.Count() );
+ aBehindArr.push_back( &rTbl[ n ]->GetBound(sal_False) );
bBreak = sal_False;
}
}
@@ -3573,14 +3571,12 @@ void SwRedline::MoveFromSection()
bBreak = sal_True;
if( rTbl[ n ]->GetBound(sal_True) == *GetPoint() )
{
- void* pTmp = &rTbl[ n ]->GetBound(sal_True);
- aBeforeArr.Insert( pTmp, aBeforeArr.Count() );
+ aBeforeArr.push_back( &rTbl[ n ]->GetBound(sal_True) );
bBreak = sal_False;
}
if( rTbl[ n ]->GetBound(sal_False) == *GetPoint() )
{
- void* pTmp = &rTbl[ n ]->GetBound(sal_False);
- aBeforeArr.Insert( pTmp, aBeforeArr.Count() );
+ aBeforeArr.push_back( &rTbl[ n ]->GetBound(sal_False) );
bBreak = sal_False;
}
}
@@ -3650,10 +3646,10 @@ void SwRedline::MoveFromSection()
// adjustment of redline table positions must take start and
// end into account, not point and mark.
- for( n = 0; n < aBeforeArr.Count(); ++n )
- *(SwPosition*)aBeforeArr[ n ] = *Start();
- for( n = 0; n < aBehindArr.Count(); ++n )
- *(SwPosition*)aBehindArr[ n ] = *End();
+ for( n = 0; n < aBeforeArr.size(); ++n )
+ *aBeforeArr[ n ] = *Start();
+ for( n = 0; n < aBehindArr.size(); ++n )
+ *aBehindArr[ n ] = *End();
}
else
InvalidateRange();
commit db36d83392792fa672d64460c617c9a72d779f1d
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 25 14:29:49 2012 +0200
Convert Svptrarr to std::vector
Change-Id: Ia385f3b004f9d4744035b43e0e049dbb19da774b
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index db44bc3..4d39e34 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -952,28 +952,19 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
InsertAlphaDelimitter( aIntl );
// Sort the List of all TOC Marks and TOC Sections
- void* p = 0;
- sal_uInt16 nCnt = 0, nFormMax = GetTOXForm().GetFormMax();
- SvPtrarr aCollArr( (sal_uInt8)nFormMax );
- for( ; nCnt < nFormMax; ++nCnt )
- {
- aCollArr.Insert( p, nCnt );
- }
-
+ std::vector<SwTxtFmtColl*> aCollArr( GetTOXForm().GetFormMax(), 0 );
SwNodeIndex aInsPos( *pFirstEmptyNd, 1 );
- for( nCnt = 0; nCnt < aSortArr.size(); ++nCnt )
+ for( sal_uInt16 nCnt = 0; nCnt < aSortArr.size(); ++nCnt )
{
::SetProgressState( 0, pDoc->GetDocShell() );
// Put the Text into the TOC
sal_uInt16 nLvl = aSortArr[ nCnt ]->GetLevel();
- SwTxtFmtColl* pColl = (SwTxtFmtColl*)aCollArr[ nLvl ];
+ SwTxtFmtColl* pColl = aCollArr[ nLvl ];
if( !pColl )
{
pColl = GetTxtFmtColl( nLvl );
- aCollArr.Remove( nLvl );
- p = pColl;
- aCollArr.Insert( p , nLvl );
+ aCollArr[ nLvl ] = pColl;
}
// Generate: Set dynamic TabStops
More information about the Libreoffice-commits
mailing list