diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-12-07 13:25:59 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-12-15 12:35:04 +0100 |
commit | f0863c1495a65731b1bc475bc0b5fd269b0f2764 (patch) | |
tree | 8478faad95f90e2a9d1829ce26b5718a57affb95 | |
parent | bda03d99d1a9fb1eb01b6857f079b0cdc597bddf (diff) |
lok: Insert shape at the positon of the selected cell
Calculation of the visible area is not working correctly in
online case which leads to positioning of the shape outisde
of the view.
Instead of that calculation use the selected cell's position
to insert the shape at, similar how image insertion works.
Change-Id: I5c887261556c491962ed19f416ce480a63c24a9a
(cherry picked from commit 076675d5b57ad779a15e25c2105127d86e849fbb)
-rw-r--r-- | sc/source/ui/view/tabvwsh2.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index 93e1f729ec1f..477fce8438c6 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -326,11 +326,21 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) sal_uInt32 nDefaultObjectSizeHeight = rAppOpt.GetDefaultObjectSizeHeight(); // calc position and size - tools::Rectangle aVisArea = pWin->PixelToLogic(tools::Rectangle(Point(0,0), pWin->GetOutputSizePixel())); - Point aPagePos = aVisArea.Center(); - aPagePos.X() -= nDefaultObjectSizeWidth / 2; - aPagePos.Y() -= nDefaultObjectSizeHeight / 2; - tools::Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight)); + bool bLOKIsActive = comphelper::LibreOfficeKit::isActive(); + Point aInsertPos; + if(!bLOKIsActive) + { + tools::Rectangle aVisArea = pWin->PixelToLogic(tools::Rectangle(Point(0,0), pWin->GetOutputSizePixel())); + aInsertPos = aVisArea.Center(); + aInsertPos.X() -= nDefaultObjectSizeWidth / 2; + aInsertPos.Y() -= nDefaultObjectSizeHeight / 2; + } + else + { + aInsertPos = GetInsertPos(); + } + + tools::Rectangle aNewObjectRectangle(aInsertPos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight)); ScDrawView* pDrView = GetScDrawView(); |