mobile: Center inserted shapes on visible area

Change-Id: I366ef5d01ee3afb072b1f67d24015c889a41f4b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88488
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
This commit is contained in:
Muhammet Kara
2020-02-13 06:56:01 +01:00
committed by Andras Timar
parent 09e6824bc8
commit 7a27ac1060
+12
View File
@@ -19,6 +19,7 @@
#include <comphelper/lok.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/lokhelper.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/whiter.hxx>
#include <unotools/moduleoptions.hxx>
@@ -320,6 +321,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
// calc position and size
bool bLOKIsActive = comphelper::LibreOfficeKit::isActive();
bool bIsMobile = comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView());
Point aInsertPos;
if(!bLOKIsActive)
{
@@ -328,6 +330,16 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
aInsertPos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) );
aInsertPos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) );
}
else if (bIsMobile)
{
aInsertPos = GetViewData().getLOKVisibleArea().Center();
aInsertPos.setX(sc::TwipsToHMM(aInsertPos.X()));
aInsertPos.setY(sc::TwipsToHMM(aInsertPos.Y()));
aInsertPos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) );
aInsertPos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) );
}
else
{
aInsertPos = GetInsertPos();