editeng/source/editeng/editeng.cxx  |    2 +-
 editeng/source/editeng/impedit.hxx  |    2 +-
 editeng/source/editeng/impedit3.cxx |    6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 8a60780dddf4a2d043b7152514f251d480f3be7e
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Sep 5 09:10:46 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Sep 5 14:56:01 2021 +0200

    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.gran...@collabora.co.uk>

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;
 }

Reply via email to