summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-09-21 15:18:23 +0200
committerMichael Stahl <mstahl@redhat.com>2012-09-21 18:05:02 +0200
commitb844f06b36cf9a6c1411861a08701c8f9be2af0d (patch)
tree54b76161f052d77d52e890c712aea86e7852db54
parent5b89b1dd909f76154266cd51558e97152cff5f64 (diff)
fdo#48692: fix problems with large number of table cells:
SwSelBoxes containers are filled from SwTableSortBoxes in various places, so adapt that to use size_t integers as well. Change-Id: Ia55f020bb9ada94bb22802d9adabb055a22edd2f
-rw-r--r--sw/inc/cellfml.hxx2
-rw-r--r--sw/inc/crsrsh.hxx2
-rw-r--r--sw/inc/swcrsr.hxx8
-rw-r--r--sw/source/core/access/acccell.cxx3
-rw-r--r--sw/source/core/access/acctable.cxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx9
-rw-r--r--sw/source/core/crsr/swcrsr.cxx52
-rw-r--r--sw/source/core/crsr/unocrsr.cxx11
-rw-r--r--sw/source/core/crsr/viscrs.cxx14
-rw-r--r--sw/source/core/doc/tblcpy.cxx4
-rw-r--r--sw/source/core/doc/tblrwcl.cxx92
-rw-r--r--sw/source/core/docnode/ndtbl.cxx6
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx10
-rw-r--r--sw/source/core/edit/edtab.cxx6
-rw-r--r--sw/source/core/fields/cellfml.cxx9
-rw-r--r--sw/source/core/frmedt/fetab.cxx16
-rw-r--r--sw/source/core/frmedt/tblsel.cxx22
-rw-r--r--sw/source/core/inc/UndoTable.hxx4
-rw-r--r--sw/source/core/table/swnewtable.cxx57
-rw-r--r--sw/source/core/undo/untbl.cxx25
-rw-r--r--sw/source/core/unocore/unochart.cxx2
-rw-r--r--sw/source/core/unocore/unotbl.cxx17
22 files changed, 217 insertions, 156 deletions
diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx
index 6c020f155caf..d5a6f2dea672 100644
--- a/sw/inc/cellfml.hxx
+++ b/sw/inc/cellfml.hxx
@@ -152,7 +152,7 @@ public:
eNmType = EXTRNL_NAME;
}
- sal_uInt16 GetBoxesOfFormula( const SwTable& rTbl, SwSelBoxes& rBoxes );
+ void GetBoxesOfFormula(const SwTable& rTbl, SwSelBoxes& rBoxes);
// are all boxes valid which this formula relies on?
bool HasValidBoxes() const;
};
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 7630214ee33a..632b021015b4 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -655,7 +655,7 @@ public:
const SwShellTableCrsr* GetTableCrsr() const { return pTblCrsr; }
SwShellTableCrsr* GetTableCrsr() { return pTblCrsr; }
- sal_uInt16 UpdateTblSelBoxes();
+ size_t UpdateTblSelBoxes();
sal_Bool GotoFtnTxt(); ///< jump from content to footnote
sal_Bool GotoFtnAnchor(); ///< jump from footnote to anchor
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index 2a1c5638cdab..30901f3b2b4e 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -270,7 +270,7 @@ class SwTableCursor : public virtual SwCursor
protected:
sal_uLong nTblPtNd, nTblMkNd;
xub_StrLen nTblPtCnt, nTblMkCnt;
- SwSelBoxes aSelBoxes;
+ SwSelBoxes m_SelectedBoxes;
sal_Bool bChg : 1;
sal_Bool bParked : 1; // Table-cursor was parked.
@@ -286,9 +286,9 @@ public:
virtual sal_Bool GotoTable( const String& rName );
void InsertBox( const SwTableBox& rTblBox );
- void DeleteBox( sal_uInt16 nPos ) { aSelBoxes.erase( aSelBoxes.begin() + nPos ); bChg = sal_True; }
- sal_uInt16 GetBoxesCount() const { return aSelBoxes.size(); }
- const SwSelBoxes& GetBoxes() const { return aSelBoxes; }
+ void DeleteBox(size_t nPos);
+ size_t GetSelectedBoxesCount() const { return m_SelectedBoxes.size(); }
+ const SwSelBoxes& GetSelectedBoxes() const { return m_SelectedBoxes; }
// Creates cursor for all boxes.
SwCursor* MakeBoxSels( SwCursor* pAktCrsr );
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index 914a76679ea7..a96a2f154ea0 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -72,7 +72,8 @@ sal_Bool SwAccessibleCell::IsSelected()
static_cast< const SwCellFrm * >( GetFrm() );
SwTableBox *pBox =
const_cast< SwTableBox *>( pCFrm->GetTabBox() );
- bRet = pCSh->GetTableCrsr()->GetBoxes().find( pBox ) != pCSh->GetTableCrsr()->GetBoxes().end();
+ SwSelBoxes const& rBoxes(pCSh->GetTableCrsr()->GetSelectedBoxes());
+ bRet = rBoxes.find(pBox) != rBoxes.end();
}
}
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 735c314b7a9e..9c39db2fc5e8 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -603,7 +603,7 @@ const SwSelBoxes *SwAccessibleTable::GetSelBoxes() const
const SwCrsrShell *pCSh = GetCrsrShell();
if( (pCSh != NULL) && pCSh->IsTableMode() )
{
- pSelBoxes = &pCSh->GetTableCrsr()->GetBoxes();
+ pSelBoxes = &pCSh->GetTableCrsr()->GetSelectedBoxes();
}
return pSelBoxes;
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 64da8ea7f483..8a6a5bff4384 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2658,12 +2658,13 @@ sal_Bool SwCrsrShell::ShouldWait() const
pPam->End()->nNode.GetIndex();
}
-
-sal_uInt16 SwCrsrShell::UpdateTblSelBoxes()
+size_t SwCrsrShell::UpdateTblSelBoxes()
{
- if( pTblCrsr && ( pTblCrsr->IsChgd() || !pTblCrsr->GetBoxesCount() ))
+ if (pTblCrsr && (pTblCrsr->IsChgd() || !pTblCrsr->GetSelectedBoxesCount()))
+ {
GetLayout()->MakeTblCrsrs( *pTblCrsr );
- return pTblCrsr ? pTblCrsr->GetBoxesCount() : 0;
+ }
+ return (pTblCrsr) ? pTblCrsr->GetSelectedBoxesCount() : 0;
}
/// show the current selected "object"
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index c1e0b401b90f..d69886514a90 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2099,21 +2099,23 @@ SwTableCursor::SwTableCursor( const SwPosition &rPos, SwPaM* pRing )
SwTableCursor::~SwTableCursor() {}
-sal_Bool lcl_SeekEntry( const SwSelBoxes& rTmp, const SwStartNode* pSrch, sal_uInt16& rFndPos )
+static bool
+lcl_SeekEntry(const SwSelBoxes& rTmp, SwStartNode const*const pSrch,
+ size_t & o_rFndPos)
{
sal_uLong nIdx = pSrch->GetIndex();
- sal_uInt16 nO = rTmp.size();
+ size_t nO = rTmp.size();
if( nO > 0 )
{
nO--;
- sal_uInt16 nU = 0;
+ size_t nU = 0;
while( nU <= nO )
{
- sal_uInt16 nM = nU + ( nO - nU ) / 2;
+ size_t nM = nU + ( nO - nU ) / 2;
if( rTmp[ nM ]->GetSttNd() == pSrch )
{
- rFndPos = nM;
+ o_rFndPos = nM;
return sal_True;
}
else if( rTmp[ nM ]->GetSttIdx() < nIdx )
@@ -2146,14 +2148,14 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
// create temporary copies so that all boxes that
// have already cursors can be removed
- SwSelBoxes aTmp( aSelBoxes );
+ SwSelBoxes aTmp(m_SelectedBoxes);
// compare old and new ones
SwNodes& rNds = pAktCrsr->GetDoc()->GetNodes();
- sal_uInt16 nPos;
const SwStartNode* pSttNd;
SwPaM* pCur = pAktCrsr;
do {
+ size_t nPos;
sal_Bool bDel = sal_False;
pSttNd = pCur->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
if( !pCur->HasMark() || !pSttNd ||
@@ -2198,7 +2200,7 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
}
} while ( pAktCrsr != pCur );
- for( nPos = 0; nPos < aTmp.size(); ++nPos )
+ for (size_t nPos = 0; nPos < aTmp.size(); ++nPos)
{
pSttNd = aTmp[ nPos ]->GetSttNd();
@@ -2239,7 +2241,14 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
void SwTableCursor::InsertBox( const SwTableBox& rTblBox )
{
SwTableBox* pBox = (SwTableBox*)&rTblBox;
- aSelBoxes.insert( pBox );
+ m_SelectedBoxes.insert(pBox);
+ bChg = sal_True;
+}
+
+
+void SwTableCursor::DeleteBox(size_t const nPos)
+{
+ m_SelectedBoxes.erase(m_SelectedBoxes.begin() + nPos);
bChg = sal_True;
}
@@ -2255,7 +2264,7 @@ bool SwTableCursor::NewTableSelection()
pTableNode->GetTable().IsNewModel() )
{
bRet = true;
- SwSelBoxes aNew( aSelBoxes );
+ SwSelBoxes aNew(m_SelectedBoxes);
pTableNode->GetTable().CreateSelection( pStart, pEnd, aNew,
SwTable::SEARCH_NONE, false );
ActualizeSelection( aNew );
@@ -2266,10 +2275,10 @@ bool SwTableCursor::NewTableSelection()
void SwTableCursor::ActualizeSelection( const SwSelBoxes &rNew )
{
- sal_uInt16 nOld = 0, nNew = 0;
- while ( nOld < aSelBoxes.size() && nNew < rNew.size() )
+ size_t nOld = 0, nNew = 0;
+ while (nOld < m_SelectedBoxes.size() && nNew < rNew.size())
{
- const SwTableBox* pPOld = aSelBoxes[ nOld ];
+ SwTableBox const*const pPOld = m_SelectedBoxes[ nOld ];
const SwTableBox* pPNew = rNew[ nNew ];
if( pPOld == pPNew )
{ // this box will stay
@@ -2277,7 +2286,9 @@ void SwTableCursor::ActualizeSelection( const SwSelBoxes &rNew )
++nNew;
}
else if( pPOld->GetSttIdx() < pPNew->GetSttIdx() )
+ {
DeleteBox( nOld ); // this box has to go
+ }
else
{
InsertBox( *pPNew ); // this is a new one
@@ -2286,11 +2297,15 @@ void SwTableCursor::ActualizeSelection( const SwSelBoxes &rNew )
}
}
- while( nOld < aSelBoxes.size() )
+ while (nOld < m_SelectedBoxes.size())
+ {
DeleteBox( nOld ); // some more to delete
+ }
- for( ; nNew < rNew.size(); ++nNew ) // some more to insert
+ for ( ; nNew < rNew.size(); ++nNew ) // some more to insert
+ {
InsertBox( *rNew[ nNew ] );
+ }
}
sal_Bool SwTableCursor::IsCrsrMovedUpdt()
@@ -2329,14 +2344,15 @@ void SwTableCursor::ParkCrsr()
sal_Bool SwTableCursor::HasReadOnlyBoxSel() const
{
sal_Bool bRet = sal_False;
- for( sal_uInt16 n = aSelBoxes.size(); n; )
- if( aSelBoxes[ --n ]->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ for (size_t n = m_SelectedBoxes.size(); n; )
+ {
+ if (m_SelectedBoxes[--n]->GetFrmFmt()->GetProtect().IsCntntProtected())
{
bRet = sal_True;
break;
}
+ }
return bRet;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx
index 571c3136cfb3..a1342a9eb32f 100644
--- a/sw/source/core/crsr/unocrsr.cxx
+++ b/sw/source/core/crsr/unocrsr.cxx
@@ -233,16 +233,17 @@ void SwUnoTableCrsr::MakeBoxSels()
if ( !bMakeTblCrsrs )
{
- SwSelBoxes& rTmpBoxes = (SwSelBoxes&)GetBoxes();
- sal_uInt16 nCount = 0;
- while( nCount < rTmpBoxes.size() )
- DeleteBox( nCount );
+ SwSelBoxes const& rTmpBoxes = GetSelectedBoxes();
+ while (!rTmpBoxes.empty())
+ {
+ DeleteBox(0);
+ }
}
if( IsChgd() )
{
SwTableCursor::MakeBoxSels( &aTblSel );
- if( !GetBoxesCount() )
+ if (!GetSelectedBoxesCount())
{
const SwTableBox* pBox;
const SwNode* pBoxNd = GetPoint()->nNode.GetNode().FindTableBoxStartNode();
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 22a4b7c3d4ac..09eebb7d37f0 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -630,15 +630,14 @@ void SwShellTableCrsr::SaveTblBoxCntnt( const SwPosition* pPos )
void SwShellTableCrsr::FillRects()
{
// Calculate the new rectangles. If the cursor is still "parked" do nothing
- if( aSelBoxes.empty() || bParked ||
- !GetPoint()->nNode.GetIndex() )
+ if (m_SelectedBoxes.empty() || bParked || !GetPoint()->nNode.GetIndex())
return;
SwRegionRects aReg( GetShell()->VisArea() );
SwNodes& rNds = GetDoc()->GetNodes();
- for( sal_uInt16 n = 0; n < aSelBoxes.size(); ++n )
+ for (size_t n = 0; n < m_SelectedBoxes.size(); ++n)
{
- const SwStartNode* pSttNd = aSelBoxes[n]->GetSttNd();
+ const SwStartNode* pSttNd = m_SelectedBoxes[n]->GetSttNd();
const SwTableNode* pSelTblNd = pSttNd->FindTableNode();
SwNodeIndex aIdx( *pSttNd );
@@ -681,14 +680,13 @@ void SwShellTableCrsr::FillRects()
sal_Bool SwShellTableCrsr::IsInside( const Point& rPt ) const
{
// Calculate the new rectangles. If the cursor is still "parked" do nothing
- if( aSelBoxes.empty() || bParked ||
- !GetPoint()->nNode.GetIndex() )
+ if (m_SelectedBoxes.empty() || bParked || !GetPoint()->nNode.GetIndex())
return sal_False;
SwNodes& rNds = GetDoc()->GetNodes();
- for( sal_uInt16 n = 0; n < aSelBoxes.size(); ++n )
+ for (size_t n = 0; n < m_SelectedBoxes.size(); ++n)
{
- SwNodeIndex aIdx( *aSelBoxes[ n ]->GetSttNd() );
+ SwNodeIndex aIdx( *m_SelectedBoxes[n]->GetSttNd() );
SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
if( !pCNd )
continue;
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 273a8659501b..8c5858f71a4f 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -1011,9 +1011,11 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
if( 1 == rCpyTbl.GetTabSortBoxes().size() )
{
SwTableBox *pTmpBx = rCpyTbl.GetTabSortBoxes()[0];
- for( sal_uInt16 n = 0; n < rSelBoxes.size(); ++n )
+ for (size_t n = 0; n < rSelBoxes.size(); ++n)
+ {
lcl_CpyBox( rCpyTbl, pTmpBx, *this,
(SwTableBox*)rSelBoxes[n], sal_True, pUndo );
+ }
}
else
for( nLn = 0; nLn < aFndBox.GetLines().size(); ++nLn )
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index ef8857f2d173..4a5876ff487f 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -103,7 +103,7 @@ struct _CpyTabFrm
struct CR_SetBoxWidth
{
- SwSelBoxes aBoxes;
+ SwSelBoxes m_Boxes;
SwTableLineWidthMap_t m_LineWidthMap;
SwShareBoxFmts aShareFmts;
SwTableNode* pTblNd;
@@ -141,7 +141,7 @@ struct CR_SetBoxWidth
SwUndoTblNdsChg* CreateUndo( SwUndoId eUndoType )
{
- return pUndo = new SwUndoTblNdsChg( eUndoType, aBoxes, *pTblNd );
+ return pUndo = new SwUndoTblNdsChg( eUndoType, m_Boxes, *pTblNd );
}
void LoopClear()
@@ -220,7 +220,7 @@ void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
struct CR_SetLineHeight
{
- SwSelBoxes aBoxes;
+ SwSelBoxes m_Boxes;
SwShareBoxFmts aShareFmts;
SwTableNode* pTblNd;
SwUndoTblNdsChg* pUndo;
@@ -250,7 +250,7 @@ struct CR_SetLineHeight
SwUndoTblNdsChg* CreateUndo( SwUndoId nUndoType )
{
- return pUndo = new SwUndoTblNdsChg( nUndoType, aBoxes, *pTblNd );
+ return pUndo = new SwUndoTblNdsChg( nUndoType, m_Boxes, *pTblNd );
}
};
@@ -940,10 +940,11 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
} while( pBox->GetTabLines().empty() );
}
-SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
+static SwTableBox*
+lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
SwTwips nBoxStt, SwTwips nBoxWidth,
sal_uInt16 nLinePos, sal_Bool bNxt,
- SwSelBoxes* pAllDelBoxes, sal_uInt16* pCurPos )
+ SwSelBoxes* pAllDelBoxes, size_t *const pCurPos)
{
SwTableBox* pFndBox = 0;
do {
@@ -983,7 +984,7 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
SwSelBoxes::const_iterator aFndIt = pAllDelBoxes->find( pFndBox);
if( aFndIt == pAllDelBoxes->end() )
break;
- sal_uInt16 nFndPos = aFndIt - pAllDelBoxes->begin() ;
+ size_t const nFndPos = aFndIt - pAllDelBoxes->begin() ;
// else, we keep on searching.
// We do not need to recheck the Box, however
@@ -996,10 +997,11 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
return pFndBox;
}
-void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox,
+static void
+lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox,
SwShareBoxFmts& rShareFmts,
SwSelBoxes* pAllDelBoxes = 0,
- sal_uInt16* pCurPos = 0 )
+ size_t *const pCurPos = 0 )
{
//JP 16.04.97: 2. part for Bug 36271
sal_Bool bChgd = sal_False;
@@ -1104,18 +1106,20 @@ sal_Bool SwTable::DeleteSel(
if( bCorrBorder )
{
SwSelBoxes aBoxes( rBoxes );
- for( sal_uInt16 n = 0; n < aBoxes.size(); ++n )
+ for (size_t n = 0; n < aBoxes.size(); ++n)
+ {
::lcl_SaveUpperLowerBorder( *this, *rBoxes[ n ], aShareFmts,
&aBoxes, &n );
+ }
}
PrepareDelBoxes( rBoxes );
SwChartDataProvider *pPCD = pDoc->GetChartDataProvider();
// Delete boxes from last to first
- for( sal_uInt16 n = 0; n < rBoxes.size(); ++n )
+ for (size_t n = 0; n < rBoxes.size(); ++n)
{
- sal_uInt16 nIdx = rBoxes.size() - 1 - n;
+ size_t const nIdx = rBoxes.size() - 1 - n;
// First adapt the data-sequence for chart if necessary
// (needed to move the implementation cursor properly to it's new
@@ -1163,7 +1167,7 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
if ( bSameHeight )
{
pRowHeights = new long[ rBoxes.size() ];
- for( sal_uInt16 n = 0; n < rBoxes.size(); ++n )
+ for (size_t n = 0; n < rBoxes.size(); ++n)
{
SwTableBox* pSelBox = rBoxes[n];
const SwRowFrm* pRow = GetRowFrm( *pSelBox->GetUpper() );
@@ -1178,7 +1182,7 @@ sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
aFndBox.SetTableLines( rBoxes, *this );
aFndBox.DelFrms( *this );
- for( sal_uInt16 n = 0; n < rBoxes.size(); ++n )
+ for (size_t n = 0; n < rBoxes.size(); ++n)
{
SwTableBox* pSelBox = rBoxes[n];
OSL_ENSURE( pSelBox, "Box is not within the Table" );
@@ -1309,7 +1313,7 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
_CpyTabFrms aFrmArr;
std::vector<SwTableBoxFmt*> aLastBoxArr;
sal_uInt16 nFndPos;
- for( sal_uInt16 n = 0; n < aSelBoxes.size(); ++n )
+ for (size_t n = 0; n < aSelBoxes.size(); ++n)
{
SwTableBox* pSelBox = aSelBoxes[n];
OSL_ENSURE( pSelBox, "Box steht nicht in der Tabelle" );
@@ -2768,7 +2772,9 @@ sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
return sal_False;
if( pBox->GetSttNd() )
- rParam.aBoxes.insert( pBox );
+ {
+ rParam.m_Boxes.insert(pBox);
+ }
break;
}
@@ -3163,7 +3169,7 @@ sal_Bool lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox,
else
{
SwTableBox* pBox = &rBox;
- rParam.aBoxes.insert( pBox );
+ rParam.m_Boxes.insert(pBox);
}
}
else
@@ -3510,7 +3516,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo,
// Find all Boxes/Lines
SwTable& rTbl = rParam.pTblNd->GetTable();
- if( rParam.aBoxes.empty() )
+ if (rParam.m_Boxes.empty())
{
// Get the Boxes
if( rParam.bBigger )
@@ -3522,15 +3528,18 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo,
}
// Prevent deleting the whole Table
- if( rParam.bBigger && rParam.aBoxes.size() == rTbl.GetTabSortBoxes().size() )
+ if (rParam.bBigger
+ && rParam.m_Boxes.size() == rTbl.GetTabSortBoxes().size())
+ {
return 0;
+ }
_FndBox* pFndBox = new _FndBox( 0, 0 );
if( rParam.bBigger )
- pFndBox->SetTableLines( rParam.aBoxes, rTbl );
+ pFndBox->SetTableLines( rParam.m_Boxes, rTbl );
else
{
- _FndPara aPara( rParam.aBoxes, pFndBox );
+ _FndPara aPara(rParam.m_Boxes, pFndBox);
ForEach_FndLineCopyCol( rTbl.GetTabLines(), &aPara );
OSL_ENSURE( pFndBox->GetLines().size(), "Where are the Boxes" );
pFndBox->SetTableLines( rTbl );
@@ -3665,10 +3674,10 @@ sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo,
aTmpLst, nDistStt );
if (aParam.bBigger &&
- aParam.aBoxes.size() == m_TabSortContentBoxes.size())
+ aParam.m_Boxes.size() == m_TabSortContentBoxes.size())
{
// This whole Table is to be deleted!
- GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes );
+ GetFrmFmt()->GetDoc()->DeleteRowCol(aParam.m_Boxes);
return sal_False;
}
@@ -4045,18 +4054,21 @@ _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.m_Boxes.empty(), "We can't go on without Boxes!" );
// Prevent deleting the whole Table
- if( !rParam.bBigger && rParam.aBoxes.size() == rTbl.GetTabSortBoxes().size() )
+ if (!rParam.bBigger
+ && rParam.m_Boxes.size() == rTbl.GetTabSortBoxes().size())
+ {
return 0;
+ }
_FndBox* pFndBox = new _FndBox( 0, 0 );
if( !rParam.bBigger )
- pFndBox->SetTableLines( rParam.aBoxes, rTbl );
+ pFndBox->SetTableLines( rParam.m_Boxes, rTbl );
else
{
- _FndPara aPara( rParam.aBoxes, pFndBox );
+ _FndPara aPara(rParam.m_Boxes, pFndBox);
ForEach_FndLineCopyCol( rTbl.GetTabLines(), &aPara );
OSL_ENSURE( pFndBox->GetLines().size(), "Where are the Boxes?" );
pFndBox->SetTableLines( rTbl );
@@ -4192,16 +4204,18 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam,
SwDoc* pDoc = pLine->GetFrmFmt()->GetDoc();
if( !rParam.bBigger )
{
- sal_uInt16 n;
-
- for( n = rBoxes.size(); n; )
+ for (size_t n = rBoxes.size(); n; )
+ {
::lcl_SaveUpperLowerBorder( rParam.pTblNd->GetTable(),
*rBoxes[ --n ],
rParam.aShareFmts );
- for( n = rBoxes.size(); n; )
+ }
+ for (size_t n = rBoxes.size(); n; )
+ {
::_DeleteBox( rParam.pTblNd->GetTable(),
rBoxes[ --n ], rParam.pUndo, sal_False,
sal_False, &rParam.aShareFmts );
+ }
}
else
{
@@ -4266,7 +4280,9 @@ sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam,
return sal_False;
if( pBox->GetSttNd() )
- rParam.aBoxes.insert( pBox );
+ {
+ rParam.m_Boxes.insert(pBox);
+ }
else
{
for( sal_uInt16 i = pBox->GetTabLines().size(); i; )
@@ -4359,17 +4375,19 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
{
if( bInsDel )
{
- if( aParam.aBoxes.empty() )
+ if (aParam.m_Boxes.empty())
+ {
::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
aParam, 0, sal_True );
+ }
pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst );
// delete complete table when last row is deleted
if( !bBigger &&
- aParam.aBoxes.size() == m_TabSortContentBoxes.size())
+ aParam.m_Boxes.size() == m_TabSortContentBoxes.size())
{
- GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes );
+ GetFrmFmt()->GetDoc()->DeleteRowCol(aParam.m_Boxes);
return sal_False;
}
@@ -4445,9 +4463,11 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
// Adjust
if( bInsDel )
{
- if( aParam.aBoxes.empty() )
+ if (aParam.m_Boxes.empty())
+ {
::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
aParam, 0, sal_True );
+ }
pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst );
if( ppUndo )
*ppUndo = aParam.CreateUndo(
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index f334b7b2b59f..a39e0154f708 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2170,7 +2170,7 @@ sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 n
aTmpLst.insert( rTbl.GetTabSortBoxes() );
if( !bVert )
{
- for( sal_uInt16 n = 0; n < rBoxes.size(); ++n )
+ for (size_t n = 0; n < rBoxes.size(); ++n)
{
const SwStartNode* pSttNd = rBoxes[ n ]->GetSttNd();
aNdsCnts.push_back( pSttNd->EndOfSectionIndex() -
@@ -2546,7 +2546,7 @@ bool FuzzyCompare::operator() ( long s1, long s2 ) const
bool lcl_IsFrmInColumn( const SwCellFrm& rFrm, SwSelBoxes& rBoxes )
{
- for( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{
if ( rFrm.GetTabBox() == rBoxes[ i ] )
return true;
@@ -4469,7 +4469,7 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
: 0;
std::vector<SwFrmFmt*> aFmts, aNewFmts;
- for( sal_uInt16 i = rBoxes.size(); i; )
+ for (size_t i = rBoxes.size(); i; )
{
SwTableBox* pBox = rBoxes[ --i ];
SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index c10e7222e5e9..024fd77e1107 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1137,8 +1137,8 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
}
std::vector<SwTblFmtCmp*> aFmtCmp;
- aFmtCmp.reserve( Max( 255, (int)aBoxes.size() ) );
- for ( sal_uInt16 i = 0; i < aBoxes.size(); ++i )
+ aFmtCmp.reserve(std::max<size_t>(255, aBoxes.size()));
+ for (size_t i = 0; i < aBoxes.size(); ++i)
{
SwTableBox *pBox = aBoxes[i];
@@ -1183,7 +1183,7 @@ 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( sal_uInt16 i = 0; i < aBoxes.size(); ++i )
+ for (size_t i = 0; i < aBoxes.size(); ++i)
{
switch ( nWhich )
{
@@ -1253,7 +1253,8 @@ sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor ) const
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
SwSelBoxes aBoxes;
if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes ))
- for( sal_uInt16 i = 0; i < aBoxes.size(); ++i )
+ {
+ for (size_t i = 0; i < aBoxes.size(); ++i)
{
const SwFmtVertOrient &rOri =
aBoxes[i]->GetFrmFmt()->GetVertOrient();
@@ -1265,6 +1266,7 @@ sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor ) const
break;
}
}
+ }
return nAlign;
}
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index 43f09ca30f05..2a8445398862 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -272,7 +272,7 @@ sal_Bool SwEditShell::GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const
} while( sal_False );
}
- for( sal_uInt16 n = 0; n < aBoxes.size(); ++n )
+ for (size_t n = 0; n < aBoxes.size(); ++n)
{
const SwTableBox* pSelBox = aBoxes[ n ];
const SwTableBoxFmt* pTblFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt();
@@ -320,8 +320,10 @@ void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet )
StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
- for( sal_uInt16 n = 0; n < aBoxes.size(); ++n )
+ for (size_t n = 0; n < aBoxes.size(); ++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 102b1e23ee31..430067fbe292 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -346,8 +346,8 @@ void SwTableFormula::_MakeFormula( const SwTable& rTbl, String& rNewStr,
rNewStr += '(';
bool bDelim = false;
- for( sal_uInt16 n = 0; n < aBoxes.size() &&
- !pCalcPara->rCalc.IsCalcError(); ++n )
+ for (size_t n = 0; n < aBoxes.size() &&
+ !pCalcPara->rCalc.IsCalcError(); ++n)
{
const SwTableBox* pTblBox = aBoxes[n];
if ( pTblBox->getRowSpan() >= 1 )
@@ -869,14 +869,13 @@ String lcl_BoxNmToRel( const SwTable& rTbl, const SwTableNode& rTblNd,
return sTmp;
}
-sal_uInt16 SwTableFormula::GetBoxesOfFormula( const SwTable& rTbl,
+void SwTableFormula::GetBoxesOfFormula( const SwTable& rTbl,
SwSelBoxes& rBoxes )
{
rBoxes.clear();
BoxNmToPtr( &rTbl );
ScanString( &SwTableFormula::_GetFmlBoxes, rTbl, &rBoxes );
- return rBoxes.size();
}
void SwTableFormula::_GetFmlBoxes( const SwTable& rTbl, String& ,
@@ -956,7 +955,7 @@ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox,
break;
// dann mal die Tabellenkoepfe raus:
- for( sal_uInt16 n = 0; n < rBoxes.size(); ++n )
+ for (size_t n = 0; n < rBoxes.size(); ++n)
{
pLine = rBoxes[n]->GetUpper();
while( pLine->GetUpper() )
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 5e5b13712f66..0ce30625e20f 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -95,11 +95,11 @@ class TblWait
{
SwWait *pWait;
public:
- TblWait( sal_uInt16 nCnt, SwFrm *pFrm, SwDocShell &rDocShell, sal_uInt16 nCnt2 = 0);
+ TblWait(size_t nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t nCnt2 = 0);
~TblWait() { delete pWait; }
};
-TblWait::TblWait( sal_uInt16 nCnt, SwFrm *pFrm, SwDocShell &rDocShell, sal_uInt16 nCnt2):
+TblWait::TblWait(size_t const nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t const nCnt2):
pWait( 0 )
{
sal_Bool bWait = 20 < nCnt || 20 < nCnt2 || (pFrm &&
@@ -478,7 +478,8 @@ sal_uInt16 SwFEShell::MergeTab()
SET_CURR_SHELL( this );
StartAllAction();
- TblWait( pTableCrsr->GetBoxesCount(), 0, *GetDoc()->GetDocShell(),
+ TblWait(pTableCrsr->GetSelectedBoxesCount(), 0,
+ *GetDoc()->GetDocShell(),
pTblNd->GetTable().GetTabLines().size() );
nRet = GetDoc()->MergeTbl( *pTableCrsr );
@@ -1207,7 +1208,8 @@ void SwFEShell::AdjustCellWidth( sal_Bool bBalance )
// switch on wait-cursor, as we do not know how
// much content is affected
- TblWait aWait( USHRT_MAX, 0, *GetDoc()->GetDocShell() );
+ TblWait aWait(::std::numeric_limits<size_t>::max(), 0,
+ *GetDoc()->GetDocShell());
GetDoc()->AdjustCellWidth( *getShellCrsr( false ), bBalance );
EndAllActionAndCall();
@@ -1236,7 +1238,7 @@ sal_Bool SwFEShell::IsAdjustCellWidthAllowed( sal_Bool bBalance ) const
aBoxes.insert( pBox );
}
- for ( sal_uInt16 i = 0; i < aBoxes.size(); ++i )
+ for (size_t i = 0; i < aBoxes.size(); ++i)
{
SwTableBox *pBox = aBoxes[i];
if ( pBox->GetSttNd() )
@@ -2337,8 +2339,8 @@ sal_Bool lcl_IsFormulaSelBoxes( const SwTable& rTbl, const SwTblBoxFormula& rFml
{
SwTblBoxFormula aTmp( rFml );
SwSelBoxes aBoxes;
-
- for( sal_uInt16 nSelBoxes = aTmp.GetBoxesOfFormula( rTbl,aBoxes ); nSelBoxes; )
+ aTmp.GetBoxesOfFormula(rTbl, aBoxes);
+ for (size_t nSelBoxes = aBoxes.size(); nSelBoxes; )
{
SwTableBox* pBox = aBoxes[ --nSelBoxes ];
SwCellFrms::iterator iC;
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index aa8fbc43924a..4826701c6d80 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -138,21 +138,25 @@ void GetTblSelCrs( const SwCrsrShell &rShell, SwSelBoxes& rBoxes )
{
rBoxes.clear();
if( rShell.IsTableMode() && ((SwCrsrShell&)rShell).UpdateTblSelBoxes())
- rBoxes.insert( (SwSelBoxes&)rShell.GetTableCrsr()->GetBoxes() );
+ {
+ rBoxes.insert(rShell.GetTableCrsr()->GetSelectedBoxes());
+ }
}
void GetTblSelCrs( const SwTableCursor& rTblCrsr, SwSelBoxes& rBoxes )
{
rBoxes.clear();
- if( rTblCrsr.IsChgd() || !rTblCrsr.GetBoxesCount() )
+ if (rTblCrsr.IsChgd() || !rTblCrsr.GetSelectedBoxesCount())
{
SwTableCursor* pTCrsr = (SwTableCursor*)&rTblCrsr;
pTCrsr->GetDoc()->GetCurrentLayout()->MakeTblCrsrs( *pTCrsr ); //swmod 080218
}
- if( rTblCrsr.GetBoxesCount() )
- rBoxes.insert( (SwSelBoxes&)rTblCrsr.GetBoxes() );
+ if (rTblCrsr.GetSelectedBoxesCount())
+ {
+ rBoxes.insert(rTblCrsr.GetSelectedBoxes());
+ }
}
void GetTblSel( const SwCrsrShell& rShell, SwSelBoxes& rBoxes,
@@ -267,7 +271,6 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
sal_Bool bTblIsValid;
// #i55421# Reduced value 10
int nLoopMax = 10;
- sal_uInt16 i;
do {
bTblIsValid = sal_True;
@@ -284,9 +287,10 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
const SwCellFrm* pCurrentTopRightFrm = 0;
const SwCellFrm* pCurrentBottomLeftFrm = 0;
const SwCellFrm* pCurrentBottomRightFrm = 0;
+ size_t i = 0;
// Now find boxes for each entry and emit
- for( i = 0; i < aUnions.size() && bTblIsValid; ++i )
+ for ( ; i < aUnions.size() && bTblIsValid; ++i)
{
SwSelUnion *pUnion = &aUnions[i];
const SwTabFrm *pTable = pUnion->GetTable();
@@ -848,12 +852,14 @@ sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes )
sal_Bool HasProtectedCells( const SwSelBoxes& rBoxes )
{
sal_Bool bRet = sal_False;
- for( sal_uInt16 n = 0, nCnt = rBoxes.size(); n < nCnt; ++n )
+ for (size_t n = 0; n < rBoxes.size(); ++n)
+ {
if( rBoxes[ n ]->GetFrmFmt()->GetProtect().IsCntntProtected() )
{
bRet = sal_True;
break;
}
+ }
return bRet;
}
@@ -2112,7 +2118,7 @@ void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable )
sal_uInt16 nStPos = USHRT_MAX;
sal_uInt16 nEndPos= 0;
- for ( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{
SwTableLine *pLine = rBoxes[i]->GetUpper();
while ( pLine->GetUpper() )
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index d22552d545bb..32bae4337b5c 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -176,7 +176,7 @@ public:
class SwUndoTblNdsChg : public SwUndo, private boost::noncopyable
{
_SaveTable* pSaveTbl;
- std::set<sal_uLong> aBoxes;
+ std::set<sal_uLong> m_Boxes;
struct _BoxMove
{
sal_uLong index; ///< Index of this box.
@@ -229,7 +229,7 @@ class SwUndoTblMerge : public SwUndo, private SwUndRng
{
sal_uLong nTblNode;
_SaveTable* pSaveTbl;
- std::set<sal_uLong> aBoxes;
+ std::set<sal_uLong> m_Boxes;
std::vector<sal_uLong> aNewSttNds;
SwUndoMoves* pMoves;
SwHistory* pHistory;
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 5fa237713931..ed0c47ecef50 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -610,7 +610,7 @@ long lcl_InsertPosition( SwTable &rTable, std::vector<sal_uInt16>& rInsPos,
{
sal_Int32 nAddWidth = 0;
long nCount = 0;
- for( sal_uInt16 j = 0; j < rBoxes.size(); ++j )
+ for (size_t j = 0; j < rBoxes.size(); ++j)
{
SwTableBox *pBox = rBoxes[j];
SwTableLine* pLine = pBox->GetUpper();
@@ -852,9 +852,9 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
{
// The selected boxes in the current line
const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ];
- sal_uInt16 nColCount = pBoxes->size();
+ size_t nColCount = pBoxes->size();
// Iteration over the selected cell in the current row
- for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ for (size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol)
{
SwTableBox* pBox = (*pBoxes)[nCurrCol];
rMerged.insert( pBox );
@@ -930,8 +930,8 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
for( sal_uInt16 nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
{
const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ];
- sal_uInt16 nColCount = pBoxes->size();
- for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ size_t nColCount = pBoxes->size();
+ for (size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol)
{
SwTableBox* pBox = (*pBoxes)[nCurrCol];
if( nCurrCol )
@@ -1087,22 +1087,22 @@ void lcl_getAllMergedBoxes( const SwTable& rTable, SwSelBoxes& rBoxes, SwTableBo
and its overlapped cells to split them into several pieces.
*/
-void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt,
+void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, size_t nCnt,
sal_Bool bSameHeight )
{
SwSelBoxes aBoxes;
lcl_getAllMergedBoxes( rTable, aBoxes, rBox );
- sal_uInt16 nCount = aBoxes.size();
+ size_t const nCount = aBoxes.size();
if( nCount < 2 )
return;
if( nCnt > nCount )
nCnt = nCount;
- sal_uInt16 *pSplitIdx = new sal_uInt16[ nCnt ];
+ size_t *const pSplitIdx = new size_t[ nCnt ];
if( bSameHeight )
{
SwTwips *pHeights = new SwTwips[ nCount ];
SwTwips nHeight = 0;
- for( sal_uInt16 i = 0; i < nCount; ++i )
+ for (size_t i = 0; i < nCount; ++i)
{
SwTableLine* pLine = aBoxes[ i ]->GetUpper();
SwFrmFmt *pRowFmt = pLine->GetFrmFmt();
@@ -1110,8 +1110,8 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt,
nHeight += pHeights[ i ];
}
SwTwips nSumH = 0;
- sal_uInt16 nIdx = 0;
- for( sal_uInt16 i = 1; i <= nCnt; ++i )
+ size_t nIdx = 0;
+ for (size_t i = 1; i <= nCnt; ++i)
{
SwTwips nSplit = ( i * nHeight ) / nCnt;
while( nSumH < nSplit && nIdx < nCount )
@@ -1122,13 +1122,15 @@ void lcl_UnMerge( const SwTable& rTable, SwTableBox& rBox, sal_uInt16 nCnt,
}
else
{
- for( long i = 1; i <= nCnt; ++i )
- pSplitIdx[ i - 1 ] = (sal_uInt16)( ( i * nCount ) / nCnt );
+ for (size_t i = 1; i <= nCnt; ++i)
+ {
+ pSplitIdx[ i - 1 ] = ( i * nCount ) / nCnt;
+ }
}
- sal_uInt16 nIdx = 0;
- for( long i = 0; i < nCnt; ++i )
+ size_t nIdx = 0;
+ for (size_t i = 0; i < nCnt; ++i)
{
- sal_uInt16 nNextIdx = pSplitIdx[ i ];
+ size_t nNextIdx = pSplitIdx[ i ];
aBoxes[ nIdx ]->setRowSpan( nNextIdx - nIdx );
lcl_InvalidateCellFrm( *aBoxes[ nIdx ] );
while( ++nIdx < nNextIdx )
@@ -1206,7 +1208,7 @@ void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr,
{
std::list< SwLineOffset > aBoxes;
SwLineOffset aLnOfs( USHRT_MAX, USHRT_MAX );
- for( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{ // Collect all end line indices and the row spans
const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable );
OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" );
@@ -1305,7 +1307,7 @@ 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( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{ // Collect all pairs (start+end) of line indices to split
const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable );
OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" );
@@ -1362,7 +1364,7 @@ sal_uInt16 lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes,
{
sal_uInt16 nDirect = USHRT_MAX;
sal_uInt16 nSpan = USHRT_MAX;
- for( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{
SwTableBox *pBox = rBoxes[i];
const SwTableLine* pLine = rBoxes[i]->GetUpper();
@@ -1458,15 +1460,15 @@ sal_Bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16
}
}
- std::set< sal_uInt16> aIndices;
- for( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ std::set<size_t> aIndices;
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{
OSL_ENSURE( rBoxes[i]->getRowSpan() != 1, "Forgot to split?" );
if( rBoxes[i]->getRowSpan() > 1 )
aIndices.insert( i );
}
- std::set< sal_uInt16 >::iterator pCurrBox = aIndices.begin();
+ std::set<size_t>::iterator pCurrBox = aIndices.begin();
while( pCurrBox != aIndices.end() )
lcl_UnMerge( *this, *rBoxes[*pCurrBox++], nCnt, bSameHeight );
@@ -1547,7 +1549,7 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes )
{
if( IsNewModel() )
{
- for( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{
SwTableBox* pBox = rBoxes[i];
long nRowSpan = pBox->getRowSpan();
@@ -1627,7 +1629,7 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon
( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) )
{
- sal_uInt16 nOldCnt = rBoxes.size();
+ size_t const nOldCnt = rBoxes.size();
rBoxes.insert( pBox );
if( bColumn && nRowSpan != 1 && nOldCnt < rBoxes.size() )
{
@@ -1802,8 +1804,8 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
return;
sal_uInt16 nLineCnt = aLines.size();
- sal_uInt16 nBoxCnt = rBoxes.size();
- sal_uInt16 nBox = 0;
+ size_t const nBoxCnt = rBoxes.size();
+ size_t nBox = 0;
for( sal_uInt16 nRow = 0; nRow < nLineCnt && nBox < nBoxCnt; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
@@ -1821,7 +1823,6 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
}
}
}
- nBox = 0;
for( sal_uInt16 nRow = 0; nRow < nLineCnt; ++nRow )
{
SwTableLine* pLine = aLines[nRow];
@@ -1896,7 +1897,7 @@ void SwTable::PrepareDeleteCol( long nMin, long nMax )
void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const
{
- for( sal_uInt16 i = 0; i < rBoxes.size(); ++i )
+ for (size_t i = 0; i < rBoxes.size(); ++i)
{
SwTableBox *pBox = rBoxes[i];
long nRowSpan = pBox->getRowSpan();
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index bd6c6cd8eee2..ef83b551cc63 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1523,11 +1523,13 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction,
void SwUndoTblNdsChg::ReNewBoxes( const SwSelBoxes& rBoxes )
{
- if( rBoxes.size() != aBoxes.size() )
+ if (rBoxes.size() != m_Boxes.size())
{
- aBoxes.clear();
- for( sal_uInt16 n = 0; n < rBoxes.size(); ++n )
- aBoxes.insert( rBoxes[n]->GetSttIdx() );
+ m_Boxes.clear();
+ for (size_t n = 0; n < rBoxes.size(); ++n)
+ {
+ m_Boxes.insert( rBoxes[n]->GetSttIdx() );
+ }
}
}
@@ -1622,7 +1624,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
const SwTableLine* pBoxLine = pBox->GetUpper();
sal_uInt16 nLineDiff = lcl_FindParentLines(rTbl,*pBox).GetPos(pBoxLine);
sal_uInt16 nLineNo = 0;
- for( sal_uInt16 j = 0; j < rBoxes.size(); ++j )
+ for (size_t j = 0; j < rBoxes.size(); ++j)
{
pCheckBox = rBoxes[j];
if( pCheckBox->GetUpper()->GetUpper() == pBox->GetUpper()->GetUpper() )
@@ -1644,7 +1646,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
OSL_ENSURE( pSourceBox, "Splitted source box not found!" );
// find out how many nodes the source box used to have
// (to help determine bNodesMoved flag below)
- sal_uInt16 nNdsPos = 0;
+ size_t nNdsPos = 0;
while( rBoxes[ nNdsPos ] != pSourceBox )
++nNdsPos;
sal_uLong nNodes = rNodeCnts[ nNdsPos ];
@@ -1814,7 +1816,8 @@ void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
CHECK_TABLE( pTblNd->GetTable() )
SwSelBoxes aSelBoxes;
- for( std::set<sal_uLong>::iterator it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ for (std::set<sal_uLong>::iterator it = m_Boxes.begin();
+ it != m_Boxes.end(); ++it)
{
SwTableBox* pBox = pTblNd->GetTable().GetTblBox( *it );
aSelBoxes.insert( pBox );
@@ -1961,7 +1964,7 @@ CHECKTABLE(pTblNd->GetTable())
sal_uInt16 n;
std::set<sal_uLong>::iterator it;
- for( it = aBoxes.begin(); it != aBoxes.end(); ++it )
+ for (it = m_Boxes.begin(); it != m_Boxes.end(); ++it)
{
aIdx = *it;
SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection( aIdx,
@@ -2104,8 +2107,10 @@ void SwUndoTblMerge::MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& r
void SwUndoTblMerge::SetSelBoxes( const SwSelBoxes& rBoxes )
{
// memorize selection
- for( sal_uInt16 n = 0; n < rBoxes.size(); ++n )
- aBoxes.insert( rBoxes[n]->GetSttIdx() );
+ for (size_t n = 0; n < rBoxes.size(); ++n)
+ {
+ m_Boxes.insert(rBoxes[n]->GetSttIdx());
+ }
// as separator for inserts of new boxes after shifting
aNewSttNds.push_back( (sal_uLong)0 );
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 3602a4bb2a6f..ec521881dc10 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1684,7 +1684,7 @@ void SwChartDataProvider::AddRowCols(
if (rTable.IsTblComplex())
return;
- const sal_uInt16 nBoxes = rBoxes.size();
+ const size_t nBoxes = rBoxes.size();
if (nBoxes < 1 || nLines < 1)
return;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 64eba7af4ced..b3163b9d76d9 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1517,10 +1517,12 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt& rTableFmt, const SwTableCursor*
pUnoCrsr->SetMark();
*pUnoCrsr->GetMark() = *pTableSelection->GetMark();
}
- const SwSelBoxes& rBoxes = pTableSelection->GetBoxes();
+ const SwSelBoxes& rBoxes = pTableSelection->GetSelectedBoxes();
SwTableCursor* pTableCrsr = dynamic_cast<SwTableCursor*>(pUnoCrsr);
- for(sal_uInt16 i = 0; i < rBoxes.size(); i++)
+ for (size_t i = 0; i < rBoxes.size(); i++)
+ {
pTableCrsr->InsertBox( *rBoxes[i] );
+ }
pUnoCrsr->Add(&aCrsrDepend);
SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
@@ -1689,9 +1691,11 @@ sal_Bool SwXTextTableCursor::mergeRange(void) throw( uno::RuntimeException )
bRet = TBLMERGE_OK == pTblCrsr->GetDoc()->MergeTbl(*pTblCrsr);
if(bRet)
{
- sal_uInt16 nCount = pTblCrsr->GetBoxesCount();
- while(nCount--)
+ size_t nCount = pTblCrsr->GetSelectedBoxesCount();
+ while (--nCount)
+ {
pTblCrsr->DeleteBox(nCount);
+ }
}
}
pTblCrsr->MakeBoxSels();
@@ -1716,7 +1720,8 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) th
pTblCrsr->MakeBoxSels();
{
UnoActionContext aContext(pUnoCrsr->GetDoc());
- bRet = pTblCrsr->GetDoc()->SplitTbl( pTblCrsr->GetBoxes(), !Horizontal, Count );
+ bRet = pTblCrsr->GetDoc()->SplitTbl(
+ pTblCrsr->GetSelectedBoxes(), !Horizontal, Count);
}
pTblCrsr->MakeBoxSels();
}
@@ -4595,7 +4600,7 @@ void SAL_CALL SwXCellRange::sort(const uno::Sequence< beans::PropertyValue >& rD
SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
pTableCrsr->MakeBoxSels();
UnoActionContext aContext( pFmt->GetDoc() );
- pFmt->GetDoc()->SortTbl(pTableCrsr->GetBoxes(), aSortOpt);
+ pFmt->GetDoc()->SortTbl(pTableCrsr->GetSelectedBoxes(), aSortOpt);
}
}