Kaydet (Commit) f62ef4e8 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann Kaydeden (comit) Caolán McNamara

Resolves: #i123578# adjust table layout algorithm to avoid layout loops

--> no shrink of master table, when follow table current is layouting its lower
table row

(cherry picked from commit c037ec6a)

Conflicts:
	sw/source/core/inc/tabfrm.hxx
	sw/source/core/layout/tabfrm.cxx

Change-Id: Ic1366b20e421d582977d44c6dd7dae3865f53ec4
üst 72365491
......@@ -29,8 +29,6 @@ class SwAttrSetChg;
class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
{
// OD 14.03.2003 #i11760# - adjustment, because of method signature change
//darf mit den Flags spielen.
friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow );
//Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch.
......@@ -40,22 +38,22 @@ class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
SwTable* pTable;
sal_Bool bComplete :1; //Eintrage als Repaint ohne das CompletePaint
//der Basisklasse gesetzt werden muss. Damit
//sollen unertraegliche Tabellen-Repaints
//vermieden werden.
//der Basisklasse gesetzt werden muss. Damit
//sollen unertraegliche Tabellen-Repaints
//vermieden werden.
sal_Bool bCalcLowers :1; //Im MakeAll auf jedenfall auch fuer Stabilitaet
//des Inhaltes sorgen.
//des Inhaltes sorgen.
sal_Bool bLowersFormatted :1;//Kommunikation zwischen MakeAll und Layact
sal_Bool bLockBackMove :1; //BackMove-Test hat der Master erledigt.
sal_Bool bResizeHTMLTable :1; //Resize des HTMLTableLayout rufen im MakeAll
//Zur Optimierung, damit dies nicht im
//CntntFrm::Grow gerufen werden muss, denn dann
//wird es ggf. fuer jede Zelle gerufen #47483#
//Zur Optimierung, damit dies nicht im
//CntntFrm::Grow gerufen werden muss, denn dann
//wird es ggf. fuer jede Zelle gerufen #47483#
sal_Bool bONECalcLowers :1; //Primaer fuer die StarONE-SS. Beim MakeAll werden
//die Cntnts auf jedenfall per Calc() formatiert.
//es finden keine zusaetzlichen Invalidierungen
//statt und dieser Weg kann auch kaum garantien
//geben.
//die Cntnts auf jedenfall per Calc() formatiert.
//es finden keine zusaetzlichen Invalidierungen
//statt und dieser Weg kann auch kaum garantien
//geben.
sal_Bool bHasFollowFlowLine :1; // Means that the first line in the follow
// is indented to contain content from a broken
......@@ -85,14 +83,19 @@ class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
sal_Bool bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
// indicates, if the floating screen objects fits
bool mbInRecalcLowerRow : 1;
//Split() spaltet den Frm an der angegebenen Stelle, es wird ein
//Follow erzeugt und aufgebaut und direkt hinter this gepastet.
//Join() Holt sich den Inhalt aus dem Follow und vernichtet diesen.
bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
bool Join();
void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
void _UpdateAttr(
const SfxPoolItem*,
const SfxPoolItem*, sal_uInt8 &,
SwAttrSetChg *pa = 0,
SwAttrSetChg *pb = 0 );
virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat );
......@@ -163,6 +166,15 @@ public:
sal_Bool IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; }
void SetRemoveFollowFlowLinePending( sal_Bool bNew ) { bRemoveFollowFlowLinePending = bNew; }
bool IsInRecalcLowerRow() const
{
return mbInRecalcLowerRow;
}
void SetInRecalcLowerRow( bool bNew )
{
mbInRecalcLowerRow = bNew;
}
// #i26945#
sal_Bool IsConsiderObjsForMinCellHeight() const
{
......@@ -172,6 +184,7 @@ public:
{
bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight;
}
// #i26945#
sal_Bool DoesObjsFit() const
{
......@@ -187,8 +200,10 @@ public:
// End: New stuff for breaking table rows
//
sal_Bool CalcFlyOffsets( SwTwips& rUpper, long& rLeftOffset,
long& rRightOffset ) const;
sal_Bool CalcFlyOffsets(
SwTwips& rUpper,
long& rLeftOffset,
long& rRightOffset ) const;
SwTwips CalcHeightOfFirstContentLine() const;
......@@ -200,9 +215,7 @@ public:
// #i29550#
bool IsCollapsingBorders() const;
// used for collapsing border lines:
sal_uInt16 GetBottomLineSize() const;
// <-- collapsing
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
......
......@@ -87,6 +87,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab, SwFrm* pSib ):
// #i26945#
bConsiderObjsForMinCellHeight = sal_True;
bObjsDoesFit = sal_True;
mbInRecalcLowerRow = false;
mbFixSize = sal_False; //Don't fall for import filter again.
mnType = FRMC_TAB;
......@@ -118,6 +119,7 @@ SwTabFrm::SwTabFrm( SwTabFrm &rTab ) :
// #i26945#
bConsiderObjsForMinCellHeight = sal_True;
bObjsDoesFit = sal_True;
mbInRecalcLowerRow = false;
mbFixSize = sal_False; //Don't fall for import filter again.
mnType = FRMC_TAB;
......@@ -1999,7 +2001,7 @@ void SwTabFrm::MakeAll()
}
SwFrm *pPre;
if ( bKeep || (0 != (pPre = FindPrev()) &&
pPre->GetAttrSet()->GetKeep().GetValue()) )
pPre->GetAttrSet()->GetKeep().GetValue()) )
{
bCalcLowers = sal_True;
// #i99267#
......@@ -2028,12 +2030,12 @@ void SwTabFrm::MakeAll()
SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout();
if ( pLayout &&
((Prt().*fnRect->fnGetWidth)() != nOldPrtWidth ||
(Frm().*fnRect->fnGetWidth)() != nOldFrmWidth) )
((Prt().*fnRect->fnGetWidth)() != nOldPrtWidth ||
(Frm().*fnRect->fnGetWidth)() != nOldFrmWidth) )
{
delete pAccess;
bCalcLowers |= pLayout->Resize(
pLayout->GetBrowseWidthByTabFrm( *this ), sal_False );
pLayout->GetBrowseWidthByTabFrm( *this ), sal_False );
pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this );
pAttrs = pAccess->Get();
}
......@@ -2085,8 +2087,7 @@ void SwTabFrm::MakeAll()
pHTMLLayout->GetBrowseWidthByTabFrm( *this ),
sal_False );
pAccess= new SwBorderAttrAccess(
SwFrm::GetCache(), this );
pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this );
pAttrs = pAccess->Get();
}
......@@ -2119,17 +2120,14 @@ void SwTabFrm::MakeAll()
// check, if calculation of table frame is ready.
/// OD 23.10.2002 #103517# - Local variable <nDistanceToUpperPrtBottom>
/// Introduce local variable and init it with the distance from the
/// table frame bottom to the bottom of the upper printing area.
/// Note: negative values denotes the situation that table frame doesn't
/// fit in its upper.
// Local variable <nDistanceToUpperPrtBottom>
// Introduce local variable and init it with the distance from the
// table frame bottom to the bottom of the upper printing area.
// Note: negative values denotes the situation that table frame doesn't fit in its upper.
SwTwips nDistanceToUpperPrtBottom =
(Frm().*fnRect->fnBottomDist)( (GetUpper()->*fnRect->fnGetPrtBottom)());
/// OD 23.10.2002 #103517# - In online layout try to grow upper of table
/// frame, if table frame doesn't fit in its upper.
/// In online layout try to grow upper of table frame, if table frame doesn't fit in its upper.
const SwViewShell *pSh = getRootFrm()->GetCurrShell();
const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
if ( nDistanceToUpperPrtBottom < 0 && bBrowseMode )
......@@ -2137,8 +2135,7 @@ void SwTabFrm::MakeAll()
if ( GetUpper()->Grow( -nDistanceToUpperPrtBottom ) )
{
// upper is grown --> recalculate <nDistanceToUpperPrtBottom>
nDistanceToUpperPrtBottom =
(Frm().*fnRect->fnBottomDist)( (GetUpper()->*fnRect->fnGetPrtBottom)());
nDistanceToUpperPrtBottom = (Frm().*fnRect->fnBottomDist)( (GetUpper()->*fnRect->fnGetPrtBottom)());
}
}
......@@ -2148,7 +2145,6 @@ void SwTabFrm::MakeAll()
// the table to be split! Only skip this if condition once.
if( nDistanceToUpperPrtBottom >= 0 && !bLastRowHasToMoveToFollow )
{
// OD 23.10.2002 - translate german commentary
// If there is space left in the upper printing area, join as for trial
// at least one further row of an existing follow.
if ( !bSplit && GetFollow() )
......@@ -2193,8 +2189,8 @@ void SwTabFrm::MakeAll()
//
SwRowFrm *pRow = GetFollow()->GetFirstNonHeadlineRow();
//The follow becomes empty and invalid for this reason.
if ( !pRow )
//The follow becomes empty and invalid for this reason.
if ( !pRow )
{
Join();
continue;
......@@ -2215,8 +2211,10 @@ void SwTabFrm::MakeAll()
SwFrm* pNextRow = pRowToMove->GetNext();
if ( !pNextRow )
{
//The follow becomes empty and invalid for this reason.
Join();
}
else
{
pRowToMove->Cut();
......@@ -2225,8 +2223,7 @@ void SwTabFrm::MakeAll()
//Displace the footnotes!
if ( bMoveFtns )
if ( ((SwLayoutFrm*)pRowToMove)->MoveLowerFtns(
0, pOldBoss, FindFtnBossFrm( sal_True ), sal_True ) )
if ( ((SwLayoutFrm*)pRowToMove)->MoveLowerFtns( 0, pOldBoss, FindFtnBossFrm( sal_True ), sal_True ) )
GetUpper()->Calc();
pRowToMove = pNextRow;
......@@ -2382,7 +2379,11 @@ void SwTabFrm::MakeAll()
nDeadLine = (*fnRect->fnYInc)( nDeadLine,
GetUpper()->Grow( LONG_MAX, sal_True ) );
::lcl_RecalcRow( static_cast<SwRowFrm&>(*Lower()), nDeadLine );
{
SetInRecalcLowerRow( true );
::lcl_RecalcRow( static_cast<SwRowFrm&>(*Lower()), nDeadLine );
SetInRecalcLowerRow( false );
}
bLowersFormatted = sal_True;
aNotify.SetLowersComplete( sal_True );
......@@ -2528,10 +2529,10 @@ void SwTabFrm::MakeAll()
SwFrm* pNxt = ((SwFrm*)GetFollow())->FindNext();
if ( pNxt )
{
// OD 26.08.2003 #i18103# - no formatting
// of found next frame, if it's a follow
// section of the 'ColLocked' section,
// the follow table is in.
// #i18103# - no formatting of found next
// frame, if its a follow section of the
// 'ColLocked' section, the follow table is
// in.
bool bCalcNxt = true;
if ( GetFollow()->IsInSct() && pNxt->IsSctFrm() )
{
......@@ -2607,9 +2608,11 @@ void SwTabFrm::MakeAll()
}
if ( bMovedBwd && GetUpper() )
{
//During floating back the upper was animated to do a full repaint,
//we can now skip this after the whole back and forth floating.
GetUpper()->ResetCompletePaint();
}
if ( bCalcLowers && IsValid() )
{
......@@ -4594,8 +4597,10 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
SetCompletePaint();
SwTabFrm *pTab = FindTabFrm();
if ( !pTab->IsRebuildLastLine() && pTab->IsFollow() &&
this == pTab->GetFirstNonHeadlineRow() )
if ( !pTab->IsRebuildLastLine()
&& pTab->IsFollow()
&& this == pTab->GetFirstNonHeadlineRow()
&& !pTab->IsInRecalcLowerRow() )
{
SwTabFrm* pMasterTab = const_cast< SwTabFrm* >( pTab->FindMaster() );
pMasterTab->InvalidatePos();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment