diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-01-16 09:19:36 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-01-16 09:28:06 +0000 |
commit | 0250d6c643f2866c4de7e3c943248ffda9205d05 (patch) | |
tree | 1f8403626e9d57c3bea175132f53efb26be67063 /sw/source/uibase/shells | |
parent | 2cf59dee9637dcb741806ce61e50b6be427dd7b8 (diff) |
sw, UpdateFieldContent: address a minor performance nit
See
<https://gerrit.libreoffice.org/c/core/+/145459/1#message-fa0ede3525e35014c1f6c99455a96a69bc2a3601>,
it's enough to start grouping undo/redo after we know that there is a
relevant refmark under the cursor.
Change-Id: I53e7e371768480d6b7e968c90bf8c5d9901013b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145555
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 44759890e695..363c37f9d580 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -913,16 +913,6 @@ void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& rWrtSh) uno::Sequence<beans::PropertyValue> aField; pField->GetValue() >>= aField; - SwDoc* pDoc = rWrtSh.GetDoc(); - pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSBOOKMARK, nullptr); - rWrtSh.StartAction(); - comphelper::ScopeGuard g( - [&rWrtSh] - { - rWrtSh.EndAction(); - rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSBOOKMARK, nullptr); - }); - SwPosition& rCursor = *rWrtSh.GetCursor()->GetPoint(); SwTextNode* pTextNode = rCursor.GetNode().GetTextNode(); std::vector<SwTextAttr*> aAttrs @@ -938,6 +928,16 @@ void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& rWrtSh) return; } + SwDoc* pDoc = rWrtSh.GetDoc(); + pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSBOOKMARK, nullptr); + rWrtSh.StartAction(); + comphelper::ScopeGuard g( + [&rWrtSh] + { + rWrtSh.EndAction(); + rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSBOOKMARK, nullptr); + }); + comphelper::SequenceAsHashMap aMap(aField); auto aName = aMap["Name"].get<OUString>(); rRefmark.GetRefName() = aName; |