editeng/source/outliner/overflowingtxt.cxx |    9 +++++--
 include/editeng/overflowingtxt.hxx         |    8 +++++-
 include/svx/textchainflow.hxx              |    2 -
 svx/source/svdraw/textchainflow.cxx        |   34 +++++++++++++++++------------
 4 files changed, 33 insertions(+), 20 deletions(-)

New commits:
commit 0c01a319097cc79e3860d1ac3d760de912bbe887
Author: matteocam <matteo.campane...@gmail.com>
Date:   Mon Jul 13 12:32:43 2015 -0400

    Move logic for para merging to editeng
    
    Change-Id: I10ed532d8a42dbcb2f4c5aaa52f1848dde6745e6

diff --git a/editeng/source/outliner/overflowingtxt.cxx 
b/editeng/source/outliner/overflowingtxt.cxx
index 45e8f51..eb6bfe5 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -111,10 +111,12 @@ OutlinerParaObject 
*OverflowingText::GetJuxtaposedParaObject(Outliner *pOutl, Ou
 
 // class OFlowChainedText
 
-OFlowChainedText::OFlowChainedText(Outliner *pOutl)
+OFlowChainedText::OFlowChainedText(Outliner *pOutl, bool bIsDeepMerge)
 {
     mpOverflowingTxt = pOutl->GetOverflowingText();
     mpNonOverflowingTxt = pOutl->GetNonOverflowingText();
+
+    mbIsDeepMerge = bIsDeepMerge;
 }
 
 ESelection OFlowChainedText::GetInsertionPointSel() const
@@ -129,7 +131,7 @@ ESelection OFlowChainedText::GetOverflowPointSel() const
 
 OutlinerParaObject *OFlowChainedText::CreateOverflowingParaObject(Outliner 
*pOutliner, OutlinerParaObject *pTextToBeMerged)
 {
-    // Just return the roughly merged paras fpr now
+    // Just return the roughly merged paras for now
     if (mpOverflowingTxt == NULL || pTextToBeMerged == NULL)
         return NULL;
 
@@ -152,9 +154,10 @@ bool OFlowChainedText::IsLastParaInterrupted() const
 
 // classes UFlowChainedText
 
-UFlowChainedText::UFlowChainedText(Outliner *pOutl)
+UFlowChainedText::UFlowChainedText(Outliner *pOutl, bool bIsDeepMerge)
 {
     mpUnderflowPObj = pOutl->CreateParaObject();
+    mbIsDeepMerge = bIsDeepMerge;
 }
 
 OutlinerParaObject *UFlowChainedText::CreateMergedUnderflowParaObject(Outliner 
*pOutl, OutlinerParaObject *pNextLinkWholeText)
diff --git a/include/editeng/overflowingtxt.hxx 
b/include/editeng/overflowingtxt.hxx
index 2f63cea..345daa8 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -81,7 +81,7 @@ private:
 
 class EDITENG_DLLPUBLIC OFlowChainedText {
     public:
-        OFlowChainedText(Outliner *);
+        OFlowChainedText(Outliner *, bool );
 
         OutlinerParaObject *CreateOverflowingParaObject(Outliner *, 
OutlinerParaObject *);
         OutlinerParaObject *CreateNonOverflowingParaObject(Outliner *);
@@ -99,18 +99,22 @@ class EDITENG_DLLPUBLIC OFlowChainedText {
         NonOverflowingText *mpNonOverflowingTxt;
         OverflowingText *mpOverflowingTxt;
 
+        bool mbIsDeepMerge;
+
 };
 
 // UFlowChainedText is a simpler class than OFlowChainedText: it almost only 
joins para-objects
 class EDITENG_DLLPUBLIC UFlowChainedText {
     public:
-        UFlowChainedText(Outliner *);
+        UFlowChainedText(Outliner *, bool);
 
         OutlinerParaObject *CreateMergedUnderflowParaObject(Outliner *, 
OutlinerParaObject *);
     protected:
 
     private:
         OutlinerParaObject *mpUnderflowPObj;
+
+        bool mbIsDeepMerge;
 };
 
 #endif
diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 8e8ad62..f96ce59 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -104,8 +104,6 @@ class TextChainFlow {
     OFlowChainedText *mpOverflChText;
     UFlowChainedText *mpUnderflChText;
 
-    bool mbMustMergeParaAmongLinks;
-
 };
 
 
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index 50bddb5..57147d3 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -41,7 +41,6 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget)
     maCursorEvent = CursorChainingEvent::NULL_EVENT;
     mbPossiblyCursorOut = false;
 
-    mbMustMergeParaAmongLinks = false;
 }
 
 
@@ -90,11 +89,26 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
         pFlowOutl->SetUpdateMode(bOldUpdateMode);
     }
 
+    // Get old state on whether to merge para-s or not
+    // NOTE: We handle UF/OF using the _old_ state. The new one is simply saved
+    bool bMustMergeParaAmongLinks = 
GetTextChain()->GetIsPartOfLastParaInNextLink(mpTargetLink);
+
     // Set (Non)OverflowingTxt here (if any)
-    mpOverflChText = bOverflow ? new OFlowChainedText(pFlowOutl) : NULL;
+    mpOverflChText = bOverflow ? new OFlowChainedText(pFlowOutl, 
bMustMergeParaAmongLinks) : NULL;
 
     // Set current underflowing text (if any)
-    mpUnderflChText = bUnderflow ? new UFlowChainedText(pFlowOutl) : NULL;
+    mpUnderflChText = bUnderflow ? new UFlowChainedText(pFlowOutl, 
bMustMergeParaAmongLinks) : NULL;
+
+    // update new state on paragraph merging
+    if (bOverflow) {
+        GetTextChain()->SetIsPartOfLastParaInNextLink(
+                          mpTargetLink,
+                          mpOverflChText->IsLastParaInterrupted());
+    } else { // Overflows determine merging or not. If no OF, just merge 
everything next time.
+        GetTextChain()->SetIsPartOfLastParaInNextLink(
+                          mpTargetLink,
+                          true);
+    }
 
     // NOTE: Must be called after mp*ChText abd b*flow have been set but 
before mbOFisUFinduced is reset
     impUpdateCursorInfo();
@@ -102,13 +116,7 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
     // To check whether an overflow is underflow induced or not (useful in 
cursor checking)
     mbOFisUFinduced = bUnderflow;
 
-    // Save old state and update new
-    mbMustMergeParaAmongLinks = 
GetTextChain()->GetIsPartOfLastParaInNextLink(mpTargetLink);
 
-    if (bOverflow)
-        GetTextChain()->SetIsPartOfLastParaInNextLink(mpTargetLink, 
mpOverflChText->IsLastParaInterrupted());
-    else // Overflows determine merging or not. If no OF, just merge 
everything next time.
-        GetTextChain()->SetIsPartOfLastParaInNextLink(mpTargetLink, true);
 
 }
 
@@ -212,7 +220,7 @@ void 
TextChainFlow::impMoveChainedTextToNextLink(SdrOutliner *pOverflOutl)
 
 OutlinerParaObject *TextChainFlow::impGetNonOverflowingParaObject(SdrOutliner 
*pOutliner)
 {
-    return mpOverflChText->CreateNonOverflowingParaObject(pOutliner);
+        return mpOverflChText->CreateNonOverflowingParaObject(pOutliner);
 }
 
 SdrTextObj *TextChainFlow::GetLinkTarget() const
@@ -227,13 +235,13 @@ SdrTextObj *TextChainFlow::GetNextLink() const
 
 OutlinerParaObject *TextChainFlow::impGetOverflowingParaObject(SdrOutliner 
*pOutliner)
 {
-    return mpOverflChText->CreateOverflowingParaObject(pOutliner, 
mpNextLink->GetOutlinerParaObject());
+    return mpOverflChText->CreateOverflowingParaObject(pOutliner,
+                                                      
mpNextLink->GetOutlinerParaObject());
 }
 
 OutlinerParaObject *TextChainFlow::impGetMergedUnderflowParaObject(SdrOutliner 
*pOutliner)
 {
-    // Should check whether to merge paragraphs or not
-    return mpUnderflChText->CreateMergedUnderflowParaObject(pOutliner, 
mpNextLink->GetOutlinerParaObject());
+        return mpUnderflChText->CreateMergedUnderflowParaObject(pOutliner, 
mpNextLink->GetOutlinerParaObject());
 }
 
 TextChain *TextChainFlow::GetTextChain() const
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to