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

matteocam matteo.campanelli at gmail.com
Wed Jul 8 06:01:43 PDT 2015


 include/svx/svdedxv.hxx       |    9 +++++
 svx/source/svdraw/svdedxv.cxx |   64 +++++++++++++++++++++++++++++++-----------
 2 files changed, 57 insertions(+), 16 deletions(-)

New commits:
commit e76ca3b674ebd74bdd1ad81dc9ab942c7151f0e1
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 8 09:00:20 2015 -0400

    Move to the other box after OF.
    
    Change-Id: I5184cfb09bb796821fa12a07f085bf790d46b792

diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 010032e..0f9de4d 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -35,6 +35,9 @@ class ImpSdrEditPara;
 struct PasteOrDropInfos;
 class SdrUndoManager;
 
+enum class CursorChainingEvent;
+class ESelection;
+
 namespace com { namespace sun { namespace star { namespace uno {
     class Any;
 } } } }
@@ -94,6 +97,10 @@ private:
 
     SVX_DLLPRIVATE void ImpClearVars();
 
+    // FIXME(matteocam)
+    CursorChainingEvent *maCursorEvent;
+    ESelection *maPreChainingSel;
+
 protected:
     // central method to get an SdrUndoManager for enhanced TextEdit. Default will
     // try to return a dynamic_casted GetModel()->GetSdrUndoManager(). Applications
@@ -103,6 +110,8 @@ protected:
 
     OutlinerView* ImpFindOutlinerView(vcl::Window* pWin) const;
 
+    void ImpMoveCursorAfterChainingEvent();
+
     // Create a new OutlinerView at the heap and initialize all required parameters.
     // pTextEditObj, pTextEditPV and pTextEditOutliner have to be initialized
     OutlinerView* ImpMakeOutlinerView(vcl::Window* pWin, bool bNoPaint, OutlinerView* pGivenView) const;
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index febb1c5..c09dfb1 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -500,7 +500,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
             pTextChain->SetNilChainingEvent(pTextObj, true);
 
             // Save previous selection pos
-            ESelection aPreChainingSel(pOLV->GetSelection());
+            maPreChainingSel = new ESelection(pOLV->GetSelection());
 
             // trigger actual chaining
             pTextObj->onChainingEvent();
@@ -508,22 +508,9 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
             // XXX: this logic could be put in a separate approppriate class
             /* Cursor motion stuff */
 
-            CursorChainingEvent aCursorEvent = pTextChain->GetCursorEvent(pTextObj);
-            SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
+            maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
+            //SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
 
-            switch (aCursorEvent) {
-
-            case CursorChainingEvent::UNCHANGED:
-                    pOLV->SetSelection(aPreChainingSel);
-                    break;
-            case CursorChainingEvent::TO_NEXT_LINK:
-                    //SdrEndTextEdit(true);
-                    //SdrBeginTextEdit(pNextLink, nullptr, nullptr, false, nullptr, nullptr, true, true);
-                    break;
-            case CursorChainingEvent::TO_PREV_LINK:
-                    // XXX: To be handled
-                    break;
-            }
 
             // Find last Para
             /*
@@ -545,6 +532,47 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
     return 0;
 }
 
+
+void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
+{
+    if (!mxTextEditObj.is())
+        return;
+
+    SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
+
+    if (!pTextObj->IsChainable() || !pTextObj->GetNextLinkInChain())
+        return;
+
+    assert(maCursorEvent);
+    assert(maPreChainingSel);
+
+    SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
+    OutlinerView* pOLV = GetTextEditOutlinerView();
+
+    switch (*maCursorEvent) {
+
+            case CursorChainingEvent::UNCHANGED:
+                    pOLV->SetSelection(*maPreChainingSel);
+                    break;
+            case CursorChainingEvent::TO_NEXT_LINK:
+                    SdrEndTextEdit();
+                    SdrBeginTextEdit(pNextLink);
+
+                    //SdrEndTextEdit(true);
+                    //SdrBeginTextEdit(pNextLink, nullptr, nullptr, false, nullptr, nullptr, true, true);
+                    break;
+            case CursorChainingEvent::TO_PREV_LINK:
+                    // XXX: To be handled
+                    break;
+    }
+
+    // Default case
+    // XXX: You should delete the old ones here too.
+    maCursorEvent = NULL;
+    maPreChainingSel = NULL;
+
+}
+
 IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
 {
     bool bOk=false;
@@ -1274,6 +1302,10 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
             if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
 #endif
             ImpMakeTextCursorAreaVisible();
+
+            // FIXME(matteocam)
+            ImpMoveCursorAfterChainingEvent();
+
             return true;
         }
     }


More information about the Libreoffice-commits mailing list