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

matteocam matteo.campanelli at gmail.com
Thu Jul 16 20:22:48 PDT 2015


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

New commits:
commit 7d8b0eb2f2df07d4f85cd0000750d7b229646a6d
Author: matteocam <matteo.campanelli at 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))
         {


More information about the Libreoffice-commits mailing list