diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-26 11:53:57 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-30 09:23:53 +0200 |
commit | 62d03f6c6109755375a93681ffcc7196827cfd0c (patch) | |
tree | adef4c417b20372a84443ce6ce10d31dd25a4a8f | |
parent | 741599f3e56c2ae6656377cdac6bc19512513876 (diff) |
SdrTableObj tiled rendering: implement selection callbacks
This makes selections of Impress tables visible. Double-click in an
empty cell doesn't select the cell yet, neither extending cell text
selections into table ones work, but it's a start.
Change-Id: Idb8921d980ac9d7ab363c68c91c1a9e6cf0918e3
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 181adf933427..27d6a7d87367 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -66,6 +66,7 @@ #include "tableundo.hxx" #include "tablelayouter.hxx" #include <vcl/msgbox.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <memory> using ::editeng::SvxBorderLine; @@ -2077,18 +2078,18 @@ void SvxTableController::updateSelectionOverlay() { sdr::overlay::OverlayObjectCell::RangeVector aRanges; - Rectangle aRect; + Rectangle aStartRect, aEndRect; CellPos aStart,aEnd; getSelectedCells( aStart, aEnd ); - pTableObj->getCellBounds( aStart, aRect ); + pTableObj->getCellBounds( aStart, aStartRect ); - basegfx::B2DRange a2DRange( basegfx::B2DPoint(aRect.Left(), aRect.Top()) ); - a2DRange.expand( basegfx::B2DPoint(aRect.Right(), aRect.Bottom()) ); + basegfx::B2DRange a2DRange( basegfx::B2DPoint(aStartRect.Left(), aStartRect.Top()) ); + a2DRange.expand( basegfx::B2DPoint(aStartRect.Right(), aStartRect.Bottom()) ); findMergeOrigin( aEnd ); - pTableObj->getCellBounds( aEnd, aRect ); - a2DRange.expand( basegfx::B2DPoint(aRect.Left(), aRect.Top()) ); - a2DRange.expand( basegfx::B2DPoint(aRect.Right(), aRect.Bottom()) ); + pTableObj->getCellBounds( aEnd, aEndRect ); + a2DRange.expand( basegfx::B2DPoint(aEndRect.Left(), aEndRect.Top()) ); + a2DRange.expand( basegfx::B2DPoint(aEndRect.Right(), aEndRect.Bottom()) ); aRanges.push_back( a2DRange ); ::Color aHighlight( COL_BLUE ); @@ -2116,6 +2117,27 @@ void SvxTableController::updateSelectionOverlay() } } } + + // If tiled rendering, emit callbacks for sdr table selection. + if (pOutDev && pTableObj->GetModel()->isTiledRendering()) + { + // Left edge of aStartRect. + Rectangle aSelectionStart(aStartRect.Left(), aStartRect.Top(), aStartRect.Left(), aStartRect.Bottom()); + // Right edge of aEndRect. + Rectangle aSelectionEnd(aEndRect.Right(), aEndRect.Top(), aEndRect.Right(), aEndRect.Bottom()); + Rectangle aSelection(a2DRange.getMinX(), a2DRange.getMinY(), a2DRange.getMaxX(), a2DRange.getMaxY()); + + if (pOutDev->GetMapMode().GetMapUnit() == MAP_100TH_MM) + { + aSelectionStart = OutputDevice::LogicToLogic(aSelectionStart, MAP_100TH_MM, MAP_TWIP); + aSelectionEnd = OutputDevice::LogicToLogic(aSelectionEnd, MAP_100TH_MM, MAP_TWIP); + 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()); + } } } } @@ -2128,6 +2150,14 @@ void SvxTableController::destroySelectionOverlay() { delete mpSelectionOverlay; mpSelectionOverlay = 0; + + 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"); + } } } |