2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-16 20:21:38 +00:00
|
|
|
|
2004-08-02 13:11:47 +00:00
|
|
|
#include <objectformattertxtfrm.hxx>
|
|
|
|
#include <anchoredobject.hxx>
|
|
|
|
#include <sortedobjs.hxx>
|
|
|
|
#include <flyfrms.hxx>
|
|
|
|
#include <txtfrm.hxx>
|
|
|
|
#include <pagefrm.hxx>
|
2004-11-16 14:48:52 +00:00
|
|
|
#include <rowfrm.hxx>
|
2004-08-02 13:11:47 +00:00
|
|
|
#include <layouter.hxx>
|
|
|
|
#include <frmfmt.hxx>
|
|
|
|
#include <fmtanchr.hxx>
|
|
|
|
#include <fmtwrapinfluenceonobjpos.hxx>
|
2004-11-16 14:48:52 +00:00
|
|
|
#include <fmtfollowtextflow.hxx>
|
2004-08-02 13:11:47 +00:00
|
|
|
#include <layact.hxx>
|
|
|
|
|
2007-10-22 14:11:20 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// little helper class to forbid follow formatting for the given text frame
|
2004-12-23 09:08:49 +00:00
|
|
|
class SwForbidFollowFormat
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
SwTxtFrm& mrTxtFrm;
|
|
|
|
const bool bOldFollowFormatAllowed;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SwForbidFollowFormat( SwTxtFrm& _rTxtFrm )
|
|
|
|
: mrTxtFrm( _rTxtFrm ),
|
|
|
|
bOldFollowFormatAllowed( _rTxtFrm.FollowFormatAllowed() )
|
|
|
|
{
|
|
|
|
mrTxtFrm.ForbidFollowFormat();
|
|
|
|
}
|
|
|
|
|
|
|
|
~SwForbidFollowFormat()
|
|
|
|
{
|
|
|
|
if ( bOldFollowFormatAllowed )
|
|
|
|
{
|
|
|
|
mrTxtFrm.AllowFollowFormat();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-08-02 13:11:47 +00:00
|
|
|
// =============================================================================
|
|
|
|
// implementation of class <SwObjectFormatterTxtFrm>
|
|
|
|
// =============================================================================
|
|
|
|
SwObjectFormatterTxtFrm::SwObjectFormatterTxtFrm( SwTxtFrm& _rAnchorTxtFrm,
|
|
|
|
const SwPageFrm& _rPageFrm,
|
|
|
|
SwTxtFrm* _pMasterAnchorTxtFrm,
|
|
|
|
SwLayAction* _pLayAction )
|
|
|
|
: SwObjectFormatter( _rPageFrm, _pLayAction, true ),
|
|
|
|
mrAnchorTxtFrm( _rAnchorTxtFrm ),
|
|
|
|
mpMasterAnchorTxtFrm( _pMasterAnchorTxtFrm )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwObjectFormatterTxtFrm::~SwObjectFormatterTxtFrm()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwObjectFormatterTxtFrm* SwObjectFormatterTxtFrm::CreateObjFormatter(
|
|
|
|
SwTxtFrm& _rAnchorTxtFrm,
|
|
|
|
const SwPageFrm& _rPageFrm,
|
|
|
|
SwLayAction* _pLayAction )
|
|
|
|
{
|
|
|
|
SwObjectFormatterTxtFrm* pObjFormatter = 0L;
|
|
|
|
|
|
|
|
// determine 'master' of <_rAnchorTxtFrm>, if anchor frame is a follow text frame.
|
|
|
|
SwTxtFrm* pMasterOfAnchorFrm = 0L;
|
|
|
|
if ( _rAnchorTxtFrm.IsFollow() )
|
|
|
|
{
|
|
|
|
pMasterOfAnchorFrm = _rAnchorTxtFrm.FindMaster();
|
2010-11-30 13:52:10 +00:00
|
|
|
while ( pMasterOfAnchorFrm && pMasterOfAnchorFrm->IsFollow() )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
pMasterOfAnchorFrm = pMasterOfAnchorFrm->FindMaster();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// create object formatter, if floating screen objects are registered
|
|
|
|
// at anchor frame (or at 'master' anchor frame)
|
|
|
|
if ( _rAnchorTxtFrm.GetDrawObjs() ||
|
|
|
|
( pMasterOfAnchorFrm && pMasterOfAnchorFrm->GetDrawObjs() ) )
|
|
|
|
{
|
|
|
|
pObjFormatter =
|
|
|
|
new SwObjectFormatterTxtFrm( _rAnchorTxtFrm, _rPageFrm,
|
|
|
|
pMasterOfAnchorFrm, _pLayAction );
|
|
|
|
}
|
|
|
|
|
|
|
|
return pObjFormatter;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFrm& SwObjectFormatterTxtFrm::GetAnchorFrm()
|
|
|
|
{
|
|
|
|
return mrAnchorTxtFrm;
|
|
|
|
}
|
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i40147# - add parameter <_bCheckForMovedFwd>.
|
2005-01-21 09:38:29 +00:00
|
|
|
bool SwObjectFormatterTxtFrm::DoFormatObj( SwAnchoredObject& _rAnchoredObj,
|
|
|
|
const bool _bCheckForMovedFwd )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
// check, if only as-character anchored object have to be formatted, and
|
|
|
|
// check the anchor type
|
|
|
|
if ( FormatOnlyAsCharAnchored() &&
|
2010-01-05 16:37:41 +01:00
|
|
|
!(_rAnchoredObj.GetFrmFmt().GetAnchor().GetAnchorId() == FLY_AS_CHAR) )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// consider, if the layout action has to be
|
2005-09-28 10:14:28 +00:00
|
|
|
// restarted due to a delete of a page frame.
|
|
|
|
if ( GetLayAction() && GetLayAction()->IsAgain() )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:11:47 +00:00
|
|
|
bool bSuccess( true );
|
|
|
|
|
|
|
|
if ( _rAnchoredObj.IsFormatPossible() )
|
|
|
|
{
|
|
|
|
_rAnchoredObj.SetRestartLayoutProcess( false );
|
|
|
|
|
|
|
|
_FormatObj( _rAnchoredObj );
|
2011-02-13 18:00:46 +01:00
|
|
|
// consider, if the layout action has to be
|
2005-09-28 10:14:28 +00:00
|
|
|
// restarted due to a delete of a page frame.
|
|
|
|
if ( GetLayAction() && GetLayAction()->IsAgain() )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2004-08-02 13:11:47 +00:00
|
|
|
|
|
|
|
// check, if layout process has to be restarted.
|
|
|
|
// if yes, perform needed invalidations.
|
2011-02-13 18:00:46 +01:00
|
|
|
|
|
|
|
// no restart of layout process,
|
2004-11-16 14:48:52 +00:00
|
|
|
// if anchored object is anchored inside a Writer fly frame,
|
|
|
|
// its position is already locked, and it follows the text flow.
|
|
|
|
const bool bRestart =
|
|
|
|
_rAnchoredObj.RestartLayoutProcess() &&
|
|
|
|
!( _rAnchoredObj.PositionLocked() &&
|
|
|
|
_rAnchoredObj.GetAnchorFrm()->IsInFly() &&
|
|
|
|
_rAnchoredObj.GetFrmFmt().GetFollowTextFlow().GetValue() );
|
|
|
|
if ( bRestart )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
bSuccess = false;
|
|
|
|
_InvalidatePrevObjs( _rAnchoredObj );
|
|
|
|
_InvalidateFollowObjs( _rAnchoredObj, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
// format anchor text frame, if wrapping style influence of the object
|
|
|
|
// has to be considered and it's <NONE_SUCCESSIVE_POSITIONED>
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i3317# - consider also anchored objects, whose
|
2004-09-09 09:58:18 +00:00
|
|
|
// wrapping style influence is temporarly considered.
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i40147# - consider also anchored objects, for
|
2005-01-21 09:38:29 +00:00
|
|
|
// whose the check of a moved forward anchor frame is requested.
|
2011-02-14 14:00:29 +01:00
|
|
|
// revise decision made for i3317:
|
2006-07-26 07:17:23 +00:00
|
|
|
// anchored objects, whose wrapping style influence is temporarly considered,
|
|
|
|
// have to be considered in method <SwObjectFormatterTxtFrm::DoFormatObjs()>
|
2004-08-02 13:11:47 +00:00
|
|
|
if ( bSuccess &&
|
2006-07-26 07:17:23 +00:00
|
|
|
_rAnchoredObj.ConsiderObjWrapInfluenceOnObjPos() &&
|
|
|
|
( _bCheckForMovedFwd ||
|
|
|
|
_rAnchoredObj.GetFrmFmt().GetWrapInfluenceOnObjPos().
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE
|
2006-07-26 07:17:23 +00:00
|
|
|
GetWrapInfluenceOnObjPos( true ) ==
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - constant name has changed
|
2006-07-26 07:17:23 +00:00
|
|
|
text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ) )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i26945# - check conditions for move forward of
|
2004-11-16 14:48:52 +00:00
|
|
|
// anchor text frame
|
|
|
|
// determine, if anchor text frame has previous frame
|
|
|
|
const bool bDoesAnchorHadPrev = ( mrAnchorTxtFrm.GetIndPrev() != 0 );
|
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i40141# - use new method - it also formats the
|
2005-01-21 09:38:29 +00:00
|
|
|
// section the anchor frame is in.
|
|
|
|
_FormatAnchorFrmForCheckMoveFwd();
|
2004-11-16 14:48:52 +00:00
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35911#
|
2004-11-16 14:48:52 +00:00
|
|
|
if ( _rAnchoredObj.HasClearedEnvironment() )
|
|
|
|
{
|
|
|
|
_rAnchoredObj.SetClearedEnvironment( true );
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049# - consider, that anchor frame
|
2005-03-23 12:00:38 +00:00
|
|
|
// could already been marked to move forward.
|
|
|
|
SwPageFrm* pAnchorPageFrm( mrAnchorTxtFrm.FindPageFrm() );
|
|
|
|
if ( pAnchorPageFrm != _rAnchoredObj.GetPageFrm() )
|
2004-11-16 14:48:52 +00:00
|
|
|
{
|
2005-03-23 12:00:38 +00:00
|
|
|
bool bInsert( true );
|
|
|
|
sal_uInt32 nToPageNum( 0L );
|
|
|
|
const SwDoc& rDoc = *(GetPageFrm().GetFmt()->GetDoc());
|
|
|
|
if ( SwLayouter::FrmMovedFwdByObjPos(
|
|
|
|
rDoc, mrAnchorTxtFrm, nToPageNum ) )
|
|
|
|
{
|
|
|
|
if ( nToPageNum < pAnchorPageFrm->GetPhyPageNum() )
|
|
|
|
SwLayouter::RemoveMovedFwdFrm( rDoc, mrAnchorTxtFrm );
|
|
|
|
else
|
|
|
|
bInsert = false;
|
|
|
|
}
|
|
|
|
if ( bInsert )
|
|
|
|
{
|
|
|
|
SwLayouter::InsertMovedFwdFrm( rDoc, mrAnchorTxtFrm,
|
|
|
|
pAnchorPageFrm->GetPhyPageNum() );
|
|
|
|
mrAnchorTxtFrm.InvalidatePos();
|
|
|
|
bSuccess = false;
|
|
|
|
_InvalidatePrevObjs( _rAnchoredObj );
|
|
|
|
_InvalidateFollowObjs( _rAnchoredObj, true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "<SwObjectFormatterTxtFrm::DoFormatObj(..)> - anchor frame not marked to move forward" );
|
2005-03-23 12:00:38 +00:00
|
|
|
}
|
2004-11-16 14:48:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( !mrAnchorTxtFrm.IsFollow() && bDoesAnchorHadPrev )
|
|
|
|
{
|
|
|
|
// index of anchored object in collection of page numbers and
|
|
|
|
// anchor types
|
|
|
|
sal_uInt32 nIdx( CountOfCollected() );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( nIdx > 0,
|
2004-11-16 14:48:52 +00:00
|
|
|
"<SwObjectFormatterTxtFrm::DoFormatObj(..)> - anchored object not collected!?" );
|
|
|
|
--nIdx;
|
|
|
|
|
|
|
|
sal_uInt32 nToPageNum( 0L );
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i43913#
|
2005-04-01 15:35:59 +00:00
|
|
|
bool bDummy( false );
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i58182# - consider new method signature
|
2006-02-03 16:18:01 +00:00
|
|
|
if ( SwObjectFormatterTxtFrm::CheckMovedFwdCondition( *GetCollectedObj( nIdx ),
|
|
|
|
GetPgNumOfCollected( nIdx ),
|
|
|
|
IsCollectedAnchoredAtMaster( nIdx ),
|
|
|
|
nToPageNum, bDummy ) )
|
2004-11-16 14:48:52 +00:00
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i49987# - consider, that anchor frame
|
2005-07-08 10:04:17 +00:00
|
|
|
// could already been marked to move forward.
|
|
|
|
bool bInsert( true );
|
|
|
|
sal_uInt32 nMovedFwdToPageNum( 0L );
|
|
|
|
const SwDoc& rDoc = *(GetPageFrm().GetFmt()->GetDoc());
|
|
|
|
if ( SwLayouter::FrmMovedFwdByObjPos(
|
|
|
|
rDoc, mrAnchorTxtFrm, nMovedFwdToPageNum ) )
|
|
|
|
{
|
|
|
|
if ( nMovedFwdToPageNum < nToPageNum )
|
|
|
|
SwLayouter::RemoveMovedFwdFrm( rDoc, mrAnchorTxtFrm );
|
|
|
|
else
|
|
|
|
bInsert = false;
|
|
|
|
}
|
|
|
|
if ( bInsert )
|
|
|
|
{
|
|
|
|
// Indicate that anchor text frame has to move forward and
|
|
|
|
// invalidate its position to force a re-format.
|
|
|
|
SwLayouter::InsertMovedFwdFrm( rDoc, mrAnchorTxtFrm,
|
|
|
|
nToPageNum );
|
|
|
|
mrAnchorTxtFrm.InvalidatePos();
|
2004-11-16 14:48:52 +00:00
|
|
|
|
2005-07-08 10:04:17 +00:00
|
|
|
// Indicate restart of the layout process
|
|
|
|
bSuccess = false;
|
2004-11-16 14:48:52 +00:00
|
|
|
|
2005-07-08 10:04:17 +00:00
|
|
|
// If needed, invalidate previous objects anchored at same anchor
|
|
|
|
// text frame.
|
|
|
|
_InvalidatePrevObjs( _rAnchoredObj );
|
2004-11-16 14:48:52 +00:00
|
|
|
|
2005-07-08 10:04:17 +00:00
|
|
|
// Invalidate object and following objects for the restart of the
|
|
|
|
// layout process
|
|
|
|
_InvalidateFollowObjs( _rAnchoredObj, true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "<SwObjectFormatterTxtFrm::DoFormatObj(..)> - anchor frame not marked to move forward" );
|
2005-07-08 10:04:17 +00:00
|
|
|
}
|
2004-11-16 14:48:52 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-13 18:00:46 +01:00
|
|
|
// i40155# - mark anchor frame not to wrap around
|
2005-01-21 09:38:29 +00:00
|
|
|
// objects under the condition, that its follow contains all its text.
|
|
|
|
else if ( !mrAnchorTxtFrm.IsFollow() &&
|
|
|
|
mrAnchorTxtFrm.GetFollow() &&
|
|
|
|
mrAnchorTxtFrm.GetFollow()->GetOfst() == 0 )
|
|
|
|
{
|
|
|
|
SwLayouter::RemoveMovedFwdFrm(
|
|
|
|
*(mrAnchorTxtFrm.FindPageFrm()->GetFmt()->GetDoc()),
|
|
|
|
mrAnchorTxtFrm );
|
|
|
|
}
|
2004-08-02 13:11:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SwObjectFormatterTxtFrm::DoFormatObjs()
|
|
|
|
{
|
|
|
|
if ( !mrAnchorTxtFrm.IsValid() )
|
|
|
|
{
|
|
|
|
if ( GetLayAction() &&
|
|
|
|
mrAnchorTxtFrm.FindPageFrm() != &GetPageFrm() )
|
|
|
|
{
|
|
|
|
// notify layout action, thus is can restart the layout process on
|
|
|
|
// a previous page.
|
|
|
|
GetLayAction()->SetAgain();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// the anchor text frame has to be valid, thus assert.
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "<SwObjectFormatterTxtFrm::DoFormatObjs()> called for invalidate anchor text frame." );
|
2004-08-02 13:11:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool bSuccess( true );
|
|
|
|
|
|
|
|
if ( mrAnchorTxtFrm.IsFollow() )
|
|
|
|
{
|
|
|
|
// Only floating screen objects anchored as-character are directly
|
|
|
|
// registered at a follow text frame. The other floating screen objects
|
|
|
|
// are registered at the 'master' anchor text frame.
|
|
|
|
// Thus, format the other floating screen objects through the 'master'
|
|
|
|
// anchor text frame
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( mpMasterAnchorTxtFrm,
|
2004-08-02 13:11:47 +00:00
|
|
|
"SwObjectFormatterTxtFrm::DoFormatObjs() - missing 'master' anchor text frame" );
|
2004-11-16 14:48:52 +00:00
|
|
|
bSuccess = _FormatObjsAtFrm( mpMasterAnchorTxtFrm );
|
2004-08-02 13:11:47 +00:00
|
|
|
|
|
|
|
if ( bSuccess )
|
|
|
|
{
|
|
|
|
// format of as-character anchored floating screen objects - no failure
|
|
|
|
// excepted on the format of these objects.
|
2005-09-28 10:14:28 +00:00
|
|
|
bSuccess = _FormatObjsAtFrm();
|
2004-08-02 13:11:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bSuccess = _FormatObjsAtFrm();
|
|
|
|
}
|
|
|
|
|
2006-07-26 07:17:23 +00:00
|
|
|
// consider anchored objects, whose wrapping style influence are temporarly
|
|
|
|
// considered.
|
|
|
|
if ( bSuccess &&
|
|
|
|
( ConsiderWrapOnObjPos() ||
|
|
|
|
( !mrAnchorTxtFrm.IsFollow() &&
|
|
|
|
_AtLeastOneObjIsTmpConsiderWrapInfluence() ) ) )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
const bool bDoesAnchorHadPrev = ( mrAnchorTxtFrm.GetIndPrev() != 0 );
|
|
|
|
|
|
|
|
// Format anchor text frame after its objects are formatted.
|
|
|
|
// Note: The format of the anchor frame also formats the invalid
|
|
|
|
// previous frames of the anchor frame. The format of the previous
|
|
|
|
// frames is needed to get a correct result of format of the
|
|
|
|
// anchor frame for the following check for moved forward anchors
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i40141# - use new method - it also formats the
|
2005-01-21 09:38:29 +00:00
|
|
|
// section the anchor frame is in.
|
|
|
|
_FormatAnchorFrmForCheckMoveFwd();
|
2004-08-02 13:11:47 +00:00
|
|
|
|
|
|
|
sal_uInt32 nToPageNum( 0L );
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i43913#
|
2005-04-01 15:35:59 +00:00
|
|
|
bool bInFollow( false );
|
2004-08-02 13:11:47 +00:00
|
|
|
SwAnchoredObject* pObj = 0L;
|
|
|
|
if ( !mrAnchorTxtFrm.IsFollow() )
|
|
|
|
{
|
|
|
|
pObj = _GetFirstObjWithMovedFwdAnchor(
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - constant name has changed
|
2004-11-26 12:25:50 +00:00
|
|
|
text::WrapInfluenceOnPosition::ONCE_CONCURRENT,
|
2005-04-01 15:35:59 +00:00
|
|
|
nToPageNum, bInFollow );
|
2004-08-02 13:11:47 +00:00
|
|
|
}
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35911#
|
2004-11-16 14:48:52 +00:00
|
|
|
if ( pObj && pObj->HasClearedEnvironment() )
|
|
|
|
{
|
|
|
|
pObj->SetClearedEnvironment( true );
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049# - consider, that anchor frame
|
2005-03-23 12:00:38 +00:00
|
|
|
// could already been marked to move forward.
|
|
|
|
SwPageFrm* pAnchorPageFrm( mrAnchorTxtFrm.FindPageFrm() );
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i43913# - consider, that anchor frame
|
2005-04-01 15:35:59 +00:00
|
|
|
// is a follow or is in a follow row, which will move forward.
|
|
|
|
if ( pAnchorPageFrm != pObj->GetPageFrm() ||
|
|
|
|
bInFollow )
|
2004-11-16 14:48:52 +00:00
|
|
|
{
|
2005-03-23 12:00:38 +00:00
|
|
|
bool bInsert( true );
|
2007-09-27 08:05:20 +00:00
|
|
|
sal_uInt32 nTmpToPageNum( 0L );
|
2005-03-23 12:00:38 +00:00
|
|
|
const SwDoc& rDoc = *(GetPageFrm().GetFmt()->GetDoc());
|
|
|
|
if ( SwLayouter::FrmMovedFwdByObjPos(
|
2007-09-27 08:05:20 +00:00
|
|
|
rDoc, mrAnchorTxtFrm, nTmpToPageNum ) )
|
2005-03-23 12:00:38 +00:00
|
|
|
{
|
2007-09-27 08:05:20 +00:00
|
|
|
if ( nTmpToPageNum < pAnchorPageFrm->GetPhyPageNum() )
|
2005-03-23 12:00:38 +00:00
|
|
|
SwLayouter::RemoveMovedFwdFrm( rDoc, mrAnchorTxtFrm );
|
|
|
|
else
|
|
|
|
bInsert = false;
|
|
|
|
}
|
|
|
|
if ( bInsert )
|
|
|
|
{
|
|
|
|
SwLayouter::InsertMovedFwdFrm( rDoc, mrAnchorTxtFrm,
|
|
|
|
pAnchorPageFrm->GetPhyPageNum() );
|
|
|
|
mrAnchorTxtFrm.InvalidatePos();
|
|
|
|
bSuccess = false;
|
|
|
|
_InvalidatePrevObjs( *pObj );
|
|
|
|
_InvalidateFollowObjs( *pObj, true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "<SwObjectFormatterTxtFrm::DoFormatObjs(..)> - anchor frame not marked to move forward" );
|
2005-03-23 12:00:38 +00:00
|
|
|
}
|
2004-11-16 14:48:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( pObj && bDoesAnchorHadPrev )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
// Object found, whose anchor is moved forward
|
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i49987# - consider, that anchor frame
|
2005-07-08 10:04:17 +00:00
|
|
|
// could already been marked to move forward.
|
|
|
|
bool bInsert( true );
|
|
|
|
sal_uInt32 nMovedFwdToPageNum( 0L );
|
|
|
|
const SwDoc& rDoc = *(GetPageFrm().GetFmt()->GetDoc());
|
|
|
|
if ( SwLayouter::FrmMovedFwdByObjPos(
|
|
|
|
rDoc, mrAnchorTxtFrm, nMovedFwdToPageNum ) )
|
|
|
|
{
|
|
|
|
if ( nMovedFwdToPageNum < nToPageNum )
|
|
|
|
SwLayouter::RemoveMovedFwdFrm( rDoc, mrAnchorTxtFrm );
|
|
|
|
else
|
|
|
|
bInsert = false;
|
|
|
|
}
|
|
|
|
if ( bInsert )
|
|
|
|
{
|
|
|
|
// Indicate that anchor text frame has to move forward and
|
|
|
|
// invalidate its position to force a re-format.
|
|
|
|
SwLayouter::InsertMovedFwdFrm( rDoc, mrAnchorTxtFrm, nToPageNum );
|
|
|
|
mrAnchorTxtFrm.InvalidatePos();
|
2004-08-02 13:11:47 +00:00
|
|
|
|
2005-07-08 10:04:17 +00:00
|
|
|
// Indicate restart of the layout process
|
|
|
|
bSuccess = false;
|
2004-08-02 13:11:47 +00:00
|
|
|
|
2005-07-08 10:04:17 +00:00
|
|
|
// If needed, invalidate previous objects anchored at same anchor
|
|
|
|
// text frame.
|
|
|
|
_InvalidatePrevObjs( *pObj );
|
2004-08-02 13:11:47 +00:00
|
|
|
|
2005-07-08 10:04:17 +00:00
|
|
|
// Invalidate object and following objects for the restart of the
|
|
|
|
// layout process
|
|
|
|
_InvalidateFollowObjs( *pObj, true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "<SwObjectFormatterTxtFrm::DoFormatObjs(..)> - anchor frame not marked to move forward" );
|
2005-07-08 10:04:17 +00:00
|
|
|
}
|
2004-08-02 13:11:47 +00:00
|
|
|
}
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i40155# - mark anchor frame not to wrap around
|
2005-01-21 09:38:29 +00:00
|
|
|
// objects under the condition, that its follow contains all its text.
|
|
|
|
else if ( !mrAnchorTxtFrm.IsFollow() &&
|
|
|
|
mrAnchorTxtFrm.GetFollow() &&
|
|
|
|
mrAnchorTxtFrm.GetFollow()->GetOfst() == 0 )
|
|
|
|
{
|
|
|
|
SwLayouter::RemoveMovedFwdFrm(
|
|
|
|
*(mrAnchorTxtFrm.FindPageFrm()->GetFmt()->GetDoc()),
|
|
|
|
mrAnchorTxtFrm );
|
|
|
|
}
|
2004-08-02 13:11:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwObjectFormatterTxtFrm::_InvalidatePrevObjs( SwAnchoredObject& _rAnchoredObj )
|
|
|
|
{
|
|
|
|
// invalidate all previous objects, whose wrapping influence on the object
|
|
|
|
// positioning is <NONE_CONCURRENT_POSIITIONED>.
|
|
|
|
// Note: list of objects at anchor frame is sorted by this property.
|
|
|
|
if ( _rAnchoredObj.GetFrmFmt().GetWrapInfluenceOnObjPos().
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE
|
2004-11-26 12:25:50 +00:00
|
|
|
GetWrapInfluenceOnObjPos( true ) ==
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - constant name has changed
|
2004-11-26 12:25:50 +00:00
|
|
|
text::WrapInfluenceOnPosition::ONCE_CONCURRENT )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
const SwSortedObjs* pObjs = GetAnchorFrm().GetDrawObjs();
|
|
|
|
if ( pObjs )
|
|
|
|
{
|
|
|
|
// determine start index
|
|
|
|
sal_Int32 i = pObjs->ListPosOf( _rAnchoredObj ) - 1;
|
|
|
|
for ( ; i >= 0; --i )
|
|
|
|
{
|
|
|
|
SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
|
|
|
|
if ( pAnchoredObj->GetFrmFmt().GetWrapInfluenceOnObjPos().
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE
|
2004-11-26 12:25:50 +00:00
|
|
|
GetWrapInfluenceOnObjPos( true ) ==
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - constant name has changed
|
2004-11-26 12:25:50 +00:00
|
|
|
text::WrapInfluenceOnPosition::ONCE_CONCURRENT )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
|
|
|
pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence( true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwObjectFormatterTxtFrm::_InvalidateFollowObjs( SwAnchoredObject& _rAnchoredObj,
|
|
|
|
const bool _bInclObj )
|
|
|
|
{
|
|
|
|
if ( _bInclObj )
|
|
|
|
{
|
|
|
|
_rAnchoredObj.InvalidateObjPosForConsiderWrapInfluence( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwSortedObjs* pObjs = GetPageFrm().GetSortedObjs();
|
|
|
|
if ( pObjs )
|
|
|
|
{
|
|
|
|
// determine start index
|
|
|
|
sal_uInt32 i = pObjs->ListPosOf( _rAnchoredObj ) + 1;
|
|
|
|
for ( ; i < pObjs->Count(); ++i )
|
|
|
|
{
|
|
|
|
SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
|
|
|
|
pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence( true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAnchoredObject* SwObjectFormatterTxtFrm::_GetFirstObjWithMovedFwdAnchor(
|
|
|
|
const sal_Int16 _nWrapInfluenceOnPosition,
|
2005-04-01 15:35:59 +00:00
|
|
|
sal_uInt32& _noToPageNum,
|
|
|
|
bool& _boInFollow )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - constant names have changed
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
|
2004-11-26 12:25:50 +00:00
|
|
|
_nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_CONCURRENT,
|
2004-08-02 13:11:47 +00:00
|
|
|
"<SwObjectFormatterTxtFrm::_GetFirstObjWithMovedFwdAnchor(..)> - invalid value for parameter <_nWrapInfluenceOnPosition>" );
|
|
|
|
|
|
|
|
SwAnchoredObject* pRetAnchoredObj = 0L;
|
|
|
|
|
|
|
|
sal_uInt32 i = 0L;
|
|
|
|
for ( ; i < CountOfCollected(); ++i )
|
|
|
|
{
|
|
|
|
SwAnchoredObject* pAnchoredObj = GetCollectedObj(i);
|
|
|
|
if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() &&
|
|
|
|
pAnchoredObj->GetFrmFmt().GetWrapInfluenceOnObjPos().
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE
|
2004-11-26 12:25:50 +00:00
|
|
|
GetWrapInfluenceOnObjPos( true ) == _nWrapInfluenceOnPosition )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i26945# - use new method <_CheckMovedFwdCondition(..)>
|
|
|
|
// #i43913#
|
|
|
|
// #i58182# - consider new method signature
|
2006-02-03 16:18:01 +00:00
|
|
|
if ( SwObjectFormatterTxtFrm::CheckMovedFwdCondition( *GetCollectedObj( i ),
|
|
|
|
GetPgNumOfCollected( i ),
|
|
|
|
IsCollectedAnchoredAtMaster( i ),
|
|
|
|
_noToPageNum, _boInFollow ) )
|
2004-08-02 13:11:47 +00:00
|
|
|
{
|
2004-11-16 14:48:52 +00:00
|
|
|
pRetAnchoredObj = pAnchoredObj;
|
|
|
|
break;
|
2004-08-02 13:11:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRetAnchoredObj;
|
|
|
|
}
|
2004-11-16 14:48:52 +00:00
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i58182#
|
2006-02-03 16:18:01 +00:00
|
|
|
// - replace private method by corresponding static public method
|
|
|
|
bool SwObjectFormatterTxtFrm::CheckMovedFwdCondition(
|
|
|
|
SwAnchoredObject& _rAnchoredObj,
|
|
|
|
const sal_uInt32 _nFromPageNum,
|
|
|
|
const bool _bAnchoredAtMasterBeforeFormatAnchor,
|
2005-04-01 15:35:59 +00:00
|
|
|
sal_uInt32& _noToPageNum,
|
|
|
|
bool& _boInFollow )
|
2004-11-16 14:48:52 +00:00
|
|
|
{
|
|
|
|
bool bAnchorIsMovedForward( false );
|
|
|
|
|
2006-02-03 16:18:01 +00:00
|
|
|
SwPageFrm* pPageFrmOfAnchor = _rAnchoredObj.FindPageFrmOfAnchor();
|
2004-11-16 14:48:52 +00:00
|
|
|
if ( pPageFrmOfAnchor )
|
|
|
|
{
|
|
|
|
const sal_uInt32 nPageNum = pPageFrmOfAnchor->GetPhyPageNum();
|
2006-02-03 16:18:01 +00:00
|
|
|
if ( nPageNum > _nFromPageNum )
|
2004-11-16 14:48:52 +00:00
|
|
|
{
|
|
|
|
_noToPageNum = nPageNum;
|
2006-07-10 14:16:52 +00:00
|
|
|
// Handling of special case:
|
|
|
|
// If anchor frame is move forward into a follow flow row,
|
|
|
|
// <_noToPageNum> is set to <_nFromPageNum + 1>, because it is
|
|
|
|
// possible that the anchor page frame isn't valid, because the
|
|
|
|
// page distance between master row and follow flow row is greater
|
|
|
|
// than 1.
|
|
|
|
if ( _noToPageNum > (_nFromPageNum + 1) )
|
|
|
|
{
|
|
|
|
SwFrm* pAnchorFrm = _rAnchoredObj.GetAnchorFrmContainingAnchPos();
|
|
|
|
if ( pAnchorFrm->IsInTab() &&
|
|
|
|
pAnchorFrm->IsInFollowFlowRow() )
|
|
|
|
{
|
|
|
|
_noToPageNum = _nFromPageNum + 1;
|
|
|
|
}
|
|
|
|
}
|
2004-11-16 14:48:52 +00:00
|
|
|
bAnchorIsMovedForward = true;
|
|
|
|
}
|
|
|
|
}
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i26945# - check, if an at-paragraph|at-character
|
2004-11-16 14:48:52 +00:00
|
|
|
// anchored object is now anchored at a follow text frame, which will be
|
|
|
|
// on the next page. Also check, if an at-character anchored object
|
|
|
|
// is now anchored at a text frame, which is in a follow flow row,
|
|
|
|
// which will be on the next page.
|
|
|
|
if ( !bAnchorIsMovedForward &&
|
2006-02-03 16:18:01 +00:00
|
|
|
_bAnchoredAtMasterBeforeFormatAnchor &&
|
2010-01-05 16:37:41 +01:00
|
|
|
((_rAnchoredObj.GetFrmFmt().GetAnchor().GetAnchorId() == FLY_AT_CHAR) ||
|
|
|
|
(_rAnchoredObj.GetFrmFmt().GetAnchor().GetAnchorId() == FLY_AT_PARA)))
|
2004-11-16 14:48:52 +00:00
|
|
|
{
|
2006-02-03 16:18:01 +00:00
|
|
|
SwFrm* pAnchorFrm = _rAnchoredObj.GetAnchorFrmContainingAnchPos();
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pAnchorFrm->IsTxtFrm(),
|
2006-02-03 16:18:01 +00:00
|
|
|
"<SwObjectFormatterTxtFrm::CheckMovedFwdCondition(..) - wrong type of anchor frame>" );
|
2004-11-16 14:48:52 +00:00
|
|
|
SwTxtFrm* pAnchorTxtFrm = static_cast<SwTxtFrm*>(pAnchorFrm);
|
|
|
|
bool bCheck( false );
|
|
|
|
if ( pAnchorTxtFrm->IsFollow() )
|
|
|
|
{
|
|
|
|
bCheck = true;
|
|
|
|
}
|
|
|
|
else if( pAnchorTxtFrm->IsInTab() )
|
|
|
|
{
|
|
|
|
const SwRowFrm* pMasterRow = pAnchorTxtFrm->IsInFollowFlowRow();
|
|
|
|
if ( pMasterRow &&
|
|
|
|
pMasterRow->FindPageFrm() == pPageFrmOfAnchor )
|
|
|
|
{
|
|
|
|
bCheck = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( bCheck )
|
|
|
|
{
|
|
|
|
// check, if found text frame will be on the next page
|
|
|
|
// by checking, if it's in a column, which has no next.
|
|
|
|
SwFrm* pColFrm = pAnchorTxtFrm->FindColFrm();
|
|
|
|
while ( pColFrm && !pColFrm->GetNext() )
|
|
|
|
{
|
|
|
|
pColFrm = pColFrm->FindColFrm();
|
|
|
|
}
|
|
|
|
if ( !pColFrm || !pColFrm->GetNext() )
|
|
|
|
{
|
2006-02-03 16:18:01 +00:00
|
|
|
_noToPageNum = _nFromPageNum + 1;
|
2004-11-16 14:48:52 +00:00
|
|
|
bAnchorIsMovedForward = true;
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i43913#
|
2005-04-01 15:35:59 +00:00
|
|
|
_boInFollow = true;
|
2004-11-16 14:48:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bAnchorIsMovedForward;
|
|
|
|
}
|
2005-01-21 09:38:29 +00:00
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i40140# - helper method to format layout frames used by
|
2005-01-21 09:38:29 +00:00
|
|
|
// method <SwObjectFormatterTxtFrm::_FormatAnchorFrmForCheckMoveFwd()>
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049# - format till a certain lower frame, if provided.
|
2012-10-12 16:49:40 +02:00
|
|
|
static void lcl_FormatCntntOfLayoutFrm( SwLayoutFrm* pLayFrm,
|
2005-03-23 12:00:38 +00:00
|
|
|
SwFrm* pLastLowerFrm = 0L )
|
2005-01-21 09:38:29 +00:00
|
|
|
{
|
|
|
|
SwFrm* pLowerFrm = pLayFrm->GetLower();
|
|
|
|
while ( pLowerFrm )
|
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049#
|
2005-03-23 12:00:38 +00:00
|
|
|
if ( pLastLowerFrm && pLowerFrm == pLastLowerFrm )
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2005-01-21 09:38:29 +00:00
|
|
|
if ( pLowerFrm->IsLayoutFrm() )
|
2005-03-23 12:00:38 +00:00
|
|
|
lcl_FormatCntntOfLayoutFrm( static_cast<SwLayoutFrm*>(pLowerFrm),
|
|
|
|
pLastLowerFrm );
|
2005-01-21 09:38:29 +00:00
|
|
|
else
|
|
|
|
pLowerFrm->Calc();
|
|
|
|
|
|
|
|
pLowerFrm = pLowerFrm->GetNext();
|
|
|
|
}
|
|
|
|
}
|
2011-02-13 18:00:46 +01:00
|
|
|
|
2005-11-17 15:34:04 +00:00
|
|
|
/** method to format given anchor text frame and its previous frames
|
2005-01-21 09:38:29 +00:00
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
#i56300#
|
2005-11-17 15:34:04 +00:00
|
|
|
Usage: Needed to check, if the anchor text frame is moved forward
|
|
|
|
due to the positioning and wrapping of its anchored objects, and
|
|
|
|
to format the frames, which have become invalid due to the anchored
|
|
|
|
object formatting in the iterative object positioning algorithm
|
2005-01-21 09:38:29 +00:00
|
|
|
*/
|
2005-11-17 15:34:04 +00:00
|
|
|
void SwObjectFormatterTxtFrm::FormatAnchorFrmAndItsPrevs( SwTxtFrm& _rAnchorTxtFrm )
|
2005-01-21 09:38:29 +00:00
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i47014# - no format of section and previous columns
|
2005-04-18 13:28:28 +00:00
|
|
|
// for follow text frames.
|
2005-11-17 15:34:04 +00:00
|
|
|
if ( !_rAnchorTxtFrm.IsFollow() )
|
2005-01-21 09:38:29 +00:00
|
|
|
{
|
2005-04-18 13:28:28 +00:00
|
|
|
// if anchor frame is directly inside a section, format this section and
|
|
|
|
// its previous frames.
|
|
|
|
// Note: It's a very simple format without formatting objects.
|
2005-11-17 15:34:04 +00:00
|
|
|
if ( _rAnchorTxtFrm.IsInSct() )
|
2005-01-21 09:38:29 +00:00
|
|
|
{
|
2005-11-17 15:34:04 +00:00
|
|
|
SwFrm* pSectFrm = _rAnchorTxtFrm.GetUpper();
|
2005-04-18 13:28:28 +00:00
|
|
|
while ( pSectFrm )
|
2005-01-21 09:38:29 +00:00
|
|
|
{
|
2005-04-18 13:28:28 +00:00
|
|
|
if ( pSectFrm->IsSctFrm() || pSectFrm->IsCellFrm() )
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pSectFrm = pSectFrm->GetUpper();
|
|
|
|
}
|
|
|
|
if ( pSectFrm && pSectFrm->IsSctFrm() )
|
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049#
|
2005-11-17 15:34:04 +00:00
|
|
|
_rAnchorTxtFrm.LockJoin();
|
2005-04-18 13:28:28 +00:00
|
|
|
SwFrm* pFrm = pSectFrm->GetUpper()->GetLower();
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i49605# - section frame could move forward
|
2005-07-08 10:04:17 +00:00
|
|
|
// by the format of its previous frame.
|
|
|
|
// Thus, check for valid <pFrm>.
|
|
|
|
while ( pFrm && pFrm != pSectFrm )
|
2005-04-18 13:28:28 +00:00
|
|
|
{
|
|
|
|
if ( pFrm->IsLayoutFrm() )
|
|
|
|
lcl_FormatCntntOfLayoutFrm( static_cast<SwLayoutFrm*>(pFrm) );
|
|
|
|
else
|
|
|
|
pFrm->Calc();
|
|
|
|
|
|
|
|
pFrm = pFrm->GetNext();
|
|
|
|
}
|
|
|
|
lcl_FormatCntntOfLayoutFrm( static_cast<SwLayoutFrm*>(pSectFrm),
|
2005-11-17 15:34:04 +00:00
|
|
|
&_rAnchorTxtFrm );
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049#
|
2005-11-17 15:34:04 +00:00
|
|
|
_rAnchorTxtFrm.UnlockJoin();
|
2005-01-21 09:38:29 +00:00
|
|
|
}
|
|
|
|
}
|
2005-04-18 13:28:28 +00:00
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i40140# - if anchor frame is inside a column,
|
2005-04-18 13:28:28 +00:00
|
|
|
// format the content of the previous columns.
|
|
|
|
// Note: It's a very simple format without formatting objects.
|
2005-11-17 15:34:04 +00:00
|
|
|
SwFrm* pColFrmOfAnchor = _rAnchorTxtFrm.FindColFrm();
|
2005-04-18 13:28:28 +00:00
|
|
|
if ( pColFrmOfAnchor )
|
2005-01-21 09:38:29 +00:00
|
|
|
{
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049#
|
2005-11-17 15:34:04 +00:00
|
|
|
_rAnchorTxtFrm.LockJoin();
|
2005-04-18 13:28:28 +00:00
|
|
|
SwFrm* pColFrm = pColFrmOfAnchor->GetUpper()->GetLower();
|
|
|
|
while ( pColFrm != pColFrmOfAnchor )
|
2005-01-21 09:38:29 +00:00
|
|
|
{
|
2005-04-18 13:28:28 +00:00
|
|
|
SwFrm* pFrm = pColFrm->GetLower();
|
|
|
|
while ( pFrm )
|
|
|
|
{
|
|
|
|
if ( pFrm->IsLayoutFrm() )
|
|
|
|
lcl_FormatCntntOfLayoutFrm( static_cast<SwLayoutFrm*>(pFrm) );
|
|
|
|
else
|
|
|
|
pFrm->Calc();
|
2005-01-21 09:38:29 +00:00
|
|
|
|
2005-04-18 13:28:28 +00:00
|
|
|
pFrm = pFrm->GetNext();
|
|
|
|
}
|
|
|
|
|
|
|
|
pColFrm = pColFrm->GetNext();
|
2005-01-21 09:38:29 +00:00
|
|
|
}
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i44049#
|
2005-11-17 15:34:04 +00:00
|
|
|
_rAnchorTxtFrm.UnlockJoin();
|
2005-01-21 09:38:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// format anchor frame - format of its follow not needed
|
2011-02-13 18:00:46 +01:00
|
|
|
// #i43255# - forbid follow format, only if anchor text
|
2005-04-18 10:29:57 +00:00
|
|
|
// frame is in table
|
2005-11-17 15:34:04 +00:00
|
|
|
if ( _rAnchorTxtFrm.IsInTab() )
|
2005-04-18 10:29:57 +00:00
|
|
|
{
|
2005-11-17 15:34:04 +00:00
|
|
|
SwForbidFollowFormat aForbidFollowFormat( _rAnchorTxtFrm );
|
|
|
|
_rAnchorTxtFrm.Calc();
|
2005-04-18 10:29:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-11-17 15:34:04 +00:00
|
|
|
_rAnchorTxtFrm.Calc();
|
2005-04-18 10:29:57 +00:00
|
|
|
}
|
2005-01-21 09:38:29 +00:00
|
|
|
}
|
2005-11-17 15:34:04 +00:00
|
|
|
|
|
|
|
/** method to format the anchor frame for checking of the move forward condition
|
|
|
|
|
2011-02-13 18:00:46 +01:00
|
|
|
#i40141#
|
2005-11-17 15:34:04 +00:00
|
|
|
*/
|
|
|
|
void SwObjectFormatterTxtFrm::_FormatAnchorFrmForCheckMoveFwd()
|
|
|
|
{
|
|
|
|
SwObjectFormatterTxtFrm::FormatAnchorFrmAndItsPrevs( mrAnchorTxtFrm );
|
|
|
|
}
|
|
|
|
|
2006-07-26 07:17:23 +00:00
|
|
|
/** method to determine if at least one anchored object has state
|
|
|
|
<temporarly consider wrapping style influence> set.
|
|
|
|
*/
|
|
|
|
bool SwObjectFormatterTxtFrm::_AtLeastOneObjIsTmpConsiderWrapInfluence()
|
|
|
|
{
|
|
|
|
bool bRet( false );
|
|
|
|
|
|
|
|
const SwSortedObjs* pObjs = GetAnchorFrm().GetDrawObjs();
|
|
|
|
if ( pObjs && pObjs->Count() > 1 )
|
|
|
|
{
|
|
|
|
sal_uInt32 i = 0;
|
|
|
|
for ( ; i < pObjs->Count(); ++i )
|
|
|
|
{
|
|
|
|
SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
|
|
|
|
if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
|
|
|
|
{
|
|
|
|
bRet = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|