[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Xisco Fauli anistenis at gmail.com
Mon Jun 6 07:14:11 UTC 2016


 include/sfx2/unoctitm.hxx        |    2 +-
 sfx2/source/control/unoctitm.cxx |   38 +++++++++++++++++++-------------------
 2 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit cc813c946c2fdb2e050db773572431a537e37215
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun Jun 5 00:00:45 2016 +0200

    tdf#89329: use unique_ptr for pImpl in unoctitm
    
    Change-Id: I580c6c9999b35137ae883a84898b9d03fd7cb056
    Reviewed-on: https://gerrit.libreoffice.org/25899
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx
index 8d58738..235c815 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 7c1fefe..3c00b52 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;


More information about the Libreoffice-commits mailing list