sw/source/core/doc/docdesc.cxx | 22 +++++++++++++++++----- sw/source/core/layout/pagedesc.cxx | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-)
New commits: commit b8499fc3dcf474050f026b8d5cd1d9037bbe42b7 Author: Michael Stahl <mst...@redhat.com> Date: Mon Aug 19 14:45:20 2013 +0200 fdo#66145: revert change to CopyMasterHeader Not copying the nodes for first page is not an option; the real problem with the fdo45183.rtf is that flys in the header are not copied along with the nodes, like it is done in SwDoc::CopyPageDescHeaderFooterImpl. Also, the same problem may occur for footers too (CopyMasterFooter). Conflicts: sw/source/core/doc/docdesc.cxx The comment above is for the master commit, but copyting the flys is actually necessary with e1a9a348a519a69f898c9c1e6d87a5837b8267f9 too, since that copying code is now executed when changing sharing flags in the UI so withtout this commit you lose any flys anchored in the header/footer. (cherry picked from commit bf206549228685a68e1504db05119d8fa1d354b3) Change-Id: I985a6b89f8cde96dc0fa0b489c44d77987f91a8a Reviewed-on: https://gerrit.libreoffice.org/5541 Reviewed-by: Thorsten Behrens <tbehr...@suse.com> Reviewed-by: Petr Mladek <pmla...@suse.cz> Reviewed-by: Miklos Vajna <vmik...@suse.cz> Tested-by: Miklos Vajna <vmik...@suse.cz> diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 5d0232e..bb1d78f 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -212,6 +212,8 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() ); aTmp = *pSttNd->EndOfSectionNode(); GetNodes()._Copy( aRange, aTmp, sal_False ); + aTmp = *pSttNd; + CopyFlyInFlyImpl(aRange, 0, aTmp); pFmt->SetFmtAttr( SwFmtCntnt( pSttNd ) ); rDescFrmFmt.SetFmtAttr( SwFmtHeader( pFmt ) ); @@ -271,6 +273,8 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() ); aTmp = *pSttNd->EndOfSectionNode(); GetNodes()._Copy( aRange, aTmp, sal_False ); + aTmp = *pSttNd; + CopyFlyInFlyImpl(aRange, 0, aTmp); pFmt->SetFmtAttr( SwFmtCntnt( pSttNd ) ); rDescFrmFmt.SetFmtAttr( SwFmtFooter( pFmt ) ); commit 796409636f999cf58a4f36dd7977497b7bd6ab20 Author: Michael Stahl <mst...@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 <pmla...@suse.cz> Tested-by: Petr Mladek <pmla...@suse.cz> Reviewed-by: Thorsten Behrens <tbehr...@suse.com> Reviewed-by: Miklos Vajna <vmik...@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 62809efff8b75b00368ebbc70d697e5613523416 Author: Michael Stahl <mst...@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 <pmla...@suse.cz> Tested-by: Petr Mladek <pmla...@suse.cz> Reviewed-by: Thorsten Behrens <tbehr...@suse.com> Reviewed-by: Miklos Vajna <vmik...@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 commit 75084f6c42c27dc95418df9cefed2fddfb26000e Author: Michael Stahl <mst...@redhat.com> Date: Tue Aug 20 11:41:37 2013 +0200 fdo#66145: do not check IsFirstShared() in SwPageDesc::GetLeftFmt() ... and GetRightFmt(). If the first format is requested it must be returned; the sharing works by copying the SwFmtHeader/Footer from aMaster to the other members. (regression from 4dc78aee9bcdb6ea5e9dc47ebb4a4b9e590c725a) Change-Id: I1708f01c18b155ae75c14fc407e52ccd2bd798d7 (cherry picked from commit 4df438c9a9d5e698c47c1e85903eb81880a5e6fa) Reviewed-on: https://gerrit.libreoffice.org/5530 Reviewed-by: Petr Mladek <pmla...@suse.cz> Tested-by: Petr Mladek <pmla...@suse.cz> Reviewed-by: Thorsten Behrens <tbehr...@suse.com> Reviewed-by: Miklos Vajna <vmik...@suse.cz> diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 33aecbf..1b248f1 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -348,14 +348,14 @@ sal_Bool SwPageDesc::IsFollowNextPageOfNode( const SwNode& rNd ) const SwFrmFmt *SwPageDesc::GetLeftFmt(bool const bFirst) { return (nsUseOnPage::PD_LEFT & eUse) - ? (bFirst && !IsFirstShared()) ? &aFirst : &aLeft + ? ((bFirst) ? &aFirst : &aLeft) : 0; } SwFrmFmt *SwPageDesc::GetRightFmt(bool const bFirst) { return (nsUseOnPage::PD_RIGHT & eUse) - ? (bFirst && !IsFirstShared()) ? &aFirst : &aMaster + ? ((bFirst) ? &aFirst : &aMaster) : 0; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits