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

matteocam matteo.campanelli at gmail.com
Wed Aug 5 04:23:02 PDT 2015


 include/svx/textchain.hxx             |   10 +++--
 svx/source/svdraw/svdotxed.cxx        |   16 ++++++++
 svx/source/svdraw/textchain.cxx       |   65 +---------------------------------
 svx/source/svdraw/textchaincursor.cxx |    7 +++
 4 files changed, 32 insertions(+), 66 deletions(-)

New commits:
commit 0cd61255022e054c795baf364b1a0e0ceca9cc76
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Aug 5 13:18:26 2015 +0200

    Handle Pending Overflow Check for domino chaining
    
    Change-Id: I9053f858c97f68f99cea3705e08e374aedc53107

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 631f646..91e8211 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -38,10 +38,10 @@
  *    in constructor of ImpChainLinkProperties below
  *    (V is the initialization value for PROPNAME)
  *
- * 2) Add
+ * 3) Add
  *      "DECL_CHAIN_PROP_INTERFACE(PROPNAME, T)"
  *    in class TextChain (under "public:");
- * 3)  Add
+ * 4)  Add
  *       "IMPL_CHAIN_PROP_INTERFACE(PROPNAME, T)"
  *    in file "svx/source/svdraw/textchain.cxx"
 */
@@ -119,15 +119,17 @@ class ImpChainLinkProperties
         INIT_CHAIN_PROP(PreChainingSel, ESelection(0,0,0,0));
         INIT_CHAIN_PROP(PostChainingSel, ESelection(0,0,0,0));
         INIT_CHAIN_PROP(IsPartOfLastParaInNextLink, false) // XXX: Should come from file
+        INIT_CHAIN_PROP(PendingOverflowCheck, false)
     }
 
     private:
-    // NOTE: Remember to set default value in contructor when adding field
+    // NOTE: Remember to set default value in constructor when adding field
     DECL_CHAIN_PROP(NilChainingEvent, bool)
     DECL_CHAIN_PROP(CursorEvent, CursorChainingEvent)
     DECL_CHAIN_PROP(PreChainingSel, ESelection)
     DECL_CHAIN_PROP(PostChainingSel, ESelection)
     DECL_CHAIN_PROP(IsPartOfLastParaInNextLink, bool)
+    DECL_CHAIN_PROP(PendingOverflowCheck, bool)
 
 };
 
@@ -154,6 +156,8 @@ class TextChain {
     DECL_CHAIN_PROP_INTERFACE(PostChainingSel, ESelection)
     // return whether a paragraph is split between this box and the next
     DECL_CHAIN_PROP_INTERFACE(IsPartOfLastParaInNextLink, bool)
+    // return whether there is a pending overflow check (usually when we move cursor after an overflow in the prev link)
+    DECL_CHAIN_PROP_INTERFACE(PendingOverflowCheck, bool)
 
 
 
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 72c6ca4..02c800fe 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -28,6 +28,7 @@
 #include <svl/itemset.hxx>
 #include <editeng/eeitem.hxx>
 #include <svx/sdtfchim.hxx>
+#include <svx/textchain.hxx>
 
 
 bool SdrTextObj::HasTextEdit() const
@@ -280,8 +281,23 @@ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
         SetOutlinerParaObject(pNewText);
     }
 
+    /* Beginning Chaining-related code */
     // we do not need the bookmark at the overflowing check anymore.
     rOutl.ClearOverflowingParaNum();
+    // XXX: Experiment
+    /* Flush overflow for next textbox */
+    if (IsChainable() &&
+        GetNextLinkInChain() &&
+        GetTextChain()->GetPendingOverflowCheck(GetNextLinkInChain()) )
+    {
+        GetTextChain()->SetPendingOverflowCheck(GetNextLinkInChain(), false);
+        // NEXT: Prepare outliner for overflow
+        SdrOutliner rDrawOutl = GetNextLinkInChain()->ImpGetDrawOutliner();
+        rDrawOutl.SetUpdateMode(true);
+        // XXX: Change name of method above to impHandleChainingEventsNonEditMode
+        GetNextLinkInChain()->impHandleChainingEventsDuringDecomposition(rDrawOutl);
+    }
+    /* End Chaining-related code */
 
     pEdtOutl = NULL;
     rOutl.Clear();
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index c19b924..911e006 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -30,6 +30,8 @@ IMPL_CHAIN_PROP_INTERFACE(NilChainingEvent, bool)
 IMPL_CHAIN_PROP_INTERFACE(PreChainingSel, ESelection)
 IMPL_CHAIN_PROP_INTERFACE(PostChainingSel, ESelection)
 IMPL_CHAIN_PROP_INTERFACE(IsPartOfLastParaInNextLink, bool)
+IMPL_CHAIN_PROP_INTERFACE(PendingOverflowCheck, bool)
+
 
 /* End Definition of Properties Interface */
 
@@ -46,69 +48,6 @@ TextChain::~TextChain()
     // XXX: Should free all LinkProperties
 }
 
-/*
-bool TextChain::IsLinkInChain(SdrTextObj *) const
-{
-    return true;    // XXX: Should make an actual check
-}
-
-void TextChain::AppendLink(SdrTextObj *)
-{
-    // XXX
-}
-
-SdrTextObj *TextChain::GetNextLink(const SdrTextObj *pTextObj) const
-{
-    return impGetNextLink(pTextObj);
-}
-
-SdrTextObj *TextChain::GetPrevLink(const SdrTextObj *pTextObj) const
-{
-    return impGetPrevLink(pTextObj);
-}
-
-SdrTextObj *TextChain::impGetNextLink(const SdrTextObj *pTextObj) const
-{
-    // XXX: Temporary implementation based on index number
-
-    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(const SdrTextObj *pTextObj) const
-{
-    SdrTextObj *pPrevTextObj = NULL;
-    SdrPage *pPage = pTextObj->pPage;
-
-    if ( pPage && pPage->GetObjCount() > 1) {
-
-        sal_Int32 prevIndex = (pTextObj->GetOrdNum()-1);
-
-        if (prevIndex >= 0)
-            pPrevTextObj =  dynamic_cast< SdrTextObj * >( pPage->GetObj( prevIndex ) );
-
-        return pPrevTextObj;
-    } else {
-        fprintf(stderr, "Make New Object please\n");
-        return NULL;
-    }
-}
-*/
-
-
 ImpChainLinkProperties *TextChain::GetLinkProperties(const SdrTextObj *pLink)
 {
     // if the guy does not already have properties in the map make them
diff --git a/svx/source/svdraw/textchaincursor.cxx b/svx/source/svdraw/textchaincursor.cxx
index 6daf59b..87c8f86 100644
--- a/svx/source/svdraw/textchaincursor.cxx
+++ b/svx/source/svdraw/textchaincursor.cxx
@@ -189,6 +189,13 @@ void TextChainCursorManager::impChangeEditingTextObj(SdrTextObj *pTargetTextObj,
 {
     assert(pTargetTextObj);
 
+    // To ensure that we check for overflow in the next box // This is handled in SdrTextObj::EndTextEdit
+    SdrTextObj *pNextLink = mpTextObj->GetNextLinkInChain();
+    TextChain *pTextChain = mpTextObj->GetTextChain();
+    // If we are moving forward
+    if (pNextLink && pTargetTextObj == pNextLink)
+        pTextChain->SetPendingOverflowCheck(pNextLink, true);
+
     mpEditView->SdrEndTextEdit();
     mpEditView->SdrBeginTextEdit(pTargetTextObj);
     // OutlinerView has changed, so we update the pointer


More information about the Libreoffice-commits mailing list