diff options
Diffstat (limited to 'sw/source/core/layout/anchoredobject.cxx')
-rw-r--r-- | sw/source/core/layout/anchoredobject.cxx | 144 |
1 files changed, 71 insertions, 73 deletions
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index d6443027e3ad..d33b6e009753 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,7 @@ #include <frmfmt.hxx> #include <fmtanchr.hxx> #include <fmtornt.hxx> -// --> OD 2004-06-29 #i28701# +// --> #i28701# #include <doc.hxx> #include <fmtsrnd.hxx> #include <svx/svdobj.hxx> @@ -45,10 +46,10 @@ #include <pagefrm.hxx> // <-- #include <frmatr.hxx> -// --> OD 2004-08-25 #i3317# +// --> #i3317# #include <colfrm.hxx> // <-- -// --> OD 2004-10-22 #i35911# +// --> #i35911# #include <layouter.hxx> @@ -57,28 +58,28 @@ using namespace ::com::sun::star; // <-- // ============================================================================ -// --> OD 2004-06-30 #i28701# - +// --> #i28701# - // implementation of helper class <SwObjPositioningInProgress> // ============================================================================ SwObjPositioningInProgress::SwObjPositioningInProgress( SdrObject& _rSdrObj ) : mpAnchoredObj( 0L ), - // --> OD 2005-08-09 #i52904# + // --> #i52904# mbOldObjPositioningInProgress( false ) // <-- { mpAnchoredObj = ::GetUserCall( &_rSdrObj )->GetAnchoredObj( &_rSdrObj ); - // --> OD 2005-08-09 #i52904# + // --> #i52904# mbOldObjPositioningInProgress = mpAnchoredObj->IsPositioningInProgress(); // <-- mpAnchoredObj->SetPositioningInProgress( true ); } SwObjPositioningInProgress::SwObjPositioningInProgress( SwAnchoredObject& _rAnchoredObj ) : mpAnchoredObj( &_rAnchoredObj ), - // --> OD 2005-08-09 #i52904# + // --> #i52904# mbOldObjPositioningInProgress( false ) // <-- { - // --> OD 2005-08-09 #i52904# + // --> #i52904# mbOldObjPositioningInProgress = mpAnchoredObj->IsPositioningInProgress(); // <-- mpAnchoredObj->SetPositioningInProgress( true ); @@ -88,7 +89,7 @@ SwObjPositioningInProgress::~SwObjPositioningInProgress() { if ( mpAnchoredObj ) { - // --> OD 2005-08-09 #i52904# + // --> #i52904# mpAnchoredObj->SetPositioningInProgress( mbOldObjPositioningInProgress ); // <-- } @@ -101,29 +102,29 @@ TYPEINIT0(SwAnchoredObject); SwAnchoredObject::SwAnchoredObject() : mpDrawObj( 0L ), mpAnchorFrm( 0L ), - // --> OD 2004-06-30 #i28701# + // --> #i28701# mpPageFrm( 0L ), // <-- maRelPos(), maLastCharRect(), mnLastTopOfLine( 0L ), mpVertPosOrientFrm( 0L ), - // --> OD 2004-06-29 #i28701# + // --> #i28701# mbPositioningInProgress( false ), mbConsiderForTextWrap( false ), mbPositionLocked( false ), - // --> OD 2005-01-10 #i40147# + // --> #i40147# mbKeepPositionLockedForSection( false ), // <-- mbRestartLayoutProcess( false ), // <-- - // --> OD 2004-10-22 #i35911# + // --> #i35911# mbClearedEnvironment( false ), // <-- - // --> OD 2004-08-25 #i3317# + // --> #i3317# mbTmpConsiderWrapInfluence( false ), // <-- - // --> OD 2006-08-10 #i68520# + // --> #i68520# maObjRectWithSpaces(), mbObjRectWithSpacesValid( false ), maLastObjRect() @@ -178,7 +179,7 @@ void SwAnchoredObject::ChgAnchorFrm( SwFrm* _pNewAnchorFrm ) /** determine anchor frame containing the anchor position - OD 2004-10-08 #i26945# + #i26945# the anchor frame, which is determined, is <mpAnchorFrm> for an at-page, at-frame or at-paragraph anchored object and the anchor character frame for an at-character and as-character @@ -198,7 +199,7 @@ SwFrm* SwAnchoredObject::GetAnchorFrmContainingAnchPos() } // ============================================================================= -// OD 2004-06-30 #i28701# accessors for member <mpPageFrm> +// #i28701# accessors for member <mpPageFrm> // ============================================================================= SwPageFrm* SwAnchoredObject::GetPageFrm() { @@ -212,7 +213,6 @@ const SwPageFrm* SwAnchoredObject::GetPageFrm() const void SwAnchoredObject::SetPageFrm( SwPageFrm* _pNewPageFrm ) { - // --> OD 2006-01-02 #125977# if ( mpPageFrm != _pNewPageFrm ) { // clear member, which denotes the layout frame at which the vertical @@ -227,7 +227,6 @@ void SwAnchoredObject::SetPageFrm( SwPageFrm* _pNewPageFrm ) // assign new page frame mpPageFrm = _pNewPageFrm; } - // <-- } // ============================================================================= @@ -278,7 +277,7 @@ SwTwips SwAnchoredObject::GetLastTopOfLine() const return mnLastTopOfLine; } -// OD 2004-05-18 #i28701# - follow-up of #i22341# +// #i28701# - follow-up of #i22341# void SwAnchoredObject::AddLastTopOfLineY( SwTwips _nDiff ) { mnLastTopOfLine += _nDiff; @@ -286,12 +285,12 @@ void SwAnchoredObject::AddLastTopOfLineY( SwTwips _nDiff ) /** check anchor character rectangle and top of line - OD 2004-03-24 #i26791 + #i26791 For to-character anchored Writer fly frames the members <maLastCharRect> and <maLastTopOfLine> are updated. These are checked for change and depending on the applied positioning, it's decided, if the Writer fly frame has to be invalidated. - OD 2004-07-15 #117380# + add parameter <_bCheckForParaPorInf>, default value <true> @author OD @@ -306,13 +305,13 @@ void SwAnchoredObject::CheckCharRectAndTopOfLine( if ( (rAnch.GetAnchorId() == FLY_AT_CHAR) && rAnch.GetCntntAnchor() ) { - // --> OD 2004-07-14 #117380# - if requested, assure that anchor frame, + // --> if requested, assure that anchor frame, // which contains the anchor character, has a paragraph portion information. // The paragraph portion information is needed to determine the // anchor character rectangle respectively the top of the line. // Thus, a format of this frame is avoided to determine the // paragraph portion information. - // --> OD 2004-10-04 #i26945# - use new method <FindAnchorCharFrm()> + // --> #i26945# - use new method <FindAnchorCharFrm()> const SwTxtFrm& aAnchorCharFrm = *(FindAnchorCharFrm()); // <-- if ( !_bCheckForParaPorInf || aAnchorCharFrm.HasPara() ) @@ -327,12 +326,12 @@ void SwAnchoredObject::CheckCharRectAndTopOfLine( /** check anchor character rectangle - OD 11.11.2003 #i22341# + #i22341# helper method for method <CheckCharRectAndTopOfLine()> For to-character anchored Writer fly frames the member <maLastCharRect> is updated. This is checked for change and depending on the applied positioning, it's decided, if the Writer fly frame has to be invalidated. - OD 2004-07-14 #117380# + improvement - add second parameter <_rAnchorCharFrm> @author OD @@ -357,7 +356,7 @@ void SwAnchoredObject::_CheckCharRect( const SwFmtAnchor& _rAnch, SwFmtHoriOrient aHori( GetFrmFmt().GetHoriOrient() ); // check for anchor character rectangle changes for certain // positionings and alignments - // OD 07.10.2003 #110978# - add condition to invalidate position, + // add condition to invalidate position, // if vertical aligned at frame/page area and vertical position // of anchor character has changed. const sal_Int16 eVertRelOrient = aVert.GetRelationOrient(); @@ -376,7 +375,7 @@ void SwAnchoredObject::_CheckCharRect( const SwFmtAnchor& _rAnch, ( (aCharRect.*fnRect->fnGetTop)() != (maLastCharRect.*fnRect->fnGetTop)() ) ) ) { - // --> OD 2004-10-08 #i26945#, #i35911# - unlock position of + // --> #i26945#, #i35911# - unlock position of // anchored object, if it isn't registered at the page, // where its anchor character frame is on. if ( GetPageFrm() != _rAnchorCharFrm.FindPageFrm() ) @@ -394,12 +393,12 @@ void SwAnchoredObject::_CheckCharRect( const SwFmtAnchor& _rAnch, /** check top of line - OD 11.11.2003 #i22341# + #i22341# helper method for method <CheckCharRectAndTopOfLine()> For to-character anchored Writer fly frames the member <mnLastTopOfLine> is updated. This is checked for change and depending on the applied positioning, it's decided, if the Writer fly frame has to be invalidated. - OD 2004-07-14 #117380# + improvement - add second parameter <_rAnchorCharFrm> @author OD @@ -415,7 +414,7 @@ void SwAnchoredObject::_CheckTopOfLine( const SwFmtAnchor& _rAnch, // check alignment for invalidation of position if ( GetFrmFmt().GetVertOrient().GetRelationOrient() == text::RelOrientation::TEXT_LINE ) { - // --> OD 2004-10-08 #i26945#, #i35911# - unlock position of + // --> #i26945#, #i35911# - unlock position of // anchored object, if it isn't registered at the page, // where its anchor character frame is on. if ( GetPageFrm() != _rAnchorCharFrm.FindPageFrm() ) @@ -456,7 +455,7 @@ void SwAnchoredObject::ObjectAttachedToAnchorFrame() /** method update layout direction the layout direction, the anchored object is in - OD 2004-07-27 #i31698# + #i31698# method has typically to be called, if the anchored object gets its anchor frame assigned. @@ -486,7 +485,7 @@ void SwAnchoredObject::UpdateLayoutDir() objects, for whose the wrapping style influence has to be considered on the object positioning. - OD 2004-06-30 #i28701# + #i28701# @author OD */ @@ -512,7 +511,7 @@ void SwAnchoredObject::InvalidateObjPosForConsiderWrapInfluence( /** method to determine, if wrapping style influence of the anchored object has to be considered on the object positioning - OD 2004-06-30 #i28701# + #i28701# Note: result of this method also decides, if the booleans for the layout process are of relevance. @@ -524,8 +523,8 @@ bool SwAnchoredObject::ConsiderObjWrapInfluenceOnObjPos() const const SwFrmFmt& rObjFmt = GetFrmFmt(); - // --> OD 2004-08-25 #i3317# - add condition <IsTmpConsiderWrapInfluence()> - // --> OD 2005-09-29 #i55204# + // --> #i3317# - add condition <IsTmpConsiderWrapInfluence()> + // --> #i55204# // - correction: wrapping style influence has been considered, if condition // <IsTmpConsiderWrapInfluence()> is hold, regardless of its anchor type // or its wrapping style. @@ -541,7 +540,7 @@ bool SwAnchoredObject::ConsiderObjWrapInfluenceOnObjPos() const (rAnchor.GetAnchorId() == FLY_AT_PARA)) && rObjFmt.GetSurround().GetSurround() != SURROUND_THROUGHT ) { - // --> OD 2004-09-23 #i34520# - text also wraps around anchored + // --> #i34520# - text also wraps around anchored // objects in the layer Hell - see the text formatting. // Thus, it hasn't to be checked here. bRet = true; @@ -555,7 +554,7 @@ bool SwAnchoredObject::ConsiderObjWrapInfluenceOnObjPos() const /** method to determine, if other anchored objects, also attached at to the anchor frame, have to consider its wrap influence. - // --> OD 2005-02-22 #i43255# + // --> #i43255# @author OD */ @@ -583,7 +582,7 @@ bool SwAnchoredObject::ConsiderObjWrapInfluenceOfOtherObjs() const } // ============================================================================= -// --> OD 2004-06-29 #i28701# - accessors to booleans for layout process +// --> #i28701# - accessors to booleans for layout process // ============================================================================= bool SwAnchoredObject::ConsiderForTextWrap() const { @@ -619,7 +618,7 @@ void SwAnchoredObject::SetRestartLayoutProcess( const bool _bRestartLayoutProces mbRestartLayoutProcess = _bRestartLayoutProcess; } -// --> OD 2004-10-22 #i35911# +// --> #i35911# bool SwAnchoredObject::ClearedEnvironment() const { if ( ConsiderObjWrapInfluenceOnObjPos() ) @@ -636,7 +635,7 @@ void SwAnchoredObject::SetClearedEnvironment( const bool _bClearedEnvironment ) /** method to determine, if due to anchored object size and wrapping style, its layout environment is cleared. - OD 2004-10-22 #i35911# + #i35911# @author OD */ @@ -644,8 +643,8 @@ bool SwAnchoredObject::HasClearedEnvironment() const { bool bHasClearedEnvironment( false ); - // --> OD 2005-03-03 #i43913# - layout frame, vertical position is orient at, has to be set. - ASSERT( GetVertPosOrientFrm(), + // --> #i43913# - layout frame, vertical position is orient at, has to be set. + OSL_ENSURE( GetVertPosOrientFrm(), "<SwAnchoredObject::HasClearedEnvironment()> - layout frame missing, at which the vertical position is oriented at." ); if ( GetVertPosOrientFrm() && GetAnchorFrm()->IsTxtFrm() && @@ -680,8 +679,8 @@ bool SwAnchoredObject::HasClearedEnvironment() const /** method to add spacing to object area - OD 2004-06-30 #i28701# - OD 2006-08-10 #i68520# - return constant reference and use cache + #i28701# + #i68520# - return constant reference and use cache @author OD */ @@ -690,13 +689,12 @@ const SwRect& SwAnchoredObject::GetObjRectWithSpaces() const if ( mbObjRectWithSpacesValid && maLastObjRect != GetObjRect() ) { - ASSERT( false, - "<SwAnchoredObject::GetObjRectWithSpaces> - cache for object rectangle inclusive spaces marked as valid, but it couldn't be. Missing invalidation of cache. Please inform OD." ); + OSL_FAIL( "<SwAnchoredObject::GetObjRectWithSpaces> - cache for object rectangle inclusive spaces marked as valid, but it couldn't be. Missing invalidation of cache. Please inform OD." ); InvalidateObjRectWithSpaces(); } if ( !mbObjRectWithSpacesValid ) { - // --> OD 2006-10-05 #i70122# - correction: + // --> #i70122# - correction: // use bounding rectangle of anchored objects. // maObjRectWithSpaces = GetObjRect(); maObjRectWithSpaces = GetObjBoundRect(); @@ -718,7 +716,7 @@ const SwRect& SwAnchoredObject::GetObjRectWithSpaces() const return maObjRectWithSpaces; } -// --> OD 2006-08-10 #i68520# +// --> #i68520# void SwAnchoredObject::SetObjTop( const SwTwips _nTop) { const bool bTopChanged( _SetObjTop( _nTop ) ); @@ -740,7 +738,7 @@ void SwAnchoredObject::SetObjLeft( const SwTwips _nLeft) /** method to update anchored object in the <SwSortedObjs> lists - OD 2004-07-01 #i28701# + #i28701# If document compatibility option 'Consider wrapping style influence on object positioning' is ON, additionally all anchored objects at the anchor frame and all following anchored objects on the page @@ -798,13 +796,13 @@ void SwAnchoredObject::UpdateObjInSortedList() /** method to determine, if invalidation of position is allowed - OD 2004-07-01 #i28701# + #i28701# @author OD */ bool SwAnchoredObject::InvalidationOfPosAllowed() const { - // --> OD 2004-11-03 #114798# - Check, if page frame layout is in progress, + // --> Check, if page frame layout is in progress, // isn't needed, because of anchored object, whose are moved forward. return !PositionLocked(); // <-- @@ -813,8 +811,8 @@ bool SwAnchoredObject::InvalidationOfPosAllowed() const /** method to determine the page frame, on which the 'anchor' of the given anchored object is. - OD 2004-07-02 #i28701# - OD 2004-09-23 #i33751#, #i34060# + #i28701# + #i33751#, #i34060# Adjust meaning of method and thus its name: If the anchored object or its anchor isn't correctly inserted in the layout, no page frame can be found. Thus, the return type changed to be a pointer and can @@ -826,10 +824,10 @@ SwPageFrm* SwAnchoredObject::FindPageFrmOfAnchor() { SwPageFrm* pRetPageFrm = 0L; - // --> OD 2005-03-08 #i44339# - check, if anchor frame exists. + // --> #i44339# - check, if anchor frame exists. if ( mpAnchorFrm ) { - // --> OD 2004-10-08 #i26945# - use new method <GetAnchorFrmContainingAnchPos()> + // --> #i26945# - use new method <GetAnchorFrmContainingAnchPos()> pRetPageFrm = GetAnchorFrmContainingAnchPos()->FindPageFrm(); // <-- } @@ -840,7 +838,7 @@ SwPageFrm* SwAnchoredObject::FindPageFrmOfAnchor() /** get frame, which contains the anchor character, if the object is anchored at-character or as-character. - OD 2004-10-04 #i26945# + #i26945# @author OD @@ -852,7 +850,7 @@ SwTxtFrm* SwAnchoredObject::FindAnchorCharFrm() { SwTxtFrm* pAnchorCharFrm( 0L ); - // --> OD 2005-03-08 #i44339# - check, if anchor frame exists. + // --> #i44339# - check, if anchor frame exists. if ( mpAnchorFrm ) { const SwFmtAnchor& rAnch = GetFrmFmt().GetAnchor(); @@ -870,7 +868,7 @@ SwTxtFrm* SwAnchoredObject::FindAnchorCharFrm() /** method to determine, if a format on the anchored object is possible - OD 2004-07-23 #i28701# + #i28701# A format is possible, if anchored object is in an invisible layer. Note: method is virtual to refine the conditions for the sub-classes. @@ -881,11 +879,11 @@ bool SwAnchoredObject::IsFormatPossible() const return GetFrmFmt().GetDoc()->IsVisibleLayerId( GetDrawObj()->GetLayer() ); } -// --> OD 2004-08-25 #i3317# +// --> #i3317# void SwAnchoredObject::SetTmpConsiderWrapInfluence( const bool _bTmpConsiderWrapInfluence ) { mbTmpConsiderWrapInfluence = _bTmpConsiderWrapInfluence; - // --> OD 2004-10-22 #i35911# + // --> #i35911# if ( mbTmpConsiderWrapInfluence ) { SwLayouter::InsertObjForTmpConsiderWrapInfluence( *(GetFrmFmt().GetDoc()), @@ -900,7 +898,6 @@ bool SwAnchoredObject::IsTmpConsiderWrapInfluence() const } // <-- -// --> OD 2006-07-24 #b6449874# void SwAnchoredObject::SetTmpConsiderWrapInfluenceOfOtherObjs( const bool bTmpConsiderWrapInfluence ) { const SwSortedObjs* pObjs = GetAnchorFrm()->GetDrawObjs(); @@ -917,12 +914,11 @@ void SwAnchoredObject::SetTmpConsiderWrapInfluenceOfOtherObjs( const bool bTmpCo } } } -// <-- /** method to determine, if the anchored object is overlapping with a previous column - OD 2004-08-25 #i3317# + #i3317# overlapping with a previous column means, that the object overlaps with a column, which is a previous one of the column its anchor frame is in. @@ -956,7 +952,7 @@ bool SwAnchoredObject::OverlapsPrevColumn() const /** method to determine position of anchored object relative to anchor frame - OD 2005-01-06 #i30669# + #i30669# Usage: Needed layout information for WW8 export @author OD @@ -965,7 +961,7 @@ Point SwAnchoredObject::GetRelPosToAnchorFrm() const { Point aRelPos; - ASSERT( GetAnchorFrm(), + OSL_ENSURE( GetAnchorFrm(), "<SwAnchoredObject::GetRelPosToAnchorFrm()> - missing anchor frame." ); aRelPos = GetObjRect().Pos(); aRelPos -= GetAnchorFrm()->Frm().Pos(); @@ -976,9 +972,9 @@ Point SwAnchoredObject::GetRelPosToAnchorFrm() const /** method to determine position of anchored object relative to page frame - OD 2005-01-06 #i30669# + #i30669# Usage: Needed layout information for WW8 export - OD 2005-01-27 #i33818# - add parameters <_bFollowTextFlow> and + #i33818# - add parameters <_bFollowTextFlow> and <_obRelToTableCell> If <_bFollowTextFlow> is set and object is anchored inside table, the position relative to the table cell is determined. Output @@ -992,13 +988,13 @@ Point SwAnchoredObject::GetRelPosToPageFrm( const bool _bFollowTextFlow, Point aRelPos; _obRelToTableCell = false; - ASSERT( GetAnchorFrm(), + OSL_ENSURE( GetAnchorFrm(), "<SwAnchoredObject::GetRelPosToPageFrm()> - missing anchor frame." ); - ASSERT( GetAnchorFrm()->FindPageFrm(), + OSL_ENSURE( GetAnchorFrm()->FindPageFrm(), "<SwAnchoredObject::GetRelPosToPageFrm()> - missing page frame." ); aRelPos = GetObjRect().Pos(); - // --> OD 2005-01-27 #i33818# - search for cell frame, if object has to + // --> #i33818# - search for cell frame, if object has to // follow the text flow. const SwFrm* pFrm( 0L ); if ( _bFollowTextFlow && !GetAnchorFrm()->IsPageFrm() ) @@ -1030,7 +1026,7 @@ Point SwAnchoredObject::GetRelPosToPageFrm( const bool _bFollowTextFlow, /** method to determine position of anchored object relative to anchor character - OD 2005-01-06 #i30669# + #i30669# Usage: Needed layout information for WW8 export @author OD @@ -1048,7 +1044,7 @@ Point SwAnchoredObject::GetRelPosToChar() const /** method to determine position of anchored object relative to top of line - OD 2005-01-06 #i30669# + #i30669# Usage: Needed layout information for WW8 export @author OD @@ -1062,3 +1058,5 @@ Point SwAnchoredObject::GetRelPosToLine() const return aRelPos; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |