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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Thu Mar 19 18:25:54 PDT 2015


 sw/inc/calbck.hxx      |  166 +++++++++++++++++++++++--------------------------
 sw/qa/core/uwriter.cxx |   95 ++++++++++++++++++++++++++++
 2 files changed, 176 insertions(+), 85 deletions(-)

New commits:
commit 85e969fc230a49ea40fd3a799bc5828d3e7c2e95
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Mar 20 02:07:00 2015 +0100

    use IsChanged() some more
    
    Change-Id: Ic32f27fe5aa6be115af0d3f28252b98c7b1788a3

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 062ebdf..2af23b7 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -317,7 +317,7 @@ public:
     }
     TElementType* Next()
     {
-        if( m_pPosition == m_pCurrent )
+        if(!IsChanged())
             m_pPosition = GetRightOfPos();
         while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
             m_pPosition = GetRightOfPos();
@@ -352,7 +352,7 @@ public:
     }
     SwClient* Next()
     {
-        if( m_pPosition == m_pCurrent )
+        if(!IsChanged())
             m_pPosition = GetRightOfPos();
         return Sync();
     }
commit 87bc662386ffe53b8b4b1fa07deb0bb665fe39c9
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Thu Mar 19 03:23:24 2015 +0100

    add unittest
    
    Change-Id: Iba119145155ee13067565b1f314c85b0e6a8de85

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index e0860c8f..edfa241 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -60,6 +60,7 @@
 #include "scriptinfo.hxx"
 #include "IMark.hxx"
 #include "ring.hxx"
+#include "calbck.hxx"
 
 typedef tools::SvRef<SwDocShell> SwDocShellRef;
 
@@ -105,8 +106,10 @@ public:
     void testTransliterate();
     void testMarkMove();
     void testIntrusiveRing();
+    void testClientModify();
 
     CPPUNIT_TEST_SUITE(SwDocTest);
+
     CPPUNIT_TEST(testTransliterate);
     CPPUNIT_TEST(randomTest);
     CPPUNIT_TEST(testPageDescName);
@@ -134,6 +137,7 @@ public:
     CPPUNIT_TEST(testGraphicAnchorDeletion);
     CPPUNIT_TEST(testMarkMove);
     CPPUNIT_TEST(testIntrusiveRing);
+    CPPUNIT_TEST(testClientModify);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1384,6 +1388,97 @@ void SwDocTest::testIntrusiveRing()
     CPPUNIT_ASSERT_EQUAL(&foo, foo.GetPrev());
 }
 
+namespace
+{
+    struct TestModify : SwModify
+    {
+        TYPEINFO();
+    };
+    TYPEINIT1( TestModify, SwModify );
+    struct TestClient : SwClient
+    {
+        TYPEINFO();
+        int m_nModifyCount;
+        TestClient() : m_nModifyCount(0) {};
+        virtual void Modify( const SfxPoolItem*, const SfxPoolItem*)
+        {
+            ShowReg();
+            ++m_nModifyCount;
+        }
+
+        void ShowReg()
+        {
+            if(GetRegisteredIn())
+            {
+                std::cout << "TestClient " << this << " registered  in " << GetRegisteredIn() << std::endl;
+            }
+            else
+                std::cout << "TestClient " << this << " not registered " << std::endl;
+        }
+    };
+    TYPEINIT1( TestClient, SwClient );
+    struct OtherTestClient : SwClient
+        { TYPEINFO(); };
+    TYPEINIT1( OtherTestClient, SwClient );
+}
+void SwDocTest::testClientModify()
+{
+    TestModify aMod;
+    TestClient aClient1, aClient2;
+    aMod.Add(&aClient1);
+    aMod.Add(&aClient2);
+    CPPUNIT_ASSERT_EQUAL(aClient1.GetRegisteredIn(),static_cast<SwModify*>(&aMod));
+    CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(),static_cast<SwModify*>(&aMod));
+    aMod.ModifyBroadcast(nullptr, nullptr);
+    CPPUNIT_ASSERT_EQUAL(aClient1.m_nModifyCount,1);
+    CPPUNIT_ASSERT_EQUAL(aClient2.m_nModifyCount,1);
+    aMod.ModifyBroadcast(nullptr, nullptr);
+    CPPUNIT_ASSERT_EQUAL(aClient1.m_nModifyCount,2);
+    CPPUNIT_ASSERT_EQUAL(aClient2.m_nModifyCount,2);
+    CPPUNIT_ASSERT(!aClient1.IsA(TYPE(OtherTestClient)));
+    {
+        SwIterator<OtherTestClient,SwModify> aIter(aMod);
+        for(OtherTestClient* pClient = aIter.First(); pClient ; pClient = aIter.Next())
+            CPPUNIT_ASSERT(false);
+    }
+    {
+        int nCount = 0;
+        SwIterator<TestClient,SwModify> aIter(aMod);
+        for(TestClient* pClient = aIter.First(); pClient ; pClient = aIter.Next())
+        {
+            CPPUNIT_ASSERT_EQUAL(pClient->m_nModifyCount,2);
+            ++nCount;
+        }
+        CPPUNIT_ASSERT_EQUAL(nCount,2);
+    }
+    CPPUNIT_ASSERT_EQUAL(aClient1.GetRegisteredIn(),static_cast<SwModify*>(&aMod));
+    CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(),static_cast<SwModify*>(&aMod));
+    {
+        int nCount = 0;
+        SwIterator<TestClient,SwModify> aIter(aMod);
+        for(TestClient* pClient = aIter.First(); pClient ; pClient = aIter.Next())
+        {
+            aMod.Remove(pClient);
+            ++nCount;
+        }
+        CPPUNIT_ASSERT_EQUAL(nCount,2);
+    }
+    CPPUNIT_ASSERT_EQUAL(aClient1.GetRegisteredIn(), static_cast<SwModify*>(nullptr));
+    CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(), static_cast<SwModify*>(nullptr));
+    {
+        int nCount = 0;
+        SwIterator<TestClient,SwModify> aIter(aMod);
+        for(TestClient* pClient = aIter.First(); pClient ; pClient = aIter.Next())
+        {
+            CPPUNIT_ASSERT(false);
+        }
+        CPPUNIT_ASSERT_EQUAL(nCount,0);
+    }
+    aMod.ModifyBroadcast(nullptr, nullptr);
+    CPPUNIT_ASSERT_EQUAL(aClient1.m_nModifyCount,2);
+    CPPUNIT_ASSERT_EQUAL(aClient2.m_nModifyCount,2);
+}
+
 void SwDocTest::setUp()
 {
     BootstrapFixture::setUp();
commit 6934ad423afd43d4d5c3788d0c020164309aaffa
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Mar 18 18:03:00 2015 +0100

    remove spurious friend and forward-decl
    
    Change-Id: Iaba7852af44248b5479e5ea0c7ccf51561df4c2d

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 713277a..062ebdf 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -31,7 +31,6 @@
 
 
 class SwModify;
-class SwClientIter;
 class SfxPoolItem;
 class SfxHint;
 
@@ -79,7 +78,6 @@ namespace sw
     class SW_DLLPUBLIC WriterListener : ::boost::noncopyable
     {
         friend class ::SwModify;
-        friend class ::SwClient;
         friend class ::sw::ClientIteratorBase;
         private:
             WriterListener* m_pLeft;
commit 16fdd721631b7c93880f601b0253ad4053865d77
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Mar 18 17:36:44 2015 +0100

    introduce Sync() helper
    
    Change-Id: I9fbbb8fa1d0fee1b761143923c843658f3fd4053

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 516d8ab6..713277a 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -286,6 +286,8 @@ namespace sw
             // adding objects to a client chain in iteration is forbidden
             // SwModify::Add() asserts this
             bool IsChanged() const { return m_pPosition != m_pCurrent; }
+            // ensures the iterator to point at a current client
+            SwClient* Sync() { return m_pCurrent = m_pPosition; }
     };
 }
 
@@ -294,7 +296,6 @@ template< typename TElementType, typename TSource > class SwIterator SAL_FINAL :
     static_assert(std::is_base_of<SwClient,TElementType>::value, "TElementType needs to be derived from SwClient");
     static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify");
 public:
-
     SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {}
     TElementType* First()
     {
@@ -309,11 +310,11 @@ public:
         if(!m_pPosition)
             m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
         if(!m_pPosition)
-            return PTR_CAST(TElementType,m_pCurrent = nullptr);
+            return PTR_CAST(TElementType,Sync());
         while(GetRightOfPos())
             m_pPosition = GetRightOfPos();
         if(m_pPosition->IsA(TYPE(TElementType)))
-            return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
+            return PTR_CAST(TElementType,Sync());
         return Previous();
     }
     TElementType* Next()
@@ -322,14 +323,14 @@ public:
             m_pPosition = GetRightOfPos();
         while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
             m_pPosition = GetRightOfPos();
-        return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
+        return PTR_CAST(TElementType,Sync());
     }
     TElementType* Previous()
     {
         m_pPosition = GetLeftOfPos();
         while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
             m_pPosition = GetLeftOfPos();
-        return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
+        return PTR_CAST(TElementType,Sync());
     }
     using sw::ClientIteratorBase::IsChanged;
 };
@@ -349,18 +350,18 @@ public:
             return m_pCurrent = nullptr;
         while(GetRightOfPos())
             m_pPosition = GetRightOfPos();
-        return m_pCurrent = m_pPosition;
+        return Sync();
     }
     SwClient* Next()
     {
         if( m_pPosition == m_pCurrent )
             m_pPosition = GetRightOfPos();
-        return m_pCurrent = m_pPosition;
+        return Sync();
     }
     SwClient* Previous()
     {
         m_pPosition = GetLeftOfPos();
-        return m_pCurrent = m_pPosition;
+        return Sync();
     }
     using sw::ClientIteratorBase::IsChanged;
 };
commit b72b1011fe2548ff5d9507e39da1528a1c4c7503
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Mar 18 17:24:19 2015 +0100

    move IsChanged to shared base
    
    Change-Id: I1b70e51c2bb99db0e546793f0257e751c9129b47

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 76cdb6d..516d8ab6 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -331,7 +331,7 @@ public:
             m_pPosition = GetLeftOfPos();
         return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
     }
-    bool IsChanged()          { return sw::ClientIteratorBase::IsChanged(); }
+    using sw::ClientIteratorBase::IsChanged;
 };
 
 template< typename TSource > class SwIterator<SwClient, TSource> SAL_FINAL : private sw::ClientIteratorBase
@@ -362,7 +362,7 @@ public:
         m_pPosition = GetLeftOfPos();
         return m_pCurrent = m_pPosition;
     }
-    bool IsChanged()          { return sw::ClientIteratorBase::IsChanged(); }
+    using sw::ClientIteratorBase::IsChanged;
 };
 
 SwClient::SwClient( SwModify* pToRegisterIn )
commit feac7080db6c008088396223774f96a5acfc3fe0
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Mar 20 01:30:44 2015 +0100

    typo
    
    Change-Id: I5bbcb45312cb85c67ef1205b31e7ea4b0e944da8

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 5a48431..76cdb6d 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -267,7 +267,7 @@ namespace sw
                 m_pCurrent = m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
             }
             SwClient* GetLeftOfPos() { return static_cast<SwClient*>(m_pPosition->m_pLeft); }
-            SwClient* GetRighOfPos() { return static_cast<SwClient*>(m_pPosition->m_pRight); }
+            SwClient* GetRightOfPos() { return static_cast<SwClient*>(m_pPosition->m_pRight); }
             SwClient* GoStart()
             {
                 if((m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends())))
@@ -310,8 +310,8 @@ public:
             m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
         if(!m_pPosition)
             return PTR_CAST(TElementType,m_pCurrent = nullptr);
-        while(GetRighOfPos())
-            m_pPosition = GetRighOfPos();
+        while(GetRightOfPos())
+            m_pPosition = GetRightOfPos();
         if(m_pPosition->IsA(TYPE(TElementType)))
             return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
         return Previous();
@@ -319,9 +319,9 @@ public:
     TElementType* Next()
     {
         if( m_pPosition == m_pCurrent )
-            m_pPosition = GetRighOfPos();
+            m_pPosition = GetRightOfPos();
         while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
-            m_pPosition = GetRighOfPos();
+            m_pPosition = GetRightOfPos();
         return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
     }
     TElementType* Previous()
@@ -347,14 +347,14 @@ public:
             m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
         if(!m_pPosition)
             return m_pCurrent = nullptr;
-        while(GetRighOfPos())
-            m_pPosition = GetRighOfPos();
+        while(GetRightOfPos())
+            m_pPosition = GetRightOfPos();
         return m_pCurrent = m_pPosition;
     }
     SwClient* Next()
     {
         if( m_pPosition == m_pCurrent )
-            m_pPosition = GetRighOfPos();
+            m_pPosition = GetRightOfPos();
         return m_pCurrent = m_pPosition;
     }
     SwClient* Previous()
commit d83b2ae1cc7731b23a2fd735ea9f8d88f4357156
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Mar 18 17:02:51 2015 +0100

    derive SwIterator<> from ClientIteratorBase
    
    Change-Id: Ib0898e852f688863f8064ca773bc5a6947be44ad

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 0275c16..5a48431 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -245,127 +245,124 @@ protected:
 
 namespace sw
 {
-    class ClientIteratorBase SAL_FINAL : public sw::Ring< ::sw::ClientIteratorBase >
+    class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase >
     {
-        friend SwClient* SwModify::Remove(SwClient*);
-        friend void SwModify::Add(SwClient*);
-        template<typename E, typename S> friend class ::SwIterator; ///< for typed interation
-
-        const SwModify& m_rRoot;
-        // the current object in an iteration
-        SwClient* m_pCurrent;
-        // in case the current object is already removed, the next object in the list
-        // is marked down to become the current object in the next step
-        // this is necessary because iteration requires access to members of the current object
-        SwClient* m_pPosition;
-        static SW_DLLPUBLIC ClientIteratorBase* our_pClientIters;
-
-        ClientIteratorBase( const SwModify& rModify )
-            : m_rRoot(rModify)
-        {
-            MoveTo(our_pClientIters);
-            our_pClientIters = this;
-            m_pCurrent = m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
-        }
-        SwClient* GetLeftOfPos() { return static_cast<SwClient*>(m_pPosition->m_pLeft); }
-        SwClient* GetRighOfPos() { return static_cast<SwClient*>(m_pPosition->m_pRight); }
-        SwClient* GoStart()
-        {
-            if((m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends())))
-                while( m_pPosition->m_pLeft )
-                    m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft);
-            return m_pCurrent = m_pPosition;
-        }
-        ~ClientIteratorBase() SAL_OVERRIDE
-        {
-            assert(our_pClientIters);
-            if(our_pClientIters == this)
-                our_pClientIters = unique() ? nullptr : GetNextInRing();
-            MoveTo(nullptr);
-        }
-        // return "true" if an object was removed from a client chain in iteration
-        // adding objects to a client chain in iteration is forbidden
-        // SwModify::Add() asserts this
-        bool IsChanged() const { return m_pPosition != m_pCurrent; }
+            friend SwClient* SwModify::Remove(SwClient*);
+            friend void SwModify::Add(SwClient*);
+        protected:
+            const SwModify& m_rRoot;
+            // the current object in an iteration
+            SwClient* m_pCurrent;
+            // in case the current object is already removed, the next object in the list
+            // is marked down to become the current object in the next step
+            // this is necessary because iteration requires access to members of the current object
+            SwClient* m_pPosition;
+            static SW_DLLPUBLIC ClientIteratorBase* our_pClientIters;
+
+            ClientIteratorBase( const SwModify& rModify )
+                : m_rRoot(rModify)
+            {
+                MoveTo(our_pClientIters);
+                our_pClientIters = this;
+                m_pCurrent = m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
+            }
+            SwClient* GetLeftOfPos() { return static_cast<SwClient*>(m_pPosition->m_pLeft); }
+            SwClient* GetRighOfPos() { return static_cast<SwClient*>(m_pPosition->m_pRight); }
+            SwClient* GoStart()
+            {
+                if((m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends())))
+                    while( m_pPosition->m_pLeft )
+                        m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft);
+                return m_pCurrent = m_pPosition;
+            }
+            ~ClientIteratorBase() SAL_OVERRIDE
+            {
+                assert(our_pClientIters);
+                if(our_pClientIters == this)
+                    our_pClientIters = unique() ? nullptr : GetNextInRing();
+                MoveTo(nullptr);
+            }
+            // return "true" if an object was removed from a client chain in iteration
+            // adding objects to a client chain in iteration is forbidden
+            // SwModify::Add() asserts this
+            bool IsChanged() const { return m_pPosition != m_pCurrent; }
     };
 }
 
-template< typename TElementType, typename TSource > class SwIterator SAL_FINAL
+template< typename TElementType, typename TSource > class SwIterator SAL_FINAL : private sw::ClientIteratorBase
 {
     static_assert(std::is_base_of<SwClient,TElementType>::value, "TElementType needs to be derived from SwClient");
     static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify");
-    sw::ClientIteratorBase aClientIter;
 public:
 
-    SwIterator( const TSource& rSrc ) : aClientIter(rSrc) {}
+    SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {}
     TElementType* First()
     {
-        aClientIter.GoStart();
-        if(!aClientIter.m_pPosition)
+        GoStart();
+        if(!m_pPosition)
             return nullptr;
-        aClientIter.m_pCurrent = nullptr;
+        m_pCurrent = nullptr;
         return Next();
     }
     TElementType* Last()
     {
-        if(!aClientIter.m_pPosition)
-            aClientIter.m_pPosition = const_cast<SwClient*>(aClientIter.m_rRoot.GetDepends());
-        if(!aClientIter.m_pPosition)
-            return PTR_CAST(TElementType,aClientIter.m_pCurrent = nullptr);
-        while(aClientIter.GetRighOfPos())
-            aClientIter.m_pPosition = aClientIter.GetRighOfPos();
-        if(aClientIter.m_pPosition->IsA(TYPE(TElementType)))
-            return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition);
+        if(!m_pPosition)
+            m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
+        if(!m_pPosition)
+            return PTR_CAST(TElementType,m_pCurrent = nullptr);
+        while(GetRighOfPos())
+            m_pPosition = GetRighOfPos();
+        if(m_pPosition->IsA(TYPE(TElementType)))
+            return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
         return Previous();
     }
     TElementType* Next()
     {
-        if( aClientIter.m_pPosition == aClientIter.m_pCurrent )
-            aClientIter.m_pPosition = aClientIter.GetRighOfPos();
-        while(aClientIter.m_pPosition && !aClientIter.m_pPosition->IsA( TYPE(TElementType) ) )
-            aClientIter.m_pPosition = aClientIter.GetRighOfPos();
-        return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition);
+        if( m_pPosition == m_pCurrent )
+            m_pPosition = GetRighOfPos();
+        while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
+            m_pPosition = GetRighOfPos();
+        return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
     }
     TElementType* Previous()
     {
-        aClientIter.m_pPosition = aClientIter.GetLeftOfPos();
-        while(aClientIter.m_pPosition && !aClientIter.m_pPosition->IsA( TYPE(TElementType) ) )
-            aClientIter.m_pPosition = aClientIter.GetLeftOfPos();
-        return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition);
+        m_pPosition = GetLeftOfPos();
+        while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
+            m_pPosition = GetLeftOfPos();
+        return PTR_CAST(TElementType,m_pCurrent = m_pPosition);
     }
-    bool IsChanged()          { return aClientIter.IsChanged(); }
+    bool IsChanged()          { return sw::ClientIteratorBase::IsChanged(); }
 };
 
-template< typename TSource > class SwIterator<SwClient, TSource>
+template< typename TSource > class SwIterator<SwClient, TSource> SAL_FINAL : private sw::ClientIteratorBase
 {
     static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify");
-    sw::ClientIteratorBase aClientIter;
 public:
-    SwIterator( const TSource& rSrc ) : aClientIter(rSrc) {}
+    SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {}
     SwClient* First()
-        { return aClientIter.GoStart(); }
+        { return GoStart(); }
     SwClient* Last()
     {
-        if(!aClientIter.m_pPosition)
-            aClientIter.m_pPosition = const_cast<SwClient*>(aClientIter.m_rRoot.GetDepends());
-        if(!aClientIter.m_pPosition)
-            return aClientIter.m_pCurrent = nullptr;
-        while(aClientIter.GetRighOfPos())
-            aClientIter.m_pPosition = aClientIter.GetRighOfPos();
-        return aClientIter.m_pCurrent = aClientIter.m_pPosition;
+        if(!m_pPosition)
+            m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
+        if(!m_pPosition)
+            return m_pCurrent = nullptr;
+        while(GetRighOfPos())
+            m_pPosition = GetRighOfPos();
+        return m_pCurrent = m_pPosition;
     }
     SwClient* Next()
     {
-        if( aClientIter.m_pPosition == aClientIter.m_pCurrent )
-            aClientIter.m_pPosition = aClientIter.GetRighOfPos();
-        return aClientIter.m_pCurrent = aClientIter.m_pPosition;
+        if( m_pPosition == m_pCurrent )
+            m_pPosition = GetRighOfPos();
+        return m_pCurrent = m_pPosition;
     }
     SwClient* Previous()
     {
-        aClientIter.m_pPosition = aClientIter.GetLeftOfPos();
-        return aClientIter.m_pCurrent = aClientIter.m_pPosition;
+        m_pPosition = GetLeftOfPos();
+        return m_pCurrent = m_pPosition;
     }
-    bool IsChanged()          { return aClientIter.IsChanged(); }
+    bool IsChanged()          { return sw::ClientIteratorBase::IsChanged(); }
 };
 
 SwClient::SwClient( SwModify* pToRegisterIn )


More information about the Libreoffice-commits mailing list