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