diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2017-06-27 23:35:08 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2017-08-03 10:58:59 +0200 |
commit | eba883c8a2ce045fc7bd3848d796ca10b7f4ba51 (patch) | |
tree | a6a5684a36725e67a24eab86fa984c38252cb2d9 /editeng | |
parent | 166f13ef65b4a0eb9927eff2ffe5bac319785ee7 (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 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 4f35f97227ce..22efd056dbee 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -376,6 +376,17 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou { std::vector<tools::Rectangle> aRectangles; pRegion->GetRegionRectangles(aRectangles); + if (pOutWin->IsChart()) + { + const vcl::Window* pViewShellWindow = mpViewShell->GetEditWindowForActiveOLEObj(); + if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pOutWin)) + { + Point aOffsetPx = pOutWin->GetOffsetPixelFrom(*pViewShellWindow); + Point aLogicOffset = pOutWin->PixelToLogic(aOffsetPx); + for (tools::Rectangle& rRect : aRectangles) + rRect.Move(aLogicOffset.getX(), aLogicOffset.getY()); + } + } if (!aRectangles.empty()) { @@ -1017,8 +1028,19 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) if (comphelper::LibreOfficeKit::isActive() && mpViewShell) { - const Point& rPos = GetCursor()->GetPos(); - tools::Rectangle aRect(rPos.getX(), rPos.getY(), rPos.getX() + GetCursor()->GetWidth(), rPos.getY() + GetCursor()->GetHeight()); + Point aPos = GetCursor()->GetPos(); + if (pOutWin->IsChart()) + { + const vcl::Window* pViewShellWindow = mpViewShell->GetEditWindowForActiveOLEObj(); + if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pOutWin)) + { + Point aOffsetPx = pOutWin->GetOffsetPixelFrom(*pViewShellWindow); + Point aLogicOffset = pOutWin->PixelToLogic(aOffsetPx); + aPos.Move(aLogicOffset.getX(), aLogicOffset.getY()); + } + } + + tools::Rectangle aRect(aPos.getX(), aPos.getY(), aPos.getX() + GetCursor()->GetWidth(), aPos.getY() + GetCursor()->GetHeight()); // LOK output is always in twips, convert from mm100 if necessary. if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::Map100thMM) |