diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-09-24 13:41:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-24 18:58:16 +0200 |
commit | e8edc8edbf820d8358b465b92e697eb6831d23de (patch) | |
tree | 3095d1b490fbbd479dff18d974f6517fe7146e84 /sw/source/uibase/wrtsh | |
parent | fb7d05f3d56c3e21ed7ba5cf8723a02801640caa (diff) |
no need to allocate these SwPaM on the heap
Change-Id: Ief142e6410599ea50aee4065d843d7eaea55e21c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122578
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/wrtsh')
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh2.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 90f08fd33a81..a4f050492328 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -72,10 +72,10 @@ void SwWrtShell::Insert(SwField const& rField, SwPaM* pAnnotationRange) StartUndo(SwUndoId::INSERT, &aRewriter); bool bDeleted = false; - std::unique_ptr<SwPaM> pAnnotationTextRange; + std::optional<SwPaM> pAnnotationTextRange; if (pAnnotationRange) { - pAnnotationTextRange.reset(new SwPaM(*pAnnotationRange->Start(), *pAnnotationRange->End())); + pAnnotationTextRange.emplace(*pAnnotationRange->Start(), *pAnnotationRange->End()); } if ( HasSelection() ) @@ -95,13 +95,13 @@ void SwWrtShell::Insert(SwField const& rField, SwPaM* pAnnotationRange) EndPara(); } const SwPosition rEndPos( *GetCurrentShellCursor().GetPoint() ); - pAnnotationTextRange.reset(new SwPaM( rStartPos, rEndPos )); + pAnnotationTextRange.emplace( rStartPos, rEndPos ); } else { NormalizePam( false ); const SwPaM& rCurrPaM = GetCurrentShellCursor(); - pAnnotationTextRange.reset(new SwPaM( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() )); + pAnnotationTextRange.emplace( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() ); ClearMark(); } } |