2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 13:41:58 +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:41:58 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:41:58 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:41:58 +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:41:58 +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:41:58 +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:16:49 +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 "rootfrm.hxx"
|
|
|
|
#include "pagefrm.hxx"
|
|
|
|
#include "cntfrm.hxx"
|
|
|
|
#include "viewsh.hxx"
|
|
|
|
#include "doc.hxx"
|
|
|
|
#include "viewimp.hxx"
|
|
|
|
#include "swtypes.hxx"
|
|
|
|
#include "dflyobj.hxx"
|
|
|
|
#include "dcontact.hxx"
|
|
|
|
#include "flyfrm.hxx"
|
|
|
|
#include "frmtool.hxx"
|
|
|
|
#include "txtftn.hxx"
|
|
|
|
#include "fmtftn.hxx"
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/ulspitem.hxx>
|
|
|
|
#include <editeng/keepitem.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
#include <vcl/outdev.hxx>
|
|
|
|
#include <fmtfsize.hxx>
|
|
|
|
#include <fmtanchr.hxx>
|
2003-03-27 14:45:43 +00:00
|
|
|
#include <fmtclbl.hxx>
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "tabfrm.hxx"
|
|
|
|
#include "ftnfrm.hxx"
|
|
|
|
#include "txtfrm.hxx"
|
|
|
|
#include "pagedesc.hxx"
|
|
|
|
#include "ftninfo.hxx"
|
|
|
|
#include "sectfrm.hxx"
|
|
|
|
#include "dbg_lay.hxx"
|
|
|
|
|
2004-08-02 13:07:59 +00:00
|
|
|
// --> OD 2004-06-23 #i28701#
|
|
|
|
#include <sortedobjs.hxx>
|
|
|
|
#include <layouter.hxx>
|
2004-11-16 14:44:27 +00:00
|
|
|
// --> OD 2004-11-01 #i36347#
|
|
|
|
#include <flyfrms.hxx>
|
|
|
|
// <--
|
2002-11-11 08:40:33 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Move-Methoden
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwCntntFrm::ShouldBwdMoved()
|
|
|
|
|*
|
|
|
|
|* Beschreibung Returnwert sagt, ob der Frm verschoben werden sollte.
|
|
|
|
|* Ersterstellung MA 05. Dec. 96
|
|
|
|
|* Letzte Aenderung MA 05. Dec. 96
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
BOOL SwCntntFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL & )
|
|
|
|
{
|
|
|
|
if ( (SwFlowFrm::IsMoveBwdJump() || !IsPrevObjMove()))
|
|
|
|
{
|
|
|
|
//Das zurueckfliessen von Frm's ist leider etwas Zeitintensiv.
|
|
|
|
//Der haufigste Fall ist der, dass dort wo der Frm hinfliessen
|
|
|
|
//moechte die FixSize die gleiche ist, die der Frm selbst hat.
|
|
|
|
//In diesem Fall kann einfach geprueft werden, ob der Frm genug
|
|
|
|
//Platz fuer seine VarSize findet, ist dies nicht der Fall kann
|
|
|
|
//gleich auf das Verschieben verzichtet werden.
|
|
|
|
//Die Pruefung, ob der Frm genug Platz findet fuehrt er selbst
|
|
|
|
//durch, dabei wird beruecksichtigt, dass er sich moeglicherweise
|
|
|
|
//aufspalten kann.
|
|
|
|
//Wenn jedoch die FixSize eine andere ist oder Flys im Spiel sind
|
|
|
|
//(an der alten oder neuen Position) hat alle Prueferei keinen Sinn
|
|
|
|
//der Frm muss dann halt Probehalber verschoben werden (Wenn ueberhaupt
|
|
|
|
//etwas Platz zur Verfuegung steht).
|
|
|
|
|
|
|
|
//Die FixSize der Umgebungen in denen Cntnts herumlungern ist immer
|
|
|
|
//Die Breite.
|
|
|
|
|
|
|
|
//Wenn mehr als ein Blatt zurueckgegangen wurde (z.B. ueberspringen
|
|
|
|
//von Leerseiten), so muss in jedemfall gemoved werden - sonst wuerde,
|
|
|
|
//falls der Frm nicht in das Blatt passt, nicht mehr auf die
|
|
|
|
//dazwischenliegenden Blaetter geachtet werden.
|
|
|
|
BYTE nMoveAnyway = 0;
|
|
|
|
SwPageFrm * const pNewPage = pNewUpper->FindPageFrm();
|
|
|
|
SwPageFrm *pOldPage = FindPageFrm();
|
|
|
|
|
|
|
|
if ( SwFlowFrm::IsMoveBwdJump() )
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if( IsInFtn() && IsInSct() )
|
|
|
|
{
|
|
|
|
SwFtnFrm* pFtn = FindFtnFrm();
|
|
|
|
SwSectionFrm* pMySect = pFtn->FindSctFrm();
|
|
|
|
if( pMySect && pMySect->IsFtnLock() )
|
|
|
|
{
|
|
|
|
SwSectionFrm *pSect = pNewUpper->FindSctFrm();
|
|
|
|
while( pSect && pSect->IsInFtn() )
|
|
|
|
pSect = pSect->GetUpper()->FindSctFrm();
|
|
|
|
ASSERT( pSect, "Escaping footnote" );
|
|
|
|
if( pSect != pMySect )
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2001-10-05 11:36:10 +00:00
|
|
|
SWRECTFN( this )
|
2001-11-14 13:40:22 +00:00
|
|
|
SWRECTFNX( pNewUpper )
|
|
|
|
if( Abs( (pNewUpper->Prt().*fnRectX->fnGetWidth)() -
|
2001-09-13 14:26:42 +00:00
|
|
|
(GetUpper()->Prt().*fnRect->fnGetWidth)() ) > 1 )
|
2000-09-18 23:08:29 +00:00
|
|
|
nMoveAnyway = 2; // Damit kommt nur noch ein _WouldFit mit Umhaengen in Frage
|
2004-06-28 11:59:21 +00:00
|
|
|
|
|
|
|
// OD 2004-05-26 #i25904# - do *not* move backward,
|
|
|
|
// if <nMoveAnyway> equals 3 and no space is left in new upper.
|
|
|
|
nMoveAnyway |= BwdMoveNecessary( pOldPage, Frm() );
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2006-08-14 15:25:09 +00:00
|
|
|
const IDocumentSettingAccess* pIDSA = pNewPage->GetFmt()->getIDocumentSettingAccess();
|
2000-09-18 23:08:29 +00:00
|
|
|
SwTwips nSpace = 0;
|
|
|
|
SwRect aRect( pNewUpper->Prt() );
|
|
|
|
aRect.Pos() += pNewUpper->Frm().Pos();
|
|
|
|
const SwFrm *pPrevFrm = pNewUpper->Lower();
|
|
|
|
while ( pPrevFrm )
|
|
|
|
{
|
2004-03-23 10:36:45 +00:00
|
|
|
SwTwips nNewTop = (pPrevFrm->Frm().*fnRectX->fnGetBottom)();
|
|
|
|
// OD 2004-03-01 #106629#:
|
|
|
|
// consider lower spacing of last frame in a table cell
|
|
|
|
{
|
|
|
|
// check, if last frame is inside table and if it includes
|
|
|
|
// its lower spacing.
|
|
|
|
if ( !pPrevFrm->GetNext() && pPrevFrm->IsInTab() &&
|
2006-08-14 15:25:09 +00:00
|
|
|
pIDSA->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) )
|
2004-03-23 10:36:45 +00:00
|
|
|
{
|
|
|
|
const SwFrm* pLastFrm = pPrevFrm;
|
|
|
|
// if last frame is a section, take its last content
|
|
|
|
if ( pPrevFrm->IsSctFrm() )
|
|
|
|
{
|
|
|
|
pLastFrm = static_cast<const SwSectionFrm*>(pPrevFrm)->FindLastCntnt();
|
|
|
|
if ( pLastFrm &&
|
|
|
|
pLastFrm->FindTabFrm() != pPrevFrm->FindTabFrm() )
|
|
|
|
{
|
|
|
|
pLastFrm = pLastFrm->FindTabFrm();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pLastFrm )
|
|
|
|
{
|
|
|
|
SwBorderAttrAccess aAccess( SwFrm::GetCache(), pLastFrm );
|
|
|
|
const SwBorderAttrs& rAttrs = *aAccess.Get();
|
|
|
|
nNewTop -= rAttrs.GetULSpace().GetLower();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
(aRect.*fnRectX->fnSetTop)( nNewTop );
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
pPrevFrm = pPrevFrm->GetNext();
|
|
|
|
}
|
|
|
|
|
|
|
|
nMoveAnyway |= BwdMoveNecessary( pNewPage, aRect);
|
2004-01-13 10:14:29 +00:00
|
|
|
|
2004-06-28 11:59:21 +00:00
|
|
|
//determine space left in new upper frame
|
|
|
|
nSpace = (aRect.*fnRectX->fnGetHeight)();
|
2004-01-13 10:14:29 +00:00
|
|
|
|
2006-08-14 15:25:09 +00:00
|
|
|
if ( IsInFtn() ||
|
|
|
|
pIDSA->get(IDocumentSettingAccess::BROWSE_MODE) ||
|
2004-06-28 11:59:21 +00:00
|
|
|
pNewUpper->IsCellFrm() ||
|
|
|
|
( pNewUpper->IsInSct() && ( pNewUpper->IsSctFrm() ||
|
|
|
|
( pNewUpper->IsColBodyFrm() &&
|
|
|
|
!pNewUpper->GetUpper()->GetPrev() &&
|
|
|
|
!pNewUpper->GetUpper()->GetNext() ) ) ) )
|
2007-02-28 14:47:09 +00:00
|
|
|
nSpace += pNewUpper->Grow( LONG_MAX, TRUE );
|
2004-06-28 11:59:21 +00:00
|
|
|
|
|
|
|
if ( nMoveAnyway < 3 )
|
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( nSpace )
|
|
|
|
{
|
|
|
|
//Keine Beruecksichtigung der Fussnoten die an dem Absatz
|
|
|
|
//kleben, denn dies wuerde extrem unuebersichtlichen Code
|
|
|
|
//beduerfen (wg. Beruecksichtung der Breiten und vor allem
|
|
|
|
//der Flys, die ja wieder Einfluss auf die Fussnoten nehmen...).
|
|
|
|
|
|
|
|
// _WouldFit kann bei gleicher Breite und _nur_ selbst verankerten Flys
|
|
|
|
// befragt werden.
|
|
|
|
// _WouldFit kann auch gefragt werden, wenn _nur_ fremdverankerte Flys vorliegen,
|
|
|
|
// dabei ist sogar die Breite egal, da ein TestFormat in der neuen Umgebung
|
|
|
|
// vorgenommen wird.
|
2008-01-04 12:21:28 +00:00
|
|
|
// --> OD 2007-11-26 #b6614158#
|
|
|
|
const BYTE nBwdMoveNecessaryResult =
|
|
|
|
BwdMoveNecessary( pNewPage, aRect);
|
|
|
|
const bool bObjsInNewUpper( nBwdMoveNecessaryResult == 2 ||
|
|
|
|
nBwdMoveNecessaryResult == 3 );
|
|
|
|
|
|
|
|
return _WouldFit( nSpace, pNewUpper, nMoveAnyway == 2,
|
|
|
|
bObjsInNewUpper );
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
//Bei einem spaltigen Bereichsfrischling kann _WouldFit kein
|
|
|
|
//brauchbares Ergebnis liefern, also muessen wir wirklich
|
|
|
|
//zurueckfliessen
|
|
|
|
else if( pNewUpper->IsInSct() && pNewUpper->IsColBodyFrm() &&
|
2001-11-14 13:40:22 +00:00
|
|
|
!(pNewUpper->Prt().*fnRectX->fnGetWidth)() &&
|
2000-09-18 23:08:29 +00:00
|
|
|
( pNewUpper->GetUpper()->GetPrev() ||
|
|
|
|
pNewUpper->GetUpper()->GetNext() ) )
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE; // Kein Platz, dann ist es sinnlos, zurueckzufliessen
|
|
|
|
}
|
2004-06-28 11:59:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// OD 2004-05-26 #i25904# - check for space left in new upper
|
|
|
|
if ( nSpace )
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Calc-Methoden
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFrm::Prepare()
|
|
|
|
|*
|
|
|
|
|* Beschreibung Bereitet den Frm auf die 'Formatierung' (MakeAll())
|
|
|
|
|* vor. Diese Methode dient dazu auf dem Stack Platz einzusparen,
|
|
|
|
|* denn zur Positionsberechnung des Frm muss sichergestellt sein, dass
|
|
|
|
|* die Position von Upper und Prev gueltig sind, mithin also ein
|
|
|
|
|* rekursiver Aufruf (Schleife waere relativ teuer, da selten notwendig).
|
|
|
|
|* Jeder Aufruf von MakeAll verbraucht aber ca. 500Byte Stack -
|
|
|
|
|* das Ende ist leicht abzusehen. _Prepare benoetigt nur wenig Stack,
|
|
|
|
|* deshalb solle der Rekursive Aufruf hier kein Problem sein.
|
|
|
|
|* Ein weiterer Vorteil ist, das eines schoenen Tages das _Prepare und
|
|
|
|
|* damit die Formatierung von Vorgaengern umgangen werden kann.
|
|
|
|
|* So kann evtl. mal 'schnell' an's Dokumentende gesprungen werden.
|
|
|
|
|* Ersterstellung MA ??
|
|
|
|
|* Letzte Aenderung MA 13. Dec. 93
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
//Zwei kleine Freundschaften werden hier zu einem Geheimbund.
|
|
|
|
inline void PrepareLock( SwFlowFrm *pTab )
|
|
|
|
{
|
|
|
|
pTab->LockJoin();
|
|
|
|
}
|
|
|
|
inline void PrepareUnlock( SwFlowFrm *pTab )
|
|
|
|
{
|
|
|
|
pTab->UnlockJoin();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-06-01 06:43:32 +00:00
|
|
|
// hopefully, one day this function simply will return 'false'
|
|
|
|
bool lcl_IsCalcUpperAllowed( const SwFrm& rFrm )
|
|
|
|
{
|
|
|
|
return !rFrm.GetUpper()->IsSctFrm() &&
|
|
|
|
!rFrm.GetUpper()->IsFooterFrm() &&
|
2004-11-16 14:44:27 +00:00
|
|
|
// --> OD 2004-11-02 #i23129#, #i36347# - no format of upper Writer fly frame
|
|
|
|
!rFrm.GetUpper()->IsFlyFrm() &&
|
|
|
|
// <--
|
2004-06-01 06:43:32 +00:00
|
|
|
!( rFrm.GetUpper()->IsTabFrm() && rFrm.GetUpper()->GetUpper()->IsInTab() ) &&
|
|
|
|
!( rFrm.IsTabFrm() && rFrm.GetUpper()->IsInTab() );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
void SwFrm::PrepareMake()
|
|
|
|
{
|
|
|
|
StackHack aHack;
|
|
|
|
if ( GetUpper() )
|
|
|
|
{
|
2004-06-01 06:43:32 +00:00
|
|
|
if ( lcl_IsCalcUpperAllowed( *this ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
GetUpper()->Calc();
|
|
|
|
ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." );
|
|
|
|
if ( !GetUpper() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
const BOOL bCnt = IsCntntFrm();
|
|
|
|
const BOOL bTab = IsTabFrm();
|
|
|
|
BOOL bNoSect = IsInSct();
|
|
|
|
BOOL bOldTabLock = FALSE, bFoll = FALSE;
|
|
|
|
SwFlowFrm* pThis = bCnt ? (SwCntntFrm*)this : NULL;
|
|
|
|
|
|
|
|
if ( bTab )
|
|
|
|
{
|
|
|
|
pThis = (SwTabFrm*)this;
|
|
|
|
bOldTabLock = ((SwTabFrm*)this)->IsJoinLocked();
|
|
|
|
::PrepareLock( (SwTabFrm*)this );
|
|
|
|
bFoll = pThis->IsFollow();
|
|
|
|
}
|
|
|
|
else if( IsSctFrm() )
|
|
|
|
{
|
|
|
|
pThis = (SwSectionFrm*)this;
|
|
|
|
bFoll = pThis->IsFollow();
|
|
|
|
bNoSect = FALSE;
|
|
|
|
}
|
|
|
|
else if ( bCnt && TRUE == (bFoll = pThis->IsFollow()) &&
|
|
|
|
GetPrev() )
|
|
|
|
{
|
|
|
|
//Wenn der Master gereade ein CalcFollow ruft braucht die Kette
|
|
|
|
//nicht durchlaufen werden. Das spart Zeit und vermeidet Probleme.
|
|
|
|
if ( ((SwTxtFrm*)((SwTxtFrm*)this)->FindMaster())->IsLocked() )
|
|
|
|
{
|
|
|
|
MakeAll();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-23 11:58:48 +00:00
|
|
|
// --> OD 2005-03-04 #i44049# - no format of previous frame, if current
|
|
|
|
// frame is a table frame and its previous frame wants to keep with it.
|
|
|
|
const bool bFormatPrev = !bTab ||
|
|
|
|
!GetPrev() ||
|
|
|
|
!GetPrev()->GetAttrSet()->GetKeep().GetValue();
|
|
|
|
if ( bFormatPrev )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2005-03-23 11:58:48 +00:00
|
|
|
SwFrm *pFrm = GetUpper()->Lower();
|
|
|
|
while ( pFrm != this )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2005-03-23 11:58:48 +00:00
|
|
|
ASSERT( pFrm, ":-( Layoutgeruest wackelig (this not found)." );
|
|
|
|
if ( !pFrm )
|
|
|
|
return; //Oioioioi ...
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2005-03-23 11:58:48 +00:00
|
|
|
if ( !pFrm->IsValid() )
|
|
|
|
{
|
|
|
|
//Ein kleiner Eingriff der hoffentlich etwas zur Verbesserung
|
|
|
|
//der Stabilitaet beitraegt:
|
|
|
|
//Wenn ich Follow _und_ Nachbar eines Frms vor mir bin,
|
|
|
|
//so wuerde dieser mich beim Formatieren deleten; wie jeder
|
|
|
|
//leicht sehen kann waere dies eine etwas unuebersichtliche
|
|
|
|
//Situation die es zu vermeiden gilt.
|
|
|
|
if ( bFoll && pFrm->IsFlowFrm() &&
|
|
|
|
(SwFlowFrm::CastFlowFrm(pFrm))->IsAnFollow( pThis ) )
|
|
|
|
break;
|
|
|
|
|
|
|
|
//MA: 24. Mar. 94, Calc wuerde doch nur wieder in ein _Prepare laufen und so
|
|
|
|
//die ganze Kette nocheinmal abhuenern.
|
|
|
|
// pFrm->Calc();
|
|
|
|
pFrm->MakeAll();
|
|
|
|
if( IsSctFrm() && !((SwSectionFrm*)this)->GetSection() )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
//Die Kette kann bei CntntFrms waehrend des durchlaufens
|
|
|
|
//aufgebrochen werden, deshalb muss der Nachfolger etwas
|
|
|
|
//umstaendlich ermittelt werden. However, irgendwann _muss_
|
|
|
|
//ich wieder bei mir selbst ankommen.
|
|
|
|
pFrm = pFrm->FindNext();
|
|
|
|
|
|
|
|
//Wenn wir in einem SectionFrm gestartet sind, koennen wir durch die
|
|
|
|
//MakeAll-Aufrufe in einen Section-Follow gewandert sein.
|
|
|
|
//FindNext liefert allerdings den SectionFrm, nicht seinen Inhalt.
|
|
|
|
// => wir finden uns selbst nicht mehr!
|
|
|
|
if( bNoSect && pFrm && pFrm->IsSctFrm() )
|
|
|
|
{
|
|
|
|
SwFrm* pCnt = ((SwSectionFrm*)pFrm)->ContainsAny();
|
|
|
|
if( pCnt )
|
|
|
|
pFrm = pCnt;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2005-03-23 11:58:48 +00:00
|
|
|
ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech II)." );
|
|
|
|
if ( !GetUpper() )
|
|
|
|
return;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2005-03-23 11:58:48 +00:00
|
|
|
if ( lcl_IsCalcUpperAllowed( *this ) )
|
|
|
|
GetUpper()->Calc();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2005-03-23 11:58:48 +00:00
|
|
|
ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech III)." );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( bTab && !bOldTabLock )
|
|
|
|
::PrepareUnlock( (SwTabFrm*)this );
|
|
|
|
}
|
|
|
|
MakeAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwFrm::OptPrepareMake()
|
|
|
|
{
|
2004-11-16 14:44:27 +00:00
|
|
|
// --> OD 2004-11-02 #i23129#, #i36347# - no format of upper Writer fly frame
|
|
|
|
if ( GetUpper() && !GetUpper()->IsFooterFrm() &&
|
|
|
|
!GetUpper()->IsFlyFrm() )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
GetUpper()->Calc();
|
|
|
|
ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." );
|
|
|
|
if ( !GetUpper() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ( GetPrev() && !GetPrev()->IsValid() )
|
|
|
|
PrepareMake();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StackHack aHack;
|
|
|
|
MakeAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwFrm::PrepareCrsr()
|
|
|
|
{
|
|
|
|
StackHack aHack;
|
|
|
|
if( GetUpper() && !GetUpper()->IsSctFrm() )
|
|
|
|
{
|
|
|
|
GetUpper()->PrepareCrsr();
|
|
|
|
GetUpper()->Calc();
|
|
|
|
|
|
|
|
ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." );
|
|
|
|
if ( !GetUpper() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
const BOOL bCnt = IsCntntFrm();
|
|
|
|
const BOOL bTab = IsTabFrm();
|
|
|
|
BOOL bNoSect = IsInSct();
|
|
|
|
|
|
|
|
BOOL bOldTabLock = FALSE, bFoll;
|
|
|
|
SwFlowFrm* pThis = bCnt ? (SwCntntFrm*)this : NULL;
|
|
|
|
|
|
|
|
if ( bTab )
|
|
|
|
{
|
|
|
|
bOldTabLock = ((SwTabFrm*)this)->IsJoinLocked();
|
|
|
|
::PrepareLock( (SwTabFrm*)this );
|
|
|
|
pThis = (SwTabFrm*)this;
|
|
|
|
}
|
|
|
|
else if( IsSctFrm() )
|
|
|
|
{
|
|
|
|
pThis = (SwSectionFrm*)this;
|
|
|
|
bNoSect = FALSE;
|
|
|
|
}
|
|
|
|
bFoll = pThis && pThis->IsFollow();
|
|
|
|
|
|
|
|
SwFrm *pFrm = GetUpper()->Lower();
|
|
|
|
while ( pFrm != this )
|
|
|
|
{
|
|
|
|
ASSERT( pFrm, ":-( Layoutgeruest wackelig (this not found)." );
|
|
|
|
if ( !pFrm )
|
|
|
|
return; //Oioioioi ...
|
|
|
|
|
|
|
|
if ( !pFrm->IsValid() )
|
|
|
|
{
|
|
|
|
//Ein kleiner Eingriff der hoffentlich etwas zur Verbesserung
|
|
|
|
//der Stabilitaet beitraegt:
|
|
|
|
//Wenn ich Follow _und_ Nachbar eines Frms vor mir bin,
|
|
|
|
//so wuerde dieser mich beim Formatieren deleten; wie jeder
|
|
|
|
//leicht sehen kann waere dies eine etwas unuebersichtliche
|
|
|
|
//Situation die es zu vermeiden gilt.
|
|
|
|
if ( bFoll && pFrm->IsFlowFrm() &&
|
|
|
|
(SwFlowFrm::CastFlowFrm(pFrm))->IsAnFollow( pThis ) )
|
|
|
|
break;
|
|
|
|
|
|
|
|
pFrm->MakeAll();
|
|
|
|
}
|
|
|
|
//Die Kette kann bei CntntFrms waehrend des durchlaufens
|
|
|
|
//aufgebrochen werden, deshalb muss der Nachfolger etwas
|
|
|
|
//umstaendlich ermittelt werden. However, irgendwann _muss_
|
|
|
|
//ich wieder bei mir selbst ankommen.
|
|
|
|
pFrm = pFrm->FindNext();
|
|
|
|
if( bNoSect && pFrm && pFrm->IsSctFrm() )
|
|
|
|
{
|
|
|
|
SwFrm* pCnt = ((SwSectionFrm*)pFrm)->ContainsAny();
|
|
|
|
if( pCnt )
|
|
|
|
pFrm = pCnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech II)." );
|
|
|
|
if ( !GetUpper() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetUpper()->Calc();
|
|
|
|
|
|
|
|
ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech III)." );
|
|
|
|
|
|
|
|
if ( bTab && !bOldTabLock )
|
|
|
|
::PrepareUnlock( (SwTabFrm*)this );
|
|
|
|
}
|
|
|
|
Calc();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFrm::MakePos()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA ??
|
|
|
|
|* Letzte Aenderung MA 24. May. 93
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
// Hier wird GetPrev() zurueckgegeben, allerdings werden
|
|
|
|
// dabei leere SectionFrms ueberlesen
|
|
|
|
SwFrm* lcl_Prev( SwFrm* pFrm, BOOL bSectPrv = TRUE )
|
|
|
|
{
|
|
|
|
SwFrm* pRet = pFrm->GetPrev();
|
|
|
|
if( !pRet && pFrm->GetUpper() && pFrm->GetUpper()->IsSctFrm() &&
|
|
|
|
bSectPrv && !pFrm->IsColumnFrm() )
|
|
|
|
pRet = pFrm->GetUpper()->GetPrev();
|
|
|
|
while( pRet && pRet->IsSctFrm() &&
|
|
|
|
!((SwSectionFrm*)pRet)->GetSection() )
|
|
|
|
pRet = pRet->GetPrev();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFrm* lcl_NotHiddenPrev( SwFrm* pFrm )
|
|
|
|
{
|
|
|
|
SwFrm *pRet = pFrm;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
pRet = lcl_Prev( pRet );
|
|
|
|
} while ( pRet && pRet->IsTxtFrm() && ((SwTxtFrm*)pRet)->IsHiddenNow() );
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwFrm::MakePos()
|
|
|
|
{
|
|
|
|
if ( !bValidPos )
|
|
|
|
{
|
|
|
|
bValidPos = TRUE;
|
2007-09-27 08:01:12 +00:00
|
|
|
BOOL bUseUpper = FALSE;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFrm* pPrv = lcl_Prev( this );
|
2002-10-17 13:10:00 +00:00
|
|
|
if ( pPrv &&
|
|
|
|
( !pPrv->IsCntntFrm() ||
|
|
|
|
( ((SwCntntFrm*)pPrv)->GetFollow() != this ) )
|
|
|
|
)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2002-10-17 13:10:00 +00:00
|
|
|
if ( !StackHack::IsLocked() &&
|
|
|
|
( !IsInSct() || IsSctFrm() ) &&
|
|
|
|
!pPrv->IsSctFrm() &&
|
|
|
|
!pPrv->GetAttrSet()->GetKeep().GetValue()
|
|
|
|
)
|
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
pPrv->Calc(); //hierbei kann der Prev verschwinden!
|
2002-10-17 13:10:00 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else if ( pPrv->Frm().Top() == 0 )
|
2002-10-17 13:10:00 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
bUseUpper = TRUE;
|
2002-10-17 13:10:00 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pPrv = lcl_Prev( this, FALSE );
|
2001-08-29 09:47:32 +00:00
|
|
|
USHORT nMyType = GetType();
|
2004-04-21 08:55:45 +00:00
|
|
|
SWRECTFN( ( IsCellFrm() && GetUpper() ? GetUpper() : this ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !bUseUpper && pPrv )
|
2002-10-17 13:10:00 +00:00
|
|
|
{
|
|
|
|
aFrm.Pos( pPrv->Frm().Pos() );
|
2001-09-19 07:45:10 +00:00
|
|
|
if( FRM_NEIGHBOUR & nMyType )
|
|
|
|
{
|
|
|
|
BOOL bR2L = IsRightToLeft();
|
2001-10-05 11:36:10 +00:00
|
|
|
if( bR2L )
|
|
|
|
(aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() -
|
|
|
|
(aFrm.*fnRect->fnGetWidth)() );
|
2001-09-19 07:45:10 +00:00
|
|
|
else
|
2001-10-05 11:36:10 +00:00
|
|
|
(aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() +
|
|
|
|
(pPrv->Frm().*fnRect->fnGetWidth)() );
|
2007-02-28 14:47:09 +00:00
|
|
|
|
|
|
|
// cells may now leave their uppers
|
|
|
|
if( bVert && FRM_CELL & nMyType && !bReverse )
|
|
|
|
aFrm.Pos().X() -= aFrm.Width() -pPrv->Frm().Width();
|
2001-09-19 07:45:10 +00:00
|
|
|
}
|
2001-09-13 07:24:07 +00:00
|
|
|
else if( bVert && FRM_NOTE_VERT & nMyType )
|
2001-10-05 11:36:10 +00:00
|
|
|
{
|
|
|
|
if( bReverse )
|
|
|
|
aFrm.Pos().X() += pPrv->Frm().Width();
|
|
|
|
else
|
|
|
|
aFrm.Pos().X() -= aFrm.Width();
|
|
|
|
}
|
2001-08-29 09:47:32 +00:00
|
|
|
else
|
|
|
|
aFrm.Pos().Y() += pPrv->Frm().Height();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if ( GetUpper() )
|
|
|
|
{
|
2004-11-16 14:44:27 +00:00
|
|
|
// OD 15.10.2002 #103517# - add safeguard for <SwFooterFrm::Calc()>
|
|
|
|
// If parent frame is a footer frame and its <ColLocked()>, then
|
|
|
|
// do *not* calculate it.
|
|
|
|
// NOTE: Footer frame is <ColLocked()> during its
|
|
|
|
// <FormatSize(..)>, which is called from <Format(..)>, which
|
|
|
|
// is called from <MakeAll()>, which is called from <Calc()>.
|
2005-11-17 15:33:30 +00:00
|
|
|
// --> OD 2005-11-17 #i56850#
|
|
|
|
// - no format of upper Writer fly frame, which is anchored
|
|
|
|
// at-paragraph or at-character.
|
2004-01-13 10:14:29 +00:00
|
|
|
if ( !GetUpper()->IsTabFrm() &&
|
2004-06-01 06:43:32 +00:00
|
|
|
!( IsTabFrm() && GetUpper()->IsInTab() ) &&
|
2004-01-13 10:14:29 +00:00
|
|
|
!GetUpper()->IsSctFrm() &&
|
2005-11-17 15:33:30 +00:00
|
|
|
!dynamic_cast<SwFlyAtCntFrm*>(GetUpper()) &&
|
2002-10-17 13:10:00 +00:00
|
|
|
!( GetUpper()->IsFooterFrm() &&
|
|
|
|
GetUpper()->IsColLocked() )
|
|
|
|
)
|
2001-07-03 09:39:14 +00:00
|
|
|
{
|
2004-11-16 14:44:27 +00:00
|
|
|
GetUpper()->Calc();
|
2001-07-03 09:39:14 +00:00
|
|
|
}
|
2004-11-16 14:44:27 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
pPrv = lcl_Prev( this, FALSE );
|
|
|
|
if ( !bUseUpper && pPrv )
|
2002-10-17 13:10:00 +00:00
|
|
|
{
|
|
|
|
aFrm.Pos( pPrv->Frm().Pos() );
|
2001-09-19 07:45:10 +00:00
|
|
|
if( FRM_NEIGHBOUR & nMyType )
|
|
|
|
{
|
|
|
|
BOOL bR2L = IsRightToLeft();
|
2001-10-05 11:36:10 +00:00
|
|
|
if( bR2L )
|
|
|
|
(aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() -
|
|
|
|
(aFrm.*fnRect->fnGetWidth)() );
|
2001-09-19 07:45:10 +00:00
|
|
|
else
|
2001-10-05 11:36:10 +00:00
|
|
|
(aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() +
|
|
|
|
(pPrv->Frm().*fnRect->fnGetWidth)() );
|
2007-02-28 14:47:09 +00:00
|
|
|
|
|
|
|
// cells may now leave their uppers
|
|
|
|
if( bVert && FRM_CELL & nMyType && !bReverse )
|
|
|
|
aFrm.Pos().X() -= aFrm.Width() -pPrv->Frm().Width();
|
2001-09-19 07:45:10 +00:00
|
|
|
}
|
2001-09-13 07:24:07 +00:00
|
|
|
else if( bVert && FRM_NOTE_VERT & nMyType )
|
2001-10-05 11:36:10 +00:00
|
|
|
{
|
|
|
|
if( bReverse )
|
|
|
|
aFrm.Pos().X() += pPrv->Frm().Width();
|
|
|
|
else
|
|
|
|
aFrm.Pos().X() -= aFrm.Width();
|
|
|
|
}
|
2001-08-29 09:47:32 +00:00
|
|
|
else
|
|
|
|
aFrm.Pos().Y() += pPrv->Frm().Height();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aFrm.Pos( GetUpper()->Frm().Pos() );
|
|
|
|
aFrm.Pos() += GetUpper()->Prt().Pos();
|
2001-09-19 07:45:10 +00:00
|
|
|
if( FRM_NEIGHBOUR & nMyType && IsRightToLeft() )
|
|
|
|
{
|
|
|
|
if( bVert )
|
|
|
|
aFrm.Pos().Y() += GetUpper()->Prt().Height()
|
|
|
|
- aFrm.Height();
|
|
|
|
else
|
|
|
|
aFrm.Pos().X() += GetUpper()->Prt().Width()
|
|
|
|
- aFrm.Width();
|
|
|
|
}
|
2001-10-05 11:36:10 +00:00
|
|
|
else if( bVert && FRM_NOTE_VERT & nMyType && !bReverse )
|
2001-08-29 09:47:32 +00:00
|
|
|
aFrm.Pos().X() -= aFrm.Width() - GetUpper()->Prt().Width();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aFrm.Pos().X() = aFrm.Pos().Y() = 0;
|
2001-10-05 11:36:10 +00:00
|
|
|
if( IsBodyFrm() && bVert && !bReverse && GetUpper() )
|
2001-08-29 09:47:32 +00:00
|
|
|
aFrm.Pos().X() += GetUpper()->Prt().Width() - aFrm.Width();
|
2000-09-18 23:08:29 +00:00
|
|
|
bValidPos = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwPageFrm::MakeAll()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 23. Feb. 93
|
|
|
|
|* Letzte Aenderung MA 20. Jul. 98
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
2004-08-02 13:07:59 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - new type <SwSortedObjs>
|
|
|
|
void lcl_CheckObjects( SwSortedObjs* pSortedObjs, SwFrm* pFrm, long& rBot )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
//Und dann kann es natuerlich noch Absatzgebundene
|
|
|
|
//Rahmen geben, die unterhalb ihres Absatzes stehen.
|
|
|
|
long nMax = 0;
|
|
|
|
for ( USHORT i = 0; i < pSortedObjs->Count(); ++i )
|
|
|
|
{
|
2004-08-02 13:07:59 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - consider changed type of <SwSortedObjs>
|
|
|
|
// entries.
|
|
|
|
SwAnchoredObject* pObj = (*pSortedObjs)[i];
|
2000-09-18 23:08:29 +00:00
|
|
|
long nTmp = 0;
|
2004-08-02 13:07:59 +00:00
|
|
|
if ( pObj->ISA(SwFlyFrm) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-08-02 13:07:59 +00:00
|
|
|
SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pObj);
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pFly->Frm().Top() != WEIT_WECH &&
|
|
|
|
( pFrm->IsPageFrm() ? pFly->IsFlyLayFrm() :
|
|
|
|
( pFly->IsFlyAtCntFrm() &&
|
2004-06-28 12:38:09 +00:00
|
|
|
( pFrm->IsBodyFrm() ? pFly->GetAnchorFrm()->IsInDocBody() :
|
|
|
|
pFly->GetAnchorFrm()->IsInFtn() ) ) ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
nTmp = pFly->Frm().Bottom();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2004-08-02 13:07:59 +00:00
|
|
|
nTmp = pObj->GetObjRect().Bottom();
|
2000-09-18 23:08:29 +00:00
|
|
|
nMax = Max( nTmp, nMax );
|
2004-08-02 13:07:59 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
++nMax; //Unterkante vs. Hoehe!
|
|
|
|
rBot = Max( rBot, nMax );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwPageFrm::MakeAll()
|
|
|
|
{
|
|
|
|
PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
|
|
|
|
|
|
|
|
const SwRect aOldRect( Frm() ); //Anpassung der Root-Groesse
|
|
|
|
const SwLayNotify aNotify( this ); //uebernimmt im DTor die Benachrichtigung
|
|
|
|
SwBorderAttrAccess *pAccess = 0;
|
|
|
|
const SwBorderAttrs*pAttrs = 0;
|
|
|
|
|
|
|
|
while ( !bValidPos || !bValidSize || !bValidPrtArea )
|
|
|
|
{
|
|
|
|
if ( !bValidPos )
|
|
|
|
{
|
2008-03-07 13:54:38 +00:00
|
|
|
// PAGES01
|
|
|
|
bValidPos = TRUE; // positioning of the pages is taken care of by the root frame
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !bValidSize || !bValidPrtArea )
|
|
|
|
{
|
|
|
|
if ( IsEmptyPage() )
|
|
|
|
{
|
|
|
|
Frm().Width( 0 ); Prt().Width( 0 );
|
|
|
|
Frm().Height( 0 ); Prt().Height( 0 );
|
|
|
|
Prt().Left( 0 ); Prt().Top( 0 );
|
|
|
|
bValidSize = bValidPrtArea = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !pAccess )
|
|
|
|
{
|
|
|
|
pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this );
|
|
|
|
pAttrs = pAccess->Get();
|
|
|
|
}
|
|
|
|
//Bei der BrowseView gelten feste Einstellungen.
|
|
|
|
ViewShell *pSh = GetShell();
|
2006-08-14 15:25:09 +00:00
|
|
|
if ( pSh && GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
|
|
|
|
const long nTop = pAttrs->CalcTopLine() + aBorder.Height();
|
|
|
|
const long nBottom = pAttrs->CalcBottomLine()+ aBorder.Height();
|
|
|
|
|
2008-02-19 12:44:17 +00:00
|
|
|
long nWidth = GetUpper() ? ((SwRootFrm*)GetUpper())->GetBrowseWidth() : 0;
|
|
|
|
if ( nWidth < pSh->GetBrowseWidth() )
|
|
|
|
nWidth = pSh->GetBrowseWidth();
|
|
|
|
nWidth += + 2 * aBorder.Width();
|
|
|
|
/*
|
|
|
|
long nWidth = GetUpper() ? ((SwRootFrm*)GetUpper())->GetBrowseWidth() + 2 * aBorder.Width() : 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( nWidth < pSh->VisArea().Width() )
|
2008-02-19 12:44:17 +00:00
|
|
|
nWidth = pSh->VisArea().Width(); */
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
nWidth = Max( nWidth, 2L * aBorder.Width() + 4L*MM50 );
|
|
|
|
Frm().Width( nWidth );
|
|
|
|
|
|
|
|
SwLayoutFrm *pBody = FindBodyCont();
|
|
|
|
if ( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrm() )
|
|
|
|
{
|
|
|
|
//Fuer Spalten gilt eine feste Hoehe
|
|
|
|
Frm().Height( pAttrs->GetSize().Height() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Fuer Seiten ohne Spalten bestimmt der Inhalt die
|
|
|
|
//Groesse.
|
|
|
|
long nBot = Frm().Top() + nTop;
|
|
|
|
SwFrm *pFrm = Lower();
|
|
|
|
while ( pFrm )
|
|
|
|
{
|
|
|
|
long nTmp = 0;
|
|
|
|
SwFrm *pCnt = ((SwLayoutFrm*)pFrm)->ContainsAny();
|
|
|
|
while ( pCnt && (pCnt->GetUpper() == pFrm ||
|
|
|
|
((SwLayoutFrm*)pFrm)->IsAnLower( pCnt )))
|
|
|
|
{
|
|
|
|
nTmp += pCnt->Frm().Height();
|
|
|
|
if( pCnt->IsTxtFrm() &&
|
|
|
|
((SwTxtFrm*)pCnt)->IsUndersized() )
|
|
|
|
nTmp += ((SwTxtFrm*)pCnt)->GetParHeight()
|
|
|
|
- pCnt->Prt().Height();
|
|
|
|
else if( pCnt->IsSctFrm() &&
|
|
|
|
((SwSectionFrm*)pCnt)->IsUndersized() )
|
|
|
|
nTmp += ((SwSectionFrm*)pCnt)->Undersize();
|
|
|
|
pCnt = pCnt->FindNext();
|
|
|
|
}
|
2002-11-01 10:36:31 +00:00
|
|
|
// OD 29.10.2002 #97265# - consider invalid body frame properties
|
|
|
|
if ( pFrm->IsBodyFrm() &&
|
|
|
|
( !pFrm->GetValidSizeFlag() ||
|
|
|
|
!pFrm->GetValidPrtAreaFlag() ) &&
|
|
|
|
( pFrm->Frm().Height() < pFrm->Prt().Height() )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
nTmp = Min( nTmp, pFrm->Frm().Height() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// OD 30.10.2002 #97265# - assert invalid lower property
|
|
|
|
ASSERT( !(pFrm->Frm().Height() < pFrm->Prt().Height()),
|
|
|
|
"SwPageFrm::MakeAll(): Lower with frame height < printing height" );
|
|
|
|
nTmp += pFrm->Frm().Height() - pFrm->Prt().Height();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !pFrm->IsBodyFrm() )
|
|
|
|
nTmp = Min( nTmp, pFrm->Frm().Height() );
|
|
|
|
nBot += nTmp;
|
|
|
|
// Hier werden die absatzgebundenen Objekte ueberprueft,
|
|
|
|
// ob sie ueber den Body/FtnCont hinausragen.
|
|
|
|
if( pSortedObjs && !pFrm->IsHeaderFrm() &&
|
|
|
|
!pFrm->IsFooterFrm() )
|
|
|
|
lcl_CheckObjects( pSortedObjs, pFrm, nBot );
|
|
|
|
pFrm = pFrm->GetNext();
|
|
|
|
}
|
|
|
|
nBot += nBottom;
|
|
|
|
//Und die Seitengebundenen
|
|
|
|
if ( pSortedObjs )
|
|
|
|
lcl_CheckObjects( pSortedObjs, this, nBot );
|
|
|
|
nBot -= Frm().Top();
|
2004-12-23 09:06:35 +00:00
|
|
|
// --> OD 2004-11-10 #i35143# - If second page frame
|
|
|
|
// exists, the first page doesn't have to fulfill the
|
|
|
|
// visible area.
|
|
|
|
if ( !GetPrev() && !GetNext() )
|
|
|
|
// <--
|
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
nBot = Max( nBot, pSh->VisArea().Height() );
|
2004-12-23 09:06:35 +00:00
|
|
|
}
|
|
|
|
// --> OD 2004-11-10 #i35143# - Assure, that the page
|
|
|
|
// doesn't exceed the defined browse height.
|
|
|
|
Frm().Height( Min( nBot, BROWSE_HEIGHT ) );
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
Prt().Left ( pAttrs->CalcLeftLine() + aBorder.Width() );
|
|
|
|
Prt().Top ( nTop );
|
|
|
|
Prt().Width( Frm().Width() - ( Prt().Left()
|
|
|
|
+ pAttrs->CalcRightLine() + aBorder.Width() ) );
|
|
|
|
Prt().Height( Frm().Height() - (nTop + nBottom) );
|
|
|
|
bValidSize = bValidPrtArea = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ //FixSize einstellen, bei Seiten nicht vom Upper sondern vom
|
|
|
|
//Attribut vorgegeben.
|
|
|
|
Frm().SSize( pAttrs->GetSize() );
|
|
|
|
Format( pAttrs );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} //while ( !bValidPos || !bValidSize || !bValidPrtArea )
|
|
|
|
delete pAccess;
|
2008-03-07 13:54:38 +00:00
|
|
|
|
|
|
|
// PAGES01
|
|
|
|
if ( Frm() != aOldRect && GetUpper() )
|
|
|
|
static_cast<SwRootFrm*>(GetUpper())->CheckViewLayout( 0, 0 );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2009-07-10 14:03:42 +02:00
|
|
|
#ifdef DBG_UTIL
|
2000-09-18 23:08:29 +00:00
|
|
|
//Der Upper (Root) muss mindestens so breit
|
|
|
|
//sein, dass er die breiteste Seite aufnehmen kann.
|
|
|
|
if ( GetUpper() )
|
2001-10-19 09:25:19 +00:00
|
|
|
{
|
|
|
|
ASSERT( GetUpper()->Prt().Width() >= aFrm.Width(), "Rootsize" );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwLayoutFrm::MakeAll()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA ??
|
|
|
|
|* Letzte Aenderung MA 28. Nov. 95
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void SwLayoutFrm::MakeAll()
|
|
|
|
{
|
|
|
|
PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
|
|
|
|
|
|
|
|
//uebernimmt im DTor die Benachrichtigung
|
|
|
|
const SwLayNotify aNotify( this );
|
2001-10-22 10:01:46 +00:00
|
|
|
BOOL bVert = IsVertical();
|
|
|
|
SwRectFn fnRect = ( IsNeighbourFrm() == bVert )? fnRectHori : fnRectVert;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwBorderAttrAccess *pAccess = 0;
|
|
|
|
const SwBorderAttrs*pAttrs = 0;
|
|
|
|
|
|
|
|
while ( !bValidPos || !bValidSize || !bValidPrtArea )
|
|
|
|
{
|
|
|
|
if ( !bValidPos )
|
|
|
|
MakePos();
|
|
|
|
|
|
|
|
if ( GetUpper() )
|
|
|
|
{
|
2007-02-28 14:47:09 +00:00
|
|
|
// NEW TABLES
|
|
|
|
if ( IsLeaveUpperAllowed() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-02-28 14:47:09 +00:00
|
|
|
if ( !bValidSize )
|
|
|
|
bValidPrtArea = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !bValidSize )
|
2001-10-22 10:01:46 +00:00
|
|
|
{
|
2007-02-28 14:47:09 +00:00
|
|
|
//FixSize einstellen, die VarSize wird von Format() nach
|
|
|
|
//Berechnung der PrtArea eingestellt.
|
|
|
|
bValidPrtArea = FALSE;
|
|
|
|
|
|
|
|
SwTwips nPrtWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
|
|
|
|
if( bVert && ( IsBodyFrm() || IsFtnContFrm() ) )
|
|
|
|
{
|
|
|
|
SwFrm* pNxt = GetPrev();
|
|
|
|
while( pNxt && !pNxt->IsHeaderFrm() )
|
|
|
|
pNxt = pNxt->GetPrev();
|
|
|
|
if( pNxt )
|
|
|
|
nPrtWidth -= pNxt->Frm().Height();
|
|
|
|
pNxt = GetNext();
|
|
|
|
while( pNxt && !pNxt->IsFooterFrm() )
|
|
|
|
pNxt = pNxt->GetNext();
|
|
|
|
if( pNxt )
|
|
|
|
nPrtWidth -= pNxt->Frm().Height();
|
|
|
|
}
|
|
|
|
|
|
|
|
const long nDiff = nPrtWidth - (Frm().*fnRect->fnGetWidth)();
|
|
|
|
|
|
|
|
if( IsNeighbourFrm() && IsRightToLeft() )
|
|
|
|
(Frm().*fnRect->fnSubLeft)( nDiff );
|
|
|
|
else
|
|
|
|
(Frm().*fnRect->fnAddRight)( nDiff );
|
2001-10-22 10:01:46 +00:00
|
|
|
}
|
2002-02-15 08:33:58 +00:00
|
|
|
else
|
2007-02-28 14:47:09 +00:00
|
|
|
{
|
|
|
|
// Don't leave your upper
|
|
|
|
const SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
|
|
|
|
if( (Frm().*fnRect->fnOverStep)( nDeadLine ) )
|
|
|
|
bValidSize = FALSE;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !bValidSize || !bValidPrtArea )
|
|
|
|
{
|
|
|
|
if ( !pAccess )
|
|
|
|
{
|
|
|
|
pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this );
|
|
|
|
pAttrs = pAccess->Get();
|
|
|
|
}
|
|
|
|
Format( pAttrs );
|
|
|
|
}
|
|
|
|
} //while ( !bValidPos || !bValidSize || !bValidPrtArea )
|
|
|
|
if ( pAccess )
|
|
|
|
delete pAccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwCntntFrm::MakePrtArea()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 17. Nov. 92
|
|
|
|
|* Letzte Aenderung MA 03. Mar. 96
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
BOOL SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
|
|
|
|
{
|
|
|
|
BOOL bSizeChgd = FALSE;
|
|
|
|
|
|
|
|
if ( !bValidPrtArea )
|
|
|
|
{
|
|
|
|
bValidPrtArea = TRUE;
|
|
|
|
|
2001-10-05 11:36:10 +00:00
|
|
|
SWRECTFN( this )
|
2007-09-27 08:01:12 +00:00
|
|
|
const BOOL bTxtFrm = IsTxtFrm();
|
2001-08-29 09:47:32 +00:00
|
|
|
SwTwips nUpper = 0;
|
|
|
|
if ( bTxtFrm && ((SwTxtFrm*)this)->IsHiddenNow() )
|
|
|
|
{
|
2002-09-20 06:00:56 +00:00
|
|
|
if ( ((SwTxtFrm*)this)->HasFollow() )
|
|
|
|
((SwTxtFrm*)this)->JoinFrm();
|
|
|
|
|
2001-09-11 07:13:09 +00:00
|
|
|
if( (Prt().*fnRect->fnGetHeight)() )
|
2001-08-29 09:47:32 +00:00
|
|
|
((SwTxtFrm*)this)->HideHidden();
|
2001-09-11 07:13:09 +00:00
|
|
|
Prt().Pos().X() = Prt().Pos().Y() = 0;
|
|
|
|
(Prt().*fnRect->fnSetWidth)( (Frm().*fnRect->fnGetWidth)() );
|
|
|
|
(Prt().*fnRect->fnSetHeight)( 0 );
|
|
|
|
nUpper = -( (Frm().*fnRect->fnGetHeight)() );
|
2001-08-29 09:47:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Vereinfachung: CntntFrms sind immer in der Hoehe Variabel!
|
|
|
|
|
|
|
|
//An der FixSize gibt der umgebende Frame die Groesse vor, die
|
|
|
|
//Raender werden einfach abgezogen.
|
|
|
|
const long nLeft = rAttrs.CalcLeft( this );
|
2002-08-26 06:54:52 +00:00
|
|
|
const long nRight = ((SwBorderAttrs&)rAttrs).CalcRight( this );
|
|
|
|
(this->*fnRect->fnSetXMargins)( nLeft, nRight );
|
2001-08-29 09:47:32 +00:00
|
|
|
|
|
|
|
ViewShell *pSh = GetShell();
|
2001-09-11 07:13:09 +00:00
|
|
|
SwTwips nWidthArea;
|
|
|
|
if( pSh && 0!=(nWidthArea=(pSh->VisArea().*fnRect->fnGetWidth)()) &&
|
|
|
|
GetUpper()->IsPageBodyFrm() && // nicht dagegen bei BodyFrms in Columns
|
2006-08-14 15:25:09 +00:00
|
|
|
pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
|
2001-08-29 09:47:32 +00:00
|
|
|
{
|
|
|
|
//Nicht ueber die Kante des sichbaren Bereiches hinausragen.
|
|
|
|
//Die Seite kann breiter sein, weil es Objekte mit "ueberbreite"
|
|
|
|
//geben kann (RootFrm::ImplCalcBrowseWidth())
|
|
|
|
long nMinWidth = 0;
|
|
|
|
|
|
|
|
for (USHORT i = 0; GetDrawObjs() && i < GetDrawObjs()->Count();++i)
|
|
|
|
{
|
2004-08-02 13:07:59 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - consider changed type of
|
|
|
|
// <SwSortedObjs> entries
|
|
|
|
SwAnchoredObject* pObj = (*GetDrawObjs())[i];
|
|
|
|
const SwFrmFmt& rFmt = pObj->GetFrmFmt();
|
2007-09-27 08:01:12 +00:00
|
|
|
const BOOL bFly = pObj->ISA(SwFlyFrm);
|
2010-08-02 16:00:15 +02:00
|
|
|
if ((bFly && (WEIT_WECH == pObj->GetObjRect().Width()))
|
|
|
|
|| rFmt.GetFrmSize().GetWidthPercent())
|
|
|
|
{
|
2001-08-29 09:47:32 +00:00
|
|
|
continue;
|
2010-08-02 16:00:15 +02:00
|
|
|
}
|
2001-08-29 09:47:32 +00:00
|
|
|
|
2010-01-05 16:37:41 +01:00
|
|
|
if ( FLY_AS_CHAR == rFmt.GetAnchor().GetAnchorId() )
|
|
|
|
{
|
2001-08-29 09:47:32 +00:00
|
|
|
nMinWidth = Max( nMinWidth,
|
2004-08-02 13:07:59 +00:00
|
|
|
bFly ? rFmt.GetFrmSize().GetWidth()
|
|
|
|
: pObj->GetObjRect().Width() );
|
2010-01-05 16:37:41 +01:00
|
|
|
}
|
2004-08-02 13:07:59 +00:00
|
|
|
// <--
|
2001-08-29 09:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
|
2008-02-19 12:44:17 +00:00
|
|
|
long nWidth = nWidthArea - 2 * ( IsVertical() ? aBorder.Height() : aBorder.Width() );
|
2001-09-11 07:13:09 +00:00
|
|
|
nWidth -= (Prt().*fnRect->fnGetLeft)();
|
2001-08-29 09:47:32 +00:00
|
|
|
nWidth -= rAttrs.CalcRightLine();
|
|
|
|
nWidth = Max( nMinWidth, nWidth );
|
2001-09-11 07:13:09 +00:00
|
|
|
(Prt().*fnRect->fnSetWidth)( Min( nWidth,
|
|
|
|
(Prt().*fnRect->fnGetWidth)() ) );
|
2001-08-29 09:47:32 +00:00
|
|
|
}
|
|
|
|
|
2001-09-11 07:13:09 +00:00
|
|
|
if ( (Prt().*fnRect->fnGetWidth)() <= MINLAY )
|
2001-08-29 09:47:32 +00:00
|
|
|
{
|
|
|
|
//Die PrtArea sollte schon wenigstens MINLAY breit sein, passend
|
|
|
|
//zu den Minimalwerten des UI
|
2001-09-11 07:13:09 +00:00
|
|
|
(Prt().*fnRect->fnSetWidth)( Min( long(MINLAY),
|
|
|
|
(Frm().*fnRect->fnGetWidth)() ) );
|
|
|
|
SwTwips nTmp = (Frm().*fnRect->fnGetWidth)() -
|
|
|
|
(Prt().*fnRect->fnGetWidth)();
|
|
|
|
if( (Prt().*fnRect->fnGetLeft)() > nTmp )
|
|
|
|
(Prt().*fnRect->fnSetLeft)( nTmp );
|
2001-08-29 09:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Fuer die VarSize gelten folgende Regeln:
|
|
|
|
//1. Der erste einer Kette hat keinen Rand nach oben
|
|
|
|
//2. Nach unten gibt es nie einen Rand
|
|
|
|
//3. Der Rand nach oben ist das Maximum aus dem Abstand des
|
|
|
|
// Prev nach unten und dem eigenen Abstand nach oben.
|
|
|
|
//Die drei Regeln werden auf die Berechnung der Freiraeume, die von
|
|
|
|
//UL- bzw. LRSpace vorgegeben werden, angewand. Es gibt in alle
|
|
|
|
//Richtungen jedoch ggf. trotzdem einen Abstand; dieser wird durch
|
|
|
|
//Umrandung und/oder Schatten vorgegeben.
|
|
|
|
//4. Der Abstand fuer TextFrms entspricht mindestens dem Durchschuss
|
|
|
|
|
|
|
|
nUpper = CalcUpperSpace( &rAttrs, NULL );
|
2004-03-23 10:36:45 +00:00
|
|
|
|
|
|
|
// OD 2004-03-02 #106629# - use new method <CalcLowerSpace(..)>
|
|
|
|
SwTwips nLower = CalcLowerSpace( &rAttrs );
|
|
|
|
// // in balanced columned section frames we do not want the
|
|
|
|
// // common border
|
|
|
|
// sal_Bool bCommonBorder = sal_True;
|
|
|
|
// if ( IsInSct() && GetUpper()->IsColBodyFrm() )
|
|
|
|
// {
|
|
|
|
// const SwSectionFrm* pSct = FindSctFrm();
|
|
|
|
// bCommonBorder = pSct->GetFmt()->GetBalancedColumns().GetValue();
|
|
|
|
// }
|
|
|
|
// SwTwips nLower = bCommonBorder ?
|
|
|
|
// rAttrs.GetBottomLine( this ) :
|
|
|
|
// rAttrs.CalcBottomLine();
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2001-11-22 10:15:10 +00:00
|
|
|
(Prt().*fnRect->fnSetPosY)( (!bVert || bReverse) ? nUpper : nLower);
|
2001-09-06 08:56:48 +00:00
|
|
|
nUpper += nLower;
|
2001-09-11 07:13:09 +00:00
|
|
|
nUpper -= (Frm().*fnRect->fnGetHeight)() -
|
|
|
|
(Prt().*fnRect->fnGetHeight)();
|
2001-08-29 09:47:32 +00:00
|
|
|
}
|
|
|
|
//Wenn Unterschiede zwischen Alter und neuer Groesse,
|
|
|
|
//Grow() oder Shrink() rufen
|
|
|
|
if ( nUpper )
|
|
|
|
{
|
|
|
|
if ( nUpper > 0 )
|
2001-10-19 09:25:19 +00:00
|
|
|
GrowFrm( nUpper );
|
2001-08-29 09:47:32 +00:00
|
|
|
else
|
2001-10-19 09:25:19 +00:00
|
|
|
ShrinkFrm( -nUpper );
|
2001-08-29 09:47:32 +00:00
|
|
|
bSizeChgd = TRUE;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
return bSizeChgd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwCntntFrm::MakeAll()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA ??
|
|
|
|
|* Letzte Aenderung MA 16. Dec. 96
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2002-09-13 11:13:06 +00:00
|
|
|
#define STOP_FLY_FORMAT 10
|
2006-10-13 11:19:53 +00:00
|
|
|
// --> OD 2006-09-25 #b6448963# - loop prevention
|
|
|
|
const int cnStopFormat = 15;
|
|
|
|
// <--
|
2002-09-13 11:13:06 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
inline void ValidateSz( SwFrm *pFrm )
|
|
|
|
{
|
|
|
|
if ( pFrm )
|
|
|
|
{
|
|
|
|
pFrm->bValidSize = TRUE;
|
|
|
|
pFrm->bValidPrtArea = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwCntntFrm::MakeAll()
|
|
|
|
{
|
|
|
|
ASSERT( GetUpper(), "keinen Upper?" );
|
|
|
|
ASSERT( IsTxtFrm(), "MakeAll(), NoTxt" );
|
|
|
|
|
|
|
|
if ( !IsFollow() && StackHack::IsLocked() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( IsJoinLocked() )
|
|
|
|
return;
|
|
|
|
|
2001-08-29 09:47:32 +00:00
|
|
|
ASSERT( !((SwTxtFrm*)this)->IsSwapped(), "Calculation of a swapped frame" );
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
StackHack aHack;
|
|
|
|
|
|
|
|
if ( ((SwTxtFrm*)this)->IsLocked() )
|
|
|
|
{
|
|
|
|
ASSERT( FALSE, "Format fuer gelockten TxtFrm." );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LockJoin();
|
2002-09-13 11:13:06 +00:00
|
|
|
long nFormatCount = 0;
|
2006-10-13 11:19:53 +00:00
|
|
|
// --> OD 2006-09-25 #b6448963# - loop prevention
|
|
|
|
int nConsequetiveFormatsWithoutChange = 0;
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
|
|
|
|
|
2009-07-10 14:03:42 +02:00
|
|
|
#ifdef DBG_UTIL
|
2006-12-01 14:43:54 +00:00
|
|
|
const SwDoc *pDoc = GetAttrSet()->GetDoc();
|
2000-12-06 11:27:40 +00:00
|
|
|
if( pDoc )
|
|
|
|
{
|
|
|
|
static sal_Bool bWarn = sal_False;
|
|
|
|
if( pDoc->InXMLExport() )
|
|
|
|
{
|
|
|
|
ASSERT( bWarn, "Formatting during XML-export!" );
|
|
|
|
bWarn = sal_True;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
bWarn = sal_False;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//uebernimmt im DTor die Benachrichtigung
|
|
|
|
SwCntntNotify *pNotify = new SwCntntNotify( this );
|
|
|
|
|
|
|
|
BOOL bMakePage = TRUE; //solange TRUE kann eine neue Seite
|
|
|
|
//angelegt werden (genau einmal)
|
|
|
|
BOOL bMovedBwd = FALSE; //Wird TRUE wenn der Frame zurueckfliesst
|
|
|
|
BOOL bMovedFwd = FALSE; //solange FALSE kann der Frm zurueck-
|
|
|
|
//fliessen (solange, bis er einmal
|
|
|
|
//vorwaerts ge'moved wurde).
|
|
|
|
BOOL bFormatted = FALSE; //Fuer die Witwen und Waisen Regelung
|
|
|
|
//wird der letzte CntntFrm einer Kette
|
|
|
|
//u.U. zum Formatieren angeregt, dies
|
|
|
|
//braucht nur einmal zu passieren.
|
|
|
|
//Immer wenn der Frm gemoved wird muss
|
|
|
|
//das Flag zurueckgesetzt werden.
|
|
|
|
BOOL bMustFit = FALSE; //Wenn einmal die Notbremse gezogen wurde,
|
|
|
|
//werden keine anderen Prepares mehr
|
|
|
|
//abgesetzt.
|
|
|
|
BOOL bFitPromise = FALSE; //Wenn ein Absatz nicht passte, mit WouldFit
|
|
|
|
//aber verspricht, dass er sich passend
|
|
|
|
//einstellt wird dieses Flag gesetzt.
|
|
|
|
//Wenn er dann sein Versprechen nicht haelt,
|
|
|
|
//kann kontrolliert verfahren werden.
|
|
|
|
BOOL bMoveable;
|
|
|
|
const BOOL bFly = IsInFly();
|
|
|
|
const BOOL bTab = IsInTab();
|
|
|
|
const BOOL bFtn = IsInFtn();
|
|
|
|
const BOOL bSct = IsInSct();
|
2001-09-19 07:45:10 +00:00
|
|
|
Point aOldFrmPos; //Damit bei Turnarounds jew. mit der
|
|
|
|
Point aOldPrtPos; //letzten Pos verglichen und geprueft
|
|
|
|
//werden kann, ob ein Prepare sinnvoll ist.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
|
|
|
|
const SwBorderAttrs &rAttrs = *aAccess.Get();
|
|
|
|
|
2004-03-09 08:30:07 +00:00
|
|
|
// OD 2004-02-26 #i25029#
|
|
|
|
if ( !IsFollow() && rAttrs.JoinedWithPrev( *(this) ) )
|
|
|
|
{
|
|
|
|
pNotify->SetBordersJoinedWithPrev();
|
|
|
|
}
|
|
|
|
|
2006-03-09 13:06:28 +00:00
|
|
|
const BOOL bKeep = IsKeep( rAttrs.GetAttrSet() );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwSaveFtnHeight *pSaveFtn = 0;
|
|
|
|
if ( bFtn )
|
|
|
|
{
|
|
|
|
SwFtnFrm *pFtn = FindFtnFrm();
|
|
|
|
SwSectionFrm* pSct = pFtn->FindSctFrm();
|
|
|
|
if ( !((SwTxtFrm*)pFtn->GetRef())->IsLocked() )
|
|
|
|
{
|
|
|
|
SwFtnBossFrm* pBoss = pFtn->GetRef()->FindFtnBossFrm(
|
|
|
|
pFtn->GetAttr()->GetFtn().IsEndNote() );
|
|
|
|
if( !pSct || pSct->IsColLocked() || !pSct->Growable() )
|
|
|
|
pSaveFtn = new SwSaveFtnHeight( pBoss,
|
2007-09-27 08:01:12 +00:00
|
|
|
((SwTxtFrm*)pFtn->GetRef())->GetFtnLine( pFtn->GetAttr() ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-01 15:44:36 +00:00
|
|
|
// --> OD 2008-08-12 #b6732519#
|
|
|
|
if ( GetUpper()->IsSctFrm() &&
|
|
|
|
HasFollow() &&
|
|
|
|
GetFollow()->GetFrm() == GetNext() )
|
|
|
|
{
|
|
|
|
dynamic_cast<SwTxtFrm*>(this)->JoinFrm();
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2004-08-02 13:07:59 +00:00
|
|
|
// --> OD 2004-06-23 #i28701# - move master forward, if it has to move,
|
|
|
|
// because of its object positioning.
|
|
|
|
if ( !static_cast<SwTxtFrm*>(this)->IsFollow() )
|
|
|
|
{
|
|
|
|
sal_uInt32 nToPageNum = 0L;
|
|
|
|
const bool bMoveFwdByObjPos = SwLayouter::FrmMovedFwdByObjPos(
|
|
|
|
*(GetAttrSet()->GetDoc()),
|
|
|
|
*(static_cast<SwTxtFrm*>(this)),
|
|
|
|
nToPageNum );
|
2006-02-03 16:17:13 +00:00
|
|
|
// --> OD 2006-01-27 #i58182#
|
|
|
|
// Also move a paragraph forward, which is the first one inside a table cell.
|
2004-08-02 13:07:59 +00:00
|
|
|
if ( bMoveFwdByObjPos &&
|
|
|
|
FindPageFrm()->GetPhyPageNum() < nToPageNum &&
|
2006-02-03 16:17:13 +00:00
|
|
|
( lcl_Prev( this ) ||
|
|
|
|
GetUpper()->IsCellFrm() ||
|
|
|
|
( GetUpper()->IsSctFrm() &&
|
|
|
|
GetUpper()->GetUpper()->IsCellFrm() ) ) &&
|
|
|
|
IsMoveable() )
|
2004-08-02 13:07:59 +00:00
|
|
|
{
|
|
|
|
bMovedFwd = TRUE;
|
|
|
|
MoveFwd( bMakePage, FALSE );
|
|
|
|
}
|
2006-02-03 16:17:13 +00:00
|
|
|
// <--
|
2004-08-02 13:07:59 +00:00
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//Wenn ein Follow neben seinem Master steht und nicht passt, kann er
|
|
|
|
//gleich verschoben werden.
|
2004-03-23 10:36:45 +00:00
|
|
|
if ( lcl_Prev( this ) && ((SwTxtFrm*)this)->IsFollow() && IsMoveable() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
bMovedFwd = TRUE;
|
2004-03-23 10:36:45 +00:00
|
|
|
// OD 2004-03-02 #106629# - If follow frame is in table, it's master
|
|
|
|
// will be the last in the current table cell. Thus, invalidate the
|
|
|
|
// printing area of the master,
|
|
|
|
if ( IsInTab() )
|
|
|
|
{
|
|
|
|
lcl_Prev( this )->InvalidatePrt();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
MoveFwd( bMakePage, FALSE );
|
|
|
|
}
|
|
|
|
|
2002-11-11 08:40:33 +00:00
|
|
|
// OD 08.11.2002 #104840# - check footnote content for forward move.
|
|
|
|
// If a content of a footnote is on a prior page/column as its invalid
|
|
|
|
// reference, it can be moved forward.
|
|
|
|
if ( bFtn && !bValidPos )
|
|
|
|
{
|
|
|
|
SwFtnFrm* pFtn = FindFtnFrm();
|
|
|
|
SwCntntFrm* pRefCnt = pFtn ? pFtn->GetRef() : 0;
|
|
|
|
if ( pRefCnt && !pRefCnt->IsValid() )
|
|
|
|
{
|
|
|
|
SwFtnBossFrm* pFtnBossOfFtn = pFtn->FindFtnBossFrm();
|
|
|
|
SwFtnBossFrm* pFtnBossOfRef = pRefCnt->FindFtnBossFrm();
|
|
|
|
//<loop of movefwd until condition held or no move>
|
|
|
|
if ( pFtnBossOfFtn && pFtnBossOfRef &&
|
|
|
|
pFtnBossOfFtn != pFtnBossOfRef &&
|
|
|
|
pFtnBossOfFtn->IsBefore( pFtnBossOfRef ) )
|
|
|
|
{
|
|
|
|
bMovedFwd = TRUE;
|
|
|
|
MoveFwd( bMakePage, FALSE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-14 13:40:22 +00:00
|
|
|
SWRECTFN( this )
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
while ( !bValidPos || !bValidSize || !bValidPrtArea )
|
|
|
|
{
|
2006-10-13 11:19:53 +00:00
|
|
|
// --> OD 2006-09-25 #b6448963# - loop prevention
|
|
|
|
SwRect aOldFrm_StopFormat( Frm() );
|
|
|
|
SwRect aOldPrt_StopFormat( Prt() );
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( TRUE == (bMoveable = IsMoveable()) )
|
|
|
|
{
|
|
|
|
SwFrm *pPre = GetIndPrev();
|
|
|
|
if ( CheckMoveFwd( bMakePage, bKeep, bMovedBwd ) )
|
|
|
|
{
|
2001-11-14 13:40:22 +00:00
|
|
|
SWREFRESHFN( this )
|
2000-09-18 23:08:29 +00:00
|
|
|
bMovedFwd = TRUE;
|
|
|
|
if ( bMovedBwd )
|
|
|
|
{
|
|
|
|
//Beim zurueckfliessen wurde der Upper angeregt sich
|
|
|
|
//vollstaendig zu Painten, dass koennen wir uns jetzt
|
|
|
|
//nach dem hin und her fliessen sparen.
|
|
|
|
GetUpper()->ResetCompletePaint();
|
|
|
|
//Der Vorgaenger wurde Invalidiert, das ist jetzt auch obsolete.
|
|
|
|
ASSERT( pPre, "missing old Prev" );
|
|
|
|
if( !pPre->IsSctFrm() )
|
|
|
|
::ValidateSz( pPre );
|
|
|
|
}
|
|
|
|
bMoveable = IsMoveable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-09-19 07:45:10 +00:00
|
|
|
aOldFrmPos = (Frm().*fnRect->fnGetPos)();
|
|
|
|
aOldPrtPos = (Prt().*fnRect->fnGetPos)();
|
2001-09-14 09:59:33 +00:00
|
|
|
|
|
|
|
if ( !bValidPos )
|
|
|
|
MakePos();
|
|
|
|
|
|
|
|
//FixSize einstellen, die VarSize wird von Format() justiert.
|
|
|
|
if ( !bValidSize )
|
2006-01-27 13:35:32 +00:00
|
|
|
{
|
|
|
|
// --> OD 2006-01-03 #125452#
|
|
|
|
// invalidate printing area flag, if the following conditions are hold:
|
|
|
|
// - current frame width is 0.
|
|
|
|
// - current printing area width is 0.
|
|
|
|
// - frame width is adjusted to a value greater than 0.
|
|
|
|
// - printing area flag is TRUE.
|
|
|
|
// Thus, it's assured that the printing area is adjusted, if the
|
|
|
|
// frame area width changes its width from 0 to something greater
|
|
|
|
// than 0.
|
|
|
|
// Note: A text frame can be in such a situation, if the format is
|
|
|
|
// triggered by method call <SwCrsrShell::SetCrsr()> after
|
|
|
|
// loading the document.
|
|
|
|
const SwTwips nNewFrmWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
|
|
|
|
if ( bValidPrtArea && nNewFrmWidth > 0 &&
|
|
|
|
(Frm().*fnRect->fnGetWidth)() == 0 &&
|
|
|
|
(Prt().*fnRect->fnGetWidth)() == 0 )
|
|
|
|
{
|
|
|
|
bValidPrtArea = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
(Frm().*fnRect->fnSetWidth)( nNewFrmWidth );
|
|
|
|
// <--
|
|
|
|
}
|
2001-09-14 09:59:33 +00:00
|
|
|
if ( !bValidPrtArea )
|
|
|
|
{
|
|
|
|
const long nOldW = (Prt().*fnRect->fnGetWidth)();
|
2004-11-09 12:46:54 +00:00
|
|
|
// --> OD 2004-09-28 #i34730# - keep current frame height
|
|
|
|
const SwTwips nOldH = (Frm().*fnRect->fnGetHeight)();
|
|
|
|
// <--
|
2001-09-14 09:59:33 +00:00
|
|
|
MakePrtArea( rAttrs );
|
2001-11-20 14:01:33 +00:00
|
|
|
if ( nOldW != (Prt().*fnRect->fnGetWidth)() )
|
2001-09-14 09:59:33 +00:00
|
|
|
Prepare( PREP_FIXSIZE_CHG );
|
2004-11-09 12:46:54 +00:00
|
|
|
// --> OD 2004-09-28 #i34730# - check, if frame height has changed.
|
|
|
|
// If yes, send a PREP_ADJUST_FRM and invalidate the size flag to
|
|
|
|
// force a format. The format will check in its method
|
|
|
|
// <SwTxtFrm::CalcPreps()>, if the already formatted lines still
|
|
|
|
// fit and if not, performs necessary actions.
|
2005-01-21 09:34:12 +00:00
|
|
|
// --> OD 2005-01-10 #i40150# - no check, if frame is undersized.
|
|
|
|
if ( bValidSize && !IsUndersized() &&
|
|
|
|
nOldH != (Frm().*fnRect->fnGetHeight)() )
|
2004-11-09 12:46:54 +00:00
|
|
|
{
|
2004-12-23 09:06:35 +00:00
|
|
|
// --> OD 2004-11-25 #115759# - no PREP_ADJUST_FRM and size
|
|
|
|
// invalidation, if height decreases only by the additional
|
|
|
|
// lower space as last content of a table cell and an existing
|
|
|
|
// follow containing one line exists.
|
|
|
|
const SwTwips nHDiff = nOldH - (Frm().*fnRect->fnGetHeight)();
|
|
|
|
const bool bNoPrepAdjustFrm =
|
|
|
|
nHDiff > 0 && IsInTab() && GetFollow() &&
|
2007-06-26 09:42:04 +00:00
|
|
|
( 1 == static_cast<SwTxtFrm*>(GetFollow())->GetLineCount( STRING_LEN ) || (static_cast<SwTxtFrm*>(GetFollow())->Frm().*fnRect->fnGetWidth)() < 0 ) &&
|
2004-12-23 09:06:35 +00:00
|
|
|
GetFollow()->CalcAddLowerSpaceAsLastInTableCell() == nHDiff;
|
|
|
|
if ( !bNoPrepAdjustFrm )
|
|
|
|
{
|
|
|
|
Prepare( PREP_ADJUST_FRM );
|
|
|
|
bValidSize = FALSE;
|
|
|
|
}
|
|
|
|
// <--
|
2004-11-09 12:46:54 +00:00
|
|
|
}
|
|
|
|
// <--
|
2001-09-14 09:59:33 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
//Damit die Witwen- und Waisen-Regelung eine Change bekommt muss der
|
|
|
|
//CntntFrm benachrichtigt werden.
|
|
|
|
//Kriterium:
|
|
|
|
//- Er muss Moveable sein (sonst mach das Spalten keinen Sinn.)
|
|
|
|
//- Er muss mit der Unterkante der PrtArea des Upper ueberlappen.
|
|
|
|
if ( !bMustFit )
|
|
|
|
{
|
|
|
|
BOOL bWidow = TRUE;
|
2001-12-12 13:44:09 +00:00
|
|
|
const SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
|
2001-09-14 09:59:33 +00:00
|
|
|
if ( bMoveable && !bFormatted && ( GetFollow() ||
|
2001-09-19 07:45:10 +00:00
|
|
|
( (Frm().*fnRect->fnOverStep)( nDeadLine ) ) ) )
|
2001-09-14 09:59:33 +00:00
|
|
|
{
|
|
|
|
Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
|
|
|
|
bValidSize = bWidow = FALSE;
|
|
|
|
}
|
2001-09-19 07:45:10 +00:00
|
|
|
if( (Frm().*fnRect->fnGetPos)() != aOldFrmPos ||
|
|
|
|
(Prt().*fnRect->fnGetPos)() != aOldPrtPos )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
// In diesem Prepare erfolgt ggf. ein _InvalidateSize().
|
|
|
|
// bValidSize wird FALSE und das Format() wird gerufen.
|
|
|
|
Prepare( PREP_POS_CHGD, (const void*)&bFormatted, FALSE );
|
|
|
|
if ( bWidow && GetFollow() )
|
|
|
|
{ Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
|
|
|
|
bValidSize = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !bValidSize )
|
2003-04-17 15:06:21 +00:00
|
|
|
{
|
|
|
|
bValidSize = bFormatted = TRUE;
|
2002-09-13 11:13:06 +00:00
|
|
|
++nFormatCount;
|
|
|
|
if( nFormatCount > STOP_FLY_FORMAT )
|
|
|
|
SetFlyLock( TRUE );
|
2006-10-13 11:19:53 +00:00
|
|
|
// --> OD 2006-09-25 #b6448963# - loop prevention
|
|
|
|
// No format any longer, if <cnStopFormat> consequetive formats
|
|
|
|
// without change occur.
|
|
|
|
if ( nConsequetiveFormatsWithoutChange <= cnStopFormat )
|
|
|
|
{
|
|
|
|
Format();
|
|
|
|
}
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSERT( false, "debug assertion: <SwCntntFrm::MakeAll()> - format of text frame suppressed by fix b6448963" );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2003-04-17 15:06:21 +00:00
|
|
|
|
2003-07-21 09:30:47 +00:00
|
|
|
// FME 16.07.2003 #i16930# - removed this code because it did not work
|
|
|
|
|
2003-04-17 15:06:21 +00:00
|
|
|
// OD 04.04.2003 #108446# - react on the situation detected in the text
|
|
|
|
// formatting - see <SwTxtFrm::FormatAdjust(..)>:
|
|
|
|
// text frame has to move forward, because its text formatting stopped,
|
|
|
|
// created a follow and detected, that it contains no content.
|
2003-07-21 09:30:47 +00:00
|
|
|
/* if ( IsTxtFrm() && bValidPos && bValidSize && bValidPrtArea &&
|
2003-04-17 15:06:21 +00:00
|
|
|
(Frm().*fnRect->fnGetHeight)() == 0 &&
|
|
|
|
HasFollow()
|
|
|
|
)
|
|
|
|
{
|
|
|
|
SwFrm* pOldUpper = GetUpper();
|
|
|
|
MoveFwd( TRUE, FALSE );
|
|
|
|
if ( GetUpper() != pOldUpper )
|
|
|
|
{
|
|
|
|
bMovedFwd = TRUE;
|
|
|
|
SWREFRESHFN( this )
|
|
|
|
continue;
|
|
|
|
}
|
2003-07-21 09:30:47 +00:00
|
|
|
} */
|
2003-04-17 15:06:21 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//Wenn ich der erste einer Kette bin koennte ich mal sehen ob
|
|
|
|
//ich zurueckfliessen kann (wenn ich mich ueberhaupt bewegen soll).
|
|
|
|
//Damit es keine Oszillation gibt, darf ich nicht gerade vorwaerts
|
|
|
|
//geflossen sein.
|
|
|
|
BOOL bDummy;
|
2004-01-13 10:14:29 +00:00
|
|
|
if ( !lcl_Prev( this ) &&
|
|
|
|
!bMovedFwd &&
|
|
|
|
( bMoveable || ( bFly && !bTab ) ) &&
|
|
|
|
( !bFtn || !GetUpper()->FindFtnFrm()->GetPrev() )
|
|
|
|
&& MoveBwd( bDummy ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-11-14 13:40:22 +00:00
|
|
|
SWREFRESHFN( this )
|
2000-09-18 23:08:29 +00:00
|
|
|
bMovedBwd = TRUE;
|
|
|
|
bFormatted = FALSE;
|
2002-08-19 08:57:30 +00:00
|
|
|
if ( bKeep && bMoveable )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( CheckMoveFwd( bMakePage, FALSE, bMovedBwd ) )
|
|
|
|
{
|
|
|
|
bMovedFwd = TRUE;
|
|
|
|
bMoveable = IsMoveable();
|
2001-11-14 13:40:22 +00:00
|
|
|
SWREFRESHFN( this )
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-09-19 07:45:10 +00:00
|
|
|
Point aOldPos = (Frm().*fnRect->fnGetPos)();
|
2001-09-14 09:59:33 +00:00
|
|
|
MakePos();
|
2001-09-19 07:45:10 +00:00
|
|
|
if( aOldPos != (Frm().*fnRect->fnGetPos)() )
|
2001-09-14 09:59:33 +00:00
|
|
|
{
|
|
|
|
Prepare( PREP_POS_CHGD, (const void*)&bFormatted, FALSE );
|
|
|
|
if ( !bValidSize )
|
|
|
|
{
|
|
|
|
(Frm().*fnRect->fnSetWidth)( (GetUpper()->
|
|
|
|
Prt().*fnRect->fnGetWidth)() );
|
|
|
|
if ( !bValidPrtArea )
|
|
|
|
{
|
|
|
|
const long nOldW = (Prt().*fnRect->fnGetWidth)();
|
|
|
|
MakePrtArea( rAttrs );
|
|
|
|
if( nOldW != (Prt().*fnRect->fnGetWidth)() )
|
|
|
|
Prepare( PREP_FIXSIZE_CHG, 0, FALSE );
|
|
|
|
}
|
|
|
|
if( GetFollow() )
|
|
|
|
Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
|
|
|
|
bValidSize = bFormatted = TRUE;
|
|
|
|
Format();
|
|
|
|
}
|
|
|
|
}
|
2001-11-22 16:51:47 +00:00
|
|
|
SwFrm *pNxt = HasFollow() ? NULL : FindNext();
|
2000-09-18 23:08:29 +00:00
|
|
|
while( pNxt && pNxt->IsSctFrm() )
|
|
|
|
{ // Leere Bereiche auslassen, in die anderen hinein
|
|
|
|
if( ((SwSectionFrm*)pNxt)->GetSection() )
|
|
|
|
{
|
|
|
|
SwFrm* pTmp = ((SwSectionFrm*)pNxt)->ContainsAny();
|
|
|
|
if( pTmp )
|
|
|
|
{
|
|
|
|
pNxt = pTmp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pNxt = pNxt->FindNext();
|
|
|
|
}
|
|
|
|
if ( pNxt )
|
|
|
|
{
|
|
|
|
pNxt->Calc();
|
|
|
|
if( bValidPos && !GetIndNext() )
|
|
|
|
{
|
|
|
|
SwSectionFrm *pSct = FindSctFrm();
|
|
|
|
if( pSct && !pSct->GetValidSizeFlag() )
|
|
|
|
{
|
|
|
|
SwSectionFrm* pNxtSct = pNxt->FindSctFrm();
|
|
|
|
if( pNxtSct && pSct->IsAnFollow( pNxtSct ) )
|
|
|
|
bValidPos = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
bValidPos = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Der TxtFrm Validiert sich bei Fussnoten ggf. selbst, dass kann leicht
|
|
|
|
//dazu fuehren, dass seine Position obwohl unrichtig valide ist.
|
|
|
|
if ( bValidPos )
|
|
|
|
{
|
2006-02-03 16:17:13 +00:00
|
|
|
// --> OD 2006-01-23 #i59341#
|
|
|
|
// Workaround for inadequate layout algorithm:
|
|
|
|
// suppress invalidation and calculation of position, if paragraph
|
|
|
|
// has formatted itself at least STOP_FLY_FORMAT times and
|
|
|
|
// has anchored objects.
|
|
|
|
// Thus, the anchored objects get the possibility to format itself
|
|
|
|
// and this probably solve the layout loop.
|
|
|
|
if ( bFtn &&
|
|
|
|
nFormatCount <= STOP_FLY_FORMAT &&
|
|
|
|
!GetDrawObjs() )
|
|
|
|
// <--
|
2003-04-17 15:06:21 +00:00
|
|
|
{
|
|
|
|
bValidPos = FALSE;
|
2000-09-18 23:08:29 +00:00
|
|
|
MakePos();
|
2001-09-19 07:45:10 +00:00
|
|
|
aOldFrmPos = (Frm().*fnRect->fnGetPos)();
|
|
|
|
aOldPrtPos = (Prt().*fnRect->fnGetPos)();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-13 11:19:53 +00:00
|
|
|
// --> OD 2006-09-25 #b6448963# - loop prevention
|
|
|
|
{
|
|
|
|
if ( aOldFrm_StopFormat == Frm() &&
|
|
|
|
aOldPrt_StopFormat == Prt() )
|
|
|
|
{
|
|
|
|
++nConsequetiveFormatsWithoutChange;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nConsequetiveFormatsWithoutChange = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//Wieder ein Wert ungueltig? - dann nochmal das ganze...
|
|
|
|
if ( !bValidPos || !bValidSize || !bValidPrtArea )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
//Fertig?
|
|
|
|
// Achtung, wg. Hoehe==0, ist es besser statt Bottom() Top()+Height() zu nehmen
|
2001-09-14 09:59:33 +00:00
|
|
|
// (kommt bei Undersized TxtFrms an der Unterkante eines spaltigen Bereichs vor)
|
2004-01-13 10:14:29 +00:00
|
|
|
const long nPrtBottom = (GetUpper()->*fnRect->fnGetPrtBottom)();
|
|
|
|
const long nBottomDist = (Frm().*fnRect->fnBottomDist)( nPrtBottom );
|
|
|
|
if( nBottomDist >= 0 )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2002-08-19 08:57:30 +00:00
|
|
|
if ( bKeep && bMoveable )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
//Wir sorgen dafuer, dass der Nachfolger gleich mit formatiert
|
|
|
|
//wird. Dadurch halten wir das Heft in der Hand, bis wirklich
|
|
|
|
//(fast) alles stabil ist. So vermeiden wir Endlosschleifen,
|
|
|
|
//die durch staendig wiederholte Versuche entstehen.
|
|
|
|
//Das bMoveFwdInvalid ist fuer #38407# notwendig. War urspruenglich
|
|
|
|
//in flowfrm.cxx rev 1.38 behoben, das unterbrach aber obiges
|
|
|
|
//Schema und spielte lieber Tuerme von Hanoi (#43669#).
|
2001-11-22 16:51:47 +00:00
|
|
|
SwFrm *pNxt = HasFollow() ? NULL : FindNext();
|
2000-09-18 23:08:29 +00:00
|
|
|
// Bei Bereichen nehmen wir lieber den Inhalt, denn nur
|
|
|
|
// dieser kann ggf. die Seite wechseln
|
|
|
|
while( pNxt && pNxt->IsSctFrm() )
|
|
|
|
{
|
|
|
|
if( ((SwSectionFrm*)pNxt)->GetSection() )
|
|
|
|
{
|
|
|
|
pNxt = ((SwSectionFrm*)pNxt)->ContainsAny();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pNxt = pNxt->FindNext();
|
|
|
|
}
|
|
|
|
if ( pNxt )
|
|
|
|
{
|
2007-09-27 08:01:12 +00:00
|
|
|
const BOOL bMoveFwdInvalid = 0 != GetIndNext();
|
|
|
|
const BOOL bNxtNew =
|
2001-09-14 09:59:33 +00:00
|
|
|
( 0 == (pNxt->Prt().*fnRect->fnGetHeight)() ) &&
|
|
|
|
(!pNxt->IsTxtFrm() ||!((SwTxtFrm*)pNxt)->IsHiddenNow());
|
2003-09-25 09:49:15 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
pNxt->Calc();
|
2003-09-25 09:49:15 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !bMovedBwd &&
|
|
|
|
((bMoveFwdInvalid && !GetIndNext()) ||
|
|
|
|
bNxtNew) )
|
2002-04-25 07:39:08 +00:00
|
|
|
{
|
|
|
|
if( bMovedFwd )
|
|
|
|
pNotify->SetInvaKeep();
|
2000-09-18 23:08:29 +00:00
|
|
|
bMovedFwd = FALSE;
|
2002-04-25 07:39:08 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Ich passe nicht mehr in meinen Uebergeordneten, also ist es jetzt
|
|
|
|
//an der Zeit moeglichst konstruktive Veranderungen vorzunehmen
|
|
|
|
|
|
|
|
//Wenn ich den uebergeordneten Frm nicht verlassen darf, habe
|
|
|
|
//ich ein Problem; Frei nach Artur Dent tun wir das einzige das man
|
|
|
|
//mit einen nicht loesbaren Problem tun kann: wir ignorieren es - und
|
|
|
|
//zwar mit aller Kraft.
|
|
|
|
if ( !bMoveable || IsUndersized() )
|
|
|
|
{
|
|
|
|
if( !bMoveable && IsInTab() )
|
|
|
|
{
|
2001-12-12 13:44:09 +00:00
|
|
|
long nDiff = -(Frm().*fnRect->fnBottomDist)(
|
|
|
|
(GetUpper()->*fnRect->fnGetPrtBottom)() );
|
2007-02-28 14:47:09 +00:00
|
|
|
long nReal = GetUpper()->Grow( nDiff );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( nReal )
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Wenn ich nun ueberhaupt ganz und garnicht in meinen Upper passe
|
|
|
|
//so kann die Situation vielleicht doch noch durch Aufbrechen
|
|
|
|
//aufgeklart werden. Diese Situation tritt bei einem frisch
|
|
|
|
//erzeugten Follow auf, der zwar auf die Folgeseite geschoben wurde
|
|
|
|
//aber selbst noch zu gross fuer diese ist; also wiederum
|
|
|
|
//aufgespalten werden muss.
|
|
|
|
//Wenn ich nicht passe und nicht Spaltbar (WouldFit()) bin, so schicke
|
|
|
|
//ich meinem TxtFrmanteil die Nachricht, dass eben falls moeglich
|
|
|
|
//trotz des Attributes 'nicht aufspalten' aufgespalten werden muss.
|
|
|
|
BOOL bMoveOrFit = FALSE;
|
|
|
|
BOOL bDontMoveMe = !GetIndPrev();
|
|
|
|
if( bDontMoveMe && IsInSct() )
|
|
|
|
{
|
|
|
|
SwFtnBossFrm* pBoss = FindFtnBossFrm();
|
|
|
|
bDontMoveMe = !pBoss->IsInSct() ||
|
|
|
|
( !pBoss->Lower()->GetNext() && !pBoss->GetPrev() );
|
|
|
|
}
|
|
|
|
|
2004-01-13 10:14:29 +00:00
|
|
|
// Finally, we are able to split table rows. Therefore, bDontMoveMe
|
|
|
|
// can be set to FALSE:
|
2007-02-28 14:47:09 +00:00
|
|
|
if( bDontMoveMe && IsInTab() &&
|
|
|
|
0 != const_cast<SwCntntFrm*>(this)->GetNextCellLeaf( MAKEPAGE_NONE ) )
|
2004-01-13 10:14:29 +00:00
|
|
|
bDontMoveMe = FALSE;
|
|
|
|
|
2001-09-14 09:59:33 +00:00
|
|
|
if ( bDontMoveMe && (Frm().*fnRect->fnGetHeight)() >
|
|
|
|
(GetUpper()->Prt().*fnRect->fnGetHeight)() )
|
|
|
|
{
|
|
|
|
if ( !bFitPromise )
|
|
|
|
{
|
|
|
|
SwTwips nTmp = (GetUpper()->Prt().*fnRect->fnGetHeight)() -
|
|
|
|
(Prt().*fnRect->fnGetTop)();
|
2007-02-28 14:47:09 +00:00
|
|
|
BOOL bSplit = !IsFwdMoveAllowed();
|
2003-09-25 09:49:15 +00:00
|
|
|
if ( nTmp > 0 && WouldFit( nTmp, bSplit, sal_False ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
|
|
|
|
bValidSize = FALSE;
|
|
|
|
bFitPromise = TRUE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* -----------------19.02.99 12:58-------------------
|
|
|
|
* Frueher wurde in Rahmen und Bereichen niemals versucht,
|
|
|
|
* durch bMoveOrFit den TxtFrm unter Verzicht auf seine
|
|
|
|
* Attribute (Widows,Keep) doch noch passend zu bekommen.
|
|
|
|
* Dies haette zumindest bei spaltigen Rahmen versucht
|
|
|
|
* werden muessen, spaetestens bei verketteten Rahmen und
|
|
|
|
* in Bereichen muss es versucht werden.
|
|
|
|
* Ausnahme: Wenn wir im FormatWidthCols stehen, duerfen die
|
|
|
|
* Attribute nicht ausser Acht gelassen werden.
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
else if ( !bFtn && bMoveable &&
|
|
|
|
( !bFly || !FindFlyFrm()->IsColLocked() ) &&
|
|
|
|
( !bSct || !FindSctFrm()->IsColLocked() ) )
|
|
|
|
bMoveOrFit = TRUE;
|
|
|
|
}
|
2009-07-10 14:03:42 +02:00
|
|
|
#ifdef DBG_UTIL
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSERT( FALSE, "+TxtFrm hat WouldFit-Versprechen nicht eingehalten." );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
//Mal sehen ob ich irgenwo Platz finde...
|
|
|
|
//Benachbarte Fussnoten werden in _MoveFtnCntFwd 'vorgeschoben'
|
|
|
|
SwFrm *pPre = GetIndPrev();
|
|
|
|
SwFrm *pOldUp = GetUpper();
|
|
|
|
|
|
|
|
/* MA 13. Oct. 98: Was soll das denn sein!?
|
|
|
|
* AMA 14. Dec 98: Wenn ein spaltiger Bereich keinen Platz mehr fuer seinen ersten ContentFrm
|
|
|
|
* bietet, so soll dieser nicht nur in die naechste Spalte, sondern ggf. bis zur naechsten
|
|
|
|
* Seite wandern und dort einen Section-Follow erzeugen.
|
|
|
|
*/
|
|
|
|
if( IsInSct() && bMovedFwd && bMakePage && pOldUp->IsColBodyFrm() &&
|
|
|
|
pOldUp->GetUpper()->GetUpper()->IsSctFrm() &&
|
|
|
|
( pPre || pOldUp->GetUpper()->GetPrev() ) &&
|
|
|
|
((SwSectionFrm*)pOldUp->GetUpper()->GetUpper())->MoveAllowed(this) )
|
|
|
|
bMovedFwd = FALSE;
|
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
const sal_Bool bCheckForGrownBody = pOldUp->IsBodyFrm();
|
|
|
|
const long nOldBodyHeight = (pOldUp->Frm().*fnRect->fnGetHeight)();
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !bMovedFwd && !MoveFwd( bMakePage, FALSE ) )
|
|
|
|
bMakePage = FALSE;
|
2001-11-14 13:40:22 +00:00
|
|
|
SWREFRESHFN( this )
|
2003-03-27 14:45:43 +00:00
|
|
|
|
|
|
|
// If MoveFwd moves the paragraph to the next page, a following
|
|
|
|
// paragraph, which contains footnotes can can cause the old upper
|
|
|
|
// frame to grow. In this case we explicitely allow a new check
|
|
|
|
// for MoveBwd. Robust: We also check the bMovedBwd flag again.
|
|
|
|
// If pOldUp was a footnote frame, it has been deleted inside MoveFwd.
|
|
|
|
// Therefore we only check for growing body frames.
|
|
|
|
if ( bCheckForGrownBody && ! bMovedBwd && pOldUp != GetUpper() &&
|
|
|
|
(pOldUp->Frm().*fnRect->fnGetHeight)() > nOldBodyHeight )
|
|
|
|
bMovedFwd = FALSE;
|
|
|
|
else
|
|
|
|
bMovedFwd = TRUE;
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
bFormatted = FALSE;
|
|
|
|
if ( bMoveOrFit && GetUpper() == pOldUp )
|
|
|
|
{
|
2007-09-20 10:48:30 +00:00
|
|
|
// FME 2007-08-30 #i81146# new loop control
|
|
|
|
if ( nConsequetiveFormatsWithoutChange <= cnStopFormat )
|
|
|
|
{
|
|
|
|
Prepare( PREP_MUST_FIT, 0, FALSE );
|
|
|
|
bValidSize = FALSE;
|
|
|
|
bMustFit = TRUE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
ASSERT( false, "LoopControl in SwCntntFrm::MakeAll" )
|
|
|
|
#endif
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if ( bMovedBwd && GetUpper() )
|
|
|
|
{ //Unuetz gewordene Invalidierungen zuruecknehmen.
|
|
|
|
GetUpper()->ResetCompletePaint();
|
|
|
|
if( pPre && !pPre->IsSctFrm() )
|
|
|
|
::ValidateSz( pPre );
|
|
|
|
}
|
|
|
|
|
|
|
|
} //while ( !bValidPos || !bValidSize || !bValidPrtArea )
|
|
|
|
|
2005-02-22 07:19:36 +00:00
|
|
|
|
|
|
|
// NEW: Looping Louie (Light). Should not be applied in balanced sections.
|
|
|
|
// Should only be applied if there is no better solution!
|
|
|
|
LOOPING_LOUIE_LIGHT( bMovedFwd && bMovedBwd && !IsInBalancedSection() &&
|
|
|
|
(
|
|
|
|
|
|
|
|
// --> FME 2005-01-26 #118572#
|
|
|
|
( bFtn && !FindFtnFrm()->GetRef()->IsInSct() ) ||
|
|
|
|
// <--
|
|
|
|
|
|
|
|
// --> FME 2005-01-27 #i33887#
|
|
|
|
( IsInSct() && bKeep )
|
|
|
|
// <--
|
|
|
|
|
|
|
|
// ... add your conditions here ...
|
|
|
|
|
|
|
|
),
|
|
|
|
static_cast<SwTxtFrm&>(*this) );
|
|
|
|
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pSaveFtn )
|
|
|
|
delete pSaveFtn;
|
|
|
|
|
|
|
|
UnlockJoin();
|
|
|
|
if ( bMovedFwd || bMovedBwd )
|
|
|
|
pNotify->SetInvaKeep();
|
2004-03-09 08:30:07 +00:00
|
|
|
// OD 2004-02-26 #i25029#
|
|
|
|
if ( bMovedFwd )
|
|
|
|
{
|
|
|
|
pNotify->SetInvalidatePrevPrtArea();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
delete pNotify;
|
2002-09-13 11:13:06 +00:00
|
|
|
SetFlyLock( FALSE );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwCntntFrm::_WouldFit()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 28. Feb. 95
|
|
|
|
|* Letzte Aenderung AMA 15. Feb. 99
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MakeNxt( SwFrm *pFrm, SwFrm *pNxt )
|
|
|
|
{
|
|
|
|
//fix(25455): Validieren, sonst kommt es zu einer Rekursion.
|
|
|
|
//Der erste Versuch, der Abbruch mit pFrm = 0 wenn !Valid,
|
|
|
|
//fuehrt leider zu dem Problem, dass das Keep dann u.U. nicht mehr
|
|
|
|
//korrekt beachtet wird (27417)
|
|
|
|
const BOOL bOldPos = pFrm->GetValidPosFlag();
|
|
|
|
const BOOL bOldSz = pFrm->GetValidSizeFlag();
|
|
|
|
const BOOL bOldPrt = pFrm->GetValidPrtAreaFlag();
|
|
|
|
pFrm->bValidPos = pFrm->bValidPrtArea = pFrm->bValidSize = TRUE;
|
|
|
|
|
|
|
|
//fix(29272): Nicht MakeAll rufen, dort wird evtl. pFrm wieder invalidert
|
|
|
|
//und kommt rekursiv wieder herein.
|
|
|
|
if ( pNxt->IsCntntFrm() )
|
|
|
|
{
|
|
|
|
SwCntntNotify aNotify( (SwCntntFrm*)pNxt );
|
|
|
|
SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNxt );
|
|
|
|
const SwBorderAttrs &rAttrs = *aAccess.Get();
|
|
|
|
if ( !pNxt->GetValidSizeFlag() )
|
2001-09-14 09:59:33 +00:00
|
|
|
{
|
|
|
|
if( pNxt->IsVertical() )
|
|
|
|
pNxt->Frm().Height( pNxt->GetUpper()->Prt().Height() );
|
|
|
|
else
|
2002-10-17 13:10:00 +00:00
|
|
|
pNxt->Frm().Width( pNxt->GetUpper()->Prt().Width() );
|
2001-09-14 09:59:33 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
((SwCntntFrm*)pNxt)->MakePrtArea( rAttrs );
|
|
|
|
pNxt->Format( &rAttrs );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SwLayNotify aNotify( (SwLayoutFrm*)pNxt );
|
|
|
|
SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNxt );
|
|
|
|
const SwBorderAttrs &rAttrs = *aAccess.Get();
|
|
|
|
if ( !pNxt->GetValidSizeFlag() )
|
2001-09-14 09:59:33 +00:00
|
|
|
{
|
|
|
|
if( pNxt->IsVertical() )
|
|
|
|
pNxt->Frm().Height( pNxt->GetUpper()->Prt().Height() );
|
|
|
|
else
|
2002-10-17 13:10:00 +00:00
|
|
|
pNxt->Frm().Width( pNxt->GetUpper()->Prt().Width() );
|
2001-09-14 09:59:33 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
pNxt->Format( &rAttrs );
|
|
|
|
}
|
|
|
|
|
|
|
|
pFrm->bValidPos = bOldPos;
|
|
|
|
pFrm->bValidSize = bOldSz;
|
|
|
|
pFrm->bValidPrtArea = bOldPrt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Diese Routine ueberprueft, ob zwischen dem FtnBoss von pFrm und dem
|
|
|
|
// von pNxt keine anderen FtnBosse liegen
|
|
|
|
|
|
|
|
BOOL lcl_IsNextFtnBoss( const SwFrm *pFrm, const SwFrm* pNxt )
|
|
|
|
{
|
|
|
|
ASSERT( pFrm && pNxt, "lcl_IsNextFtnBoss: No Frames?" );
|
|
|
|
pFrm = pFrm->FindFtnBossFrm();
|
|
|
|
pNxt = pNxt->FindFtnBossFrm();
|
|
|
|
// Falls pFrm eine letzte Spalte ist, wird stattdessen die Seite genommen
|
|
|
|
while( pFrm && pFrm->IsColumnFrm() && !pFrm->GetNext() )
|
|
|
|
pFrm = pFrm->GetUpper()->FindFtnBossFrm();
|
|
|
|
// Falls pNxt eine erste Spalte ist, wird stattdessen die Seite genommen
|
|
|
|
while( pNxt && pNxt->IsColumnFrm() && !pNxt->GetPrev() )
|
|
|
|
pNxt = pNxt->GetUpper()->FindFtnBossFrm();
|
|
|
|
// So, jetzt muessen pFrm und pNxt entweder zwei benachbarte Seiten oder Spalten sein.
|
|
|
|
return ( pFrm && pNxt && pFrm->GetNext() == pNxt );
|
|
|
|
}
|
|
|
|
|
2008-01-04 12:21:28 +00:00
|
|
|
// --> OD 2007-11-26 #b6614158#
|
|
|
|
BOOL SwCntntFrm::_WouldFit( SwTwips nSpace,
|
|
|
|
SwLayoutFrm *pNewUpper,
|
|
|
|
BOOL bTstMove,
|
|
|
|
const bool bObjsInNewUpper )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
//Damit die Fussnote sich ihren Platz sorgsam waehlt, muss
|
|
|
|
//sie in jedem Fall gemoved werden, wenn zwischen dem
|
|
|
|
//neuen Upper und ihrer aktuellen Seite/Spalte mindestens eine
|
|
|
|
//Seite/Spalte liegt.
|
|
|
|
SwFtnFrm* pFtnFrm = 0;
|
|
|
|
if ( IsInFtn() )
|
|
|
|
{
|
|
|
|
if( !lcl_IsNextFtnBoss( pNewUpper, this ) )
|
|
|
|
return TRUE;
|
|
|
|
pFtnFrm = FindFtnFrm();
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL bRet;
|
|
|
|
BOOL bSplit = !pNewUpper->Lower();
|
|
|
|
SwCntntFrm *pFrm = this;
|
2007-09-27 08:01:12 +00:00
|
|
|
const SwFrm *pTmpPrev = pNewUpper->Lower();
|
|
|
|
if( pTmpPrev && pTmpPrev->IsFtnFrm() )
|
|
|
|
pTmpPrev = ((SwFtnFrm*)pTmpPrev)->Lower();
|
|
|
|
while ( pTmpPrev && pTmpPrev->GetNext() )
|
|
|
|
pTmpPrev = pTmpPrev->GetNext();
|
2000-09-18 23:08:29 +00:00
|
|
|
do
|
|
|
|
{
|
2005-09-28 10:10:56 +00:00
|
|
|
// --> FME 2005-03-31 #b6236853# #i46181#
|
|
|
|
SwTwips nSecondCheck = 0;
|
|
|
|
SwTwips nOldSpace = nSpace;
|
|
|
|
BOOL bOldSplit = bSplit;
|
|
|
|
// <--
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( bTstMove || IsInFly() || ( IsInSct() &&
|
|
|
|
( pFrm->GetUpper()->IsColBodyFrm() || ( pFtnFrm &&
|
|
|
|
pFtnFrm->GetUpper()->GetUpper()->IsColumnFrm() ) ) ) )
|
|
|
|
{
|
|
|
|
//Jetzt wirds ein bischen hinterlistig; empfindliche Gemueter sollten
|
|
|
|
//lieber wegsehen. Wenn ein Flys Spalten enthaelt so sind die Cntnts
|
|
|
|
//moveable, mit Ausnahme der in der letzten Spalte (siehe
|
|
|
|
//SwFrm::IsMoveable()). Zurueckfliessen duerfen sie aber natuerlich.
|
|
|
|
//Das WouldFit() liefert leider nur dann einen vernueftigen Wert, wenn
|
|
|
|
//der Frm moveable ist. Um dem WouldFit() einen Moveable Frm
|
|
|
|
//vorzugaukeln haenge ich ihn einfach solange um.
|
|
|
|
// Auch bei spaltigen Bereichen muss umgehaengt werden, damit
|
|
|
|
// SwSectionFrm::Growable() den richtigen Wert liefert.
|
|
|
|
// Innerhalb von Fussnoten muss ggf. sogar der SwFtnFrm umgehaengt werden,
|
|
|
|
// falls es dort keinen SwFtnFrm gibt.
|
|
|
|
SwFrm* pTmpFrm = pFrm->IsInFtn() && !pNewUpper->FindFtnFrm() ?
|
|
|
|
(SwFrm*)pFrm->FindFtnFrm() : pFrm;
|
|
|
|
SwLayoutFrm *pUp = pTmpFrm->GetUpper();
|
|
|
|
SwFrm *pOldNext = pTmpFrm->GetNext();
|
|
|
|
pTmpFrm->Remove();
|
|
|
|
pTmpFrm->InsertBefore( pNewUpper, 0 );
|
2003-04-17 15:06:21 +00:00
|
|
|
if ( pFrm->IsTxtFrm() &&
|
|
|
|
( bTstMove ||
|
|
|
|
((SwTxtFrm*)pFrm)->HasFollow() ||
|
|
|
|
( !((SwTxtFrm*)pFrm)->HasPara() &&
|
|
|
|
!((SwTxtFrm*)pFrm)->IsEmpty()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
bTstMove = TRUE;
|
2007-09-27 08:01:12 +00:00
|
|
|
bRet = ((SwTxtFrm*)pFrm)->TestFormat( pTmpPrev, nSpace, bSplit );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
2003-09-25 09:49:15 +00:00
|
|
|
bRet = pFrm->WouldFit( nSpace, bSplit, sal_False );
|
2005-09-28 10:10:56 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
pTmpFrm->Remove();
|
|
|
|
pTmpFrm->InsertBefore( pUp, pOldNext );
|
|
|
|
}
|
|
|
|
else
|
2005-09-28 10:10:56 +00:00
|
|
|
{
|
2003-09-25 09:49:15 +00:00
|
|
|
bRet = pFrm->WouldFit( nSpace, bSplit, sal_False );
|
2005-09-28 10:10:56 +00:00
|
|
|
nSecondCheck = !bSplit ? 1 : 0;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-06-25 09:49:15 +00:00
|
|
|
SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm );
|
|
|
|
const SwBorderAttrs &rAttrs = *aAccess.Get();
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//Bitter aber wahr: Der Abstand muss auch noch mit einkalkuliert werden.
|
|
|
|
//Bei TestFormatierung ist dies bereits geschehen.
|
|
|
|
if ( bRet && !bTstMove )
|
|
|
|
{
|
|
|
|
SwTwips nUpper;
|
2005-09-28 10:10:56 +00:00
|
|
|
|
2007-09-27 08:01:12 +00:00
|
|
|
if ( pTmpPrev )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 08:01:12 +00:00
|
|
|
nUpper = CalcUpperSpace( NULL, pTmpPrev );
|
2003-06-25 09:49:15 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
// in balanced columned section frames we do not want the
|
|
|
|
// common border
|
|
|
|
sal_Bool bCommonBorder = sal_True;
|
|
|
|
if ( pFrm->IsInSct() && pFrm->GetUpper()->IsColBodyFrm() )
|
|
|
|
{
|
|
|
|
const SwSectionFrm* pSct = pFrm->FindSctFrm();
|
|
|
|
bCommonBorder = pSct->GetFmt()->GetBalancedColumns().GetValue();
|
|
|
|
}
|
2005-09-28 10:10:56 +00:00
|
|
|
|
|
|
|
// --> FME 2005-03-31 #b6236853# #i46181#
|
|
|
|
nSecondCheck = ( 1 == nSecondCheck &&
|
|
|
|
pFrm == this &&
|
|
|
|
IsTxtFrm() &&
|
|
|
|
bCommonBorder &&
|
|
|
|
!static_cast<const SwTxtFrm*>(this)->IsEmpty() ) ?
|
|
|
|
nUpper :
|
|
|
|
0;
|
|
|
|
// <--
|
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
nUpper += bCommonBorder ?
|
2004-03-09 08:30:07 +00:00
|
|
|
rAttrs.GetBottomLine( *(pFrm) ) :
|
2003-03-27 14:45:43 +00:00
|
|
|
rAttrs.CalcBottomLine();
|
2005-09-28 10:10:56 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
2001-09-14 09:59:33 +00:00
|
|
|
{
|
2005-09-28 10:10:56 +00:00
|
|
|
// --> FME 2005-03-31 #b6236853# #i46181#
|
|
|
|
nSecondCheck = 0;
|
|
|
|
// <--
|
|
|
|
|
2001-09-14 09:59:33 +00:00
|
|
|
if( pFrm->IsVertical() )
|
|
|
|
nUpper = pFrm->Frm().Width() - pFrm->Prt().Width();
|
|
|
|
else
|
2002-10-17 13:10:00 +00:00
|
|
|
nUpper = pFrm->Frm().Height() - pFrm->Prt().Height();
|
2001-09-14 09:59:33 +00:00
|
|
|
}
|
2005-09-28 10:10:56 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
nSpace -= nUpper;
|
2005-09-28 10:10:56 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( nSpace < 0 )
|
2005-09-28 10:10:56 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
bRet = FALSE;
|
2005-09-28 10:10:56 +00:00
|
|
|
|
|
|
|
// --> FME 2005-03-31 #b6236853# #i46181#
|
|
|
|
if ( nSecondCheck > 0 )
|
|
|
|
{
|
|
|
|
// The following code is indented to solve a (rare) problem
|
|
|
|
// causing some frames not to move backward:
|
|
|
|
// SwTxtFrm::WouldFit() claims that the whole paragraph
|
|
|
|
// fits into the given space and subtracts the height of
|
|
|
|
// all lines from nSpace. nSpace - nUpper is not a valid
|
|
|
|
// indicator if the frame should be allowed to move backward.
|
|
|
|
// We do a second check with the original remaining space
|
|
|
|
// reduced by the required upper space:
|
|
|
|
nOldSpace -= nSecondCheck;
|
|
|
|
const bool bSecondRet = nOldSpace >= 0 && pFrm->WouldFit( nOldSpace, bOldSplit, sal_False );
|
|
|
|
if ( bSecondRet && bOldSplit && nOldSpace >= 0 )
|
|
|
|
{
|
|
|
|
bRet = TRUE;
|
|
|
|
bSplit = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-03-23 10:36:45 +00:00
|
|
|
// OD 2004-03-01 #106629# - also consider lower spacing in table cells
|
|
|
|
if ( bRet && IsInTab() &&
|
2006-08-14 15:25:09 +00:00
|
|
|
pNewUpper->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) )
|
2004-03-23 10:36:45 +00:00
|
|
|
{
|
|
|
|
nSpace -= rAttrs.GetULSpace().GetLower();
|
|
|
|
if ( nSpace < 0 )
|
|
|
|
{
|
|
|
|
bRet = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-09 13:06:28 +00:00
|
|
|
if ( bRet && !bSplit && pFrm->IsKeep( rAttrs.GetAttrSet() ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( bTstMove )
|
2003-04-17 15:06:21 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
while( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->HasFollow() )
|
2003-04-17 15:06:21 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
pFrm = ((SwTxtFrm*)pFrm)->GetFollow();
|
2003-04-17 15:06:21 +00:00
|
|
|
}
|
|
|
|
// OD 11.04.2003 #108824# - If last follow frame of <this> text
|
|
|
|
// frame isn't valid, a formatting of the next content frame
|
|
|
|
// doesn't makes sense. Thus, return TRUE.
|
|
|
|
if ( IsAnFollow( pFrm ) && !pFrm->IsValid() )
|
|
|
|
{
|
|
|
|
ASSERT( false, "Only a warning for task 108824:/n<SwCntntFrm::_WouldFit(..) - follow not valid!" );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFrm *pNxt;
|
|
|
|
if( 0 != (pNxt = pFrm->FindNext()) && pNxt->IsCntntFrm() &&
|
|
|
|
( !pFtnFrm || ( pNxt->IsInFtn() &&
|
|
|
|
pNxt->FindFtnFrm()->GetAttr() == pFtnFrm->GetAttr() ) ) )
|
|
|
|
{
|
|
|
|
// ProbeFormatierung vertraegt keine absatz- oder gar zeichengebundene Objekte
|
2008-01-04 12:21:28 +00:00
|
|
|
// --> OD 2007-11-26 #b6614158#
|
|
|
|
// current solution for the test formatting doesn't work, if
|
|
|
|
// objects are present in the remaining area of the new upper
|
|
|
|
if ( bTstMove &&
|
|
|
|
( pNxt->GetDrawObjs() || bObjsInNewUpper ) )
|
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
return TRUE;
|
2008-01-04 12:21:28 +00:00
|
|
|
}
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( !pNxt->IsValid() )
|
|
|
|
MakeNxt( pFrm, pNxt );
|
|
|
|
|
|
|
|
//Kleiner Trick: Wenn der naechste einen Vorgaenger hat, so hat
|
|
|
|
//er den Absatzabstand bereits berechnet. Er braucht dann nicht
|
|
|
|
//teuer kalkuliert werden.
|
|
|
|
if( lcl_NotHiddenPrev( pNxt ) )
|
2007-09-27 08:01:12 +00:00
|
|
|
pTmpPrev = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow() )
|
2007-09-27 08:01:12 +00:00
|
|
|
pTmpPrev = lcl_NotHiddenPrev( pFrm );
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2007-09-27 08:01:12 +00:00
|
|
|
pTmpPrev = pFrm;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
pFrm = (SwCntntFrm*)pNxt;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pFrm = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pFrm = 0;
|
|
|
|
|
|
|
|
} while ( bRet && pFrm );
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|