[Libreoffice-commits] core.git: Branch 'libreoffice-4-1-1' - 2 commits - sw/source

Michael Stahl mstahl at redhat.com
Wed Aug 21 03:25:10 PDT 2013


 sw/source/core/doc/docdesc.cxx |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

New commits:
commit abce5c9fc563d0d9ff0c8a4ae547a3b974c49527
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Aug 20 11:50:34 2013 +0200

    fdo#66145: fix copying of header/footer when un-sharing
    
    SwDoc::CopyMasterHeader/Footer(): this could result in sharing the
    first-page header/footer with the left-page (!) when un-sharing
    via the dialog; the reason is that what actually happens here is that
    the left-page header/footer was never changed but the master one
    was copied in SwDocStyleSheet::SetItemSet(), so it sort of worked
    by accident before the first-page header/footer was added...
    
    Change-Id: Ia24df6ad59cda484559f2ca48ecaa7563878120b
    (cherry picked from commit e1a9a348a519a69f898c9c1e6d87a5837b8267f9)
    Reviewed-on: https://gerrit.libreoffice.org/5532
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>
    Reviewed-by: Thorsten Behrens <tbehrens at suse.com>
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 56e48ee4..5d0232e 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -194,7 +194,11 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead,
                 const SwFrmFmt& rChgedFrmFmt = (bLeft ? rChged.GetLeft() : rChged.GetFirst());
                 rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetHeader() );
             }
-            else if( (*aRCnt.GetCntntIdx()) == (*aCnt.GetCntntIdx()) )
+            else if ((*aRCnt.GetCntntIdx() == *aCnt.GetCntntIdx()) ||
+                // The CntntIdx is _always_ different when called from
+                // SwDocStyleSheet::SetItemSet, because it deep-copies the
+                // PageDesc.  So check if it was previously shared.
+                 ((bLeft) ? pDesc->IsHeaderShared() : pDesc->IsFirstShared()))
             {
                 SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), (bLeft ? "Left header" : "First header"),
                                                 GetDfltFrmFmt() );
@@ -249,7 +253,11 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot,
                 const SwFrmFmt& rChgedFrmFmt = (bLeft ? rChged.GetLeft() : rChged.GetFirst());
                 rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetFooter() );
             }
-            else if( (*aRCnt.GetCntntIdx()) == (*aLCnt.GetCntntIdx()) )
+            else if ((*aRCnt.GetCntntIdx() == *aLCnt.GetCntntIdx()) ||
+                // The CntntIdx is _always_ different when called from
+                // SwDocStyleSheet::SetItemSet, because it deep-copies the
+                // PageDesc.  So check if it was previously shared.
+                 ((bLeft) ? pDesc->IsHeaderShared() : pDesc->IsFirstShared()))
             {
                 SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), (bLeft ? "Left footer" : "First footer"),
                                                 GetDfltFrmFmt() );
@@ -341,8 +349,6 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
     CopyMasterHeader(rChged, rHead, pDesc, true); // Copy left header
     CopyMasterHeader(rChged, rHead, pDesc, false); // Copy first header
     pDesc->ChgHeaderShare( rChged.IsHeaderShared() );
-    // there is just one first shared flag for both header and footer?
-    pDesc->ChgFirstShare( rChged.IsFirstShared() );
 
     // Synch Footer.
     const SwFmtFooter &rFoot = rChged.GetMaster().GetFooter();
@@ -359,6 +365,8 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
     CopyMasterFooter(rChged, rFoot, pDesc, true); // Copy left footer
     CopyMasterFooter(rChged, rFoot, pDesc, false); // Copy first footer
     pDesc->ChgFooterShare( rChged.IsFooterShared() );
+    // there is just one first shared flag for both header and footer?
+    pDesc->ChgFirstShare( rChged.IsFirstShared() );
 
     if ( pDesc->GetName() != rChged.GetName() )
         pDesc->SetName( rChged.GetName() );
commit b82d99e50d846c3b2505466d3048eacf02488757
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Aug 20 11:51:27 2013 +0200

    fdo#66145: fix Undo invalidation in SwDoc::ChgPageDesc()
    
    SwDoc::ChgPageDesc(): make the invalidation of the Undo stack on
    change of IsFirstShared work by delaying ChgFirstShare() until after
    the check.
    
    Change-Id: Ifbefe446df8b6d785ed1bb6394ec5beb803fb1fe
    (cherry picked from commit 0b7a823bb6df79384939dda4de3b7f28e5e52758)
    Reviewed-on: https://gerrit.libreoffice.org/5531
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>
    Reviewed-by: Thorsten Behrens <tbehrens at suse.com>
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 920853f..56e48ee4 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -321,7 +321,6 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
 
     // Take over orientation
     pDesc->SetLandscape( rChged.GetLandscape() );
-    pDesc->ChgFirstShare( rChged.IsFirstShared() );
 
     // #i46909# no undo if header or footer changed
     bool bHeaderFooterChanged = false;
@@ -342,6 +341,8 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
     CopyMasterHeader(rChged, rHead, pDesc, true); // Copy left header
     CopyMasterHeader(rChged, rHead, pDesc, false); // Copy first header
     pDesc->ChgHeaderShare( rChged.IsHeaderShared() );
+    // there is just one first shared flag for both header and footer?
+    pDesc->ChgFirstShare( rChged.IsFirstShared() );
 
     // Synch Footer.
     const SwFmtFooter &rFoot = rChged.GetMaster().GetFooter();
@@ -352,8 +353,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
         const SwFmtFooter &rOldFoot = pDesc->GetMaster().GetFooter();
         bHeaderFooterChanged |=
             ( rFoot.IsActive() != rOldFoot.IsActive() ||
-              rChged.IsFooterShared() != pDesc->IsFooterShared() ||
-              rChged.IsFirstShared() != pDesc->IsFirstShared() );
+              rChged.IsFooterShared() != pDesc->IsFooterShared() );
     }
     pDesc->GetMaster().SetFmtAttr( rFoot );
     CopyMasterFooter(rChged, rFoot, pDesc, true); // Copy left footer


More information about the Libreoffice-commits mailing list