diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-14 10:19:43 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-12 22:06:37 -0400 |
commit | 275fee46b7fea770d25b385dae86227a72f5aa4e (patch) | |
tree | ec837626b6f9959286d557d304a8da1253dcb777 /svx | |
parent | 06faba41f1531bc51f1258fd7824ff60c2564732 (diff) |
svx: implement per-view LOK_CALLBACK_TEXT_SELECTION
To fix table shape selections.
Reviewed-on: https://gerrit.libreoffice.org/26242
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 75f4372dd6a7ff1a1029231a6e3959bfe84f6445)
Change-Id: I85810c20b8cc51646d3c8a8b974d0e8a4f96d1ae
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index d055849d3819..da6a99e00ee2 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -71,6 +71,8 @@ #include <o3tl/enumarray.hxx> #include <o3tl/enumrange.hxx> #include <cppuhelper/implbase.hxx> +#include <comphelper/lok.hxx> +#include <sfx2/viewsh.hxx> using ::editeng::SvxBorderLine; using namespace sdr::table; @@ -256,7 +258,7 @@ Point pixelToLogic(const Point& rPoint, vcl::Window* pWindow) bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWindow ) { - if (mxTableObj->GetModel()->isTiledRendering() && !pWindow) + if (comphelper::LibreOfficeKit::isActive() && !pWindow) { // Tiled rendering: get the window that has the disabled map mode. if (OutputDevice* pOutputDevice = mpView->GetFirstOutputDevice()) @@ -308,7 +310,7 @@ bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* } } - if (mxTableObj->GetModel()->isTiledRendering() && rMEvt.GetClicks() == 2 && rMEvt.IsLeft() && eHit == SDRTABLEHIT_CELLTEXTAREA) + if (comphelper::LibreOfficeKit::isActive() && rMEvt.GetClicks() == 2 && rMEvt.IsLeft() && eHit == SDRTABLEHIT_CELLTEXTAREA) { bool bEmptyOutliner = false; if (Outliner* pOutliner = mpView->GetTextEditOutliner()) @@ -2176,9 +2178,21 @@ void SvxTableController::updateSelectionOverlay() aSelection = OutputDevice::LogicToLogic(aSelection, MAP_100TH_MM, MAP_TWIP); } - pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aSelectionStart.toString().getStr()); - pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aSelectionEnd.toString().getStr()); - pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr()); + if (comphelper::LibreOfficeKit::isViewCallback()) + { + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + { + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aSelectionStart.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aSelectionEnd.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr()); + } + } + else + { + pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aSelectionStart.toString().getStr()); + pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aSelectionEnd.toString().getStr()); + pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr()); + } } } } @@ -2195,9 +2209,21 @@ void SvxTableController::destroySelectionOverlay() if (mxTableObj->GetModel()->isTiledRendering()) { // Clear the LOK text selection so far provided by this table. - mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); - mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); - mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); + if (comphelper::LibreOfficeKit::isViewCallback()) + { + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + { + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); + } + } + else + { + mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); + mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); + mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); + } } } } |