diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-02 13:00:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-02 13:58:07 +0200 |
commit | be48eb2e82a3d8891ee84145567e2b89884f1fd6 (patch) | |
tree | 17e123be98ce578c3ff10c31a275141dfe2e3afa /sc | |
parent | f66edd357c4572fd69d42c2330f922ec2beaa415 (diff) |
return std::unique_ptr from SdrMakeOutliner
and some of its callers
Change-Id: I121a7810e3e35e76da4ffe5fc5405a7bf86cb66d
Reviewed-on: https://gerrit.libreoffice.org/53728
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/drawfunc/futext.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/futext2.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/futext.hxx | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 7914c87a7313..0152ba0084af 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -184,7 +184,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) nullptr; if (pObj) { - SdrOutliner* pO = MakeOutliner(); + std::unique_ptr<SdrOutliner> pO = MakeOutliner(); lcl_UpdateHyphenator( *pO, pObj ); // vertical flag: @@ -197,10 +197,11 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) pO->SetVertical( bVertical ); //!?? the default values are not correct when result is without outliner ???!? - if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO) ) + auto pUndoManager = &pO->GetUndoManager(); + if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) ) { // subscribe EditEngine-UndoManager - pViewShell->SetDrawTextUndo( &pO->GetUndoManager() ); + pViewShell->SetDrawTextUndo( pUndoManager ); OutlinerView* pOLV = pView->GetTextEditOutlinerView(); if ( pOLV->MouseButtonDown(rMEvt) ) @@ -578,7 +579,7 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, if ( pObj->HasTextEdit() ) { - SdrOutliner* pO = MakeOutliner(); + std::unique_ptr<SdrOutliner> pO = MakeOutliner(); lcl_UpdateHyphenator( *pO, pObj ); // vertical flag: @@ -592,7 +593,8 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, pO->SetVertical( bVertical ); //!?? without returned Outliner the defaults are not correct ???!? - if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO) ) + auto pUndoManager = &pO->GetUndoManager(); + if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) ) { // Toggle out of paste mode if we are in it, otherwise // pressing return in this object will instead go to the @@ -601,7 +603,7 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, pViewShell->UpdateCopySourceOverlay(); // EditEngine-UndoManager anmelden - pViewShell->SetDrawTextUndo( &pO->GetUndoManager() ); + pViewShell->SetDrawTextUndo( pUndoManager ); pView->SetEditMode(); diff --git a/sc/source/ui/drawfunc/futext2.cxx b/sc/source/ui/drawfunc/futext2.cxx index 22f6325a7114..e986099cce7a 100644 --- a/sc/source/ui/drawfunc/futext2.cxx +++ b/sc/source/ui/drawfunc/futext2.cxx @@ -24,10 +24,10 @@ #include <futext.hxx> #include <tabvwsh.hxx> -SdrOutliner* FuText::MakeOutliner() +std::unique_ptr<SdrOutliner> FuText::MakeOutliner() { ScViewData& rViewData = pViewShell->GetViewData(); - SdrOutliner* pOutl = SdrMakeOutliner(OutlinerMode::OutlineObject, *pDrDoc); + std::unique_ptr<SdrOutliner> pOutl = SdrMakeOutliner(OutlinerMode::OutlineObject, *pDrDoc); rViewData.UpdateOutlinerFlags(*pOutl); diff --git a/sc/source/ui/inc/futext.hxx b/sc/source/ui/inc/futext.hxx index 0403dc944004..215da2dbe80c 100644 --- a/sc/source/ui/inc/futext.hxx +++ b/sc/source/ui/inc/futext.hxx @@ -53,7 +53,7 @@ public: virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override; private: - SdrOutliner* MakeOutliner(); + std::unique_ptr<SdrOutliner> MakeOutliner(); }; #endif |