diff options
Diffstat (limited to 'sw/source/core/table/swtable.cxx')
-rw-r--r-- | sw/source/core/table/swtable.cxx | 417 |
1 files changed, 217 insertions, 200 deletions
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 3f59266b65e5..74197aee67df 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -96,7 +96,7 @@ SV_IMPL_REF( SwServerObject ) #define COLFUZZY 20 void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol, - BOOL bChgAlign,ULONG nNdPos ); + sal_Bool bChgAlign,sal_uLong nNdPos ); //---------------------------------- class SwTableBox_Impl @@ -213,7 +213,7 @@ String& lcl_DelTabsAtSttEnd( String& rTxt ) void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd, SwTableLine* pLine, SwTableBoxFmt* pBoxFrmFmt, SwTableBox* pBox, - USHORT nInsPos, USHORT nCnt ) + sal_uInt16 nInsPos, sal_uInt16 nCnt ) { ASSERT( pBox->GetSttNd(), "Box ohne Start-Node" ); SwNodeIndex aIdx( *pBox->GetSttNd(), +1 ); @@ -250,7 +250,7 @@ void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd, if( nRowSpan != 1 ) { SwTableBoxes& rTblBoxes = pLine->GetTabBoxes(); - for( USHORT i = 0; i < nCnt; ++i ) + for( sal_uInt16 i = 0; i < nCnt; ++i ) { pBox = rTblBoxes[ i + nInsPos ]; pBox->setRowSpan( nRowSpan ); @@ -269,8 +269,8 @@ SwTable::SwTable( SwTableFmt* pFmt ) pTableNode( 0 ), nGrfsThatResize( 0 ), nRowsToRepeat( 1 ), - bModifyLocked( FALSE ), - bNewModel( TRUE ) + bModifyLocked( sal_False ), + bNewModel( sal_True ) { // default Wert aus den Optionen setzen eTblChgMode = (TblChgMode)GetTblChgDefaultMode(); @@ -283,14 +283,14 @@ SwTable::SwTable( const SwTable& rTable ) eTblChgMode( rTable.eTblChgMode ), nGrfsThatResize( 0 ), nRowsToRepeat( rTable.GetRowsToRepeat() ), - bModifyLocked( FALSE ), + bModifyLocked( sal_False ), bNewModel( rTable.bNewModel ) { } void DelBoxNode( SwTableSortBoxes& rSortCntBoxes ) { - for( USHORT n = 0; n < rSortCntBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rSortCntBoxes.Count(); ++n ) rSortCntBoxes[ n ]->pSttNd = 0; } @@ -319,7 +319,7 @@ SwTable::~SwTable() //JP: reicht leider nicht, es muessen die Pointer auf den StartNode // der Section geloescht werden DelBoxNode( aSortCntBoxes ); - aSortCntBoxes.Remove( (USHORT)0, aSortCntBoxes.Count() ); + aSortCntBoxes.Remove( (sal_uInt16)0, aSortCntBoxes.Count() ); delete pHTMLLayout; } @@ -330,7 +330,7 @@ SwTable::~SwTable() |*************************************************************************/ inline void FmtInArr( SvPtrarr& rFmtArr, SwFmt* pBoxFmt ) { - BOOL bRet = USHRT_MAX != rFmtArr.GetPos( (VoidPtr)pBoxFmt ); + sal_Bool bRet = USHRT_MAX != rFmtArr.GetPos( (VoidPtr)pBoxFmt ); if( !bRet ) rFmtArr.Insert( (VoidPtr)pBoxFmt, rFmtArr.Count() ); } @@ -341,11 +341,11 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld, void lcl_ModifyLines( SwTableLines &rLines, const long nOld, const long nNew, SvPtrarr& rFmtArr, const bool bCheckSum ) { - for ( USHORT i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) ::lcl_ModifyBoxes( rLines[i]->GetTabBoxes(), nOld, nNew, rFmtArr ); if( bCheckSum ) { - for( USHORT i = 0; i < rFmtArr.Count(); ++i ) + for( sal_uInt16 i = 0; i < rFmtArr.Count(); ++i ) { SwFmt* pFmt = (SwFmt*)rFmtArr[i]; sal_uInt64 nBox = pFmt->GetFrmSize().GetWidth(); @@ -364,7 +364,7 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld, { sal_uInt64 nSum = 0; // To avoid rounding errors we summarize all box widths sal_uInt64 nOriginalSum = 0; // Sum of original widths - for ( USHORT i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) { SwTableBox &rBox = *rBoxes[i]; if ( rBox.GetTabLines().Count() ) @@ -406,13 +406,13 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld, void SwTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { // fange SSize Aenderungen ab, um die Lines/Boxen anzupassen - USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ; + sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ; const SwFmtFrmSize* pNewSize = 0, *pOldSize = 0; if( RES_ATTRSET_CHG == nWhich ) { if( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( - RES_FRM_SIZE, FALSE, (const SfxPoolItem**)&pNewSize )) + RES_FRM_SIZE, sal_False, (const SfxPoolItem**)&pNewSize )) pOldSize = &((SwAttrSetChg*)pOld)->GetChgSet()->GetFrmSize(); } else if( RES_FRM_SIZE == nWhich ) @@ -437,7 +437,7 @@ void SwTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) void SwTable::AdjustWidths( const long nOld, const long nNew ) { - SvPtrarr aFmtArr( (BYTE)aLines[0]->GetTabBoxes().Count(), 1 ); + SvPtrarr aFmtArr( (sal_uInt8)aLines[0]->GetTabBoxes().Count(), 1 ); ::lcl_ModifyLines( aLines, nOld, nNew, aFmtArr, true ); } @@ -446,20 +446,20 @@ void SwTable::AdjustWidths( const long nOld, const long nNew ) |* SwTable::GetTabCols() |* |*************************************************************************/ -void lcl_RefreshHidden( SwTabCols &rToFill, USHORT nPos ) +void lcl_RefreshHidden( SwTabCols &rToFill, sal_uInt16 nPos ) { - for ( USHORT i = 0; i < rToFill.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rToFill.Count(); ++i ) { if ( Abs((long)(nPos - rToFill[i])) <= COLFUZZY ) { - rToFill.SetHidden( i, FALSE ); + rToFill.SetHidden( i, sal_False ); break; } } } void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox, - const SwFrmFmt *pTabFmt, const BOOL bHidden, + const SwFrmFmt *pTabFmt, const sal_Bool bHidden, const FASTBOOL bRefreshHidden ) { const long nWish = pTabFmt->GetFrmSize().GetWidth(); @@ -467,32 +467,32 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox, //Der Wert fuer die linke Kante der Box errechnet sich aus den //Breiten der vorhergehenden Boxen. - USHORT nPos = 0; - USHORT nSum = 0; - USHORT nLeftMin = 0; - USHORT nRightMax = 0; + sal_uInt16 nPos = 0; + sal_uInt16 nSum = 0; + sal_uInt16 nLeftMin = 0; + sal_uInt16 nRightMax = 0; const SwTableBox *pCur = pBox; const SwTableLine *pLine = pBox->GetUpper(); while ( pLine ) { const SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - for ( USHORT i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) { SwTwips nWidth = rBoxes[i]->GetFrmFmt()->GetFrmSize().GetWidth(); - nSum = (USHORT)(nSum + nWidth); + nSum = (sal_uInt16)(nSum + nWidth); sal_uInt64 nTmp = nSum; nTmp *= nAct; nTmp /= nWish; if (rBoxes[i] != pCur) { if ( pLine == pBox->GetUpper() || 0 == nLeftMin ) - nLeftMin = (USHORT)(nTmp - nPos); - nPos = (USHORT)nTmp; + nLeftMin = (sal_uInt16)(nTmp - nPos); + nPos = (sal_uInt16)nTmp; } else { - nSum = (USHORT)(nSum - nWidth); + nSum = (sal_uInt16)(nSum - nWidth); if ( 0 == nRightMax ) - nRightMax = (USHORT)(nTmp - nPos); + nRightMax = (sal_uInt16)(nTmp - nPos); break; } } @@ -500,18 +500,18 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox, pLine = pCur ? pCur->GetUpper() : 0; } - BOOL bInsert = !bRefreshHidden; - for ( USHORT j = 0; bInsert && (j < rToFill.Count()); ++j ) + sal_Bool bInsert = !bRefreshHidden; + for ( sal_uInt16 j = 0; bInsert && (j < rToFill.Count()); ++j ) { long nCmp = rToFill[j]; if ( (nPos >= ((nCmp >= COLFUZZY) ? nCmp - COLFUZZY : nCmp)) && (nPos <= (nCmp + COLFUZZY)) ) { - bInsert = FALSE; //Hat ihn schon. + bInsert = sal_False; //Hat ihn schon. } else if ( nPos < nCmp ) { - bInsert = FALSE; + bInsert = sal_False; rToFill.Insert( nPos, bHidden, j ); } } @@ -529,7 +529,7 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox, // check if nPos is entry: bool bFoundPos = false; bool bFoundMax = false; - for ( USHORT j = 0; !(bFoundPos && bFoundMax ) && j < rToFill.Count(); ++j ) + for ( sal_uInt16 j = 0; !(bFoundPos && bFoundMax ) && j < rToFill.Count(); ++j ) { SwTabColsEntry& rEntry = rToFill.GetEntry( j ); long nCmp = rToFill[j]; @@ -568,26 +568,26 @@ void lcl_ProcessBoxGet( const SwTableBox *pBox, SwTabCols &rToFill, if ( pBox->GetTabLines().Count() ) { const SwTableLines &rLines = pBox->GetTabLines(); - for ( USHORT i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { const SwTableBoxes &rBoxes = rLines[i]->GetTabBoxes(); - for ( USHORT j = 0; j < rBoxes.Count(); ++j ) + for ( sal_uInt16 j = 0; j < rBoxes.Count(); ++j ) ::lcl_ProcessBoxGet( rBoxes[j], rToFill, pTabFmt, bRefreshHidden); } } else - ::lcl_SortedTabColInsert( rToFill, pBox, pTabFmt, FALSE, bRefreshHidden ); + ::lcl_SortedTabColInsert( rToFill, pBox, pTabFmt, sal_False, bRefreshHidden ); } void lcl_ProcessLineGet( const SwTableLine *pLine, SwTabCols &rToFill, const SwFrmFmt *pTabFmt ) { - for ( USHORT i = 0; i < pLine->GetTabBoxes().Count(); ++i ) + for ( sal_uInt16 i = 0; i < pLine->GetTabBoxes().Count(); ++i ) { const SwTableBox *pBox = pLine->GetTabBoxes()[i]; if ( pBox->GetSttNd() ) - ::lcl_SortedTabColInsert( rToFill, pBox, pTabFmt, TRUE, FALSE ); + ::lcl_SortedTabColInsert( rToFill, pBox, pTabFmt, sal_True, sal_False ); else - for ( USHORT j = 0; j < pBox->GetTabLines().Count(); ++j ) + for ( sal_uInt16 j = 0; j < pBox->GetTabLines().Count(); ++j ) ::lcl_ProcessLineGet( pBox->GetTabLines()[j], rToFill, pTabFmt ); } } @@ -599,14 +599,14 @@ void lcl_ProcessLineGet( const SwTableLine *pLine, SwTabCols &rToFill, #endif void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, - BOOL bRefreshHidden, BOOL bCurRowOnly ) const + sal_Bool bRefreshHidden, sal_Bool bCurRowOnly ) const { //MA 30. Nov. 95: Opt: wenn bHidden gesetzt ist, wird nur das Hidden //Array aktualisiert. if ( bRefreshHidden ) { //Korrekturen entfernen - USHORT i; + sal_uInt16 i; for ( i = 0; i < rToFill.Count(); ++i ) { SwTabColsEntry& rEntry = rToFill.GetEntry( i ); @@ -617,7 +617,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, //Alle sind hidden, dann die sichtbaren eintragen. for ( i = 0; i < rToFill.Count(); ++i ) - rToFill.SetHidden( i, TRUE ); + rToFill.SetHidden( i, sal_True ); } else { @@ -647,7 +647,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, //1. const SwTableBoxes &rBoxes = pStart->GetUpper()->GetTabBoxes(); - USHORT i; + sal_uInt16 i; for ( i = 0; i < rBoxes.Count(); ++i ) ::lcl_ProcessBoxGet( rBoxes[i], rToFill, pTabFmt, bRefreshHidden ); @@ -657,9 +657,9 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, while ( pLine ) { const SwTableBoxes &rBoxes2 = pLine->GetTabBoxes(); - for ( USHORT k = 0; k < rBoxes2.Count(); ++k ) + for ( sal_uInt16 k = 0; k < rBoxes2.Count(); ++k ) ::lcl_SortedTabColInsert( rToFill, rBoxes2[k], - pTabFmt, FALSE, bRefreshHidden ); + pTabFmt, sal_False, bRefreshHidden ); pLine = pLine->GetUpper() ? pLine->GetUpper()->GetUpper() : 0; } @@ -710,9 +710,9 @@ struct Parm Parm( const SwTabCols &rN, const SwTabCols &rO ) : rNew( rN ), rOld( rO ), aBoxArr( 10, 1 ) {} }; -inline BOOL BoxInArr( SvPtrarr& rArr, SwTableBox* pBox ) +inline sal_Bool BoxInArr( SvPtrarr& rArr, SwTableBox* pBox ) { - BOOL bRet = USHRT_MAX != rArr.GetPos( (VoidPtr)pBox ); + sal_Bool bRet = USHRT_MAX != rArr.GetPos( (VoidPtr)pBox ); if( !bRet ) rArr.Insert( (VoidPtr)pBox, rArr.Count() ); return bRet; @@ -724,7 +724,7 @@ void lcl_ProcessLine( SwTableLine *pLine, Parm &rParm ) { SwTableBoxes &rBoxes = pLine->GetTabBoxes(); for ( int i = rBoxes.Count()-1; i >= 0; --i ) - ::lcl_ProcessBoxSet( rBoxes[ static_cast< USHORT >(i) ], rParm ); + ::lcl_ProcessBoxSet( rBoxes[ static_cast< sal_uInt16 >(i) ], rParm ); } void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) @@ -732,7 +732,7 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) if ( pBox->GetTabLines().Count() ) { SwTableLines &rLines = pBox->GetTabLines(); for ( int i = rLines.Count()-1; i >= 0; --i ) - lcl_ProcessLine( rLines[ static_cast< USHORT >(i) ], rParm ); + lcl_ProcessLine( rLines[ static_cast< sal_uInt16 >(i) ], rParm ); } else { @@ -753,13 +753,13 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) while ( pLine ) { const SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - for ( USHORT i = 0; (i < rBoxes.Count()) && (rBoxes[i] != pCur); ++i) + for ( sal_uInt16 i = 0; (i < rBoxes.Count()) && (rBoxes[i] != pCur); ++i) { sal_uInt64 nWidth = rBoxes[i]->GetFrmFmt()-> GetFrmSize().GetWidth(); nWidth *= nOldAct; nWidth /= rParm.nOldWish; - nLeft += (USHORT)nWidth; + nLeft += (sal_uInt16)nWidth; } pCur = pLine->GetUpper(); pLine = pCur ? pCur->GetUpper() : 0; @@ -773,9 +773,9 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) nWidth *= nOldAct; nWidth /= rParm.nOldWish; long nRight = nLeft + (long)nWidth; - USHORT nLeftPos = USHRT_MAX, + sal_uInt16 nLeftPos = USHRT_MAX, nRightPos = USHRT_MAX; - for ( USHORT i = 0; i < rParm.rOld.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rParm.rOld.Count(); ++i ) { if ( nLeft >= (rParm.rOld[i] - COLFUZZY) && nLeft <= (rParm.rOld[i] + COLFUZZY) ) @@ -801,8 +801,8 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) nWidth /= rParm.nOldWish; long nTmp = (long)nWidth; nTmp += rParm.rOld.GetLeft(); - USHORT nLeftPos = USHRT_MAX; - for ( USHORT i = 0; i < rParm.rOld.Count() && + sal_uInt16 nLeftPos = USHRT_MAX; + for ( sal_uInt16 i = 0; i < rParm.rOld.Count() && nLeftPos == USHRT_MAX; ++i ) { if ( nTmp >= (rParm.rOld[i] - COLFUZZY) && @@ -823,7 +823,7 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) if( pBox->getRowSpan() == 1 ) { SwTableBoxes& rTblBoxes = pBox->GetUpper()->GetTabBoxes(); - USHORT nPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox ); + sal_uInt16 nPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox ); if( nPos && rTblBoxes[ nPos - 1 ]->getRowSpan() != 1 ) nLeftDiff = 0; if( nPos + 1 < rTblBoxes.Count() && @@ -881,15 +881,15 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) } void lcl_ProcessBoxPtr( SwTableBox *pBox, SvPtrarr &rBoxArr, - BOOL bBefore ) + sal_Bool bBefore ) { if ( pBox->GetTabLines().Count() ) { const SwTableLines &rLines = pBox->GetTabLines(); - for ( USHORT i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { const SwTableBoxes &rBoxes = rLines[i]->GetTabBoxes(); - for ( USHORT j = 0; j < rBoxes.Count(); ++j ) + for ( sal_uInt16 j = 0; j < rBoxes.Count(); ++j ) ::lcl_ProcessBoxPtr( rBoxes[j], rBoxArr, bBefore ); } } @@ -903,7 +903,7 @@ void lcl_AdjustBox( SwTableBox *pBox, const long nDiff, Parm &rParm ); void lcl_AdjustLines( SwTableLines &rLines, const long nDiff, Parm &rParm ) { - for ( USHORT i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { SwTableBox *pBox = rLines[i]->GetTabBoxes() [rLines[i]->GetTabBoxes().Count()-1]; @@ -926,7 +926,7 @@ void lcl_AdjustBox( SwTableBox *pBox, const long nDiff, Parm &rParm ) } void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, - const SwTableBox *pStart, BOOL bCurRowOnly ) + const SwTableBox *pStart, sal_Bool bCurRowOnly ) { CHECK_TABLE( *this ) @@ -967,8 +967,8 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, SwFmtHoriOrient aOri( pFmt->GetHoriOrient() ); if(text::HoriOrientation::NONE != aOri.GetHoriOrient()) { - const BOOL bLeftDist = rNew.GetLeft() != nShLeft; - const BOOL bRightDist = rNew.GetRight() + nShRight != rNew.GetRightMax(); + const sal_Bool bLeftDist = rNew.GetLeft() != nShLeft; + const sal_Bool bRightDist = rNew.GetRight() + nShRight != rNew.GetRightMax(); if(!bLeftDist && !bRightDist) aOri.SetHoriOrient( text::HoriOrientation::FULL ); else if(!bRightDist && rNew.GetLeft() > nShLeft ) @@ -1032,8 +1032,8 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, //entsprechenden Boxen in einem PtrArray vorzumerken. const SwTableBoxes &rBoxes = pStart->GetUpper()->GetTabBoxes(); - for ( USHORT i = 0; i < rBoxes.Count(); ++i ) - ::lcl_ProcessBoxPtr( rBoxes[i], aParm.aBoxArr, FALSE ); + for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) + ::lcl_ProcessBoxPtr( rBoxes[i], aParm.aBoxArr, sal_False ); const SwTableLine *pLine = pStart->GetUpper()->GetUpper() ? pStart->GetUpper()->GetUpper()->GetUpper() : 0; @@ -1041,13 +1041,13 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, while ( pLine ) { const SwTableBoxes &rBoxes2 = pLine->GetTabBoxes(); - BOOL bBefore = TRUE; - for ( USHORT i = 0; i < rBoxes2.Count(); ++i ) + sal_Bool bBefore = sal_True; + for ( sal_uInt16 i = 0; i < rBoxes2.Count(); ++i ) { if ( rBoxes2[i] != pExcl ) ::lcl_ProcessBoxPtr( rBoxes2[i], aParm.aBoxArr, bBefore ); else - bBefore = FALSE; + bBefore = sal_False; } pExcl = pLine->GetUpper(); pLine = pLine->GetUpper() ? pLine->GetUpper()->GetUpper() : 0; @@ -1057,7 +1057,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, //verarbeitet zu werden. for ( int j = aParm.aBoxArr.Count()-1; j >= 0; --j ) { - SwTableBox *pBox = (SwTableBox*)aParm.aBoxArr[ static_cast< USHORT >(j)]; + SwTableBox *pBox = (SwTableBox*)aParm.aBoxArr[ static_cast< sal_uInt16 >(j)]; ::lcl_ProcessBoxSet( pBox, aParm ); } } @@ -1069,7 +1069,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, //gearbeitet werden! SwTableLines &rLines = GetTabLines(); for ( int i = rLines.Count()-1; i >= 0; --i ) - ::lcl_ProcessLine( rLines[ static_cast< USHORT >(i) ], aParm ); + ::lcl_ProcessLine( rLines[ static_cast< sal_uInt16 >(i) ], aParm ); } } @@ -1079,23 +1079,23 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, extern void _CheckBoxWidth( const SwTableLine&, SwTwips ); // checke doch mal ob die Tabellen korrekte Breiten haben SwTwips nSize = GetFrmFmt()->GetFrmSize().GetWidth(); - for( USHORT n = 0; n < aLines.Count(); ++n ) + for( sal_uInt16 n = 0; n < aLines.Count(); ++n ) _CheckBoxWidth( *aLines[ n ], nSize ); } #endif } -typedef std::pair<USHORT, USHORT> ColChange; +typedef std::pair<sal_uInt16, sal_uInt16> ColChange; typedef std::list< ColChange > ChangeList; static void lcl_AdjustWidthsInLine( SwTableLine* pLine, ChangeList& rOldNew, - Parm& rParm, USHORT nColFuzzy ) + Parm& rParm, sal_uInt16 nColFuzzy ) { ChangeList::iterator pCurr = rOldNew.begin(); if( pCurr == rOldNew.end() ) return; - USHORT nCount = pLine->GetTabBoxes().Count(); - USHORT i = 0; + sal_uInt16 nCount = pLine->GetTabBoxes().Count(); + sal_uInt16 i = 0; SwTwips nBorder = 0; SwTwips nRest = 0; while( i < nCount ) @@ -1138,7 +1138,7 @@ static void lcl_AdjustWidthsInLine( SwTableLine* pLine, ChangeList& rOldNew, } } -static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges, +static void lcl_CalcNewWidths( std::list<sal_uInt16> &rSpanPos, ChangeList& rChanges, SwTableLine* pLine, long nWish, long nWidth, bool bTop ) { if( !rChanges.size() ) @@ -1151,17 +1151,17 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges rChanges.clear(); return; } - std::list<USHORT> aNewSpanPos; + std::list<sal_uInt16> aNewSpanPos; ChangeList aNewChanges; ChangeList::iterator pCurr = rChanges.begin(); aNewChanges.push_back( *pCurr ); // Nullposition - std::list<USHORT>::iterator pSpan = rSpanPos.begin(); - USHORT nCurr = 0; - USHORT nOrgSum = 0; + std::list<sal_uInt16>::iterator pSpan = rSpanPos.begin(); + sal_uInt16 nCurr = 0; + sal_uInt16 nOrgSum = 0; bool bRowSpan = false; - USHORT nRowSpanCount = 0; - USHORT nCount = pLine->GetTabBoxes().Count(); - for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) + sal_uInt16 nRowSpanCount = 0; + sal_uInt16 nCount = pLine->GetTabBoxes().Count(); + for( sal_uInt16 nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; SwTwips nCurrWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth(); @@ -1171,17 +1171,17 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges if( bRowSpan || bCurrRowSpan ) aNewSpanPos.push_back( nRowSpanCount ); bRowSpan = bCurrRowSpan; - nOrgSum = (USHORT)(nOrgSum + nCurrWidth); + nOrgSum = (sal_uInt16)(nOrgSum + nCurrWidth); sal_uInt64 nSum = nOrgSum; nSum *= nWidth; nSum /= nWish; nSum *= nWish; nSum /= nWidth; - USHORT nPos = (USHORT)nSum; + sal_uInt16 nPos = (sal_uInt16)nSum; while( pCurr != rChanges.end() && pCurr->first < nPos ) { #ifdef DBG_UTIL - USHORT nTemp = pCurr->first; + sal_uInt16 nTemp = pCurr->first; nTemp = pCurr->second; #endif ++nCurr; @@ -1230,7 +1230,7 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges nTmp *= pLeftMove->second - pLast->second; nTmp /= pLeftMove->first - pLast->first; nTmp += pLast->second; - pCurr->second = (USHORT)nTmp; + pCurr->second = (sal_uInt16)nTmp; } } pLast = pCurr; @@ -1254,7 +1254,7 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges nTmp *= pNext->second - pLast->second; nTmp /= pNext->first - pLast->first; nTmp += pLast->second; - pCurr->second = (USHORT)nTmp; + pCurr->second = (sal_uInt16)nTmp; } ++pCurr; } @@ -1272,13 +1272,13 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges while( pCopy != aNewChanges.end() ) rChanges.push_back( *pCopy++ ); rSpanPos.clear(); - std::list<USHORT>::iterator pSpCopy = aNewSpanPos.begin(); + std::list<sal_uInt16>::iterator pSpCopy = aNewSpanPos.begin(); while( pSpCopy != aNewSpanPos.end() ) rSpanPos.push_back( *pSpCopy++ ); } void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, - const SwTabCols &rOld, const SwTableBox *pStart, BOOL bCurRowOnly ) + const SwTabCols &rOld, const SwTableBox *pStart, sal_Bool bCurRowOnly ) { #ifdef DBG_UTIL static int nCallCount = 0; @@ -1290,7 +1290,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, const long nOldWidth = rParm.rOld.GetRight() - rParm.rOld.GetLeft(); if( nNewWidth < 1 || nOldWidth < 1 ) return; - for( USHORT i = 0; i <= rOld.Count(); ++i ) + for( sal_uInt16 i = 0; i <= rOld.Count(); ++i ) { sal_uInt64 nNewPos; sal_uInt64 nOldPos; @@ -1310,7 +1310,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, nOldPos /= nOldWidth; if( nOldPos != nNewPos && nNewPos > 0 && nOldPos > 0 ) { - ColChange aChg( (USHORT)nOldPos, (USHORT)nNewPos ); + ColChange aChg( (sal_uInt16)nOldPos, (sal_uInt16)nNewPos ); aOldNew.push_back( aChg ); } } @@ -1322,18 +1322,18 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, if( bCurRowOnly ) { const SwTableLine* pCurrLine = pStart->GetUpper(); - USHORT nCurr = rLines.C40_GETPOS( SwTableLine, pCurrLine ); + sal_uInt16 nCurr = rLines.C40_GETPOS( SwTableLine, pCurrLine ); if( nCurr >= USHRT_MAX ) return; ColChange aChg( 0, 0 ); aOldNew.push_front( aChg ); - std::list<USHORT> aRowSpanPos; + std::list<sal_uInt16> aRowSpanPos; if( nCurr ) { ChangeList aCopy; ChangeList::iterator pCop = aOldNew.begin(); - USHORT nPos = 0; + sal_uInt16 nPos = 0; while( pCop != aOldNew.end() ) { aCopy.push_back( *pCop ); @@ -1343,7 +1343,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[nCurr], rParm.nOldWish, nOldWidth, true ); bool bGoOn = aRowSpanPos.size() > 0; - USHORT j = nCurr; + sal_uInt16 j = nCurr; while( bGoOn ) { lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[--j], @@ -1357,7 +1357,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, { ChangeList aCopy; ChangeList::iterator pCop = aOldNew.begin(); - USHORT nPos = 0; + sal_uInt16 nPos = 0; while( pCop != aOldNew.end() ) { aCopy.push_back( *pCop ); @@ -1367,7 +1367,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[nCurr], rParm.nOldWish, nOldWidth, false ); bool bGoOn = aRowSpanPos.size() > 0; - USHORT j = nCurr; + sal_uInt16 j = nCurr; while( bGoOn ) { lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[++j], @@ -1378,7 +1378,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, } ::lcl_AdjustWidthsInLine( rLines[nCurr], aOldNew, rParm, 1 ); } - else for( USHORT i = 0; i < rLines.Count(); ++i ) + else for( sal_uInt16 i = 0; i < rLines.Count(); ++i ) ::lcl_AdjustWidthsInLine( rLines[i], aOldNew, rParm, COLFUZZY ); CHECK_TABLE( *this ) } @@ -1391,31 +1391,31 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, |* |*************************************************************************/ -BOOL IsValidRowName( const String& rStr ) +sal_Bool IsValidRowName( const String& rStr ) { - BOOL bIsValid = TRUE; + sal_Bool bIsValid = sal_True; xub_StrLen nLen = rStr.Len(); for (xub_StrLen i = 0; i < nLen && bIsValid; ++i) { const sal_Unicode cChar = rStr.GetChar(i); if (cChar < '0' || cChar > '9') - bIsValid = FALSE; + bIsValid = sal_False; } return bIsValid; } // --> OD 2007-08-03 #i80314# // add 3rd parameter and its handling -USHORT SwTable::_GetBoxNum( String& rStr, BOOL bFirstPart, +sal_uInt16 SwTable::_GetBoxNum( String& rStr, sal_Bool bFirstPart, const bool bPerformValidCheck ) { - USHORT nRet = 0; + sal_uInt16 nRet = 0; xub_StrLen nPos = 0; - if( bFirstPart ) // TRUE == column; FALSE == row + if( bFirstPart ) // sal_True == column; sal_False == row { // die 1. ist mit Buchstaben addressiert! sal_Unicode cChar; - BOOL bFirst = TRUE; + sal_Bool bFirst = sal_True; while( 0 != ( cChar = rStr.GetChar( nPos )) && ( (cChar >= 'A' && cChar <= 'Z') || (cChar >= 'a' && cChar <= 'z') ) ) @@ -1423,7 +1423,7 @@ USHORT SwTable::_GetBoxNum( String& rStr, BOOL bFirstPart, if( (cChar -= 'A') >= 26 ) cChar -= 'a' - '['; if( bFirst ) - bFirst = FALSE; + bFirst = sal_False; else ++nRet; nRet = nRet * 52 + cChar; @@ -1436,7 +1436,7 @@ USHORT SwTable::_GetBoxNum( String& rStr, BOOL bFirstPart, nRet = 0; if ( !bPerformValidCheck || IsValidRowName( rStr ) ) { - nRet = static_cast<USHORT>(rStr.ToInt32()); + nRet = static_cast<sal_uInt16>(rStr.ToInt32()); } rStr.Erase(); } @@ -1446,7 +1446,7 @@ USHORT SwTable::_GetBoxNum( String& rStr, BOOL bFirstPart, String aTxt( rStr.Copy( 0, nPos ) ); if ( !bPerformValidCheck || IsValidRowName( aTxt ) ) { - nRet = static_cast<USHORT>(aTxt.ToInt32()); + nRet = static_cast<sal_uInt16>(aTxt.ToInt32()); } rStr.Erase( 0, nPos+1 ); } @@ -1464,7 +1464,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, const SwTableLines* pLines; const SwTableBoxes* pBoxes; - USHORT nLine, nBox; + sal_uInt16 nLine, nBox; String aNm( rName ); while( aNm.Len() ) { @@ -1479,7 +1479,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, --nBox; } - nLine = SwTable::_GetBoxNum( aNm, FALSE, bPerformValidCheck ); + nLine = SwTable::_GetBoxNum( aNm, sal_False, bPerformValidCheck ); // bestimme die Line if( !nLine || nLine > pLines->Count() ) @@ -1497,7 +1497,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, // Box ist ?? if( pBox && !pBox->GetSttNd() ) { - ASSERT( FALSE, "Box ohne Inhalt, suche die naechste !!" ); + ASSERT( sal_False, "Box ohne Inhalt, suche die naechste !!" ); // "herunterfallen lassen" bis zur ersten Box while( pBox->GetTabLines().Count() ) pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; @@ -1505,7 +1505,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, return pBox; } -SwTableBox* SwTable::GetTblBox( ULONG nSttIdx ) +SwTableBox* SwTable::GetTblBox( sal_uLong nSttIdx ) { //MA: Zur Optimierung nicht immer umstaendlich das ganze SortArray abhuenern. //OS: #102675# converting text to table tries und certain conditions @@ -1514,7 +1514,7 @@ SwTableBox* SwTable::GetTblBox( ULONG nSttIdx ) return 0; SwTableBox* pRet = 0; SwNodes& rNds = GetFrmFmt()->GetDoc()->GetNodes(); - ULONG nIndex = nSttIdx + 1; + sal_uLong nIndex = nSttIdx + 1; SwCntntNode* pCNd = 0; SwTableNode* pTblNd = 0; @@ -1549,22 +1549,22 @@ SwTableBox* SwTable::GetTblBox( ULONG nSttIdx ) //Falls es das Layout noch nicht gibt oder sonstwie etwas schieft geht. if ( !pRet ) { - for( USHORT n = aSortCntBoxes.Count(); n; ) + for( sal_uInt16 n = aSortCntBoxes.Count(); n; ) if( aSortCntBoxes[ --n ]->GetSttIdx() == nSttIdx ) return aSortCntBoxes[ n ]; } return pRet; } -BOOL SwTable::IsTblComplex() const +sal_Bool SwTable::IsTblComplex() const { - // returnt TRUE wenn sich in der Tabelle Verschachtelungen befinden + // returnt sal_True wenn sich in der Tabelle Verschachtelungen befinden // steht eine Box nicht in der obersten Line, da wurde gesplittet/ // gemergt und die Struktur ist komplexer. - for( USHORT n = 0; n < aSortCntBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < aSortCntBoxes.Count(); ++n ) if( aSortCntBoxes[ n ]->GetUpper()->GetUpper() ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } @@ -1574,10 +1574,10 @@ BOOL SwTable::IsTblComplex() const |* SwTableLine::SwTableLine() |* |*************************************************************************/ -SwTableLine::SwTableLine( SwTableLineFmt *pFmt, USHORT nBoxes, +SwTableLine::SwTableLine( SwTableLineFmt *pFmt, sal_uInt16 nBoxes, SwTableBox *pUp ) : SwClient( pFmt ), - aBoxes( (BYTE)nBoxes, 1 ), + aBoxes( (sal_uInt8)nBoxes, 1 ), pUpper( pUp ) { } @@ -1661,7 +1661,7 @@ void SwTableLine::ChgFrmFmt( SwTableLineFmt *pNewFmt ) if ( bInFirstNonHeadlineRow || bInFollowFlowRow ) pTab = pTab->FindMaster(); - pTab->SetRemoveFollowFlowLinePending( TRUE ); + pTab->SetRemoveFollowFlowLinePending( sal_True ); pTab->InvalidatePos(); } // <-- @@ -1719,9 +1719,9 @@ SwTwips SwTableLine::GetTableLineHeight( bool& bLayoutAvailable ) const |* SwTableBox::SwTableBox() |* |*************************************************************************/ -SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, USHORT nLines, SwTableLine *pUp ) +SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, sal_uInt16 nLines, SwTableLine *pUp ) : SwClient( 0 ), - aLines( (BYTE)nLines, 1 ), + aLines( (sal_uInt8)nLines, 1 ), pSttNd( 0 ), pUpper( pUp ), pImpl( 0 ) @@ -1736,10 +1736,9 @@ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwNodeIndex &rIdx, pUpper( pUp ), pImpl( 0 ) { - SwDoc* pDoc = pFmt->GetDoc(); CheckBoxFmt( pFmt )->Add( this ); - pSttNd = pDoc->GetNodes()[ rIdx ]->GetStartNode(); + pSttNd = rIdx.GetNode().GetStartNode(); // an der Table eintragen const SwTableNode* pTblNd = pSttNd->FindTableNode(); @@ -1796,8 +1795,8 @@ SwTableBoxFmt* SwTableBox::CheckBoxFmt( SwTableBoxFmt* pFmt ) { // sollte das Format eine Formel oder einen Value tragen, dann muss die // Box alleine am Format haengen. Ggfs. muss ein neues angelegt werden. - if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, FALSE ) || - SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMULA, FALSE ) ) + if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, sal_False ) || + SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMULA, sal_False ) ) { SwTableBox* pOther = SwIterator<SwTableBox,SwFmt>::FirstElement( *pFmt ); if( pOther ) @@ -1871,7 +1870,7 @@ void SwTableBox::ChgFrmFmt( SwTableBoxFmt* pNewFmt ) pCell->InvalidateSize(); pCell->_InvalidatePrt(); pCell->SetCompletePaint(); - pCell->SetDerivedVert( FALSE ); + pCell->SetDerivedVert( sal_False ); pCell->CheckDirChange(); // --> FME 2005-04-15 #i47489# @@ -1903,10 +1902,10 @@ void SwTableBox::ChgFrmFmt( SwTableBoxFmt* pNewFmt ) |* und ergibt sich aus der Position in den Lines/Boxen/Tabelle |* |*************************************************************************/ -void lcl_GetTblBoxColStr( USHORT nCol, String& rNm ) +void lcl_GetTblBoxColStr( sal_uInt16 nCol, String& rNm ) { - const USHORT coDiff = 52; // 'A'-'Z' 'a' - 'z' - USHORT nCalc; + const sal_uInt16 coDiff = 52; // 'A'-'Z' 'a' - 'z' + sal_uInt16 nCalc; do { nCalc = nCol % coDiff; @@ -1931,7 +1930,7 @@ String SwTableBox::GetName() const } const SwTable& rTbl = pSttNd->FindTableNode()->GetTable(); - USHORT nPos; + sal_uInt16 nPos; String sNm, sTmp; const SwTableBox* pBox = this; do { @@ -1957,10 +1956,10 @@ String SwTableBox::GetName() const return sNm; } -BOOL SwTableBox::IsInHeadline( const SwTable* pTbl ) const +sal_Bool SwTableBox::IsInHeadline( const SwTable* pTbl ) const { if( !GetUpper() ) // sollte nur beim Merge vorkommen. - return FALSE; + return sal_False; if( !pTbl ) pTbl = &pSttNd->FindTableNode()->GetTable(); @@ -1975,14 +1974,14 @@ BOOL SwTableBox::IsInHeadline( const SwTable* pTbl ) const #ifdef DBG_UTIL -ULONG SwTableBox::GetSttIdx() const +sal_uLong SwTableBox::GetSttIdx() const { return pSttNd ? pSttNd->GetIndex() : 0; } #endif // erfrage vom Client Informationen -BOOL SwTable::GetInfo( SfxPoolItem& rInfo ) const +sal_Bool SwTable::GetInfo( SfxPoolItem& rInfo ) const { switch( rInfo.Which() ) { @@ -1997,7 +1996,7 @@ BOOL SwTable::GetInfo( SfxPoolItem& rInfo ) const ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = GetFrmFmt()->GetDoc()->GetNodes().GoNext( &aIdx ); } - return FALSE; + return sal_False; } break; } @@ -2014,9 +2013,9 @@ BOOL SwTable::GetInfo( SfxPoolItem& rInfo ) const { ((SwPtrMsgPoolItem&)rInfo).pObject = SwIterator<SwFrm,SwFmt>::FirstElement( *GetFrmFmt() ); } - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } SwTable * SwTable::FindTable( SwFrmFmt const*const pFmt ) @@ -2049,13 +2048,13 @@ void SwTable::SetHTMLTableLayout( SwHTMLTableLayout *p ) } void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol, - BOOL bChgAlign ) + sal_Bool bChgAlign ) { - ULONG nNdPos = rBox.IsValidNumTxtNd( TRUE ); + sal_uLong nNdPos = rBox.IsValidNumTxtNd( sal_True ); ChgTextToNum( rBox,rTxt,pCol,bChgAlign,nNdPos); } void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol, - BOOL bChgAlign,ULONG nNdPos ) + sal_Bool bChgAlign,sal_uLong nNdPos ) { if( ULONG_MAX != nNdPos ) @@ -2079,7 +2078,7 @@ void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol, // Farbe umsetzen oder "Benutzer Farbe" sichern if( !pTNd->GetpSwAttrSet() || SFX_ITEM_SET != pTNd->GetpSwAttrSet()-> - GetItemState( RES_CHRATR_COLOR, FALSE, &pItem )) + GetItemState( RES_CHRATR_COLOR, sal_False, &pItem )) pItem = 0; const Color* pOldNumFmtColor = rBox.GetSaveNumFmtColor(); @@ -2136,7 +2135,7 @@ void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol, // zuruecksetzen, damit sie wieder aufgespannt werden { SwIndex aResetIdx( aIdx, n ); - pTNd->DontExpandFmt( aResetIdx, FALSE, FALSE ); + pTNd->DontExpandFmt( aResetIdx, sal_False, sal_False ); } if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) @@ -2160,7 +2159,7 @@ void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol, // vertikale Ausrichtung umsetzen if( bChgAlign && ( SFX_ITEM_SET != rBox.GetFrmFmt()->GetItemState( - RES_VERT_ORIENT, TRUE, &pItem ) || + RES_VERT_ORIENT, sal_True, &pItem ) || text::VertOrientation::TOP == ((SwFmtVertOrient*)pItem)->GetVertOrient() )) { rBox.GetFrmFmt()->SetFmtAttr( SwFmtVertOrient( 0, text::VertOrientation::BOTTOM )); @@ -2168,14 +2167,14 @@ void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol, } } -void ChgNumToText( SwTableBox& rBox, ULONG nFmt ) +void ChgNumToText( SwTableBox& rBox, sal_uLong nFmt ) { - ULONG nNdPos = rBox.IsValidNumTxtNd( FALSE ); + sal_uLong nNdPos = rBox.IsValidNumTxtNd( sal_False ); if( ULONG_MAX != nNdPos ) { SwDoc* pDoc = rBox.GetFrmFmt()->GetDoc(); SwTxtNode* pTNd = pDoc->GetNodes()[ nNdPos ]->GetTxtNode(); - BOOL bChgAlign = pDoc->IsInsTblAlignNum(); + sal_Bool bChgAlign = pDoc->IsInsTblAlignNum(); const SfxPoolItem* pItem; Color* pCol = 0; @@ -2190,7 +2189,7 @@ void ChgNumToText( SwTableBox& rBox, ULONG nFmt ) SwIndex aIdx( pTNd, sTxt.Len() ); //JP 06.04.99: Bug 64321 - DontExpand-Flags vorm Austauschen // zuruecksetzen, damit sie wieder aufgespannt werden - pTNd->DontExpandFmt( aIdx, FALSE, FALSE ); + pTNd->DontExpandFmt( aIdx, sal_False, sal_False ); aIdx = 0; pTNd->EraseText( aIdx, STRING_LEN, IDocumentContentOperations::INS_EMPTYEXPAND ); @@ -2203,7 +2202,7 @@ void ChgNumToText( SwTableBox& rBox, ULONG nFmt ) // Ausrichtung umsetzen if( bChgAlign && pAttrSet && SFX_ITEM_SET == pAttrSet->GetItemState( - RES_PARATR_ADJUST, FALSE, &pItem ) && + RES_PARATR_ADJUST, sal_False, &pItem ) && SVX_ADJUST_RIGHT == ((SvxAdjustItem*)pItem)->GetAdjust() ) { pTNd->SetAttr( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) ); @@ -2211,7 +2210,7 @@ void ChgNumToText( SwTableBox& rBox, ULONG nFmt ) // Farbe umsetzen oder "Benutzer Farbe" sichern if( !pAttrSet || SFX_ITEM_SET != pAttrSet-> - GetItemState( RES_CHRATR_COLOR, FALSE, &pItem )) + GetItemState( RES_CHRATR_COLOR, sal_False, &pItem )) pItem = 0; const Color* pOldNumFmtColor = rBox.GetSaveNumFmtColor(); @@ -2252,7 +2251,7 @@ void ChgNumToText( SwTableBox& rBox, ULONG nFmt ) // vertikale Ausrichtung umsetzen if( bChgAlign && SFX_ITEM_SET == rBox.GetFrmFmt()->GetItemState( - RES_VERT_ORIENT, FALSE, &pItem ) && + RES_VERT_ORIENT, sal_False, &pItem ) && text::VertOrientation::BOTTOM == ((SwFmtVertOrient*)pItem)->GetVertOrient() ) { rBox.GetFrmFmt()->SetFmtAttr( SwFmtVertOrient( 0, text::VertOrientation::TOP )); @@ -2269,7 +2268,7 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) const SwTblBoxFormula *pNewFml = 0; const SwTblBoxValue *pNewVal = 0; double aOldValue = 0; - ULONG nOldFmt = NUMBERFORMAT_TEXT; + sal_uLong nOldFmt = NUMBERFORMAT_TEXT; switch( pNew ? pNew->Which() : 0 ) { @@ -2277,13 +2276,13 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { const SfxItemSet& rSet = *((SwAttrSetChg*)pNew)->GetChgSet(); if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, - FALSE, (const SfxPoolItem**)&pNewFmt ) ) + sal_False, (const SfxPoolItem**)&pNewFmt ) ) nOldFmt = ((SwTblBoxNumFormat&)((SwAttrSetChg*)pOld)-> GetChgSet()->Get( RES_BOXATR_FORMAT )).GetValue(); - rSet.GetItemState( RES_BOXATR_FORMULA, FALSE, + rSet.GetItemState( RES_BOXATR_FORMULA, sal_False, (const SfxPoolItem**)&pNewFml ); if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE, - FALSE, (const SfxPoolItem**)&pNewVal ) ) + sal_False, (const SfxPoolItem**)&pNewVal ) ) aOldValue = ((SwTblBoxValue&)((SwAttrSetChg*)pOld)-> GetChgSet()->Get( RES_BOXATR_VALUE )).GetValue(); } @@ -2308,9 +2307,9 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { GetDoc()->SetFieldsDirty(true, NULL, 0); - if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMAT, FALSE ) || - SFX_ITEM_SET == GetItemState( RES_BOXATR_VALUE, FALSE ) || - SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, FALSE ) ) + if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMAT, sal_False ) || + SFX_ITEM_SET == GetItemState( RES_BOXATR_VALUE, sal_False ) || + SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, sal_False ) ) { // die Box holen SwIterator<SwTableBox,SwFmt> aIter( *this ); @@ -2319,19 +2318,19 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { ASSERT( !aIter.Next(), "keine Box oder mehrere am Format" ); - ULONG nNewFmt; + sal_uLong nNewFmt; if( pNewFmt ) { nNewFmt = pNewFmt->GetValue(); // neu Formatieren // ist es neuer oder wurde der akt. entfernt? - if( SFX_ITEM_SET != GetItemState( RES_BOXATR_VALUE, FALSE )) + if( SFX_ITEM_SET != GetItemState( RES_BOXATR_VALUE, sal_False )) pNewFmt = 0; } else { // das akt. Item besorgen - GetItemState( RES_BOXATR_FORMAT, FALSE, + GetItemState( RES_BOXATR_FORMAT, sal_False, (const SfxPoolItem**)&pNewFmt ); nOldFmt = GetTblBoxNumFmt().GetValue(); nNewFmt = pNewFmt ? pNewFmt->GetValue() : nOldFmt; @@ -2343,7 +2342,7 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if( NUMBERFORMAT_TEXT != nNewFmt ) { if( SFX_ITEM_SET == GetItemState( - RES_BOXATR_VALUE, FALSE )) + RES_BOXATR_VALUE, sal_False )) nOldFmt = NUMBERFORMAT_TEXT; else nNewFmt = NUMBERFORMAT_TEXT; @@ -2365,26 +2364,26 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) // - vertikale Ausrichtung auf OEBN, wenn UNTEN gesetzt ist SvNumberFormatter* pNumFmtr = GetDoc()->GetNumberFormatter(); - BOOL bNewIsTxtFmt = pNumFmtr->IsTextFormat( nNewFmt ) || + sal_Bool bNewIsTxtFmt = pNumFmtr->IsTextFormat( nNewFmt ) || NUMBERFORMAT_TEXT == nNewFmt; if( (!bNewIsTxtFmt && nOldFmt != nNewFmt) || pNewFml ) { - BOOL bChgTxt = TRUE; + sal_Bool bChgTxt = sal_True; double fVal = 0; if( !pNewVal && SFX_ITEM_SET != GetItemState( - RES_BOXATR_VALUE, FALSE, (const SfxPoolItem**)&pNewVal )) + RES_BOXATR_VALUE, sal_False, (const SfxPoolItem**)&pNewVal )) { // es wurde noch nie ein Wert gesetzt, dann versuche // doch mal den Inhalt auszuwerten - ULONG nNdPos = pBox->IsValidNumTxtNd( TRUE ); + sal_uLong nNdPos = pBox->IsValidNumTxtNd( sal_True ); if( ULONG_MAX != nNdPos ) { sal_uInt32 nTmpFmtIdx = nNewFmt; String aTxt( GetDoc()->GetNodes()[ nNdPos ] ->GetTxtNode()->GetRedlineTxt()); if( !aTxt.Len() ) - bChgTxt = FALSE; + bChgTxt = sal_False; else { //JP 15.09.98: Bug 55741 - Tabs beibehalten @@ -2392,7 +2391,7 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) // JP 22.04.98: Bug 49659 - // Sonderbehandlung fuer Prozent - BOOL bIsNumFmt = FALSE; + sal_Bool bIsNumFmt = sal_False; if( NUMBERFORMAT_PERCENT == pNumFmtr->GetType( nNewFmt )) { @@ -2466,11 +2465,11 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) SwFrmFmt::Modify( pOld, pNew ); } -BOOL SwTableBox::HasNumCntnt( double& rNum, sal_uInt32& rFmtIndex, - BOOL& rIsEmptyTxtNd ) const +sal_Bool SwTableBox::HasNumCntnt( double& rNum, sal_uInt32& rFmtIndex, + sal_Bool& rIsEmptyTxtNd ) const { - BOOL bRet = FALSE; - ULONG nNdPos = IsValidNumTxtNd( TRUE ); + sal_Bool bRet = sal_False; + sal_uLong nNdPos = IsValidNumTxtNd( sal_True ); if( ULONG_MAX != nNdPos ) { String aTxt( pSttNd->GetNodes()[ nNdPos ]->GetTxtNode()-> @@ -2482,7 +2481,7 @@ BOOL SwTableBox::HasNumCntnt( double& rNum, sal_uInt32& rFmtIndex, const SfxPoolItem* pItem; if( SFX_ITEM_SET == GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT, - FALSE, &pItem )) + sal_False, &pItem )) { rFmtIndex = ((SwTblBoxNumFormat*)pItem)->GetValue(); // JP 22.04.98: Bug 49659 - Sonderbehandlung fuer Prozent @@ -2499,31 +2498,49 @@ BOOL SwTableBox::HasNumCntnt( double& rNum, sal_uInt32& rFmtIndex, rFmtIndex = 0; bRet = pNumFmtr->IsNumberFormat( aTxt, rFmtIndex, rNum ); +<<<<<<< local +======= + +/* +// wie bekommt man aus dem neuen String den neuen Wert? +// denn der Numberformater erkennt aus "123.--DM" kein Zahlenformat! + if( !bRet && rFmtIndex && !pNumFmtr->IsTextFormat( rFmtIndex ) && + SFX_ITEM_SET == GetFrmFmt()->GetItemState( RES_BOXATR_VALUE, + sal_False, &pItem )) + { + Color* pCol; + String sNewTxt; + pNumFmtr->GetOutputString( ((SwTblBoxValue*)pItem)->GetValue(), + rFmtIndex, sNewTxt, &pCol ); + bRet = aTxt == sNewTxt; + } +*/ +>>>>>>> other } else - rIsEmptyTxtNd = FALSE; + rIsEmptyTxtNd = sal_False; return bRet; } -BOOL SwTableBox::IsNumberChanged() const +sal_Bool SwTableBox::IsNumberChanged() const { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; - if( SFX_ITEM_SET == GetFrmFmt()->GetItemState( RES_BOXATR_FORMULA, FALSE )) + if( SFX_ITEM_SET == GetFrmFmt()->GetItemState( RES_BOXATR_FORMULA, sal_False )) { const SwTblBoxNumFormat *pNumFmt; const SwTblBoxValue *pValue; - if( SFX_ITEM_SET != GetFrmFmt()->GetItemState( RES_BOXATR_VALUE, FALSE, + if( SFX_ITEM_SET != GetFrmFmt()->GetItemState( RES_BOXATR_VALUE, sal_False, (const SfxPoolItem**)&pValue )) pValue = 0; - if( SFX_ITEM_SET != GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT, FALSE, + if( SFX_ITEM_SET != GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT, sal_False, (const SfxPoolItem**)&pNumFmt )) pNumFmt = 0; - ULONG nNdPos; + sal_uLong nNdPos; if( pNumFmt && pValue && - ULONG_MAX != ( nNdPos = IsValidNumTxtNd( TRUE ) ) ) + ULONG_MAX != ( nNdPos = IsValidNumTxtNd( sal_True ) ) ) { String sNewTxt, sOldTxt( pSttNd->GetNodes()[ nNdPos ]-> GetTxtNode()->GetRedlineTxt() ); @@ -2542,14 +2559,14 @@ BOOL SwTableBox::IsNumberChanged() const return bRet; } -ULONG SwTableBox::IsValidNumTxtNd( BOOL bCheckAttr ) const +sal_uLong SwTableBox::IsValidNumTxtNd( sal_Bool bCheckAttr ) const { - ULONG nPos = ULONG_MAX; + sal_uLong nPos = ULONG_MAX; if( pSttNd ) { SwNodeIndex aIdx( *pSttNd ); - ULONG nIndex = aIdx.GetIndex(); - const ULONG nIndexEnd = pSttNd->GetNodes()[ nIndex ]->EndOfSectionIndex(); + sal_uLong nIndex = aIdx.GetIndex(); + const sal_uLong nIndexEnd = pSttNd->GetNodes()[ nIndex ]->EndOfSectionIndex(); const SwTxtNode *pTextNode = 0; while( ++nIndex < nIndexEnd ) { @@ -2583,7 +2600,7 @@ ULONG SwTableBox::IsValidNumTxtNd( BOOL bCheckAttr ) const // Flys/Felder/.. if( pHts ) { - for( USHORT n = 0; n < pHts->Count(); ++n ) + for( sal_uInt16 n = 0; n < pHts->Count(); ++n ) { const SwTxtAttr* pAttr = (*pHts)[ n ]; if( RES_TXTATR_NOEND_BEGIN <= pAttr->Which() || @@ -2612,14 +2629,14 @@ ULONG SwTableBox::IsValidNumTxtNd( BOOL bCheckAttr ) const } // ist das eine FormelBox oder eine Box mit numerischen Inhalt (AutoSum) -USHORT SwTableBox::IsFormulaOrValueBox() const +sal_uInt16 SwTableBox::IsFormulaOrValueBox() const { - USHORT nWhich = 0; + sal_uInt16 nWhich = 0; const SwTxtNode* pTNd; SwFrmFmt* pFmt = GetFrmFmt(); - if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMULA, FALSE )) + if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMULA, sal_False )) nWhich = RES_BOXATR_FORMULA; - else if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, FALSE ) && + else if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, sal_False ) && !pFmt->GetDoc()->GetNumberFormatter()->IsTextFormat( pFmt->GetTblBoxNumFmt().GetValue() )) nWhich = RES_BOXATR_VALUE; @@ -2635,15 +2652,15 @@ void SwTableBox::ActualiseValueBox() { const SfxPoolItem *pFmtItem, *pValItem; SwFrmFmt* pFmt = GetFrmFmt(); - if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMAT, TRUE, &pFmtItem ) - && SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, TRUE, &pValItem )) + if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMAT, sal_True, &pFmtItem ) + && SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, sal_True, &pValItem )) { - const ULONG nFmtId = ((SwTblBoxNumFormat*)pFmtItem)->GetValue(); - ULONG nNdPos = ULONG_MAX; + const sal_uLong nFmtId = ((SwTblBoxNumFormat*)pFmtItem)->GetValue(); + sal_uLong nNdPos = ULONG_MAX; SvNumberFormatter* pNumFmtr = pFmt->GetDoc()->GetNumberFormatter(); if( !pNumFmtr->IsTextFormat( nFmtId ) && - ULONG_MAX != (nNdPos = IsValidNumTxtNd( TRUE )) ) + ULONG_MAX != (nNdPos = IsValidNumTxtNd( sal_True )) ) { double fVal = ((SwTblBoxValue*)pValItem)->GetValue(); Color* pCol = 0; @@ -2652,7 +2669,7 @@ void SwTableBox::ActualiseValueBox() const String& rTxt = pSttNd->GetNodes()[ nNdPos ]->GetTxtNode()->GetTxt(); if( rTxt != sNewTxt ) - ChgTextToNum( *this, sNewTxt, pCol, FALSE ,nNdPos); + ChgTextToNum( *this, sNewTxt, pCol, sal_False ,nNdPos); } } } |