diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-12-14 16:56:25 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-12-14 20:32:43 +0100 |
commit | edf6819a7dca6348954d6cbefb19631448602774 (patch) | |
tree | c1511937e6e2dd070d53fb300381e42b2bfcef86 /sc | |
parent | b052974a6574e4074794ffa590fe60f7c1726768 (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
Reviewed-on: https://gerrit.libreoffice.org/65177
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-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 531aa9052f9c..b21fdd31fd0c 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -324,11 +324,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.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) ); - aPagePos.AdjustY( -sal_Int32(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.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) ); + aInsertPos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) ); + } + else + { + aInsertPos = GetInsertPos(); + } + + tools::Rectangle aNewObjectRectangle(aInsertPos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight)); ScDrawView* pDrView = GetScDrawView(); |