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

matteocam matteo.campanelli at gmail.com
Wed Jul 1 10:32:14 PDT 2015


 editeng/source/outliner/outliner.cxx       |   20 ++++++++++++++++++--
 editeng/source/outliner/overflowingtxt.cxx |   22 ++++++++++++++++++++++
 include/editeng/overflowingtxt.hxx         |    9 +++++++++
 3 files changed, 49 insertions(+), 2 deletions(-)

New commits:
commit 7007bf784049586639835a3df436e5a8ef00ce8b
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 1 13:29:32 2015 -0400

    EditTetxObj approach for OverflowingText; only para juxtaposition
    
    Change-Id: I98c2fe3d3d4583a8d8a5880a0df39ded30f2bed2

diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 4fde0ce..bfd4189 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2210,20 +2210,36 @@ OverflowingText *Outliner::GetOverflowingText() const
     OutlinerParaObject *pMidParas = NULL;
 
 
-    sal_uInt32 nHeadPara = pEditEngine->GetOverflowingParaNum();
+    sal_Int32 nHeadPara = pEditEngine->GetOverflowingParaNum();
     sal_uInt32 nParaCount = GetParagraphCount();
-    sal_uInt32 nTailPara = nParaCount-1;
+    sal_Int32 nTailPara = nParaCount-1;
     sal_Int32 nMidParas = nTailPara-nHeadPara-1;
 
     // Set the head text
     // XXX: Is there a proper method to join lines in a single string?
     OUString aWholeTxtHeadPara = GetText(GetParagraph(nHeadPara));
+
+
     sal_uInt32 nLen = 0;
     for ( sal_Int32 nLine = 0;
           nLine < pEditEngine->GetOverflowingLineNum();
           nLine++) {
         nLen += GetLineLen(nHeadPara, nLine);
     }
+
+    /* BEGIN experiment ESEL */
+    sal_uInt32 nOverflowingPara = pEditEngine->GetOverflowingParaNum();
+    ESelection aOverflowingTextSel;
+    sal_Int32 nLastPara = nParaCount-1;
+    sal_Int32 nLastParaLen = GetText(GetParagraph(nOverflowingPara-1)).getLength();
+    aOverflowingTextSel = ESelection(nOverflowingPara, nLen,
+                                     nLastPara, nLastParaLen);
+
+    EditTextObject *pTObj = pEditEngine->CreateTextObject(aOverflowingTextSel);
+    return new OverflowingText(pTObj);
+
+    /* END experiment ESel */
+
     // XXX: Any separator to be included?
     aHeadTxt = aWholeTxtHeadPara.copy(nLen);
 
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 23246fb..5a7b15c 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -88,6 +88,20 @@ OUString OverflowingText::GetHeadingLines() const
     return mHeadTxt;
 }
 
+OutlinerParaObject *OverflowingText::GetJuxtaposedParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj)
+{
+    if (mpContentTextObj == NULL) {
+        fprintf(stderr, "[Chaining] OverflowingText's mpContentTextObj is NULL!\n");
+        return NULL;
+    }
+
+    // Simply Juxtaposing; no within para-merging
+    OutlinerParaObject *pOverflowingPObj = new OutlinerParaObject(*mpContentTextObj);
+    pOutl->SetText(*pOverflowingPObj);
+    pOutl->AddText(*pNextPObj);
+    return pOutl->CreateParaObject();
+}
+
 
 OFlowChainedText::OFlowChainedText(Outliner *pOutl)
 {
@@ -97,6 +111,13 @@ OFlowChainedText::OFlowChainedText(Outliner *pOutl)
 
 OutlinerParaObject *OFlowChainedText::CreateOverflowingParaObject(Outliner *pOutliner, OutlinerParaObject *pTextToBeMerged)
 {
+    // Just return the roughly merged paras fpr now
+    if (mpOverflowingTxt == NULL || pTextToBeMerged == NULL)
+        return NULL;
+
+    return mpOverflowingTxt->GetJuxtaposedParaObject(pOutliner, pTextToBeMerged );
+
+    /*
     if (mpOverflowingTxt == NULL || pTextToBeMerged == NULL)
         return NULL;
 
@@ -162,6 +183,7 @@ OutlinerParaObject *OFlowChainedText::CreateOverflowingParaObject(Outliner *pOut
     // Draw everything
     OutlinerParaObject *pNewText = pOutliner->CreateParaObject();
     return pNewText;
+    * */
 }
 
 OutlinerParaObject *OFlowChainedText::CreateNonOverflowingParaObject(Outliner *pOutliner)
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index 12e1e7c..3e9ce3a 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -50,9 +50,18 @@ public:
                   mTailTxt(tailTxt)
                 { }
 
+        OverflowingText(EditTextObject *pTObj) : mpContentTextObj(pTObj)
+        {
+        }
+
+        OutlinerParaObject *GetJuxtaposedParaObject(Outliner *, OutlinerParaObject *);
+
         OUString GetHeadingLines() const;
         OUString GetEndingLines() const;
         bool HasOtherParas() const { return !(mTailTxt == "" && mpMidParas == NULL); }
+
+private:
+    const EditTextObject *mpContentTextObj;
 };
 
 class NonOverflowingText {


More information about the Libreoffice-commits mailing list