diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-05 11:25:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-07 10:00:22 +0100 |
commit | d4e1802c620e3cddb2e7a9f6a573a5a4770bc7a4 (patch) | |
tree | ccb178f4c83baf8d21cdf9c310e6f3bbce46c2bf | |
parent | f4b9c35c018ccacd7f8cf71c534863239b0da02c (diff) |
loplugin:useuniqueptr in TextChainFlow
Change-Id: Iad96df43c9c7ae6d5fd4f3aa9c2c5c721711da30
Reviewed-on: https://gerrit.libreoffice.org/49331
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svx/textchainflow.hxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/textchainflow.cxx | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx index d52e26a86e3d..2c5f5d8c00a5 100644 --- a/include/svx/textchainflow.hxx +++ b/include/svx/textchainflow.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_TEXTCHAINFLOW_HXX #include <svx/textchain.hxx> +#include <memory> class SdrTextObj; class SdrOutliner; @@ -56,8 +57,8 @@ protected: ESelection maOverflowPosSel; ESelection maPostChainingSel; - OFlowChainedText *mpOverflChText; - UFlowChainedText *mpUnderflChText; + std::unique_ptr<OFlowChainedText> mpOverflChText; + std::unique_ptr<UFlowChainedText> mpUnderflChText; void impCheckForFlowEvents(SdrOutliner *, SdrOutliner *); diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx index b87d2a7f02ed..5cce8877e098 100644 --- a/svx/source/svdraw/textchainflow.cxx +++ b/svx/source/svdraw/textchainflow.cxx @@ -46,8 +46,8 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget) TextChainFlow::~TextChainFlow() { - delete mpOverflChText; - delete mpUnderflChText; + mpOverflChText.reset(); + mpUnderflChText.reset(); } void TextChainFlow::impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *) @@ -91,14 +91,14 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p // If we had an underflow before we have to deep merge paras anyway bool bMustMergeParaOF = bMustMergeParaAmongLinks || mbOFisUFinduced; - mpOverflChText = bOverflow ? + mpOverflChText.reset( bOverflow ? new OFlowChainedText(pFlowOutl, bMustMergeParaOF) : - nullptr; + nullptr ); // Set current underflowing text (if any) - mpUnderflChText = bUnderflow ? + mpUnderflChText.reset( bUnderflow ? new UFlowChainedText(pFlowOutl, bMustMergeParaAmongLinks) : - nullptr; + nullptr ); // Reset update mode // Reset it here because we use WriteRTF (needing updatemode = true) in the two constructors above if (!bOldUpdateMode) // Reset only if the old value was false |