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

matteocam matteo.campanelli at gmail.com
Wed Jul 8 11:42:57 PDT 2015


 editeng/source/outliner/outliner.cxx       |    5 ----
 editeng/source/outliner/overflowingtxt.cxx |   31 ++++++++++++++++++++++++++++-
 include/editeng/overflowingtxt.hxx         |   27 ++++++++++---------------
 include/svx/textchainflow.hxx              |    2 -
 svx/source/svdraw/textchainflow.cxx        |    8 ++-----
 5 files changed, 45 insertions(+), 28 deletions(-)

New commits:
commit 7b5adb6f56dcd448cb2f92dd9dc679abb1479d50
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 8 14:41:58 2015 -0400

    Add Selection getters to (Non)OverflowingText
    
    Change-Id: Ia5f485c3f3adf6ae0cab3cf12ebb1119048eec83

diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 301ee0c..2b03d26 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2144,7 +2144,6 @@ NonOverflowingText *Outliner::GetNonOverflowingText() const
             nLen += GetLineLen(nOverflowingPara, nLine);
         }
 
-        /* BEGIN Experiment with ESelection and EditTextobject */
         sal_Int32 nStartPara = 0;
         sal_Int32 nStartPos = 0;
         ESelection aNonOverflowingTextSelection;
@@ -2201,7 +2200,6 @@ OverflowingText *Outliner::GetOverflowingText() const
         nLen += GetLineLen(nHeadPara, nLine);
     }
 
-    /* BEGIN experiment ESEL */
     sal_uInt32 nOverflowingPara = pEditEngine->GetOverflowingParaNum();
     ESelection aOverflowingTextSel;
     sal_Int32 nLastPara = nParaCount-1;
@@ -2211,9 +2209,6 @@ OverflowingText *Outliner::GetOverflowingText() const
 
     EditTextObject *pTObj = pEditEngine->CreateTextObject(aOverflowingTextSel);
     return new OverflowingText(pTObj);
-
-    /* END experiment ESel */
-
 }
 
 void Outliner::ClearOverflowingParaNum()
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 77f4829..03ed385 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -23,6 +23,28 @@
 #include <editeng/overflowingtxt.hxx>
 #include <editeng/outliner.hxx>
 #include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+
+ESelection getLastPositionSel(const EditTextObject *pTObj)
+{
+    sal_Int32 nLastPara = pTObj->GetParagraphCount()-1;
+    // If text is empty
+    if (nLastPara < 0 )
+        nLastPara = 0;
+    sal_Int32 nLen = pTObj->GetText(nLastPara).getLength();
+    ESelection aEndPos(nLastPara, nLen, nLastPara, nLen);
+
+    return aEndPos;
+}
+
+OverflowingText::OverflowingText(EditTextObject *pTObj) : mpContentTextObj(pTObj)
+{
+}
+
+ESelection OverflowingText::GetInsertionPointSel() const
+{
+    return getLastPositionSel(mpContentTextObj);
+}
 
 OutlinerParaObject *NonOverflowingText::ToParaObject(Outliner *pOutliner) const
 {
@@ -31,6 +53,11 @@ OutlinerParaObject *NonOverflowingText::ToParaObject(Outliner *pOutliner) const
     return pPObj;
 }
 
+ESelection NonOverflowingText::GetOverflowPointSel() const
+{
+    return getLastPositionSel(mpContentTextObj);
+}
+
 // 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)
@@ -49,7 +76,7 @@ OutlinerParaObject *OverflowingText::GetJuxtaposedParaObject(Outliner *pOutl, Ou
     pOutl->SetText(*pOverflowingPObj);
 
     // Set selection position between new and old text
-    maInsertionPointSel = impGetEndSelection(pOutl);
+    //maInsertionPointSel = impGetEndSelection(pOutl);  // XXX: Maybe setting in the constructor is just right
 
     pOutl->AddText(*pNextPObj);
 
@@ -60,6 +87,7 @@ OutlinerParaObject *OverflowingText::GetJuxtaposedParaObject(Outliner *pOutl, Ou
     return pPObj;
 }
 
+/*
 ESelection OverflowingText::impGetEndSelection(Outliner *pOutl) const
 {
     const sal_Int32 nParaCount = pOutl->GetParagraphCount();
@@ -70,6 +98,7 @@ ESelection OverflowingText::impGetEndSelection(Outliner *pOutl) const
     ESelection aEndSel(nLastParaIndex,nLenLastPara,nLastParaIndex,nLenLastPara);
     return aEndSel;
 }
+* */
 
 /*
 OUString OverflowingText::GetEndingLines() const
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index be5530b..7faa9a9 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -36,14 +36,6 @@ class OverflowingText
 {
 
 public:
-        // Constructor
-
-        OverflowingText(EditTextObject *pTObj) : mpContentTextObj(pTObj)
-        {
-            ESelection aStartPos(0,0,0,0);
-            maInsertionPointSel = aStartPos;
-        }
-
         OutlinerParaObject *GetJuxtaposedParaObject(Outliner *, OutlinerParaObject *);
         ESelection GetInsertionPointSel() const;
 
@@ -52,25 +44,26 @@ public:
         //bool HasOtherParas() const { return !(mTailTxt == "" && mpMidParas == NULL); }
 
 private:
+    friend class Outliner;
+    // Constructor
+    OverflowingText(EditTextObject *pTObj);
+
     const EditTextObject *mpContentTextObj;
     ESelection maInsertionPointSel;
-
-    ESelection impGetEndSelection(Outliner *pOutl) const;
 };
 
 class NonOverflowingText {
-    public:
-
-        // NOTE: mPreOverflowingTxt might be empty
+public:
+    OutlinerParaObject *ToParaObject(Outliner *) const;
+    ESelection GetOverflowPointSel() const;
 
+private:
         // Constructor
         NonOverflowingText(const EditTextObject *pTObj)
         : mpContentTextObj(pTObj)
         { }
 
-        OutlinerParaObject *ToParaObject(Outliner *) const;
-
-    private:
+        friend class Outliner;
         const EditTextObject *mpContentTextObj;
 };
 
@@ -88,6 +81,8 @@ class EDITENG_DLLPUBLIC OFlowChainedText {
         OutlinerParaObject *CreateOverflowingParaObject(Outliner *, OutlinerParaObject *);
         OutlinerParaObject *CreateNonOverflowingParaObject(Outliner *);
 
+        ESelection GetInsertionPointSel() const { return mpOverflowingTxt->GetInsertionPointSel(); }
+
     protected:
         void impSetOutlinerToEmptyTxt(Outliner *);
 
diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index ade3404..b2373e8 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -118,7 +118,7 @@ protected:
     virtual void impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *) SAL_OVERRIDE;
 
 private:
-    void impBroadcasCursorInfo() const;
+    void impBroadcastCursorInfo() const;
 
 };
 
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 2700bf3..161e615 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -99,10 +99,8 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
 
 void TextChainFlow::impUpdateCursorInfo(SdrOutliner *, bool bIsOverflow)
 {
-    // XXX: Current implementation might create problems with UF-
-    //      In fact UF causes a
-
-
+    // XXX: Maybe we can get rid of mbOFisUFinduced by not allowing handling of more than one event by the same TextChainFlow
+    // if this is not an OF triggered during an UF
     if (bIsOverflow && !mbOFisUFinduced) {
         bool bCursorOut = true; // XXX: Should have real check
         if (bCursorOut) {
@@ -241,7 +239,7 @@ void EditingTextChainFlow::CheckForFlowEvents(SdrOutliner *pFlowOutl)
         impCheckForFlowEvents(pFlowOutl, GetLinkTarget()->pEdtOutl);
 
     // Broadcast events for cursor handling
-    impBroadcasCursorInfo();
+    impBroadcastCursorInfo();
 }
 
 /*


More information about the Libreoffice-commits mailing list