diff options
Diffstat (limited to 'sw/source/core/doc/docdesc.cxx')
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 1852b4c16fd4..6c31cbf1a509 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -197,7 +197,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() ); @@ -252,7 +256,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() ); @@ -362,6 +370,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() ); |