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

matteocam matteo.campanelli at gmail.com
Mon Jul 20 12:11:17 PDT 2015


 include/svx/svdedxv.hxx        |    1 
 include/svx/svdotext.hxx       |    3 +
 svx/source/svdraw/svdedxv.cxx  |   81 +++++++++++++++++++++--------------------
 svx/source/svdraw/svdotext.cxx |    6 +++
 4 files changed, 52 insertions(+), 39 deletions(-)

New commits:
commit fc94131416c9fd5a7c95dc8b7f076d75282ae38f
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Mon Jul 20 15:04:17 2015 -0400

    Separated code for cursor motion with arrow keys
    
    Change-Id: I3184929219306b68599d1bd3efffa2f7def0c572

diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 0f9de4d..d45a12f 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -111,6 +111,7 @@ protected:
     OutlinerView* ImpFindOutlinerView(vcl::Window* pWin) const;
 
     void ImpMoveCursorAfterChainingEvent();
+    bool ImpHandleMotionThroughBoxesKeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
 
     // Create a new OutlinerView at the heap and initialize all required parameters.
     // pTextEditObj, pTextEditPV and pTextEditOutliner have to be initialized
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 774c974..ab70471 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1280,54 +1280,59 @@ bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
     return bOk;
 }
 
-
-
-bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
+bool SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(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();
+    // 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();
 
 
-        SdrTextObj* pTextObj = NULL;
-        if (mxTextEditObj.is())
-            pTextObj= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
+    SdrTextObj* pTextObj = NULL;
+    if (mxTextEditObj.is())
+        pTextObj= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
 
-        bool bHandled = false;
+    bool bHandled = false;
 
-        // XXX: Add check for last position in the para
-        if (pTextObj && pTextObj->IsChainable() && pTextObj->GetNextLinkInChain() &&
-            eFunc ==  KeyFuncType::DONTKNOW)
+    // XXX: Add check for last position in the para
+    if (pTextObj && pTextObj->IsChainable() && pTextObj->GetNextLinkInChain() &&
+        eFunc ==  KeyFuncType::DONTKNOW)
+    {
+        SdrOutliner *pOutl = GetTextEditOutliner();
+        sal_Int32 nLastPara = pOutl->GetParagraphCount()-1;
+        OUString aLastParaText = pOutl->GetText(pOutl->GetParagraph(nLastPara));
+        sal_Int32 nLastParaLen = aLastParaText.getLength();
+
+        if (nCode == KEY_RIGHT &&
+            aCurSel.nEndPara == nLastPara &&
+            aCurSel.nEndPos == nLastParaLen
+            )
         {
-            SdrOutliner *pOutl = GetTextEditOutliner();
-            sal_Int32 nLastPara = pOutl->GetParagraphCount()-1;
-            OUString aLastParaText = pOutl->GetText(pOutl->GetParagraph(nLastPara));
-            sal_Int32 nLastParaLen = aLastParaText.getLength();
-
-            if (nCode == KEY_RIGHT &&
-                aCurSel.nEndPara == nLastPara &&
-                aCurSel.nEndPos == nLastParaLen
-                )
-            {
-                fprintf(stderr, "[CHAIN - CURSOR] Trying to move to next box\n" );
+            fprintf(stderr, "[CHAIN - CURSOR] Trying to move to next box\n" );
 
-                // Move to next box
-                SdrEndTextEdit();
-                SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
-                SdrBeginTextEdit(pNextLink);
-                bHandled = true;
-            } // else if (...)
+            // Move to next box
+            SdrEndTextEdit();
+            SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
+            SdrBeginTextEdit(pNextLink);
+            bHandled = true;
+        } // else if (...)
 
-            // XXX: Careful with the checks below for pWin and co. You should do them here I guess.
+        // XXX: Careful with the checks below for pWin and co. You should do them here I guess.
 
-        }
+    }
+
+    return bHandled;
+
+}
 
-        if (bHandled)
+bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
+{
+    if(pTextEditOutlinerView)
+    {
+        // We possibly move to another box before any handling
+        if (ImpHandleMotionThroughBoxesKeyInput(rKEvt, pWin))
             return true;
 
         // FIXME(matteocam): Old code from here
commit 1beb368aef88ec3f82d44460a81d62320d15274f
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Mon Jul 20 14:54:44 2015 -0400

    Add SdrTextObj::GetPrevLink in chain declaration
    
    Change-Id: If7fca35cb5bae369480405fb68681761ad588f4c

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 761c4e0..6dc4ed4 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -364,9 +364,10 @@ public:
     /// returns true if the old feature for fitting shape content should into shape is enabled. implies IsAutoFit()==false!
     bool IsFitToSize() const;
 
-    // Chaining
+    // Chaining // XXX: how are we using IsToBeChained at the moment?
     bool IsToBeChained() const;
     SdrTextObj *GetNextLinkInChain() const;
+    SdrTextObj *GetPrevLinkInChain() const;
     bool IsChainable() const;
     void SetPreventChainable();
     bool GetPreventChainable() const;
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 26b6296..f315d01 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2100,6 +2100,12 @@ SdrTextObj* SdrTextObj::GetNextLinkInChain() const
 
 }
 
+SdrTextObj* SdrTextObj::GetPrevLinkInChain() const
+{
+    // FIXME: To be implemented
+    return NULL;
+}
+
 void SdrTextObj::SetPreventChainable()
 {
     mbIsUnchainableClone = true;


More information about the Libreoffice-commits mailing list