desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 9 +++----- desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 1 sc/inc/fielduno.hxx | 4 +-- sc/source/ui/unoobj/fielduno.cxx | 19 ++++++------------ xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 11 +++------- 5 files changed, 17 insertions(+), 27 deletions(-)
New commits: commit 22d36649a3087b9f8eec74c05fa33f87423619a4 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Nov 6 09:26:05 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 9 06:42:47 2018 +0100 loplugin:useuniqueptr in ScHeaderFieldsObj Change-Id: I7d9855a45ebfb5bc185e964d4437ab0c9c2deff4 Reviewed-on: https://gerrit.libreoffice.org/63131 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 70b3aa31639b..a1678d68ee8e 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -63,7 +63,7 @@ private: ScAddress const aCellPos; std::unique_ptr<ScEditSource> mpEditSource; /// List of refresh listeners. - comphelper::OInterfaceContainerHelper2* mpRefreshListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper osl::Mutex aMutex; @@ -117,7 +117,7 @@ private: std::unique_ptr<ScEditSource> mpEditSource; /// List of refresh listeners. - comphelper::OInterfaceContainerHelper2* mpRefreshListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper osl::Mutex aMutex; diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 666eb8c7c88e..7c53309b1082 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -272,8 +272,7 @@ ScCellFieldsObj::ScCellFieldsObj( ScDocShell* pDocSh, const ScAddress& rPos) : mxContent(xContent), pDocShell( pDocSh ), - aCellPos( rPos ), - mpRefreshListeners( nullptr ) + aCellPos( rPos ) { pDocShell->GetDocument().AddUnoObject(*this); @@ -296,11 +295,8 @@ ScCellFieldsObj::~ScCellFieldsObj() { lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - if (mpRefreshListeners) - { - mpRefreshListeners->disposeAndClear(aEvent); - DELETEZ( mpRefreshListeners ); - } + mpRefreshListeners->disposeAndClear(aEvent); + mpRefreshListeners.reset(); } } @@ -408,7 +404,7 @@ void SAL_CALL ScCellFieldsObj::addRefreshListener( const uno::Reference< util::X { SolarMutexGuard aGuard; if (!mpRefreshListeners) - mpRefreshListeners = new comphelper::OInterfaceContainerHelper2(aMutex); + mpRefreshListeners.reset( new comphelper::OInterfaceContainerHelper2(aMutex) ); mpRefreshListeners->addInterface(xListener); } } @@ -424,8 +420,7 @@ void SAL_CALL ScCellFieldsObj::removeRefreshListener( const uno::Reference<util: } ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterTextData& rData) : - mrData(rData), - mpRefreshListeners( nullptr ) + mrData(rData) { mpEditSource.reset( new ScHeaderFooterEditSource(rData) ); } @@ -442,7 +437,7 @@ ScHeaderFieldsObj::~ScHeaderFieldsObj() lang::EventObject aEvent; aEvent.Source = static_cast<cppu::OWeakObject*>(this); mpRefreshListeners->disposeAndClear(aEvent); - DELETEZ(mpRefreshListeners); + mpRefreshListeners.reset(); } } @@ -561,7 +556,7 @@ void SAL_CALL ScHeaderFieldsObj::addRefreshListener( const uno::Reference< util: { SolarMutexGuard aGuard; if (!mpRefreshListeners) - mpRefreshListeners = new comphelper::OInterfaceContainerHelper2(aMutex); + mpRefreshListeners.reset(new comphelper::OInterfaceContainerHelper2(aMutex)); mpRefreshListeners->addInterface(xListener); } } commit 224837289cb6c6753026173b35142b10e7e1538e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Nov 8 16:05:32 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 9 06:42:20 2018 +0100 fix bug in listbox height calc in ExtensionBox_Impl found by loplugin:singlevalfields Change-Id: Ide29da9222c8323e87fe640bd3548306c1778919 Reviewed-on: https://gerrit.libreoffice.org/63125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index e8442a20f8a1..b09ce623127f 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -183,7 +183,6 @@ ExtensionBox_Impl::ExtensionBox_Impl(vcl::Window* pParent) : m_nActive( 0 ), m_nTopIndex( 0 ), m_nActiveHeight( 0 ), - m_nExtraHeight( 2 ), m_aSharedImage(BitmapEx(RID_BMP_SHARED)), m_aLockedImage(BitmapEx(RID_BMP_LOCKED)), m_aWarningImage(BitmapEx(RID_BMP_WARNING)), @@ -314,10 +313,10 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos ) if ( aTextHeight < m_nStdHeight ) aTextHeight = m_nStdHeight; + m_nActiveHeight = aTextHeight; + if ( m_vEntries[ nPos ]->m_bHasButtons ) - m_nActiveHeight = aTextHeight + m_nExtraHeight; - else - m_nActiveHeight = aTextHeight + 2; + m_nActiveHeight += 2; } tools::Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const @@ -530,7 +529,7 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools: long nExtraHeight = 0; if (rEntry->m_bHasButtons) - nExtraHeight = m_nExtraHeight; + nExtraHeight = 2; rRenderContext.DrawText(tools::Rectangle(aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - nExtraHeight), sDescription, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 356a4ff2e238..abe69cf87623 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -118,7 +118,6 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox long m_nTopIndex; long m_nStdHeight; long m_nActiveHeight; - long m_nExtraHeight; Image m_aSharedImage; Image m_aLockedImage; Image m_aWarningImage; commit 20831ee1c0c856904cdd4fae4a9a55ecc885d04d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Oct 31 09:44:07 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 9 06:41:26 2018 +0100 loplugin:useuniqueptr in ResultSetForQuery Change-Id: Ie375f7fded2592cd1e926f14be0216608c2695d6 Reviewed-on: https://gerrit.libreoffice.org/63130 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index 66ccaf747696..93007b70c6df 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -128,7 +128,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte try { - vector< vector<HitItem>* > aQueryListResultVectorVector; + vector< vector<HitItem> > aQueryListResultVectorVector; set< OUString > aSet,aCurrent,aResultSet; int nQueryListSize = queryList.size(); @@ -140,8 +140,8 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte vector<HitItem>* pQueryResultVector; if( nQueryListSize > 1 ) { - pQueryResultVector = new vector<HitItem>; - aQueryListResultVectorVector.push_back( pQueryResultVector ); + aQueryListResultVectorVector.emplace_back(); + pQueryResultVector = &aQueryListResultVectorVector.back(); } else { @@ -197,8 +197,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte { for( int n = 0 ; n < nQueryListSize ; ++n ) { - vector<HitItem>* pQueryResultVector = aQueryListResultVectorVector[n]; - vector<HitItem>& rQueryResultVector = *pQueryResultVector; + vector<HitItem>& rQueryResultVector = aQueryListResultVectorVector[n]; int nItemCount = rQueryResultVector.size(); for( int i = 0 ; i < nItemCount ; ++i ) @@ -229,8 +228,6 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte } } } - - delete pQueryResultVector; } sort( aIndexFolderResultVector.begin(), aIndexFolderResultVector.end() ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits