[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sw/source

Oliver-Rainer Wittmann orw at apache.org
Wed Nov 20 06:07:41 PST 2013


 sw/source/core/inc/tabfrm.hxx    |   61 +++++++++++++------------
 sw/source/core/layout/tabfrm.cxx |   93 +++++++++++++++------------------------
 sw/source/filter/ww8/ww8par.cxx  |   20 --------
 3 files changed, 68 insertions(+), 106 deletions(-)

New commits:
commit 51e177c89ee9725030231d00cf7b1e5ad1fc7c65
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Wed Nov 20 13:32:30 2013 +0000

    123578: revert part of changes made for bug 119620 as page styles for only left or only right pages does not make sense for imported Microsoft Word documents as Microsoft Word does not support such a feature.

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 90607c3..b66b43b 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3882,26 +3882,6 @@ void wwSectionManager::SetUseOn(wwSection &rSection)
         rSection.mpTitlePage->WriteUseOn(
             (UseOnPage) (eUseBase | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE));
     }
-
-    if( nsUseOnPage::PD_MIRROR != (UseOnPage)(eUse & nsUseOnPage::PD_MIRROR) )
-    {
-        if( rSection.maSep.bkc == 3 )
-        {
-            if( rSection.mpPage )
-                rSection.mpPage->SetUseOn( nsUseOnPage::PD_LEFT );
-            if( rSection.mpTitlePage )
-                rSection.mpTitlePage->SetUseOn( nsUseOnPage::PD_LEFT );
-        }
-        else if( rSection.maSep.bkc == 4 )
-        {
-            if( rSection.mpPage )
-                rSection.mpPage->SetUseOn( nsUseOnPage::PD_RIGHT );
-            if( rSection.mpTitlePage )
-                rSection.mpTitlePage->SetUseOn( nsUseOnPage::PD_RIGHT );
-        }
-
-    }
-
 }
 
 //Set the page descriptor on this node, handle the different cases for a text
commit c037ec6acc66efdeee738f057acee7c52ab979f3
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Wed Nov 20 13:26:34 2013 +0000

    123578: adjust table layout algorithm to avoid layout loops
    
    --> no shrink of master table, when follow table current is layouting its lower table row

diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 85c87db..3cb3a72 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -33,8 +33,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.
@@ -44,22 +42,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
@@ -76,7 +74,6 @@ class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
                                         // is necessary, in order to let the text
                                         // flow into the FollowFlowLine
     sal_Bool bRemoveFollowFlowLinePending :1;
-    // --> OD 2004-10-04 #i26945#
     sal_Bool bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
                                            // are considered on the calculation
                                            // for the minimal cell height.
@@ -85,12 +82,10 @@ class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
                                            // screen object for the preparation
                                            // of the re-calculation of the
                                            // last table row.
-    // <--
-    // --> OD 2004-10-15 #i26945#
     sal_Bool bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
                           // indicates, if the floating screen objects fits
-    // <--
-    sal_Bool bDummy4 :1;
+
+    bool mbInRecalcLowerRow : 1;
 
     //Split() spaltet den Frm an der angegebenen Stelle, es wird ein
     //Follow erzeugt und aufgebaut und direkt hinter this gepastet.
@@ -98,8 +93,11 @@ class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
     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 );
 
@@ -168,7 +166,15 @@ public:
     sal_Bool IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; }
     void SetRemoveFollowFlowLinePending( sal_Bool bNew ) { bRemoveFollowFlowLinePending = bNew; }
 
-    // --> OD 2004-10-04 #i26945#
+    bool IsInRecalcLowerRow() const
+    {
+        return mbInRecalcLowerRow;
+    }
+    void SetInRecalcLowerRow( bool bNew )
+    {
+        mbInRecalcLowerRow = bNew;
+    }
+
     sal_Bool IsConsiderObjsForMinCellHeight() const
     {
         return bConsiderObjsForMinCellHeight;
@@ -177,8 +183,7 @@ public:
     {
         bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight;
     }
-    // <--
-    // --> OD 2004-10-04 #i26945#
+
     sal_Bool DoesObjsFit() const
     {
         return bObjsDoesFit;
@@ -187,15 +192,16 @@ public:
     {
         bObjsDoesFit = _bNewObjsDoesFit;
     }
-    // <--
 
     bool RemoveFollowFlowLine();
     //
     // 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;
 
@@ -204,12 +210,9 @@ public:
 
     bool IsLayoutSplitAllowed() const;
 
-    // --> collapsing borders FME 2005-05-27 #i29550#
     bool IsCollapsingBorders() const;
 
-    // used for collapsing border lines:
     sal_uInt16 GetBottomLineSize() const;
-    // <-- collapsing
 
     DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
 };
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 615b4f7..14b301a 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -93,10 +93,9 @@ SwTabFrm::SwTabFrm( SwTable &rTab, SwFrm* pSib ):
     bComplete = bCalcLowers = bONECalcLowers = bLowersFormatted = bLockBackMove =
     bResizeHTMLTable = bHasFollowFlowLine = bIsRebuildLastLine =
     bRestrictTableGrowth = bRemoveFollowFlowLinePending = sal_False;
-    // --> OD 2004-10-04 #i26945#
     bConsiderObjsForMinCellHeight = sal_True;
     bObjsDoesFit = sal_True;
-    // <--
+    mbInRecalcLowerRow = false;
     bFixSize = sal_False;     //Nicht nochmal auf die Importfilter hereinfallen.
     nType = FRMC_TAB;
 
@@ -126,10 +125,9 @@ SwTabFrm::SwTabFrm( SwTabFrm &rTab ) :
     bLockJoin = bComplete = bONECalcLowers = bCalcLowers = bLowersFormatted = bLockBackMove =
     bResizeHTMLTable = bHasFollowFlowLine = bIsRebuildLastLine =
     bRestrictTableGrowth = bRemoveFollowFlowLinePending = sal_False;
-    // --> OD 2004-10-04 #i26945#
     bConsiderObjsForMinCellHeight = sal_True;
     bObjsDoesFit = sal_True;
-    // <--
+    mbInRecalcLowerRow = false;
     bFixSize = sal_False;     //Nicht nochmal auf die Importfilter hereinfallen.
     nType = FRMC_TAB;
 
@@ -2075,7 +2073,7 @@ void SwTabFrm::MakeAll()
             }
             SwFrm *pPre;
             if ( bKeep || (0 != (pPre = FindPrev()) &&
-                           pPre->GetAttrSet()->GetKeep().GetValue()) )
+                pPre->GetAttrSet()->GetKeep().GetValue()) )
             {
                 bCalcLowers = sal_True;
             }
@@ -2101,13 +2099,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 );
-//                  GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() ? sal_False : sal_True );
+                    pLayout->GetBrowseWidthByTabFrm( *this ), sal_False );
                 pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this );
                 pAttrs = pAccess->Get();
             }
@@ -2160,8 +2157,7 @@ void SwTabFrm::MakeAll()
                                 pHTMLLayout->GetBrowseWidthByTabFrm( *this ),
                                 sal_False );
 
-                            pAccess= new SwBorderAttrAccess(
-                                        SwFrm::GetCache(), this );
+                            pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this );
                             pAttrs = pAccess->Get();
                         }
 
@@ -2172,27 +2168,10 @@ void SwTabFrm::MakeAll()
                     bLowersFormatted = sal_True;
                     if ( bKeep && KEEPTAB )
                     {
-                        // --> OD 2005-09-28 #b6329202#
-                        // Consider case that table is inside another table,
-                        // because it has to be avoided, that superior table
-                        // is formatted.
-                        // Thus, find next content, table or section
-                        // and, if a section is found, get its first
-                        // content.
-//                        SwFrm *pNxt = FindNextCnt();
-//                        if( pNxt && pNxt->IsInTab() )
-//                            pNxt = pNxt->FindTabFrm();
-//                        if ( pNxt )
-//                        {
-//                            pNxt->Calc();
-//                            if ( !GetNext() )
-//                                bValidPos = sal_False;
-//                        }
                         if ( 0 != lcl_FormatNextCntntForKeep( this ) && !GetNext() )
                         {
                             bValidPos = sal_False;
                         }
-                        // <--
                     }
                 }
             }
@@ -2204,17 +2183,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 ViewShell *pSh = getRootFrm()->GetCurrShell();
         const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
         if ( nDistanceToUpperPrtBottom < 0 && bBrowseMode )
@@ -2222,8 +2198,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)());
             }
         }
 
@@ -2233,7 +2208,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() )
@@ -2278,8 +2252,8 @@ void SwTabFrm::MakeAll()
                         //
                         SwRowFrm *pRow = GetFollow()->GetFirstNonHeadlineRow();
 
-                          //Der Follow wird leer und damit ueberfluessig.
-                           if ( !pRow )
+                        //Der Follow wird leer und damit ueberfluessig.
+                        if ( !pRow )
                         {
                             Join();
                             continue;
@@ -2300,8 +2274,10 @@ void SwTabFrm::MakeAll()
                             SwFrm* pNextRow = pRowToMove->GetNext();
 
                             if ( !pNextRow )
+                            {
                                 //Der Follow wird leer und damit ueberfluessig.
                                 Join();
+                            }
                             else
                             {
                                 pRowToMove->Cut();
@@ -2310,8 +2286,7 @@ void SwTabFrm::MakeAll()
 
                             //Die Fussnoten verschieben!
                             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;
@@ -2471,7 +2446,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 );
 
@@ -2629,10 +2608,8 @@ void SwTabFrm::MakeAll()
                                 SwFrm* pNxt = ((SwFrm*)GetFollow())->FindNext();
                                 if ( pNxt )
                                 {
-                                    // OD 26.08.2003 #i18103# - no formatting
-                                    // of found next frame, if its a follow
-                                    // section of the 'ColLocked' section,
-                                    // the follow table is in.
+                                    // 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() )
                                     {
@@ -2678,19 +2655,19 @@ void SwTabFrm::MakeAll()
         if ( !bMovedFwd && !MoveFwd( bMakePage, sal_False ) )
             bMakePage = sal_False;
 
-        // --> FME 2004-06-09 #i29771# Reset bSplitError flag on change of upper
+        // Reset bSplitError flag on change of upper
         if ( GetUpper() != pOldUpper )
         {
             bTryToSplit = true;
             nUnSplitted = 5;
         }
-        // <--
 
         SWREFRESHFN( this )
         bMovedFwd = bCalcLowers = sal_True;
         aNotify.SetLowersComplete( sal_False );
         if ( IsFollow() )
-        {   //Um Oszillationen zu vermeiden sollte kein ungueltiger Master
+        {
+            //Um Oszillationen zu vermeiden sollte kein ungueltiger Master
             //zurueckbleiben.
             SwTabFrm *pTab = FindMaster();
             if ( pTab->GetUpper() )
@@ -2710,16 +2687,17 @@ void SwTabFrm::MakeAll()
         }
 
         if ( bMovedBwd && GetUpper() )
+        {
             //Beim zurueckfliessen wurde der Upper angeregt sich vollstaendig
             //zu Painten, dass koennen wir uns jetzt nach dem hin und her
             //fliessen sparen.
             GetUpper()->ResetCompletePaint();
+        }
 
         if ( bCalcLowers && IsValid() )
         {
-            // --> OD 2005-05-11 #i44910# - format of lower frames unnecessary
-            // and can cause layout loops, if table doesn't fit and isn't
-            // allowed to split.
+            // format of lower frames unnecessary and can cause layout loops,
+            // if table doesn't fit and isn't  allowed to split.
             SwTwips nDistToUpperPrtBottom =
                 (Frm().*fnRect->fnBottomDist)( (GetUpper()->*fnRect->fnGetPrtBottom)());
             if ( nDistToUpperPrtBottom >= 0 || bTryToSplit )
@@ -2734,7 +2712,6 @@ void SwTabFrm::MakeAll()
                 ASSERT( false, "debug assertion: <SwTabFrm::MakeAll()> - format of table lowers suppressed by fix i44910" );
             }
 #endif
-            // <--
         }
 
     } //while ( !bValidPos || !bValidSize || !bValidPrtArea )
@@ -4827,8 +4804,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();


More information about the Libreoffice-commits mailing list