include/svx/svdedxv.hxx | 2 +- include/svx/textchain.hxx | 11 +++++++++++ svx/source/svdraw/svdedxv.cxx | 31 +++++++++++++++++++------------ svx/source/svdraw/textchain.cxx | 13 +++++++++++++ 4 files changed, 44 insertions(+), 13 deletions(-)
New commits: commit 5d5b0c29b59557ace847ffd34a1aa15220c806cd Author: matteocam <matteo.campane...@gmail.com> Date: Mon Jul 6 15:57:03 2015 -0400 Adds CursorChainEvent and related code in SdrObjEditView Change-Id: Ife00e7cd5c67ec127961ef7c89f8cf6b3a87f5a5 diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index 67945b58b..010032e 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -125,7 +125,7 @@ protected: void ImpMacroUp(const Point& rUpPos); void ImpMacroDown(const Point& rDownPos); - DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* ); + DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* ); DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* ); protected: diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx index 8032747..730489b 100644 --- a/include/svx/textchain.hxx +++ b/include/svx/textchain.hxx @@ -32,6 +32,12 @@ namespace rtl { typedef rtl::OUString ChainLinkId; typedef std::map< ChainLinkId, ImpChainLinkProperties *> LinkPropertiesMap; +enum class CursorChainingEvent +{ + TO_NEXT_LINK, + TO_PREV_LINK, + UNCHANGED +}; class ImpChainLinkProperties { @@ -40,7 +46,9 @@ class ImpChainLinkProperties ImpChainLinkProperties(); + // NOTE: Remember to set default value in contructor when adding field bool bNilChainingEvent; + CursorChainingEvent aCursorEvent; // XXX: replace with enum instead of bool? }; @@ -54,6 +62,9 @@ class TextChain { bool IsLinkInChain(SdrTextObj *) const; SdrTextObj *GetNextLink(SdrTextObj *) const; + CursorChainingEvent GetCursorEvent(SdrTextObj *); + void SetCursorEvent(SdrTextObj *, CursorChainingEvent); + ChainLinkId GetId(SdrTextObj *) const; ImpChainLinkProperties *GetLinkProperties(SdrTextObj *); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 74a14e1..bc5bfb0 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -51,6 +51,7 @@ #include "svx/svdstr.hrc" #include "svdglob.hxx" #include "svx/globl3d.hxx" +#include <svx/textchain.hxx> #include <editeng/outliner.hxx> #include <editeng/adjustitem.hxx> #include <svtools/colorcfg.hxx> @@ -495,8 +496,24 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl) // trigger actual chaining pTextObj->onChainingEvent(); + // XXX: this logic could be put in a separate approppriate class /* Cursor motion stuff */ + CursorChainingEvent aCursorEvent = pTextObj->GetTextChain()->GetCursorEvent(pTextObj); + SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain(); + switch (aCursorEvent) { + + case CursorChainingEvent::UNCHANGED: + pOLV->SetSelection(aPreChainingSel); + break; + case CursorChainingEvent::TO_NEXT_LINK: + SdrEndTextEdit(); + SdrBeginTextEdit(pNextLink); + break; + case CursorChainingEvent::TO_PREV_LINK: + // XXX: To be handled + break; + } // Find last Para /* @@ -508,8 +525,6 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl) ESelection aEndSel(nLastParaIndex,nLenLastPara,nLastParaIndex,nLenLastPara); */ - pOLV->SetSelection(aPreChainingSel); - } else { // XXX fprintf(stderr, "[OnChaining] No Edit Outliner View\n"); @@ -758,7 +773,8 @@ bool SdrObjEditView::SdrBeginTextEdit( pTextEditOutlinerView->ShowCursor(); pTextEditOutliner->SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl)); - pTextEditOutliner->SetChainingEventHdl(LINK(this,SdrObjEditView,ImpChainingEventHdl) ); + if (pTextObj->IsChainable()) + pTextEditOutliner->SetChainingEventHdl(LINK(this,SdrObjEditView,ImpChainingEventHdl) ); #ifdef DBG_UTIL if (pItemBrowser!=nullptr) pItemBrowser->SetDirty(); @@ -808,15 +824,6 @@ bool SdrObjEditView::SdrBeginTextEdit( } } - // FIXME(matteocam) - // XXX: Trying to get to the next text obj directly - if (pTextObj->IsChainable()) { - SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain(); - SdrEndTextEdit(); - SdrBeginTextEdit(pNextLink); - } - - return true; // ran fine, let TextEdit run now } else diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx index 09911f4..37bca69 100644 --- a/svx/source/svdraw/textchain.cxx +++ b/svx/source/svdraw/textchain.cxx @@ -25,6 +25,7 @@ ImpChainLinkProperties::ImpChainLinkProperties() { // give defaults bNilChainingEvent = false; + aCursorEvent = CursorChainingEvent::UNCHANGED; } // XXX: All getters in the class assume that the guy is in the chain @@ -53,6 +54,18 @@ SdrTextObj *TextChain::GetNextLink(SdrTextObj *) const return NULL; // XXX: To be changed. It'd be a mess to implement now } +CursorChainingEvent TextChain::GetCursorEvent(SdrTextObj *pTarget) +{ + ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); + return pLinkProperties->aCursorEvent; +} + +void TextChain::SetCursorEvent(SdrTextObj *pTarget, CursorChainingEvent aCursorEvent) +{ + ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); + pLinkProperties->aCursorEvent = aCursorEvent; +} + bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* /* pPrevLink */, SdrTextObj* /* pNextLink */) { // XXX _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits