diff options
author | Xisco Fauli <anistenis@gmail.com> | 2016-06-05 00:00:45 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-06 07:13:50 +0000 |
commit | cc813c946c2fdb2e050db773572431a537e37215 (patch) | |
tree | 132eec4b900b0abe7ddf069b5e320e500a6193d9 | |
parent | d2e0d10d481f76e142635463bdccb6bc6706cc13 (diff) |
tdf#89329: use unique_ptr for pImpl in unoctitm
Change-Id: I580c6c9999b35137ae883a84898b9d03fd7cb056
Reviewed-on: https://gerrit.libreoffice.org/25899
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/sfx2/unoctitm.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 38 |
2 files changed, 20 insertions, 20 deletions
diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx index 8d58738ec694..235c815270ea 100644 --- a/include/sfx2/unoctitm.hxx +++ b/include/sfx2/unoctitm.hxx @@ -73,7 +73,7 @@ class SfxDispatchController_Impl; class SfxOfficeDispatch : public ::cppu::ImplInheritanceHelper1< SfxStatusDispatcher, css::lang::XUnoTunnel > { friend class SfxDispatchController_Impl; - SfxDispatchController_Impl* pControllerItem; + std::unique_ptr<SfxDispatchController_Impl> pImpl; public: SfxOfficeDispatch( SfxBindings& rBind, SfxDispatcher* pDispat, diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 7c1fefeae1cb..3c00b5269f86 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -161,24 +161,24 @@ sal_Int64 SAL_CALL SfxOfficeDispatch::getSomething( const css::uno::Sequence< sa } SfxOfficeDispatch::SfxOfficeDispatch( SfxBindings& rBindings, SfxDispatcher* pDispat, const SfxSlot* pSlot, const css::util::URL& rURL ) + : pImpl( new SfxDispatchController_Impl( this, &rBindings, pDispat, pSlot, rURL )) { - // this object is an adapter that shows a css::frame::XDispatch-Interface to the outside and uses a SfxControllerItem to monitor a state - pControllerItem = new SfxDispatchController_Impl( this, &rBindings, pDispat, pSlot, rURL ); + // pImpl is an adapter that shows a css::frame::XDispatch-Interface to the outside and uses a SfxControllerItem to monitor a state + } SfxOfficeDispatch::SfxOfficeDispatch( SfxDispatcher* pDispat, const SfxSlot* pSlot, const css::util::URL& rURL ) + : pImpl( new SfxDispatchController_Impl( this, nullptr, pDispat, pSlot, rURL )) { - // this object is an adapter that shows a css::frame::XDispatch-Interface to the outside and uses a SfxControllerItem to monitor a state - pControllerItem = new SfxDispatchController_Impl( this, nullptr, pDispat, pSlot, rURL ); + // pImpl is an adapter that shows a css::frame::XDispatch-Interface to the outside and uses a SfxControllerItem to monitor a state } SfxOfficeDispatch::~SfxOfficeDispatch() { - if ( pControllerItem ) + if ( pImpl ) { // when dispatch object is released, destroy its connection to this object and destroy it - pControllerItem->UnBindController(); - delete pControllerItem; + pImpl->UnBindController(); } } @@ -194,7 +194,7 @@ const css::uno::Sequence< sal_Int8 >& SfxOfficeDispatch::impl_getStaticIdentifie void SAL_CALL SfxOfficeDispatch::dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) throw ( css::uno::RuntimeException, std::exception ) { // ControllerItem is the Impl class - if ( pControllerItem ) + if ( pImpl ) { #if HAVE_FEATURE_JAVA // The JavaContext contains an interaction handler which is used when @@ -206,7 +206,7 @@ void SAL_CALL SfxOfficeDispatch::dispatch( const css::util::URL& aURL, const css css::uno::ContextLayer layer( new svt::JavaContext( css::uno::getCurrentContext() ) ); #endif - pControllerItem->dispatch( aURL, aArgs, css::uno::Reference < css::frame::XDispatchResultListener >() ); + pImpl->dispatch( aURL, aArgs, css::uno::Reference < css::frame::XDispatchResultListener >() ); } } @@ -215,41 +215,41 @@ void SAL_CALL SfxOfficeDispatch::dispatchWithNotification( const css::util::URL& const css::uno::Reference< css::frame::XDispatchResultListener >& rListener ) throw( css::uno::RuntimeException, std::exception ) { // ControllerItem is the Impl class - if ( pControllerItem ) + if ( pImpl ) { #if HAVE_FEATURE_JAVA // see comment for SfxOfficeDispatch::dispatch css::uno::ContextLayer layer( new svt::JavaContext( css::uno::getCurrentContext() ) ); #endif - pControllerItem->dispatch( aURL, aArgs, rListener ); + pImpl->dispatch( aURL, aArgs, rListener ); } } void SAL_CALL SfxOfficeDispatch::addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & aListener, const css::util::URL& aURL) throw ( css::uno::RuntimeException, std::exception ) { GetListeners().addInterface( aURL.Complete, aListener ); - if ( pControllerItem ) + if ( pImpl ) { // ControllerItem is the Impl class - pControllerItem->addStatusListener( aListener, aURL ); + pImpl->addStatusListener( aListener, aURL ); } } SfxDispatcher* SfxOfficeDispatch::GetDispatcher_Impl() { - return pControllerItem->GetDispatcher(); + return pImpl->GetDispatcher(); } void SfxOfficeDispatch::SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame) { - if ( pControllerItem ) - pControllerItem->SetFrame( xFrame ); + if ( pImpl ) + pImpl->SetFrame( xFrame ); } void SfxOfficeDispatch::SetMasterUnoCommand( bool bSet ) { - if ( pControllerItem ) - pControllerItem->setMasterSlaveCommand( bSet ); + if ( pImpl ) + pImpl->setMasterSlaveCommand( bSet ); } // Determine if URL contains a master/slave command which must be handled a little bit different @@ -315,7 +315,7 @@ SfxDispatchController_Impl::~SfxDispatchController_Impl() if ( pDispatch ) { // disconnect - pDispatch->pControllerItem = nullptr; + pDispatch->pImpl = nullptr; // force all listeners to release the dispatch object css::lang::EventObject aObject; |