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

matteocam matteo.campanelli at gmail.com
Wed Jul 15 23:13:26 PDT 2015


 editeng/source/outliner/overflowingtxt.cxx |    4 +--
 include/svx/textchain.hxx                  |    2 -
 svx/source/svdraw/svdedxv.cxx              |   28 +++++++++++++++++++++++++++
 svx/source/svdraw/svdotext.cxx             |    2 -
 svx/source/svdraw/textchainflow.cxx        |   30 +++++++++++++++--------------
 5 files changed, 48 insertions(+), 18 deletions(-)

New commits:
commit 8a370da33bbca5ecdb8c8d0551625f7bc843af8d
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 17:27:05 2015 -0400

    Right arrow at last para moves to next link
    
    Change-Id: Ic7e567d3d3120e0f8e2860cb90aa855dc68f760d

diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index e708471..4f857fc 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1296,13 +1296,24 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
         SdrOutliner *pOutl = GetTextEditOutliner();
         sal_Int32 nLastPara = pOutl->GetParagraphCount()-1;
 
-        if (eFunc ==  KeyFuncType::DONTKNOW && nCode == KEY_RIGHT && aCurSel.nEndPara == nLastPara) {
+        SdrTextObj* pTextObj = NULL;
+        if (mxTextEditObj.is())
+            pTextObj= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
+
+        // XXX: Add check for last position in the para
+        if (pTextObj && pTextObj->IsChainable() && pTextObj->GetNextLinkInChain() &&
+            eFunc ==  KeyFuncType::DONTKNOW && nCode == KEY_RIGHT && aCurSel.nEndPara == nLastPara) {
             fprintf(stderr, "[CHAIN - CURSOR] Trying to move to next box\n" );
 
+            // Move to next box
+            SdrEndTextEdit();
+            SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
+            SdrBeginTextEdit(pNextLink);
+
             // XXX: Careful with the checks below for pWin and co. You should do them here I guess.
             return true;
         } else
-        // Old code from here
+        // FIXME(matteocam): Old code from here
         if (pTextEditOutlinerView->PostKeyEvent(rKEvt, pWin))
         {
             if( pMod )
commit 733cd3bb573e7904f565b0ad071d3b133b429dae
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 17:19:22 2015 -0400

    First experiment with right arrow key to move to next link
    
    Change-Id: If2c67ec0a8f87ba05098abeeaea72237d648257d

diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 4bbb28d..e708471 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1286,6 +1286,23 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
 {
     if(pTextEditOutlinerView)
     {
+        // XXX: Find a clean way to do this (even cleaner than the code commented below)
+        // if( pTextEditOutlinerView->IsKeyEventPushingOutOfPage(rKevt, pWin)
+        //       pWin = HandleKeyPushingOutOfBox(rKevt);
+        KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
+        sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
+        ESelection aCurSel = pTextEditOutlinerView->GetSelection();
+
+        SdrOutliner *pOutl = GetTextEditOutliner();
+        sal_Int32 nLastPara = pOutl->GetParagraphCount()-1;
+
+        if (eFunc ==  KeyFuncType::DONTKNOW && nCode == KEY_RIGHT && aCurSel.nEndPara == nLastPara) {
+            fprintf(stderr, "[CHAIN - CURSOR] Trying to move to next box\n" );
+
+            // XXX: Careful with the checks below for pWin and co. You should do them here I guess.
+            return true;
+        } else
+        // Old code from here
         if (pTextEditOutlinerView->PostKeyEvent(rKEvt, pWin))
         {
             if( pMod )
commit 23e5c185b473ad6bb9fd4711b39a786872fef569
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 16:51:10 2015 -0400

    Revert "Broadcast changed text in target link when in static mode"
    
    This reverts commit cae895d03aab6ffe719f331c90699e4b6238ac97.

diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index d2667e9..4d6352f 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -204,7 +204,7 @@ void TextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl)
     // adds it to current outliner anyway (useful in static decomposition)
     pNonOverflOutl->SetText(*pNewText);
 
-    mpTargetLink->SetOutlinerParaObject(pNewText);
+    mpTargetLink->NbcSetOutlinerParaObject(pNewText);
     // For some reason the paper size is lost after last instruction, so we set it.
     pNonOverflOutl->SetPaperSize(Size(pNonOverflOutl->GetPaperSize().Width(),
                                       pNonOverflOutl->GetTextHeight()));
commit cae895d03aab6ffe719f331c90699e4b6238ac97
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 16:50:10 2015 -0400

    Broadcast changed text in target link when in static mode
    
    Change-Id: I20e72cfedfb4d690586ceb1e0470c8bef7f0dd9a

diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 4d6352f..d2667e9 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -204,7 +204,7 @@ void TextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl)
     // adds it to current outliner anyway (useful in static decomposition)
     pNonOverflOutl->SetText(*pNewText);
 
-    mpTargetLink->NbcSetOutlinerParaObject(pNewText);
+    mpTargetLink->SetOutlinerParaObject(pNewText);
     // For some reason the paper size is lost after last instruction, so we set it.
     pNonOverflOutl->SetPaperSize(Size(pNonOverflOutl->GetPaperSize().Width(),
                                       pNonOverflOutl->GetTextHeight()));
commit 1a9dda60fd4b6e6bcb59e752db9b8a0d43edde5b
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 16:37:55 2015 -0400

    Revert "Experiment: allowing recursive textchainflow calls"
    
    This reverts commit 974793220584cae1aab28e43a57a0ec19019e7d2.

diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index bdd3659..b627b77 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1425,7 +1425,7 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL
 
 void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutliner) const
 {
-    //GetTextChain()->SetNilChainingEvent(this, true);
+    GetTextChain()->SetNilChainingEvent(this, true);
 
     TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
     bool bIsOverflow;
@@ -1451,7 +1451,7 @@ void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutlin
         aTxtChainFlow.ExecuteOverflow(&rOutliner, &rChainingOutl);
     }
 
-    //GetTextChain()->SetNilChainingEvent(this, false);
+    GetTextChain()->SetNilChainingEvent(this, false);
 }
 
 void SdrTextObj::impDecomposeChainedTextPrimitive(
commit 974793220584cae1aab28e43a57a0ec19019e7d2
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 16:36:57 2015 -0400

    Experiment: allowing recursive textchainflow calls
    
    Change-Id: Ie028eaf56cb7910f6f56104f25ec10dd2f02acbb

diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index b627b77..bdd3659 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1425,7 +1425,7 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL
 
 void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutliner) const
 {
-    GetTextChain()->SetNilChainingEvent(this, true);
+    //GetTextChain()->SetNilChainingEvent(this, true);
 
     TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
     bool bIsOverflow;
@@ -1451,7 +1451,7 @@ void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutlin
         aTxtChainFlow.ExecuteOverflow(&rOutliner, &rChainingOutl);
     }
 
-    GetTextChain()->SetNilChainingEvent(this, false);
+    //GetTextChain()->SetNilChainingEvent(this, false);
 }
 
 void SdrTextObj::impDecomposeChainedTextPrimitive(
commit d525fcbda4360c0ce0a09b0f92d6a3194be92305
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 16:16:50 2015 -0400

    Comment on initial value of deepMerge
    
    Change-Id: I7201689975b06af28795e0f081f9bd637ef5b01c

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 8d0ae47..91fdef8 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -117,7 +117,7 @@ class ImpChainLinkProperties
         INIT_CHAIN_PROP(CursorEvent, CursorChainingEvent::NULL_EVENT)
         INIT_CHAIN_PROP(PreChainingSel, ESelection(0,0,0,0));
         INIT_CHAIN_PROP(PostChainingSel, ESelection(0,0,0,0));
-        INIT_CHAIN_PROP(IsPartOfLastParaInNextLink, false)
+        INIT_CHAIN_PROP(IsPartOfLastParaInNextLink, false) // XXX: Should come from file
     }
 
     private:
commit 1fda6cd7b06d92904064517457046305809ab3ca
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 16:11:42 2015 -0400

    Change deep merge state only if we are moving text
    
    Change-Id: I49cfa24661cf7fb038a71a4a2c33dc3ae5365e29

diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index baea465..4d6352f 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -109,18 +109,6 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
                       new UFlowChainedText(pFlowOutl, bMustMergeParaAmongLinks) :
                       NULL;
 
-    // update new state on paragraph merging
-    if (bOverflow) {
-        fprintf(stderr, "[DEEPMERGE] Setting deepMerge to %d\n", mpOverflChText->IsLastParaInterrupted());
-        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();
 
@@ -235,6 +223,12 @@ void TextChainFlow::impMoveChainedTextToNextLink(SdrOutliner *pOverflOutl)
     fprintf(stderr, "[TEXTCHAINFLOW - OF] DEST box set to %d paras \n", pNewText->GetTextObject().GetParagraphCount());
     if (pNewText)
         mpNextLink->NbcSetOutlinerParaObject(pNewText);
+
+    // Set Deep Merge status
+    fprintf(stderr, "[DEEPMERGE] Setting deepMerge to %d\n", mpOverflChText->IsLastParaInterrupted());
+    GetTextChain()->SetIsPartOfLastParaInNextLink(
+                          mpTargetLink,
+                          mpOverflChText->IsLastParaInterrupted());
 }
 
 OutlinerParaObject *TextChainFlow::impGetNonOverflowingParaObject(SdrOutliner *pOutliner)
commit dee0c86635855b17bbfdb16732151d6ca15eb7a0
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 16:06:34 2015 -0400

    Output when deep merge changes
    
    Change-Id: Id11b067cbebe2c50b78aa0a96de620ff5c534e48

diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 4e17a14..baea465 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -111,6 +111,7 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
 
     // update new state on paragraph merging
     if (bOverflow) {
+        fprintf(stderr, "[DEEPMERGE] Setting deepMerge to %d\n", mpOverflChText->IsLastParaInterrupted());
         GetTextChain()->SetIsPartOfLastParaInNextLink(
                           mpTargetLink,
                           mpOverflChText->IsLastParaInterrupted());
commit f8ad64d55e4d8ecb19f31e814f6bc35ca89ee143
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 15:55:02 2015 -0400

    Change debugging output format
    
    Change-Id: I5679cdd673e59e87a8cea724fcdfc1f44f2c7741

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 567afd9..26b6296 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1987,7 +1987,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
 bool SdrTextObj::IsChainable() const
 {
     if (!GetName().startsWith("Chainable")) {
-        fprintf(stderr, "[CHAINABLE?] %p is _not_ chainable\n", this);
+        //fprintf(stderr, "[CHAINABLE?] %p is _not_ chainable\n", this);
         return false;
     }
 
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index a60f5bb..4e17a14 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -28,7 +28,7 @@
 TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget)
     : mpTargetLink(pChainTarget)
 {
-    fprintf(stderr, "[TEXTCHAINFLOW] Creating a new TextChainFlow\n");
+    fprintf(stderr, "\n[TEXTCHAINFLOW] Creating a new TextChainFlow\n");
 
     mpTextChain = mpTargetLink->GetTextChain();
     mpNextLink = mpTargetLink->GetNextLinkInChain();
commit cdf2d4be1a8c895141443328d704d002928cfbdd
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 15:42:23 2015 -0400

    Don't change global deep merge state after UF
    
    Change-Id: Iaa4abe230f439a2f6aefafcb212d2439fcc839cb

diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 607a2d6..a60f5bb 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -97,21 +97,28 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
     bool bMustMergeParaAmongLinks = GetTextChain()->GetIsPartOfLastParaInNextLink(mpTargetLink);
 
     // Set (Non)OverflowingTxt here (if any)
-    mpOverflChText = bOverflow ? new OFlowChainedText(pFlowOutl, bMustMergeParaAmongLinks) : NULL;
+
+    // If we had an underflow before we have to deep merge paras anyway
+    bool bMustMergeParaOF = bMustMergeParaAmongLinks || mbOFisUFinduced;
+    mpOverflChText = bOverflow ?
+                     new OFlowChainedText(pFlowOutl, bMustMergeParaOF) :
+                     NULL;
 
     // Set current underflowing text (if any)
-    mpUnderflChText = bUnderflow ? new UFlowChainedText(pFlowOutl, bMustMergeParaAmongLinks) : 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.
+    } /* 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();
commit 36e2eeccf1b24493abdc67ce71d9116a93a4e647
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 15 15:05:36 2015 -0400

    Fix the call to Deep Merging if mbIsDeepMerge==true
    
    Change-Id: I4c21afbd125744f311b4c98bfe706024339b54d1

diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 31b3d64..b015c28 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -221,10 +221,10 @@ OutlinerParaObject *OFlowChainedText::CreateOverflowingParaObject(Outliner *pOut
 
     if (mbIsDeepMerge) {
         fprintf(stderr, "[TEXTCHAINFLOW - OF] Deep merging paras\n" );
-        return mpOverflowingTxt->GetJuxtaposedParaObject(pOutliner, pTextToBeMerged );
+        return mpOverflowingTxt->GetDeeplyMergedParaObject(pOutliner, pTextToBeMerged );
     } else {
         fprintf(stderr, "[TEXTCHAINFLOW - OF] Juxtaposing paras\n" );
-        return mpOverflowingTxt->GetDeeplyMergedParaObject(pOutliner, pTextToBeMerged );
+        return mpOverflowingTxt->GetJuxtaposedParaObject(pOutliner, pTextToBeMerged );
     }
 }
 


More information about the Libreoffice-commits mailing list