svx/source/svdraw/textchain.cxx | 10 +++++----- svx/source/svdraw/textchaincursor.cxx | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-)
New commits: commit 7afcf37661e01bcc75271a82a067892ce98ce627 Author: matteocam <matteo.campane...@gmail.com> Date: Fri Jul 24 02:14:16 2015 +0200 Handle Left Arrow and Prev Link Change-Id: I08f56fc5fc747d097d90313f4bfec14091b6f5a7 diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx index 86357c2..7cfa0a4 100644 --- a/svx/source/svdraw/textchain.cxx +++ b/svx/source/svdraw/textchain.cxx @@ -89,17 +89,17 @@ SdrTextObj *TextChain::impGetNextLink(const SdrTextObj *pTextObj) const SdrTextObj *TextChain::impGetPrevLink(const SdrTextObj *pTextObj) const { - SdrTextObj *pNextTextObj = NULL; + SdrTextObj *pPrevTextObj = NULL; SdrPage *pPage = pTextObj->pPage; if ( pPage && pPage->GetObjCount() > 1) { - sal_uInt32 nextIndex = (pTextObj->GetOrdNum()-1); + sal_Int32 prevIndex = (pTextObj->GetOrdNum()-1); - if (nextIndex > 0) - pNextTextObj = dynamic_cast< SdrTextObj * >( pPage->GetObj( nextIndex ) ); + if (prevIndex >= 0) + pPrevTextObj = dynamic_cast< SdrTextObj * >( pPage->GetObj( prevIndex ) ); - return pNextTextObj; + return pPrevTextObj; } else { fprintf(stderr, "Make New Object please\n"); return NULL; diff --git a/svx/source/svdraw/textchaincursor.cxx b/svx/source/svdraw/textchaincursor.cxx index 7ca44f7..3952d8b 100644 --- a/svx/source/svdraw/textchaincursor.cxx +++ b/svx/source/svdraw/textchaincursor.cxx @@ -58,6 +58,9 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt, SdrOutliner *pOutl = mpEditView->GetTextEditOutliner(); OutlinerView *pOLV = mpEditView->GetTextEditOutlinerView(); + SdrTextObj *pNextLink = mpTextObj->GetNextLinkInChain(); + SdrTextObj *pPrevLink = mpTextObj->GetPrevLinkInChain(); + KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction(); // We need to have this KeyFuncType @@ -74,17 +77,27 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt, OUString aLastParaText = pOutl->GetText(pOutl->GetParagraph(nLastPara)); sal_Int32 nLastParaLen = aLastParaText.getLength(); - bool bAtEndOfTextContent = - (aCurSel.nEndPara == nLastPara) && - (aCurSel.nEndPos == nLastParaLen); + ESelection aEndSel = ESelection(nLastPara, nLastParaLen); + bool bAtEndOfTextContent = aCurSel.IsEqual(aEndSel); - if (nCode == KEY_RIGHT && bAtEndOfTextContent) + // 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 + return; } - // if (nCode == KEY_LEFT && bAtStartOfTextContent) ... + ESelection aStartSel = ESelection(0, 0); + bool bAtStartOfTextContent = aCurSel.IsEqual(aStartSel); + + // 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 + return; + } // If arrived here there is no event detected *pOutCursorEvt = CursorChainingEvent::NULL_EVENT; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits