summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-06-27 23:35:08 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2017-08-03 10:58:59 +0200
commiteba883c8a2ce045fc7bd3848d796ca10b7f4ba51 (patch)
treea6a5684a36725e67a24eab86fa984c38252cb2d9 /svx
parent166f13ef65b4a0eb9927eff2ffe5bac319785ee7 (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 objects can be moved and resized, text objects can be edited. Change-Id: I8e637dabf328a94bd6bb0e309a245302cff421d8 Reviewed-on: https://gerrit.libreoffice.org/39342 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdmrkv.cxx37
-rw-r--r--svx/source/svdraw/svdpntv.cxx9
2 files changed, 45 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index ce62affb411c..938ce9e60370 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -207,6 +207,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)
{
@@ -732,10 +748,29 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
}
tools::Rectangle aRect(GetMarkedObjRect());
+ tools::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)
{
- tools::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 7642a1ce2e7b..4ac29efb0e08 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -59,6 +59,8 @@
#include <comphelper/lok.hxx>
#include <svx/svdviter.hxx>
+#include <sfx2/lokhelper.hxx>
+
using namespace ::com::sun::star;
// interface to SdrPaintWindow
@@ -1115,6 +1117,13 @@ void SdrPaintView::ShowItemBrowser(bool bShow)
void SdrPaintView::MakeVisible(const tools::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());