You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by tr...@apache.org on 2018/08/01 04:58:36 UTC

svn commit: r1837212 - in /openoffice/trunk/main/sw/source/core: inc/cntfrm.hxx layout/tabfrm.cxx

Author: truckman
Date: Wed Aug  1 04:58:36 2018
New Revision: 1837212

URL: http://svn.apache.org/viewvc?rev=1837212&view=rev
Log:
Fix SwCntntFrm::CalcLowers() so that it visits all on-page objects.
 
SwCntntFrm::CalcLowers() walks the object tree walk and it assumes
that the objects visited will be at a monotonically increasing
distance from the top of the page, so it terminates the walk once 
it encounters the first object below the bottom of the page.  Even
though the objects are vertically sorted in each branch of the tree,
there is no guarantee that the order of the objects visited in the
depth-first walk will be perfectly sorted vertically, so the walk
may terminate before visiting all of the objects on the page.  Fix
this problem by pruning branches when they cross the lower page
boundary and only terminating the walk once there are no longer any
paths forward.


Modified:
    openoffice/trunk/main/sw/source/core/inc/cntfrm.hxx
    openoffice/trunk/main/sw/source/core/layout/tabfrm.cxx

Modified: openoffice/trunk/main/sw/source/core/inc/cntfrm.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/inc/cntfrm.hxx?rev=1837212&r1=1837211&r2=1837212&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/inc/cntfrm.hxx (original)
+++ openoffice/trunk/main/sw/source/core/inc/cntfrm.hxx Wed Aug  1 04:58:36 2018
@@ -103,6 +103,7 @@ public:
 	sal_Bool MoveFtnCntFwd( sal_Bool, SwFtnBossFrm* );//von MoveFwd gerufen bei Ftn-Inhalt
 
     inline  SwCntntFrm* GetNextCntntFrm() const;
+    inline  SwCntntFrm* GetNextCntntFrm( bool ) const;
     inline  SwCntntFrm* GetPrevCntntFrm() const;
     static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells );
     void RegisterToNode( SwCntntNode& );
@@ -117,6 +118,16 @@ inline SwCntntFrm* SwCntntFrm::GetNextCn
         return (SwCntntFrm*)ImplGetNextCntntFrm( true );
 }
 
+inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm( bool bPrune ) const
+{
+    if ( bPrune && !GetPrev() )
+        return NULL;
+    else if ( bPrune || !(GetNext() && GetNext()->IsCntntFrm()))
+        return (SwCntntFrm*)ImplGetNextCntntFrm( true );
+    else
+        return (SwCntntFrm*)GetNext();
+}
+
 inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
 {
     if ( GetPrev() && GetPrev()->IsCntntFrm() )

Modified: openoffice/trunk/main/sw/source/core/layout/tabfrm.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/layout/tabfrm.cxx?rev=1837212&r1=1837211&r2=1837212&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/layout/tabfrm.cxx (original)
+++ openoffice/trunk/main/sw/source/core/layout/tabfrm.cxx Wed Aug  1 04:58:36 2018
@@ -1536,6 +1536,7 @@ bool SwCntntFrm::CalcLowers( SwLayoutFrm
     // LONG_MAX == nBottom means we have to calculate all
     bool bAll = LONG_MAX == nBottom;
     bool bRet = sal_False;
+    bool bPrune;
 	SwCntntFrm *pCnt = pLay->ContainsCntnt();
     SWRECTFN( pLay )
 
@@ -1612,9 +1613,8 @@ bool SwCntntFrm::CalcLowers( SwLayoutFrm
             pCnt->GetUpper()->Calc();
         }
         // <--
-        if( ! bAll && (*fnRect->fnYDiff)((pCnt->Frm().*fnRect->fnGetTop)(), nBottom) > 0 )
-			break;
-		pCnt = pCnt->GetNextCntntFrm();
+        bPrune = !bAll && ( (*fnRect->fnYDiff)((pCnt->Frm().*fnRect->fnGetTop)(), nBottom) > 0 );
+		pCnt = pCnt->GetNextCntntFrm( bPrune );
 	}
 	return bRet;
 }