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>
This commit is contained in:
@@ -913,16 +913,6 @@ void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& rWrtSh)
|
|||||||
uno::Sequence<beans::PropertyValue> aField;
|
uno::Sequence<beans::PropertyValue> aField;
|
||||||
pField->GetValue() >>= 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();
|
SwPosition& rCursor = *rWrtSh.GetCursor()->GetPoint();
|
||||||
SwTextNode* pTextNode = rCursor.GetNode().GetTextNode();
|
SwTextNode* pTextNode = rCursor.GetNode().GetTextNode();
|
||||||
std::vector<SwTextAttr*> aAttrs
|
std::vector<SwTextAttr*> aAttrs
|
||||||
@@ -938,6 +928,16 @@ void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& rWrtSh)
|
|||||||
return;
|
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);
|
comphelper::SequenceAsHashMap aMap(aField);
|
||||||
auto aName = aMap["Name"].get<OUString>();
|
auto aName = aMap["Name"].get<OUString>();
|
||||||
rRefmark.GetRefName() = aName;
|
rRefmark.GetRefName() = aName;
|
||||||
|
Reference in New Issue
Block a user