diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-12-20 21:24:37 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-12-20 23:56:12 +0100 |
commit | 899538a155b0d58f3a864dbc26d0dc7c37386807 (patch) | |
tree | bf04e2d02358a995da3541e965f320f23dcdd7dc /sw/source | |
parent | e936ecc92a7e362f57ce72a955697840920636b8 (diff) |
fdo#71429: sw: fix crashes when changing header first sharing
Copy some nutso code in SwUndoPageDesc::ExchangeContentNodes() to
work on the un-shared First header/footer too, which apparently avoids
the crash. It's not like Undo of header/footer isn't already a
house of cards anyway.
Change-Id: Ie6593c4784ce9d368a5098ffb3aa4dec536d250e
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/undo/SwUndoPageDesc.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index b60c18b93ea0..5246c6fa3b51 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -248,6 +248,27 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } + if (!rDest.IsFirstShared()) + { + // Same procedure for unshared header.. + const SwFmtHeader& rSourceFirstMasterHead = rSource.GetFirstMaster().GetHeader(); + rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_HEADER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); +#if OSL_DEBUG_LEVEL > 1 + const SwFmtCntnt& rSourceCntnt1 = rSourceFirstMasterHead.GetHeaderFmt()->GetCntnt(); + (void)rSourceCntnt1; + const SwFmtCntnt& rDestCntnt1 = rDest.GetFirstMaster().GetHeader().GetHeaderFmt()->GetCntnt(); + (void)rDestCntnt1; +#endif + pNewFmt->SetFmtAttr( rSourceFirstMasterHead.GetHeaderFmt()->GetCntnt() ); + delete pNewItem; + rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_HEADER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pNewFmt->SetFmtAttr( SwFmtCntnt() ); + delete pNewItem; + } } // Same procedure for footers... const SwFmtFooter& rDestFoot = rDest.GetMaster().GetFooter(); @@ -294,6 +315,27 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } + if (!rDest.IsFirstShared()) + { + const SwFmtFooter& rSourceFirstMasterFoot = rSource.GetFirstMaster().GetFooter(); +#if OSL_DEBUG_LEVEL > 1 + const SwFmtCntnt& rFooterSourceCntnt2 = rSourceFirstMasterFoot.GetFooterFmt()->GetCntnt(); + const SwFmtCntnt& rFooterDestCntnt2 = + rDest.GetFirstMaster().GetFooter().GetFooterFmt()->GetCntnt(); + (void)rFooterSourceCntnt2; + (void)rFooterDestCntnt2; +#endif + rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt->SetFmtAttr( rSourceFirstMasterFoot.GetFooterFmt()->GetCntnt() ); + delete pNewItem; + rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt->SetFmtAttr( SwFmtCntnt() ); + delete pNewItem; + } } } |