diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-09-05 09:10:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-05 14:56:01 +0200 |
commit | 8a60780dddf4a2d043b7152514f251d480f3be7e (patch) | |
tree | d0c9e75fe2f448ca54d21f6d9ebe734d63057861 | |
parent | 24edba599a71da5cec504bdeb595ee1edfd9a4da (diff) |
no need to pass EditSelection around with unique_ptr
Change-Id: I4c55bfd68f35fb0a559d6a3ba3d860445fc7242f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121664
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index b5b3c543354a..e9f19cbd3194 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1735,7 +1735,7 @@ void EditEngine::InsertParagraph(sal_Int32 nPara, const OUString& rTxt) void EditEngine::SetText(sal_Int32 nPara, const OUString& rTxt) { - std::unique_ptr<EditSelection> pSel = pImpEditEngine->SelectParagraph( nPara ); + std::optional<EditSelection> pSel = pImpEditEngine->SelectParagraph( nPara ); if ( pSel ) { pImpEditEngine->UndoActionStart( EDITUNDO_INSERT ); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index b3ca1e284671..b894bd2153e6 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -947,7 +947,7 @@ public: // OV-Special void InvalidateFromParagraph( sal_Int32 nFirstInvPara ); EditPaM InsertParagraph( sal_Int32 nPara ); - std::unique_ptr<EditSelection> SelectParagraph( sal_Int32 nPara ); + std::optional<EditSelection> SelectParagraph( sal_Int32 nPara ); void SetStatusEventHdl( const Link<EditStatus&, void>& rLink ) { aStatusHdlLink = rLink; } const Link<EditStatus&,void>& GetStatusEventHdl() const { return aStatusHdlLink; } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 441a3ef65aad..7b4a96412181 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4160,13 +4160,13 @@ EditPaM ImpEditEngine::InsertParagraph( sal_Int32 nPara ) return ImpInsertParaBreak( aPaM ); } -std::unique_ptr<EditSelection> ImpEditEngine::SelectParagraph( sal_Int32 nPara ) +std::optional<EditSelection> ImpEditEngine::SelectParagraph( sal_Int32 nPara ) { - std::unique_ptr<EditSelection> pSel; + std::optional<EditSelection> pSel; ContentNode* pNode = GetEditDoc().GetObject( nPara ); SAL_WARN_IF( !pNode, "editeng", "Paragraph does not exist: SelectParagraph" ); if ( pNode ) - pSel.reset(new EditSelection( EditPaM( pNode, 0 ), EditPaM( pNode, pNode->Len() ) )); + pSel.emplace( EditPaM( pNode, 0 ), EditPaM( pNode, pNode->Len() ) ); return pSel; } |