sw/source/core/undo/SwUndoPageDesc.cxx |   42 +++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

New commits:
commit da6c12df9161f93114c1aecdb1ed3cd24aeb1697
Author: Michael Stahl <mst...@redhat.com>
Date:   Fri Dec 20 21:24:37 2013 +0100

    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
    (cherry picked from commit 899538a155b0d58f3a864dbc26d0dc7c37386807)
    Reviewed-on: https://gerrit.libreoffice.org/7157
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx 
b/sw/source/core/undo/SwUndoPageDesc.cxx
index b60c18b..5246c6f 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;
+        }
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to