editeng/source/outliner/overflowingtxt.cxx | 10 +++++ include/editeng/overflowingtxt.hxx | 4 +- include/svx/textchainflow.hxx | 11 ++++- svx/source/svdraw/svdedxv.cxx | 2 - svx/source/svdraw/textchainflow.cxx | 57 ++++++++++++++++------------- 5 files changed, 53 insertions(+), 31 deletions(-)
New commits: commit b0273e17cdf5a0f0877c3bc64543b333727cfdc7 Author: matteocam <matteo.campane...@gmail.com> Date: Wed Jul 8 23:06:07 2015 -0400 Test for actual cursor overflow Change-Id: Ia306b8ee15d986c773787a500a23a886caf20087 diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx index 03ed385..304e04b 100644 --- a/editeng/source/outliner/overflowingtxt.cxx +++ b/editeng/source/outliner/overflowingtxt.cxx @@ -126,6 +126,16 @@ OFlowChainedText::OFlowChainedText(Outliner *pOutl) mpNonOverflowingTxt = pOutl->GetNonOverflowingText(); } +ESelection OFlowChainedText::GetInsertionPointSel() const +{ + return mpOverflowingTxt->GetInsertionPointSel(); +} + +ESelection OFlowChainedText::GetOverflowPointSel() const +{ + return mpNonOverflowingTxt->GetOverflowPointSel(); +} + OutlinerParaObject *OFlowChainedText::CreateOverflowingParaObject(Outliner *pOutliner, OutlinerParaObject *pTextToBeMerged) { // Just return the roughly merged paras fpr now diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx index 7faa9a9..4e97fcc 100644 --- a/include/editeng/overflowingtxt.hxx +++ b/include/editeng/overflowingtxt.hxx @@ -49,7 +49,6 @@ private: OverflowingText(EditTextObject *pTObj); const EditTextObject *mpContentTextObj; - ESelection maInsertionPointSel; }; class NonOverflowingText { @@ -81,7 +80,8 @@ class EDITENG_DLLPUBLIC OFlowChainedText { OutlinerParaObject *CreateOverflowingParaObject(Outliner *, OutlinerParaObject *); OutlinerParaObject *CreateNonOverflowingParaObject(Outliner *); - ESelection GetInsertionPointSel() const { return mpOverflowingTxt->GetInsertionPointSel(); } + ESelection GetInsertionPointSel() const; + ESelection GetOverflowPointSel() const; protected: void impSetOutlinerToEmptyTxt(Outliner *); diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx index b2373e8..00a04f3 100644 --- a/include/svx/textchainflow.hxx +++ b/include/svx/textchainflow.hxx @@ -62,7 +62,12 @@ class TextChainFlow { // -- Protected Members -- protected: + + // Cursor related + bool mbPossiblyCursorOut; CursorChainingEvent maCursorEvent; + ESelection maOverflowPosSel; + void impCheckForFlowEvents(SdrOutliner *, SdrOutliner *); @@ -80,8 +85,10 @@ class TextChainFlow { // -- Private Members -- private: + // XXX: It would be nice to get rid of this + bool mbOFisUFinduced; - void impUpdateCursorInfo(SdrOutliner *, bool); + void impUpdateCursorInfo(); SdrTextObj *mpTargetLink; SdrTextObj *mpNextLink; @@ -96,8 +103,6 @@ class TextChainFlow { OFlowChainedText *mpOverflChText; UFlowChainedText *mpUnderflChText; - // XXX: It would be nice to get rid of this - bool mbOFisUFinduced; }; diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index d893dab..16373c3 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -499,7 +499,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl) // We prevent to trigger further handling of overflow/underflow for pTextObj pTextChain->SetNilChainingEvent(pTextObj, true); - // Save previous selection pos + // Save previous selection pos // NOTE: It must be done to have the right CursorEvent in KeyInput pTextChain->SetPreChainingSel(pTextObj, pOLV->GetSelection()); //maPreChainingSel = new ESelection(pOLV->GetSelection()); diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx index 161e615..1df7fe3 100644 --- a/svx/source/svdraw/textchainflow.cxx +++ b/svx/source/svdraw/textchainflow.cxx @@ -38,7 +38,8 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget) mpOverflChText = NULL; mpUnderflChText = NULL; - maCursorEvent = CursorChainingEvent::UNCHANGED; + maCursorEvent = CursorChainingEvent::NULL_EVENT; + mbPossiblyCursorOut = false; } @@ -79,8 +80,6 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p bOverflow = bIsPageOverflow && mpNextLink; bUnderflow = !bIsPageOverflow && mpNextLink && mpNextLink->HasText(); - impUpdateCursorInfo(pFlowOutl, bOverflow); - if (pParamOutl != NULL) { pFlowOutl->SetUpdateMode(bOldUpdateMode); @@ -92,22 +91,22 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p // Set current underflowing text (if any) mpUnderflChText = bUnderflow ? new UFlowChainedText(pFlowOutl) : NULL; + // NOTE: Must be called after mp*ChText abd b*flow have been set but before mbOFisUFinduced is reset + impUpdateCursorInfo(); + // To check whether an overflow is underflow induced or not (useful in cursor checking) mbOFisUFinduced = bUnderflow; } -void TextChainFlow::impUpdateCursorInfo(SdrOutliner *, bool bIsOverflow) +void TextChainFlow::impUpdateCursorInfo() { // XXX: Maybe we can get rid of mbOFisUFinduced by not allowing handling of more than one event by the same TextChainFlow // if this is not an OF triggered during an UF - if (bIsOverflow && !mbOFisUFinduced) { - bool bCursorOut = true; // XXX: Should have real check - if (bCursorOut) { - maCursorEvent = CursorChainingEvent::TO_NEXT_LINK; - } - } else { - maCursorEvent = CursorChainingEvent::UNCHANGED; + + mbPossiblyCursorOut = bOverflow && !mbOFisUFinduced; + if (mbPossiblyCursorOut) { + maOverflowPosSel = ESelection(mpOverflChText->GetOverflowPointSel()); } } @@ -285,21 +284,29 @@ void EditingTextChainFlow::impSetFlowOutlinerParams(SdrOutliner *pFlowOutl, SdrO //pFlowOutl->SetEditTextObjectPool(pParamOutl->GetEditTextObjectPool()); } -void EditingTextChainFlow::impBroadcasCursorInfo() const +void EditingTextChainFlow::impBroadcastCursorInfo() const { - GetTextChain()->SetCursorEvent(GetLinkTarget(), maCursorEvent); -} + bool bCursorOut = false; -/* - * - * Some notes on how to set style sheets: - * - save whole edittexts instead of strings only for (Non)OverflowingText; this can be done by the EditEngine::CreateTextObject method and using a selection - probably from ImpEditEngine) - * - for the refactoring of the previous point we may also add an option for whether we are joining paragraphs or not - * - When making new OutlinerParaObjs and joining paragraphs we need to first add the string (as we already do) and then, with the appropriate selection, use Outliner::QuickSetAttribs(SfxItemSet(txtObj->GetPool()), aSelectionOfTheNewText) - * - having all this in a whole class that contains Overflowing and NonOverflowingText would not be bad. This same class could be used to handle a cursor later on. - * - * - * - */ + // Possibility: 1) why don't we stop passing the actual event to the TextChain and instead we pass + // the overflow pos and mbPossiblyCursorOut + // 2) We pass the current selection before anything happens and we make impBroadcastCursorInfo compute it. + + if (mbPossiblyCursorOut) { + ESelection aPreChainingSel = GetTextChain()->GetPreChainingSel(GetLinkTarget()) ; + bCursorOut = maOverflowPosSel.IsLess(aPreChainingSel); + } + + if (bCursorOut) { + //maCursorEvent = CursorChainingEvent::TO_NEXT_LINK; + // XXX: GetTextChain()->SetPostChainingPos()sdasd) + GetTextChain()->SetCursorEvent(GetLinkTarget(), CursorChainingEvent::TO_NEXT_LINK); + } else { + //maCursorEvent = CursorChainingEvent::UNCHANGED; + GetTextChain()->SetCursorEvent(GetLinkTarget(), CursorChainingEvent::UNCHANGED); + } + + +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits