diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-13 16:49:03 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-14 10:11:42 +0200 |
commit | 1ac8217f6114943002730502ebafd8617d2fd5c1 (patch) | |
tree | 589072e5045a3f93cafbbb38286a61cd0002747b /editeng/source/editeng | |
parent | 4d9bb7120a2ca27207b30d81d77a810a306fbe04 (diff) |
sw draw text: emit LOK_CALLBACK_TEXT_VIEW_SELECTION from registerCallback()
With this, in case the first view has an active text edit selection and
a new view is created, then the text selection is instantly visible in
the second view, even if the first view's text selection does not change
later.
Change-Id: I3255febd5d65d6576ddbc57cf96836bdf0b06a72
(cherry picked from commit 2ea385a54b53797ab3960869012f3ce3268eab2c)
Diffstat (limited to 'editeng/source/editeng')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 7 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 17 |
2 files changed, 20 insertions, 4 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 51d9cd42d3b9..ee6a864f5394 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1361,4 +1361,11 @@ void EditView::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool ShowCursor(/*bGotoCursor=*/false); } +void EditView::DrawSelection(OutlinerViewShell* pOtherShell) +{ + pImpEditView->RegisterOtherShell(pOtherShell); + pImpEditView->DrawSelection(); + pImpEditView->RegisterOtherShell(nullptr); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 3fa2b5111d37..83a8e352943c 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -375,8 +375,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou aOrigin = pOutWin->GetMapMode().GetOrigin(); OString sRectangle; - // If we are not in selection mode, then the exported selection should be empty. - if (pEditEngine->pImpEditEngine->IsInSelectionMode()) + // If we are not in selection mode, then the exported own selection should be empty. + if (pEditEngine->pImpEditEngine->IsInSelectionMode() || mpOtherShell) { std::vector<Rectangle> aRectangles; pRegion->GetRegionRectangles(aRectangles); @@ -412,8 +412,17 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou sRectangle = comphelper::string::join("; ", v); } - mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr()); - mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRectangle); + if (mpOtherShell) + { + // An other shell wants to know about our existing selection. + if (mpViewShell != mpOtherShell) + mpViewShell->NotifyOtherView(mpOtherShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRectangle); + } + else + { + mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr()); + mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRectangle); + } pOutWin->Pop(); } |