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

matteocam matteo.campanelli at gmail.com
Thu Aug 20 09:02:27 PDT 2015


 editeng/source/editeng/impedit3.cxx |    6 ++++++
 svx/source/svdraw/textchainflow.cxx |   25 +++++--------------------
 2 files changed, 11 insertions(+), 20 deletions(-)

New commits:
commit b35661fab277d98e9b45df6626e947c1edd597dd
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Thu Aug 20 18:01:20 2015 +0200

    Set UpdateMode to true only if necessary
    
    Change-Id: If4c0517328271ce2b1c7e184981de6c2b7c14560

diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 9739eee..cad0b3c 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -71,12 +71,12 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
 {
     bool bOldUpdateMode = pFlowOutl->GetUpdateMode();
 
-    // We need this since it's required to check overflow
-    pFlowOutl->SetUpdateMode(true);
-
     // XXX: This could be reorganized moving most of this stuff inside EditingTextChainFlow
     if (pParamOutl != NULL)
     {
+        // We need this since it's required to check overflow
+        pFlowOutl->SetUpdateMode(true);
+
         // XXX: does this work if you do it before setting the text? Seems so.
         impSetFlowOutlinerParams(pFlowOutl, pParamOutl);
     }
@@ -105,7 +105,8 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
                       NULL;
 
     // Reset update mode // Reset it here because we use WriteRTF (needing updatemode = true) in the two constructors above
-    pFlowOutl->SetUpdateMode(bOldUpdateMode);
+    if (!bOldUpdateMode) // Reset only if the old value was false
+        pFlowOutl->SetUpdateMode(bOldUpdateMode);
 
     // NOTE: Must be called after mp*ChText abd b*flow have been set but before mbOFisUFinduced is reset
     impUpdateCursorInfo();
@@ -155,11 +156,6 @@ bool TextChainFlow::IsUnderflow() const
 // XXX:Would it be possible to unify undeflow and its possibly following overrflow?
 void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
 {
-    bool bOldUpdateMode = pOutl->GetUpdateMode();
-
-    // We need this since it's required by WriteRTF
-    pOutl->SetUpdateMode(true);
-
 
     //GetTextChain()->SetNilChainingEvent(mpTargetLink, true);
     // making whole text
@@ -180,9 +176,6 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
     pOutl->SetMaxAutoPaperSize(aOldSize);
     pOutl->SetText(*pNewText);
 
-    // Reset update mode
-    pOutl->SetUpdateMode(bOldUpdateMode);
-
     //GetTextChain()->SetNilChainingEvent(mpTargetLink, false);
 
     // Check for new overflow
@@ -191,11 +184,6 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
 
 void TextChainFlow::ExecuteOverflow(SdrOutliner *pNonOverflOutl, SdrOutliner *pOverflOutl)
 {
-    bool bOldUpdateMode = pNonOverflOutl->GetUpdateMode();
-
-    // We need this since it's required by WriteRTF
-    pNonOverflOutl->SetUpdateMode(true);
-
     //GetTextChain()->SetNilChainingEvent(mpTargetLink, true);
     // Leave only non overflowing text
     impLeaveOnlyNonOverflowingText(pNonOverflOutl);
@@ -206,9 +194,6 @@ void TextChainFlow::ExecuteOverflow(SdrOutliner *pNonOverflOutl, SdrOutliner *pO
         impMoveChainedTextToNextLink(pOverflOutl);
     }
 
-    // Reset update mode
-    pNonOverflOutl->SetUpdateMode(bOldUpdateMode);
-
     //GetTextChain()->SetNilChainingEvent(mpTargetLink, false);
 }
 
commit 0dccde9fc86aa74061d39e72c5139477d560c0a3
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Thu Aug 20 17:48:06 2015 +0200

    Show height of first line during OF check
    
    Change-Id: I20e5ca90cb147c841645fd28df0846f41a3dcb42

diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 7965a06..8a38539 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4658,6 +4658,12 @@ void ImpEditEngine::ImplUpdateOverflowingLineNum(sal_uInt32 nPaperHeight,
         EditLine &aLine = pPara->GetLines()[nLine];
         nLH = aLine.GetHeight();
         nY += nLH;
+
+        // Debugging output
+        if (nLine == 0) {
+            fprintf(stderr, "[CHAINING] First line has height %d\n", nLH);
+        }
+
         if ( nY > nPaperHeight ) // found first line overflowing
         {
             mnOverflowingLine = nLine;


More information about the Libreoffice-commits mailing list