summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-05-14 22:32:37 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-05-14 22:36:28 +0100
commit51270f84bbeed46b3253ecfa1f8ddd408106b746 (patch)
tree8909be7040fe8b13ef89b6c63aaed746756ff6d4 /sw
parent80a921e88a036d42b4b884bb3e0b651fc083c1cd (diff)
sw: avoid over-using over-complicated SfxUndoManager::IsUndoEnabled
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/doc.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 47614733ca24..1d4121c19203 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -909,10 +909,10 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos )
bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
const enum InsertFlags nInsertMode )
{
- if (GetIDocumentUndoRedo().DoesUndo())
- {
+ // fetching DoesUndo is surprisingly expensive
+ bool bDoesUndo = GetIDocumentUndoRedo().DoesUndo();
+ if (bDoesUndo)
GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called!
- }
const SwPosition& rPos = *rRg.GetPoint();
@@ -927,18 +927,15 @@ 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 (!GetIDocumentUndoRedo().DoesUndo() ||
- !GetIDocumentUndoRedo().DoesGroupUndo())
+ if (!bDoesUndo || !GetIDocumentUndoRedo().DoesGroupUndo())
{
pNode->InsertText( rStr, rPos.nContent, nInsertMode );
- if (GetIDocumentUndoRedo().DoesUndo())
+ if (bDoesUndo)
{
SwUndoInsert * const pUndo( new SwUndoInsert(
rPos.nNode, rPos.nContent.GetIndex(), rStr.Len(), nInsertMode));