svx/source/tbxctrls/tbcontrl.cxx | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-)
New commits: commit 464f109cb6f506b26a500a90eeba32c42432b83d Author: Maxim Monastirsky <momonas...@gmail.com> Date: Wed Jan 11 00:56:22 2017 +0200 SvxFontNameBox_Impl was not disposed This is visible after toolbar customization, when the old font box stays visible. Turns out that currently the toolbox controller is supposed to own the item window, not the toolbox. Regression of: commit 970a66f8c919ea0524f216f40d21b3e2a8c88ccc Author: Maxim Monastirsky <momonas...@gmail.com> Date: Sun Oct 16 01:27:10 2016 +0300 Use UNO registration for font name toolbox control Change-Id: I29a1f06d97c9a981507ff62889e2d7fc6ac9d688 Reviewed-on: https://gerrit.libreoffice.org/32943 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonas...@gmail.com> (cherry picked from commit e1f5db9579602dd02a80c1d1ea1d078606542f16) Reviewed-on: https://gerrit.libreoffice.org/32956 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 36b57a8..6e7b8e0 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2699,10 +2699,16 @@ public: // XToolbarController virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& rParent ) throw ( css::uno::RuntimeException, std::exception ) override; + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException, std::exception ) override; + // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw ( css::uno::RuntimeException, std::exception ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw ( css::uno::RuntimeException, std::exception ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException, std::exception ) override; + +private: + VclPtr<SvxFontNameBox_Impl> m_pBox; }; SvxFontNameToolBoxControl::SvxFontNameToolBoxControl() @@ -2718,25 +2724,21 @@ void SvxFontNameToolBoxControl::statusChanged( const css::frame::FeatureStateEve if ( !getToolboxId( nId, &pToolBox ) ) return; - SvxFontNameBox_Impl* pBox = static_cast<SvxFontNameBox_Impl*>(pToolBox->GetItemWindow( nId )); - - DBG_ASSERT( pBox, "Control not found!" ); - if ( !rEvent.IsEnabled ) { - pBox->Disable(); - pBox->Update( nullptr ); + m_pBox->Disable(); + m_pBox->Update( nullptr ); } else { - pBox->Enable(); + m_pBox->Enable(); css::awt::FontDescriptor aFontDesc; if ( rEvent.State >>= aFontDesc ) - pBox->Update( &aFontDesc ); + m_pBox->Update( &aFontDesc ); else - pBox->SetText( "" ); - pBox->SaveValue(); + m_pBox->SetText( "" ); + m_pBox->SaveValue(); } pToolBox->EnableItem( nId, rEvent.IsEnabled ); @@ -2746,10 +2748,17 @@ css::uno::Reference< css::awt::XWindow > SvxFontNameToolBoxControl::createItemWi throw ( css::uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - VclPtrInstance<SvxFontNameBox_Impl> pBox( VCLUnoHelper::GetWindow( rParent ), - Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), - m_xFrame,0); - return VCLUnoHelper::GetInterface( pBox ); + m_pBox = VclPtr<SvxFontNameBox_Impl>::Create( VCLUnoHelper::GetWindow( rParent ), + Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), + m_xFrame, 0); + return VCLUnoHelper::GetInterface( m_pBox ); +} + +void SvxFontNameToolBoxControl::dispose() + throw ( css::uno::RuntimeException, std::exception ) +{ + m_pBox.disposeAndClear(); + ToolboxController::dispose(); } OUString SvxFontNameToolBoxControl::getImplementationName()
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits