[Libreoffice-commits] core.git: 2 commits - include/svx svx/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Jun 4 06:37:26 UTC 2018
include/svx/tbcontrl.hxx | 2 +-
svx/source/fmcomp/gridcell.cxx | 10 +++++-----
svx/source/inc/gridcell.hxx | 2 +-
svx/source/tbxctrls/tbcontrl.cxx | 16 +++++-----------
4 files changed, 12 insertions(+), 18 deletions(-)
New commits:
commit 02180aa060fce0bea6bc8483acd7ac27f4979e25
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon May 28 11:56:02 2018 +0200
loplugin:useuniqueptr in FmXGridCell
Change-Id: Ic8e452a3ff75b5157c1bd35bb493e0059e5b1b40
Reviewed-on: https://gerrit.libreoffice.org/55221
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index deff8c93ffd8..928977fe7e36 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3194,7 +3194,7 @@ void FmXGridCell::disposing()
OComponentHelper::disposing();
m_pColumn = nullptr;
- DELETEZ(m_pCellControl);
+ m_pCellControl.reset();
}
@@ -4551,7 +4551,7 @@ const Sequence<sal_Int8>& FmXFilterCell::getUnoTunnelId()
void FmXFilterCell::PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect )
{
- static_cast< DbFilterField* >( m_pCellControl )->PaintCell( rDev, rRect );
+ static_cast< DbFilterField* >( m_pCellControl.get() )->PaintCell( rDev, rRect );
}
// OComponentHelper
@@ -4561,7 +4561,7 @@ void FmXFilterCell::disposing()
css::lang::EventObject aEvt(*this);
m_aTextListeners.disposeAndClear(aEvt);
- static_cast<DbFilterField*>(m_pCellControl)->SetCommitHdl(Link<DbFilterField&,void>());
+ static_cast<DbFilterField*>(m_pCellControl.get())->SetCommitHdl(Link<DbFilterField&,void>());
FmXGridCell::disposing();
}
@@ -4606,7 +4606,7 @@ void SAL_CALL FmXFilterCell::removeTextListener(const Reference< css::awt::XText
void SAL_CALL FmXFilterCell::setText( const OUString& aText )
{
::osl::MutexGuard aGuard( m_aMutex );
- static_cast<DbFilterField*>(m_pCellControl)->SetText(aText);
+ static_cast<DbFilterField*>(m_pCellControl.get())->SetText(aText);
}
@@ -4618,7 +4618,7 @@ void SAL_CALL FmXFilterCell::insertText( const css::awt::Selection& /*rSel*/, co
OUString SAL_CALL FmXFilterCell::getText()
{
::osl::MutexGuard aGuard( m_aMutex );
- return static_cast<DbFilterField*>(m_pCellControl)->GetText();
+ return static_cast<DbFilterField*>(m_pCellControl.get())->GetText();
}
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 1368e9a19a66..046f8fceb7cb 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -703,7 +703,7 @@ class FmXGridCell :public ::cppu::OComponentHelper
protected:
::osl::Mutex m_aMutex;
DbGridColumn* m_pColumn;
- DbCellControl* m_pCellControl;
+ std::unique_ptr<DbCellControl> m_pCellControl;
private:
::comphelper::OInterfaceContainerHelper2 m_aWindowListeners;
commit a5e0c725ef57c7489458195afa143d0197c79aa5
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon May 28 11:53:04 2018 +0200
loplugin:useuniqueptr in SvxStyleToolBoxControl
Change-Id: Ia4f7c1bd1b8e411013d4d8c084e2d5342bdbfbfb
Reviewed-on: https://gerrit.libreoffice.org/55220
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 1f5079f69a22..bf089f87153a 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -190,7 +190,7 @@ private:
SfxStyleSheetBasePool* pStyleSheetPool;
SfxStyleControllerItem_Impl* pBoundItems[MAX_FAMILIES];
css::uno::Reference<css::lang::XComponent> m_xBoundItems[MAX_FAMILIES];
- SfxTemplateItem* pFamilyState[MAX_FAMILIES];
+ std::unique_ptr<SfxTemplateItem> pFamilyState[MAX_FAMILIES];
sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
SVX_DLLPRIVATE void Update();
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 8b63a0f45ef3..882bb7194566 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2359,8 +2359,7 @@ void SAL_CALL SvxStyleToolBoxControl::dispose()
m_xBoundItems[i].clear();
pBoundItems[i] = nullptr;
}
- delete pFamilyState[i];
- pFamilyState[i] = nullptr;
+ pFamilyState[i].reset();
}
pStyleSheetPool = nullptr;
pImpl.reset();
@@ -2547,17 +2546,17 @@ void SvxStyleToolBoxControl::Update()
const SfxTemplateItem* pItem = nullptr;
- if ( nActFamily == 0xffff || nullptr == (pItem = pFamilyState[nActFamily-1]) )
+ if ( nActFamily == 0xffff || nullptr == (pItem = pFamilyState[nActFamily-1].get()) )
// Current range not within allowed ranges or default
{
pStyleSheetPool = pPool;
nActFamily = 2;
- pItem = pFamilyState[nActFamily-1];
+ pItem = pFamilyState[nActFamily-1].get();
if ( !pItem )
{
nActFamily++;
- pItem = pFamilyState[nActFamily-1];
+ pItem = pFamilyState[nActFamily-1].get();
}
if ( !pItem )
@@ -2577,12 +2576,7 @@ void SvxStyleToolBoxControl::Update()
void SvxStyleToolBoxControl::SetFamilyState( sal_uInt16 nIdx,
const SfxTemplateItem* pItem )
{
- delete pFamilyState[nIdx];
- pFamilyState[nIdx] = nullptr;
-
- if ( pItem )
- pFamilyState[nIdx] = new SfxTemplateItem( *pItem );
-
+ pFamilyState[nIdx].reset( pItem == nullptr ? nullptr : new SfxTemplateItem( *pItem ) );
Update();
}
More information about the Libreoffice-commits
mailing list