summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/swcrsr.hxx7
-rw-r--r--sw/inc/swtable.hxx5
-rw-r--r--sw/inc/tblsel.hxx40
-rw-r--r--sw/source/core/access/acccell.cxx2
-rw-r--r--sw/source/core/access/acctable.cxx6
-rw-r--r--sw/source/core/crsr/swcrsr.cxx134
-rw-r--r--sw/source/core/crsr/trvltbl.cxx18
-rw-r--r--sw/source/core/crsr/unocrsr.cxx5
-rw-r--r--sw/source/core/crsr/viscrs.cxx12
-rw-r--r--sw/source/core/doc/doclay.cxx9
-rw-r--r--sw/source/core/doc/docsort.cxx8
-rw-r--r--sw/source/core/doc/tblcpy.cxx28
-rw-r--r--sw/source/core/doc/tblrwcl.cxx108
-rw-r--r--sw/source/core/docnode/ndtbl.cxx74
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx25
-rw-r--r--sw/source/core/edit/edglss.cxx6
-rw-r--r--sw/source/core/edit/edtab.cxx16
-rw-r--r--sw/source/core/fields/cellfml.cxx28
-rw-r--r--sw/source/core/frmedt/fecopy.cxx8
-rw-r--r--sw/source/core/frmedt/fefly1.cxx4
-rw-r--r--sw/source/core/frmedt/fetab.cxx68
-rw-r--r--sw/source/core/frmedt/tblsel.cxx101
-rw-r--r--sw/source/core/inc/tblrwcl.hxx9
-rw-r--r--sw/source/core/layout/trvlfrm.cxx2
-rw-r--r--sw/source/core/table/swnewtable.cxx167
-rw-r--r--sw/source/core/undo/untbl.cxx30
-rw-r--r--sw/source/core/unocore/unochart.cxx6
-rw-r--r--sw/source/core/unocore/unotbl.cxx19
-rw-r--r--sw/source/filter/basflt/shellio.cxx2
-rw-r--r--sw/source/filter/ww1/fltshell.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx17
31 files changed, 498 insertions, 470 deletions
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index dd8cd4e44a35..aaf8d6f19742 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -286,12 +286,9 @@ public:
virtual sal_Bool GotoTable( const String& rName );
void InsertBox( const SwTableBox& rTblBox );
- void DeleteBox( SwSelBoxes::iterator it ) { aSelBoxes.erase( it ); bChg = sal_True; }
- void DeleteBox( SwSelBoxes::iterator itFirst, SwSelBoxes::iterator itLast ) { aSelBoxes.erase( itFirst, itLast ); bChg = sal_True; }
- void DeleteAllBoxes() { DeleteBox(aSelBoxes.begin(), aSelBoxes.end()); }
- sal_uInt16 GetBoxesCount() const { return aSelBoxes.size(); }
+ void DeleteBox( sal_uInt16 nPos ) { aSelBoxes.Remove( nPos ); bChg = sal_True; }
+ sal_uInt16 GetBoxesCount() const { return aSelBoxes.Count(); }
const SwSelBoxes& GetBoxes() const { return aSelBoxes; }
- SwSelBoxes& GetBoxes() { return aSelBoxes; }
// Creates cursor for all boxes.
SwCursor* MakeBoxSels( SwCursor* pAktCrsr );
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index f6de56e9d5c8..ba67780a1762 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -34,7 +34,6 @@
#include <swtypes.hxx>
#include <calbck.hxx>
#include <swrect.hxx>
-#include <frmfmt.hxx>
#include <memory>
#include <boost/noncopyable.hpp>
@@ -42,6 +41,7 @@
class SwStartNode;
class SwFmt;
class Color;
+class SwFrmFmt;
class SwTableFmt;
class SwTableLineFmt;
class SwTableBoxFmt;
@@ -404,7 +404,8 @@ public:
const SwTableLine *GetUpper() const { return pUpper; }
void SetUpper( SwTableLine *pNew ) { pUpper = pNew; }
- SwFrmFmt* GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); }
+ SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
// Creates its own FrmFmt if more boxes depend on it.
SwFrmFmt* ClaimFrmFmt();
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx
index d75a18daf8f9..a4b772883fa0 100644
--- a/sw/inc/tblsel.hxx
+++ b/sw/inc/tblsel.hxx
@@ -33,7 +33,6 @@
#include <swrect.hxx>
#include "swdllapi.h"
-#include <map>
#include <deque>
#include <boost/ptr_container/ptr_vector.hpp>
@@ -52,44 +51,7 @@ class SwUndoTblMerge;
class SwCellFrm;
typedef ::std::deque< SwCellFrm* > SwCellFrms;
-
-
-class SwSelBoxes : private std::map<sal_uLong, SwTableBox*>
-{
- typedef std::map<sal_uLong, SwTableBox*> Base;
-public:
- using Base::begin;
- using Base::clear;
- using Base::count;
- using Base::const_iterator;
- using Base::const_reverse_iterator;
- using Base::empty;
- using Base::end;
- using Base::erase;
- using Base::find;
- using Base::insert;
- using Base::iterator;
- using Base::rbegin;
- using Base::rend;
- using Base::reverse_iterator;
- using Base::size;
-
- std::pair<iterator, bool>
- insert(SwTableBox* pBox) { return Base::insert(std::make_pair(pBox->GetSttIdx(), pBox)); }
-
- iterator
- insert(iterator it, SwTableBox* pBox) { return Base::insert(it, std::make_pair(pBox->GetSttIdx(), pBox)); }
-
- size_type
- count(const SwTableBox* pBox) const { return Base::count(pBox->GetSttIdx()); }
-
- iterator
- find(const SwTableBox* pBox) { return Base::find(pBox->GetSttIdx()); }
-
- const_iterator
- find(const SwTableBox* pBox) const { return Base::find(pBox->GetSttIdx()); }
-};
-
+SV_DECL_PTRARR_SORT( SwSelBoxes, SwTableBoxPtr, 10 )
// Collects all boxes in table that are selected.
// Selection gets extended in given direction according to enum-parameter.
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index 4df813f5078a..b70b39709161 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -74,7 +74,7 @@ sal_Bool SwAccessibleCell::IsSelected()
static_cast< const SwCellFrm * >( GetFrm() );
SwTableBox *pBox =
const_cast< SwTableBox *>( pCFrm->GetTabBox() ); //SVPtrArr!
- bRet = ( 0 != pCSh->GetTableCrsr()->GetBoxes().count( pBox ) );
+ bRet = pCSh->GetTableCrsr()->GetBoxes().Seek_Entry( pBox );
}
}
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 89fc739a377d..1b86c326c89c 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -295,7 +295,7 @@ void SwAccessibleTableData_Impl::GetSelection(
static_cast < const SwCellFrm * >( pLower );
SwTableBox *pBox =
const_cast< SwTableBox *>( pCFrm->GetTabBox() ); //SVPtrArr!
- if( 0 == rSelBoxes.count( pBox ) )
+ if( !rSelBoxes.Seek_Entry( pBox ) )
{
const Int32Set_Impl rRowsOrCols =
bColumns ? maColumns : maRows;
@@ -659,7 +659,7 @@ sal_Bool SwAccessibleTable::IsChildSelected( sal_Int32 nChildIndex ) const
{
const SwTableBox* pBox = GetTableBox( nChildIndex );
OSL_ENSURE( pBox != NULL, "We need the table box." );
- bRet = ( 0 != pSelBoxes->count( pBox ) );
+ bRet = pSelBoxes->Seek_Entry( const_cast<SwTableBox*>( pBox ) );
}
return bRet;
@@ -1199,7 +1199,7 @@ sal_Bool SAL_CALL SwAccessibleTable::isAccessibleSelected(
const SwCellFrm *pCFrm = static_cast < const SwCellFrm * >( pFrm );
SwTableBox *pBox =
const_cast< SwTableBox *>( pCFrm->GetTabBox() ); //SVPtrArr!
- bRet = ( 0 != pSelBoxes->count( pBox ) );
+ bRet = pSelBoxes->Seek_Entry( pBox );
}
}
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 6150204aa1bc..8c24b3060c7f 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2130,6 +2130,35 @@ SwTableCursor::SwTableCursor( const SwPosition &rPos, SwPaM* pRing )
SwTableCursor::~SwTableCursor() {}
+sal_Bool lcl_SeekEntry( const SwSelBoxes& rTmp, const SwStartNode* pSrch, sal_uInt16& rFndPos )
+{
+ sal_uLong nIdx = pSrch->GetIndex();
+
+ sal_uInt16 nO = rTmp.Count();
+ if( nO > 0 )
+ {
+ nO--;
+ sal_uInt16 nU = 0;
+ while( nU <= nO )
+ {
+ sal_uInt16 nM = nU + ( nO - nU ) / 2;
+ if( rTmp[ nM ]->GetSttNd() == pSrch )
+ {
+ rFndPos = nM;
+ return sal_True;
+ }
+ else if( rTmp[ nM ]->GetSttIdx() < nIdx )
+ nU = nM + 1;
+ else if( nM == 0 )
+ return sal_False;
+ else
+ nO = nM - 1;
+ }
+ }
+ return sal_False;
+}
+
+
SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
{
if( bChg ) // ???
@@ -2148,10 +2177,12 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
// temp Kopie anlegen, damit alle Boxen, fuer die schon Cursor
// existieren, entfernt werden koennen.
- SwSelBoxes aTmp( aSelBoxes );
+ SwSelBoxes aTmp;
+ aTmp.Insert( &aSelBoxes );
//Jetzt die Alten und die neuen abgleichen.
SwNodes& rNds = pAktCrsr->GetDoc()->GetNodes();
+ sal_uInt16 nPos;
const SwStartNode* pSttNd;
SwPaM* pCur = pAktCrsr;
do {
@@ -2161,35 +2192,31 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
pSttNd != pCur->GetMark()->nNode.GetNode().FindTableBoxStartNode() )
bDel = sal_True;
- else
+ else if( lcl_SeekEntry( aTmp, pSttNd, nPos ))
{
- SwSelBoxes::iterator it = aTmp.find(pSttNd->GetIndex());
- if( it != aTmp.end() )
- {
- SwNodeIndex aIdx( *pSttNd, 1 );
- const SwNode* pNd = &aIdx.GetNode();
- if( !pNd->IsCntntNode() )
- pNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
-
- SwPosition* pPos = pCur->GetMark();
- if( pNd != &pPos->nNode.GetNode() )
- pPos->nNode = *pNd;
- pPos->nContent.Assign( (SwCntntNode*)pNd, 0 );
-
- aIdx.Assign( *pSttNd->EndOfSectionNode(), - 1 );
- if( !( pNd = &aIdx.GetNode())->IsCntntNode() )
- pNd = rNds.GoPrevSection( &aIdx, sal_True, sal_False );
-
- pPos = pCur->GetPoint();
- if( pNd != &pPos->nNode.GetNode() )
- pPos->nNode = *pNd;
- pPos->nContent.Assign( (SwCntntNode*)pNd, ((SwCntntNode*)pNd)->Len() );
-
- aTmp.erase( it );
- }
- else
- bDel = sal_True;
+ SwNodeIndex aIdx( *pSttNd, 1 );
+ const SwNode* pNd = &aIdx.GetNode();
+ if( !pNd->IsCntntNode() )
+ pNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
+
+ SwPosition* pPos = pCur->GetMark();
+ if( pNd != &pPos->nNode.GetNode() )
+ pPos->nNode = *pNd;
+ pPos->nContent.Assign( (SwCntntNode*)pNd, 0 );
+
+ aIdx.Assign( *pSttNd->EndOfSectionNode(), - 1 );
+ if( !( pNd = &aIdx.GetNode())->IsCntntNode() )
+ pNd = rNds.GoPrevSection( &aIdx, sal_True, sal_False );
+
+ pPos = pCur->GetPoint();
+ if( pNd != &pPos->nNode.GetNode() )
+ pPos->nNode = *pNd;
+ pPos->nContent.Assign( (SwCntntNode*)pNd, ((SwCntntNode*)pNd)->Len() );
+
+ aTmp.Remove( nPos );
}
+ else
+ bDel = sal_True;
pCur = (SwPaM*)pCur->GetNext();
if( bDel )
@@ -2203,9 +2230,9 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
}
} while ( pAktCrsr != pCur );
- for( SwSelBoxes::const_iterator it = aTmp.begin(); it != aTmp.end(); ++it )
+ for( nPos = 0; nPos < aTmp.Count(); ++nPos )
{
- pSttNd = it->second->GetSttNd();
+ pSttNd = aTmp[ nPos ]->GetSttNd();
SwNodeIndex aIdx( *pSttNd, 1 );
if( &aIdx.GetNodes() != &rNds )
@@ -2244,7 +2271,7 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
void SwTableCursor::InsertBox( const SwTableBox& rTblBox )
{
SwTableBox* pBox = (SwTableBox*)&rTblBox;
- aSelBoxes.insert( pBox );
+ aSelBoxes.Insert( pBox );
bChg = sal_True;
}
@@ -2260,7 +2287,8 @@ bool SwTableCursor::NewTableSelection()
pTableNode->GetTable().IsNewModel() )
{
bRet = true;
- SwSelBoxes aNew( aSelBoxes );
+ SwSelBoxes aNew;
+ aNew.Insert( &aSelBoxes );
pTableNode->GetTable().CreateSelection( pStart, pEnd, aNew,
SwTable::SEARCH_NONE, false );
ActualizeSelection( aNew );
@@ -2271,37 +2299,31 @@ bool SwTableCursor::NewTableSelection()
void SwTableCursor::ActualizeSelection( const SwSelBoxes &rNew )
{
- SwSelBoxes::iterator itOld = aSelBoxes.begin();
- SwSelBoxes::const_iterator itNew = rNew.begin();
- while ( itOld != aSelBoxes.end() && itNew != rNew.end() )
+ sal_uInt16 nOld = 0, nNew = 0;
+ while ( nOld < aSelBoxes.Count() && nNew < rNew.Count() )
{
- const SwTableBox* pPOld = itOld->second;
- const SwTableBox* pPNew = itNew->second;
+ const SwTableBox* pPOld = *( aSelBoxes.GetData() + nOld );
+ const SwTableBox* pPNew = *( rNew.GetData() + nNew );
if( pPOld == pPNew )
{ // this box will stay
- ++itOld;
- ++itNew;
+ ++nOld;
+ ++nNew;
}
else if( pPOld->GetSttIdx() < pPNew->GetSttIdx() )
- {
- SwSelBoxes::iterator it = itOld;
- ++itOld;
- DeleteBox( it ); // this box has to go
- }
+ DeleteBox( nOld ); // this box has to go
else
{
InsertBox( *pPNew ); // this is a new one
- ++itOld;
- ++itNew;
+ ++nOld;
+ ++nNew;
}
}
- // some more to delete
- DeleteBox( itOld, aSelBoxes.end() );
+ while( nOld < aSelBoxes.Count() )
+ DeleteBox( nOld ); // some more to delete
- // some more to insert
- for( ; itNew != rNew.end(); ++itNew )
- InsertBox( *itNew->second );
+ for( ; nNew < rNew.Count(); ++nNew ) // some more to insert
+ InsertBox( **( rNew.GetData() + nNew ) );
}
sal_Bool SwTableCursor::IsCrsrMovedUpdt()
@@ -2340,12 +2362,14 @@ void SwTableCursor::ParkCrsr()
sal_Bool SwTableCursor::HasReadOnlyBoxSel() const
{
- for( SwSelBoxes::const_reverse_iterator it = aSelBoxes.rbegin(); it != aSelBoxes.rend(); ++it )
- if( it->second->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ sal_Bool bRet = sal_False;
+ for( sal_uInt16 n = aSelBoxes.Count(); n; )
+ if( aSelBoxes[ --n ]->GetFrmFmt()->GetProtect().IsCntntProtected() )
{
- return sal_True;
+ bRet = sal_True;
+ break;
}
- return sal_False;
+ return bRet;
}
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 44a2b95fc5d6..f4724ecd5871 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -169,11 +169,11 @@ sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple )
{
GetTblSel( *this, aBoxes, eType );
- if( aBoxes.empty() )
+ if( !aBoxes.Count() )
return sal_False;
- pStt = aBoxes.begin()->second;
- pEnd = aBoxes.rbegin()->second;
+ pStt = aBoxes[0];
+ pEnd = aBoxes[aBoxes.Count() - 1];
}
// #i32329# Enhanced table selection
else if ( pTable->IsNewModel() )
@@ -181,11 +181,11 @@ sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple )
const SwShellCrsr *pCrsr = _GetCrsr();
SwTable::SearchType eSearchType = bRow ? SwTable::SEARCH_ROW : SwTable::SEARCH_COL;
pTable->CreateSelection( *pCrsr, aBoxes, eSearchType, bCheckProtected );
- if( aBoxes.empty() )
+ if( !aBoxes.Count() )
return sal_False;
- pStt = aBoxes.begin()->second;
- pEnd = aBoxes.rbegin()->second;
+ pStt = aBoxes[0];
+ pEnd = aBoxes[aBoxes.Count() - 1];
}
else
{
@@ -217,13 +217,13 @@ sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple )
static_cast<const SwCellFrm*>(pEndFrm),
aBoxes, bSelectUp ? 0 : &aCells, eType );
- if( aBoxes.empty() || ( !bSelectUp && 4 != aCells.size() ) )
+ if( !aBoxes.Count() || ( !bSelectUp && 4 != aCells.size() ) )
return sal_False;
if ( bSelectUp )
{
- pStt = aBoxes.begin()->second;
- pEnd = aBoxes.rbegin()->second;
+ pStt = aBoxes[0];
+ pEnd = aBoxes[aBoxes.Count() - 1];
}
else
{
diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx
index 36ea67f4c736..09382e93073d 100644
--- a/sw/source/core/crsr/unocrsr.cxx
+++ b/sw/source/core/crsr/unocrsr.cxx
@@ -240,7 +240,10 @@ void SwUnoTableCrsr::MakeBoxSels()
if ( !bMakeTblCrsrs )
{
- DeleteAllBoxes();
+ SwSelBoxes& rTmpBoxes = (SwSelBoxes&)GetBoxes();
+ sal_uInt16 nCount = 0;
+ while( nCount < rTmpBoxes.Count() )
+ DeleteBox( nCount );
}
if( IsChgd() )
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index cbefb9f55135..2df5fff4b165 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -644,15 +644,15 @@ void SwShellTableCrsr::FillRects()
{
// Calculate the new rectangles.
// JP 16.01.98: If the cursor is still "parked" do nothing!!
- if( aSelBoxes.empty() || bParked ||
+ if( !aSelBoxes.Count() || bParked ||
!GetPoint()->nNode.GetIndex() )
return;
SwRegionRects aReg( GetShell()->VisArea() );
SwNodes& rNds = GetDoc()->GetNodes();
- for( SwSelBoxes::iterator it = aSelBoxes.begin(); it != aSelBoxes.end(); ++it )
+ for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n )
{
- const SwStartNode* pSttNd = it->second->GetSttNd();
+ const SwStartNode* pSttNd = (*(aSelBoxes.GetData() + n ))->GetSttNd();
const SwTableNode* pSelTblNd = pSttNd->FindTableNode();
SwNodeIndex aIdx( *pSttNd );
@@ -696,14 +696,14 @@ sal_Bool SwShellTableCrsr::IsInside( const Point& rPt ) const
{
// Calculate the new rectangles.
// JP 16.01.98: If the cursor is still "parked" do nothing!!
- if( aSelBoxes.empty() || bParked ||
+ if( !aSelBoxes.Count() || bParked ||
!GetPoint()->nNode.GetIndex() )
return sal_False;
SwNodes& rNds = GetDoc()->GetNodes();
- for( SwSelBoxes::const_iterator it = aSelBoxes.begin(); it != aSelBoxes.end(); ++it )
+ for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n )
{
- SwNodeIndex aIdx( *it->second->GetSttNd() );
+ SwNodeIndex aIdx( *(*(aSelBoxes.GetData() + n ))->GetSttNd() );
SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
if( !pCNd )
continue;
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 08e4f4062fcb..e08fe3353324 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -784,21 +784,22 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
SwPosition aPos( aIndex );
aPos.nContent.Assign( pNode, 0 );
- if( pSelBoxes && !pSelBoxes->empty() )
+ if( pSelBoxes && pSelBoxes->Count() )
{
// Table selection
// Copy parts of a table: create a table with the same width as the
// original one and move (copy and delete) the selected boxes.
// The size is corrected on a percentage basis.
- const SwTableNode* pTblNd = pSelBoxes->begin()->second->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = (SwTableNode*)(*pSelBoxes)[0]->
+ GetSttNd()->FindTableNode();
if( !pTblNd )
break;
- const SwTable& rTbl = pTblNd->GetTable();
+ SwTable& rTbl = pTblNd->GetTable();
// Did we select the whole table?
- if( pSelBoxes->size() == rTbl.GetTabSortBoxes().Count() )
+ if( pSelBoxes->Count() == rTbl.GetTabSortBoxes().Count() )
{
// move the whole table
SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode(), 1 );
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index dd3f81011cf9..3cc31df8951e 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -492,8 +492,8 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
{
// Via SwDoc for Undo!
- OSL_ENSURE( !rBoxes.empty(), "no valid Box list" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>( rBoxes.begin()->second->GetSttNd()->FindTableNode() );
+ OSL_ENSURE( rBoxes.Count(), "no valid Box list" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -560,8 +560,8 @@ sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
SwUndoSort* pUndoSort = 0;
if (GetIDocumentUndoRedo().DoesUndo())
{
- pUndoSort = new SwUndoSort( rBoxes.begin()->second->GetSttIdx(),
- rBoxes.rbegin()->second->GetSttIdx(),
+ pUndoSort = new SwUndoSort( rBoxes[0]->GetSttIdx(),
+ rBoxes[rBoxes.Count()-1]->GetSttIdx(),
*pTblNd, rOpt, aFlatBox.HasItemSets() );
GetIDocumentUndoRedo().AppendUndo(pUndoSort);
}
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 60a2a28ca387..8c3e96096830 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -52,8 +52,8 @@
#include <fmtfsize.hxx>
#include <list>
-static sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara );
-static sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara );
+sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara );
+sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara );
void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
SwTable& rDstTbl, SwTableBox* pDstBox,
sal_Bool bDelCntnt, SwUndoTblCpyTbl* pUndo );
@@ -195,7 +195,7 @@ namespace
{
if( !rFndBox.GetLines().empty() )
{
- bool bNoSelection = rSelBoxes.size() < 2;
+ bool bNoSelection = rSelBoxes.Count() < 2;
_FndLines &rFndLines = rFndBox.GetLines();
maCols.push_front(0);
const SwTableLine* pLine = rFndLines.front().GetLine();
@@ -320,13 +320,13 @@ namespace
{
BoxSpanInfo aInfo;
if( pSelBoxes &&
- 0 != pSelBoxes->count( pBox ) )
+ USHRT_MAX != pSelBoxes->GetPos( pBox ) )
{
aInfo.mbSelected = true;
if( mnStartCol == USHRT_MAX )
{
mnStartCol = (sal_uInt16)maLines[nLine].size();
- if( pSelBoxes->size() < 2 )
+ if( pSelBoxes->Count() < 2 )
{
pSelBoxes = 0;
aInfo.mbSelected = false;
@@ -693,7 +693,7 @@ sal_Bool SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBox
if( aTarget.mnAddLine && IsNewModel() )
{
SwSelBoxes aBoxes;
- aBoxes.insert( GetTabLines()[ GetTabLines().Count()-1 ]->GetTabBoxes()[0] );
+ aBoxes.Insert( GetTabLines()[ GetTabLines().Count()-1 ]->GetTabBoxes()[0] );
if( pUndo )
pUndo->InsertRow( *this, aBoxes, aTarget.mnAddLine );
else
@@ -820,7 +820,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox,
sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
SwUndoTblCpyTbl* pUndo )
{
- OSL_ENSURE( !rSelBoxes.empty(), "Missing selection" );
+ OSL_ENSURE( rSelBoxes.Count(), "Missing selection" );
SetHTMLTableLayout( 0 ); // Delete HTML Layout
@@ -834,7 +834,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
SwTblNumFmtMerge aTNFM( *pCpyDoc, *pDoc );
- SwTableBox *pTmpBox, *pSttBox = rSelBoxes.begin()->second;
+ SwTableBox *pTmpBox, *pSttBox = (SwTableBox*)rSelBoxes[0];
sal_uInt16 nLn, nBx;
_FndLine *pFLine, *pInsFLine = 0;
@@ -873,7 +873,7 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
// If we don't have enough Lines, then see if we can insert
// new ones to reach our goal. But only if the SSelection
// contains a Box!
- if( 1 < rSelBoxes.size() )
+ if( 1 < rSelBoxes.Count() )
return sal_False;
sal_uInt16 nNewLns = rCpyTbl.GetTabLines().Count() -
@@ -1015,9 +1015,9 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
if( 1 == rCpyTbl.GetTabSortBoxes().Count() )
{
SwTableBox *pTmpBx = rCpyTbl.GetTabSortBoxes()[0];
- for( SwSelBoxes::const_iterator it = rSelBoxes.begin(); it != rSelBoxes.end(); ++it )
+ for( sal_uInt16 n = 0; n < rSelBoxes.Count(); ++n )
lcl_CpyBox( rCpyTbl, pTmpBx, *this,
- it->second, sal_True, pUndo );
+ (SwTableBox*)rSelBoxes[n], sal_True, pUndo );
}
else
for( nLn = 0; nLn < aFndBox.GetLines().size(); ++nLn )
@@ -1040,11 +1040,11 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara )
{
- SwTableBox* pBox = const_cast<SwTableBox*>(rpBox);
+ SwTableBox* pBox = (SwTableBox*)rpBox;
if( rpBox->GetTabLines().Count() )
pBox->GetTabLines().ForEach( &_FndCntntLine, pPara );
else
- static_cast<SwSelBoxes*>(pPara)->insert( pBox );
+ ((SwSelBoxes*)pPara)->Insert( pBox );
return sal_True;
}
@@ -1064,7 +1064,7 @@ SwSelBoxes& SwTable::SelLineFromBox( const SwTableBox* pBox,
pLine = pLine->GetUpper()->GetUpper();
// Delete all old ones
- rBoxes.clear();
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
pLine->GetTabBoxes().ForEach( &_FndCntntBox, &rBoxes );
return rBoxes;
}
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 3afdfb03d646..34010bbee1fe 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -528,8 +528,8 @@ SwRowFrm* GetRowFrm( SwTableLine& rLine )
sal_Bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind )
{
- OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid Box List" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>( rBoxes.begin()->second->GetSttNd()->FindTableNode() );
+ OSL_ENSURE( rBoxes.Count() && nCnt, "No valid Box List" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -584,8 +584,8 @@ sal_Bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 n
sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
sal_uInt16 nCnt, sal_Bool bBehind )
{
- OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid Box List" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>( rBoxes.begin()->second->GetSttNd()->FindTableNode() );
+ OSL_ENSURE( pDoc && rBoxes.Count && nCnt, "No valid Box List" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -947,7 +947,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
SwTwips nBoxStt, SwTwips nBoxWidth,
sal_uInt16 nLinePos, sal_Bool bNxt,
- SwSelBoxes* pAllDelBoxes, SwSelBoxes::iterator* pCurPos )
+ SwSelBoxes* pAllDelBoxes, sal_uInt16* pCurPos )
{
SwTableBox* pFndBox = 0;
do {
@@ -984,16 +984,16 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
else if( pAllDelBoxes )
{
// If the predecessor will also be deleted, there's nothing to do
- SwSelBoxes::iterator it = pAllDelBoxes->find( pFndBox );
- if( it == pAllDelBoxes->end() )
+ sal_uInt16 nFndPos;
+ if( !pAllDelBoxes->Seek_Entry( pFndBox, &nFndPos ) )
break;
// else, we keep on searching.
// We do not need to recheck the Box, however
- if( pFndBox->GetSttIdx() <= (*pCurPos)->second->GetSttIdx() )
- --*pCurPos;
pFndBox = 0;
- pAllDelBoxes->erase( it );
+ if( nFndPos <= *pCurPos )
+ --*pCurPos;
+ pAllDelBoxes->Remove( nFndPos );
}
} while( bNxt ? ( nLinePos + 1 < rTblLns.Count() ) : nLinePos );
return pFndBox;
@@ -1002,7 +1002,7 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox,
SwShareBoxFmts& rShareFmts,
SwSelBoxes* pAllDelBoxes = 0,
- SwSelBoxes::iterator* pCurPos = 0 )
+ sal_uInt16* pCurPos = 0 )
{
//JP 16.04.97: 2. part for Bug 36271
sal_Bool bChgd = sal_False;
@@ -1081,9 +1081,9 @@ sal_Bool SwTable::DeleteSel(
{
OSL_ENSURE( pDoc, "No doc?" );
SwTableNode* pTblNd = 0;
- if( !rBoxes.empty() )
+ if( rBoxes.Count() )
{
- pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
}
@@ -1094,9 +1094,9 @@ sal_Bool SwTable::DeleteSel(
_FndBox aFndBox( 0, 0 );
if ( bDelMakeFrms )
{
- if( pMerged && !pMerged->empty() )
+ if( pMerged && pMerged->Count() )
aFndBox.SetTableLines( *pMerged, *this );
- else if( !rBoxes.empty() )
+ else if( rBoxes.Count() )
aFndBox.SetTableLines( rBoxes, *this );
aFndBox.DelFrms( *this );
}
@@ -1106,26 +1106,29 @@ sal_Bool SwTable::DeleteSel(
// First switch the Border, then delete
if( bCorrBorder )
{
- SwSelBoxes aBoxes( rBoxes );
- for( SwSelBoxes::iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
- ::lcl_SaveUpperLowerBorder( *this, *it->second, aShareFmts,
- &aBoxes, &it );
+ SwSelBoxes aBoxes;
+ aBoxes.Insert( &rBoxes );
+ for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
+ ::lcl_SaveUpperLowerBorder( *this, *rBoxes[ n ], aShareFmts,
+ &aBoxes, &n );
}
PrepareDelBoxes( rBoxes );
SwChartDataProvider *pPCD = pDoc->GetChartDataProvider();
// Delete boxes from last to first
- for( SwSelBoxes::const_reverse_iterator it = rBoxes.rbegin(); it != rBoxes.rend(); ++it )
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
{
+ sal_uInt16 nIdx = rBoxes.Count() - 1 - n;
+
// First adapt the data-sequence for chart if necessary
// (needed to move the implementation cursor properly to it's new
// position which can't be done properly if the cell is already gone)
if (pPCD && pTblNd)
- pPCD->DeleteBox( &pTblNd->GetTable(), *it->second );
+ pPCD->DeleteBox( &pTblNd->GetTable(), *rBoxes[nIdx] );
// ... then delete the boxes
- _DeleteBox( *this, it->second, pUndo, sal_True, bCorrBorder, &aShareFmts );
+ _DeleteBox( *this, rBoxes[nIdx], pUndo, sal_True, bCorrBorder, &aShareFmts );
}
// then clean up the structure of all Lines
@@ -1146,8 +1149,8 @@ sal_Bool SwTable::DeleteSel(
sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
sal_Bool bSameHeight )
{
- OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "No valid values" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -1160,17 +1163,17 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
// If the rows should get the same (min) height, we first have
// to store the old row heights before deleting the frames
- std::vector<long> aRowHeights;
+ long* pRowHeights = 0;
if ( bSameHeight )
{
- aRowHeights.reserve(rBoxes.size());
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ pRowHeights = new long[ rBoxes.Count() ];
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
{
- SwTableBox* pSelBox = it->second;
+ SwTableBox* pSelBox = *( rBoxes.GetData() + n );
const SwRowFrm* pRow = GetRowFrm( *pSelBox->GetUpper() );
OSL_ENSURE( pRow, "Where is the SwTableLine's Frame?" );
SWRECTFN( pRow )
- aRowHeights.push_back((pRow->Frm().*fnRect->fnGetHeight)());
+ pRowHeights[ n ] = (pRow->Frm().*fnRect->fnGetHeight)();
}
}
@@ -1179,10 +1182,9 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
aFndBox.SetTableLines( rBoxes, *this );
aFndBox.DelFrms( *this );
- sal_uInt16 n = 0;
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it, ++n )
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
{
- SwTableBox* pSelBox = it->second;
+ SwTableBox* pSelBox = *( rBoxes.GetData() + n );
OSL_ENSURE( pSelBox, "Box is not within the Table" );
// Insert nCnt new Lines into the Box
@@ -1196,7 +1198,7 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
sal_Bool bChgLineSz = 0 != aFSz.GetHeight() || bSameHeight;
if ( bChgLineSz )
- aFSz.SetHeight( ( bSameHeight ? aRowHeights[ n ] : aFSz.GetHeight() ) /
+ aFSz.SetHeight( ( bSameHeight ? pRowHeights[ n ] : aFSz.GetHeight() ) /
(nCnt + 1) );
SwTableBox* pNewBox = new SwTableBox( pFrmFmt, nCnt, pInsLine );
@@ -1277,6 +1279,8 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
pFrmFmt->ResetFmtAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 );
}
+ delete[] pRowHeights;
+
GCLines();
aFndBox.MakeFrms( *this );
@@ -1288,8 +1292,8 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
{
- OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "No valid values" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -1299,7 +1303,8 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
pDoc->CreateChartInternalDataProviders( this );
SetHTMLTableLayout( 0 ); // Delete HTML Layout
- SwSelBoxes aSelBoxes( rBoxes );
+ SwSelBoxes aSelBoxes;
+ aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count());
ExpandSelection( aSelBoxes );
// Find Lines for the Layout update
@@ -1310,9 +1315,9 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
_CpyTabFrms aFrmArr;
SvPtrarr aLastBoxArr;
sal_uInt16 nFndPos;
- for( SwSelBoxes::const_iterator it = aSelBoxes.begin(); it != aSelBoxes.end(); ++it )
+ for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n )
{
- SwTableBox* pSelBox = it->second;
+ SwTableBox* pSelBox = *( aSelBoxes.GetData() + n );
OSL_ENSURE( pSelBox, "Box steht nicht in der Tabelle" );
// We don't want to split small table cells into very very small cells
@@ -1728,8 +1733,8 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara)
sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes,
SwTableBox* pMergeBox, SwUndoTblMerge* pUndo )
{
- OSL_ENSURE( !rBoxes.empty() && pMergeBox, "no valid values" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( rBoxes.Count() && pMergeBox, "no valid values" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -2753,7 +2758,7 @@ sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
return sal_False;
if( pBox->GetSttNd() )
- rParam.aBoxes.insert( pBox );
+ rParam.aBoxes.Insert( pBox );
break;
}
@@ -3148,7 +3153,7 @@ sal_Bool lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox,
else
{
SwTableBox* pBox = &rBox;
- rParam.aBoxes.insert( pBox );
+ rParam.aBoxes.Insert( pBox );
}
}
else
@@ -3494,7 +3499,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo,
// Find all Boxes/Lines
SwTable& rTbl = rParam.pTblNd->GetTable();
- if( rParam.aBoxes.empty() )
+ if( !rParam.aBoxes.Count() )
{
// Get the Boxes
if( rParam.bBigger )
@@ -3506,7 +3511,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo,
}
// Prevent deleting the whole Table
- if( rParam.bBigger && rParam.aBoxes.size() == rTbl.GetTabSortBoxes().Count() )
+ if( rParam.bBigger && rParam.aBoxes.Count() == rTbl.GetTabSortBoxes().Count() )
return 0;
_FndBox* pFndBox = new _FndBox( 0, 0 );
@@ -3648,7 +3653,8 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
{
pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo,
aTmpLst, nDistStt );
- if( aParam.bBigger && aParam.aBoxes.size() == aSortCntBoxes.Count() )
+ if( aParam.bBigger && aParam.aBoxes.Count() ==
+ aSortCntBoxes.Count() )
{
// This whole Table is to be deleted!
GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes );
@@ -4028,10 +4034,10 @@ _FndBox* lcl_SaveInsDelData( CR_SetLineHeight& rParam, SwUndo** ppUndo,
// Find all Boxes/Lines
SwTable& rTbl = rParam.pTblNd->GetTable();
- OSL_ENSURE( !rParam.aBoxes.empty(), "We can't go on without Boxes!" );
+ OSL_ENSURE( rParam.aBoxes.Count(), "We can't go on without Boxes!" );
// Prevent deleting the whole Table
- if( !rParam.bBigger && rParam.aBoxes.size() == rTbl.GetTabSortBoxes().Count() )
+ if( !rParam.bBigger && rParam.aBoxes.Count() == rTbl.GetTabSortBoxes().Count() )
return 0;
_FndBox* pFndBox = new _FndBox( 0, 0 );
@@ -4249,7 +4255,7 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam,
return sal_False;
if( pBox->GetSttNd() )
- rParam.aBoxes.insert( pBox );
+ rParam.aBoxes.Insert( pBox );
else
{
for( sal_uInt16 i = pBox->GetTabLines().Count(); i; )
@@ -4342,7 +4348,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
{
if( bInsDel )
{
- if( aParam.aBoxes.empty() )
+ if( !aParam.aBoxes.Count() )
::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
aParam, 0, sal_True );
@@ -4350,7 +4356,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
// delete complete table when last row is deleted
if( !bBigger &&
- aParam.aBoxes.size() == aSortCntBoxes.Count() )
+ aParam.aBoxes.Count() == aSortCntBoxes.Count() )
{
GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes );
return sal_False;
@@ -4428,7 +4434,7 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
// Adjust
if( bInsDel )
{
- if( aParam.aBoxes.empty() )
+ if( !aParam.aBoxes.Count() )
::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
aParam, 0, sal_True );
pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst );
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index a338deda34c6..2d231455f7cb 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1672,7 +1672,7 @@ sal_Bool SwDoc::InsertCol( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bB
::GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
sal_Bool bRet = sal_False;
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
bRet = InsertCol( aBoxes, nCnt, bBehind );
return bRet;
}
@@ -1680,8 +1680,8 @@ sal_Bool SwDoc::InsertCol( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bB
sal_Bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind )
{
// uebers SwDoc fuer Undo !!
- OSL_ENSURE( !rBoxes.empty(), "keine gueltige Box-Liste" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -1735,7 +1735,7 @@ sal_Bool SwDoc::InsertRow( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bB
GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
sal_Bool bRet = sal_False;
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
bRet = InsertRow( aBoxes, nCnt, bBehind );
return bRet;
}
@@ -1743,8 +1743,8 @@ sal_Bool SwDoc::InsertRow( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bB
sal_Bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind )
{
// uebers SwDoc fuer Undo !!
- OSL_ENSURE( !rBoxes.empty(), "keine gueltige Box-Liste" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -1931,8 +1931,8 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
return sal_False;
// uebers SwDoc fuer Undo !!
- OSL_ENSURE( !rBoxes.empty(), "keine gueltige Box-Liste" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -1940,7 +1940,8 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
return sal_False;
::ClearFEShellTabCols();
- SwSelBoxes aSelBoxes( rBoxes );
+ SwSelBoxes aSelBoxes;
+ aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count());
SwTable &rTable = pTblNd->GetTable();
long nMin = 0;
long nMax = 0;
@@ -1954,10 +1955,10 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
// soll die gesamte Tabelle geloescht werden ??
const sal_uLong nTmpIdx1 = pTblNd->GetIndex();
- const sal_uLong nTmpIdx2 = aSelBoxes.rbegin()->second->GetSttNd()->
+ const sal_uLong nTmpIdx2 = aSelBoxes[ aSelBoxes.Count()-1 ]->GetSttNd()->
EndOfSectionIndex()+1;
- if( pTblNd->GetTable().GetTabSortBoxes().Count() == aSelBoxes.size() &&
- aSelBoxes.begin()->second->GetSttIdx()-1 == nTmpIdx1 &&
+ if( pTblNd->GetTable().GetTabSortBoxes().Count() == aSelBoxes.Count() &&
+ aSelBoxes[0]->GetSttIdx()-1 == nTmpIdx1 &&
nTmpIdx2 == pTblNd->EndOfSectionIndex() )
{
sal_Bool bNewTxtNd = sal_False;
@@ -2140,8 +2141,8 @@ sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 n
sal_Bool bSameHeight )
{
// uebers SwDoc fuer Undo !!
- OSL_ENSURE( !rBoxes.empty() && nCnt, "keine gueltige Box-Liste" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -2160,9 +2161,9 @@ sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 n
aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
if( !bVert )
{
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it)
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
{
- const SwStartNode* pSttNd = it->second->GetSttNd();
+ const SwStartNode* pSttNd = rBoxes[ n ]->GetSttNd();
aNdsCnts.push_back( pSttNd->EndOfSectionIndex() -
pSttNd->GetIndex() );
}
@@ -2536,7 +2537,13 @@ bool FuzzyCompare::operator() ( long s1, long s2 ) const
bool lcl_IsFrmInColumn( const SwCellFrm& rFrm, SwSelBoxes& rBoxes )
{
- return 0 != rBoxes.count(rFrm.GetTabBox());
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
+ {
+ if ( rFrm.GetTabBox() == rBoxes[ i ] )
+ return true;
+ }
+
+ return false;
}
//
@@ -2932,7 +2939,8 @@ void SwCollectTblLineBoxes::AddToUndoHistory( const SwCntntNode& rNd )
void SwCollectTblLineBoxes::AddBox( const SwTableBox& rBox )
{
aPosArr.push_back(nWidth);
- aBoxes.push_back( &rBox );
+ SwTableBox* p = (SwTableBox*)&rBox;
+ aBoxes.Insert( p, aBoxes.Count() );
nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth();
}
@@ -2964,10 +2972,10 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
sal_Bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
{
- if( !aPosArr.empty() )
- {
- sal_uInt16 n;
+ sal_uInt16 n;
+ if( aPosArr.size() )
+ {
for( n = 0; n < aPosArr.size(); ++n )
{
if( aPosArr[ n ] == nOffset )
@@ -2981,7 +2989,7 @@ sal_Bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth
}
aPosArr.erase(aPosArr.begin(), aPosArr.begin()+n);
- aBoxes.erase(aBoxes.begin(), aBoxes.begin()+n);
+ aBoxes.Remove( 0, n );
// dann die Positionen der neuen Size anpassen
for( n = 0; n < aPosArr.size(); ++n )
@@ -3710,8 +3718,8 @@ sal_Bool lcl_SetAFmtBox( _FndBox & rBox, _SetAFmtTabPara *pSetPara )
// AutoFormat fuer die Tabelle/TabellenSelection
sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew )
{
- OSL_ENSURE( !rBoxes.empty(), "keine gueltige Box-Liste" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -3797,8 +3805,8 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt&
// Erfrage wie attributiert ist
sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet )
{
- OSL_ENSURE( !rBoxes.empty(), "keine gueltige Box-Liste" );
- SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes.begin()->second->GetSttNd()->FindTableNode());
+ OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
if( !pTblNd )
return sal_False;
@@ -4248,7 +4256,7 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
const SwTableNode* pSrcTblNd = pCpyTbl
? pCpyTbl->GetTableNode()
- : rBoxes.begin()->second->GetSttNd()->FindTableNode();
+ : rBoxes[ 0 ]->GetSttNd()->FindTableNode();
SwTableNode * pInsTblNd = rInsPos.nNode.GetNode().FindTableNode();
@@ -4333,7 +4341,7 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
// no complex into complex, but copy into or from new model is welcome
if( ( !pSrcTblNd->GetTable().IsTblComplex() || pInsTblNd->GetTable().IsNewModel() )
- && ( bDelCpyDoc || !rBoxes.empty() ) )
+ && ( bDelCpyDoc || rBoxes.Count() ) )
{
// dann die Tabelle "relativ" kopieren
const SwSelBoxes* pBoxes;
@@ -4344,7 +4352,7 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
SwTableBox* pBox = pInsTblNd->GetTable().GetTblBox(
pSttNd->GetIndex() );
OSL_ENSURE( pBox, "Box steht nicht in dieser Tabelle" );
- aBoxes.insert( pBox );
+ aBoxes.Insert( pBox );
pBoxes = &aBoxes;
}
else
@@ -4446,16 +4454,16 @@ sal_Bool SwDoc::UnProtectCells( const String& rName )
sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
{
sal_Bool bChgd = sal_False;
- if( !rBoxes.empty() )
+ if( rBoxes.Count() )
{
SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
- ? new SwUndoAttrTbl( *rBoxes.begin()->second->GetSttNd()->FindTableNode() )
+ ? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() )
: 0;
SvPtrarr aFmts( 16 ), aNewFmts( 16 );
- for( SwSelBoxes::const_reverse_iterator it = rBoxes.rbegin(); it != rBoxes.rend(); ++it )
+ for( sal_uInt16 i = rBoxes.Count(); i; )
{
- SwTableBox* pBox = it->second;
+ SwTableBox* pBox = rBoxes[ --i ];
SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
if( pBoxFmt->GetProtect().IsCntntProtected() )
{
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index da40f248358a..7f8b5936a15c 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -147,12 +147,12 @@ sal_Bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
{
SwTableBox* pBox = (SwTableBox*)pNd->FindTableNode()->GetTable().
GetTblBox( pNd->GetIndex() );
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
}
} while( bAllCrsr &&
pSttPam != ( pCurPam = (SwPaM*)pCurPam->GetNext()) );
}
- return !rBoxes.empty();
+ return 0 != rBoxes.Count();
}
/***********************************************************************
@@ -251,7 +251,7 @@ void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLine
return ;
//Die selektierte Struktur kopieren.
- const SwTable &rTable = aBoxes.begin()->second->GetSttNd()->FindTableNode()->GetTable();
+ const SwTable &rTable = aBoxes[0]->GetSttNd()->FindTableNode()->GetTable();
LinesAndTable aPara( rArr, rTable );
_FndBox aFndBox( 0, 0 );
{
@@ -1130,10 +1130,10 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) );
}
- SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aBoxes.size()) ) );
- for( SwSelBoxes::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aBoxes.Count()) ) );
+ for ( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
{
- SwTableBox *pBox = it->second;
+ SwTableBox *pBox = aBoxes[i];
SwFrmFmt *pNewFmt;
if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), 0 )))
@@ -1176,15 +1176,14 @@ sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) cons
bRet = sal_True;
sal_Bool bOneFound = sal_False;
const sal_uInt16 nWhich = rToFill.Which();
- for( SwSelBoxes::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
{
- SwTableBox* pBox = it->second;
switch ( nWhich )
{
case RES_BACKGROUND:
{
const SvxBrushItem &rBack =
- pBox->GetFrmFmt()->GetBackground();
+ aBoxes[i]->GetFrmFmt()->GetBackground();
if( !bOneFound )
{
(SvxBrushItem&)rToFill = rBack;
@@ -1198,7 +1197,7 @@ sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) cons
case RES_FRAMEDIR:
{
const SvxFrameDirectionItem& rDir =
- pBox->GetFrmFmt()->GetFrmDir();
+ aBoxes[i]->GetFrmFmt()->GetFrmDir();
if( !bOneFound )
{
(SvxFrameDirectionItem&)rToFill = rDir;
@@ -1210,7 +1209,7 @@ sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) cons
case RES_VERT_ORIENT:
{
const SwFmtVertOrient& rOrient =
- pBox->GetFrmFmt()->GetVertOrient();
+ aBoxes[i]->GetFrmFmt()->GetVertOrient();
if( !bOneFound )
{
(SwFmtVertOrient&)rToFill = rOrient;
@@ -1247,10 +1246,10 @@ sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor ) const
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
SwSelBoxes aBoxes;
if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes ))
- for( SwSelBoxes::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
{
const SwFmtVertOrient &rOri =
- it->second->GetFrmFmt()->GetVertOrient();
+ aBoxes[i]->GetFrmFmt()->GetVertOrient();
if( USHRT_MAX == nAlign )
nAlign = static_cast<sal_uInt16>(rOri.GetVertOrient());
else if( rOri.GetVertOrient() != nAlign )
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index d02ed2ad8af7..92882779b70a 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -210,11 +210,11 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
SwTableNode* pTblNd;
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes );
- if( !aBoxes.empty() &&
- NULL != (pTblNd = const_cast<SwTableNode*>(aBoxes.begin()->second->GetSttNd()->FindTableNode()) ))
+ if( aBoxes.Count() && 0 != (pTblNd = (SwTableNode*)aBoxes[0]
+ ->GetSttNd()->FindTableNode() ))
{
// teste ob der TabellenName kopiert werden kann
- sal_Bool bCpyTblNm = aBoxes.size() == pTblNd->GetTable().GetTabSortBoxes().Count();
+ sal_Bool bCpyTblNm = aBoxes.Count() == pTblNd->GetTable().GetTabSortBoxes().Count();
if( bCpyTblNm )
{
const String& rTblName = pTblNd->GetTable().GetFrmFmt()->GetName();
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index f97f26a0a989..755e74e4cf81 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -277,16 +277,16 @@ sal_Bool SwEditShell::GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const
if ( pFrm )
{
SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
- aBoxes.insert( pBox );
+ aBoxes.Insert( pBox );
}
} while( sal_False );
}
- for( SwSelBoxes::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
{
- const SwTableBox* pSelBox = it->second;
- const SwTableBoxFmt* pTblFmt = static_cast<SwTableBoxFmt*>(pSelBox->GetFrmFmt());
- if( it == aBoxes.begin() )
+ const SwTableBox* pSelBox = aBoxes[ n ];
+ const SwTableBoxFmt* pTblFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt();
+ if( !n )
{
// Formeln in die externe Darstellung bringen!
const SwTable& rTbl = pSelBox->GetSttNd()->FindTableNode()->GetTable();
@@ -319,7 +319,7 @@ void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet )
if ( pFrm )
{
SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
- aBoxes.insert( pBox );
+ aBoxes.Insert( pBox );
}
} while( sal_False );
}
@@ -330,8 +330,8 @@ void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet )
StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
- for( SwSelBoxes::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
- GetDoc()->SetTblBoxFormulaAttrs( *it->second, rSet );
+ for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
+ GetDoc()->SetTblBoxFormulaAttrs( *aBoxes[ n ], rSet );
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
EndAllAction();
}
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index a3bc8f6c2194..700de059c237 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -348,11 +348,10 @@ void SwTableFormula::_MakeFormel( const SwTable& rTbl, String& rNewStr,
rNewStr += '(';
bool bDelim = false;
- for( SwSelBoxes::iterator it = aBoxes.begin();
- it != aBoxes.end() && !pCalcPara->rCalc.IsCalcError();
- ++it )
+ for( sal_uInt16 n = 0; n < aBoxes.Count() &&
+ !pCalcPara->rCalc.IsCalcError(); ++n )
{
- const SwTableBox* pTblBox = it->second;
+ const SwTableBox* pTblBox = aBoxes[n];
if ( pTblBox->getRowSpan() >= 1 )
{
if( bDelim )
@@ -875,11 +874,12 @@ String lcl_BoxNmToRel( const SwTable& rTbl, const SwTableNode& rTblNd,
sal_uInt16 SwTableFormula::GetBoxesOfFormula( const SwTable& rTbl,
SwSelBoxes& rBoxes )
{
- rBoxes.clear();
+ if( rBoxes.Count() )
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
BoxNmToPtr( &rTbl );
ScanString( &SwTableFormula::_GetFmlBoxes, rTbl, &rBoxes );
- return rBoxes.size();
+ return rBoxes.Count();
}
void SwTableFormula::_GetFmlBoxes( const SwTable& rTbl, String& ,
@@ -911,10 +911,10 @@ void SwTableFormula::_GetFmlBoxes( const SwTable& rTbl, String& ,
// deren Werte
SwSelBoxes aBoxes;
GetBoxes( *pSttBox, *pEndBox, aBoxes );
- pBoxes->insert( aBoxes.begin(), aBoxes.end() );
+ pBoxes->Insert( &aBoxes );
}
else if( pSttBox ) // nur die StartBox ?
- pBoxes->insert( pSttBox );
+ pBoxes->Insert( pSttBox );
}
void SwTableFormula::GetBoxes( const SwTableBox& rSttBox,
@@ -959,20 +959,14 @@ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox,
break;
// dann mal die Tabellenkoepfe raus:
- for( SwSelBoxes::iterator it = rBoxes.begin(); it != rBoxes.end(); )
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
{
- pLine = it->second->GetUpper();
+ pLine = rBoxes[n]->GetUpper();
while( pLine->GetUpper() )
pLine = pLine->GetUpper()->GetUpper();
if( pTbl->IsHeadline( *pLine ) )
- {
- rBoxes.erase( it++ );
- }
- else
- {
- ++it;
- }
+ rBoxes.Remove( n--, 1 );
}
} while( sal_False );
}
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 0bdd9ce00c9c..505cbbde30ee 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -589,8 +589,8 @@ sal_Bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt,
const SwTableNode* pTblNd;
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes );
- if( !aBoxes.empty() &&
- NULL != (pTblNd = aBoxes.begin()->second->GetSttNd()->FindTableNode()) )
+ if( aBoxes.Count() &&
+ 0 != (pTblNd = aBoxes[0]->GetSttNd()->FindTableNode()) )
{
SwPosition* pDstPos = 0;
if( this == pDestShell )
@@ -616,7 +616,7 @@ sal_Bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt,
bRet = pDestShell->GetDoc()->InsCopyOfTbl( *pDstPos, aBoxes,0,
bIsMove && this == pDestShell &&
- aBoxes.size() == pTblNd->GetTable().
+ aBoxes.Count() == pTblNd->GetTable().
GetTabSortBoxes().Count(),
this != pDestShell );
@@ -859,7 +859,7 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
SwTableBox* pBox = pDestNd->GetTable().GetTblBox(
pSttNd->GetIndex() );
OSL_ENSURE( pBox, "Box steht nicht in dieser Tabelle" );
- aBoxes.insert( pBox );
+ aBoxes.Insert( pBox );
}
SwNodeIndex aNdIdx( *pDestNd->EndOfSectionNode());
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index fbcccbda3a72..92f9f842198f 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -611,13 +611,13 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali
if( IsTableMode() )
{
GetTblSel( *this, aBoxes );
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
{
// Crsr should be removed from the removal area.
// Always put it after/on the table; via the
// document position they will be set to the old
// position
- ParkCrsr( SwNodeIndex( *aBoxes.begin()->second->GetSttNd() ));
+ ParkCrsr( SwNodeIndex( *aBoxes[0]->GetSttNd() ));
// #i127787# pCurCrsr will be deleted in ParkCrsr,
// we better get the current pCurCrsr instead of working with the
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index a8952df6f42a..28938d00a1b9 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -221,10 +221,10 @@ sal_Bool SwFEShell::InsertRow( sal_uInt16 nCnt, sal_Bool bBehind )
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
- TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
+ TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.Count() );
sal_Bool bRet = sal_False;
- if ( !aBoxes.empty() )
+ if ( aBoxes.Count() )
bRet = GetDoc()->InsertRow( aBoxes, nCnt, bBehind );
EndAllActionAndCall();
@@ -259,10 +259,10 @@ sal_Bool SwFEShell::InsertCol( sal_uInt16 nCnt, sal_Bool bBehind )
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
- TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
+ TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.Count() );
sal_Bool bRet = sal_False;
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
bRet = GetDoc()->InsertCol( aBoxes, nCnt, bBehind );
EndAllActionAndCall();
@@ -314,9 +314,9 @@ sal_Bool SwFEShell::DeleteCol()
sal_Bool bRet;
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
- if ( !aBoxes.empty() )
+ if ( aBoxes.Count() )
{
- TblWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
+ TblWait( aBoxes.Count(), pFrm, *GetDoc()->GetDocShell() );
// remove crsr from the deletion area.
// Put them behind/on the table; via the
@@ -361,9 +361,9 @@ sal_Bool SwFEShell::DeleteRow()
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
{
- TblWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
+ TblWait( aBoxes.Count(), pFrm, *GetDoc()->GetDocShell() );
// Delete cursors from the deletion area.
// Then the cursor is:
@@ -522,9 +522,9 @@ sal_Bool SwFEShell::SplitTab( sal_Bool bVert, sal_uInt16 nCnt, sal_Bool bSameHei
sal_Bool bRet;
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes );
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
{
- TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
+ TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.Count() );
// now delete the columns
bRet = GetDoc()->SplitTbl( aBoxes, bVert, nCnt, bSameHeight );
@@ -933,12 +933,12 @@ sal_Bool SwFEShell::HasWholeTabSelection() const
{
SwSelBoxes aBoxes;
::GetTblSelCrs( *this, aBoxes );
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
{
const SwTableNode *pTblNd = IsCrsrInTbl();
- return ( pTblNd && aBoxes.begin()->second->GetSttIdx()-1 == pTblNd->
+ return ( pTblNd && aBoxes[0]->GetSttIdx()-1 == pTblNd->
EndOfSectionNode()->StartOfSectionIndex() &&
- aBoxes.rbegin()->second->GetSttNd()->EndOfSectionIndex()+1
+ aBoxes[aBoxes.Count()-1]->GetSttNd()->EndOfSectionIndex()+1
== pTblNd->EndOfSectionIndex() );
}
}
@@ -1026,12 +1026,12 @@ void SwFEShell::UnProtectCells()
} while ( pFrm && !pFrm->IsCellFrm() );
if( pFrm )
{
- SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox());
- aBoxes.insert( pBox );
+ SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+ aBoxes.Insert( pBox );
}
}
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
GetDoc()->UnProtectCells( aBoxes );
EndAllActionAndCall();
@@ -1069,11 +1069,11 @@ sal_Bool SwFEShell::CanUnProtectCells() const
} while ( pFrm && !pFrm->IsCellFrm() );
if( pFrm )
{
- SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox());
- aBoxes.insert( pBox );
+ SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+ aBoxes.Insert( pBox );
}
}
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
bUnProtectAvailable = ::HasProtectedCells( aBoxes );
}
return bUnProtectAvailable;
@@ -1230,20 +1230,20 @@ sal_Bool SwFEShell::IsAdjustCellWidthAllowed( sal_Bool bBalance ) const
::GetTblSelCrs( *this, aBoxes );
if ( bBalance )
- return aBoxes.size() > 1;
+ return aBoxes.Count() > 1;
- if ( aBoxes.empty() )
+ if ( !aBoxes.Count() )
{
do
{ pFrm = pFrm->GetUpper();
} while ( !pFrm->IsCellFrm() );
- SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox());
- aBoxes.insert( pBox );
+ SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+ aBoxes.Insert( pBox );
}
- for( SwSelBoxes::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ for ( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
{
- SwTableBox *pBox = it->second;
+ SwTableBox *pBox = aBoxes[i];
if ( pBox->GetSttNd() )
{
SwNodeIndex aIdx( *pBox->GetSttNd(), 1 );
@@ -1283,12 +1283,13 @@ sal_Bool SwFEShell::SetTableAutoFmt( const SwTableAutoFmt& rNew )
const SwTableSortBoxes& rTBoxes = pTblNd->GetTable().GetTabSortBoxes();
for( sal_uInt16 n = 0; n < rTBoxes.Count(); ++n )
{
- aBoxes.insert( rTBoxes[ n ] );
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.Insert( pBox );
}
}
sal_Bool bRet;
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
{
SET_CURR_SHELL( this );
StartAllAction();
@@ -1321,7 +1322,8 @@ sal_Bool SwFEShell::GetTableAutoFmt( SwTableAutoFmt& rGet )
const SwTableSortBoxes& rTBoxes = pTblNd->GetTable().GetTabSortBoxes();
for( sal_uInt16 n = 0; n < rTBoxes.Count(); ++n )
{
- aBoxes.insert( rTBoxes[ n ] );
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.Insert( pBox );
}
}
@@ -1353,9 +1355,9 @@ sal_Bool SwFEShell::DeleteTblSel()
sal_Bool bRet;
SwSelBoxes aBoxes;
GetTblSelCrs( *this, aBoxes );
- if( !aBoxes.empty() )
+ if( aBoxes.Count() )
{
- TblWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
+ TblWait( aBoxes.Count(), pFrm, *GetDoc()->GetDocShell() );
// cursor should be removed from deletion area.
// Put them behind/on the table; via the document
@@ -2340,10 +2342,10 @@ sal_Bool lcl_IsFormulaSelBoxes( const SwTable& rTbl, const SwTblBoxFormula& rFml
{
SwTblBoxFormula aTmp( rFml );
SwSelBoxes aBoxes;
- aTmp.GetBoxesOfFormula( rTbl, aBoxes );
- for( SwSelBoxes::reverse_iterator it = aBoxes.rbegin(); it != aBoxes.rend(); ++it )
+
+ for( sal_uInt16 nSelBoxes = aTmp.GetBoxesOfFormula( rTbl,aBoxes ); nSelBoxes; )
{
- SwTableBox* pBox = it->second;
+ SwTableBox* pBox = aBoxes[ --nSelBoxes ];
SwCellFrms::iterator iC;
for( iC = rCells.begin(); iC != rCells.end(); ++iC )
if( (*iC)->GetTabBox() == pBox )
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 9e5253e7b1d5..ade24da77b65 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -75,6 +75,41 @@
#undef DEL_EMPTY_BOXES_AT_START_AND_END
#define DEL_ALL_EMPTY_BOXES
+_SV_IMPL_SORTAR_ALG( SwSelBoxes, SwTableBoxPtr )
+sal_Bool SwSelBoxes::Seek_Entry( const SwTableBoxPtr rSrch, sal_uInt16* pFndPos ) const
+{
+ sal_uLong nIdx = rSrch->GetSttIdx();
+
+ sal_uInt16 nO = Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ if( (*this)[ nM ]->GetSttNd() == rSrch->GetSttNd() )
+ {
+ if( pFndPos )
+ *pFndPos = nM;
+ return sal_True;
+ }
+ else if( (*this)[ nM ]->GetSttIdx() < nIdx )
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pFndPos )
+ *pFndPos = nU;
+ return sal_False;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pFndPos )
+ *pFndPos = nU;
+ return sal_False;
+}
+
struct _CmpLPt
{
Point aPos;
@@ -137,29 +172,25 @@ const SwLayoutFrm *lcl_FindNextCellFrm( const SwLayoutFrm *pLay )
void GetTblSelCrs( const SwCrsrShell &rShell, SwSelBoxes& rBoxes )
{
- rBoxes.clear();
- if( rShell.IsTableMode() && const_cast<SwCrsrShell&>(rShell).UpdateTblSelBoxes())
- {
- const SwSelBoxes& rShellBoxes = rShell.GetTableCrsr()->GetBoxes();
- rBoxes.insert( rShellBoxes.begin(), rShellBoxes.end() );
- }
+ if( rBoxes.Count() )
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
+ if( rShell.IsTableMode() && ((SwCrsrShell&)rShell).UpdateTblSelBoxes())
+ rBoxes.Insert( &rShell.GetTableCrsr()->GetBoxes() );
}
void GetTblSelCrs( const SwTableCursor& rTblCrsr, SwSelBoxes& rBoxes )
{
- rBoxes.clear();
+ if( rBoxes.Count() )
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
if( rTblCrsr.IsChgd() || !rTblCrsr.GetBoxesCount() )
{
- SwTableCursor* pTCrsr = const_cast<SwTableCursor*>(&rTblCrsr);
+ SwTableCursor* pTCrsr = (SwTableCursor*)&rTblCrsr;
pTCrsr->GetDoc()->GetCurrentLayout()->MakeTblCrsrs( *pTCrsr ); //swmod 080218
}
if( rTblCrsr.GetBoxesCount() )
- {
- const SwSelBoxes& rCursorBoxes = rTblCrsr.GetBoxes();
- rBoxes.insert( rCursorBoxes.begin(), rCursorBoxes.end() );
- }
+ rBoxes.Insert( &rTblCrsr.GetBoxes() );
}
void GetTblSel( const SwCrsrShell& rShell, SwSelBoxes& rBoxes,
@@ -233,7 +264,7 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes,
// check for cell protection??
if( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
}
}
}
@@ -336,7 +367,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
// check for cell protection??
if( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
if ( pCells )
{
@@ -428,7 +459,8 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
break;
}
- rBoxes.clear();
+ i = 0;
+ rBoxes.Remove( i, rBoxes.Count() );
--nLoopMax;
} while( sal_True );
@@ -853,14 +885,14 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes )
sal_Bool HasProtectedCells( const SwSelBoxes& rBoxes )
{
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
- {
- if( it->second->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ sal_Bool bRet = sal_False;
+ for( sal_uInt16 n = 0, nCnt = rBoxes.Count(); n < nCnt; ++n )
+ if( rBoxes[ n ]->GetFrmFmt()->GetProtect().IsCntntProtected() )
{
- return sal_True;
+ bRet = sal_True;
+ break;
}
- }
- return sal_False;
+ return bRet;
}
@@ -927,7 +959,8 @@ sal_Bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam )
void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwTableBox** ppMergeBox, SwUndoTblMerge* pUndo )
{
- rBoxes.clear();
+ if( rBoxes.Count() )
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
OSL_ENSURE( rPam.GetCntntNode() && rPam.GetCntntNode( sal_False ),
"Tabselection not on Cnt." );
@@ -1007,7 +1040,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
pBox->GetFrmFmt()->SetFmtAttr( aNew );
// this box is selected
pLastBox = pBox;
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
aPosArr.Insert(
_CmpLPt( (pCell->Frm().*fnRect->fnGetPos)(),
pBox, bVert ) );
@@ -1024,7 +1057,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
{
// this box is selected
pLastBox = pBox;
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
#if OSL_DEBUG_LEVEL > 1
Point aInsPoint( (pCell->Frm().*fnRect->fnGetPos)() );
#endif
@@ -1075,7 +1108,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
// this box is selected
pLastBox = pBox;
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
aPosArr.Insert(
_CmpLPt( (pCell->Frm().*fnRect->fnGetPos)(),
pBox, bVert ) );
@@ -1117,7 +1150,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
pBox->GetFrmFmt()->SetFmtAttr( aNew );
pLastBox = pBox;
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
aPosArr.Insert( _CmpLPt( Point( rUnion.Left(),
pCell->Frm().Top()), pBox, bVert ));
@@ -1141,7 +1174,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
}
// no SSelection / no boxes found
- if( 1 >= rBoxes.size() )
+ if( 1 >= rBoxes.Count() )
return;
// now search all horizontally adjacent boxes and connect
@@ -1327,7 +1360,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
// first create new box
{
- SwTableBox* pTmpBox = rBoxes.begin()->second;
+ SwTableBox* pTmpBox = rBoxes[0];
SwTableLine* pInsLine = pTmpBox->GetUpper();
sal_uInt16 nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pTmpBox );
@@ -1473,13 +1506,13 @@ sal_uInt16 CheckMergeSel( const SwPaM& rPam )
sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes )
{
sal_uInt16 eRet = TBLMERGE_NOSELECTION;
- if( !rBoxes.empty() )
+ if( rBoxes.Count() )
{
eRet = TBLMERGE_OK;
_FndBox aFndBox( 0, 0 );
_FndPara aPara( rBoxes, &aFndBox );
- const SwTableNode* pTblNd = aPara.rBoxes.begin()->second->GetSttNd()->FindTableNode();
+ const SwTableNode* pTblNd = aPara.rBoxes[0]->GetSttNd()->FindTableNode();
((SwTable&)pTblNd->GetTable()).GetTabLines().ForEach(
&_FndLineCopyCol, &aPara );
if( !aFndBox.GetLines().empty() )
@@ -2082,7 +2115,9 @@ sal_Bool _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara )
}
else
{
- if( 0 == pFndPara->rBoxes.count( rpBox ) )
+ SwTableBoxPtr pSrch = (SwTableBoxPtr)rpBox;
+ sal_uInt16 nFndPos;
+ if( !pFndPara->rBoxes.Seek_Entry( pSrch, &nFndPos ))
{
delete pFndBox;
return sal_True;
@@ -2118,9 +2153,9 @@ void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable )
sal_uInt16 nStPos = USHRT_MAX;
sal_uInt16 nEndPos= 0;
- for ( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
- SwTableLine *pLine = it->second->GetUpper();
+ SwTableLine *pLine = rBoxes[i]->GetUpper();
while ( pLine->GetUpper() )
pLine = pLine->GetUpper()->GetUpper();
const sal_uInt16 nPos = rTable.GetTabLines().GetPos(
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index 4a279d8ed2aa..15ad2fb9c606 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -74,7 +74,7 @@ SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0
class SwCollectTblLineBoxes
{
std::vector<sal_uInt16> aPosArr;
- std::vector<const SwTableBox*> aBoxes;
+ SwSelBoxes_SAR aBoxes;
SwHistory* pHst;
sal_uInt16 nMode, nWidth;
sal_Bool bGetFromTop : 1;
@@ -82,8 +82,9 @@ class SwCollectTblLineBoxes
public:
SwCollectTblLineBoxes( sal_Bool bTop, sal_uInt16 nMd = 0, SwHistory* pHist=0 )
- : pHst( pHist ), nMode( nMd ), nWidth( 0 ),
- bGetFromTop( bTop ), bGetValues( sal_True )
+ : aBoxes( 16 ),
+ pHst( pHist ), nMode( nMd ), nWidth( 0 ),
+ bGetFromTop( bTop ), bGetValues( sal_True )
{}
@@ -91,7 +92,7 @@ public:
const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
void AddToUndoHistory( const SwCntntNode& rNd );
- sal_uInt16 Count() const { return aBoxes.size(); }
+ sal_uInt16 Count() const { return aBoxes.Count(); }
const SwTableBox& GetBox( std::size_t nPos, sal_uInt16* pWidth = 0 ) const
{
// hier wird die EndPos der Spalte benoetigt!
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 00b496036c5f..a897ab4c3860 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1947,7 +1947,7 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr )
{
SwTableBox* pInsBox = (SwTableBox*)
((SwCellFrm*)pCell)->GetTabBox();
- aNew.insert( pInsBox );
+ aNew.Insert( pInsBox );
}
if ( pCell->GetNext() )
{
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 76cb5ed4eeaf..80e8bbaaa094 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -407,7 +407,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
{
if( nCurrBox )
{
- pBoxes->insert( pBox );
+ pBoxes->Insert( pBox );
pInnerBox = pBox;
pLeftBox = pLine->GetTabBoxes()[nCurrBox-1];
nDiff = nMin - nLeft;
@@ -438,7 +438,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
}
else if( nRight <= nMax )
{
- pBoxes->insert( pBox );
+ pBoxes->Insert( pBox );
if( nRow == nTop && nRowSpan < 0 )
{
bOkay = false;
@@ -457,7 +457,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
{
if( nCurrBox+1 < nCount )
{
- pBoxes->insert( pBox );
+ pBoxes->Insert( pBox );
pInnerBox = pBox;
pRightBox = pLine->GetTabBoxes()[nCurrBox+1];
nDiff = nRight - nMax;
@@ -610,11 +610,11 @@ long lcl_InsertPosition( SwTable &rTable, std::vector<sal_uInt16>& rInsPos,
{
sal_Int32 nAddWidth = 0;
long nCount = 0;
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for( sal_uInt16 j = 0; j < rBoxes.Count(); ++j )
{
- SwTableBox *pBox = it->second;
+ SwTableBox *pBox = rBoxes[j];
SwTableLine* pLine = pBox->GetUpper();
- long nWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth();
+ long nWidth = rBoxes[j]->GetFrmFmt()->GetFrmSize().GetWidth();
nAddWidth += nWidth;
sal_uInt16 nCurrBox = pLine->GetTabBoxes().C40_GETPOS(SwTableBox, pBox );
sal_uInt16 nCurrLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pLine );
@@ -814,7 +814,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
if( !bNewModel )
{
::GetMergeSel( rPam, rBoxes, ppMergeBox, pUndo );
- return rBoxes.size() > 1;
+ return rBoxes.Count() > 1;
}
CHECK_TABLE( *this )
// We have to assert a "rectangular" box selection before we start to merge
@@ -825,7 +825,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
// i.e. contiguous cells in contiguous rows
bool bMerge = false; // will be set if any content is transferred from
// a "not already overlapped" cell into the new master cell.
- SwTableBox *pMergeBox = pSel->aBoxes[0]->begin()->second; // the master cell box
+ SwTableBox *pMergeBox = (*pSel->aBoxes[0])[0]; // the master cell box
if( !pMergeBox )
return false;
(*ppMergeBox) = pMergeBox;
@@ -852,16 +852,16 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
{
// The selected boxes in the current line
const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ];
- SwSelBoxes::const_iterator itTail = pBoxes->end(); --itTail;
+ sal_uInt16 nColCount = pBoxes->Count();
// Iteration over the selected cell in the current row
- for( SwSelBoxes::const_iterator it = pBoxes->begin(); it != pBoxes->end(); ++it )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
- SwTableBox* pBox = it->second;
- rMerged.insert( pBox );
+ SwTableBox* pBox = (*pBoxes)[nCurrCol];
+ rMerged.Insert( pBox );
// Only the first selected cell in every row will be alive,
// the other will be deleted => put into rBoxes
- if( it != pBoxes->begin() )
- rBoxes.insert( pBox );
+ if( nCurrCol )
+ rBoxes.Insert( pBox );
else
{
if( nCurrLine == 1 )
@@ -874,7 +874,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
bool bDoMerge = pBox != pMergeBox && pBox->getRowSpan() > 0;
// The last box has to be in the last "column" of the selection
// and it has to be a master cell
- if( it == itTail && pBox->getRowSpan() > 0 )
+ if( nCurrCol+1 == nColCount && pBox->getRowSpan() > 0 )
pLastBox = pBox;
if( bDoMerge )
{
@@ -912,7 +912,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
}
// Only the cell of the first selected column will stay alive
// and got a new row span
- if( it == pBoxes->begin() )
+ if( !nCurrCol )
pBox->setRowSpan( nRowSpan );
}
if( nRowSpan > 0 ) // the master cell is done, from now on we set
@@ -930,10 +930,11 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
for( sal_uInt16 nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
{
const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ];
- for( SwSelBoxes::const_iterator it = pBoxes->begin(); it != pBoxes->end(); ++it )
+ sal_uInt16 nColCount = pBoxes->Count();
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
{
- SwTableBox* pBox = it->second;
- if( it != pBoxes->begin() )
+ SwTableBox* pBox = (*pBoxes)[nCurrCol];
+ if( nCurrCol )
{
// Even this box will be deleted soon,
// we have to correct the width to avoid side effects
@@ -941,7 +942,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
pFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, 0, 0 ) );
}
else
- pBox->ChgFrmFmt( static_cast<SwTableBoxFmt*>(pNewFmt) );
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)pNewFmt );
}
}
if( pLastBox ) // Robust
@@ -971,10 +972,10 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes,
{
if( !pFirstLn || !pLastLn )
{
- if( rBoxes.empty() )
+ if( !rBoxes.Count() )
return;
- pFirstLn = rBoxes.begin()->second->GetUpper();
- pLastLn = rBoxes.rbegin()->second->GetUpper();
+ pFirstLn = rBoxes[0]->GetUpper();
+ pLastLn = rBoxes[ rBoxes.Count() - 1 ]->GetUpper();
}
sal_uInt16 nFirstLn = GetTabLines().C40_GETPOS(SwTableLine, pFirstLn );
sal_uInt16 nLastLn = GetTabLines().C40_GETPOS(SwTableLine, pLastLn );
@@ -988,7 +989,7 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes,
{
SwTableBox *pBox = pLine->GetTabBoxes()[nCol];
if( pBox->getRowSpan() > 0 &&
- 0 == rBoxes.count( pBox ) )
+ USHRT_MAX == rBoxes.GetPos( pBox ) )
{
bSuperfl = false;
break;
@@ -999,7 +1000,7 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes,
for( sal_uInt16 nCol = 0; nCol < nCols; ++nCol )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCol];
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
}
}
}
@@ -1067,7 +1068,7 @@ void lcl_getAllMergedBoxes( const SwTable& rTable, SwSelBoxes& rBoxes, SwTableBo
{
SwTableBox* pBox = &rBox;
OSL_ENSURE( pBox == &rBox.FindStartOfRowSpan( rTable, USHRT_MAX ), "Not a master box" );
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
if( pBox->getRowSpan() == 1 )
return;
const SwTableLine* pMyUpper = pBox->GetUpper();
@@ -1078,7 +1079,7 @@ void lcl_getAllMergedBoxes( const SwTable& rTable, SwSelBoxes& rBoxes, SwTableBo
{
pBox = lcl_LeftBorder2Box( nLeftBorder, rTable.GetTabLines()[nLine] );
if( pBox )
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
};
}
@@ -1091,7 +1092,7 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt,
{
SwSelBoxes aBoxes;
lcl_getAllMergedBoxes( rTable, aBoxes, rBox );
- sal_uInt16 nCount = aBoxes.size();
+ sal_uInt16 nCount = aBoxes.Count();
if( nCount < 2 )
return;
if( nCnt > nCount )
@@ -1099,15 +1100,14 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt,
sal_uInt16 *pSplitIdx = new sal_uInt16[ nCnt ];
if( bSameHeight )
{
- std::vector<SwTwips> aHeights;
+ SwTwips *pHeights = new SwTwips[ nCount ];
SwTwips nHeight = 0;
- for( SwSelBoxes::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < nCount; ++i )
{
- SwTableLine* pLine = it->second->GetUpper();
+ SwTableLine* pLine = aBoxes[ i ]->GetUpper();
SwFrmFmt *pRowFmt = pLine->GetFrmFmt();
- SwTwips nH = pRowFmt->GetFrmSize().GetHeight();
- aHeights.push_back( nH );
- nHeight += nH;
+ pHeights[ i ] = pRowFmt->GetFrmSize().GetHeight();
+ nHeight += pHeights[ i ];
}
SwTwips nSumH = 0;
sal_uInt16 nIdx = 0;
@@ -1115,29 +1115,24 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt,
{
SwTwips nSplit = ( i * nHeight ) / nCnt;
while( nSumH < nSplit && nIdx < nCount )
- nSumH += aHeights[ nIdx++ ];
+ nSumH += pHeights[ nIdx++ ];
pSplitIdx[ i - 1 ] = nIdx;
}
+ delete[] pHeights;
}
else
{
- for( sal_uInt32 i = 1; i <= nCnt; ++i )
- pSplitIdx[ i - 1 ] = static_cast<sal_uInt16>( ( i * nCount ) / nCnt );
+ for( long i = 1; i <= nCnt; ++i )
+ pSplitIdx[ i - 1 ] = (sal_uInt16)( ( i * nCount ) / nCnt );
}
sal_uInt16 nIdx = 0;
- SwSelBoxes::const_iterator it = aBoxes.begin();
- for( sal_uInt16 i = 0; i < nCnt; ++i )
+ for( long i = 0; i < nCnt; ++i )
{
sal_uInt16 nNextIdx = pSplitIdx[ i ];
- it->second->setRowSpan( nNextIdx - nIdx );
- lcl_InvalidateCellFrm( *it->second );
- while( true ) {
- ++nIdx;
- ++it;
- if( nIdx >= nNextIdx )
- break;
- it->second->setRowSpan( nIdx - nNextIdx );
- }
+ aBoxes[ nIdx ]->setRowSpan( nNextIdx - nIdx );
+ lcl_InvalidateCellFrm( *aBoxes[ nIdx ] );
+ while( ++nIdx < nNextIdx )
+ aBoxes[ nIdx ]->setRowSpan( nIdx - nNextIdx );
}
delete[] pSplitIdx;
}
@@ -1150,7 +1145,7 @@ void lcl_FillSelBoxes( SwSelBoxes &rBoxes, SwTableLine &rLine )
sal_uInt16 nBoxCount = rLine.GetTabBoxes().Count();
sal_uInt16 nCurrBox;
for( nCurrBox = 0; nCurrBox < nBoxCount; ++nCurrBox )
- rBoxes.insert( rLine.GetTabBoxes()[nCurrBox] );
+ rBoxes.Insert( rLine.GetTabBoxes()[nCurrBox] );
}
/** SwTable::InsertSpannedRow(..) inserts "superfluous" rows, i.e. rows containig
@@ -1212,9 +1207,9 @@ void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr,
{
std::list< SwLineOffset > aBoxes;
SwLineOffset aLnOfs( USHRT_MAX, USHRT_MAX );
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{ // Collect all end line indices and the row spans
- const SwTableBox &rBox = it->second->FindStartOfRowSpan( rTable );
+ const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable );
OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" );
if( nCnt > rBox.getRowSpan() )
{
@@ -1311,9 +1306,9 @@ sal_uInt16 lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNe
SwLineOffset aLnOfs( USHRT_MAX, USHRT_MAX );
sal_uInt16 nFirst = USHRT_MAX; // becomes the index of the first line
sal_uInt16 nLast = 0; // becomes the index of the last line of the splitting
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{ // Collect all pairs (start+end) of line indices to split
- const SwTableBox &rBox = it->second->FindStartOfRowSpan( rTable );
+ const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable );
OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" );
const SwTableLine *pLine = rBox.GetUpper();
const sal_uInt16 nStart = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
@@ -1368,10 +1363,10 @@ sal_uInt16 lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes,
{
sal_uInt16 nDirect = USHRT_MAX;
sal_uInt16 nSpan = USHRT_MAX;
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
- const SwTableBox* pBox = it->second;
- const SwTableLine* pLine = pBox->GetUpper();
+ SwTableBox *pBox = rBoxes[i];
+ const SwTableLine* pLine = rBoxes[i]->GetUpper();
sal_uInt16 nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
if( USHRT_MAX != nPos )
{
@@ -1464,18 +1459,17 @@ sal_Bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
}
}
- std::vector<SwTableBox*> aBoxes;
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ std::set< sal_uInt16> aIndices;
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
- OSL_ENSURE( it->second->getRowSpan() != 1, "Forgot to split?" );
- if( it->second->getRowSpan() > 1 )
- aBoxes.push_back( it->second );
+ OSL_ENSURE( rBoxes[i]->getRowSpan() != 1, "Forgot to split?" );
+ if( rBoxes[i]->getRowSpan() > 1 )
+ aIndices.insert( i );
}
- for( std::vector<SwTableBox*>::const_iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
- {
- lcl_UnMerge( *this, **it, nCnt, bSameHeight );
- }
+ std::set< sal_uInt16 >::iterator pCurrBox = aIndices.begin();
+ while( pCurrBox != aIndices.end() )
+ lcl_UnMerge( *this, *rBoxes[*pCurrBox++], nCnt, bSameHeight );
CHECK_TABLE( *this )
//Layout updaten
@@ -1554,9 +1548,9 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes )
{
if( IsNewModel() )
{
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
- SwTableBox* pBox = it->second;
+ SwTableBox* pBox = rBoxes[i];
long nRowSpan = pBox->getRowSpan();
if( nRowSpan != 1 && pBox->GetFrmFmt()->GetFrmSize().GetWidth() )
{
@@ -1634,9 +1628,9 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon
( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) )
{
- sal_uInt16 nOldCnt = rBoxes.size();
- rBoxes.insert( pBox );
- if( bColumn && nRowSpan != 1 && nOldCnt < rBoxes.size() )
+ sal_uInt16 nOldCnt = rBoxes.Count();
+ rBoxes.Insert( pBox );
+ if( bColumn && nRowSpan != 1 && nOldCnt < rBoxes.Count() )
{
SwTableBox *pMasterBox = pBox->getRowSpan() > 0 ? pBox
: &pBox->FindStartOfRowSpan( rTable, USHRT_MAX );
@@ -1673,8 +1667,12 @@ void SwTable::CreateSelection( const SwPaM& rPam, SwSelBoxes& rBoxes,
void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
SwSelBoxes& rBoxes, const SearchType eSearch, bool bChkProtected ) const
{
- rBoxes.clear();
-
+ // SwSelBoxes aKeepBoxes;
+ if( rBoxes.Count() )
+ {
+ // aKeepBoxes.Insert( &rBoxes );
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
+ }
// Looking for start and end of the selection given by SwNode-pointer
sal_uInt16 nLines = aLines.Count();
// nTop becomes the line number of the upper box
@@ -1701,7 +1699,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
{
if( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
if( nFound )
{
nBottom = nRow;
@@ -1744,7 +1742,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd,
OSL_ENSURE( pBox, "Missing table box" );
if( pBox->getRowSpan() > 0 && ( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) )
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
}
}
return;
@@ -1806,12 +1804,13 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
OSL_ENSURE( bNewModel, "Don't call me for old tables" );
rMin = 0;
rMax = 0;
- if( !aLines.Count() || rBoxes.empty() )
+ if( !aLines.Count() || !rBoxes.Count() )
return;
sal_uInt16 nLineCnt = aLines.Count();
- SwSelBoxes::iterator it = rBoxes.begin();
- for( sal_uInt16 nRow = 0; nRow < nLineCnt && it != rBoxes.end(); ++nRow )
+ sal_uInt16 nBoxCnt = rBoxes.Count();
+ sal_uInt16 nBox = 0;
+ for( sal_uInt16 nRow = 0; nRow < nLineCnt && nBox < nBoxCnt; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
OSL_ENSURE( pLine, "Missing table line" );
@@ -1820,15 +1819,15 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCol];
OSL_ENSURE( pBox, "Missing table box" );
- if( pBox == it->second )
+ if( pBox == rBoxes[nBox] )
{
- lcl_CheckMinMax( rMin, rMax, *pLine, nCol, it == rBoxes.begin() );
- if( ++it == rBoxes.end() )
+ lcl_CheckMinMax( rMin, rMax, *pLine, nCol, nBox == 0 );
+ if( ++nBox >= nBoxCnt )
break;
}
}
}
-
+ nBox = 0;
for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
@@ -1841,7 +1840,7 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
nRight += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
if( nLeft >= rMin && nRight <= rMax )
- rBoxes.insert( pBox );
+ rBoxes.Insert( pBox );
}
}
}
@@ -1903,9 +1902,9 @@ void SwTable::PrepareDeleteCol( long nMin, long nMax )
void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const
{
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
{
- SwTableBox *pBox = it->second;
+ SwTableBox *pBox = rBoxes[i];
long nRowSpan = pBox->getRowSpan();
if( nRowSpan != 1 )
{
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 33afb368ad3d..eab0666d88b7 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1581,11 +1581,11 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction,
void SwUndoTblNdsChg::ReNewBoxes( const SwSelBoxes& rBoxes )
{
- if( rBoxes.size() != aBoxes.size() )
+ if( rBoxes.Count() != aBoxes.size() )
{
aBoxes.clear();
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
- aBoxes.insert( it->second->GetSttIdx() );
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ aBoxes.insert( rBoxes[n]->GetSttIdx() );
}
}
@@ -1658,7 +1658,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
OSL_ENSURE( ! IsDelBox(), "falsche Action" );
pNewSttNds.reset( new std::set<_BoxMove> );
- OSL_ENSURE( rTbl.IsNewModel() || rOld.Count() + nCount * rBoxes.size() == rTblBoxes.Count(),
+ OSL_ENSURE( rTbl.IsNewModel() || rOld.Count() + nCount * rBoxes.Count() == rTblBoxes.Count(),
"unexpected boxes" );
OSL_ENSURE( rOld.Count() <= rTblBoxes.Count(), "more unexpected boxes" );
for( sal_uInt16 n = 0, i = 0; i < rTblBoxes.Count(); ++i )
@@ -1683,9 +1683,9 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
const SwTableLine* pBoxLine = pBox->GetUpper();
sal_uInt16 nLineDiff = lcl_FindParentLines(rTbl,*pBox).C40_GETPOS(SwTableLine,pBoxLine);
sal_uInt16 nLineNo = 0;
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
+ for( sal_uInt16 j = 0; j < rBoxes.Count(); ++j )
{
- pCheckBox = it->second;
+ pCheckBox = rBoxes[j];
if( pCheckBox->GetUpper()->GetUpper() == pBox->GetUpper()->GetUpper() )
{
const SwTableLine* pCheckLine = pCheckBox->GetUpper();
@@ -1706,12 +1706,8 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
// find out how many nodes the source box used to have
// (to help determine bNodesMoved flag below)
sal_uInt16 nNdsPos = 0;
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
- {
- if( it->second == pSourceBox )
- break;
+ while( rBoxes[ nNdsPos ] != pSourceBox )
++nNdsPos;
- }
sal_uLong nNodes = rNodeCnts[ nNdsPos ];
// When a new table cell is created, it either gets a new
@@ -1879,7 +1875,7 @@ void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
for( std::set<sal_uLong>::iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
{
SwTableBox* pBox = pTblNd->GetTable().GetTblBox( *it );
- aSelBoxes.insert( pBox );
+ aSelBoxes.Insert( pBox );
}
// SelBoxes erzeugen und InsertCell/-Row/SplitTbl aufrufen
@@ -2039,7 +2035,7 @@ CHECKTABLE(pTblNd->GetTable())
pCpyBox->GetUpper() );
rLnBoxes.C40_INSERT( SwTableBox, pBox, rLnBoxes.Count() );
- aSelBoxes.insert( pBox );
+ aSelBoxes.Insert( pBox );
}
CHECKTABLE(pTblNd->GetTable())
@@ -2177,16 +2173,16 @@ void SwUndoTblMerge::MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& r
void SwUndoTblMerge::SetSelBoxes( const SwSelBoxes& rBoxes )
{
// die Selektion merken
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
- aBoxes.insert( it->second->GetSttIdx() );
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ aBoxes.insert( rBoxes[n]->GetSttIdx() );
// als Trennung fuers einfuegen neuer Boxen nach dem Verschieben!
aNewSttNds.push_back( (sal_uLong)0 );
// The new table model does not delete overlapped cells (by row span),
// so the rBoxes array might be empty even some cells have been merged.
- if( !rBoxes.empty() )
- nTblNode = rBoxes.begin()->second->GetSttNd()->FindTableNode()->GetIndex();
+ if( rBoxes.Count() )
+ nTblNode = rBoxes[ 0 ]->GetSttNd()->FindTableNode()->GetIndex();
}
void SwUndoTblMerge::SaveCollection( const SwTableBox& rBox )
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 0b3796169d15..c4b799dd1c3e 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1688,12 +1688,12 @@ void SwChartDataProvider::AddRowCols(
if (rTable.IsTblComplex())
return;
- const sal_uInt16 nBoxes = rBoxes.size();
+ const sal_uInt16 nBoxes = rBoxes.Count();
if (nBoxes < 1 || nLines < 1)
return;
- SwTableBox* pFirstBox = rBoxes.begin()->second;
- SwTableBox* pLastBox = rBoxes.rbegin()->second;
+ SwTableBox* pFirstBox = *( rBoxes.GetData() + 0 );
+ SwTableBox* pLastBox = *( rBoxes.GetData() + nBoxes - 1 );
if (pFirstBox && pLastBox)
{
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index b8ce6f3f751f..83381619f877 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1530,8 +1530,8 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt& rTableFmt, const SwTableCursor*
}
const SwSelBoxes& rBoxes = pTableSelection->GetBoxes();
SwTableCursor* pTableCrsr = dynamic_cast<SwTableCursor*>(pUnoCrsr);
- for( SwSelBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
- pTableCrsr->InsertBox( *it->second );
+ for(sal_uInt16 i = 0; i < rBoxes.Count(); i++)
+ pTableCrsr->InsertBox( *rBoxes.GetObject(i) );
pUnoCrsr->Add(&aCrsrDepend);
SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
@@ -1700,7 +1700,9 @@ sal_Bool SwXTextTableCursor::mergeRange(void) throw( uno::RuntimeException )
bRet = TBLMERGE_OK == pTblCrsr->GetDoc()->MergeTbl(*pTblCrsr);
if(bRet)
{
- pTblCrsr->DeleteAllBoxes();
+ sal_uInt16 nCount = pTblCrsr->GetBoxesCount();
+ while(nCount--)
+ pTblCrsr->DeleteBox(nCount);
}
}
pTblCrsr->MakeBoxSels();
@@ -2375,10 +2377,7 @@ void SwXTextTable::dispose(void) throw( uno::RuntimeException )
SwTable* pTable = SwTable::FindTable( pFmt );
SwTableSortBoxes& rBoxes = pTable->GetTabSortBoxes();
SwSelBoxes aSelBoxes;
- for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i)
- {
- aSelBoxes.insert( rBoxes[i] );
- }
+ aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count());
pFmt->GetDoc()->DeleteRowCol(aSelBoxes);
}
else
@@ -2946,7 +2945,8 @@ void SwXTextTable::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor
const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
for( sal_uInt16 n = 0; n < rTBoxes.Count(); ++n )
{
- aBoxes.insert( rTBoxes[ n ] );
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.Insert( pBox );
}
UnoActionContext aContext( pFmt->GetDoc() );
pFmt->GetDoc()->SortTbl(aBoxes, aSortOpt);
@@ -2973,7 +2973,8 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen
const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
for( sal_uInt16 n = 0; n < rTBoxes.Count(); ++n )
{
- aBoxes.insert( rTBoxes[ n ] );
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.Insert( pBox );
}
UnoActionContext aContext( pFmt->GetDoc() );
pFmt->GetDoc()->SetTableAutoFmt( aBoxes, *aAutoFmtTbl[i] );
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 35f84095e853..73ff75ac9e8d 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -805,7 +805,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName )
// lasse ueber das Layout die Boxen suchen
SwSelBoxes aBoxes;
GetTblSel( *pShell, aBoxes );
- SwTableNode* pTblNd = const_cast<SwTableNode*>( static_cast<const SwTableNode*>(aBoxes.begin()->second->GetSttNd()->StartOfSectionNode()) );
+ SwTableNode* pTblNd = (SwTableNode*)aBoxes[0]->GetSttNd()->StartOfSectionNode();
SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 );
SwCntntNode *pNd = aIdx.GetNode().GetCntntNode();
OSL_ENSURE( pNd, "Node not found" );
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 0afe3d3cf075..84060378e84a 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -1493,7 +1493,7 @@ void SwFltOutDoc::NextTableRow()
{
// duplicate row:
SwSelBoxes aSelBoxes;
- aSelBoxes.insert( pTableBox );
+ aSelBoxes.Insert( pTableBox );
GetDoc().InsertRow(aSelBoxes);
usTableX = 0;
SeekCell(++usTableY, usTableX, sal_True);
@@ -1610,7 +1610,7 @@ void SwFltOutDoc::DeleteCell(sal_uInt16 nCell /* = USHRT_MAX */)
SwTableBox* pTableBox = GetBox(usTableY, nCell);
if(pTableBox){
SwSelBoxes aSelBoxes;
- aSelBoxes.insert( pTableBox );
+ aSelBoxes.Insert( pTableBox );
GetDoc().DeleteRowCol(aSelBoxes);
usTableX--;
}
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index f73e42473e40..e53a528d8fe4 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -80,7 +80,7 @@
using namespace ::com::sun::star;
-class WW8SelBoxInfo: public SwSelBoxes
+class WW8SelBoxInfo: public SwSelBoxes_SAR
{
private:
WW8SelBoxInfo(const WW8SelBoxInfo&);
@@ -2739,15 +2739,14 @@ void WW8TabDesc::FinishSwTable()
groupIt != aMergeGroups.end();
++groupIt)
{
- sal_uInt16 nActBoxCount = groupIt->size();
+ sal_uInt16 nActBoxCount = groupIt->Count();
- if( ( 1 < nActBoxCount ) && groupIt->begin()->second )
+ if( ( 1 < nActBoxCount ) && (*groupIt)[0] )
{
- const sal_uInt16 nRowSpan = groupIt->size();
- sal_uInt16 n = 0;
- for( SwSelBoxes::const_iterator it = groupIt->begin(); it != groupIt->end(); ++it )
+ const sal_uInt16 nRowSpan = groupIt->Count();
+ for (sal_uInt16 n = 0; n < nRowSpan; ++n)
{
- SwTableBox* pCurrentBox = it->second;
+ SwTableBox* pCurrentBox = (*groupIt)[n];
const long nRowSpanSet = n == 0 ?
nRowSpan :
((-1) * (nRowSpan - n));
@@ -3332,10 +3331,10 @@ SwTableBox* WW8TabDesc::UpdateTableMergeGroup( WW8_TCell& rCell,
if( pTheMergeGroup )
{
// aktuelle Box der Merge-Gruppe hinzufuegen
- pTheMergeGroup->insert( pTheMergeGroup->end(), pActBox );
+ pTheMergeGroup->Insert( pActBox, pTheMergeGroup->Count() );
// Target-Box zurueckmelden
- pResult = pTheMergeGroup->begin()->second;
+ pResult = (*pTheMergeGroup)[ 0 ];
}
}
return pResult;