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

matteocam matteo.campanelli at gmail.com
Fri Jul 24 02:01:32 PDT 2015


 include/svx/textchaincursor.hxx       |    3 ++-
 svx/source/svdraw/textchaincursor.cxx |   24 +++++++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 50e6f53542903e7e17385a4be2679b2ba51d6371
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Fri Jul 24 11:00:27 2015 +0200

    Handle Backspace
    
    Change-Id: Ied9802481595f1f823ccd1abe6b6ccc97897a856

diff --git a/include/svx/textchaincursor.hxx b/include/svx/textchaincursor.hxx
index b56dd72..1d9c4de 100644
--- a/include/svx/textchaincursor.hxx
+++ b/include/svx/textchaincursor.hxx
@@ -42,7 +42,8 @@ private:
     void impChangeEditingTextObj(SdrTextObj *pTargetTextObj, ESelection aNewSel) const;
     void impDetectEvent(const KeyEvent& rKEvt,
                         CursorChainingEvent *pOutCursorEvt,
-                        ESelection *pOutSel) const;
+                        ESelection *pOutSel,
+                        bool *bOutHandled) const;
 };
 
 
diff --git a/svx/source/svdraw/textchaincursor.cxx b/svx/source/svdraw/textchaincursor.cxx
index 3952d8b..af2af7c 100644
--- a/svx/source/svdraw/textchaincursor.cxx
+++ b/svx/source/svdraw/textchaincursor.cxx
@@ -41,19 +41,22 @@ bool TextChainCursorManager::HandleKeyEvent( const KeyEvent& rKEvt ) const
     CursorChainingEvent aCursorEvent;
 
     // check what the cursor/event situation looks like
-    impDetectEvent(rKEvt, &aCursorEvent, &aNewSel);
+    bool bCompletelyHandled = false;
+    impDetectEvent(rKEvt, &aCursorEvent, &aNewSel, &bCompletelyHandled);
 
     if (aCursorEvent == CursorChainingEvent::NULL_EVENT)
         return false;
     else {
         HandleCursorEvent(aCursorEvent, aNewSel);
-        return true;
+        // return value depends on the situation we are in
+        return bCompletelyHandled;
     }
 }
 
 void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt,
                                             CursorChainingEvent *pOutCursorEvt,
-                                            ESelection *pOutSel) const
+                                            ESelection *pOutSel,
+                                            bool *bOutHandled) const
 {
     SdrOutliner *pOutl = mpEditView->GetTextEditOutliner();
     OutlinerView *pOLV = mpEditView->GetTextEditOutlinerView();
@@ -80,22 +83,33 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt,
     ESelection aEndSel = ESelection(nLastPara, nLastParaLen);
     bool bAtEndOfTextContent = aCurSel.IsEqual(aEndSel);
 
-    // Are we "pushing" at the end of the object?
+    // Possibility: Are we "pushing" at the end of the object?
     if (nCode == KEY_RIGHT && bAtEndOfTextContent && pNextLink)
     {
         *pOutCursorEvt = CursorChainingEvent::TO_NEXT_LINK;
         // Selection unchanged: we are at the beginning of the box
+        *bOutHandled = true; // Nothing more to do than move cursor
         return;
     }
 
     ESelection aStartSel = ESelection(0, 0);
     bool bAtStartOfTextContent = aCurSel.IsEqual(aStartSel);
 
-    // Are we "pushing" at the start of the object?
+    // Possibility: Are we "pushing" at the start of the object?
     if (nCode == KEY_LEFT && bAtStartOfTextContent && pPrevLink)
     {
         *pOutCursorEvt = CursorChainingEvent::TO_PREV_LINK;
         *pOutSel = ESelection(100000, 100000); // Set at end of selection
+        *bOutHandled = true; // Nothing more to do than move cursor
+        return;
+    }
+
+    // Possibility: Are we "pushing" at the start of the object and deleting left?
+    if (nCode == KEY_BACKSPACE && bAtStartOfTextContent && pPrevLink)
+    {
+        *pOutCursorEvt = CursorChainingEvent::TO_PREV_LINK;
+        *pOutSel = ESelection(100000, 100000); // Set at end of selection
+        *bOutHandled = false; // We need to delete characters after moving cursor
         return;
     }
 


More information about the Libreoffice-commits mailing list