[Libreoffice-commits] core.git: 2 commits - include/svx svx/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Feb 19 06:12:19 UTC 2018
include/svx/clipboardctl.hxx | 4 +++-
svx/source/dialog/fntctrl.cxx | 17 +++++------------
svx/source/mnuctrls/clipboardctl.cxx | 8 +++-----
3 files changed, 11 insertions(+), 18 deletions(-)
New commits:
commit 6e5d8bb2d60c2e44aa1d2bf7810bff09b9ceabb5
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Feb 6 14:51:39 2018 +0200
loplugin:useuniqueptr in FontPrevWin_Impl
Change-Id: I0919b8e2c58dbe26154e4a7c7c77e8e63f665842
Reviewed-on: https://gerrit.libreoffice.org/49933
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 63b53beb64ce..df74bc29f474 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -156,8 +156,8 @@ class FontPrevWin_Impl
SvxFont maCTLFont;
OUString maText;
OUString maScriptText;
- Color* mpColor;
- Color* mpBackColor;
+ std::unique_ptr<Color> mpColor;
+ std::unique_ptr<Color> mpBackColor;
long mnAscent;
sal_Unicode mcStartBracket;
sal_Unicode mcEndBracket;
@@ -182,8 +182,6 @@ public:
FontPrevWin_Impl() :
mpPrinter(nullptr),
mbDelPrinter(false),
- mpColor(nullptr),
- mpBackColor(nullptr),
mnAscent(0),
mcStartBracket(0),
mcEndBracket(0),
@@ -204,8 +202,6 @@ public:
~FontPrevWin_Impl()
{
- delete mpColor;
- delete mpBackColor;
if (mbDelPrinter)
mpPrinter.disposeAndClear();
}
@@ -604,22 +600,19 @@ void SvxFontPrevWindow::SetFont( const SvxFont& rNormalOutFont, const SvxFont& r
void SvxFontPrevWindow::SetColor(const Color &rColor)
{
- delete pImpl->mpColor;
- pImpl->mpColor = new Color(rColor);
+ pImpl->mpColor.reset(new Color(rColor));
Invalidate();
}
void SvxFontPrevWindow::ResetColor()
{
- delete pImpl->mpColor;
- pImpl->mpColor = nullptr;
+ pImpl->mpColor.reset();
Invalidate();
}
void SvxFontPrevWindow::SetBackColor(const Color &rColor)
{
- delete pImpl->mpBackColor;
- pImpl->mpBackColor = new Color(rColor);
+ pImpl->mpBackColor.reset(new Color(rColor));
Invalidate();
}
commit 5d9e3beb3760bcc04afb5d69b0c9ff70d522dd5e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Feb 6 13:27:43 2018 +0200
loplugin:useuniqueptr in SvxClipBoardControl
Change-Id: Ib9e3d20680cba684fea8b586a5ca4c5835ca6b42
Reviewed-on: https://gerrit.libreoffice.org/49932
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx
index 135498be439e..e825035cd34d 100644
--- a/include/svx/clipboardctl.hxx
+++ b/include/svx/clipboardctl.hxx
@@ -25,6 +25,7 @@
#include <svl/poolitem.hxx>
#include <svx/svxdllapi.h>
#include <vcl/vclptr.hxx>
+#include <memory>
class PopupMenu;
class SfxModule;
@@ -32,7 +33,8 @@ class ToolBox;
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxClipBoardControl : public SfxToolBoxControl
{
- SfxPoolItem* pClipboardFmtItem;
+ std::unique_ptr<SfxPoolItem>
+ pClipboardFmtItem;
VclPtr<PopupMenu> pPopup;
bool bDisabled;
diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx
index 22c00fe7e8fd..6d5c2e9fe25b 100644
--- a/svx/source/mnuctrls/clipboardctl.cxx
+++ b/svx/source/mnuctrls/clipboardctl.cxx
@@ -42,7 +42,6 @@ SvxClipBoardControl::SvxClipBoardControl(
sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
SfxToolBoxControl( nSlotId, nId, rTbx ),
- pClipboardFmtItem( nullptr ),
pPopup( nullptr ),
bDisabled( false )
{
@@ -56,13 +55,12 @@ SvxClipBoardControl::SvxClipBoardControl(
SvxClipBoardControl::~SvxClipBoardControl()
{
DelPopup();
- delete pClipboardFmtItem;
}
VclPtr<SfxPopupWindow> SvxClipBoardControl::CreatePopupWindow()
{
- const SvxClipboardFormatItem* pFmtItem = dynamic_cast<SvxClipboardFormatItem*>( pClipboardFmtItem );
+ const SvxClipboardFormatItem* pFmtItem = dynamic_cast<SvxClipboardFormatItem*>( pClipboardFmtItem.get() );
if ( pFmtItem )
{
if (pPopup)
@@ -111,10 +109,10 @@ void SvxClipBoardControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
{
if ( SID_CLIPBOARD_FORMAT_ITEMS == nSID )
{
- DELETEZ( pClipboardFmtItem );
+ pClipboardFmtItem.reset();
if ( eState >= SfxItemState::DEFAULT )
{
- pClipboardFmtItem = pState->Clone();
+ pClipboardFmtItem.reset( pState->Clone() );
GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) | ToolBoxItemBits::DROPDOWN );
}
else if ( !bDisabled )
More information about the Libreoffice-commits
mailing list