sw/source/uibase/app/docstyle.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 1805b7549cd240009bf67eba3a030e19b4f6f046
Author: Michael Stahl <mst...@redhat.com>
Date:   Mon Sep 7 16:18:53 2015 +0200

    tdf#90991: sw: fix style preview creating undo objects
    
    SwDocStyleSheet::FillStyleSheet() already takes care to remove all
    temporarily created styles, so assume that works and suppress the
    creation of user-visible Undo objects.
    
    Change-Id: I748f0e8304c42e767b331ebd22be0290b9c0d89d
    (cherry picked from commit 779b547ca6271156a59965569fa44fbeb3f63ce5)
    Reviewed-on: https://gerrit.libreoffice.org/18382
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/source/uibase/app/docstyle.cxx 
b/sw/source/uibase/app/docstyle.cxx
index bb0f62f..016b1a1 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1727,6 +1727,9 @@ bool SwDocStyleSheet::FillStyleSheet( FillStyleType 
eFType )
         bPhysical = 0 != pCharFormat;
         if( bFillOnlyInfo && !bPhysical )
         {
+            // create style (plus all needed parents) and clean it up
+            // later - without affecting the undo/redo stack
+            ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
             bDeleteInfo = true;
             ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, 
rDoc );
             pCharFormat = lcl_FindCharFormat(rDoc, aName, this, true );
@@ -1754,6 +1757,7 @@ bool SwDocStyleSheet::FillStyleSheet( FillStyleType 
eFType )
             bPhysical = 0 != pColl;
             if( bFillOnlyInfo && !bPhysical )
             {
+                ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
                 bDeleteInfo = true;
                 ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, 
rDoc );
                 pColl = lcl_FindParaFormat(rDoc, aName, this, true );
@@ -1777,6 +1781,7 @@ bool SwDocStyleSheet::FillStyleSheet( FillStyleType 
eFType )
         bPhysical = 0 != pFrameFormat;
         if( bFillOnlyInfo && bPhysical )
         {
+            ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
             bDeleteInfo = true;
             ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, 
rDoc );
             pFrameFormat = lcl_FindFrameFormat(rDoc, aName, this, true );
@@ -1796,6 +1801,7 @@ bool SwDocStyleSheet::FillStyleSheet( FillStyleType 
eFType )
         bPhysical = 0 != pDesc;
         if( bFillOnlyInfo && !pDesc )
         {
+            ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
             bDeleteInfo = true;
             ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, 
rDoc );
             pDesc = lcl_FindPageDesc( rDoc, aName, this, true );
@@ -1824,6 +1830,7 @@ bool SwDocStyleSheet::FillStyleSheet( FillStyleType 
eFType )
         bPhysical = 0 != pNumRule;
         if( bFillOnlyInfo && !pNumRule )
         {
+            ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
             bDeleteInfo = true;
             ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, 
rDoc );
             pNumRule = lcl_FindNumRule( rDoc, aName, this, true );
@@ -1890,7 +1897,10 @@ bool SwDocStyleSheet::FillStyleSheet( FillStyleType 
eFType )
         SetMask( _nMask );
     }
     if( bDeleteInfo && bFillOnlyInfo )
+    {
+        ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
         ::lcl_DeleteInfoStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, 
rDoc );
+    }
     return bRet;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to