[Libreoffice-commits] core.git: sw/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Jan 25 10:03:24 UTC 2017


 sw/source/uibase/inc/uivwimp.hxx    |   19 ++++++++++---------
 sw/source/uibase/uiview/uivwimp.cxx |   24 +++++++++++-------------
 2 files changed, 21 insertions(+), 22 deletions(-)

New commits:
commit cd28eb89d779091fafba0cf6c39a75498d4eab22
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 25 11:05:59 2017 +0200

    use rtl::Reference in SwView_Impl
    
    instead of storing both raw pointers and uno::Reference
    
    Change-Id: I75fbb279c5698a1d29b989a03c7daf5d279e869e

diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index edf2f05..903af9a 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -89,24 +89,25 @@ class SwMailMergeConfigItem;
 
 class SwView_Impl
 {
-    css::uno::Reference< css::lang::XEventListener >  xScanEvtLstnr;
-    css::uno::Reference< css::lang::XEventListener >  xClipEvtLstnr;
     css::uno::Reference< css::frame::XDispatchProviderInterceptor >   xDisProvInterceptor;
     css::uno::Reference< css::view::XSelectionSupplier >              mxXTextView;       // UNO object
-    css::uno::WeakReference< css::lang::XUnoTunnel > xTransferable;
+    css::uno::WeakReference< css::lang::XUnoTunnel >                  xTransferable;
 
     // temporary document for printing text of selection / multi selection
     // in PDF export.
-    SfxObjectShellLock           xTmpSelDocSh;
+    SfxObjectShellLock          xTmpSelDocSh;
 
-    SwView* pView;
-    SwScannerEventListener*     pScanEvtLstnr;
-    SwClipboardChangeListener*  pClipEvtLstnr;
+    SwView*                     pView;
+    rtl::Reference<SwScannerEventListener>
+                                mxScanEvtLstnr;
+    rtl::Reference<SwClipboardChangeListener>
+                                mxClipEvtLstnr;
     ShellModes                  eShellMode;
 
 #if HAVE_FEATURE_DBCONNECTIVITY
-    std::shared_ptr<SwMailMergeConfigItem> xConfigItem;
-    sal_uInt16              nMailMergeRestartPage;
+    std::shared_ptr<SwMailMergeConfigItem>
+                                xConfigItem;
+    sal_uInt16                  nMailMergeRestartPage;
 #endif
 
     sfx2::DocumentInserter*     m_pDocInserter;
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index bdd224f..0c2af38 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -55,8 +55,6 @@ using namespace ::com::sun::star::datatransfer::clipboard;
 SwView_Impl::SwView_Impl(SwView* pShell)
     : mxXTextView()
     , pView(pShell)
-    , pScanEvtLstnr(nullptr)
-    , pClipEvtLstnr(nullptr)
     , eShellMode(SHELL_MODE_TEXT)
 #if HAVE_FEATURE_DBCONNECTIVITY
     , nMailMergeRestartPage(0)
@@ -85,12 +83,12 @@ SwView_Impl::~SwView_Impl()
     view::XSelectionSupplier* pTextView = mxXTextView.get();
     static_cast<SwXTextView*>(pTextView)->Invalidate();
     mxXTextView.clear();
-    if( xScanEvtLstnr.is() )
-           pScanEvtLstnr->ViewDestroyed();
-    if( xClipEvtLstnr.is() )
+    if( mxScanEvtLstnr.is() )
+           mxScanEvtLstnr->ViewDestroyed();
+    if( mxClipEvtLstnr.is() )
     {
-        pClipEvtLstnr->AddRemoveListener( false );
-        pClipEvtLstnr->ViewDestroyed();
+        mxClipEvtLstnr->AddRemoveListener( false );
+        mxClipEvtLstnr->ViewDestroyed();
     }
 #if HAVE_FEATURE_DBCONNECTIVITY
     xConfigItem.reset();
@@ -195,17 +193,17 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq )
 
 SwScannerEventListener& SwView_Impl::GetScannerEventListener()
 {
-    if(!xScanEvtLstnr.is())
-        xScanEvtLstnr = pScanEvtLstnr = new SwScannerEventListener(*pView);
-    return *pScanEvtLstnr;
+    if(!mxScanEvtLstnr.is())
+        mxScanEvtLstnr = new SwScannerEventListener(*pView);
+    return *mxScanEvtLstnr;
 }
 
 void SwView_Impl::AddClipboardListener()
 {
-    if(!xClipEvtLstnr.is())
+    if(!mxClipEvtLstnr.is())
     {
-        xClipEvtLstnr = pClipEvtLstnr = new SwClipboardChangeListener( *pView );
-        pClipEvtLstnr->AddRemoveListener( true );
+        mxClipEvtLstnr = new SwClipboardChangeListener( *pView );
+        mxClipEvtLstnr->AddRemoveListener( true );
     }
 }
 


More information about the Libreoffice-commits mailing list