svx/source/svdraw/svdedxv.cxx |   36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

New commits:
commit 7d8b0eb2f2df07d4f85cd0000750d7b229646a6d
Author: matteocam <matteo.campane...@gmail.com>
Date:   Thu Jul 16 23:21:50 2015 -0400

    Move cursor if at end of box
    
    Change-Id: I355ebd71b1627d08b7b0493960c0d0f1dcf55fe7

diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 4f857fc..3ac3c1e 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1293,26 +1293,44 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, 
vcl::Window* pWin)
         sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
         ESelection aCurSel = pTextEditOutlinerView->GetSelection();
 
-        SdrOutliner *pOutl = GetTextEditOutliner();
-        sal_Int32 nLastPara = pOutl->GetParagraphCount()-1;
+
 
         SdrTextObj* pTextObj = NULL;
         if (mxTextEditObj.is())
             pTextObj= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
 
+        bool bHandled = false;
+
         // XXX: Add check for last position in the para
         if (pTextObj && pTextObj->IsChainable() && 
pTextObj->GetNextLinkInChain() &&
-            eFunc ==  KeyFuncType::DONTKNOW && nCode == KEY_RIGHT && 
aCurSel.nEndPara == nLastPara) {
-            fprintf(stderr, "[CHAIN - CURSOR] Trying to move to next box\n" );
+            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
+                )
+            {
+                fprintf(stderr, "[CHAIN - CURSOR] Trying to move to next 
box\n" );
 
-            // Move to next box
-            SdrEndTextEdit();
-            SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
-            SdrBeginTextEdit(pNextLink);
+                // 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.
+
+        }
+
+        if (bHandled)
             return true;
-        } else
+
         // FIXME(matteocam): Old code from here
         if (pTextEditOutlinerView->PostKeyEvent(rKEvt, pWin))
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to