diff options
Diffstat (limited to 'sw/source/core/frmedt/tblsel.cxx')
-rw-r--r-- | sw/source/core/frmedt/tblsel.cxx | 407 |
1 files changed, 226 insertions, 181 deletions
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 36683730e760..a1e38d87f194 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -28,15 +28,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> #include <editeng/boxitem.hxx> #include <editeng/protitem.hxx> + +#include <hintids.hxx> #include <fmtanchr.hxx> #include <fmtfsize.hxx> #include <frmatr.hxx> #include <tblsel.hxx> #include <crsrsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -50,7 +52,7 @@ #include <rootfrm.hxx> #include <viscrs.hxx> #include <swtblfmt.hxx> -#include <undobj.hxx> +#include <UndoTable.hxx> #include <mvsave.hxx> #include <sectfrm.hxx> #include <frmtool.hxx> @@ -75,11 +77,11 @@ _SV_IMPL_SORTAR_ALG( SwSelBoxes, SwTableBoxPtr ) -BOOL SwSelBoxes::Seek_Entry( const SwTableBoxPtr rSrch, USHORT* pFndPos ) const +sal_Bool SwSelBoxes::Seek_Entry( const SwTableBoxPtr rSrch, sal_uInt16* pFndPos ) const { - ULONG nIdx = rSrch->GetSttIdx(); + sal_uLong nIdx = rSrch->GetSttIdx(); - USHORT nO = Count(), nM, nU = 0; + sal_uInt16 nO = Count(), nM, nU = 0; if( nO > 0 ) { nO--; @@ -90,7 +92,7 @@ BOOL SwSelBoxes::Seek_Entry( const SwTableBoxPtr rSrch, USHORT* pFndPos ) const { if( pFndPos ) *pFndPos = nM; - return TRUE; + return sal_True; } else if( (*this)[ nM ]->GetSttIdx() < nIdx ) nU = nM + 1; @@ -98,7 +100,7 @@ BOOL SwSelBoxes::Seek_Entry( const SwTableBoxPtr rSrch, USHORT* pFndPos ) const { if( pFndPos ) *pFndPos = nU; - return FALSE; + return sal_False; } else nO = nM - 1; @@ -106,7 +108,7 @@ BOOL SwSelBoxes::Seek_Entry( const SwTableBoxPtr rSrch, USHORT* pFndPos ) const } if( pFndPos ) *pFndPos = nU; - return FALSE; + return sal_False; } @@ -116,21 +118,21 @@ struct _CmpLPt { Point aPos; const SwTableBox* pSelBox; - BOOL bVert; + sal_Bool bVert; - _CmpLPt( const Point& rPt, const SwTableBox* pBox, BOOL bVertical ); + _CmpLPt( const Point& rPt, const SwTableBox* pBox, sal_Bool bVertical ); - BOOL operator==( const _CmpLPt& rCmp ) const - { return X() == rCmp.X() && Y() == rCmp.Y() ? TRUE : FALSE; } + sal_Bool operator==( const _CmpLPt& rCmp ) const + { return X() == rCmp.X() && Y() == rCmp.Y() ? sal_True : sal_False; } - BOOL operator<( const _CmpLPt& rCmp ) const + sal_Bool operator<( const _CmpLPt& rCmp ) const { if ( bVert ) return X() > rCmp.X() || ( X() == rCmp.X() && Y() < rCmp.Y() ) - ? TRUE : FALSE; + ? sal_True : sal_False; else return Y() < rCmp.Y() || ( Y() == rCmp.Y() && X() < rCmp.X() ) - ? TRUE : FALSE; + ? sal_True : sal_False; } long X() const { return aPos.X(); } @@ -181,7 +183,7 @@ const SwLayoutFrm *lcl_FindNextCellFrm( const SwLayoutFrm *pLay ) void GetTblSelCrs( const SwCrsrShell &rShell, SwSelBoxes& rBoxes ) { if( rBoxes.Count() ) - rBoxes.Remove( USHORT(0), rBoxes.Count() ); + rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); if( rShell.IsTableMode() && ((SwCrsrShell&)rShell).UpdateTblSelBoxes()) rBoxes.Insert( &rShell.GetTableCrsr()->GetBoxes() ); } @@ -189,7 +191,7 @@ void GetTblSelCrs( const SwCrsrShell &rShell, SwSelBoxes& rBoxes ) void GetTblSelCrs( const SwTableCursor& rTblCrsr, SwSelBoxes& rBoxes ) { if( rBoxes.Count() ) - rBoxes.Remove( USHORT(0), rBoxes.Count() ); + rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); if( rTblCrsr.IsChgd() || !rTblCrsr.GetBoxesCount() ) { @@ -215,7 +217,7 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes, const SwTblSearchType eSearchType ) { //Start- und Endzelle besorgen und den naechsten fragen. - ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ), + ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( sal_False ), "Tabselection nicht auf Cnt." ); // Zeilen-Selektion: @@ -243,31 +245,31 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes, const SwTable& rTbl = pTblNd->GetTable(); const SwTableLines& rLines = rTbl.GetTabLines(); - const SwNode* pMarkNode = rCrsr.GetNode( FALSE ); - const ULONG nMarkSectionStart = pMarkNode->StartOfSectionIndex(); + const SwNode* pMarkNode = rCrsr.GetNode( sal_False ); + const sal_uLong nMarkSectionStart = pMarkNode->StartOfSectionIndex(); const SwTableBox* pMarkBox = rTbl.GetTblBox( nMarkSectionStart ); ASSERT( pMarkBox, "Point in table, mark outside?" ) const SwTableLine* pLine = pMarkBox ? pMarkBox->GetUpper() : 0; - USHORT nSttPos = rLines.GetPos( pLine ); + sal_uInt16 nSttPos = rLines.GetPos( pLine ); ASSERT( USHRT_MAX != nSttPos, "Wo ist meine Zeile in der Tabelle?" ); - pLine = rTbl.GetTblBox( rCrsr.GetNode( TRUE )->StartOfSectionIndex() )->GetUpper(); - USHORT nEndPos = rLines.GetPos( pLine ); + pLine = rTbl.GetTblBox( rCrsr.GetNode( sal_True )->StartOfSectionIndex() )->GetUpper(); + sal_uInt16 nEndPos = rLines.GetPos( pLine ); ASSERT( USHRT_MAX != nEndPos, "Wo ist meine Zeile in der Tabelle?" ); // pb: #i20193# if tableintable then nSttPos == nEndPos == USHRT_MAX if ( nSttPos != USHRT_MAX && nEndPos != USHRT_MAX ) { if( nEndPos < nSttPos ) // vertauschen { - USHORT nTmp = nSttPos; nSttPos = nEndPos; nEndPos = nTmp; + sal_uInt16 nTmp = nSttPos; nSttPos = nEndPos; nEndPos = nTmp; } int bChkProtected = nsSwTblSearchType::TBLSEARCH_PROTECT & eSearchType; for( ; nSttPos <= nEndPos; ++nSttPos ) { pLine = rLines[ nSttPos ]; - for( USHORT n = pLine->GetTabBoxes().Count(); n ; ) + for( sal_uInt16 n = pLine->GetTabBoxes().Count(); n ; ) { SwTableBox* pBox = pLine->GetTabBoxes()[ --n ]; // Zellenschutzt beachten ?? @@ -289,8 +291,13 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes, } const SwCntntNode *pCntNd = rCrsr.GetCntntNode(); const SwLayoutFrm *pStart = pCntNd ? +<<<<<<< local pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &aPtPos )->GetUpper() : 0; pCntNd = rCrsr.GetCntntNode(FALSE); +======= + pCntNd->GetFrm( &aPtPos )->GetUpper() : 0; + pCntNd = rCrsr.GetCntntNode(sal_False); +>>>>>>> other const SwLayoutFrm *pEnd = pCntNd ? pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &aMkPos )->GetUpper() : 0; if( pStart && pEnd ) @@ -312,14 +319,14 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, int bChkProtected = nsSwTblSearchType::TBLSEARCH_PROTECT & eSearchType; - BOOL bTblIsValid; + sal_Bool bTblIsValid; // --> FME 2006-01-25 #i55421# Reduced value 10 int nLoopMax = 10; //JP 28.06.99: max 100 loops - Bug 67292 // <-- - USHORT i; + sal_uInt16 i; do { - bTblIsValid = TRUE; + bTblIsValid = sal_True; //Zuerst lassen wir uns die Tabellen und die Rechtecke heraussuchen. SwSelUnions aUnions; @@ -341,7 +348,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, const SwTabFrm *pTable = pUnion->GetTable(); if( !pTable->IsValid() && nLoopMax ) { - bTblIsValid = FALSE; + bTblIsValid = sal_False; break; } @@ -354,7 +361,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, { if( !pRow->IsValid() && nLoopMax ) { - bTblIsValid = FALSE; + bTblIsValid = sal_False; break; } @@ -366,7 +373,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, { if( !pCell->IsValid() && nLoopMax ) { - bTblIsValid = FALSE; + bTblIsValid = sal_False; break; } @@ -476,24 +483,24 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, rBoxes.Remove( i, rBoxes.Count() ); --nLoopMax; - } while( TRUE ); + } while( sal_True ); ASSERT( nLoopMax, "das Layout der Tabelle wurde nicht valide!" ); } -BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, +sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, SwChartLines* pGetCLines ) { const SwTableNode* pTNd = rSttNd.FindTableNode(); if( !pTNd ) - return FALSE; + return sal_False; Point aNullPos; SwNodeIndex aIdx( rSttNd ); const SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode(); if( !pCNd ) - pCNd = aIdx.GetNodes().GoNextSection( &aIdx, FALSE, FALSE ); + pCNd = aIdx.GetNodes().GoNextSection( &aIdx, sal_False, sal_False ); // #109394# if table is invisible, return // (layout needed for forming table selection further down, so we can't @@ -501,8 +508,13 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, // OD 07.11.2003 #i22135# - Also the content of the table could be // invisible - e.g. in a hidden section // Robust: check, if content was found (e.g. empty table cells) +<<<<<<< local if ( !pCNd || pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) == NULL ) return FALSE; +======= + if ( !pCNd || pCNd->GetFrm() == NULL ) + return sal_False; +>>>>>>> other const SwLayoutFrm *pStart = pCNd ? pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aNullPos )->GetUpper() : 0; ASSERT( pStart, "ohne Frame geht gar nichts" ); @@ -510,29 +522,29 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, aIdx = rEndNd; pCNd = aIdx.GetNode().GetCntntNode(); if( !pCNd ) - pCNd = aIdx.GetNodes().GoNextSection( &aIdx, FALSE, FALSE ); + pCNd = aIdx.GetNodes().GoNextSection( &aIdx, sal_False, sal_False ); // OD 07.11.2003 #i22135# - Robust: check, if content was found and if it's visible if ( !pCNd || pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) == NULL ) { - return FALSE; + return sal_False; } const SwLayoutFrm *pEnd = pCNd ? pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aNullPos )->GetUpper() : 0; ASSERT( pEnd, "ohne Frame geht gar nichts" ); - BOOL bTblIsValid, bValidChartSel; + sal_Bool bTblIsValid, bValidChartSel; // --> FME 2006-01-25 #i55421# Reduced value 10 int nLoopMax = 10; //JP 28.06.99: max 100 loops - Bug 67292 // <-- - USHORT i = 0; + sal_uInt16 i = 0; do { - bTblIsValid = TRUE; - bValidChartSel = TRUE; + bTblIsValid = sal_True; + bValidChartSel = sal_True; - USHORT nRowCells = USHRT_MAX; + sal_uInt16 nRowCells = USHRT_MAX; //Zuerst lassen wir uns die Tabellen und die Rechtecke heraussuchen. SwSelUnions aUnions; @@ -550,7 +562,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, if( !pTable->IsValid() && nLoopMax ) { - bTblIsValid = FALSE; + bTblIsValid = sal_False; break; } @@ -565,7 +577,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, { if( !pRow->IsValid() && nLoopMax ) { - bTblIsValid = FALSE; + bTblIsValid = sal_False; break; } @@ -578,7 +590,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, { if( !pCell->IsValid() && nLoopMax ) { - bTblIsValid = FALSE; + bTblIsValid = sal_False; break; } @@ -620,7 +632,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, _Sort_CellFrm( *(SwCellFrm*)pCell) ); else { - bValidChartSel = FALSE; + bValidChartSel = sal_False; break; } } @@ -659,7 +671,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, nRowCells = nCellCnt; else if( nRowCells != nCellCnt ) { - bValidChartSel = FALSE; + bValidChartSel = sal_False; break; } } @@ -682,7 +694,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, } else { - bValidChartSel = FALSE; + bValidChartSel = sal_False; break; } } @@ -691,7 +703,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, if( USHRT_MAX == nRowCells ) nRowCells = nCellCnt; else if( nRowCells != nCellCnt ) - bValidChartSel = FALSE; + bValidChartSel = sal_False; } if( bValidChartSel && pGetCLines ) @@ -704,7 +716,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, if( (rCF.pFrm->Frm().*fnRect->fnGetTop)() != nYPos ) { pBoxes = new SwChartBoxes( 255 < nRowCells - ? 255 : (BYTE)nRowCells); + ? 255 : (sal_uInt8)nRowCells); pGetCLines->C40_INSERT( SwChartBoxes, pBoxes, pGetCLines->Count() ); nYPos = (rCF.pFrm->Frm().*fnRect->fnGetTop)(); } @@ -733,7 +745,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, --nLoopMax; if( pGetCLines ) pGetCLines->DeleteAndDestroy( 0, pGetCLines->Count() ); - } while( TRUE ); + } while( sal_True ); ASSERT( nLoopMax, "das Layout der Tabelle wurde nicht valide!" ); @@ -744,7 +756,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, } -BOOL IsFrmInTblSel( const SwRect& rUnion, const SwFrm* pCell ) +sal_Bool IsFrmInTblSel( const SwRect& rUnion, const SwFrm* pCell ) { ASSERT( pCell->IsCellFrm(), "Frame ohne Gazelle" ); @@ -754,7 +766,7 @@ BOOL IsFrmInTblSel( const SwRect& rUnion, const SwFrm* pCell ) (( rUnion.Top() <= pCell->Frm().Top()+20 && rUnion.Bottom() > pCell->Frm().Top() ) || ( rUnion.Top() >= pCell->Frm().Top() && - rUnion.Bottom() < pCell->Frm().Bottom() )) ? TRUE : FALSE ); + rUnion.Bottom() < pCell->Frm().Bottom() )) ? sal_True : sal_False ); return ( rUnion.Top() <= pCell->Frm().Top() && @@ -764,10 +776,10 @@ BOOL IsFrmInTblSel( const SwRect& rUnion, const SwFrm* pCell ) rUnion.Right() > pCell->Frm().Left() ) || ( rUnion.Left() >= pCell->Frm().Left() && - rUnion.Right() < pCell->Frm().Right() )) ? TRUE : FALSE ); + rUnion.Right() < pCell->Frm().Right() )) ? sal_True : sal_False ); } -BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) +sal_Bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) { SwShellCrsr* pCrsr = rShell.pCurCrsr; if ( rShell.IsTableMode() ) @@ -775,7 +787,11 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) const SwLayoutFrm *pStart = pCrsr->GetCntntNode()->getLayoutFrm( rShell.GetLayout(), &pCrsr->GetPtPos() )->GetUpper(), +<<<<<<< local *pEnd = pCrsr->GetCntntNode(FALSE)->getLayoutFrm( rShell.GetLayout(), +======= + *pEnd = pCrsr->GetCntntNode(sal_False)->GetFrm( +>>>>>>> other &pCrsr->GetMkPos() )->GetUpper(); const SwLayoutFrm* pSttCell = pStart; @@ -788,8 +804,8 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) // default erstmal nach oben testen, dann nach links ::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_COL ); - BOOL bTstRow = TRUE, bFound = FALSE; - USHORT i; + sal_Bool bTstRow = sal_True, bFound = sal_False; + sal_uInt16 i; // 1. teste ob die darueber liegende Box Value/Formel enhaelt: for( i = 0; i < aUnions.Count(); ++i ) @@ -813,8 +829,8 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) { if( pCell == pSttCell ) { - USHORT nWhichId = 0; - for( USHORT n = rBoxes.Count(); n; ) + sal_uInt16 nWhichId = 0; + for( sal_uInt16 n = rBoxes.Count(); n; ) if( USHRT_MAX != ( nWhichId = rBoxes[ --n ] ->GetTabBox()->IsFormulaOrValueBox() )) break; @@ -822,7 +838,7 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) // alle Boxen zusammen, nicht mehr die Zeile // pruefen, wenn eine Formel oder Value gefunden wurde bTstRow = 0 == nWhichId || USHRT_MAX == nWhichId; - bFound = TRUE; + bFound = sal_True; break; } @@ -856,7 +872,7 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) // 2. teste ob die links liegende Box Value/Formel enhaelt: if( bTstRow ) { - bFound = FALSE; + bFound = sal_False; rBoxes.Remove( 0, rBoxes.Count() ); aUnions.DeleteAndDestroy( 0, aUnions.Count() ); @@ -882,8 +898,8 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) { if( pCell == pSttCell ) { - USHORT nWhichId = 0; - for( USHORT n = rBoxes.Count(); n; ) + sal_uInt16 nWhichId = 0; + for( sal_uInt16 n = rBoxes.Count(); n; ) if( USHRT_MAX != ( nWhichId = rBoxes[ --n ] ->GetTabBox()->IsFormulaOrValueBox() )) break; @@ -891,7 +907,7 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) // alle Boxen zusammen, nicht mehr die Zeile // pruefen, wenn eine Formel oder Value gefunden wurde bFound = 0 != nWhichId && USHRT_MAX != nWhichId; - bTstRow = FALSE; + bTstRow = sal_False; break; } @@ -925,25 +941,25 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) return bFound; } -BOOL HasProtectedCells( const SwSelBoxes& rBoxes ) +sal_Bool HasProtectedCells( const SwSelBoxes& rBoxes ) { - BOOL bRet = FALSE; - for( USHORT n = 0, nCnt = rBoxes.Count(); n < nCnt; ++n ) + sal_Bool bRet = sal_False; + for( sal_uInt16 n = 0, nCnt = rBoxes.Count(); n < nCnt; ++n ) if( rBoxes[ n ]->GetFrmFmt()->GetProtect().IsCntntProtected() ) { - bRet = TRUE; + bRet = sal_True; break; } return bRet; } -_CmpLPt::_CmpLPt( const Point& rPt, const SwTableBox* pBox, BOOL bVertical ) +_CmpLPt::_CmpLPt( const Point& rPt, const SwTableBox* pBox, sal_Bool bVertical ) : aPos( rPt ), pSelBox( pBox ), bVert( bVertical ) {} void lcl_InsTblBox( SwTableNode* pTblNd, SwDoc* pDoc, SwTableBox* pBox, - USHORT nInsPos, USHORT nCnt = 1 ) + sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 ) { ASSERT( pBox->GetSttNd(), "Box ohne Start-Node" ); SwCntntNode* pCNd = pDoc->GetNodes()[ pBox->GetSttIdx() + 1 ] @@ -961,25 +977,25 @@ void lcl_InsTblBox( SwTableNode* pTblNd, SwDoc* pDoc, SwTableBox* pBox, nInsPos, nCnt ); } -BOOL IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ) +sal_Bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ) { rPam.GetPoint()->nNode = *rBox.GetSttNd()->EndOfSectionNode(); rPam.Move( fnMoveBackward, fnGoCntnt ); rPam.SetMark(); rPam.GetPoint()->nNode = *rBox.GetSttNd(); rPam.Move( fnMoveForward, fnGoCntnt ); - BOOL bRet = *rPam.GetMark() == *rPam.GetPoint() + sal_Bool bRet = *rPam.GetMark() == *rPam.GetPoint() && ( rBox.GetSttNd()->GetIndex() + 1 == rPam.GetPoint()->nNode.GetIndex() ); if( bRet ) { // dann teste mal auf absatzgebundenen Flys const SwSpzFrmFmts& rFmts = *rPam.GetDoc()->GetSpzFrmFmts(); - ULONG nSttIdx = rPam.GetPoint()->nNode.GetIndex(), + sal_uLong nSttIdx = rPam.GetPoint()->nNode.GetIndex(), nEndIdx = rBox.GetSttNd()->EndOfSectionIndex(), nIdx; - for( USHORT n = 0; n < rFmts.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFmts.Count(); ++n ) { const SwFmtAnchor& rAnchor = rFmts[n]->GetAnchor(); const SwPosition* pAPos = rAnchor.GetCntntAnchor(); @@ -989,7 +1005,7 @@ BOOL IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ) nSttIdx <= ( nIdx = pAPos->nNode.GetIndex() ) && nIdx < nEndIdx ) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -1002,10 +1018,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, SwTableBox** ppMergeBox, SwUndoTblMerge* pUndo ) { if( rBoxes.Count() ) - rBoxes.Remove( USHORT(0), rBoxes.Count() ); + rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); //Zuerst lassen wir uns die Tabellen und die Rechtecke heraussuchen. - ASSERT( rPam.GetCntntNode() && rPam.GetCntntNode( FALSE ), + ASSERT( rPam.GetCntntNode() && rPam.GetCntntNode( sal_False ), "Tabselection nicht auf Cnt." ); //JP 24.09.96: Merge mit wiederholenden TabellenHeadline funktioniert nicht @@ -1013,12 +1029,18 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // das die 1. Headline mit drin ist. // Point aPt( rShell.GetCharRect().Pos() ); Point aPt( 0, 0 ); +<<<<<<< local const SwCntntNode* pCntNd = rPam.GetCntntNode(); const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &aPt )->GetUpper(); pCntNd = rPam.GetCntntNode(FALSE); const SwLayoutFrm *pEnd = rPam.GetCntntNode(FALSE)->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), +======= + const SwLayoutFrm *pStart = rPam.GetCntntNode()->GetFrm( + &aPt )->GetUpper(), + *pEnd = rPam.GetCntntNode(sal_False)->GetFrm( +>>>>>>> other &aPt )->GetUpper(); SwSelUnions aUnions; @@ -1037,7 +1059,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, SWRECTFN( pStart->GetUpper() ) - for ( USHORT i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) { const SwTabFrm *pTabFrm = aUnions[i]->GetTable(); @@ -1069,7 +1091,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, { if( ( rUnion.Right() + COLFUZZY ) < pCell->Frm().Right() ) { - USHORT nInsPos = pBox->GetUpper()-> + sal_uInt16 nInsPos = pBox->GetUpper()-> GetTabBoxes().C40_GETPOS( SwTableBox, pBox )+1; lcl_InsTblBox( pTblNd, pDoc, pBox, nInsPos ); pBox->ClaimFrmFmt(); @@ -1113,7 +1135,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, else if( ( rUnion.Left() - COLFUZZY ) >= pCell->Frm().Left() && ( rUnion.Right() + COLFUZZY ) < pCell->Frm().Right() ) { - USHORT nInsPos = pBox->GetUpper()->GetTabBoxes(). + sal_uInt16 nInsPos = pBox->GetUpper()->GetTabBoxes(). C40_GETPOS( SwTableBox, pBox )+1; lcl_InsTblBox( pTblNd, pDoc, pBox, nInsPos, 2 ); pBox->ClaimFrmFmt(); @@ -1133,7 +1155,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, { const SfxPoolItem* pItem; if( SFX_ITEM_SET == pBox->GetFrmFmt()->GetAttrSet() - .GetItemState( RES_BOX, FALSE, &pItem )) + .GetItemState( RES_BOX, sal_False, &pItem )) { SvxBoxItem aBox( *(SvxBoxItem*)pItem ); aBox.SetLine( 0, BOX_LINE_RIGHT ); @@ -1172,7 +1194,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, { // dann muss eine neue Box einfuegt und die // Breiten angepasst werden - USHORT nInsPos = pBox->GetUpper()->GetTabBoxes(). + sal_uInt16 nInsPos = pBox->GetUpper()->GetTabBoxes(). C40_GETPOS( SwTableBox, pBox )+1; lcl_InsTblBox( pTblNd, pDoc, pBox, nInsPos, 1 ); @@ -1229,7 +1251,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // 1. Loesung: gehe ueber das Array und // alle auf der gleichen Y-Ebene werden mit Blanks getrennt // alle anderen werden als Absaetze getrennt. - BOOL bCalcWidth = TRUE; + sal_Bool bCalcWidth = sal_True; const SwTableBox* pFirstBox = aPosArr[ 0 ].pSelBox; // JP 27.03.98: Optimierung - falls die Boxen einer Line leer sind, @@ -1241,8 +1263,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, #if defined( DEL_ONLY_EMPTY_LINES ) nWidth = pFirstBox->GetFrmFmt()->GetFrmSize().GetWidth(); - BOOL bEmptyLine = TRUE; - USHORT n, nSttPos = 0; + sal_Bool bEmptyLine = sal_True; + sal_uInt16 n, nSttPos = 0; for( n = 0; n < aPosArr.Count(); ++n ) { @@ -1250,14 +1272,14 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, if( n && aPosArr[ n - 1 ].Y() == rPt.Y() ) // gleiche Ebene ? { if( bEmptyLine && !IsEmptyBox( *rPt.pSelBox, aPam )) - bEmptyLine = FALSE; + bEmptyLine = sal_False; if( bCalcWidth ) nWidth += rPt.pSelBox->GetFrmFmt()->GetFrmSize().GetWidth(); } else { if( bCalcWidth && n ) - bCalcWidth = FALSE; // eine Zeile fertig + bCalcWidth = sal_False; // eine Zeile fertig if( bEmptyLine && nSttPos < n ) { @@ -1265,7 +1287,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // nicht mit Blanks aufgefuellt und als Absatz // eingefuegt werden. if( pUndo ) - for( USHORT i = nSttPos; i < n; ++i ) + for( sal_uInt16 i = nSttPos; i < n; ++i ) pUndo->SaveCollection( *aPosArr[ i ].pSelBox ); aPosArr.Remove( nSttPos, n - nSttPos ); @@ -1280,21 +1302,21 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, if( bEmptyLine && nSttPos < n ) { if( pUndo ) - for( USHORT i = nSttPos; i < n; ++i ) + for( sal_uInt16 i = nSttPos; i < n; ++i ) pUndo->SaveCollection( *aPosArr[ i ].pSelBox ); aPosArr.Remove( nSttPos, n - nSttPos ); } #elsif defined( DEL_EMPTY_BOXES_AT_START_AND_END ) nWidth = pFirstBox->GetFrmFmt()->GetFrmSize().GetWidth(); - USHORT n, nSttPos = 0, nSEndPos = 0, nESttPos = 0; + sal_uInt16 n, nSttPos = 0, nSEndPos = 0, nESttPos = 0; for( n = 0; n < aPosArr.Count(); ++n ) { const _CmpLPt& rPt = aPosArr[ n ]; if( n && aPosArr[ n - 1 ].Y() == rPt.Y() ) // gleiche Ebene ? { - BOOL bEmptyBox = IsEmptyBox( *rPt.pSelBox, aPam ); + sal_Bool bEmptyBox = IsEmptyBox( *rPt.pSelBox, aPam ); if( bEmptyBox ) { if( nSEndPos == n ) // der Anfang ist leer @@ -1309,7 +1331,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, else { if( bCalcWidth && n ) - bCalcWidth = FALSE; // eine Zeile fertig + bCalcWidth = sal_False; // eine Zeile fertig // zuerst die vom Anfang if( nSttPos < nSEndPos ) @@ -1317,10 +1339,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // dann ist der vorder Teil der Line leer und braucht // nicht mit Blanks aufgefuellt werden. if( pUndo ) - for( USHORT i = nSttPos; i < nSEndPos; ++i ) + for( sal_uInt16 i = nSttPos; i < nSEndPos; ++i ) pUndo->SaveCollection( *aPosArr[ i ].pSelBox ); - USHORT nCnt = nSEndPos - nSttPos; + sal_uInt16 nCnt = nSEndPos - nSttPos; aPosArr.Remove( nSttPos, nCnt ); nESttPos -= nCnt; n -= nCnt; @@ -1331,10 +1353,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // dann ist der vorder Teil der Line leer und braucht // nicht mit Blanks aufgefuellt werden. if( pUndo ) - for( USHORT i = nESttPos; i < n; ++i ) + for( sal_uInt16 i = nESttPos; i < n; ++i ) pUndo->SaveCollection( *aPosArr[ i ].pSelBox ); - USHORT nCnt = n - nESttPos; + sal_uInt16 nCnt = n - nESttPos; aPosArr.Remove( nESttPos, nCnt ); n -= nCnt; } @@ -1353,10 +1375,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // dann ist der vorder Teil der Line leer und braucht // nicht mit Blanks aufgefuellt werden. if( pUndo ) - for( USHORT i = nSttPos; i < nSEndPos; ++i ) + for( sal_uInt16 i = nSttPos; i < nSEndPos; ++i ) pUndo->SaveCollection( *aPosArr[ i ].pSelBox ); - USHORT nCnt = nSEndPos - nSttPos; + sal_uInt16 nCnt = nSEndPos - nSttPos; aPosArr.Remove( nSttPos, nCnt ); nESttPos -= nCnt; n -= nCnt; @@ -1366,10 +1388,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // dann ist der vorder Teil der Line leer und braucht // nicht mit Blanks aufgefuellt werden. if( pUndo ) - for( USHORT i = nESttPos; i < n; ++i ) + for( sal_uInt16 i = nESttPos; i < n; ++i ) pUndo->SaveCollection( *aPosArr[ i ].pSelBox ); - USHORT nCnt = n - nESttPos; + sal_uInt16 nCnt = n - nESttPos; aPosArr.Remove( nESttPos, nCnt ); } #else @@ -1382,7 +1404,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, aPosArr[ 0 ].Y() ) : 0; - for( USHORT n = 0; n < aPosArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < aPosArr.Count(); ++n ) { const _CmpLPt& rPt = aPosArr[ n ]; if( bCalcWidth ) @@ -1390,7 +1412,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, if( nY == ( bVert ? rPt.X() : rPt.Y() ) ) // gleiche Ebene ? nWidth += rPt.pSelBox->GetFrmFmt()->GetFrmSize().GetWidth(); else - bCalcWidth = FALSE; // eine Zeile fertig + bCalcWidth = sal_False; // eine Zeile fertig } if( IsEmptyBox( *rPt.pSelBox, aPam ) ) @@ -1409,7 +1431,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, { SwTableBox* pTmpBox = rBoxes[0]; SwTableLine* pInsLine = pTmpBox->GetUpper(); - USHORT nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pTmpBox ); + sal_uInt16 nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pTmpBox ); lcl_InsTblBox( pTblNd, pDoc, pTmpBox, nInsPos ); (*ppMergeBox) = pInsLine->GetTabBoxes()[ nInsPos ]; @@ -1440,23 +1462,28 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, SwPaM aPam( aInsPos ); - for( USHORT n = 0; n < aPosArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < aPosArr.Count(); ++n ) { const _CmpLPt& rPt = aPosArr[ n ]; aPam.GetPoint()->nNode.Assign( *rPt.pSelBox->GetSttNd()-> EndOfSectionNode(), -1 ); SwCntntNode* pCNd = aPam.GetCntntNode(); - USHORT nL = pCNd ? pCNd->Len() : 0; + sal_uInt16 nL = pCNd ? pCNd->Len() : 0; aPam.GetPoint()->nContent.Assign( pCNd, nL ); SwNodeIndex aSttNdIdx( *rPt.pSelBox->GetSttNd(), 1 ); // ein Node muss in der Box erhalten bleiben (sonst wird beim // Move die gesamte Section geloescht) + bool const bUndo(pDoc->GetIDocumentUndoRedo().DoesUndo()); if( pUndo ) - pDoc->DoUndo( FALSE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(false); + } pDoc->AppendTxtNode( *aPam.GetPoint() ); if( pUndo ) - pDoc->DoUndo( TRUE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); + } SwNodeRange aRg( aSttNdIdx, aPam.GetPoint()->nNode ); rInsPosNd++; if( pUndo ) @@ -1469,7 +1496,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // wo steht jetzt aInsPos ?? if( bCalcWidth ) - bCalcWidth = FALSE; // eine Zeile fertig + bCalcWidth = sal_False; // eine Zeile fertig // den initialen TextNode ueberspringen rInsPosNd.Assign( pDoc->GetNodes(), @@ -1495,51 +1522,57 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, } -static BOOL lcl_CheckCol( const _FndBox*& rpFndBox, void* pPara ); +static sal_Bool lcl_CheckCol( const _FndBox*& rpFndBox, void* pPara ); -static BOOL lcl_CheckRow( const _FndLine*& rpFndLine, void* pPara ) +static sal_Bool lcl_CheckRow( const _FndLine*& rpFndLine, void* pPara ) { ((_FndLine*)rpFndLine)->GetBoxes().ForEach( &lcl_CheckCol, pPara ); - return *(BOOL*)pPara; + return *(sal_Bool*)pPara; } -static BOOL lcl_CheckCol( const _FndBox*& rpFndBox, void* pPara ) +static sal_Bool lcl_CheckCol( const _FndBox*& rpFndBox, void* pPara ) { if( !rpFndBox->GetBox()->GetSttNd() ) { if( rpFndBox->GetLines().Count() != rpFndBox->GetBox()->GetTabLines().Count() ) - *((BOOL*)pPara) = FALSE; + *((sal_Bool*)pPara) = sal_False; else ((_FndBox*)rpFndBox)->GetLines().ForEach( &lcl_CheckRow, pPara ); } // Box geschuetzt ?? else if( rpFndBox->GetBox()->GetFrmFmt()->GetProtect().IsCntntProtected() ) - *((BOOL*)pPara) = FALSE; - return *(BOOL*)pPara; + *((sal_Bool*)pPara) = sal_False; + return *(sal_Bool*)pPara; } -USHORT CheckMergeSel( const SwPaM& rPam ) +sal_uInt16 CheckMergeSel( const SwPaM& rPam ) { SwSelBoxes aBoxes; //JP 24.09.96: Merge mit wiederholenden TabellenHeadline funktioniert nicht // richtig. Warum nicht Point 0,0 benutzen? Dann ist garantiert, // das die 1. Headline mit drin ist. Point aPt; +<<<<<<< local const SwCntntNode* pCntNd = rPam.GetCntntNode(); const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &aPt )->GetUpper(); pCntNd = rPam.GetCntntNode(FALSE); const SwLayoutFrm *pEnd = rPam.GetCntntNode(FALSE)->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), +======= + const SwLayoutFrm *pStart = rPam.GetCntntNode()->GetFrm( + &aPt )->GetUpper(), + *pEnd = rPam.GetCntntNode(sal_False)->GetFrm( +>>>>>>> other &aPt )->GetUpper(); GetTblSel( pStart, pEnd, aBoxes, 0 ); return CheckMergeSel( aBoxes ); } -USHORT CheckMergeSel( const SwSelBoxes& rBoxes ) +sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes ) { - USHORT eRet = TBLMERGE_NOSELECTION; + sal_uInt16 eRet = TBLMERGE_NOSELECTION; if( rBoxes.Count() ) { eRet = TBLMERGE_OK; @@ -1551,7 +1584,7 @@ USHORT CheckMergeSel( const SwSelBoxes& rBoxes ) &_FndLineCopyCol, &aPara ); if( aFndBox.GetLines().Count() ) { - BOOL bMergeSelOk = TRUE; + sal_Bool bMergeSelOk = sal_True; _FndBox* pFndBox = &aFndBox; _FndLine* pFndLine = 0; while( pFndBox && 1 == pFndBox->GetLines().Count() ) @@ -1631,7 +1664,7 @@ void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart, aEndArr.Insert( p, 0 ); } - for( USHORT n = 0; n < aEndArr.Count() && n < aSttArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < aEndArr.Count() && n < aSttArr.Count(); ++n ) if( aSttArr[ n ] != aEndArr[ n ] ) { // first unequal line or box - all odds are @@ -1856,14 +1889,14 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, const SwTabFrm *pEndTable = pEnd->FindTabFrm(); if( !pTable || !pEndTable ) return; - BOOL bExchange = FALSE; + sal_Bool bExchange = sal_False; if ( pTable != pEndTable ) { if ( !pTable->IsAnFollow( pEndTable ) ) { ASSERT( pEndTable->IsAnFollow( pTable ), "Tabkette verknotet." ); - bExchange = TRUE; + bExchange = sal_True; } } else @@ -1875,10 +1908,10 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, { if( (pStart->Frm().*fnRect->fnGetLeft)() > (pEnd->Frm().*fnRect->fnGetLeft)() ) - bExchange = TRUE; + bExchange = sal_True; } else if( bVert == ( nSttTop < nEndTop ) ) - bExchange = TRUE; + bExchange = sal_True; } if ( bExchange ) { @@ -2036,7 +2069,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, } } -BOOL CheckSplitCells( const SwCrsrShell& rShell, USHORT nDiv, +sal_Bool CheckSplitCells( const SwCrsrShell& rShell, sal_uInt16 nDiv, const SwTblSearchType eSearchType ) { if( !rShell.IsTableMode() ) @@ -2045,13 +2078,13 @@ BOOL CheckSplitCells( const SwCrsrShell& rShell, USHORT nDiv, return CheckSplitCells( *rShell.getShellCrsr(false), nDiv, eSearchType ); } -BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv, +sal_Bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, const SwTblSearchType eSearchType ) { if( 1 >= nDiv ) - return FALSE; + return sal_False; - USHORT nMinValue = nDiv * MINLAY; + sal_uInt16 nMinValue = nDiv * MINLAY; //Start- und Endzelle besorgen und den naechsten fragen. Point aPtPos, aMkPos; @@ -2061,12 +2094,18 @@ BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv, aPtPos = pShCrsr->GetPtPos(); aMkPos = pShCrsr->GetMkPos(); } +<<<<<<< local const SwCntntNode* pCntNd = rCrsr.GetCntntNode(); const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &aPtPos )->GetUpper(); pCntNd = rCrsr.GetCntntNode(FALSE); const SwLayoutFrm *pEnd = rCrsr.GetCntntNode(FALSE)->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), +======= + const SwLayoutFrm *pStart = rCrsr.GetCntntNode()->GetFrm( + &aPtPos )->GetUpper(), + *pEnd = rCrsr.GetCntntNode(sal_False)->GetFrm( +>>>>>>> other &aMkPos )->GetUpper(); SWRECTFN( pStart->GetUpper() ) @@ -2077,7 +2116,7 @@ BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv, ::MakeSelUnions( aUnions, pStart, pEnd, eSearchType ); //Jetzt zu jedem Eintrag die Boxen herausfischen und uebertragen. - for ( USHORT i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) { SwSelUnion *pUnion = aUnions[i]; const SwTabFrm *pTable = pUnion->GetTable(); @@ -2099,7 +2138,7 @@ BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv, if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) { if( (pCell->Frm().*fnRect->fnGetWidth)() < nMinValue ) - return FALSE; + return sal_False; } if ( pCell->GetNext() ) @@ -2115,7 +2154,7 @@ BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv, pRow = (const SwLayoutFrm*)pRow->GetNext(); } } - return TRUE; + return sal_True; } // ------------------------------------------------------------------- @@ -2142,7 +2181,7 @@ void lcl_InsertRow( SwTableLine &rLine, SwLayoutFrm *pUpper, SwFrm *pSibling ) } -BOOL _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara ) +sal_Bool _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara ) { _FndPara* pFndPara = (_FndPara*)pPara; _FndBox* pFndBox = new _FndBox( (SwTableBox*)rpBox, pFndPara->pFndLine ); @@ -2153,25 +2192,25 @@ BOOL _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara ) if( !pFndBox->GetLines().Count() ) { delete pFndBox; - return TRUE; + return sal_True; } } else { SwTableBoxPtr pSrch = (SwTableBoxPtr)rpBox; - USHORT nFndPos; + sal_uInt16 nFndPos; if( !pFndPara->rBoxes.Seek_Entry( pSrch, &nFndPos )) { delete pFndBox; - return TRUE; + return sal_True; } } pFndPara->pFndLine->GetBoxes().C40_INSERT( _FndBox, pFndBox, pFndPara->pFndLine->GetBoxes().Count() ); - return TRUE; + return sal_True; } -BOOL _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ) +sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ) { _FndPara* pFndPara = (_FndPara*)pPara; _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox ); @@ -2184,7 +2223,7 @@ BOOL _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ) } else delete pFndLine; - return TRUE; + return sal_True; } void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable ) @@ -2196,15 +2235,15 @@ void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable ) //Line im Array der SwTable. Damit die 0 fuer 'keine Line' verwand werden //kann werden die Positionen um 1 nach oben versetzt! - USHORT nStPos = USHRT_MAX; - USHORT nEndPos= 0; + sal_uInt16 nStPos = USHRT_MAX; + sal_uInt16 nEndPos= 0; - for ( USHORT i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) { SwTableLine *pLine = rBoxes[i]->GetUpper(); while ( pLine->GetUpper() ) pLine = pLine->GetUpper()->GetUpper(); - const USHORT nPos = rTable.GetTabLines().GetPos( + const sal_uInt16 nPos = rTable.GetTabLines().GetPos( (const SwTableLine*&)pLine ) + 1; ASSERT( nPos != USHRT_MAX, "TableLine not found." ); @@ -2234,7 +2273,7 @@ void _FndBox::SetTableLines( const SwTable &rTable ) return; SwTableLine* pTmpLine = GetLines()[0]->GetLine(); - USHORT nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pTmpLine ); + sal_uInt16 nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pTmpLine ); ASSERT( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" ); if( nPos ) pLineBefore = rTable.GetTabLines()[ nPos - 1 ]; @@ -2248,7 +2287,7 @@ void _FndBox::SetTableLines( const SwTable &rTable ) inline void UnsetFollow( SwFlowFrm *pTab ) { - pTab->bIsFollow = FALSE; + pTab->bIsFollow = sal_False; } void _FndBox::DelFrms( SwTable &rTable ) @@ -2259,8 +2298,8 @@ void _FndBox::DelFrms( SwTable &rTable ) //Wird ein Master vernichtet, so muss der Follow Master werden. //Ein TabFrm muss immer uebrigbleiben. - USHORT nStPos = 0; - USHORT nEndPos= rTable.GetTabLines().Count() - 1; + sal_uInt16 nStPos = 0; + sal_uInt16 nEndPos= rTable.GetTabLines().Count() - 1; if( rTable.IsNewModel() && pLineBefore ) rTable.CheckRowSpan( pLineBefore, true ); if ( pLineBefore ) @@ -2280,7 +2319,7 @@ void _FndBox::DelFrms( SwTable &rTable ) --nEndPos; } - for ( USHORT i = nStPos; i <= nEndPos; ++i) + for ( sal_uInt16 i = nStPos; i <= nEndPos; ++i) { SwFrmFmt *pFmt = rTable.GetTabLines()[i]->GetFrmFmt(); SwIterator<SwRowFrm,SwFmt> aIter( *pFmt ); @@ -2288,12 +2327,12 @@ void _FndBox::DelFrms( SwTable &rTable ) { if ( pFrm->GetTabLine() == rTable.GetTabLines()[i] ) { - BOOL bDel = TRUE; + sal_Bool bDel = sal_True; SwTabFrm *pUp = !pFrm->GetPrev() && !pFrm->GetNext() ? (SwTabFrm*)pFrm->GetUpper() : 0; if ( !pUp ) { - const USHORT nRepeat = + const sal_uInt16 nRepeat = ((SwTabFrm*)pFrm->GetUpper())->GetTable()->GetRowsToRepeat(); if ( nRepeat > 0 && ((SwTabFrm*)pFrm->GetUpper())->IsFollow() ) @@ -2327,7 +2366,7 @@ void _FndBox::DelFrms( SwTable &rTable ) // flag from pUp to pPrev. pUp may still have the // flag set although there is not more follow flow // line associated with pUp. - pPrev->SetFollowFlowLine( FALSE ); + pPrev->SetFollowFlowLine( sal_False ); // <-- } else if ( pFollow ) @@ -2353,7 +2392,7 @@ void _FndBox::DelFrms( SwTable &rTable ) } } delete pUp; - bDel = FALSE;//Die Row wird mit in den Abgrund + bDel = sal_False;//Die Row wird mit in den Abgrund //gerissen. } } @@ -2367,7 +2406,7 @@ void _FndBox::DelFrms( SwTable &rTable ) // We do not delete the follow flow line, // this will be done automatically in the // next turn. - ((SwTabFrm*)pTabFrm)->SetFollowFlowLine( FALSE ); + ((SwTabFrm*)pTabFrm)->SetFollowFlowLine( sal_False ); } pFrm->Cut(); @@ -2378,7 +2417,7 @@ void _FndBox::DelFrms( SwTable &rTable ) } } -BOOL lcl_IsLineOfTblFrm( const SwTabFrm& rTable, const SwFrm& rChk ) +sal_Bool lcl_IsLineOfTblFrm( const SwTabFrm& rTable, const SwFrm& rChk ) { const SwTabFrm* pTblFrm = rChk.FindTabFrm(); if( pTblFrm->IsFollow() ) @@ -2404,8 +2443,8 @@ void lcl_UpdateRepeatedHeadlines( SwTabFrm& rTabFrm, bool bCalcLowers ) // Insert fresh set of headlines: pLower = (SwRowFrm*)rTabFrm.Lower(); SwTable& rTable = *rTabFrm.GetTable(); - const USHORT nRepeat = rTable.GetRowsToRepeat(); - for ( USHORT nIdx = 0; nIdx < nRepeat; ++nIdx ) + const sal_uInt16 nRepeat = rTable.GetRowsToRepeat(); + for ( sal_uInt16 nIdx = 0; nIdx < nRepeat; ++nIdx ) { SwRowFrm* pHeadline = new SwRowFrm( *rTable.GetTabLines()[ nIdx ], &rTabFrm ); pHeadline->SetRepeatedHeadline( true ); @@ -2423,8 +2462,8 @@ void _FndBox::MakeFrms( SwTable &rTable ) //wieder neu erzeugt werden. //Und Zwar fuer alle Auspraegungen der Tabelle (mehrere z.B. im Kopf/Fuss). - USHORT nStPos = 0; - USHORT nEndPos= rTable.GetTabLines().Count() - 1; + sal_uInt16 nStPos = 0; + sal_uInt16 nEndPos= rTable.GetTabLines().Count() - 1; if ( pLineBefore ) { nStPos = rTable.GetTabLines().GetPos( @@ -2453,9 +2492,15 @@ void _FndBox::MakeFrms( SwTable &rTable ) i >= 0 && !pSibling; --i ) { SwTableLine *pLine = pLineBehind ? pLineBehind : +<<<<<<< local rTable.GetTabLines()[static_cast<USHORT>(i)]; SwIterator<SwRowFrm,SwFmt> aIter( *pLine->GetFrmFmt() ); pSibling = aIter.First(); +======= + rTable.GetTabLines()[static_cast<sal_uInt16>(i)]; + SwClientIter aIter( *pLine->GetFrmFmt() ); + pSibling = (SwFrm*)aIter.First( TYPE(SwFrm) ); +>>>>>>> other while ( pSibling && ( pSibling->GetTabLine() != pLine || !lcl_IsLineOfTblFrm( *pTable, *pSibling ) || @@ -2479,8 +2524,8 @@ void _FndBox::MakeFrms( SwTable &rTable ) // ???? oder das der Letzte Follow der Tabelle ???? pUpperFrm = pTable; - for ( i = nStPos; (USHORT)i <= nEndPos; ++i ) - ::lcl_InsertRow( *rTable.GetTabLines()[static_cast<USHORT>(i)], + for ( i = nStPos; (sal_uInt16)i <= nEndPos; ++i ) + ::lcl_InsertRow( *rTable.GetTabLines()[static_cast<sal_uInt16>(i)], (SwLayoutFrm*)pUpperFrm, pSibling ); if ( pUpperFrm->IsTabFrm() ) ((SwTabFrm*)pUpperFrm)->SetCalcLowers(); @@ -2493,23 +2538,23 @@ void _FndBox::MakeFrms( SwTable &rTable ) } } -void _FndBox::MakeNewFrms( SwTable &rTable, const USHORT nNumber, - const BOOL bBehind ) +void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, + const sal_Bool bBehind ) { //Frms fuer neu eingefuege Zeilen erzeugen. - //bBehind == TRUE: vor pLineBehind - // == FALSE: hinter pLineBefore - const USHORT nBfPos = pLineBefore ? + //bBehind == sal_True: vor pLineBehind + // == sal_False: hinter pLineBefore + const sal_uInt16 nBfPos = pLineBefore ? rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBefore ) : USHRT_MAX; - const USHORT nBhPos = pLineBehind ? + const sal_uInt16 nBhPos = pLineBehind ? rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBehind ) : USHRT_MAX; //nNumber: wie oft ist eingefuegt worden. //nCnt: wieviele sind nNumber mal eingefuegt worden. - const USHORT nCnt = + const sal_uInt16 nCnt = ((nBhPos != USHRT_MAX ? nBhPos : rTable.GetTabLines().Count()) - (nBfPos != USHRT_MAX ? nBfPos + 1 : 0)) / (nNumber + 1); @@ -2549,10 +2594,10 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const USHORT nNumber, pTable = pTable->GetFollow(); pUpperFrm = pTable; } - const USHORT nMax = nBhPos != USHRT_MAX ? + const sal_uInt16 nMax = nBhPos != USHRT_MAX ? nBhPos : rTable.GetTabLines().Count(); - USHORT i = nBfPos != USHRT_MAX ? nBfPos + 1 + nCnt : nCnt; + sal_uInt16 i = nBfPos != USHRT_MAX ? nBfPos + 1 + nCnt : nCnt; for ( ; i < nMax; ++i ) ::lcl_InsertRow( *rTable.GetTabLines()[i], pUpperFrm, pSibling ); @@ -2561,7 +2606,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const USHORT nNumber, } else //davor einfuegen { - USHORT i; + sal_uInt16 i; // We are looking for the frame that is behind the row frame // that should be inserted. @@ -2597,7 +2642,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const USHORT nNumber, if ( pLineBefore ) pSibling = (SwRowFrm*) pSibling->GetNext(); - USHORT nMax = nBhPos != USHRT_MAX ? + sal_uInt16 nMax = nBhPos != USHRT_MAX ? nBhPos - nCnt : rTable.GetTabLines().Count() - nCnt; @@ -2613,7 +2658,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const USHORT nNumber, //Die Headlines mussen ggf. auch verarbeitet werden. Um gut arbeitenden //Code nicht zu zerfasern wird hier nochmals iteriert. - const USHORT nRowsToRepeat = rTable.GetRowsToRepeat(); + const sal_uInt16 nRowsToRepeat = rTable.GetRowsToRepeat(); if ( nRowsToRepeat > 0 && ( ( !bBehind && ( nBfPos == USHRT_MAX || nBfPos + 1 < nRowsToRepeat ) ) || ( bBehind && ( ( nBfPos == USHRT_MAX && nRowsToRepeat > 1 ) || nBfPos + 2 < nRowsToRepeat ) ) ) ) @@ -2634,14 +2679,14 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const USHORT nNumber, } } -BOOL _FndBox::AreLinesToRestore( const SwTable &rTable ) const +sal_Bool _FndBox::AreLinesToRestore( const SwTable &rTable ) const { //Lohnt es sich MakeFrms zu rufen? if ( !pLineBefore && !pLineBehind && rTable.GetTabLines().Count() ) - return TRUE; + return sal_True; - USHORT nBfPos; + sal_uInt16 nBfPos; if(pLineBefore) { const SwTableLine* rLBefore = (const SwTableLine*)pLineBefore; @@ -2650,7 +2695,7 @@ BOOL _FndBox::AreLinesToRestore( const SwTable &rTable ) const else nBfPos = USHRT_MAX; - USHORT nBhPos; + sal_uInt16 nBhPos; if(pLineBehind) { const SwTableLine* rLBehind = (const SwTableLine*)pLineBehind; @@ -2661,8 +2706,8 @@ BOOL _FndBox::AreLinesToRestore( const SwTable &rTable ) const if ( nBfPos == nBhPos ) //Duerfte eigentlich nie vorkommen. { - ASSERT( FALSE, "Table, Loeschen auf keinem Bereich !?!" ); - return FALSE; + ASSERT( sal_False, "Table, Loeschen auf keinem Bereich !?!" ); + return sal_False; } if ( rTable.GetRowsToRepeat() > 0 ) @@ -2682,19 +2727,19 @@ BOOL _FndBox::AreLinesToRestore( const SwTable &rTable ) const // Some adjacent lines at the beginning of the table have been deleted: if ( nBfPos == USHRT_MAX && nBhPos == 0 ) - return FALSE; + return sal_False; // Some adjacent lines at the end of the table have been deleted: if ( nBhPos == USHRT_MAX && nBfPos == (rTable.GetTabLines().Count() - 1) ) - return FALSE; + return sal_False; // Some adjacent lines in the middle of the table have been deleted: if ( nBfPos != USHRT_MAX && nBhPos != USHRT_MAX && (nBfPos + 1) == nBhPos ) - return FALSE; + return sal_False; // The structure of the deleted lines is more complex due to split lines. // A call of MakeFrms() is necessary. - return TRUE; + return sal_True; } |