[Libreoffice-commits] core.git: 6 commits - avmedia/source editeng/source include/editeng linguistic/source sfx2/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Jan 18 09:00:31 UTC 2017


 avmedia/source/viewer/mediawindow_impl.cxx                |   23 +++----
 avmedia/source/viewer/mediawindow_impl.hxx                |    3 
 editeng/source/accessibility/AccessibleStaticTextBase.cxx |   46 ++++++--------
 editeng/source/items/flditem.cxx                          |   22 +++---
 include/editeng/flditem.hxx                               |    4 -
 linguistic/source/convdiclist.cxx                         |   36 ++++------
 linguistic/source/convdiclist.hxx                         |   17 +----
 sfx2/source/appl/appuno.cxx                               |   35 +++-------
 sfx2/source/inc/fltoptint.hxx                             |   13 +--
 9 files changed, 85 insertions(+), 114 deletions(-)

New commits:
commit b7388a7483da5cffdc4eef6c0474b98c9e5f5af0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 18 10:30:08 2017 +0200

    use rtl::Reference in RequestFilterOptions
    
    Change-Id: I5d8aef57734e18d944b8e6dba0f69c5411f71062

diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index a7a98d9..9d6e641 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -1680,12 +1680,8 @@ RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > cons
 
     m_aRequest <<= aOptionsRequest;
 
-    m_pAbort  = new comphelper::OInteractionAbort;
-    m_pOptions = new FilterOptionsContinuation;
-
-    m_lContinuations.realloc( 2 );
-    m_lContinuations[0].set( m_pAbort  );
-    m_lContinuations[1].set( m_pOptions );
+    m_xAbort  = new comphelper::OInteractionAbort;
+    m_xOptions = new FilterOptionsContinuation;
 }
 
 uno::Any SAL_CALL RequestFilterOptions::getRequest()
@@ -1698,7 +1694,7 @@ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
     SAL_CALL RequestFilterOptions::getContinuations()
         throw( uno::RuntimeException, std::exception )
 {
-    return m_lContinuations;
+    return { m_xAbort.get(), m_xOptions.get() };
 }
 
 
diff --git a/sfx2/source/inc/fltoptint.hxx b/sfx2/source/inc/fltoptint.hxx
index 8d296a0..bc2474d 100644
--- a/sfx2/source/inc/fltoptint.hxx
+++ b/sfx2/source/inc/fltoptint.hxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <comphelper/interaction.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
 
 class FilterOptionsContinuation : public comphelper::OInteraction< css::document::XInteractionFilterOptions >
 {
@@ -37,22 +38,18 @@ class RequestFilterOptions : public ::cppu::WeakImplHelper< css::task::XInteract
 {
     css::uno::Any m_aRequest;
 
-    css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >
-                  m_lContinuations;
-
-    comphelper::OInteractionAbort*  m_pAbort;
-
-    FilterOptionsContinuation*  m_pOptions;
+    rtl::Reference<comphelper::OInteractionAbort>  m_xAbort;
+    rtl::Reference<FilterOptionsContinuation>      m_xOptions;
 
 public:
     RequestFilterOptions( css::uno::Reference< css::frame::XModel > const & rModel,
                               const css::uno::Sequence< css::beans::PropertyValue >& rProperties );
 
-    bool    isAbort() { return m_pAbort->wasSelected(); }
+    bool    isAbort() { return m_xAbort->wasSelected(); }
 
     css::uno::Sequence< css::beans::PropertyValue > getFilterOptions()
     {
-        return m_pOptions->getFilterOptions();
+        return m_xOptions->getFilterOptions();
     }
 
     virtual css::uno::Any SAL_CALL getRequest()
commit 0c326db8073c5334f8896f6f7105c6095248673c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 18 10:27:58 2017 +0200

    use rtl::Reference in RequestPackageReparation_Impl
    
    Change-Id: I03f191972b817966d515a8d68c722070a4d0a06a

diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 12739e4..a7a98d9 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -1705,9 +1705,8 @@ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
 class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
 {
     uno::Any m_aRequest;
-    uno::Sequence< uno::Reference< task::XInteractionContinuation > > m_lContinuations;
-    comphelper::OInteractionApprove* m_pApprove;
-    comphelper::OInteractionDisapprove*  m_pDisapprove;
+    rtl::Reference<comphelper::OInteractionApprove> m_xApprove;
+    rtl::Reference<comphelper::OInteractionDisapprove>  m_xDisapprove;
 
 public:
     explicit RequestPackageReparation_Impl( const OUString& aName );
@@ -1723,16 +1722,13 @@ RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString& aN
     uno::Reference< uno::XInterface > temp2;
     document::BrokenPackageRequest aBrokenPackageRequest( temp, temp2, aName );
     m_aRequest <<= aBrokenPackageRequest;
-    m_pApprove = new comphelper::OInteractionApprove;
-    m_pDisapprove = new comphelper::OInteractionDisapprove;
-    m_lContinuations.realloc( 2 );
-    m_lContinuations[0].set( m_pApprove );
-    m_lContinuations[1].set( m_pDisapprove );
+    m_xApprove = new comphelper::OInteractionApprove;
+    m_xDisapprove = new comphelper::OInteractionDisapprove;
 }
 
 bool RequestPackageReparation_Impl::isApproved()
 {
-    return m_pApprove->wasSelected();
+    return m_xApprove->wasSelected();
 }
 
 uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
@@ -1745,7 +1741,7 @@ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
     SAL_CALL RequestPackageReparation_Impl::getContinuations()
         throw( uno::RuntimeException, std::exception )
 {
-    return m_lContinuations;
+    return { m_xApprove.get(), m_xDisapprove.get() };
 }
 
 RequestPackageReparation::RequestPackageReparation( const OUString& aName )
@@ -1771,8 +1767,7 @@ css::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetR
 class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
 {
     uno::Any m_aRequest;
-    uno::Sequence< uno::Reference< task::XInteractionContinuation > > m_lContinuations;
-    comphelper::OInteractionAbort*  m_pAbort;
+    rtl::Reference<comphelper::OInteractionAbort>  m_xAbort;
 
 public:
     explicit NotifyBrokenPackage_Impl(const OUString& rName);
@@ -1787,9 +1782,7 @@ NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString& aName )
     uno::Reference< uno::XInterface > temp2;
     document::BrokenPackageRequest aBrokenPackageRequest( temp, temp2, aName );
     m_aRequest <<= aBrokenPackageRequest;
-    m_pAbort     = new comphelper::OInteractionAbort;
-    m_lContinuations.realloc( 1 );
-    m_lContinuations[0].set( m_pAbort  );
+    m_xAbort = new comphelper::OInteractionAbort;
 }
 
 uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
@@ -1802,7 +1795,7 @@ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
     SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
         throw( uno::RuntimeException, std::exception )
 {
-    return m_lContinuations;
+    return { m_xAbort.get() };
 }
 
 NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
commit eceecde6ccc69004898cf657bc75a140c388614f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 18 09:34:32 2017 +0200

    use rtl::Reference in MediaWindowImpl
    
    instead of storing both a raw pointer and an uno::Reference
    
    Change-Id: Id42d43e14b573d48310b9e353667da80d171110e

diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 5566251..25cd07f 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -129,7 +129,6 @@ MediaWindowImpl::MediaWindowImpl(vcl::Window* pParent, MediaWindow* pMediaWindow
     , DropTargetHelper(this)
     , DragSourceHelper(this)
     , mpMediaWindow(pMediaWindow)
-    , mpEvents(nullptr)
     , mbEventTransparent(true)
     , mpMediaWindowControl(bInternalMediaControl ? VclPtr<MediaWindowControl>::Create(this) : nullptr)
     , mpEmptyBmpEx(nullptr)
@@ -149,14 +148,15 @@ MediaWindowImpl::~MediaWindowImpl()
 
 void MediaWindowImpl::dispose()
 {
-    if (mpEvents)
-        mpEvents->cleanUp();
+    if (mxEvents.is())
+        mxEvents->cleanUp();
 
     if (mxPlayerWindow.is())
     {
-        mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
-        mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
-        mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
+        auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get());
+        mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) );
+        mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( pEventsIf, uno::UNO_QUERY ) );
+        mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( pEventsIf, uno::UNO_QUERY ) );
 
         uno::Reference< lang::XComponent > xComponent( mxPlayerWindow, uno::UNO_QUERY );
         if (xComponent.is())
@@ -455,7 +455,7 @@ void MediaWindowImpl::onURLChanged()
     if (!mpChildWindow)
         return;
     mpChildWindow->SetHelpId(HID_AVMEDIA_PLAYERWINDOW);
-    mxEventsIf.set(static_cast<cppu::OWeakObject*>(mpEvents = new MediaEventListenersImpl(*mpChildWindow.get())));
+    mxEvents = new MediaEventListenersImpl(*mpChildWindow.get());
 
     if (mxPlayer.is())
     {
@@ -482,10 +482,11 @@ void MediaWindowImpl::onURLChanged()
 
         if( xPlayerWindow.is() )
         {
-            xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
-            xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
-            xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
-            xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( mxEventsIf, uno::UNO_QUERY ) );
+            auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get());
+            xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) );
+            xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( pEventsIf, uno::UNO_QUERY ) );
+            xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( pEventsIf, uno::UNO_QUERY ) );
+            xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( pEventsIf, uno::UNO_QUERY ) );
         }
     }
     else
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index 649a998..c179a9e 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -147,8 +147,7 @@ private:
     css::uno::Reference<css::media::XPlayerWindow> mxPlayerWindow;
     MediaWindow* mpMediaWindow;
 
-    css::uno::Reference<css::uno::XInterface> mxEventsIf;
-    MediaEventListenersImpl* mpEvents;
+    rtl::Reference<MediaEventListenersImpl> mxEvents;
     bool mbEventTransparent;
     VclPtr<MediaChildWindow> mpChildWindow;
     VclPtr<MediaWindowControl> mpMediaWindowControl;
commit 1d9ea5f576cab03c920a6be933a923b7bcdabc44
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 18 08:50:39 2017 +0200

    use rtl::Reference in ConvDicList
    
    instead of storing both a raw pointer and an uno::Reference
    
    Change-Id: I7241edcb50736d0650349387ca1c032b88caf192

diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index 4efefdf..e486175 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -348,38 +348,34 @@ void ConvDicList::MyAppExitListener::AtExit()
 ConvDicList::ConvDicList() :
     aEvtListeners( GetLinguMutex() )
 {
-    pNameContainer = nullptr;
     bDisposing = false;
 
-    pExitListener = new MyAppExitListener( *this );
-    xExitListener = pExitListener;
-    pExitListener->Activate();
+    mxExitListener = new MyAppExitListener( *this );
+    mxExitListener->Activate();
 }
 
 ConvDicList::~ConvDicList()
 {
+    if (!bDisposing && mxNameContainer.is())
+        mxNameContainer->FlushDics();
 
-    if (!bDisposing && pNameContainer)
-        pNameContainer->FlushDics();
-
-    pExitListener->Deactivate();
+    mxExitListener->Deactivate();
 }
 
 void ConvDicList::FlushDics()
 {
     // check only pointer to avoid creating the container when
     // the dictionaries were not accessed yet
-    if (pNameContainer)
-        pNameContainer->FlushDics();
+    if (mxNameContainer.is())
+        mxNameContainer->FlushDics();
 }
 
 ConvDicNameContainer & ConvDicList::GetNameContainer()
 {
-    if (!pNameContainer)
+    if (!mxNameContainer.is())
     {
-        pNameContainer = new ConvDicNameContainer;
-        pNameContainer->AddConvDics( GetDictionaryWriteablePath(), CONV_DIC_EXT  );
-        xNameContainer = pNameContainer;
+        mxNameContainer = new ConvDicNameContainer;
+        mxNameContainer->AddConvDics( GetDictionaryWriteablePath(), CONV_DIC_EXT  );
 
         // access list of text conversion dictionaries to activate
         SvtLinguOptions aOpt;
@@ -389,7 +385,7 @@ ConvDicNameContainer & ConvDicList::GetNameContainer()
         for (sal_Int32 i = 0;  i < nLen;  ++i)
         {
             uno::Reference< XConversionDictionary > xDic =
-                    pNameContainer->GetByName( pActiveConvDics[i] );
+                    mxNameContainer->GetByName( pActiveConvDics[i] );
             if (xDic.is())
                 xDic->setActive( true );
         }
@@ -397,24 +393,24 @@ ConvDicNameContainer & ConvDicList::GetNameContainer()
         // since there is no UI to active/deactivate the dictionaries
         // for chinese text conversion they should be activated by default
         uno::Reference< XConversionDictionary > xS2TDic(
-                    pNameContainer->GetByName( "ChineseS2T" ), UNO_QUERY );
+                    mxNameContainer->GetByName( "ChineseS2T" ), UNO_QUERY );
         uno::Reference< XConversionDictionary > xT2SDic(
-                    pNameContainer->GetByName( "ChineseT2S" ), UNO_QUERY );
+                    mxNameContainer->GetByName( "ChineseT2S" ), UNO_QUERY );
             if (xS2TDic.is())
                 xS2TDic->setActive( true );
             if (xT2SDic.is())
                 xT2SDic->setActive( true );
 
     }
-    return *pNameContainer;
+    return *mxNameContainer;
 }
 
 uno::Reference< container::XNameContainer > SAL_CALL ConvDicList::getDictionaryContainer(  ) throw (RuntimeException, std::exception)
 {
     MutexGuard  aGuard( GetLinguMutex() );
     GetNameContainer();
-    DBG_ASSERT( xNameContainer.is(), "missing name container" );
-    return xNameContainer;
+    DBG_ASSERT( mxNameContainer.is(), "missing name container" );
+    return mxNameContainer.get();
 }
 
 uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
diff --git a/linguistic/source/convdiclist.hxx b/linguistic/source/convdiclist.hxx
index 4c2bc3d..98af26e 100644
--- a/linguistic/source/convdiclist.hxx
+++ b/linguistic/source/convdiclist.hxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/interfacecontainer.h>
+#include <rtl/ref.hxx>
 
 #include "linguistic/misc.hxx"
 #include "lngopt.hxx"
@@ -51,18 +52,10 @@ class ConvDicList :
         virtual void    AtExit() override;
     };
 
-
-    ::comphelper::OInterfaceContainerHelper2       aEvtListeners;
-
-    ConvDicNameContainer                   *pNameContainer;
-    css::uno::Reference<
-        css::container::XNameContainer >   xNameContainer;
-
-    MyAppExitListener                      *pExitListener;
-    css::uno::Reference< css::frame::
-                XTerminateListener >        xExitListener;
-
-    bool                                    bDisposing;
+    ::comphelper::OInterfaceContainerHelper2  aEvtListeners;
+    rtl::Reference<ConvDicNameContainer>      mxNameContainer;
+    rtl::Reference<MyAppExitListener>         mxExitListener;
+    bool                                      bDisposing;
 
     ConvDicList( const ConvDicList & ) = delete;
     ConvDicList & operator = (const ConvDicList &) = delete;
commit e5634d4e3bcba6dc5aa46dc8ebfa388f6442abc0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jan 17 15:45:15 2017 +0200

    use rtl::Reference in AccessibleStaticTextBase_Impl
    
    instead of storing both a raw pointer and an uno::Reference
    
    Change-Id: I03da766787c3ac0273db50b7a79fd7a1d1d7bcbd

diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 1e9097e..93a4358 100644
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -161,9 +161,7 @@ namespace accessibility
         uno::Reference< XAccessible > mxThis;
 
         // implements our functionality, we're just an adapter (guarded by solar mutex)
-        mutable AccessibleEditableTextPara* mpTextParagraph;
-
-        uno::Reference< XAccessible > mxParagraph;
+        mutable rtl::Reference<AccessibleEditableTextPara> mxTextParagraph;
 
         // a wrapper for the text forwarders (guarded by solar mutex)
         mutable SvxEditSourceAdapter maEditSource;
@@ -182,8 +180,7 @@ namespace accessibility
 
     AccessibleStaticTextBase_Impl::AccessibleStaticTextBase_Impl() :
         mxThis( nullptr ),
-        mpTextParagraph( new AccessibleEditableTextPara(nullptr) ),
-        mxParagraph( mpTextParagraph ),
+        mxTextParagraph( new AccessibleEditableTextPara(nullptr) ),
         maEditSource(),
         maMutex(),
         maOffset(0,0)
@@ -201,8 +198,8 @@ namespace accessibility
     {
 
         maEditSource.SetEditSource( std::move(pEditSource) );
-        if( mpTextParagraph )
-            mpTextParagraph->SetEditSource( &maEditSource );
+        if( mxTextParagraph.is() )
+            mxTextParagraph->SetEditSource( &maEditSource );
     }
 
     void AccessibleStaticTextBase_Impl::SetOffset( const Point& rPoint )
@@ -214,43 +211,42 @@ namespace accessibility
             maOffset = rPoint;
         }
 
-        if( mpTextParagraph )
-            mpTextParagraph->SetEEOffset( rPoint );
+        if( mxTextParagraph.is() )
+            mxTextParagraph->SetEEOffset( rPoint );
     }
 
     void AccessibleStaticTextBase_Impl::Dispose()
     {
 
         // we're the owner of the paragraph, so destroy it, too
-        if( mpTextParagraph )
-            mpTextParagraph->Dispose();
+        if( mxTextParagraph.is() )
+            mxTextParagraph->Dispose();
 
         // drop references
-        mxParagraph = nullptr;
         mxThis = nullptr;
-        mpTextParagraph = nullptr;
+        mxTextParagraph.clear();
     }
 
     AccessibleEditableTextPara& AccessibleStaticTextBase_Impl::GetParagraph( sal_Int32 nPara ) const
     {
 
-        if( !mpTextParagraph )
+        if( !mxTextParagraph.is() )
             throw lang::DisposedException ("object has been already disposed", mxThis );
 
         // TODO: Have a different method on AccessibleEditableTextPara
         // that does not care about state changes
-        mpTextParagraph->SetParagraphIndex( nPara );
+        mxTextParagraph->SetParagraphIndex( nPara );
 
-        return *mpTextParagraph;
+        return *mxTextParagraph;
     }
 
     sal_Int32 AccessibleStaticTextBase_Impl::GetParagraphCount() const
     {
 
-        if( !mpTextParagraph )
+        if( !mxTextParagraph.is() )
             return 0;
         else
-            return mpTextParagraph->GetTextForwarder().GetParagraphCount();
+            return mxTextParagraph->GetTextForwarder().GetParagraphCount();
     }
 
     sal_Int32 AccessibleStaticTextBase_Impl::Internal2Index( EPosition nEEIndex ) const
@@ -332,12 +328,12 @@ namespace accessibility
                                                           sal_Int32 nEndPara, sal_Int32 nEndIndex )
     {
 
-        if( !mpTextParagraph )
+        if( !mxTextParagraph.is() )
             return false;
 
         try
         {
-            SvxEditViewForwarder& rCacheVF = mpTextParagraph->GetEditViewForwarder( true );
+            SvxEditViewForwarder& rCacheVF = mxTextParagraph->GetEditViewForwarder( true );
             return rCacheVF.SetSelection( MakeSelection(nStartPara, nStartIndex, nEndPara, nEndIndex) );
         }
         catch( const uno::RuntimeException& )
@@ -350,13 +346,13 @@ namespace accessibility
                                                       sal_Int32 nEndPara, sal_Int32 nEndIndex )
     {
 
-        if( !mpTextParagraph )
+        if( !mxTextParagraph.is() )
             return false;
 
         try
         {
-            SvxEditViewForwarder& rCacheVF = mpTextParagraph->GetEditViewForwarder( true );
-            mpTextParagraph->GetTextForwarder();    // MUST be after GetEditViewForwarder(), see method docs
+            SvxEditViewForwarder& rCacheVF = mxTextParagraph->GetEditViewForwarder( true );
+            mxTextParagraph->GetTextForwarder();    // MUST be after GetEditViewForwarder(), see method docs
             bool aRetVal;
 
             // save current selection
@@ -378,9 +374,9 @@ namespace accessibility
     Rectangle AccessibleStaticTextBase_Impl::GetParagraphBoundingBox() const
     {
         Rectangle aRect;
-        if( mpTextParagraph )
+        if( mxTextParagraph.is() )
         {
-            awt::Rectangle aAwtRect = mpTextParagraph->getBounds();
+            awt::Rectangle aAwtRect = mxTextParagraph->getBounds();
             aRect = Rectangle( Point( aAwtRect.X, aAwtRect.Y ), Size( aAwtRect.Width, aAwtRect.Height ) );
         }
         else
commit 08d063eefebeaf9950af579f707d445ac60e5389
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jan 17 15:41:51 2017 +0200

    manage pField with tools::SvRef
    
    since it is a SvRefBase subclass
    
    Change-Id: Ib7d1e22336d673405d7455d40464df29f547d351

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 6ff64b9..1d5ba3f 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -271,21 +271,21 @@ MetaAction* SvxFieldData::createEndComment()
 
 SvxFieldItem::SvxFieldItem( SvxFieldData* pFld, const sal_uInt16 nId ) :
     SfxPoolItem( nId )
-    , pField( pFld )  // belongs directly to the item
+    , mxField( pFld )  // belongs directly to the item
 {
 }
 
 
 SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ) :
     SfxPoolItem( nId )
-    , pField( rField.Clone() )
+    , mxField( rField.Clone() )
 {
 }
 
 
 SvxFieldItem::SvxFieldItem( const SvxFieldItem& rItem ) :
     SfxPoolItem ( rItem )
-    , pField( rItem.GetField() ? rItem.GetField()->Clone() : nullptr )
+    , mxField( rItem.GetField() ? rItem.GetField()->Clone() : nullptr )
 {
 }
 
@@ -319,19 +319,19 @@ SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, sal_uInt16 ) const
 
 SvStream& SvxFieldItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
 {
-    DBG_ASSERT( pField, "SvxFieldItem::Store: Field?!" );
+    DBG_ASSERT( mxField.get(), "SvxFieldItem::Store: Field?!" );
     SvPersistStream aPStrm( GetClassManager(), &rStrm );
     // The reset error in the above Create method did not exist in 3.1,
     // therefore newer items can not be saved for 3.x-exports!
-    if ( ( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_31 ) && pField &&
-            pField->GetClassId() == 50 /* SdrMeasureField */ )
+    if ( ( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_31 ) && mxField.get() &&
+            mxField->GetClassId() == 50 /* SdrMeasureField */ )
     {
         // SvxFieldData not enough, because not registered on ClassMgr.
         SvxURLField aDummyData;
         WriteSvPersistBase( aPStrm , &aDummyData );
     }
     else
-        WriteSvPersistBase( aPStrm, pField.get() );
+        WriteSvPersistBase( aPStrm, mxField.get() );
 
     return rStrm;
 }
@@ -342,12 +342,12 @@ bool SvxFieldItem::operator==( const SfxPoolItem& rItem ) const
     assert(SfxPoolItem::operator==(rItem));
 
     const SvxFieldData* pOtherFld = static_cast<const SvxFieldItem&>(rItem).GetField();
-    if( pField.get() == pOtherFld )
+    if( mxField.get() == pOtherFld )
         return true;
-    if( pField == nullptr || pOtherFld == nullptr )
+    if( mxField == nullptr || pOtherFld == nullptr )
         return false;
-    return ( typeid(*pField) == typeid(*pOtherFld) )
-            && ( *pField == *pOtherFld );
+    return ( typeid(*mxField) == typeid(*pOtherFld) )
+            && ( *mxField == *pOtherFld );
 }
 
 
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
index 50ac2fd..8e67332 100644
--- a/include/editeng/flditem.hxx
+++ b/include/editeng/flditem.hxx
@@ -67,7 +67,7 @@ public:
 class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem
 {
 private:
-    std::unique_ptr<SvxFieldData>      pField;
+    tools::SvRef<SvxFieldData>      mxField;
 
     EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const sal_uInt16 nId );
 
@@ -83,7 +83,7 @@ public:
     virtual SfxPoolItem*    Create( SvStream&, sal_uInt16 nVer ) const override;
     virtual SvStream&       Store( SvStream& , sal_uInt16 nItemVersion ) const override;
 
-    const SvxFieldData*     GetField() const    { return pField.get(); }
+    const SvxFieldData*     GetField() const    { return mxField.get(); }
     static SvClassManager&  GetClassManager();
 };
 


More information about the Libreoffice-commits mailing list