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

matteocam matteo.campanelli at gmail.com
Wed Jul 8 06:33:24 PDT 2015


 editeng/source/outliner/overflowingtxt.cxx |   57 ++++++++++++++++++++---------
 include/editeng/overflowingtxt.hxx         |    7 +++
 svx/source/svdraw/textchainflow.cxx        |    5 +-
 3 files changed, 50 insertions(+), 19 deletions(-)

New commits:
commit abf19ac0252a7f21bb276ed98ee73312096eaf93
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 8 09:31:28 2015 -0400

    Save insertion point in dest box when making overflowing text
    
    Change-Id: If08717c89d424b3e248d628e289f00da2d340d94

diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 49284f6..77f4829 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -31,23 +31,8 @@ OutlinerParaObject *NonOverflowingText::ToParaObject(Outliner *pOutliner) const
     return pPObj;
 }
 
-/*
-OUString OverflowingText::GetEndingLines() const
-{
-    // If the only overflowing part is some lines in a paragraph,
-    // the end of the overflowing text is its head.
-    if (!HasOtherParas())
-        return mHeadTxt;
-
-    return mTailTxt;
-}
-
-OUString OverflowingText::GetHeadingLines() const
-{
-    return mHeadTxt;
-}
-* */
-
+// The equivalent of ToParaObject for OverflowingText. Here we are prepending the overflowing text to the old dest box's text
+// XXX: In a sense a better name for OverflowingText and NonOverflowingText are respectively DestLinkText and SourceLinkText
 OutlinerParaObject *OverflowingText::GetJuxtaposedParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj)
 {
     if (mpContentTextObj == NULL) {
@@ -59,14 +44,52 @@ OutlinerParaObject *OverflowingText::GetJuxtaposedParaObject(Outliner *pOutl, Ou
     OutlinerParaObject *pOverflowingPObj = new OutlinerParaObject(*mpContentTextObj);
     // the OutlinerParaObject constr. at the prev line gives no valid outliner mode, so we set it
     pOverflowingPObj->SetOutlinerMode(pOutl->GetOutlinerMode());
+
+    /* Actual Text Setting */
     pOutl->SetText(*pOverflowingPObj);
+
+    // Set selection position between new and old text
+    maInsertionPointSel = impGetEndSelection(pOutl);
+
     pOutl->AddText(*pNextPObj);
 
+    // End Text Setting
+
     OutlinerParaObject *pPObj = pOutl->CreateParaObject();
     //pPObj->SetOutlinerMode(pOutl->GetOutlinerMode());
     return pPObj;
 }
 
+ESelection OverflowingText::impGetEndSelection(Outliner *pOutl) const
+{
+    const sal_Int32 nParaCount = pOutl->GetParagraphCount();
+    const sal_Int32 nLastParaIndex = nParaCount > 1 ? nParaCount - 1 : 0;
+    Paragraph* pLastPara = pOutl->GetParagraph( nLastParaIndex);
+    const sal_Int32 nLenLastPara = pOutl->GetText(pLastPara).getLength();
+    // Selection at end of editing area
+    ESelection aEndSel(nLastParaIndex,nLenLastPara,nLastParaIndex,nLenLastPara);
+    return aEndSel;
+}
+
+/*
+OUString OverflowingText::GetEndingLines() const
+{
+    // If the only overflowing part is some lines in a paragraph,
+    // the end of the overflowing text is its head.
+    if (!HasOtherParas())
+        return mHeadTxt;
+
+    return mTailTxt;
+}
+
+OUString OverflowingText::GetHeadingLines() const
+{
+    return mHeadTxt;
+}
+* */
+
+
+
 
 OFlowChainedText::OFlowChainedText(Outliner *pOutl)
 {
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index 797264b..be5530b 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -22,6 +22,7 @@
 
 #include <editeng/macros.hxx>
 #include <editeng/editengdllapi.h>
+#include <editeng/editdata.hxx>
 
 class OUString;
 
@@ -39,9 +40,12 @@ public:
 
         OverflowingText(EditTextObject *pTObj) : mpContentTextObj(pTObj)
         {
+            ESelection aStartPos(0,0,0,0);
+            maInsertionPointSel = aStartPos;
         }
 
         OutlinerParaObject *GetJuxtaposedParaObject(Outliner *, OutlinerParaObject *);
+        ESelection GetInsertionPointSel() const;
 
         //OUString GetHeadingLines() const;
         //OUString GetEndingLines() const;
@@ -49,6 +53,9 @@ public:
 
 private:
     const EditTextObject *mpContentTextObj;
+    ESelection maInsertionPointSel;
+
+    ESelection impGetEndSelection(Outliner *pOutl) const;
 };
 
 class NonOverflowingText {
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 2647afa..9e794bc 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -63,7 +63,8 @@ void TextChainFlow::impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *)
 void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *pParamOutl)
 {
     bool bOldUpdateMode = pFlowOutl->GetUpdateMode();
-    // NOTE: Nah you probably don't need this
+
+    // XXX: This could be reorganized moving most of this stuff inside EditingTextChainFlow (we need update=true anyway for TextChainFlow though)
     if (pParamOutl != NULL)
     {
         // We need this since it's required to check overflow
@@ -83,7 +84,7 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
 
     if (pParamOutl != NULL)
     {
-        pFlowOutl->SetUpdateMode(bOldUpdateMode); // XXX: Plausibly should be the prev. state
+        pFlowOutl->SetUpdateMode(bOldUpdateMode);
     }
 
     // Set (Non)OverflowingTxt here (if any)


More information about the Libreoffice-commits mailing list