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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Tue Jun 9 03:55:24 PDT 2015


 sw/inc/unobaseclass.hxx                  |   37 -
 sw/inc/unochart.hxx                      |    6 
 sw/inc/unocrsr.hxx                       |   69 +++
 sw/inc/unoparagraph.hxx                  |   46 --
 sw/inc/unotbl.hxx                        |   24 -
 sw/inc/unotextcursor.hxx                 |    4 
 sw/inc/unotextrange.hxx                  |   49 --
 sw/inc/unotxdoc.hxx                      |    4 
 sw/qa/extras/uiwriter/uiwriter.cxx       |   22 -
 sw/source/core/inc/sortedobjs.hxx        |    5 
 sw/source/core/inc/unoparaframeenum.hxx  |   76 +--
 sw/source/core/inc/unoport.hxx           |   17 
 sw/source/core/unocore/unochart.cxx      |   46 --
 sw/source/core/unocore/unocrsrhelper.cxx |    2 
 sw/source/core/unocore/unoframe.cxx      |    2 
 sw/source/core/unocore/unoftn.cxx        |    2 
 sw/source/core/unocore/unoobj.cxx        |  100 +---
 sw/source/core/unocore/unoobj2.cxx       |  677 +++++++++++--------------------
 sw/source/core/unocore/unoparagraph.cxx  |    2 
 sw/source/core/unocore/unoport.cxx       |   24 -
 sw/source/core/unocore/unoportenum.cxx   |   36 -
 sw/source/core/unocore/unoredline.cxx    |    4 
 sw/source/core/unocore/unotbl.cxx        |   51 --
 sw/source/core/unocore/unotext.cxx       |    5 
 sw/source/uibase/inc/navmgr.hxx          |   13 
 sw/source/uibase/uno/unotxdoc.cxx        |   12 
 sw/source/uibase/uno/unotxvw.cxx         |    2 
 sw/source/uibase/wrtsh/navmgr.cxx        |   16 
 28 files changed, 472 insertions(+), 881 deletions(-)

New commits:
commit 57189ddd887c0fd21f1b3140c48ac168bdd82af1
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Jun 7 00:10:51 2015 +0200

    alias sw::UnoImplPtr to ::std::unique_ptr ...
    
    - ... with a custom deleter
    - and kill homegrown implementation
    
    Change-Id: I9babf556dc75772f388d23fd05b916abb4bed497

diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx
index a4f8abd..bfbc9be 100644
--- a/sw/inc/unobaseclass.hxx
+++ b/sw/inc/unobaseclass.hxx
@@ -84,39 +84,22 @@ class UnoActionRemoveContext
 /// helper function for implementing SwClient::Modify
 void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew);
 
-#include <boost/utility.hpp>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 
 namespace sw {
-
-    /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
-    template<typename T> class UnoImplPtr
-        : private ::boost::noncopyable
+    template<typename T>
+    struct UnoImplPtrDeleter
     {
-        private:
-            T * m_p;
-
-        public:
-            UnoImplPtr(T *const i_p)
-                : m_p(i_p)
-            {
-                SAL_WARN_IF(!i_p, "sw", "UnoImplPtr: null");
-            }
-
-            ~UnoImplPtr()
-            {
-                SolarMutexGuard g;
-                delete m_p; // #i105557#: call dtor with locked solar mutex
-                m_p = 0;
-            }
-
-            T & operator * () const { return *m_p; }
-
-            T * operator ->() const { return  m_p; }
-
-            T * get        () const { return  m_p; }
+        void operator()(T* pUnoImpl)
+        {
+            SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex
+            delete pUnoImpl;
+        }
     };
+    /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
+    template<typename T>
+    using UnoImplPtr = ::std::unique_ptr<T, UnoImplPtrDeleter<T> >;
 
     template< class C > C *
     UnoTunnelGetImplementation(
commit a755edf0fba671d53659a4c5f03f549506edd65c
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jun 6 03:38:49 2015 +0200

    use new UnoCursorPointer in SwXTextPortionEnumeration
    
    Change-Id: If6b64c92d4f6f786767802cc046ccd96bd8367cb

diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index f6ee60e..cc32385 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -249,13 +249,12 @@ class SwXTextPortionEnumeration
         , ::com::sun::star::lang::XServiceInfo
         , ::com::sun::star::lang::XUnoTunnel
         >
-   , public SwClient
 {
     TextRangeList_t m_Portions; // contains all portions, filled by ctor
-    std::shared_ptr<SwUnoCrsr>  m_pUnoCrsr;
+    sw::UnoCursorPointer m_pUnoCrsr;
 
-    SwUnoCrsr*          GetCursor() const
-    {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
+    SwUnoCrsr* GetCursor() const
+        {return const_cast<SwUnoCrsr*>(&(*m_pUnoCrsr));}
 
 protected:
     virtual ~SwXTextPortionEnumeration();
@@ -292,10 +291,6 @@ public:
     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
         getSupportedServiceNames()
         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-protected:
-    //SwClient
-    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
-    virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE;
 };
 
 class SwXRedlinePortion : public SwXTextPortion
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index d3cf0bb..d95fd8b 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -364,7 +364,6 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
     : m_Portions()
 {
     m_pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), false);
-    m_pUnoCrsr->Add(this);
 
     OSL_ENSURE(nEnd == -1 || (nStart <= nEnd &&
         nEnd <= m_pUnoCrsr->Start()->nNode.GetNode().GetTextNode()->GetText().getLength()),
@@ -373,7 +372,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
     // find all frames, graphics and OLEs that are bound AT character in para
     FrameClientSortList_t frames;
     ::CollectFrameAtNode(m_pUnoCrsr->GetPoint()->nNode, frames, true);
-    lcl_CreatePortions(m_Portions, xParentText, m_pUnoCrsr.get(), frames, nStart, nEnd);
+    lcl_CreatePortions(m_Portions, xParentText, GetCursor(), frames, nStart, nEnd);
 }
 
 SwXTextPortionEnumeration::SwXTextPortionEnumeration(
@@ -382,14 +381,10 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
     : m_Portions( rPortions )
 {
     m_pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), false);
-    m_pUnoCrsr->Add(this);
 }
 
 SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
-{
-    if(m_pUnoCrsr)
-        m_pUnoCrsr->Remove(this);
-}
+{ }
 
 sal_Bool SwXTextPortionEnumeration::hasMoreElements()
 throw( uno::RuntimeException, std::exception )
@@ -1401,19 +1396,4 @@ static void lcl_CreatePortions(
             "CreatePortions: stack error" );
 }
 
-void SwXTextPortionEnumeration::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
-{
-    ClientModify(this, pOld, pNew);
-}
-
-void SwXTextPortionEnumeration::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    SwClient::SwClientNotify(rModify, rHint);
-    if(!GetRegisteredIn() || typeid(rHint) == typeid(sw::DocDisposingHint))
-    {
-        m_pUnoCrsr->Remove(this);
-        m_pUnoCrsr.reset();
-    }
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c9a343935f6c480dcaf0145c2f27db08b4ae01a5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jun 6 03:26:12 2015 +0200

    use UnoCursorPointer in SwXTextPortion
    
    Change-Id: I8628fd1fecb3e2cf54704f9844ff921862da46e5

diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index 4e66097..f6ee60e 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -114,7 +114,7 @@ private:
     ::std::unique_ptr< ::com::sun::star::uno::Any > m_pRubyStyle;
     ::std::unique_ptr< ::com::sun::star::uno::Any > m_pRubyAdjust;
     ::std::unique_ptr< ::com::sun::star::uno::Any > m_pRubyIsAbove;
-    std::shared_ptr<SwUnoCrsr> m_pUnoCursor;
+    sw::UnoCursorPointer m_pUnoCursor;
 
     const SwDepend              m_FrameDepend;
     SwFrameFormat *                  m_pFrameFormat;
@@ -151,8 +151,6 @@ protected:
 
     //SwClient
     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
-    virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) SAL_OVERRIDE;
-
 
 public:
     SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwTextPortionType   eType   );
@@ -242,7 +240,7 @@ public:
     SwTextPortionType GetTextPortionType() const { return m_ePortionType; }
 
     SwUnoCrsr* GetCursor() const
-    {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
+        { return const_cast<SwUnoCrsr*>(&(*m_pUnoCursor)); }
 };
 
 class SwXTextPortionEnumeration
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 996f4ea..22980fe 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -69,7 +69,6 @@ void SwXTextPortion::init(const SwUnoCrsr* pPortionCursor)
         m_pUnoCursor->SetMark();
         *m_pUnoCursor->GetMark() = *pPortionCursor->GetMark();
     }
-    m_pUnoCursor->Add(this);
 }
 
 SwXTextPortion::SwXTextPortion(
@@ -138,10 +137,7 @@ SwXTextPortion::SwXTextPortion(
 }
 
 SwXTextPortion::~SwXTextPortion()
-{
-    if(m_pUnoCursor)
-        m_pUnoCursor->Remove(this);
-};
+{ }
 
 uno::Reference< text::XText >  SwXTextPortion::getText()
 throw( uno::RuntimeException, std::exception )
@@ -922,17 +918,7 @@ void SwXTextPortion::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
     ClientModify(this, pOld, pNew);
     if (!m_FrameDepend.GetRegisteredIn())
     {
-        m_pFrameFormat = 0;
-    }
-}
-
-void SwXTextPortion::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    SwClient::SwClientNotify(rModify, rHint);
-    if(m_pUnoCursor && typeid(rHint) == typeid(sw::DocDisposingHint))
-    {
-        m_pUnoCursor->Remove(this);
-        m_pUnoCursor.reset();
+        m_pFrameFormat = nullptr;
     }
 }
 
commit 50924ebfd40469204323134a3b20cb20591f4890
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jun 6 03:07:35 2015 +0200

    use UnoCursorPointer in SwXTextTableCursor
    
    Change-Id: Ia58e286760e52191edbe968504e3db0967ce09d3

diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index d4909fd..f216f32 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -210,7 +210,6 @@ class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base
     ,public SwClient
     ,public OTextCursorHelper
 {
-    SwDepend                aCrsrDepend;
     const SfxItemPropertySet*   m_pPropSet;
 
 public:
@@ -263,7 +262,6 @@ public:
 
     //SwClient
     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
-    virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE;
 
     // ITextCursorHelper
     virtual const SwPaM*        GetPaM() const SAL_OVERRIDE;
@@ -273,14 +271,9 @@ public:
 
     const SwUnoCrsr*            GetCrsr() const;
     SwUnoCrsr*                  GetCrsr();
-    std::shared_ptr<SwUnoCrsr> m_pUnoCrsr;
+    sw::UnoCursorPointer m_pUnoCrsr;
     SwFrameFormat*       GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
-    virtual ~SwXTextTableCursor()
-    {
-        if(m_pUnoCrsr)
-            m_pUnoCrsr->Remove(&aCrsrDepend);
-    }
-
+    virtual ~SwXTextTableCursor() { };
 };
 
 struct SwRangeDescriptor
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index c2371d8..3f2c1dd 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1403,15 +1403,14 @@ const SwPaM*        SwXTextTableCursor::GetPaM() const  { return GetCrsr(); }
 SwPaM*              SwXTextTableCursor::GetPaM()        { return GetCrsr(); }
 const SwDoc*        SwXTextTableCursor::GetDoc() const  { return GetFrameFormat()->GetDoc(); }
 SwDoc*              SwXTextTableCursor::GetDoc()        { return GetFrameFormat()->GetDoc(); }
-const SwUnoCrsr*    SwXTextTableCursor::GetCrsr() const { return static_cast<const SwUnoCrsr*>(aCrsrDepend.GetRegisteredIn()); }
-SwUnoCrsr*          SwXTextTableCursor::GetCrsr()       { return static_cast<SwUnoCrsr*>(aCrsrDepend.GetRegisteredIn()); }
+const SwUnoCrsr*    SwXTextTableCursor::GetCrsr() const { return &(*m_pUnoCrsr); }
+SwUnoCrsr*          SwXTextTableCursor::GetCrsr()       { return &(*m_pUnoCrsr); }
 
 uno::Sequence<OUString> SwXTextTableCursor::getSupportedServiceNames() throw( uno::RuntimeException, std::exception )
     { return {"com.sun.star.text.TextTableCursor"}; }
 
 SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox* pBox) :
     SwClient(pFormat),
-    aCrsrDepend(this, 0),
     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
 {
     SwDoc* pDoc = pFormat->GetDoc();
@@ -1419,14 +1418,12 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox* pBox)
     SwPosition aPos(*pSttNd);
     m_pUnoCrsr = pDoc->CreateUnoCrsr(aPos, true);
     m_pUnoCrsr->Move( fnMoveForward, fnGoNode );
-    m_pUnoCrsr->Add(&aCrsrDepend);
-    SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*m_pUnoCrsr.get());
+    SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*m_pUnoCrsr);
     rTableCrsr.MakeBoxSels();
 }
 
 SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection) :
     SwClient(&rTableFormat),
-    aCrsrDepend(this, 0),
     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
 {
     m_pUnoCrsr = pTableSelection->GetDoc()->CreateUnoCrsr(*pTableSelection->GetPoint(), true);
@@ -1439,7 +1436,6 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTabl
     SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*m_pUnoCrsr);
     for(auto pBox : rBoxes)
         rTableCrsr.InsertBox(*pBox);
-    m_pUnoCrsr->Add(&aCrsrDepend);
     rTableCrsr.MakeBoxSels();
 }
 
@@ -1739,16 +1735,6 @@ void SwXTextTableCursor::removeVetoableChangeListener(const OUString& /*rPropert
 void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
     { ClientModify(this, pOld, pNew); }
 
-void SwXTextTableCursor::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    SwClient::SwClientNotify(rModify, rHint);
-    if(m_pUnoCrsr && typeid(rHint) == typeid(sw::DocDisposingHint))
-    {
-        m_pUnoCrsr->Remove(&aCrsrDepend);
-        m_pUnoCrsr.reset();
-    }
-}
-
 class SwXTextTable::Impl
 {
 private:
commit 43c1b8d3fe96cc78270d2e000a118d8065e4e568
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jun 6 02:46:13 2015 +0200

    add comment on possibly memory leak
    
    Change-Id: I7e1fc471ca5930ceaff4b1c6c6ba351ff0594639

diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 9448a70..a4b0de5 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1920,6 +1920,7 @@ SwChartDataSequence::SwChartDataSequence(
     }
     catch (uno::RuntimeException &)
     {
+        // TODO: shouldnt there be a call to release() here?
         throw;
     }
     catch (uno::Exception &)
@@ -1967,6 +1968,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
     }
     catch (uno::RuntimeException &)
     {
+        // TODO: shouldnt there be a call to release() here?
         throw;
     }
     catch (uno::Exception &)
commit 34040b3eef0c9c7b69cdfd7e3ba3fe34f4c5da38
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jun 6 02:38:02 2015 +0200

    use UnoCursorPointer in SwXCellRange and SwChartDataSequence
    
    Change-Id: I23d75d094c2b2dd8d234b608556a8b2339b7f166

diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx
index 43f46c9..4bfd2e0 100644
--- a/sw/inc/unochart.hxx
+++ b/sw/inc/unochart.hxx
@@ -50,12 +50,12 @@
 
 #include <calbck.hxx>
 #include <frmfmt.hxx>
+#include <unocrsr.hxx>
 
 class SfxItemPropertySet;
 class SwDoc;
 class SwTable;
 class SwTableBox;
-class SwUnoCrsr;
 struct SwRangeDescriptor;
 class SwSelBoxes;
 class SwFrameFormat;
@@ -265,8 +265,7 @@ class SwChartDataSequence :
     ::com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >    xDataProvider;
     SwChartDataProvider *                   pDataProvider;
 
-    std::shared_ptr<SwUnoCrsr>                  pTableCrsr;   // cursor spanned over cells to use
-    SwDepend                    aCursorDepend; //the cursor is removed after the doc has been removed
+    sw::UnoCursorPointer pTableCrsr;   // cursor spanned over cells to use
 
     const SfxItemPropertySet*   _pPropSet;
 
@@ -278,7 +277,6 @@ class SwChartDataSequence :
 protected:
     //SwClient
     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
-    virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE;
 
 public:
     SwChartDataSequence( SwChartDataProvider &rProvider,
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index e53f157..d4909fd 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -44,7 +44,6 @@
 #include <tuple>
 #include <unocrsr.hxx>
 
-class SwUnoCrsr;
 class SwTable;
 class SwTableBox;
 class SwTableLine;
@@ -456,14 +455,13 @@ class SwXCellRange : public cppu::WeakImplHelper
 >,
     public SwClient
 {
-    SwDepend                        aCursorDepend; //the cursor is removed after the doc has been removed
     ::osl::Mutex m_Mutex;
     ::cppu::OInterfaceContainerHelper m_ChartListeners;
 
     SwRangeDescriptor           aRgDesc;
     const SfxItemPropertySet*   m_pPropSet;
 
-    std::shared_ptr<SwUnoCrsr> m_pTableCrsr;
+    sw::UnoCursorPointer m_pTableCrsr;
 
     bool m_bFirstRowAsLabel;
     bool m_bFirstColumnAsLabel;
@@ -472,14 +470,10 @@ class SwXCellRange : public cppu::WeakImplHelper
     void setLabelDescriptions(const css::uno::Sequence<OUString>& rDesc, bool bRow);
 
 public:
-    SwXCellRange(std::shared_ptr<SwUnoCrsr> pCrsr, SwFrameFormat& rFrameFormat, SwRangeDescriptor& rDesc);
+    SwXCellRange(sw::UnoCursorPointer pCrsr, SwFrameFormat& rFrameFormat, SwRangeDescriptor& rDesc);
     void SetLabels(bool bFirstRowAsLabel, bool bFirstColumnAsLabel)
         { m_bFirstRowAsLabel = bFirstRowAsLabel, m_bFirstColumnAsLabel = bFirstColumnAsLabel; }
-    virtual ~SwXCellRange()
-    {
-        if(m_pTableCrsr)
-            m_pTableCrsr->Remove(&aCursorDepend);
-    }
+    virtual ~SwXCellRange() {};
     std::vector< css::uno::Reference< css::table::XCell > > getCells();
 
     TYPEINFO_OVERRIDE();
@@ -547,7 +541,6 @@ public:
 
     //SwClient
     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
-    virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE;
 
     SwFrameFormat*   GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
     sal_uInt16      getRowCount();
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index bf96c15..9448a70 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1900,7 +1900,6 @@ SwChartDataSequence::SwChartDataSequence(
     xDataProvider( &rProvider ),
     pDataProvider( &rProvider ),
     pTableCrsr( pTableCursor ),
-    aCursorDepend( this, pTableCursor.get() ),
     _pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_CHART2_DATA_SEQUENCE ) )
 {
     bDisposed = false;
@@ -1931,7 +1930,7 @@ SwChartDataSequence::SwChartDataSequence(
 #if OSL_DEBUG_LEVEL > 0
     // check if it can properly convert into a SwUnoTableCrsr
     // which is required for some functions
-    SwUnoTableCrsr* pUnoTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTableCrsr.get());
+    SwUnoTableCrsr* pUnoTableCrsr = dynamic_cast<SwUnoTableCrsr*>(&(*pTableCrsr));
     OSL_ENSURE(pUnoTableCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
     (void) pUnoTableCrsr;
 #endif
@@ -1947,8 +1946,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
     aColLabelText( SW_RES(STR_CHART2_COL_LABEL_TEXT) ),
     xDataProvider( rObj.pDataProvider ),
     pDataProvider( rObj.pDataProvider ),
-    pTableCrsr( dynamic_cast<SwUnoTableCrsr&>(*rObj.pTableCrsr.get()).Clone() ),
-    aCursorDepend( this, pTableCrsr.get() ),
+    pTableCrsr( rObj.pTableCrsr ),
     _pPropSet( rObj._pPropSet )
 {
     bDisposed = false;
@@ -1979,7 +1977,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
 #if OSL_DEBUG_LEVEL > 0
     // check if it can properly convert into a SwUnoTableCrsr
     // which is required for some functions
-    SwUnoTableCrsr* pUnoTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTableCrsr.get());
+    SwUnoTableCrsr* pUnoTableCrsr = dynamic_cast<SwUnoTableCrsr*>(&(*pTableCrsr));
     OSL_ENSURE(pUnoTableCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
     (void) pUnoTableCrsr;
 #endif
@@ -2028,11 +2026,7 @@ uno::Sequence< uno::Any > SAL_CALL SwChartDataSequence::getData()
             SwRangeDescriptor aDesc;
             if (FillRangeDescriptor( aDesc, GetCellRangeName( *pTableFormat, *pTableCrsr ) ))
             {
-                //!! make copy of pTableCrsr (SwUnoCrsr )
-                // keep original cursor and make copy of it that gets handed
-                // over to the SwXCellRange object which takes ownership and
-                // thus will destroy the copy later.
-                SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr&>(*pTableCrsr.get()).Clone(), *pTableFormat, aDesc );
+                SwXCellRange aRange(pTableCrsr, *pTableFormat, aDesc );
                 aRange.GetDataSequence( &aRes, 0, 0 );
             }
         }
@@ -2188,11 +2182,7 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getTextualData()
             SwRangeDescriptor aDesc;
             if (FillRangeDescriptor( aDesc, GetCellRangeName( *pTableFormat, *pTableCrsr ) ))
             {
-                //!! make copy of pTableCrsr (SwUnoCrsr )
-                // keep original cursor and make copy of it that gets handed
-                // over to the SwXCellRange object which takes ownership and
-                // thus will destroy the copy later.
-                SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr&>(*pTableCrsr.get()).Clone(), *pTableFormat, aDesc );
+                SwXCellRange aRange(pTableCrsr, *pTableFormat, aDesc );
                 aRange.GetDataSequence( 0, &aRes, 0 );
             }
         }
@@ -2217,11 +2207,7 @@ uno::Sequence< double > SAL_CALL SwChartDataSequence::getNumericalData()
             SwRangeDescriptor aDesc;
             if (FillRangeDescriptor( aDesc, GetCellRangeName( *pTableFormat, *pTableCrsr ) ))
             {
-                //!! make copy of pTableCrsr (SwUnoCrsr )
-                // keep original cursor and make copy of it that gets handed
-                // over to the SwXCellRange object which takes ownership and
-                // thus will destroy the copy later.
-                SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr&>(*pTableCrsr.get()).Clone(), *pTableFormat, aDesc );
+                SwXCellRange aRange(pTableCrsr, *pTableFormat, aDesc );
 
                 // get numerical values and make an effort to return the
                 // numerical value for text formatted cells
@@ -2345,9 +2331,9 @@ void SwChartDataSequence::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN
     ClientModify(this, pOld, pNew );
 
     // table was deleted or cursor was deleted
-    if(!GetRegisteredIn() || !aCursorDepend.GetRegisteredIn())
+    if(!GetRegisteredIn() || !pTableCrsr)
     {
-        pTableCrsr.reset();
+        pTableCrsr.reset(nullptr);
         dispose();
     }
     else
@@ -2356,16 +2342,6 @@ void SwChartDataSequence::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN
     }
 }
 
-void SwChartDataSequence::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    SwClient::SwClientNotify(rModify, rHint);
-    if(typeid(rHint) == typeid(sw::DocDisposingHint))
-    {
-        pTableCrsr.reset();
-        dispose();
-    }
-}
-
 sal_Bool SAL_CALL SwChartDataSequence::isModified(  )
     throw (uno::RuntimeException, std::exception)
 {
@@ -2463,7 +2439,7 @@ void SAL_CALL SwChartDataSequence::dispose(  )
             if (pLclRegisteredIn && pLclRegisteredIn->HasWriterListeners())
             {
                 pLclRegisteredIn->Remove(this);
-                pTableCrsr = nullptr;
+                pTableCrsr.reset(nullptr);
             }
         }
 
@@ -2629,7 +2605,7 @@ void SwChartDataSequence::FillRangeDesc( SwRangeDescriptor &rRangeDesc ) const
 bool SwChartDataSequence::ExtendTo( bool bExtendCol,
         sal_Int32 nFirstNew, sal_Int32 nCount )
 {
-    SwUnoTableCrsr* pUnoTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTableCrsr.get());
+    SwUnoTableCrsr* pUnoTableCrsr = dynamic_cast<SwUnoTableCrsr*>(&(*pTableCrsr));
     if (!pUnoTableCrsr)
         return false;
 
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 0a1cd04..c2371d8 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3138,10 +3138,9 @@ uno::Sequence<OUString> SwXCellRange::getSupportedServiceNames() throw( uno::Run
         "com.sun.star.style.ParagraphPropertiesComplex" };
 }
 
-SwXCellRange::SwXCellRange(std::shared_ptr<SwUnoCrsr> pCrsr, SwFrameFormat& rFrameFormat,
+SwXCellRange::SwXCellRange(sw::UnoCursorPointer pCrsr, SwFrameFormat& rFrameFormat,
     SwRangeDescriptor& rDesc)
     : SwClient(&rFrameFormat)
-    , aCursorDepend(this, nullptr)
     , m_ChartListeners(m_Mutex)
     , aRgDesc(rDesc)
     , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_RANGE))
@@ -3149,7 +3148,6 @@ SwXCellRange::SwXCellRange(std::shared_ptr<SwUnoCrsr> pCrsr, SwFrameFormat& rFra
     , m_bFirstRowAsLabel(false)
     , m_bFirstColumnAsLabel(false)
 {
-    m_pTableCrsr->Add(&aCursorDepend);
     aRgDesc.Normalize();
 }
 
@@ -3450,7 +3448,7 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName)
                         RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
                         0L);
                     // first look at the attributes of the cursor
-                    SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(m_pTableCrsr.get());
+                    SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(&(*m_pTableCrsr));
                     SwUnoCursorHelper::GetCrsrAttr(pCrsr->GetSelRing(), aSet);
                     m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
                 }
@@ -3865,21 +3863,15 @@ sal_uInt16 SwXCellRange::getRowCount()
 const SwUnoCrsr* SwXCellRange::GetTableCrsr() const
 {
     SwFrameFormat* pFormat = GetFrameFormat();
-    return pFormat ? m_pTableCrsr.get() : nullptr;
+    return pFormat ? &(*m_pTableCrsr) : nullptr;
 }
 
 void SwXCellRange::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
 {
     ClientModify(this, pOld, pNew );
-    if(!GetRegisteredIn() || !aCursorDepend.GetRegisteredIn())
+    if(!GetRegisteredIn() || !m_pTableCrsr)
     {
-        /*
-         * Not sure if this will cause a memory leak - this pTableCrsr
-         * is deleted in SwDoc and segfaults here when deleted again
-         * if(!aCursorDepend.GetRegisteredIn())
-            delete pTableCrsr;
-         */
-        m_pTableCrsr.reset();
+        m_pTableCrsr.reset(nullptr);
         lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
         m_ChartListeners.disposeAndClear(ev);
     }
@@ -3889,17 +3881,6 @@ void SwXCellRange::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
     }
 }
 
-void SwXCellRange::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    //assert(m_pTblCrsr->m_bSaneOwnership);
-    SwClient::SwClientNotify(rModify, rHint);
-    if(m_pTableCrsr && typeid(rHint) == typeid(sw::DocDisposingHint))
-    {
-        m_pTableCrsr->Remove(&aCursorDepend);
-        m_pTableCrsr.reset();
-    }
-}
-
 //  SwXTableRows
 
 OUString SwXTableRows::getImplementationName() throw( uno::RuntimeException, std::exception )
commit 30f3315d52df22716c086836c41465a6c4cb98b5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Thu Jun 4 22:58:25 2015 +0200

    use UnoCursorPointer in SwXTextCursor
    
    Change-Id: I46d464405d5de6460b10a2965e0c1f011c8142b2

diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx
index 3236073..6f382ef 100644
--- a/sw/inc/unocrsr.hxx
+++ b/sw/inc/unocrsr.hxx
@@ -108,16 +108,17 @@ namespace sw
     {
         public:
             UnoCursorPointer()
-                : m_pCursor(nullptr)
+                : m_pCursor(nullptr), m_bSectionRestricted(false)
             {}
-            UnoCursorPointer(std::shared_ptr<SwUnoCrsr> pCursor)
-                : m_pCursor(pCursor)
+            UnoCursorPointer(std::shared_ptr<SwUnoCrsr> pCursor, bool bSectionRestricted=false)
+                : m_pCursor(pCursor), m_bSectionRestricted(bSectionRestricted)
             {
                 m_pCursor->Add(this);
             }
-            UnoCursorPointer(const UnoCursorPointer& pOther)
+            UnoCursorPointer(const UnoCursorPointer& rOther)
                 : SwClient(nullptr)
-                , m_pCursor(pOther.m_pCursor)
+                , m_pCursor(rOther.m_pCursor)
+                , m_bSectionRestricted(rOther.m_bSectionRestricted)
             {
                 if(m_pCursor)
                     m_pCursor->Add(this);
@@ -130,8 +131,17 @@ namespace sw
             virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) SAL_OVERRIDE
             {
                 SwClient::SwClientNotify(rModify, rHint);
-                if(m_pCursor && typeid(rHint) == typeid(sw::DocDisposingHint))
-                    m_pCursor->Remove(this);
+                if(m_pCursor)
+                {
+                    if(typeid(rHint) == typeid(DocDisposingHint))
+                        m_pCursor->Remove(this);
+                    else if(m_bSectionRestricted && typeid(rHint) == typeid(LegacyModifyHint))
+                    {
+                        const auto pLegacyHint = static_cast<const LegacyModifyHint*>(&rHint);
+                        if(pLegacyHint->m_pOld && pLegacyHint->m_pOld->Which() == RES_UNOCURSOR_LEAVES_SECTION)
+                            m_pCursor->Remove(this);
+                    }
+                }
                 if(!GetRegisteredIn())
                     m_pCursor.reset();
             };
@@ -158,6 +168,7 @@ namespace sw
             }
         private:
             std::shared_ptr<SwUnoCrsr> m_pCursor;
+            const bool m_bSectionRestricted;
     };
 }
 #endif
diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx
index c86b072..b54bca4 100644
--- a/sw/inc/unotextcursor.hxx
+++ b/sw/inc/unotextcursor.hxx
@@ -91,9 +91,7 @@ public:
             SwPaM const& rSourceCursor,
             const enum CursorType eType = CURSOR_ALL);
 
-    std::shared_ptr<SwUnoCrsr> GetCursor();
-    //const SwUnoCrsr* GetConstCursor() const;
-
+    SwUnoCrsr* GetCursor();
     bool IsAtEndOfMeta() const;
 
     void DeleteAndInsert(OUString const& rText,
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index c3a2f67..0f7a446 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -432,8 +432,8 @@ public:
 
     void                        InitNewDoc();
 
-    std::shared_ptr<SwUnoCrsr>  CreateCursorForSearch(css::uno::Reference< css::text::XTextCursor > & xCrsr);
-    std::shared_ptr<SwUnoCrsr>  FindAny(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc,
+    SwUnoCrsr* CreateCursorForSearch(css::uno::Reference< css::text::XTextCursor > & xCrsr);
+    SwUnoCrsr* FindAny(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc,
                                             css::uno::Reference< css::text::XTextCursor > & xCrsr, bool bAll,
                                             sal_Int32& nResult,
                                             css::uno::Reference< css::uno::XInterface >  xLastResult);
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index af25437..ab03d80 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -654,14 +654,13 @@ SwUnoCursorHelper::GetCurTextFormatColl(SwPaM & rPaM, const bool bConditional)
 }
 
 class SwXTextCursor::Impl
-    : public SwClient
 {
 
 public:
     const SfxItemPropertySet &  m_rPropSet;
     const enum CursorType       m_eType;
     const uno::Reference< text::XText > m_xParentText;
-    std::shared_ptr<SwUnoCrsr> m_pUnoCursor;
+    sw::UnoCursorPointer m_pUnoCursor;
 
     Impl(   SwDoc & rDoc,
             const enum CursorType eType,
@@ -670,84 +669,36 @@ public:
         : m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
         , m_eType(eType)
         , m_xParentText(xParent)
-        , m_pUnoCursor(rDoc.CreateUnoCrsr(rPoint, false))
+        , m_pUnoCursor(rDoc.CreateUnoCrsr(rPoint, false), true)
     {
-        m_pUnoCursor->Add(this);
         if (pMark)
         {
-            GetCursor()->SetMark();
-            *GetCursor()->GetMark() = *pMark;
+            m_pUnoCursor->SetMark();
+            *m_pUnoCursor->GetMark() = *pMark;
         }
     }
-    virtual ~Impl()
-    {
-        Invalidate();
-    }
 
-    std::shared_ptr<SwUnoCrsr> GetCursor() {
-        return m_pUnoCursor;
-    }
     SwUnoCrsr& GetCursorOrThrow() {
         if(!m_pUnoCursor)
             throw uno::RuntimeException("SwXTextCursor: disposed or invalid", 0);
-        return *m_pUnoCursor.get();
-    }
-
-    void Invalidate() {
-        if(m_pUnoCursor)
-        {
-            if(GetRegisteredIn() == m_pUnoCursor.get())
-                m_pUnoCursor->Remove(this);
-            m_pUnoCursor.reset();
-        }
+        return *m_pUnoCursor;
     }
-protected:
-    // SwClient
-    virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
-    virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) SAL_OVERRIDE;
 };
 
-void SwXTextCursor::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
-{
-    ClientModify(this, pOld, pNew);
-    // if the cursor leaves its designated section, it becomes invalid
-    if (((pOld != NULL) && (pOld->Which() == RES_UNOCURSOR_LEAVES_SECTION)))
-        Invalidate();
-}
-
-void SwXTextCursor::Impl::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    SwClient::SwClientNotify(rModify, rHint);
-    if(m_pUnoCursor && typeid(rHint) == typeid(sw::DocDisposingHint))
-    {
-        Invalidate();
-    }
-}
-
-std::shared_ptr<SwUnoCrsr> SwXTextCursor::GetCursor()
-{
-    return m_pImpl->GetCursor();
-}
+SwUnoCrsr*SwXTextCursor::GetCursor()
+    { return &(*m_pImpl->m_pUnoCursor); }
 
 SwPaM const* SwXTextCursor::GetPaM() const
-{
-    return m_pImpl->GetCursor().get();
-}
+    { return &(*m_pImpl->m_pUnoCursor); }
 
-SwPaM * SwXTextCursor::GetPaM()
-{
-    return m_pImpl->GetCursor().get();
-}
+SwPaM* SwXTextCursor::GetPaM()
+    { return &(*m_pImpl->m_pUnoCursor); }
 
 SwDoc const* SwXTextCursor::GetDoc() const
-{
-    return m_pImpl->GetCursor() ? m_pImpl->GetCursor()->GetDoc() : 0;
-}
+    { return m_pImpl->m_pUnoCursor ? m_pImpl->m_pUnoCursor->GetDoc() : nullptr; }
 
-SwDoc * SwXTextCursor::GetDoc()
-{
-    return m_pImpl->GetCursor() ? m_pImpl->GetCursor()->GetDoc() : 0;
-}
+SwDoc* SwXTextCursor::GetDoc()
+    { return m_pImpl->m_pUnoCursor ? m_pImpl->m_pUnoCursor->GetDoc() : nullptr; }
 
 SwXTextCursor::SwXTextCursor(
         SwDoc & rDoc,
@@ -774,7 +725,7 @@ SwXTextCursor::~SwXTextCursor()
 void SwXTextCursor::DeleteAndInsert(const OUString& rText,
         const bool bForceExpandHints)
 {
-    auto pUnoCrsr = m_pImpl->GetCursor();
+    auto pUnoCrsr = static_cast<SwCursor*>(&(*m_pImpl->m_pUnoCursor));
     if(pUnoCrsr)
     {
         // Start/EndAction
@@ -782,7 +733,7 @@ void SwXTextCursor::DeleteAndInsert(const OUString& rText,
         UnoActionContext aAction(pDoc);
         const sal_Int32 nTextLen = rText.getLength();
         pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
-        SwCursor * pCurrent = pUnoCrsr.get();
+        auto pCurrent = static_cast<SwCursor*>(pUnoCrsr);
         do
         {
             if (pCurrent->HasMark())
@@ -801,8 +752,8 @@ void SwXTextCursor::DeleteAndInsert(const OUString& rText,
                 pCurrent->Left(rText.getLength(),
                         CRSR_SKIP_CHARS, false, false);
             }
-            pCurrent = static_cast<SwCursor *>(pCurrent->GetNext());
-        } while (pCurrent != pUnoCrsr.get());
+            pCurrent = static_cast<SwCursor*>(pCurrent->GetNext());
+        } while (pCurrent != pUnoCrsr);
         pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
     }
 }
@@ -857,7 +808,7 @@ bool SwXTextCursor::IsAtEndOfMeta() const
 {
     if (CURSOR_META == m_pImpl->m_eType)
     {
-        auto pCursor( m_pImpl->GetCursor() );
+        auto pCursor( m_pImpl->m_pUnoCursor );
         SwXMeta const*const pXMeta(
                 dynamic_cast<SwXMeta*>(m_pImpl->m_xParentText.get()) );
         OSL_ENSURE(pXMeta, "no meta?");
@@ -971,7 +922,7 @@ sal_Bool SAL_CALL SwXTextCursor::isCollapsed() throw (uno::RuntimeException, std
     SolarMutexGuard aGuard;
 
     bool bRet = true;
-    auto pUnoCrsr(m_pImpl->GetCursor());
+    auto pUnoCrsr(m_pImpl->m_pUnoCursor);
     if(pUnoCrsr && pUnoCrsr->GetMark())
     {
         bRet = (*pUnoCrsr->GetPoint() == *pUnoCrsr->GetMark());
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index e0e89c5..5b73f62 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -711,7 +711,7 @@ Reference< util::XReplaceDescriptor >  SwXTextDocument::createReplaceDescriptor(
     return xRet;
 }
 
-std::shared_ptr<SwUnoCrsr> SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCrsr)
+SwUnoCrsr* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCrsr)
 {
     getText();
     XText *const pText = xBodyText.get();
@@ -808,7 +808,7 @@ Reference< util::XSearchDescriptor >  SwXTextDocument::createSearchDescriptor()
 
 // Used for findAll/First/Next
 
-std::shared_ptr<SwUnoCrsr>  SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > & xDesc,
+SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > & xDesc,
                                      Reference< XTextCursor > & xCrsr,
                                      bool bAll,
                                      sal_Int32& nResult,
@@ -816,9 +816,9 @@ std::shared_ptr<SwUnoCrsr>  SwXTextDocument::FindAny(const Reference< util::XSea
 {
     Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY);
     if(!IsValid() || !xDescTunnel.is() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()))
-        return 0;
+        return nullptr;
 
-    std::shared_ptr<SwUnoCrsr> pUnoCrsr(CreateCursorForSearch(xCrsr));
+    auto pUnoCrsr(CreateCursorForSearch(xCrsr));
     const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>(
         xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()));
 
@@ -847,7 +847,7 @@ std::shared_ptr<SwUnoCrsr>  SwXTextDocument::FindAny(const Reference< util::XSea
                                         SwXTextRange::getUnoTunnelId()));
             }
             if(!pRange)
-                return 0;
+                return nullptr;
             pRange->GetPositions(*pUnoCrsr);
             if(pUnoCrsr->HasMark())
             {
@@ -942,7 +942,7 @@ Reference< XIndexAccess >
     if(!pResultCrsr)
         throw RuntimeException();
     Reference< XIndexAccess >  xRet;
-    xRet = SwXTextRanges::Create( (nResult) ? pResultCrsr.get() : nullptr );
+    xRet = SwXTextRanges::Create( (nResult) ? &(*pResultCrsr) : nullptr );
     return xRet;
 }
 
commit a2c467a58ade9f55e0154b2935c747bb283ebd45
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Jun 3 00:36:14 2015 +0200

    use UnoCursorPointer in SwNavigationMgr
    
    Change-Id: I7c7431edd79cf4527f97c7dc0695d49174b61e2c

diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx
index 6952506..3236073 100644
--- a/sw/inc/unocrsr.hxx
+++ b/sw/inc/unocrsr.hxx
@@ -115,6 +115,13 @@ namespace sw
             {
                 m_pCursor->Add(this);
             }
+            UnoCursorPointer(const UnoCursorPointer& pOther)
+                : SwClient(nullptr)
+                , m_pCursor(pOther.m_pCursor)
+            {
+                if(m_pCursor)
+                    m_pCursor->Add(this);
+            }
             virtual ~UnoCursorPointer() SAL_OVERRIDE
             {
                 if(m_pCursor)
@@ -132,6 +139,13 @@ namespace sw
                 { return *m_pCursor.get(); }
             SwUnoCrsr* operator->() const
                 { return m_pCursor.get(); }
+            UnoCursorPointer& operator=(UnoCursorPointer aOther)
+            {
+                if(aOther.m_pCursor)
+                    aOther.m_pCursor->Add(this);
+                m_pCursor = aOther.m_pCursor;
+                return *this;
+            }
             explicit operator bool() const
                 { return static_cast<bool>(m_pCursor); }
             void reset(std::shared_ptr<SwUnoCrsr> pNew)
diff --git a/sw/source/uibase/inc/navmgr.hxx b/sw/source/uibase/inc/navmgr.hxx
index 2830959..1c6baa9 100644
--- a/sw/source/uibase/inc/navmgr.hxx
+++ b/sw/source/uibase/inc/navmgr.hxx
@@ -15,12 +15,13 @@
 #include "swtypes.hxx"
 #include "calbck.hxx"
 #include "unocrsr.hxx"
+#include "vcl/svapp.hxx"
 
 class   SwWrtShell;
 struct  SwPosition;
 class SwUnoCrsr;
 
-class SwNavigationMgr : SwClient
+class SwNavigationMgr
 {
 private:
     /*
@@ -32,7 +33,7 @@ private:
      * (e.g. click a link, or double click an entry from the navigator).
      * Every use of the back/forward buttons results in moving the stack pointer within the navigation history
      */
-    typedef ::std::vector< std::shared_ptr<SwUnoCrsr> > Stack_t;
+    typedef ::std::vector< sw::UnoCursorPointer > Stack_t;
     Stack_t m_entries;
     Stack_t::size_type m_nCurrent; /* Current position within the navigation history */
     SwWrtShell & m_rMyShell; /* The active shell within which the navigation occurs */
@@ -44,11 +45,8 @@ public:
     SwNavigationMgr( SwWrtShell & rShell );
     virtual ~SwNavigationMgr()
     {
-        for(auto pEntry : m_entries)
-        {
-            if(pEntry && GetRegisteredIn() == pEntry.get())
-                pEntry->Remove(this);
-        }
+        SolarMutexGuard g;
+        m_entries.clear();
     }
     /* Can we go back in the history ? */
     bool backEnabled() ;
@@ -60,7 +58,6 @@ public:
     void goForward() ;
     /* The method that adds the position pPos to the navigation history */
     bool addEntry(const SwPosition& rPos);
-    void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) SAL_OVERRIDE;
 };
 #endif
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/wrtsh/navmgr.cxx b/sw/source/uibase/wrtsh/navmgr.cxx
index 6740fa5..1811532 100644
--- a/sw/source/uibase/wrtsh/navmgr.cxx
+++ b/sw/source/uibase/wrtsh/navmgr.cxx
@@ -162,17 +162,15 @@ bool SwNavigationMgr::addEntry(const SwPosition& rPos) {
 
         if (*m_entries.back()->GetPoint() != rPos)
         {
-            std::shared_ptr<SwUnoCrsr> pCursor(m_rMyShell.GetDoc()->CreateUnoCrsr(rPos));
+            sw::UnoCursorPointer pCursor(m_rMyShell.GetDoc()->CreateUnoCrsr(rPos));
             m_entries.push_back(pCursor);
-            pCursor->Add(this);
         }
         bRet = true;
     }
     else {
         if ( (!m_entries.empty() && *m_entries.back()->GetPoint() != rPos) || m_entries.empty() ) {
-            auto pCursor(m_rMyShell.GetDoc()->CreateUnoCrsr(rPos));
+            sw::UnoCursorPointer pCursor(m_rMyShell.GetDoc()->CreateUnoCrsr(rPos));
             m_entries.push_back(pCursor);
-            pCursor->Add(this);
             bRet = true;
         }
         if (m_entries.size() > 1 && *m_entries.back()->GetPoint() == rPos)
@@ -216,14 +214,4 @@ bool SwNavigationMgr::addEntry(const SwPosition& rPos) {
     return bRet;
 }
 
-void SwNavigationMgr::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    if(typeid(rHint) == typeid(sw::DocDisposingHint))
-    {
-        m_entries.clear();
-    }
-    else
-        SwClient::SwClientNotify(rModify, rHint);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 683bac5b9661367bce9a8b0ccd81046183ed9c9d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Jun 2 23:16:21 2015 +0200

    another RAII
    
    Change-Id: I11bb3ab21e3434574578cd7fbe03b0b75158e355

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index ea48527..5eedef6 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -228,14 +228,13 @@ void CollectFrameAtNode( const SwNodeIndex& rIdx,
                 0 != (pAnchorPos = rAnchor.GetContentAnchor()) &&
                     pAnchorPos->nNode == rIdx )
             {
-                sw::FrameClient* pNewClient = new sw::FrameClient(const_cast<SwFrameFormat*>(pFormat));
 
                 // OD 2004-05-07 #i28701# - determine insert position for
                 // sorted <rFrameArr>
                 const sal_Int32 nIndex = pAnchorPos->nContent.GetIndex();
                 sal_uInt32 nOrder = rAnchor.GetOrder();
 
-                FrameClientSortListEntry entry(nIndex, nOrder, pNewClient);
+                FrameClientSortListEntry entry(nIndex, nOrder, new sw::FrameClient(const_cast<SwFrameFormat*>(pFormat)));
                 rFrames.push_back(entry);
             }
         }
commit 071c49da0c2a42962d4e077fc453434be2a6ecf2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 23:15:02 2015 +0200

    refactor out frame collection with layout
    
    Change-Id: I977c9915414eedead860622b120f00ad811e18e9

diff --git a/sw/source/core/inc/sortedobjs.hxx b/sw/source/core/inc/sortedobjs.hxx
index a57ed15..2ebdbae 100644
--- a/sw/source/core/inc/sortedobjs.hxx
+++ b/sw/source/core/inc/sortedobjs.hxx
@@ -51,6 +51,7 @@ class SwSortedObjs
         std::vector< SwAnchoredObject* > maSortedObjLst;
 
     public:
+        typedef std::vector<SwAnchoredObject*>::const_iterator const_iterator;
         SwSortedObjs();
         ~SwSortedObjs();
 
@@ -62,6 +63,10 @@ class SwSortedObjs
             input parameter - index of entry, valid value range [0..size()-1]
         */
         SwAnchoredObject* operator[]( size_t _nIndex ) const;
+        const_iterator begin() const
+            { return maSortedObjLst.cbegin(); };
+        const_iterator end() const
+            { return maSortedObjLst.cend(); };
 
         bool Insert( SwAnchoredObject& _rAnchoredObj );
 
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 5a6f56e..ea48527 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -165,6 +165,35 @@ struct FrameClientSortListLess
     }
 };
 
+namespace
+{
+    void lcl_CollectFrameAtNodeWithLayout(SwDoc* pDoc, const SwContentFrm* pCFrm,
+            FrameClientSortList_t& rFrames,
+            const sal_uInt16 nAnchorType)
+    {
+        auto pObjs = pCFrm->GetDrawObjs();
+        if(!pObjs)
+            return;
+        const auto aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+        for(const auto pAnchoredObj : *pObjs)
+        {
+            SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat();
+            // Filter out textboxes, which are not interesting at an UNO level.
+            if(aTextBoxes.find(&rFormat) != aTextBoxes.end())
+                continue;
+            if(rFormat.GetAnchor().GetAnchorId() == nAnchorType)
+            {
+                const auto nIdx =
+                    rFormat.GetAnchor().GetContentAnchor()->nContent.GetIndex();
+                const auto nOrder = rFormat.GetAnchor().GetOrder();
+                FrameClientSortListEntry entry(nIdx, nOrder, new sw::FrameClient(&rFormat));
+                rFrames.push_back(entry);
+            }
+        }
+    }
+}
+
+
 void CollectFrameAtNode( const SwNodeIndex& rIdx,
                          FrameClientSortList_t& rFrames,
                          const bool bAtCharAnchoredObjs )
@@ -176,7 +205,7 @@ void CollectFrameAtNode( const SwNodeIndex& rIdx,
     // search all borders, images, and OLEs that are connected to the paragraph
     SwDoc* pDoc = rIdx.GetNode().GetDoc();
 
-    const sal_uInt16 nChkType = static_cast< sal_uInt16 >((bAtCharAnchoredObjs)
+    const auto nChkType = static_cast< sal_uInt16 >((bAtCharAnchoredObjs)
             ? FLY_AT_CHAR : FLY_AT_PARA);
     const SwContentFrm* pCFrm;
     const SwContentNode* pCNd;
@@ -184,34 +213,7 @@ void CollectFrameAtNode( const SwNodeIndex& rIdx,
         0 != (pCNd = rIdx.GetNode().GetContentNode()) &&
         0 != (pCFrm = pCNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout())) )
     {
-        const SwSortedObjs *pObjs = pCFrm->GetDrawObjs();
-        if( pObjs )
-        {
-            std::set<const SwFrameFormat*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
-            for( size_t i = 0; i < pObjs->size(); ++i )
-            {
-                SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
-                SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat();
-
-                // Filter out textboxes, which are not interesting at an UNO level.
-                if (aTextBoxes.find(&rFormat) != aTextBoxes.end())
-                    continue;
-
-                if ( rFormat.GetAnchor().GetAnchorId() == nChkType )
-                {
-                    // create SwDepend and insert into array
-                    sw::FrameClient* pNewClient = new sw::FrameClient( &rFormat );
-                    const sal_Int32 idx =
-                        rFormat.GetAnchor().GetContentAnchor()->nContent.GetIndex();
-                    sal_uInt32 nOrder = rFormat.GetAnchor().GetOrder();
-
-                    // OD 2004-05-07 #i28701# - sorting no longer needed,
-                    // because list <SwSortedObjs> is already sorted.
-                    FrameClientSortListEntry entry(idx, nOrder, pNewClient);
-                    rFrames.push_back(entry);
-                }
-            }
-        }
+        lcl_CollectFrameAtNodeWithLayout(pDoc, pCFrm, rFrames, nChkType);
     }
     else
     {
commit 41e43dc3d2be13bd75300d251fdd110a051be229
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 22:27:59 2015 +0200

    refactor SwXParaFrameEnumerationImpl ctor
    
    Change-Id: I017a4b5ccc28d90e1464e8cbf60cffbc96324963

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 804e5f1..5a6f56e 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1634,12 +1634,11 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
     }
     if (PARAFRAME_PORTION_PARAGRAPH == eParaFrameMode)
     {
-        FrameClientSortList_t frames;
-        ::CollectFrameAtNode(rPaM.GetPoint()->nNode,
-                frames, false);
-        ::std::transform(frames.begin(), frames.end(),
+        FrameClientSortList_t vFrames;
+        ::CollectFrameAtNode(rPaM.GetPoint()->nNode, vFrames, false);
+        ::std::transform(vFrames.begin(), vFrames.end(),
             ::std::back_inserter(m_vFrames),
-            ::boost::bind(&FrameClientSortListEntry::pFrameClient, _1));
+            [] (const FrameClientSortListEntry& rEntry) { return rEntry.pFrameClient; });
     }
     else if (pFormat)
     {
@@ -1651,12 +1650,9 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
         if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode)
         {
             //get all frames that are bound at paragraph or at character
-            SwPosFlyFrms aFlyFrms(rPaM.GetDoc()->GetAllFlyFormats(GetCursor(), false, true));
-
-            for(SwPosFlyFrms::const_iterator aIter(aFlyFrms.begin()); aIter != aFlyFrms.end(); ++aIter)
+            for(const auto& pFlyFrm : rPaM.GetDoc()->GetAllFlyFormats(GetCursor(), false, true))
             {
-                SwFrameFormat *const pFrameFormat = const_cast<SwFrameFormat*>(&((*aIter)->GetFormat()));
-
+                const auto pFrameFormat = const_cast<SwFrameFormat*>(&pFlyFrm->GetFormat());
                 m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
             }
         }
commit e4891cefd3dc221692ac2f23fd97d25e71d071f1
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 21:47:57 2015 +0200

    make FillFrames a member
    
    Change-Id: I1582705ce3ae9cc7bbe33789a1626e8d7d3853cf

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 12eb6a7..804e5f1 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1610,6 +1610,7 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration
             m_vFrames.erase(iter, m_vFrames.end());
         }
     }
+    void FillFrame();
     bool CreateNextObject();
     uno::Reference< text::XTextContent > m_xNextObject;
     FrameClientList_t m_vFrames;
@@ -1617,23 +1618,6 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration
 };
 
 
-// Search for a FLYCNT text attribute at the cursor point and fill the frame
-// into the array
-static void
-lcl_FillFrame(SwUnoCrsr& rUnoCrsr, FrameClientList_t & rFrames)
-{
-    // search for objects at the cursor - anchored at/as char
-    SwTextAttr const*const pTextAttr = (rUnoCrsr.GetNode().IsTextNode())
-        ? rUnoCrsr.GetNode().GetTextNode()->GetTextAttrForCharAt(
-            rUnoCrsr.GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT)
-        : 0;
-    if (pTextAttr)
-    {
-        const SwFormatFlyCnt& rFlyCnt = pTextAttr->GetFlyCnt();
-        SwFrameFormat * const  pFrameFormat = rFlyCnt.GetFrameFormat();
-        rFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
-    }
-}
 
 SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat)
     { return new SwXParaFrameEnumerationImpl(rPaM, eParaFrameMode, pFormat); }
@@ -1676,18 +1660,33 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
                 m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
             }
         }
-
-        lcl_FillFrame(*GetCursor(), m_vFrames);
+        FillFrame();
     }
 }
 
+// Search for a FLYCNT text attribute at the cursor point and fill the frame
+// into the array
+void SwXParaFrameEnumerationImpl::FillFrame()
+{
+    if(!m_pUnoCursor->GetNode().IsTextNode())
+        return;
+    // search for objects at the cursor - anchored at/as char
+    const auto pTextAttr = m_pUnoCursor->GetNode().GetTextNode()->GetTextAttrForCharAt(
+            m_pUnoCursor->GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT);
+    if(!pTextAttr)
+        return;
+    const SwFormatFlyCnt& rFlyCnt = pTextAttr->GetFlyCnt();
+    SwFrameFormat* const pFrameFormat = rFlyCnt.GetFrameFormat();
+    m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
+}
+
 bool SwXParaFrameEnumerationImpl::CreateNextObject()
 {
     if (!m_vFrames.size())
         return false;
 
     SwFrameFormat* const pFormat = static_cast<SwFrameFormat*>(const_cast<SwModify*>(
-                m_vFrames.front()->GetRegisteredIn()));
+            m_vFrames.front()->GetRegisteredIn()));
     m_vFrames.pop_front();
     // the format should be valid here, otherwise the client
     // would have been removed by PurgeFrameClients
@@ -1695,11 +1694,9 @@ bool SwXParaFrameEnumerationImpl::CreateNextObject()
     SwDrawContact* const pContact = SwIterator<SwDrawContact,SwFormat>( *pFormat ).First();
     if (pContact)
     {
-        SdrObject * const pSdr = pContact->GetMaster();
+        SdrObject* const pSdr = pContact->GetMaster();
         if (pSdr)
-        {
             m_xNextObject.set(pSdr->getUnoShape(), uno::UNO_QUERY);
-        }
     }
     else
     {
commit 642088c5eb811e6ca70c4f19d825e074d8268866
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 21:22:53 2015 +0200

    make CreateNextObject a member
    
    Change-Id: I1bd9668a2567390ceceb1742483a9fdabc025db7

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 931e3b3..12eb6a7 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1599,73 +1599,23 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration
     {
         if(!m_pUnoCursor)
         {
-            m_Frames.clear();
+            m_vFrames.clear();
             m_xNextObject = nullptr;
         }
         else
         {
             // removing orphaned SwDepends
-            const auto iter = std::remove_if(m_Frames.begin(), m_Frames.end(),
+            const auto iter = std::remove_if(m_vFrames.begin(), m_vFrames.end(),
                     [] (std::shared_ptr<sw::FrameClient>& rEntry) -> bool { return !rEntry->GetRegisteredIn(); });
-            m_Frames.erase(iter, m_Frames.end());
+            m_vFrames.erase(iter, m_vFrames.end());
         }
     }
-    // created by hasMoreElements
+    bool CreateNextObject();
     uno::Reference< text::XTextContent > m_xNextObject;
-    FrameClientList_t m_Frames;
+    FrameClientList_t m_vFrames;
     ::sw::UnoCursorPointer m_pUnoCursor;
 };
 
-static bool
-lcl_CreateNextObject(SwUnoCrsr& i_rUnoCrsr,
-        uno::Reference<text::XTextContent> & o_rNextObject,
-        FrameClientList_t & i_rFrames)
-{
-    if (!i_rFrames.size())
-        return false;
-
-    SwFrameFormat *const pFormat = static_cast<SwFrameFormat*>(
-                i_rFrames.front()->GetRegisteredIn());
-    i_rFrames.pop_front();
-    // the format should be valid here, otherwise the client
-    // would have been removed in ::Modify
-    // check for a shape first
-    SwDrawContact* const pContact = SwIterator<SwDrawContact,SwFormat>( *pFormat ).First();
-    if (pContact)
-    {
-        SdrObject * const pSdr = pContact->GetMaster();
-        if (pSdr)
-        {
-            o_rNextObject.set(pSdr->getUnoShape(), uno::UNO_QUERY);
-        }
-    }
-    else
-    {
-        const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
-        OSL_ENSURE(pIdx, "where is the index?");
-        SwNode const*const pNd =
-            i_rUnoCrsr.GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
-
-        if (!pNd->IsNoTextNode())
-        {
-            o_rNextObject.set(SwXTextFrame::CreateXTextFrame(
-                        *pFormat->GetDoc(), pFormat));
-        }
-        else if (pNd->IsGrfNode())
-        {
-            o_rNextObject.set(SwXTextGraphicObject::CreateXTextGraphicObject(
-                        *pFormat->GetDoc(), pFormat));
-        }
-        else
-        {
-            assert(pNd->IsOLENode());
-            o_rNextObject.set(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(
-                        *pFormat->GetDoc(), pFormat));
-        }
-    }
-
-    return o_rNextObject.is();
-}
 
 // Search for a FLYCNT text attribute at the cursor point and fill the frame
 // into the array
@@ -1704,12 +1654,12 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
         ::CollectFrameAtNode(rPaM.GetPoint()->nNode,
                 frames, false);
         ::std::transform(frames.begin(), frames.end(),
-            ::std::back_inserter(m_Frames),
+            ::std::back_inserter(m_vFrames),
             ::boost::bind(&FrameClientSortListEntry::pFrameClient, _1));
     }
     else if (pFormat)
     {
-        m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFormat)));
+        m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFormat)));
     }
     else if ((PARAFRAME_PORTION_CHAR == eParaFrameMode) ||
              (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode))
@@ -1723,14 +1673,61 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
             {
                 SwFrameFormat *const pFrameFormat = const_cast<SwFrameFormat*>(&((*aIter)->GetFormat()));
 
-                m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
+                m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
             }
         }
 
-        lcl_FillFrame(*GetCursor(), m_Frames);
+        lcl_FillFrame(*GetCursor(), m_vFrames);
     }
 }
 
+bool SwXParaFrameEnumerationImpl::CreateNextObject()
+{
+    if (!m_vFrames.size())
+        return false;
+
+    SwFrameFormat* const pFormat = static_cast<SwFrameFormat*>(const_cast<SwModify*>(
+                m_vFrames.front()->GetRegisteredIn()));
+    m_vFrames.pop_front();
+    // the format should be valid here, otherwise the client
+    // would have been removed by PurgeFrameClients
+    // check for a shape first
+    SwDrawContact* const pContact = SwIterator<SwDrawContact,SwFormat>( *pFormat ).First();
+    if (pContact)
+    {
+        SdrObject * const pSdr = pContact->GetMaster();
+        if (pSdr)
+        {
+            m_xNextObject.set(pSdr->getUnoShape(), uno::UNO_QUERY);
+        }
+    }
+    else
+    {
+        const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
+        OSL_ENSURE(pIdx, "where is the index?");
+        SwNode const*const pNd =
+            m_pUnoCursor->GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
+
+        if (!pNd->IsNoTextNode())
+        {
+            m_xNextObject.set(SwXTextFrame::CreateXTextFrame(
+                        *pFormat->GetDoc(), pFormat));
+        }
+        else if (pNd->IsGrfNode())
+        {
+            m_xNextObject.set(SwXTextGraphicObject::CreateXTextGraphicObject(
+                        *pFormat->GetDoc(), pFormat));
+        }
+        else
+        {
+            assert(pNd->IsOLENode());
+            m_xNextObject.set(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(
+                        *pFormat->GetDoc(), pFormat));
+        }
+    }
+    return m_xNextObject.is();
+}
+
 sal_Bool SAL_CALL
 SwXParaFrameEnumerationImpl::hasMoreElements() throw (uno::RuntimeException, std::exception)
 {
@@ -1738,8 +1735,7 @@ SwXParaFrameEnumerationImpl::hasMoreElements() throw (uno::RuntimeException, std
     if (!GetCursor())
         throw uno::RuntimeException();
     PurgeFrameClients();
-    return m_xNextObject.is() ||
-        lcl_CreateNextObject(*GetCursor(), m_xNextObject, m_Frames);
+    return m_xNextObject.is() || CreateNextObject();
 }
 
 uno::Any SAL_CALL SwXParaFrameEnumerationImpl::nextElement()
@@ -1750,11 +1746,8 @@ throw (container::NoSuchElementException,
     if (!GetCursor())
         throw uno::RuntimeException();
     PurgeFrameClients();
-    if (!m_xNextObject.is() && m_Frames.size())
-    {
-        lcl_CreateNextObject(*GetCursor(),
-                m_xNextObject, m_Frames);
-    }
+    if (!m_xNextObject.is() && m_vFrames.size())
+        CreateNextObject();
     if (!m_xNextObject.is())
         throw container::NoSuchElementException();
     uno::Any aRet;
commit 540027c366bf0a0e9a820d49acd7ae0ed48cb7d5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 20:49:47 2015 +0200

    simplify and inline trivial boilerplate
    
    Change-Id: Idcf0ef3670209c6b68e4afac8efcd8ab463e4774

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 6281358..931e3b3 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1576,22 +1576,23 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
 struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration
 {
     // XServiceInfo
-    virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return OUString("SwXParaFrameEnumeration"); };
+    virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return cppu::supportsService(this, rServiceName); };
+    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return {"com.sun.star.util.ContentEnumeration"}; };
 
     // XEnumeration
     virtual sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
-    SwXParaFrameEnumerationImpl(const SwPaM& rPaM,
-        const enum ParaFrameMode eParaFrameMode, SwFrameFormat *const pFormat = 0);
-    // created by hasMoreElements
-    uno::Reference< text::XTextContent > m_xNextObject;
-    FrameClientList_t m_Frames;
-    ::sw::UnoCursorPointer m_pUnoCursor;
-
-
+    SwXParaFrameEnumerationImpl(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat = nullptr);
+    virtual void SAL_CALL release() throw () SAL_OVERRIDE
+    {
+        SolarMutexGuard g;
+        OWeakObject::release();
+    }
     SwUnoCrsr* GetCursor()
         { return &(*m_pUnoCursor); }
     void PurgeFrameClients()
@@ -1609,6 +1610,10 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration
             m_Frames.erase(iter, m_Frames.end());
         }
     }
+    // created by hasMoreElements
+    uno::Reference< text::XTextContent > m_xNextObject;
+    FrameClientList_t m_Frames;
+    ::sw::UnoCursorPointer m_pUnoCursor;
 };
 
 static bool
@@ -1758,33 +1763,4 @@ throw (container::NoSuchElementException,
     return aRet;
 }
 
-OUString SAL_CALL
-SwXParaFrameEnumerationImpl::getImplementationName() throw (uno::RuntimeException, std::exception)
-{
-    return OUString("SwXParaFrameEnumeration");
-}
-
-static char const*const g_ServicesParaFrameEnum[] =
-{
-    "com.sun.star.util.ContentEnumeration",
-};
-
-static const size_t g_nServicesParaFrameEnum(
-    sizeof(g_ServicesParaFrameEnum)/sizeof(g_ServicesParaFrameEnum[0]));
-
-sal_Bool SAL_CALL
-SwXParaFrameEnumerationImpl::supportsService(const OUString& rServiceName)
-throw (uno::RuntimeException, std::exception)
-{
-    return cppu::supportsService(this, rServiceName);
-}
-
-uno::Sequence< OUString > SAL_CALL
-SwXParaFrameEnumerationImpl::getSupportedServiceNames()
-throw (uno::RuntimeException, std::exception)
-{
-    return ::sw::GetSupportedServiceNamesImpl(
-            g_nServicesParaFrameEnum, g_ServicesParaFrameEnum);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 82eac6775f93e1147e60ecef81c132ae71e64444
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 20:37:51 2015 +0200

    use ABC instead of Pimpl for SwXTextRanges
    
    - abstract base class reduces boilerplate
    - Pimpl is pointless here, except for SolarMutex, which is handled by
      overriding release
    
    Change-Id: Ia08dc26104f70411a783ade681be3bcebb3b9acb

diff --git a/sw/source/core/inc/unoparaframeenum.hxx b/sw/source/core/inc/unoparaframeenum.hxx
index baa28b4..9c33589 100644
--- a/sw/source/core/inc/unoparaframeenum.hxx
+++ b/sw/source/core/inc/unoparaframeenum.hxx
@@ -73,45 +73,10 @@ enum ParaFrameMode
     PARAFRAME_PORTION_TEXTRANGE,
 };
 
-typedef ::cppu::WeakImplHelper
-<   ::com::sun::star::lang::XServiceInfo
-,   ::com::sun::star::container::XEnumeration
-> SwXParaFrameEnumeration_Base;
-
-class SwXParaFrameEnumeration
-    : public SwXParaFrameEnumeration_Base
+struct SwXParaFrameEnumeration
+    : public SwSimpleEnumeration_Base
 {
-
-private:
-
-    class Impl;
-    ::sw::UnoImplPtr<Impl> m_pImpl;
-
-    virtual ~SwXParaFrameEnumeration();
-
-public:
-
-    SwXParaFrameEnumeration(const SwPaM& rPaM,
-        const enum ParaFrameMode eParaFrameMode, SwFrameFormat *const pFormat = 0);
-
-    // XServiceInfo
-    virtual OUString SAL_CALL getImplementationName()
-        throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual sal_Bool SAL_CALL supportsService(
-            const OUString& rServiceName)
-        throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
-        getSupportedServiceNames()
-        throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-    // XEnumeration
-    virtual sal_Bool SAL_CALL hasMoreElements()
-        throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
-        throw (::com::sun::star::container::NoSuchElementException,
-               ::com::sun::star::lang::WrappedTargetException,
-               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
+    static SwXParaFrameEnumeration* Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat = nullptr);
 };
 
 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNOPARAFRAMEENUM_HXX
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 8b4a737..af25437 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2984,17 +2984,10 @@ SwXTextCursor::createContentEnumeration(const OUString& rServiceName)
 throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard g;
-
     if (rServiceName != "com.sun.star.text.TextContent")
-    {
         throw uno::RuntimeException();
-    }
-
-    SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
-
-    uno::Reference< container::XEnumeration > xRet =
-        new SwXParaFrameEnumeration(rUnoCursor, PARAFRAME_PORTION_TEXTRANGE);
-    return xRet;
+    SwUnoCrsr& rUnoCursor( m_pImpl->GetCursorOrThrow() );
+    return SwXParaFrameEnumeration::Create(rUnoCursor, PARAFRAME_PORTION_TEXTRANGE);
 }
 
 uno::Reference< container::XEnumeration > SAL_CALL
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index c7d9ca4..6281358 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1234,9 +1234,7 @@ throw (uno::RuntimeException, std::exception)
         throw uno::RuntimeException();
     }
 
-    const uno::Reference< container::XEnumeration > xRet =
-        new SwXParaFrameEnumeration(*pNewCrsr, PARAFRAME_PORTION_TEXTRANGE);
-    return xRet;
+    return SwXParaFrameEnumeration::Create(*pNewCrsr, PARAFRAME_PORTION_TEXTRANGE);
 }
 
 uno::Reference< container::XEnumeration > SAL_CALL
@@ -1575,22 +1573,24 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
     pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
 }
 
-struct SwXParaFrameEnumeration::Impl
+struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration
 {
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    // XEnumeration
+    virtual sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    SwXParaFrameEnumerationImpl(const SwPaM& rPaM,
+        const enum ParaFrameMode eParaFrameMode, SwFrameFormat *const pFormat = 0);
     // created by hasMoreElements
     uno::Reference< text::XTextContent > m_xNextObject;
     FrameClientList_t m_Frames;
     ::sw::UnoCursorPointer m_pUnoCursor;
 
-    explicit Impl(SwPaM const & rPaM)
-        : m_pUnoCursor(rPaM.GetDoc()->CreateUnoCrsr(*rPaM.GetPoint(), false))
-    {
-        if (rPaM.HasMark())
-        {
-            GetCursor()->SetMark();
-            *GetCursor()->GetMark() = *rPaM.GetMark();
-        }
-    }
 
     SwUnoCrsr* GetCursor()
         { return &(*m_pUnoCursor); }
@@ -1680,23 +1680,31 @@ lcl_FillFrame(SwUnoCrsr& rUnoCrsr, FrameClientList_t & rFrames)
     }
 }
 
-SwXParaFrameEnumeration::SwXParaFrameEnumeration(
+SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat)
+    { return new SwXParaFrameEnumerationImpl(rPaM, eParaFrameMode, pFormat); }
+
+SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
         const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode,
-        SwFrameFormat *const pFormat)
-    : m_pImpl( new SwXParaFrameEnumeration::Impl(rPaM) )
+        SwFrameFormat* const pFormat)
+    : m_pUnoCursor(rPaM.GetDoc()->CreateUnoCrsr(*rPaM.GetPoint(), false))
 {
+    if (rPaM.HasMark())
+    {
+        GetCursor()->SetMark();
+        *GetCursor()->GetMark() = *rPaM.GetMark();
+    }
     if (PARAFRAME_PORTION_PARAGRAPH == eParaFrameMode)
     {
         FrameClientSortList_t frames;
         ::CollectFrameAtNode(rPaM.GetPoint()->nNode,
                 frames, false);
         ::std::transform(frames.begin(), frames.end(),
-            ::std::back_inserter(m_pImpl->m_Frames),
+            ::std::back_inserter(m_Frames),
             ::boost::bind(&FrameClientSortListEntry::pFrameClient, _1));
     }
     else if (pFormat)
     {
-        m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFormat)));
+        m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFormat)));
     }
     else if ((PARAFRAME_PORTION_CHAR == eParaFrameMode) ||
              (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode))
@@ -1704,60 +1712,54 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(
         if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode)
         {
             //get all frames that are bound at paragraph or at character
-            SwPosFlyFrms aFlyFrms(rPaM.GetDoc()->GetAllFlyFormats(m_pImpl->GetCursor(), false, true));
+            SwPosFlyFrms aFlyFrms(rPaM.GetDoc()->GetAllFlyFormats(GetCursor(), false, true));
 
             for(SwPosFlyFrms::const_iterator aIter(aFlyFrms.begin()); aIter != aFlyFrms.end(); ++aIter)
             {
                 SwFrameFormat *const pFrameFormat = const_cast<SwFrameFormat*>(&((*aIter)->GetFormat()));
 
-                m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
+                m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
             }
         }
 
-        lcl_FillFrame(*m_pImpl->GetCursor(), m_pImpl->m_Frames);
+        lcl_FillFrame(*GetCursor(), m_Frames);
     }
 }
 
-SwXParaFrameEnumeration::~SwXParaFrameEnumeration()
-{
-}
-
 sal_Bool SAL_CALL
-SwXParaFrameEnumeration::hasMoreElements() throw (uno::RuntimeException, std::exception)
+SwXParaFrameEnumerationImpl::hasMoreElements() throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    if (!m_pImpl->GetCursor())
+    if (!GetCursor())
         throw uno::RuntimeException();
-    m_pImpl->PurgeFrameClients();
-    return m_pImpl->m_xNextObject.is() ||
-        lcl_CreateNextObject(*m_pImpl->GetCursor(),m_pImpl->m_xNextObject, m_pImpl->m_Frames);
+    PurgeFrameClients();
+    return m_xNextObject.is() ||
+        lcl_CreateNextObject(*GetCursor(), m_xNextObject, m_Frames);
 }
 
-uno::Any SAL_CALL SwXParaFrameEnumeration::nextElement()
+uno::Any SAL_CALL SwXParaFrameEnumerationImpl::nextElement()
 throw (container::NoSuchElementException,
         lang::WrappedTargetException, uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    if (!m_pImpl->GetCursor())
+    if (!GetCursor())
         throw uno::RuntimeException();
-    m_pImpl->PurgeFrameClients();
-    if (!m_pImpl->m_xNextObject.is() && m_pImpl->m_Frames.size())
+    PurgeFrameClients();
+    if (!m_xNextObject.is() && m_Frames.size())
     {
-        lcl_CreateNextObject(*m_pImpl->GetCursor(),
-                m_pImpl->m_xNextObject, m_pImpl->m_Frames);
+        lcl_CreateNextObject(*GetCursor(),
+                m_xNextObject, m_Frames);
     }
-    if (!m_pImpl->m_xNextObject.is())
-    {
+    if (!m_xNextObject.is())
         throw container::NoSuchElementException();
-    }
     uno::Any aRet;
-    aRet <<= m_pImpl->m_xNextObject;
-    m_pImpl->m_xNextObject = 0;
+    aRet <<= m_xNextObject;
+    m_xNextObject = nullptr;
     return aRet;
 }
 
 OUString SAL_CALL
-SwXParaFrameEnumeration::getImplementationName() throw (uno::RuntimeException, std::exception)
+SwXParaFrameEnumerationImpl::getImplementationName() throw (uno::RuntimeException, std::exception)
 {
     return OUString("SwXParaFrameEnumeration");
 }
@@ -1771,14 +1773,14 @@ static const size_t g_nServicesParaFrameEnum(
     sizeof(g_ServicesParaFrameEnum)/sizeof(g_ServicesParaFrameEnum[0]));
 
 sal_Bool SAL_CALL
-SwXParaFrameEnumeration::supportsService(const OUString& rServiceName)
+SwXParaFrameEnumerationImpl::supportsService(const OUString& rServiceName)
 throw (uno::RuntimeException, std::exception)
 {
     return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SAL_CALL
-SwXParaFrameEnumeration::getSupportedServiceNames()
+SwXParaFrameEnumerationImpl::getSupportedServiceNames()
 throw (uno::RuntimeException, std::exception)
 {
     return ::sw::GetSupportedServiceNamesImpl(
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index d1c6e78..6d24e42 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -1438,7 +1438,7 @@ throw (uno::RuntimeException, std::exception)
     SwPosition aPos( rTextNode );
     SwPaM aPam( aPos );
     uno::Reference< container::XEnumeration > xRet =
-        new SwXParaFrameEnumeration(aPam, PARAFRAME_PORTION_PARAGRAPH);
+        SwXParaFrameEnumeration::Create(aPam, PARAFRAME_PORTION_PARAGRAPH);
     return xRet;
 }
 
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index ad81d7e..996f4ea 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -851,11 +851,7 @@ uno::Reference< container::XEnumeration >  SwXTextPortion::createContentEnumerat
     if(!pUnoCrsr)
         throw uno::RuntimeException();
 
-    uno::Reference< container::XEnumeration >  xRet =
-        new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_CHAR,
-                m_pFrameFormat);
-    return xRet;
-
+    return SwXParaFrameEnumeration::Create(*pUnoCrsr, PARAFRAME_PORTION_CHAR, m_pFrameFormat);
 }
 
 namespace
commit aa0301e6d941b512e18a094f567f5c47dd08ffc9
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 19:50:57 2015 +0200

    RAII for ParagraphFrameEnumeration
    
    Change-Id: I23d9beabe38587eca2b0620b5c431835ce70d37b

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 1489d8b..c7d9ca4 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1676,8 +1676,7 @@ lcl_FillFrame(SwUnoCrsr& rUnoCrsr, FrameClientList_t & rFrames)
     {
         const SwFormatFlyCnt& rFlyCnt = pTextAttr->GetFlyCnt();
         SwFrameFormat * const  pFrameFormat = rFlyCnt.GetFrameFormat();
-        sw::FrameClient* const pNewClient = new sw::FrameClient(pFrameFormat);
-        rFrames.push_back( std::shared_ptr<sw::FrameClient>(pNewClient) );
+        rFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
     }
 }
 
@@ -1697,9 +1696,7 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(
     }
     else if (pFormat)
     {
-        // create SwDepend for frame and insert into array
-        sw::FrameClient* const pNewClient = new sw::FrameClient(pFormat);
-        m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(pNewClient));
+        m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFormat)));
     }
     else if ((PARAFRAME_PORTION_CHAR == eParaFrameMode) ||
              (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode))
@@ -1713,9 +1710,7 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(
             {
                 SwFrameFormat *const pFrameFormat = const_cast<SwFrameFormat*>(&((*aIter)->GetFormat()));
 
-                // create SwDepend for frame and insert into array
-                sw::FrameClient* const pNewClient = new sw::FrameClient(pFrameFormat);
-                m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(pNewClient));
+                m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat)));
             }
         }
 
commit e1323281875e3937c812a2e172fd75d16a573fd0
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jun 1 19:43:00 2015 +0200

    use UnoCursorPointer in ParagraphFrameEnumeration
    
    Change-Id: I5fdf0bdd8609aa07c49b155cc75cade8bdb2c292

diff --git a/sw/source/core/inc/unoparaframeenum.hxx b/sw/source/core/inc/unoparaframeenum.hxx
index e4f001d..baa28b4 100644
--- a/sw/source/core/inc/unoparaframeenum.hxx
+++ b/sw/source/core/inc/unoparaframeenum.hxx
@@ -22,42 +22,49 @@
 
 #include <deque>
 
-#include <boost/shared_ptr.hpp>
-
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/container/XEnumeration.hpp>
 #include <com/sun/star/text/XTextContent.hpp>
 
 #include <cppuhelper/implbase.hxx>
 
+#include <calbck.hxx>
 #include <unobaseclass.hxx>
 
+
 class SwDepend;
 class SwNodeIndex;
 class SwPaM;
 class SwFrameFormat;
 
-struct FrameDependSortListEntry
+namespace sw
+{
+    struct FrameClient : public SwClient
+    {
+        FrameClient(SwModify* pModify) : SwClient(pModify) {};
+    };
+}
+struct FrameClientSortListEntry
 {
     sal_Int32 nIndex;
     sal_uInt32 nOrder;
-    ::boost::shared_ptr<SwDepend> pFrameDepend;
+    std::shared_ptr<sw::FrameClient> pFrameClient;
 
-    FrameDependSortListEntry (sal_Int32 const i_nIndex,
-                sal_uInt32 const i_nOrder, SwDepend * const i_pDepend)
-        : nIndex(i_nIndex), nOrder(i_nOrder), pFrameDepend(i_pDepend) { }
+    FrameClientSortListEntry (sal_Int32 const i_nIndex,
+                sal_uInt32 const i_nOrder, sw::FrameClient* const i_pClient)
+        : nIndex(i_nIndex), nOrder(i_nOrder), pFrameClient(i_pClient) { }
 };
 
-typedef ::std::deque< FrameDependSortListEntry >
-    FrameDependSortList_t;
+typedef ::std::deque< FrameClientSortListEntry >
+    FrameClientSortList_t;
 
-typedef ::std::deque< ::boost::shared_ptr<SwDepend> >
-    FrameDependList_t;
+typedef ::std::deque< std::shared_ptr<sw::FrameClient> >
+    FrameClientList_t;
 
 // #i28701# - adjust 4th parameter
-void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
-                         FrameDependSortList_t & rFrames,
-                         const bool _bAtCharAnchoredObjs );
+void CollectFrameAtNode( const SwNodeIndex& rIdx,
+                         FrameClientSortList_t& rFrames,
+                         const bool bAtCharAnchoredObjs );
 
 enum ParaFrameMode
 {
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 20883e4..1489d8b 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -155,20 +155,19 @@ void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget)
 
 } // namespace sw
 
-struct FrameDependSortListLess
+struct FrameClientSortListLess
 {
-    bool operator() (FrameDependSortListEntry const& r1,
-                     FrameDependSortListEntry const& r2) const
+    bool operator() (FrameClientSortListEntry const& r1,
+                     FrameClientSortListEntry const& r2) const
     {
         return  (r1.nIndex <  r2.nIndex)
             || ((r1.nIndex == r2.nIndex) && (r1.nOrder < r2.nOrder));
     }
 };
 
-// OD 2004-05-07 #i28701# - adjust 4th parameter
-void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
-                         FrameDependSortList_t & rFrames,
-                         const bool _bAtCharAnchoredObjs )
+void CollectFrameAtNode( const SwNodeIndex& rIdx,
+                         FrameClientSortList_t& rFrames,
+                         const bool bAtCharAnchoredObjs )
 {
     // _bAtCharAnchoredObjs:
     // <true>: at-character anchored objects are collected
@@ -177,7 +176,7 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
     // search all borders, images, and OLEs that are connected to the paragraph
     SwDoc* pDoc = rIdx.GetNode().GetDoc();
 
-    const sal_uInt16 nChkType = static_cast< sal_uInt16 >((_bAtCharAnchoredObjs)
+    const sal_uInt16 nChkType = static_cast< sal_uInt16 >((bAtCharAnchoredObjs)
             ? FLY_AT_CHAR : FLY_AT_PARA);
     const SwContentFrm* pCFrm;
     const SwContentNode* pCNd;
@@ -201,14 +200,14 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
                 if ( rFormat.GetAnchor().GetAnchorId() == nChkType )
                 {
                     // create SwDepend and insert into array
-                    SwDepend* pNewDepend = new SwDepend( &rClnt, &rFormat );
+                    sw::FrameClient* pNewClient = new sw::FrameClient( &rFormat );
                     const sal_Int32 idx =
                         rFormat.GetAnchor().GetContentAnchor()->nContent.GetIndex();
                     sal_uInt32 nOrder = rFormat.GetAnchor().GetOrder();
 
                     // OD 2004-05-07 #i28701# - sorting no longer needed,
                     // because list <SwSortedObjs> is already sorted.
-                    FrameDependSortListEntry entry(idx, nOrder, pNewDepend);
+                    FrameClientSortListEntry entry(idx, nOrder, pNewClient);
                     rFrames.push_back(entry);
                 }
             }
@@ -227,18 +226,18 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
                 0 != (pAnchorPos = rAnchor.GetContentAnchor()) &&
                     pAnchorPos->nNode == rIdx )
             {
-                SwDepend* pNewDepend = new SwDepend( &rClnt, const_cast<SwFrameFormat*>(pFormat));
+                sw::FrameClient* pNewClient = new sw::FrameClient(const_cast<SwFrameFormat*>(pFormat));
 
                 // OD 2004-05-07 #i28701# - determine insert position for
                 // sorted <rFrameArr>
                 const sal_Int32 nIndex = pAnchorPos->nContent.GetIndex();
                 sal_uInt32 nOrder = rAnchor.GetOrder();
 
-                FrameDependSortListEntry entry(nIndex, nOrder, pNewDepend);
+                FrameClientSortListEntry entry(nIndex, nOrder, pNewClient);
                 rFrames.push_back(entry);
             }
         }
-        ::std::sort(rFrames.begin(), rFrames.end(), FrameDependSortListLess());
+        ::std::sort(rFrames.begin(), rFrames.end(), FrameClientSortListLess());
     }
 }
 
@@ -1576,19 +1575,16 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
     pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
 }
 
-class SwXParaFrameEnumeration::Impl
-    : public SwClient
+struct SwXParaFrameEnumeration::Impl
 {
-public:
     // created by hasMoreElements
     uno::Reference< text::XTextContent > m_xNextObject;
-    FrameDependList_t m_Frames;
-    ::std::shared_ptr<SwUnoCrsr> m_pUnoCursor;
+    FrameClientList_t m_Frames;
+    ::sw::UnoCursorPointer m_pUnoCursor;
 
     explicit Impl(SwPaM const & rPaM)
         : m_pUnoCursor(rPaM.GetDoc()->CreateUnoCrsr(*rPaM.GetPoint(), false))
     {
-        m_pUnoCursor->Add(this);
         if (rPaM.HasMark())
         {
             GetCursor()->SetMark();
@@ -1596,60 +1592,29 @@ public:
         }
     }
 
-    virtual ~Impl() {
-        if(m_pUnoCursor)
-            m_pUnoCursor->Remove(this);
-        // Impl owns the cursor; delete it here: SolarMutex is locked
-    }
-
-    SwUnoCrsr * GetCursor() {
-        return static_cast<SwUnoCrsr*>(
-                GetRegisteredIn());
-    }
-
-protected:
-    // SwClient
-    virtual void Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
-    virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) SAL_OVERRIDE;
-};
-
-struct InvalidFrameDepend {
-    bool operator() (::boost::shared_ptr<SwDepend> const & rEntry)
-    { return !rEntry->GetRegisteredIn(); }
-};
-
-void SwXParaFrameEnumeration::Impl::Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew)
-{
-    ClientModify(this, pOld, pNew);
-    if(!GetRegisteredIn())
-    {
-        m_Frames.clear();
-        m_xNextObject = 0;
-    }
-    else
-    {
-        // check if any frame went away...
-        FrameDependList_t::iterator const iter =
-            ::std::remove_if(m_Frames.begin(), m_Frames.end(),
-                    InvalidFrameDepend());
-        m_Frames.erase(iter, m_Frames.end());
-    }
-}
-
-void SwXParaFrameEnumeration::Impl::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    SwClient::SwClientNotify(rModify, rHint);
-    if(m_pUnoCursor && typeid(rHint) == typeid(sw::DocDisposingHint))
+    SwUnoCrsr* GetCursor()
+        { return &(*m_pUnoCursor); }
+    void PurgeFrameClients()
     {
-        m_pUnoCursor->Remove(this);
-        m_pUnoCursor.reset();
+        if(!m_pUnoCursor)
+        {
+            m_Frames.clear();
+            m_xNextObject = nullptr;
+        }
+        else
+        {
+            // removing orphaned SwDepends
+            const auto iter = std::remove_if(m_Frames.begin(), m_Frames.end(),
+                    [] (std::shared_ptr<sw::FrameClient>& rEntry) -> bool { return !rEntry->GetRegisteredIn(); });
+            m_Frames.erase(iter, m_Frames.end());
+        }
     }
-}
+};
 
 static bool
 lcl_CreateNextObject(SwUnoCrsr& i_rUnoCrsr,
         uno::Reference<text::XTextContent> & o_rNextObject,
-        FrameDependList_t & i_rFrames)
+        FrameClientList_t & i_rFrames)
 {
     if (!i_rFrames.size())
         return false;
@@ -1700,8 +1665,7 @@ lcl_CreateNextObject(SwUnoCrsr& i_rUnoCrsr,
 // Search for a FLYCNT text attribute at the cursor point and fill the frame
 // into the array
 static void
-lcl_FillFrame(SwClient & rEnum, SwUnoCrsr& rUnoCrsr,
-        FrameDependList_t & rFrames)
+lcl_FillFrame(SwUnoCrsr& rUnoCrsr, FrameClientList_t & rFrames)
 {
     // search for objects at the cursor - anchored at/as char
     SwTextAttr const*const pTextAttr = (rUnoCrsr.GetNode().IsTextNode())
@@ -1712,8 +1676,8 @@ lcl_FillFrame(SwClient & rEnum, SwUnoCrsr& rUnoCrsr,
     {
         const SwFormatFlyCnt& rFlyCnt = pTextAttr->GetFlyCnt();
         SwFrameFormat * const  pFrameFormat = rFlyCnt.GetFrameFormat();
-        SwDepend * const pNewDepend = new SwDepend(&rEnum, pFrameFormat);
-        rFrames.push_back( ::boost::shared_ptr<SwDepend>(pNewDepend) );
+        sw::FrameClient* const pNewClient = new sw::FrameClient(pFrameFormat);
+        rFrames.push_back( std::shared_ptr<sw::FrameClient>(pNewClient) );
     }
 }
 
@@ -1724,18 +1688,18 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(
 {
     if (PARAFRAME_PORTION_PARAGRAPH == eParaFrameMode)
     {
-        FrameDependSortList_t frames;
-        ::CollectFrameAtNode(*m_pImpl.get(), rPaM.GetPoint()->nNode,
+        FrameClientSortList_t frames;
+        ::CollectFrameAtNode(rPaM.GetPoint()->nNode,
                 frames, false);
         ::std::transform(frames.begin(), frames.end(),
             ::std::back_inserter(m_pImpl->m_Frames),
-            ::boost::bind(&FrameDependSortListEntry::pFrameDepend, _1));
+            ::boost::bind(&FrameClientSortListEntry::pFrameClient, _1));
     }
     else if (pFormat)
     {
         // create SwDepend for frame and insert into array
-        SwDepend *const pNewDepend = new SwDepend(m_pImpl.get(), pFormat);
-        m_pImpl->m_Frames.push_back(::boost::shared_ptr<SwDepend>(pNewDepend));
+        sw::FrameClient* const pNewClient = new sw::FrameClient(pFormat);
+        m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(pNewClient));
     }
     else if ((PARAFRAME_PORTION_CHAR == eParaFrameMode) ||
              (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode))
@@ -1750,12 +1714,12 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(
                 SwFrameFormat *const pFrameFormat = const_cast<SwFrameFormat*>(&((*aIter)->GetFormat()));
 
                 // create SwDepend for frame and insert into array
-                SwDepend *const pNewDepend = new SwDepend(m_pImpl.get(), pFrameFormat);
-                m_pImpl->m_Frames.push_back(::boost::shared_ptr<SwDepend>(pNewDepend));
+                sw::FrameClient* const pNewClient = new sw::FrameClient(pFrameFormat);
+                m_pImpl->m_Frames.push_back(std::shared_ptr<sw::FrameClient>(pNewClient));
             }
         }
 
-        lcl_FillFrame(*m_pImpl.get(), *m_pImpl->GetCursor(), m_pImpl->m_Frames);
+        lcl_FillFrame(*m_pImpl->GetCursor(), m_pImpl->m_Frames);
     }
 }
 
@@ -1767,10 +1731,9 @@ sal_Bool SAL_CALL
 SwXParaFrameEnumeration::hasMoreElements() throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-
     if (!m_pImpl->GetCursor())
         throw uno::RuntimeException();
-
+    m_pImpl->PurgeFrameClients();
     return m_pImpl->m_xNextObject.is() ||
         lcl_CreateNextObject(*m_pImpl->GetCursor(),m_pImpl->m_xNextObject, m_pImpl->m_Frames);
 }
@@ -1780,12 +1743,9 @@ throw (container::NoSuchElementException,
         lang::WrappedTargetException, uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-
     if (!m_pImpl->GetCursor())
-    {
         throw uno::RuntimeException();
-    }
-
+    m_pImpl->PurgeFrameClients();
     if (!m_pImpl->m_xNextObject.is() && m_pImpl->m_Frames.size())
     {
         lcl_CreateNextObject(*m_pImpl->GetCursor(),
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 0417bbe..d3cf0bb 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -80,7 +80,7 @@ static void lcl_CreatePortions(
     TextRangeList_t & i_rPortions,
     uno::Reference< text::XText > const& i_xParentText,
     SwUnoCrsr* pUnoCrsr,
-    FrameDependSortList_t & i_rFrames,
+    FrameClientSortList_t & i_rFrames,
     const sal_Int32 i_nStartPos, const sal_Int32 i_nEndPos );
 
 namespace
@@ -371,8 +371,8 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
             "start or end value invalid!");
 
     // find all frames, graphics and OLEs that are bound AT character in para
-    FrameDependSortList_t frames;
-    ::CollectFrameAtNode(*this, m_pUnoCrsr->GetPoint()->nNode, frames, true);
+    FrameClientSortList_t frames;
+    ::CollectFrameAtNode(m_pUnoCrsr->GetPoint()->nNode, frames, true);
     lcl_CreatePortions(m_Portions, xParentText, m_pUnoCrsr.get(), frames, nStart, nEnd);
 }
 
@@ -1187,7 +1187,7 @@ static sal_Int32 lcl_ExportFrames(
     TextRangeList_t & rPortions,
     Reference<XText> const & i_xParent,
     SwUnoCrsr * const i_pUnoCrsr,
-    FrameDependSortList_t & i_rFrames,
+    FrameClientSortList_t & i_rFrames,
     sal_Int32 const i_nCurrentIndex)
 {
     // Ignore frames which are not exported, as we are exporting a selection
@@ -1200,7 +1200,7 @@ static sal_Int32 lcl_ExportFrames(
     // do not check for i_nEnd here; this is done implicity by lcl_MoveCursor
     {
         const SwModify * const pFrame =
-            i_rFrames.front().pFrameDepend->GetRegisteredIn();
+            i_rFrames.front().pFrameClient->GetRegisteredIn();
         if (pFrame) // Frame could be disposed
         {
             SwXTextPortion* pPortion = new SwXTextPortion(i_pUnoCrsr, i_xParent,
@@ -1243,7 +1243,7 @@ static void lcl_CreatePortions(
         TextRangeList_t & i_rPortions,
         uno::Reference< text::XText > const & i_xParentText,
         SwUnoCrsr * const pUnoCrsr,
-        FrameDependSortList_t & i_rFrames,
+        FrameClientSortList_t & i_rFrames,
         const sal_Int32 i_nStartPos,
         const sal_Int32 i_nEndPos )
 {
commit 4186d572133470a846399921764e55007fd5395f
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun May 31 02:12:47 2015 +0200

    inline trivial oneliners
    
    Change-Id: I20b993f1775b2db9865487ed84c60e07fd0a4ced

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 265f23c..20883e4 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -470,9 +470,12 @@ struct SwXParagraphEnumerationImpl SAL_FINAL : public SwXParagraphEnumeration
     }
 
     // XServiceInfo
-    virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return OUString("SwXParagraphEnumeration"); }
+    virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return cppu::supportsService(this, rServiceName); };
+    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return {"com.sun.star.text.ParagraphEnumeration"}; };
 
     // XEnumeration
     virtual sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -494,24 +497,6 @@ SwXParagraphEnumeration* SwXParagraphEnumeration::Create(
     return new SwXParagraphEnumerationImpl(xParent, pCursor, eType, pStartNode, pTable);
 }
 
-OUString SAL_CALL
-SwXParagraphEnumerationImpl::getImplementationName() throw (uno::RuntimeException, std::exception)
-{
-    return OUString("SwXParagraphEnumeration");
-}
-
-sal_Bool SAL_CALL
-SwXParagraphEnumerationImpl::supportsService(const OUString& rServiceName) throw (uno::RuntimeException, std::exception)
-{
-    return cppu::supportsService(this, rServiceName);
-}
-
-uno::Sequence< OUString > SAL_CALL
-SwXParagraphEnumerationImpl::getSupportedServiceNames() throw (uno::RuntimeException, std::exception)
-{
-    return {"com.sun.star.text.ParagraphEnumeration"};
-}
-
 sal_Bool SAL_CALL
 SwXParagraphEnumerationImpl::hasMoreElements() throw (uno::RuntimeException, std::exception)
 {
@@ -1473,13 +1458,18 @@ struct SwXTextRangesImpl SAL_FINAL : public SwXTextRanges
     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
     // XServiceInfo
-    virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return OUString("SwXTextRanges"); };
+    virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return cppu::supportsService(this, rServiceName); };

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list