diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-13 16:48:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-13 16:48:28 +0200 |
commit | 586789fe757c0eb350c360a49cf90431a0bd5b24 (patch) | |
tree | 0ba705458d22b67b9665fc5ecb8ca969dc06e307 /editeng | |
parent | 798d55fcd8efc10fcef6b8ac3fa5abdbc82501ec (diff) |
sw draw text: emit LOK_CALLBACK_INVALIDATE_VIEW_CURSOR from registerCallback()
With this, in case the first view has an active text edit and a new view
is created, then the cursor position is instantly visible in the second
view, even if the first view's cursor does not move later.
Change-Id: Ia82e7dc1ce9bb58c67a280179ecadc74d3b63026
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 19 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 4 |
3 files changed, 26 insertions, 2 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 1bc28d3ad979..f7f01f154af5 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -592,6 +592,11 @@ void EditView::RegisterViewShell(OutlinerViewShell* pViewShell) pImpEditView->RegisterViewShell(pViewShell); } +void EditView::RegisterOtherShell(OutlinerViewShell* pOtherShell) +{ + pImpEditView->RegisterOtherShell(pOtherShell); +} + void EditView::SetControlWord( EVControlBits nWord ) { pImpEditView->nControl = nWord; diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 36b08ebea2fb..c0d920197a40 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -80,6 +80,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo pPointer = nullptr; pBackgroundColor = nullptr; mpViewShell = nullptr; + mpOtherShell = nullptr; nScrollDiffX = 0; nExtraCursorFlags = 0; nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW; @@ -122,6 +123,11 @@ void ImpEditView::RegisterViewShell(OutlinerViewShell* pViewShell) mpViewShell = pViewShell; } +void ImpEditView::RegisterOtherShell(OutlinerViewShell* pOtherShell) +{ + mpOtherShell = pOtherShell; +} + const OutlinerViewShell* ImpEditView::GetViewShell() const { return mpViewShell; @@ -1005,8 +1011,17 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) aRect.setWidth(0); OString sRect = aRect.toString(); - mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); - mpViewShell->NotifyOtherViews(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect); + if (mpOtherShell) + { + // An other shell wants to know about our existing cursor. + if (mpViewShell != mpOtherShell) + mpViewShell->NotifyOtherView(mpOtherShell, LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect); + } + else + { + mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); + mpViewShell->NotifyOtherViews(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect); + } } CursorDirection nCursorDir = CursorDirection::NONE; diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 612fe41f7236..3daf3313a2fe 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -223,6 +223,8 @@ private: Color* pBackgroundColor; /// Containing view shell, if any. OutlinerViewShell* mpViewShell; + /// An other shell, just listening to our state, if any. + OutlinerViewShell* mpOtherShell; EditEngine* pEditEngine; VclPtr<vcl::Window> pOutWin; Pointer* pPointer; @@ -370,6 +372,8 @@ public: /// Informs this edit view about which view shell contains it. void RegisterViewShell(OutlinerViewShell* pViewShell); const OutlinerViewShell* GetViewShell() const; + /// Informs this edit view about which other shell listens to it. + void RegisterOtherShell(OutlinerViewShell* pViewShell); bool IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong ); OUString SpellIgnoreWord(); |