sd/qa/unit/tiledrendering/tiledrendering.cxx | 19 ++++++++++++++++++- sd/source/ui/view/ViewShellBase.cxx | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-)
New commits: commit e93b30c9d9f4deba597b73e04df7d4082b779b69 Author: Miklos Vajna <[email protected]> Date: Thu Sep 15 12:17:14 2016 +0200 sd draw text: emit LOK_CALLBACK_TEXT_VIEW_SELECTION from registerCallback() This is basically the Impress equivalent of commit 2ea385a54b53797ab3960869012f3ce3268eab2c (sw draw text: emit LOK_CALLBACK_TEXT_VIEW_SELECTION from registerCallback(), 2016-09-13). Change-Id: Ib138845de6db2a8ad49dc8596af3e05ec5278610 diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 28e0ac8..67455cf 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -874,6 +874,7 @@ public: bool m_bTilesInvalidated; std::map<int, bool> m_aViewCursorInvalidations; std::map<int, bool> m_aViewCursorVisibilities; + bool m_bViewSelectionSet; ViewCallback() : m_bGraphicSelectionInvalidated(false), @@ -881,7 +882,8 @@ public: m_nPart(0), m_bCursorVisibleChanged(false), m_bViewLock(false), - m_bTilesInvalidated(false) + m_bTilesInvalidated(false), + m_bViewSelectionSet(false) { } @@ -945,6 +947,11 @@ public: m_aViewCursorVisibilities[nViewId] = OString("true") == pPayload; } break; + case LOK_CALLBACK_TEXT_VIEW_SELECTION: + { + m_bViewSelectionSet = true; + } + break; } } }; @@ -1193,6 +1200,12 @@ void SdTiledRenderingTest::testCreateViewTextCursor() SdrView* pSdrView = pViewShell->GetView(); CPPUNIT_ASSERT(pSdrView->IsTextEdit()); + // Create an editeng text selection. + EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView(); + // 0th para, 0th char -> 0th para, 1st char. + ESelection aWordSelection(0, 0, 0, 1); + rEditView.SetSelection(aWordSelection); + // Make sure that creating a new view either doesn't affect the previous // one, or at least the effect is not visible at the end. aView1.m_aViewCursorInvalidations.clear(); @@ -1200,6 +1213,7 @@ void SdTiledRenderingTest::testCreateViewTextCursor() SfxLokHelper::createView(); pXImpressDocument->initializeForTiledRendering({}); ViewCallback aView2; + aView2.m_bViewSelectionSet = false; SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); bool bFoundCursor = false; for (const auto& rInvalidation : aView1.m_aViewCursorInvalidations) @@ -1215,6 +1229,9 @@ void SdTiledRenderingTest::testCreateViewTextCursor() // This failed: the second view created an unexpected view cursor in the // first view. CPPUNIT_ASSERT(!bFoundCursor); + // This failed: the text view selection of the first view wasn't seen by + // the second view. + CPPUNIT_ASSERT(aView2.m_bViewSelectionSet); mxComponent->dispose(); mxComponent.clear(); diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index d5fce1d..8513599 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -88,6 +88,7 @@ #include <tools/diagnose_ex.h> #include <sfx2/lokhelper.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <editeng/editview.hxx> #include "fubullet.hxx" #include "drawview.hxx" @@ -1049,7 +1050,21 @@ void ViewShellBase::NotifyCursor(SfxViewShell* pOtherShell) const if (!pDrawView) return; - pDrawView->AdjustMarkHdl(pOtherShell); + if (pDrawView->GetTextEditObject()) + { + // Blinking cursor. + EditView& rEditView = pDrawView->GetTextEditOutlinerView()->GetEditView(); + rEditView.RegisterOtherShell(pOtherShell); + rEditView.ShowCursor(); + rEditView.RegisterOtherShell(nullptr); + // Text selection, if any. + rEditView.DrawSelection(pOtherShell); + } + else + { + // Graphic selection. + pDrawView->AdjustMarkHdl(pOtherShell); + } } //===== ViewShellBase::Implementation ========================================= _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
