2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 13:46:52 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:46:52 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:46:52 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:46:52 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:46:52 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:46:52 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 20:20:25 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "layouter.hxx"
|
|
|
|
#include "doc.hxx"
|
|
|
|
#include "sectfrm.hxx"
|
|
|
|
#include "ftnboss.hxx"
|
|
|
|
#include "cntfrm.hxx"
|
|
|
|
#include "pagefrm.hxx"
|
|
|
|
#include "ftnfrm.hxx"
|
2005-02-22 07:20:05 +00:00
|
|
|
#include "txtfrm.hxx"
|
|
|
|
|
2004-08-02 13:10:40 +00:00
|
|
|
// --> OD 2004-06-23 #i28701#
|
|
|
|
#include <movedfwdfrmsbyobjpos.hxx>
|
|
|
|
// <--
|
2004-11-16 14:47:13 +00:00
|
|
|
// --> OD 2004-10-22 #i35911#
|
|
|
|
#include <objstmpconsiderwrapinfl.hxx>
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-05-07 08:54:44 +00:00
|
|
|
#define LOOP_DETECT 250
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
class SwLooping
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nMinPage;
|
|
|
|
sal_uInt16 nMaxPage;
|
|
|
|
sal_uInt16 nCount;
|
|
|
|
sal_uInt16 mnLoopControlStage;
|
2000-09-18 23:08:29 +00:00
|
|
|
public:
|
|
|
|
SwLooping( SwPageFrm* pPage );
|
|
|
|
void Control( SwPageFrm* pPage );
|
2007-09-20 10:49:37 +00:00
|
|
|
void Drastic( SwFrm* pFrm );
|
2005-02-22 07:20:05 +00:00
|
|
|
bool IsLoopingLouieLight() const { return nCount > LOOP_DETECT - 30; };
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SwEndnoter
|
|
|
|
{
|
|
|
|
SwLayouter* pMaster;
|
|
|
|
SwSectionFrm* pSect;
|
|
|
|
SvPtrarr* pEndArr;
|
|
|
|
public:
|
|
|
|
SwEndnoter( SwLayouter* pLay )
|
|
|
|
: pMaster( pLay ), pSect( NULL ), pEndArr( NULL ) {}
|
|
|
|
~SwEndnoter() { delete pEndArr; }
|
|
|
|
void CollectEndnotes( SwSectionFrm* pSct );
|
|
|
|
void CollectEndnote( SwFtnFrm* pFtn );
|
2010-12-10 20:32:10 +00:00
|
|
|
const SwSectionFrm* GetSect() const { return pSect; }
|
2000-09-18 23:08:29 +00:00
|
|
|
void InsertEndnotes();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool HasEndnotes() const { return pEndArr && pEndArr->Count(); }
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void SwEndnoter::CollectEndnotes( SwSectionFrm* pSct )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pSct, "CollectEndnotes: Which section?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !pSect )
|
|
|
|
pSect = pSct;
|
|
|
|
else if( pSct != pSect )
|
|
|
|
return;
|
|
|
|
pSect->CollectEndnotes( pMaster );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
|
|
|
|
{
|
|
|
|
if( pEndArr && USHRT_MAX != pEndArr->GetPos( (VoidPtr)pFtn ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( pFtn->GetUpper() )
|
|
|
|
{
|
|
|
|
// pFtn is the master, he incorporates its follows
|
|
|
|
SwFtnFrm *pNxt = pFtn->GetFollow();
|
|
|
|
while ( pNxt )
|
|
|
|
{
|
|
|
|
SwFrm *pCnt = pNxt->ContainsAny();
|
|
|
|
if ( pCnt )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{ SwFrm *pNxtCnt = pCnt->GetNext();
|
|
|
|
pCnt->Cut();
|
|
|
|
pCnt->Paste( pFtn );
|
|
|
|
pCnt = pNxtCnt;
|
|
|
|
} while ( pCnt );
|
|
|
|
}
|
|
|
|
else
|
2010-11-25 17:08:45 +01:00
|
|
|
{ OSL_ENSURE( pNxt->Lower() && pNxt->Lower()->IsSctFrm(),
|
2000-09-18 23:08:29 +00:00
|
|
|
"Endnote without content?" );
|
|
|
|
pNxt->Cut();
|
|
|
|
delete pNxt;
|
|
|
|
}
|
|
|
|
pNxt = pFtn->GetFollow();
|
|
|
|
}
|
|
|
|
if( pFtn->GetMaster() )
|
|
|
|
return;
|
|
|
|
pFtn->Cut();
|
|
|
|
}
|
|
|
|
else if( pEndArr )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
for ( sal_uInt16 i = 0; i < pEndArr->Count(); ++i )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
SwFtnFrm *pEndFtn = (SwFtnFrm*)((*pEndArr)[i]);
|
|
|
|
if( pEndFtn->GetAttr() == pFtn->GetAttr() )
|
|
|
|
{
|
|
|
|
delete pFtn;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !pEndArr )
|
|
|
|
pEndArr = new SvPtrarr( 5, 5 ); // deleted from the SwLayouter
|
|
|
|
pEndArr->Insert( (VoidPtr)pFtn, pEndArr->Count() );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwEndnoter::InsertEndnotes()
|
|
|
|
{
|
|
|
|
if( !pSect )
|
|
|
|
return;
|
|
|
|
if( !pEndArr || !pEndArr->Count() )
|
|
|
|
{
|
|
|
|
pSect = NULL;
|
|
|
|
return;
|
|
|
|
}
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pSect->Lower() && pSect->Lower()->IsFtnBossFrm(),
|
2000-09-18 23:08:29 +00:00
|
|
|
"InsertEndnotes: Where's my column?" );
|
|
|
|
SwFrm* pRef = pSect->FindLastCntnt( FINDMODE_MYLAST );
|
|
|
|
SwFtnBossFrm *pBoss = pRef ? pRef->FindFtnBossFrm()
|
|
|
|
: (SwFtnBossFrm*)pSect->Lower();
|
|
|
|
pBoss->_MoveFtns( *pEndArr );
|
|
|
|
delete pEndArr;
|
|
|
|
pEndArr = NULL;
|
|
|
|
pSect = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLooping::SwLooping( SwPageFrm* pPage )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pPage, "Where's my page?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
nMinPage = pPage->GetPhyPageNum();
|
|
|
|
nMaxPage = nMinPage;
|
|
|
|
nCount = 0;
|
2007-09-20 10:49:37 +00:00
|
|
|
mnLoopControlStage = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwLooping::Drastic( SwFrm* pFrm )
|
|
|
|
{
|
|
|
|
while( pFrm )
|
|
|
|
{
|
2007-09-20 10:49:37 +00:00
|
|
|
pFrm->ValidateThisAndAllLowers( mnLoopControlStage );
|
2000-09-18 23:08:29 +00:00
|
|
|
pFrm = pFrm->GetNext();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLooping::Control( SwPageFrm* pPage )
|
|
|
|
{
|
|
|
|
if( !pPage )
|
|
|
|
return;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nNew = pPage->GetPhyPageNum();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( nNew > nMaxPage )
|
|
|
|
nMaxPage = nNew;
|
|
|
|
if( nNew < nMinPage )
|
|
|
|
{
|
|
|
|
nMinPage = nNew;
|
|
|
|
nMaxPage = nNew;
|
|
|
|
nCount = 0;
|
2007-09-20 10:49:37 +00:00
|
|
|
mnLoopControlStage = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if( nNew > nMinPage + 2 )
|
|
|
|
{
|
|
|
|
nMinPage = nNew - 2;
|
|
|
|
nMaxPage = nNew;
|
|
|
|
nCount = 0;
|
2007-09-20 10:49:37 +00:00
|
|
|
mnLoopControlStage = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if( ++nCount > LOOP_DETECT )
|
|
|
|
{
|
2003-04-15 15:51:39 +00:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2011-01-17 15:06:54 +01:00
|
|
|
static sal_Bool bNoLouie = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bNoLouie )
|
|
|
|
return;
|
2007-09-20 10:49:37 +00:00
|
|
|
|
|
|
|
// FME 2007-08-30 #i81146# new loop control
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( 0 != mnLoopControlStage, "Looping Louie: Stage 1!" );
|
|
|
|
OSL_ENSURE( 1 != mnLoopControlStage, "Looping Louie: Stage 2!!" );
|
|
|
|
OSL_ENSURE( 2 > mnLoopControlStage, "Looping Louie: Stage 3!!!" );
|
2007-09-20 10:49:37 +00:00
|
|
|
#endif
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
Drastic( pPage->Lower() );
|
|
|
|
if( nNew > nMinPage && pPage->GetPrev() )
|
|
|
|
Drastic( ((SwPageFrm*)pPage->GetPrev())->Lower() );
|
|
|
|
if( nNew < nMaxPage && pPage->GetNext() )
|
|
|
|
Drastic( ((SwPageFrm*)pPage->GetNext())->Lower() );
|
2007-09-20 10:49:37 +00:00
|
|
|
|
|
|
|
++mnLoopControlStage;
|
|
|
|
nCount = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwLayouter::SwLayouter()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2004-08-02 13:10:40 +00:00
|
|
|
SwLayouter::SwLayouter()
|
|
|
|
: pEndnoter( NULL ),
|
|
|
|
pLooping( NULL ),
|
|
|
|
// --> OD 2004-06-23 #i28701#
|
2004-11-16 14:47:13 +00:00
|
|
|
mpMovedFwdFrms( 0L ),
|
|
|
|
// <--
|
|
|
|
// --> OD 2004-10-22 #i35911#
|
|
|
|
mpObjsTmpConsiderWrapInfl( 0L )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLayouter::~SwLayouter()
|
|
|
|
{
|
|
|
|
delete pEndnoter;
|
|
|
|
delete pLooping;
|
2004-08-02 13:10:40 +00:00
|
|
|
// --> OD 2004-06-23 #i28701#
|
|
|
|
delete mpMovedFwdFrms;
|
2005-10-19 11:35:40 +00:00
|
|
|
mpMovedFwdFrms = 0L;
|
2004-11-16 14:47:13 +00:00
|
|
|
// <--
|
|
|
|
// --> OD 2004-10-22 #i35911#
|
|
|
|
delete mpObjsTmpConsiderWrapInfl;
|
2005-10-19 11:35:40 +00:00
|
|
|
mpObjsTmpConsiderWrapInfl = 0L;
|
2004-11-16 14:47:13 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::_CollectEndnotes( SwSectionFrm* pSect )
|
|
|
|
{
|
|
|
|
if( !pEndnoter )
|
|
|
|
pEndnoter = new SwEndnoter( this );
|
|
|
|
pEndnoter->CollectEndnotes( pSect );
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwLayouter::HasEndnotes() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
return pEndnoter->HasEndnotes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::CollectEndnote( SwFtnFrm* pFtn )
|
|
|
|
{
|
|
|
|
pEndnoter->CollectEndnote( pFtn );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::InsertEndnotes( SwSectionFrm* pSect )
|
|
|
|
{
|
|
|
|
if( !pEndnoter || pEndnoter->GetSect() != pSect )
|
|
|
|
return;
|
|
|
|
pEndnoter->InsertEndnotes();
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SwLayouter::LoopControl( SwPageFrm* pPage, sal_uInt8 )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pLooping, "Looping: Lost control" );
|
2000-09-18 23:08:29 +00:00
|
|
|
pLooping->Control( pPage );
|
|
|
|
}
|
|
|
|
|
2005-02-22 07:20:05 +00:00
|
|
|
void SwLayouter::LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm )
|
|
|
|
{
|
|
|
|
if ( pLooping && pLooping->IsLoopingLouieLight() )
|
|
|
|
{
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "Looping Louie (Light): Fixating fractious frame" );
|
2005-02-22 07:20:05 +00:00
|
|
|
#endif
|
|
|
|
SwLayouter::InsertMovedFwdFrm( rDoc, rFrm, rFrm.FindPageFrm()->GetPhyPageNum() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwLayouter::StartLooping( SwPageFrm* pPage )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( pLooping )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
pLooping = new SwLooping( pPage );
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::EndLoopControl()
|
|
|
|
{
|
|
|
|
delete pLooping;
|
|
|
|
pLooping = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pDoc, "No doc, no fun" );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !pDoc->GetLayouter() )
|
|
|
|
pDoc->SetLayouter( new SwLayouter() );
|
|
|
|
pDoc->GetLayouter()->_CollectEndnotes( pSect );
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwLayouter::Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( !pDoc->GetLayouter() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwLayouter *pLayouter = pDoc->GetLayouter();
|
|
|
|
if( pLayouter->pEndnoter && pLayouter->pEndnoter->GetSect() && pSect &&
|
|
|
|
( pLayouter->pEndnoter->GetSect()->IsAnFollow( pSect ) ||
|
|
|
|
pSect->IsAnFollow( pLayouter->pEndnoter->GetSect() ) ) )
|
|
|
|
{
|
|
|
|
if( pFtn )
|
|
|
|
pLayouter->CollectEndnote( pFtn );
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwLayouter::StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pDoc, "No doc, no fun" );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !pDoc->GetLayouter() )
|
|
|
|
pDoc->SetLayouter( new SwLayouter() );
|
|
|
|
return !pDoc->GetLayouter()->pLooping &&
|
|
|
|
pDoc->GetLayouter()->StartLooping( pPage );
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:10:40 +00:00
|
|
|
// --> OD 2004-06-23 #i28701#
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// methods to manage text frames, which are moved forward by the positioning
|
|
|
|
// of its anchored objects
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void SwLayouter::ClearMovedFwdFrms( const SwDoc& _rDoc )
|
|
|
|
{
|
|
|
|
if ( _rDoc.GetLayouter() &&
|
|
|
|
_rDoc.GetLayouter()->mpMovedFwdFrms )
|
|
|
|
{
|
|
|
|
_rDoc.GetLayouter()->mpMovedFwdFrms->Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::InsertMovedFwdFrm( const SwDoc& _rDoc,
|
|
|
|
const SwTxtFrm& _rMovedFwdFrmByObjPos,
|
|
|
|
const sal_uInt32 _nToPageNum )
|
|
|
|
{
|
|
|
|
if ( !_rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(_rDoc).SetLayouter( new SwLayouter() );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !_rDoc.GetLayouter()->mpMovedFwdFrms )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(_rDoc).GetLayouter()->mpMovedFwdFrms =
|
|
|
|
new SwMovedFwdFrmsByObjPos();
|
|
|
|
}
|
|
|
|
|
|
|
|
_rDoc.GetLayouter()->mpMovedFwdFrms->Insert( _rMovedFwdFrmByObjPos,
|
|
|
|
_nToPageNum );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2005-01-21 09:35:39 +00:00
|
|
|
// --> OD 2005-01-12 #i40155#
|
|
|
|
void SwLayouter::RemoveMovedFwdFrm( const SwDoc& _rDoc,
|
|
|
|
const SwTxtFrm& _rTxtFrm )
|
|
|
|
{
|
|
|
|
sal_uInt32 nDummy;
|
|
|
|
if ( SwLayouter::FrmMovedFwdByObjPos( _rDoc, _rTxtFrm, nDummy ) )
|
|
|
|
{
|
|
|
|
_rDoc.GetLayouter()->mpMovedFwdFrms->Remove( _rTxtFrm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2004-08-02 13:10:40 +00:00
|
|
|
bool SwLayouter::FrmMovedFwdByObjPos( const SwDoc& _rDoc,
|
|
|
|
const SwTxtFrm& _rTxtFrm,
|
|
|
|
sal_uInt32& _ornToPageNum )
|
|
|
|
{
|
|
|
|
if ( !_rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
_ornToPageNum = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if ( !_rDoc.GetLayouter()->mpMovedFwdFrms )
|
|
|
|
{
|
|
|
|
_ornToPageNum = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return _rDoc.GetLayouter()->mpMovedFwdFrms->
|
|
|
|
FrmMovedFwdByObjPos( _rTxtFrm, _ornToPageNum );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
2004-11-16 14:47:13 +00:00
|
|
|
// --> OD 2004-10-05 #i26945#
|
|
|
|
bool SwLayouter::DoesRowContainMovedFwdFrm( const SwDoc& _rDoc,
|
|
|
|
const SwRowFrm& _rRowFrm )
|
|
|
|
{
|
|
|
|
if ( !_rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if ( !_rDoc.GetLayouter()->mpMovedFwdFrms )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return _rDoc.GetLayouter()->
|
|
|
|
mpMovedFwdFrms->DoesRowContainMovedFwdFrm( _rRowFrm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
|
|
|
// --> OD 2004-10-22 #i35911#
|
|
|
|
void SwLayouter::ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc )
|
|
|
|
{
|
|
|
|
if ( _rDoc.GetLayouter() &&
|
|
|
|
_rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl )
|
|
|
|
{
|
|
|
|
_rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl->Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void SwLayouter::InsertObjForTmpConsiderWrapInfluence(
|
|
|
|
const SwDoc& _rDoc,
|
|
|
|
SwAnchoredObject& _rAnchoredObj )
|
|
|
|
{
|
|
|
|
if ( !_rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(_rDoc).SetLayouter( new SwLayouter() );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !_rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(_rDoc).GetLayouter()->mpObjsTmpConsiderWrapInfl =
|
|
|
|
new SwObjsMarkedAsTmpConsiderWrapInfluence();
|
|
|
|
}
|
|
|
|
|
|
|
|
_rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj );
|
|
|
|
}
|
|
|
|
// <--
|
2005-01-21 09:35:39 +00:00
|
|
|
// --> OD 2005-01-12 #i40155#
|
|
|
|
void SwLayouter::ClearFrmsNotToWrap( const SwDoc& _rDoc )
|
|
|
|
{
|
|
|
|
if ( _rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(_rDoc).GetLayouter()->maFrmsNotToWrap.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::InsertFrmNotToWrap( const SwDoc& _rDoc,
|
|
|
|
const SwFrm& _rFrm )
|
|
|
|
{
|
|
|
|
if ( !_rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(_rDoc).SetLayouter( new SwLayouter() );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !SwLayouter::FrmNotToWrap( _rDoc, _rFrm ) )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(_rDoc).GetLayouter()->maFrmsNotToWrap.push_back( &_rFrm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-14 15:27:49 +00:00
|
|
|
bool SwLayouter::FrmNotToWrap( const IDocumentLayoutAccess& _rDLA,
|
|
|
|
const SwFrm& _rFrm )
|
2005-01-21 09:35:39 +00:00
|
|
|
{
|
2006-08-14 15:27:49 +00:00
|
|
|
const SwLayouter* pLayouter = _rDLA.GetLayouter();
|
|
|
|
if ( !pLayouter )
|
2005-01-21 09:35:39 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool bFrmNotToWrap( false );
|
|
|
|
std::vector< const SwFrm* >::const_iterator aIter =
|
2006-08-14 15:27:49 +00:00
|
|
|
pLayouter->maFrmsNotToWrap.begin();
|
|
|
|
for ( ; aIter != pLayouter->maFrmsNotToWrap.end(); ++aIter )
|
2005-01-21 09:35:39 +00:00
|
|
|
{
|
|
|
|
const SwFrm* pFrm = *(aIter);
|
|
|
|
if ( pFrm == &_rFrm )
|
|
|
|
{
|
|
|
|
bFrmNotToWrap = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bFrmNotToWrap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
2005-02-22 07:20:05 +00:00
|
|
|
|
|
|
|
void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm )
|
|
|
|
{
|
|
|
|
if ( bCondition )
|
|
|
|
{
|
|
|
|
const SwDoc& rDoc = *rTxtFrm.GetAttrSet()->GetDoc();
|
|
|
|
if ( rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(rDoc).GetLayouter()->LoopingLouieLight( rDoc, rTxtFrm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-06-02 11:12:09 +00:00
|
|
|
|
|
|
|
// --> OD 2006-05-10 #i65250#
|
|
|
|
bool SwLayouter::MoveBwdSuppressed( const SwDoc& p_rDoc,
|
|
|
|
const SwFlowFrm& p_rFlowFrm,
|
|
|
|
const SwLayoutFrm& p_rNewUpperFrm )
|
|
|
|
{
|
|
|
|
bool bMoveBwdSuppressed( false );
|
|
|
|
|
|
|
|
if ( !p_rDoc.GetLayouter() )
|
|
|
|
{
|
|
|
|
const_cast<SwDoc&>(p_rDoc).SetLayouter( new SwLayouter() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// create hash map key
|
|
|
|
tMoveBwdLayoutInfoKey aMoveBwdLayoutInfo;
|
|
|
|
aMoveBwdLayoutInfo.mnFrmId = p_rFlowFrm.GetFrm()->GetFrmId();
|
|
|
|
aMoveBwdLayoutInfo.mnNewUpperPosX = p_rNewUpperFrm.Frm().Pos().X();
|
|
|
|
aMoveBwdLayoutInfo.mnNewUpperPosY = p_rNewUpperFrm.Frm().Pos().Y();
|
|
|
|
aMoveBwdLayoutInfo.mnNewUpperWidth = p_rNewUpperFrm.Frm().Width();
|
|
|
|
aMoveBwdLayoutInfo.mnNewUpperHeight = p_rNewUpperFrm.Frm().Height();
|
|
|
|
SWRECTFN( (&p_rNewUpperFrm) )
|
|
|
|
const SwFrm* pLastLower( p_rNewUpperFrm.Lower() );
|
|
|
|
while ( pLastLower && pLastLower->GetNext() )
|
|
|
|
{
|
|
|
|
pLastLower = pLastLower->GetNext();
|
|
|
|
}
|
|
|
|
aMoveBwdLayoutInfo.mnFreeSpaceInNewUpper =
|
|
|
|
pLastLower
|
|
|
|
? (pLastLower->Frm().*fnRect->fnBottomDist)( (p_rNewUpperFrm.*fnRect->fnGetPrtBottom)() )
|
|
|
|
: (p_rNewUpperFrm.Frm().*fnRect->fnGetHeight)();
|
|
|
|
|
|
|
|
// check for moving backward suppress threshold
|
|
|
|
const sal_uInt16 cMoveBwdCountSuppressThreshold = 20;
|
|
|
|
if ( ++const_cast<SwDoc&>(p_rDoc).GetLayouter()->maMoveBwdLayoutInfo[ aMoveBwdLayoutInfo ] >
|
|
|
|
cMoveBwdCountSuppressThreshold )
|
|
|
|
{
|
|
|
|
bMoveBwdSuppressed = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bMoveBwdSuppressed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLayouter::ClearMoveBwdLayoutInfo( const SwDoc& _rDoc )
|
|
|
|
{
|
|
|
|
if ( _rDoc.GetLayouter() )
|
|
|
|
const_cast<SwDoc&>(_rDoc).GetLayouter()->maMoveBwdLayoutInfo.clear();
|
|
|
|
}
|
|
|
|
// <--
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|