include/svx/textchainflow.hxx               |   49 +++++++++++++++++++++++-----
 svx/source/svdraw/svdotextdecomposition.cxx |   44 +++++++++++++++++++++----
 2 files changed, 79 insertions(+), 14 deletions(-)

New commits:
commit d694690fd619c7be735551378f753cf6b84bb55f
Author: matteocam <matteo.campane...@gmail.com>
Date:   Thu Jun 25 18:14:28 2015 -0400

    Written mechanisms for static OF/UF in proper classes
    
    Change-Id: Ica4b774670ae2bf25b5f6ee66f55c120e3e6b005

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 5b4b7b5..e581965 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -20,22 +20,55 @@
 #ifndef INCLUDED_SVX_TEXTCHAINFLOW_HXX
 #define INCLUDED_SVX_TEXTCHAINFLOW_HXX
 
-#include <map>
-
-
 class SdrTextObj;
+class SdrOutliner;
+class NonOverflowingText;
+class OverflowingText;
+class TextChain;
 
-namespace rtl {
-    class OUString;
-}
+// XXX: Specialize class for Editing mode and non editing mode?
+// XXX: const qualifiers?
 
 class TextChainFlow {
 
     public:
-    TextChainFlow() {}
-    ~TextChainFlow() {}
+    TextChainFlow(SdrTextObj *pChainTarget);
+    ~TextChainFlow();
+
+    void CheckForFlowEvents(SdrOutliner *, SdrOutliner *);
+
+    bool IsOverflow();
+    bool IsUnderflow();
+
+    void ExecuteUnderflow(SdrOutliner *);
+    void ExecuteOverflow(SdrOutliner *, SdrOutliner *);
 
     protected:
+    TextChain *GetTextChain();
+
+    void impLeaveOnlyNonOverflowingText(SdrOutliner *);
+    void impMoveChainedTextToNextLink(SdrOutliner *);
+
+    OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner);
+    OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner);
+
+    private:
+
+    void impSetOutlinerToEmptyTxt(SdrOutliner *pOutliner);
+
+    SdrTextObj *mpTargetLink;
+    SdrTextObj *mpNextLink;
+
+    TextChain *mpTextChain;
+
+    bool bCheckedFlowEvents;
+
+    bool bUnderflow;
+    bool bOverflow;
+
+    OverflowingText *mpOverflowingTxt;
+    NonOverflowingText *mpNonOverflowingTxt;
+
 };
 
 #endif // INCLUDED_SVX_TEXTCHAINFLOW_HXX
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 70c4f2c..2ba2012 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -24,6 +24,7 @@
 #include <svx/svdotext.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/textchain.hxx>
+#include <svx/textchainflow.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <sdr/primitive2d/sdrtextprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
@@ -861,7 +862,7 @@ OutlinerParaObject 
*SdrTextObj::impGetOverflowingParaObject(SdrOutliner *pOutlin
     // Draw everything
     OutlinerParaObject *pNewText = pOutliner->CreateParaObject();
     return pNewText;
- }
+}
 
 void SdrTextObj::impMoveChainedTextToNextLink(SdrOutliner *pOutliner, 
SdrTextObj *pNextTextObj) const
 {
@@ -1638,6 +1639,36 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 
     /* Begin underflow handling */
 
+     // any parameter in the constructor?
+     // We need the outliner we get the overflow info from as well as
+     //  the outliner for "drawing" (e.g. a drawing or chaining outliner)
+     // maybe the latter ones can be passed at the time of overflow and such
+    TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
+    bool bIsOverflow;
+
+    aTxtChainFlow.CheckForFlowEvents(&rOutliner, NULL); // seconod parameter 
is to check whether you have to "prepare" the outliner's parameters
+
+    if (aTxtChainFlow.IsUnderflow() && !IsInEditMode())
+    {
+        // underflow-induced overflow
+        aTxtChainFlow.ExecuteUnderflow(&rOutliner);
+        bIsOverflow = aTxtChainFlow.IsOverflow();
+    } else {
+        bIsOverflow = aTxtChainFlow.IsOverflow();
+    }
+
+    if (bIsOverflow && !IsInEditMode()) {
+        // Initialize Chaining Outliner
+        SdrOutliner &rChainingOutl = pModel->GetChainingOutliner(this);
+        ImpInitDrawOutliner( rChainingOutl );
+        rChainingOutl.SetUpdateMode(true);
+
+        aTxtChainFlow.ExecuteOverflow(&rOutliner, &rChainingOutl);
+    }
+
+    /*
+
+    // Begin old code
     bool bIsPageUnderflow = !rOutliner.IsPageOverflow() && !IsInEditMode();
     if (bIsPageUnderflow) {
 
@@ -1646,7 +1677,6 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
             OutlinerParaObject *pNextLinkWholeText = 
pNextLink->GetOutlinerParaObject();
 
             // making whole text
-
             OutlinerParaObject *pCurText;
             pCurText = rOutliner.CreateParaObject(); // XXX: this is editing 
outliner in editing version
 
@@ -1662,19 +1692,19 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
             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
     if ( rOutliner.IsPageOverflow() && !IsInEditMode()) {
         // Save the overflowing text before changing the outliner's state
         const_cast<SdrTextObj*>(this)->mpOverflowingText = 
rOutliner.GetOverflowingText();
 
-        /* Leave only non overflowing text */
+        // Leave only non overflowing text
         impLeaveOnlyNonOverflowingText(&rOutliner);
 
         // Initialize Chaining Outliner
@@ -1682,7 +1712,7 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
         ImpInitDrawOutliner( rChainingOutl );
         rChainingOutl.SetUpdateMode(true);
 
-        /* Transfer of text to next link */
+        // Transfer of text to next link
         if (GetNextLinkInChain()
             && !GetPreventChainable() ) // we don't transfer text while 
dragging because of resizing
         {
@@ -1690,6 +1720,8 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
         }
 
     }
+
+    */
     /* End overflow handling */
 
     // set visualizing page at Outliner; needed e.g. for PageNumberField 
decomposition
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to