[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - include/svx svx/source

matteocam matteo.campanelli at gmail.com
Thu Jul 23 10:28:10 PDT 2015


 include/svx/textchain.hxx       |    8 ++++----
 svx/source/svdraw/svdotext.cxx  |   18 +++---------------
 svx/source/svdraw/textchain.cxx |   26 ++++++++++++++++++++------
 3 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit 03941b5adfa468372983331f39b9fabb962d5616
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Thu Jul 23 19:26:03 2015 +0200

    Move implementation of next link in TextChain
    
    Change-Id: If511e1d64af34d85470f1de5c43cbfb72651179e

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index ad929ed..41f0fc8 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -140,8 +140,8 @@ class TextChain {
     void AppendLink(SdrTextObj *);
     bool IsLinkInChain(SdrTextObj *) const;
 
-    SdrTextObj *GetNextLink(SdrTextObj *) const;
-    SdrTextObj *GetPrevLink(SdrTextObj *) const;
+    SdrTextObj *GetNextLink(const SdrTextObj *) const;
+    SdrTextObj *GetPrevLink(const SdrTextObj *) const;
 
     ChainLinkId GetId(const SdrTextObj *) const;
     ImpChainLinkProperties *GetLinkProperties(const SdrTextObj *);
@@ -160,8 +160,8 @@ class TextChain {
     LinkPropertiesMap maLinkPropertiesMap;
 
     private:
-    SdrTextObj *impGetNextLink(SdrTextObj *) const;
-    SdrTextObj *impGetPrevLink(SdrTextObj *) const;
+    SdrTextObj *impGetNextLink(const SdrTextObj *) const;
+    SdrTextObj *impGetPrevLink(const SdrTextObj *) const;
 
 
 };
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index f315d01..35b481b 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2082,22 +2082,10 @@ void SdrTextObj::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
 
 SdrTextObj* SdrTextObj::GetNextLinkInChain() const
 {
-    /* FIXME(matteocam) return mpNextInChain; */
-    SdrTextObj *pNextTextObj = NULL;
-
-    if ( pPage && pPage->GetObjCount() > 1) {
-
-        sal_uInt32 nextIndex = (GetOrdNum()+1);
-
-        if (nextIndex < pPage->GetObjCount())
-            pNextTextObj =  dynamic_cast< SdrTextObj * >( pPage->GetObj( nextIndex ) );
-
-        return pNextTextObj;
-    } else {
-        fprintf(stderr, "Make New Object please\n");
-        return NULL;
-    }
+    if (GetTextChain())
+        return GetTextChain()->GetNextLink(this);
 
+    return NULL;
 }
 
 SdrTextObj* SdrTextObj::GetPrevLinkInChain() const
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 787b298..31ea1fd 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -19,6 +19,7 @@
 
 #include <svx/textchain.hxx>
 #include <svx/svdotext.hxx>
+#include <svx/svdpage.hxx>
 
 /*
  * Definition of Properties Interface
@@ -55,23 +56,36 @@ void TextChain::AppendLink(SdrTextObj *)
     // XXX
 }
 
-SdrTextObj *TextChain::GetNextLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::GetNextLink(const SdrTextObj *pTextObj) const
 {
     return impGetNextLink(pTextObj);
 }
 
-SdrTextObj *TextChain::GetPrevLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::GetPrevLink(const SdrTextObj *pTextObj) const
 {
     return impGetPrevLink(pTextObj);
 }
 
-SdrTextObj *TextChain::impGetNextLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::impGetNextLink(const SdrTextObj *pTextObj) const
 {
-    // XXX: To be implemented
-    return NULL;
+    SdrTextObj *pNextTextObj = NULL;
+    SdrPage *pPage = pTextObj->pPage;
+
+    if ( pPage && pPage->GetObjCount() > 1) {
+
+        sal_uInt32 nextIndex = (pTextObj->GetOrdNum()+1);
+
+        if (nextIndex < pPage->GetObjCount())
+            pNextTextObj =  dynamic_cast< SdrTextObj * >( pPage->GetObj( nextIndex ) );
+
+        return pNextTextObj;
+    } else {
+        fprintf(stderr, "Make New Object please\n");
+        return NULL;
+    }
 }
 
-SdrTextObj *TextChain::impGetPrevLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::impGetPrevLink(const SdrTextObj *pTextObj) const
 {
     // XXX: To be implemented
     return NULL;


More information about the Libreoffice-commits mailing list