diff options
Diffstat (limited to 'sw/source/core/layout/flycnt.cxx')
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 114 |
1 files changed, 60 insertions, 54 deletions
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 4a7b816acd73..e6f73c81c381 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -27,12 +27,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <tools/bigint.hxx> #include "pagefrm.hxx" #include "cntfrm.hxx" #include "flyfrm.hxx" #include "txtfrm.hxx" -#include "doc.hxx" +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include "viewsh.hxx" #include "viewimp.hxx" #include "pam.hxx" @@ -85,7 +87,7 @@ using namespace ::com::sun::star; SwFlyAtCntFrm::SwFlyAtCntFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : SwFlyFreeFrm( pFmt, pSib, pAnch ) { - bAtCnt = TRUE; + bAtCnt = sal_True; bAutoPosition = (FLY_AT_CHAR == pFmt->GetAnchor().GetAnchorId()); } @@ -103,11 +105,11 @@ TYPEINIT1(SwFlyAtCntFrm,SwFlyFreeFrm); void SwFlyAtCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { - USHORT nWhich = pNew ? pNew->Which() : 0; + sal_uInt16 nWhich = pNew ? pNew->Which() : 0; const SwFmtAnchor *pAnch = 0; if( RES_ATTRSET_CHG == nWhich && SFX_ITEM_SET == - ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_ANCHOR, FALSE, + ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_ANCHOR, sal_False, (const SfxPoolItem**)&pAnch )) ; // Beim GetItemState wird der AnkerPointer gesetzt ! @@ -131,7 +133,7 @@ void SwFlyAtCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) SwCntntFrm *pCntnt = (SwCntntFrm*)GetAnchorFrm(); AnchorFrm()->RemoveFly( this ); - const BOOL bBodyFtn = (pCntnt->IsInDocBody() || pCntnt->IsInFtn()); + const sal_Bool bBodyFtn = (pCntnt->IsInDocBody() || pCntnt->IsInFtn()); //Den neuen Anker anhand des NodeIdx suchen, am alten und //neuen NodeIdx kann auch erkannt werden, in welche Richtung @@ -193,7 +195,11 @@ void SwFlyAtCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) if ( !pCntnt ) { SwCntntNode *pNode = aNewIdx.GetNode().GetCntntNode(); +<<<<<<< local pCntnt = pNode->getLayoutFrm( getRootFrm(), &pOldAnchor->Frm().Pos(), 0, FALSE ); +======= + pCntnt = pNode->GetFrm( &pOldAnchor->Frm().Pos(), 0, sal_False ); +>>>>>>> other ASSERT( pCntnt, "Neuen Anker nicht gefunden" ); } //Flys haengen niemals an einem Follow sondern immer am @@ -268,7 +274,7 @@ public: SwOszControl( const SwFlyFrm *pFrm ); ~SwOszControl(); bool ChkOsz(); - static BOOL IsInProgress( const SwFlyFrm *pFly ); + static sal_Bool IsInProgress( const SwFlyFrm *pFly ); }; const SwFlyFrm *SwOszControl::pStk1 = 0; const SwFlyFrm *SwOszControl::pStk2 = 0; @@ -317,19 +323,19 @@ SwOszControl::~SwOszControl() // <-- } -BOOL SwOszControl::IsInProgress( const SwFlyFrm *pFly ) +sal_Bool SwOszControl::IsInProgress( const SwFlyFrm *pFly ) { if ( SwOszControl::pStk1 && !pFly->IsLowerOf( SwOszControl::pStk1 ) ) - return TRUE; + return sal_True; if ( SwOszControl::pStk2 && !pFly->IsLowerOf( SwOszControl::pStk2 ) ) - return TRUE; + return sal_True; if ( SwOszControl::pStk3 && !pFly->IsLowerOf( SwOszControl::pStk3 ) ) - return TRUE; + return sal_True; if ( SwOszControl::pStk4 && !pFly->IsLowerOf( SwOszControl::pStk4 ) ) - return TRUE; + return sal_True; if ( SwOszControl::pStk5 && !pFly->IsLowerOf( SwOszControl::pStk5 ) ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } bool SwOszControl::ChkOsz() @@ -386,7 +392,7 @@ void SwFlyAtCntFrm::MakeAll() // --> OD 2004-06-30 #i28701# - use new method <GetPageFrm()> if( GetPageFrm() ) { - bSetCompletePaintOnInvalidate = TRUE; + bSetCompletePaintOnInvalidate = sal_True; { SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt(); const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize(); @@ -420,7 +426,7 @@ void SwFlyAtCntFrm::MakeAll() if( pFooter && !pFooter->IsFooterFrm() ) pFooter = NULL; bool bOsz = false; - BOOL bExtra = Lower() && Lower()->IsColumnFrm(); + sal_Bool bExtra = Lower() && Lower()->IsColumnFrm(); // --> OD 2004-08-25 #i3317# - boolean, to apply temporarly the // 'straightforward positioning process' for the frame due to its // overlapping with a previous column. @@ -547,7 +553,7 @@ void SwFlyAtCntFrm::MakeAll() // Spalten hinterlaesst, so drehen wir lieber hier eine weitere // Runde und formatieren unseren Inhalt via FormatWidthCols nochmal. _InvalidateSize(); - bExtra = FALSE; // Sicherhaltshalber gibt es nur eine Ehrenrunde. + bExtra = sal_False; // Sicherhaltshalber gibt es nur eine Ehrenrunde. } } while ( !IsValid() && !bOsz && // --> OD 2004-08-25 #i3317# @@ -594,7 +600,7 @@ void SwFlyAtCntFrm::MakeAll() // <-- } // <-- - bSetCompletePaintOnInvalidate = FALSE; + bSetCompletePaintOnInvalidate = sal_False; } } } @@ -631,10 +637,10 @@ public: SwDistance() { nMain = nSub = 0; } SwDistance& operator=( const SwDistance &rTwo ) { nMain = rTwo.nMain; nSub = rTwo.nSub; return *this; } - BOOL operator<( const SwDistance& rTwo ) + sal_Bool operator<( const SwDistance& rTwo ) { return nMain < rTwo.nMain || ( nMain == rTwo.nMain && nSub && rTwo.nSub && nSub < rTwo.nSub ); } - BOOL operator<=( const SwDistance& rTwo ) + sal_Bool operator<=( const SwDistance& rTwo ) { return nMain < rTwo.nMain || ( nMain == rTwo.nMain && ( !nSub || !rTwo.nSub || nSub <= rTwo.nSub ) ); } }; @@ -690,7 +696,7 @@ const SwFrm * MA_FASTCALL lcl_CalcDownDist( SwDistance &rRet, { // OD 26.09.2003 - <rPt> point is left of environment of given content frame // OD: seems not to be correct for vertical layout!? - const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, FALSE, pCnt ); + const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, sal_False, pCnt ); if( !pLay || (bVert && (pLay->Frm().Top() + pLay->Prt().Bottom()) <rPt.Y())|| (!bVert && (pLay->Frm().Left() + pLay->Prt().Right())<rPt.X()) ) @@ -716,10 +722,10 @@ const SwFrm * MA_FASTCALL lcl_CalcDownDist( SwDistance &rRet, // <-- const SwFrm *pPre = pCnt; - const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, TRUE, pCnt ); + const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, sal_True, pCnt ); SwTwips nFrmTop = 0; SwTwips nPrtHeight = 0; - BOOL bSct = FALSE; + sal_Bool bSct = sal_False; const SwSectionFrm *pSect = pUp->FindSctFrm(); if( pSect ) { @@ -728,7 +734,7 @@ const SwFrm * MA_FASTCALL lcl_CalcDownDist( SwDistance &rRet, } if( pSect && !pSect->IsAnLower( pLay ) ) { - bSct = FALSE; + bSct = sal_False; const SwSectionFrm* pNxtSect = pLay ? pLay->FindSctFrm() : 0; if( pSect->IsAnFollow( pNxtSect ) ) { @@ -800,13 +806,13 @@ const SwFrm * MA_FASTCALL lcl_CalcDownDist( SwDistance &rRet, else rRet.nMain += nPrtHeight; pPre = pLay; - pLay = pLay->GetLeaf( MAKEPAGE_NONE, TRUE, pCnt ); + pLay = pLay->GetLeaf( MAKEPAGE_NONE, sal_True, pCnt ); if( pSect && !pSect->IsAnLower( pLay ) ) { // If we're leaving a SwSectionFrm, the next Leaf-Frm // is the part of the upper below the SectionFrm. const SwSectionFrm* pNxtSect = pLay ? pLay->FindSctFrm() : NULL; - bSct = FALSE; + bSct = sal_False; if( pSect->IsAnFollow( pNxtSect ) ) { pSect = pNxtSect; @@ -883,9 +889,9 @@ const SwFrm * MA_FASTCALL lcl_CalcDownDist( SwDistance &rRet, return 0; } -ULONG MA_FASTCALL lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, +sal_uLong MA_FASTCALL lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, const SwCntntFrm *& rpCnt, - const BOOL bBody, const BOOL bFtn ) + const sal_Bool bBody, const sal_Bool bFtn ) { //Sucht unterhalb von pLay den dichtesten Cnt zum Point. Der Bezugspunkt //der Cntnts ist immer die linke obere Ecke. @@ -896,8 +902,8 @@ ULONG MA_FASTCALL lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, #endif rpCnt = 0; - ULONG nDistance = ULONG_MAX; - ULONG nNearest = ULONG_MAX; + sal_uLong nDistance = ULONG_MAX; + sal_uLong nNearest = ULONG_MAX; const SwCntntFrm *pCnt = pLay->ContainsCntnt(); while ( pCnt && (bBody != pCnt->IsInDocBody() || bFtn != pCnt->IsInFtn())) @@ -919,7 +925,7 @@ ULONG MA_FASTCALL lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, Min( pCnt->Frm().Top(), rPt.Y() ); BigInt dX1( dX ), dY1( dY ); dX1 *= dX1; dY1 *= dY1; - const ULONG nDiff = ::SqRt( dX1 + dY1 ); + const sal_uLong nDiff = ::SqRt( dX1 + dY1 ); if ( pCnt->Frm().Top() <= rPt.Y() ) { if ( nDiff < nDistance ) @@ -948,7 +954,7 @@ ULONG MA_FASTCALL lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, } const SwCntntFrm * MA_FASTCALL lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt, - const BOOL bBody, const BOOL bFtn ) + const sal_Bool bBody, const sal_Bool bFtn ) { //Sucht ausgehen von pCnt denjenigen CntntFrm, dessen linke obere //Ecke am dichtesten am Point liegt. @@ -962,7 +968,7 @@ const SwCntntFrm * MA_FASTCALL lcl_FindCnt( const Point &rPt, const SwCntntFrm * //des Point sitzt. const SwCntntFrm *pRet, *pNew; const SwLayoutFrm *pLay = pCnt->FindPageFrm(); - ULONG nDist; + sal_uLong nDist; nDist = ::lcl_FindCntDiff( rPt, pLay, pNew, bBody, bFtn ); if ( pNew ) @@ -972,16 +978,16 @@ const SwCntntFrm * MA_FASTCALL lcl_FindCnt( const Point &rPt, const SwCntntFrm * nDist = ULONG_MAX; } const SwCntntFrm *pNearest = pRet; - ULONG nNearest = nDist; + sal_uLong nNearest = nDist; if ( pLay ) { const SwLayoutFrm *pPge = pLay; - ULONG nOldNew = ULONG_MAX; - for ( USHORT i = 0; pPge->GetPrev() && (i < 3); ++i ) + sal_uLong nOldNew = ULONG_MAX; + for ( sal_uInt16 i = 0; pPge->GetPrev() && (i < 3); ++i ) { pPge = (SwLayoutFrm*)pPge->GetPrev(); - const ULONG nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); + const sal_uLong nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); if ( nNew < nDist ) { if ( pNew->Frm().Top() <= rPt.Y() ) @@ -1003,10 +1009,10 @@ const SwCntntFrm * MA_FASTCALL lcl_FindCnt( const Point &rPt, const SwCntntFrm * } pPge = pLay; nOldNew = ULONG_MAX; - for ( USHORT j = 0; pPge->GetNext() && (j < 3); ++j ) + for ( sal_uInt16 j = 0; pPge->GetNext() && (j < 3); ++j ) { pPge = (SwLayoutFrm*)pPge->GetNext(); - const ULONG nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); + const sal_uLong nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); if ( nNew < nDist ) { if ( pNew->Frm().Top() <= rPt.Y() ) @@ -1048,7 +1054,7 @@ void lcl_PointToPrt( Point &rPoint, const SwFrm *pFrm ) } const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew, - const BOOL bBodyOnly ) + const sal_Bool bBodyOnly ) { //Zu der angegebenen DokumentPosition wird der dichteste Cnt im //Textfluss gesucht. AusgangsFrm ist der uebergebene Anker. @@ -1066,14 +1072,14 @@ const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew, SwRect aTmpRect( aTmp, Size(0,0) ); pTmpLay = (SwLayoutFrm*)::FindPage( aTmpRect, pTmpLay->Lower() ); } - pCnt = pTmpLay->GetCntntPos( aTmp, FALSE, bBodyOnly ); + pCnt = pTmpLay->GetCntntPos( aTmp, sal_False, bBodyOnly ); } //Beim Suchen darauf achten, dass die Bereiche sinnvoll erhalten //bleiben. D.h. in diesem Fall nicht in Header/Footer hinein und //nicht aus Header/Footer hinaus. - const BOOL bBody = pCnt->IsInDocBody() || bBodyOnly; - const BOOL bFtn = !bBodyOnly && pCnt->IsInFtn(); + const sal_Bool bBody = pCnt->IsInDocBody() || bBodyOnly; + const sal_Bool bFtn = !bBodyOnly && pCnt->IsInFtn(); Point aNew( rNew ); if ( bBody ) @@ -1095,7 +1101,7 @@ const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew, //So gibt es kein Problem mit Spalten. Point aTmp( aNew ); const SwCntntFrm *pTmp = pCnt->FindPageFrm()-> - GetCntntPos( aTmp, FALSE, TRUE, FALSE ); + GetCntntPos( aTmp, sal_False, sal_True, sal_False ); if ( pTmp && pTmp->Frm().IsInside( aNew ) ) return pTmp; } @@ -1109,7 +1115,7 @@ const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew, SwDistance nUp, nUpLst; ::lcl_CalcDownDist( nUp, aNew, pUpFrm ); SwDistance nDown = nUp; - BOOL bNegAllowed = TRUE;//Einmal aus dem negativen Bereich heraus lassen. + sal_Bool bNegAllowed = sal_True;//Einmal aus dem negativen Bereich heraus lassen. do { pUpLst = pUpFrm; nUpLst = nUp; @@ -1137,7 +1143,7 @@ const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew, nUp.nMain = LONG_MAX; if ( nUp.nMain >= 0 && LONG_MAX != nUp.nMain ) { - bNegAllowed = FALSE; + bNegAllowed = sal_False; if ( nUpLst.nMain < 0 ) //nicht den falschen erwischen, wenn der Wert //gerade von negativ auf positiv gekippt ist. { pUpLst = pUpFrm; @@ -1335,7 +1341,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt(); const SwFmtSurround& rSurround = pFmt->GetSurround(); - const BOOL bWrapThrough = + const sal_Bool bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT; SwTwips nBaseOfstForFly = 0; const SwFrm* pTmpFrm = pFrm ? pFrm : pCnt; @@ -1369,7 +1375,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) nX = rNew.X() - pFrm->Frm().Left() - nBaseOfstForFly; } } - GetFmt()->GetDoc()->StartUndo( UNDO_START, NULL ); + GetFmt()->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); if( pCnt != GetAnchorFrm() || ( IsAutoPos() && pCnt->IsTxtFrm() && GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE)) ) @@ -1420,11 +1426,11 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) const Point aRelPos = bVert ? Point( -nY, nX ) : Point( nX, nY ); ChgRelPos( aRelPos ); - GetFmt()->GetDoc()->EndUndo( UNDO_END, NULL ); + GetFmt()->GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); if ( pOldPage != FindPageFrm() ) ::Notify_Background( GetVirtDrawObj(), pOldPage, aOld, PREP_FLY_LEAVE, - FALSE ); + sal_False ); } // OD 2004-08-12 #i32795# - Note: method no longer used in <flyincnt.cxx> @@ -1437,9 +1443,9 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) // if( pFlow && pFlow->IsAnyJoinLocked() ) // return; -// USHORT nCnt = 0; +// sal_uInt16 nCnt = 0; -// BOOL bContinue = FALSE; +// sal_Bool bContinue = sal_False; // do // { // if ( ++nCnt == 10 ) @@ -1448,7 +1454,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) // break; // } -// const BOOL bSetComplete = !pFrm->IsValid(); +// const sal_Bool bSetComplete = !pFrm->IsValid(); // const SwRect aOldFrm( pFrm->Frm() ); // const SwRect aOldPrt( pFrm->Prt() ); @@ -1479,7 +1485,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) // (((SwFlyFrm*)pUp)->IsFlyAtCntFrm() && // SwOszControl::IsInProgress( (const SwFlyFrm*)pUp )) ) // { -// bContinue = FALSE; +// bContinue = sal_False; // } // } // } while ( bContinue ); @@ -1521,7 +1527,7 @@ void SwFlyAtCntFrm::MakeObjPos() } // OD 2004-03-24 #i26791# - validate position flag here. - bValidPos = TRUE; + bValidPos = sal_True; // --> OD 2004-10-22 #i35911# - no calculation of new position, if // anchored object is marked that it clears its environment and its |