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

matteocam matteo.campanelli at gmail.com
Mon Jun 22 13:10:00 PDT 2015


 svx/source/svdraw/svdotextdecomposition.cxx |   39 +++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

New commits:
commit 06ee5333d625bc56a7401d824dc6df6490cdde26
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Mon Jun 22 16:08:58 2015 -0400

    Underflow handling in static mode
    
    Change-Id: I2540ee4d5f26e7515bcedd127f6464ef81591443

diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index caa361e..37c2384 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1667,7 +1667,44 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
     // Sets original text
     rOutliner.SetText(*pOutlinerParaObject);
 
-    /* Begin overflow handling */
+    /* Begin underflow handling */
+
+    bool bIsPageUnderflow = rOutliner.IsPageOverflow() && !IsInEditMode();
+    if (bIsPageUnderflow) {
+
+        SdrTextObj *pNextLink = GetNextLinkInChain();
+        if (pNextLink && pNextLink->HasText()) {
+            OutlinerParaObject *pNextLinkWholeText = pNextLink->GetOutlinerParaObject();
+
+            // making whole text
+
+            OutlinerParaObject *pCurText;
+            pCurText = rOutliner.CreateParaObject(); // XXX: this is editing outliner in editing version
+
+            // NewTextForCurBox = Txt(CurBox) ++ Txt(NextBox)
+            rOutliner.SetText(*pCurText);
+            rOutliner.AddText(*pNextLinkWholeText);
+            OutlinerParaObject *pNewText = rOutliner.CreateParaObject();
+
+            // 2) Set the text of the next guy to what is left
+            // (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); // we don't need this in static decomp.
+
+            // Set the other box empty so if overflow does not occur we are fine
+            if (!GetPreventChainable())
+                pNextLink->NbcSetOutlinerParaObject(rOutliner.GetEmptyParaObject());
+
+            const_cast<SdrTextObj*>(this)->NbcSetOutlinerParaObject(pNewText);
+        }
+    } // You might be done at this point, unless there is an overflow and that's handled in std way.
+
+    /* End underflow handling */
+
+
+    /* Begin overflow handling */ // might be caused from underflow handling above
 
     // If overflow occurs we have to cut the text at the right point
     // If in edit mode ImpEditEngine should have taken care of this


More information about the Libreoffice-commits mailing list