diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2017-06-27 23:35:08 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-03 12:32:51 +0200 |
commit | 0d3a367b5623639e7fdc9ce1ccc277e2597694a0 (patch) | |
tree | bd69a33834b9d85fd738c550015461453da5f16f /svx | |
parent | 9a5c39ea56bbac48f30a1a4966caa68697d8b318 (diff) |
lok - add support for in place chart editing
This commit add a minimal support for editing chart embedded in a
spreadsheet or a text document or a presentation.
Graphic object can be moved and resized, text object can be edited.
Change-Id: I8e637dabf328a94bd6bb0e309a245302cff421d8
Reviewed-on: https://gerrit.libreoffice.org/40681
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 37 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 9 |
2 files changed, 45 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index c379541d4dd8..729778bb9cf4 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -214,6 +214,22 @@ void SdrMarkView::ModelHasChanged() sSelection = "EMPTY"; else { + sal_uInt32 nTotalPaintWindows = this->PaintWindowCount(); + if (nTotalPaintWindows == 1) + { + const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + if (pWin && pWin->IsChart()) + { + const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj(); + if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin)) + { + Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow); + Point aLogicOffset = pWin->PixelToLogic(aOffsetPx); + aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY()); + } + } + } + // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK. if (mpMarkedPV) { @@ -739,10 +755,29 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) } Rectangle aRect(GetMarkedObjRect()); + Rectangle aSelection(aRect); + + if (bTiledRendering && !aRect.IsEmpty()) + { + sal_uInt32 nTotalPaintWindows = this->PaintWindowCount(); + if (nTotalPaintWindows == 1) + { + const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + if (pWin && pWin->IsChart()) + { + const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj(); + if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin)) + { + Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow); + Point aLogicOffset = pWin->PixelToLogic(aOffsetPx); + aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY()); + } + } + } + } if (bTiledRendering) { - Rectangle aSelection(aRect); OString sSelection; if (aSelection.IsEmpty()) sSelection = "EMPTY"; diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index c374c756e599..24936e9e5fee 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -62,6 +62,8 @@ #include <comphelper/lok.hxx> #include <svx/svdviter.hxx> +#include <sfx2/lokhelper.hxx> + using namespace ::com::sun::star; // interface to SdrPaintWindow @@ -1118,6 +1120,13 @@ void SdrPaintView::ShowItemBrowser(bool bShow) void SdrPaintView::MakeVisible(const Rectangle& rRect, vcl::Window& rWin) { + // TODO: handle when the text cursor goes out of the chart area + // However this hack avoids that the cursor gets misplaced wrt the text. + if (comphelper::LibreOfficeKit::isActive() && rWin.IsChart()) + { + return; + } + MapMode aMap(rWin.GetMapMode()); Size aActualSize(rWin.GetOutputSize()); |