[Libreoffice-commits] core.git: dbaccess/source forms/source include/svtools reportdesign/source sc/source sd/source

Noel Grandin noel at peralex.com
Wed Jun 8 08:21:24 UTC 2016


 dbaccess/source/ui/app/AppController.cxx           |    4 ++--
 dbaccess/source/ui/browser/brwctrlr.cxx            |    4 ++--
 forms/source/richtext/clipboarddispatcher.cxx      |    4 ++--
 include/svtools/cliplistener.hxx                   |    4 +++-
 reportdesign/source/ui/report/ReportController.cxx |    4 ++--
 sc/source/ui/drawfunc/drtxtob.cxx                  |    4 ++--
 sc/source/ui/view/cellsh.cxx                       |    4 ++--
 sc/source/ui/view/editsh.cxx                       |    4 ++--
 sd/source/ui/view/drviews7.cxx                     |    2 +-
 sd/source/ui/view/drviewsa.cxx                     |    2 +-
 sd/source/ui/view/outlnvsh.cxx                     |    4 ++--
 11 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 4cad126dc11a4798d5554da55b94ef51e0b0e21d
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jun 8 10:08:01 2016 +0200

    split AddRemoveListener into two methods
    
    Change-Id: I247dc8a9033b39d5e49dc06e725f638644fcd02d

diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index c3294b2..a3cc1b3 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -342,7 +342,7 @@ void SAL_CALL OApplicationController::disposing()
     {
         getContainer()->showPreview(nullptr);
         m_pClipbordNotifier->ClearCallbackLink();
-        m_pClipbordNotifier->AddRemoveListener( getView(), false );
+        m_pClipbordNotifier->RemoveListener( getView() );
         m_pClipbordNotifier->release();
         m_pClipbordNotifier = nullptr;
     }
@@ -448,7 +448,7 @@ bool OApplicationController::Construct(vcl::Window* _pParent)
 
     m_pClipbordNotifier = new TransferableClipboardListener( LINK( this, OApplicationController, OnClipboardChanged ) );
     m_pClipbordNotifier->acquire();
-    m_pClipbordNotifier->AddRemoveListener( getView(), true );
+    m_pClipbordNotifier->AddListener( getView() );
 
     OGenericUnoController::Construct( _pParent );
     getView()->Show();
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 3588997..5dd5e6a 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -786,7 +786,7 @@ bool SbaXDataBrowserController::Construct(vcl::Window* pParent)
 
     m_pClipbordNotifier = new TransferableClipboardListener( LINK( this, SbaXDataBrowserController, OnClipboardChanged ) );
     m_pClipbordNotifier->acquire();
-    m_pClipbordNotifier->AddRemoveListener( getView(), true );
+    m_pClipbordNotifier->AddListener( getView() );
 
     // this call create the toolbox
     SbaXDataBrowserController_Base::Construct(pParent);
@@ -1197,7 +1197,7 @@ void SbaXDataBrowserController::disposing()
     if ( getView() && m_pClipbordNotifier  )
     {
         m_pClipbordNotifier->ClearCallbackLink();
-        m_pClipbordNotifier->AddRemoveListener( getView(), false );
+        m_pClipbordNotifier->RemoveListener( getView() );
         m_pClipbordNotifier->release();
         m_pClipbordNotifier = nullptr;
     }
diff --git a/forms/source/richtext/clipboarddispatcher.cxx b/forms/source/richtext/clipboarddispatcher.cxx
index 00d5ade..cb920ff 100644
--- a/forms/source/richtext/clipboarddispatcher.cxx
+++ b/forms/source/richtext/clipboarddispatcher.cxx
@@ -135,7 +135,7 @@ namespace frm
     {
         m_pClipListener = new TransferableClipboardListener( LINK( this, OPasteClipboardDispatcher, OnClipboardChanged ) );
         m_pClipListener->acquire();
-        m_pClipListener->AddRemoveListener( _rView.GetWindow(), true );
+        m_pClipListener->AddListener( _rView.GetWindow() );
 
         // initial state
         TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( _rView.GetWindow() ) );
@@ -169,7 +169,7 @@ namespace frm
         if (m_pClipListener)
         {
             if (getEditView() && getEditView()->GetWindow())
-                m_pClipListener->AddRemoveListener( getEditView()->GetWindow(), false );
+                m_pClipListener->RemoveListener( getEditView()->GetWindow() );
 
             m_pClipListener->release();
             m_pClipListener = nullptr;
diff --git a/include/svtools/cliplistener.hxx b/include/svtools/cliplistener.hxx
index f0f5fe1..b73dff5 100644
--- a/include/svtools/cliplistener.hxx
+++ b/include/svtools/cliplistener.hxx
@@ -34,12 +34,14 @@ class SVT_DLLPUBLIC TransferableClipboardListener : public ::cppu::WeakImplHelpe
 {
     Link<TransferableDataHelper*,void>  aLink;
 
+    void    AddRemoveListener( vcl::Window* pWin, bool bAdd );
 public:
             // Link is called with a TransferableDataHelper pointer
             TransferableClipboardListener( const Link<TransferableDataHelper*,void>& rCallback );
             virtual ~TransferableClipboardListener();
 
-    void    AddRemoveListener( vcl::Window* pWin, bool bAdd );
+    void    AddListener( vcl::Window* pWin ) { AddRemoveListener(pWin, true); }
+    void    RemoveListener( vcl::Window* pWin ) { AddRemoveListener(pWin, false); }
     void    ClearCallbackLink();
 
             // XEventListener
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 63bd2b5..94c67de 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -315,7 +315,7 @@ void OReportController::disposing()
     if ( m_pClipboardNotifier.is() )
     {
         m_pClipboardNotifier->ClearCallbackLink();
-        m_pClipboardNotifier->AddRemoveListener( getView(), false );
+        m_pClipboardNotifier->RemoveListener( getView() );
         m_pClipboardNotifier.clear();
     }
     if ( m_pGroupsFloater )
@@ -1766,7 +1766,7 @@ bool OReportController::Construct(vcl::Window* pParent)
     m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
     m_aSystemClipboard.StartClipboardListening( );
     m_pClipboardNotifier = new TransferableClipboardListener( LINK( this, OReportController, OnClipboardChanged ) );
-    m_pClipboardNotifier->AddRemoveListener( getView(), true );
+    m_pClipboardNotifier->AddListener( getView() );
 
     OReportController_BASE::Construct(pParent);
     return true;
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 2709e61..f98b27d 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -134,7 +134,7 @@ ScDrawTextObjectBar::~ScDrawTextObjectBar()
 {
     if ( mxClipEvtLstnr.is() )
     {
-        mxClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false );
+        mxClipEvtLstnr->RemoveListener( pViewData->GetActiveWin() );
 
         //  The listener may just now be waiting for the SolarMutex and call the link
         //  afterwards, in spite of RemoveListener. So the link has to be reset, too.
@@ -494,7 +494,7 @@ void ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet )
         // create listener
         mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar, ClipboardChanged ) );
         vcl::Window* pWin = pViewData->GetActiveWin();
-        mxClipEvtLstnr->AddRemoveListener( pWin, true );
+        mxClipEvtLstnr->AddListener( pWin );
 
         // get initial state
         TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index f88274e..f609e15 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -87,7 +87,7 @@ ScCellShell::~ScCellShell()
 {
     if ( pImpl->m_pClipEvtLstnr )
     {
-        pImpl->m_pClipEvtLstnr->AddRemoveListener( GetViewData()->GetActiveWin(), false );
+        pImpl->m_pClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() );
 
         //  The listener may just now be waiting for the SolarMutex and call the link
         //  afterwards, in spite of RemoveListener. So the link has to be reset, too.
@@ -532,7 +532,7 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
         pImpl->m_pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) );
         pImpl->m_pClipEvtLstnr->acquire();
         vcl::Window* pWin = GetViewData()->GetActiveWin();
-        pImpl->m_pClipEvtLstnr->AddRemoveListener( pWin, true );
+        pImpl->m_pClipEvtLstnr->AddListener( pWin );
 
         // get initial state
         TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 6229893..864f1ab 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -106,7 +106,7 @@ ScEditShell::~ScEditShell()
 {
     if ( mxClipEvtLstnr.is() )
     {
-        mxClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false );
+        mxClipEvtLstnr->RemoveListener( pViewData->GetActiveWin() );
 
         //  The listener may just now be waiting for the SolarMutex and call the link
         //  afterwards, in spite of RemoveListener. So the link has to be reset, too.
@@ -811,7 +811,7 @@ void ScEditShell::GetClipState( SfxItemSet& rSet )
         // create listener
         mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScEditShell, ClipboardChanged ) );
         vcl::Window* pWin = pViewData->GetActiveWin();
-        mxClipEvtLstnr->AddRemoveListener( pWin, true );
+        mxClipEvtLstnr->AddListener( pWin );
 
         // get initial state
         TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 5f32259..5869350 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -613,7 +613,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
             {
                 // create listener
                 mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) );
-                mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), true );
+                mxClipEvtLstnr->AddListener( GetActiveWindow() );
 
                 // get initial state
                 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 561ca6f..2e79b86 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -179,7 +179,7 @@ DrawViewShell::~DrawViewShell()
 
     if ( mxClipEvtLstnr.is() )
     {
-        mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), false );
+        mxClipEvtLstnr->RemoveListener( GetActiveWindow() );
         mxClipEvtLstnr->ClearCallbackLink();        // prevent callback if another thread is waiting
         mxClipEvtLstnr.clear();
     }
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index f0708be..44fe29a 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -220,7 +220,7 @@ OutlineViewShell::~OutlineViewShell()
 
     if ( mxClipEvtLstnr.is() )
     {
-        mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), false );
+        mxClipEvtLstnr->RemoveListener( GetActiveWindow() );
         mxClipEvtLstnr->ClearCallbackLink();     // prevent callback if another thread is waiting
     }
 }
@@ -883,7 +883,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
         {
             // create listener
             mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, OutlineViewShell, ClipboardChanged ) );
-            mxClipEvtLstnr->AddRemoveListener( GetActiveWindow(), true );
+            mxClipEvtLstnr->AddListener( GetActiveWindow() );
 
             // get initial state
             TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );


More information about the Libreoffice-commits mailing list