[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/source

Michael Meeks michael at kemper.freedesktop.org
Mon May 14 14:33:36 PDT 2012


 sw/source/core/doc/doc.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit e848b91192166b97242f02334bf1f90bcb536e4d
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon May 14 22:35:42 2012 +0100

    Revert "sw: avoid over-using over-complicated SfxUndoManager::IsUndoEnabled"
    
    This reverts commit 1a83b7f884a96e61d631ed2f92b99a5493b3384c.
    Committed to wrong branch

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 635d73e..5a2f44c 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -870,10 +870,10 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos )
 bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
         const enum InsertFlags nInsertMode )
 {
-    // fetching DoesUndo is surprisingly expensive
-    bool bDoesUndo = GetIDocumentUndoRedo().DoesUndo();
-    if (bDoesUndo)
+    if (GetIDocumentUndoRedo().DoesUndo())
+    {
         GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called!
+    }
 
     const SwPosition& rPos = *rRg.GetPoint();
 
@@ -888,15 +888,18 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
 
     SwTxtNode *const pNode = rPos.nNode.GetNode().GetTxtNode();
     if(!pNode)
+    {
         return false;
+    }
 
     SwDataChanged aTmp( rRg, 0 );
 
-    if (!bDoesUndo || !GetIDocumentUndoRedo().DoesGroupUndo())
+    if (!GetIDocumentUndoRedo().DoesUndo() ||
+        !GetIDocumentUndoRedo().DoesGroupUndo())
     {
         pNode->InsertText( rStr, rPos.nContent, nInsertMode );
 
-        if (bDoesUndo)
+        if (GetIDocumentUndoRedo().DoesUndo())
         {
             SwUndoInsert * const pUndo( new SwUndoInsert(
                 rPos.nNode, rPos.nContent.GetIndex(), rStr.Len(), nInsertMode));


More information about the Libreoffice-commits mailing list