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

matteocam matteo.campanelli at gmail.com
Thu Jun 18 20:34:56 PDT 2015


 include/svx/textchain.hxx       |    6 +++++-
 svx/source/svdraw/svdotext.cxx  |   11 +++++++++++
 svx/source/svdraw/textchain.cxx |   13 +++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 465d9d703de940244adb218e60a4f2f77b7c036d
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Thu Jun 18 23:33:28 2015 -0400

    Controlling for underflow handling
    
    Change-Id: I26fb6b4878e1bca1ea09872624631578a568896d

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 01798d5..a03bf57 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -41,7 +41,7 @@ class ImpChainLinkProperties
     ImpChainLinkProperties();
 
     bool bOverwriteOnOverflow;
-        // all kind of stuff such has MergeableFirstParagraphs or if overwrite should occurr on overflow
+    bool bHandlingUnderflow;
 };
 
 
@@ -60,9 +60,13 @@ class TextChain {
 
     // return whether a paragraph is split between the two links in the argument
     bool GetLinksHaveMergeableFirstPara(SdrTextObj *, SdrTextObj *);
+
     void SetOverwriteOnOverflow(SdrTextObj *, bool );
     bool GetOverwriteOnOverflow(SdrTextObj *pTarget);
 
+    bool GetLinkHandlingUnderflow(SdrTextObj *pTarget);
+    void SetLinkHandlingUnderflow(SdrTextObj *, bool);
+
     protected:
     LinkPropertiesMap maLinkPropertiesMap;
 };
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 8ac625e..911dadc 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1999,9 +1999,17 @@ void SdrTextObj::onUnderflowStatusEvent( )
     SdrTextObj *pNextLink = GetNextLinkInChain();
     SdrOutliner &aDrawOutliner = ImpGetDrawOutliner();
 
+    if (GetTextChain()->GetLinkHandlingUnderflow(this))
+    {
+        GetTextChain()->SetLinkHandlingUnderflow(this, false);
+        return;
+    }
+
     if (!pNextLink->HasText())
         return;
 
+
+
     //  1) get the text of the other guy and add it to the last paragraph
     // XXX: For now it's not merging anything just adding the while thing as a separate para
     OutlinerParaObject *pNextLinkWholeText = pNextLink->GetOutlinerParaObject();
@@ -2016,6 +2024,9 @@ void SdrTextObj::onUnderflowStatusEvent( )
         // (since this happens automatically by overflow we just "order to" reset the destination box's text)
         GetTextChain()->SetOverwriteOnOverflow(pNextLink, true);
 
+        // We make sure we don't handle underflow while handling underflow
+        GetTextChain()->SetLinkHandlingUnderflow(this, true);
+
         if (pEdtOutl != NULL)
             pEdtOutl->SetText(*pNewText);
 
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 3637d45..3e4f546 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -25,6 +25,7 @@ ImpChainLinkProperties::ImpChainLinkProperties()
 {
     // give defaults
     bOverwriteOnOverflow = false;
+    bHandlingUnderflow = false;
 }
 
 // XXX: All getters in the class assume that the guy is in the chain
@@ -59,6 +60,18 @@ bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* /* pPrevLink */, SdrT
     return false;
 }
 
+bool TextChain::GetLinkHandlingUnderflow(SdrTextObj *pTarget)
+{
+    ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+    return pLinkProperties->bHandlingUnderflow;
+}
+
+void TextChain::SetLinkHandlingUnderflow(SdrTextObj *pTarget, bool bHandlingUnderflow)
+{
+    ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+    pLinkProperties->bHandlingUnderflow = bHandlingUnderflow;
+}
+
 void TextChain::SetOverwriteOnOverflow(SdrTextObj *pTarget, bool bOverwrite)
 {
     ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);


More information about the Libreoffice-commits mailing list