sd lok: Fix image insertion

OutputDevice::GetOutputSizePixel() returns invalid value for LOK
case which leads to incorrect image positioning when inserted.

Lets use page size for LOK, and place the image correctly to center
of the page.

Change-Id: Ie002d9a2d638cfab954c75a8cb545a003740f547
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 63410aa..d63bcc0 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -67,6 +67,7 @@
#include <sfx2/opengrf.hxx>
#include <sfx2/viewfrm.hxx>
#include <svx/charthelper.hxx>
#include <comphelper/lok.hxx>

#include "app.hrc"
#include "sdresid.hxx"
@@ -168,12 +169,18 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
            }

            Point aPos;
            Rectangle aRect(aPos, mpWindow->GetOutputSizePixel() );
            aPos = aRect.Center();
            bool bMapModeWasEnabled(mpWindow->IsMapModeEnabled());
            mpWindow->EnableMapMode(/*true*/);
            aPos = mpWindow->PixelToLogic(aPos);
            mpWindow->EnableMapMode(bMapModeWasEnabled);
            // For LOK, set position to center of the page
            if (comphelper::LibreOfficeKit::isActive())
                aPos = Rectangle(aPos, mpView->GetSdrPageView()->GetPage()->GetSize()).Center();
            else
            {
                Rectangle aRect(aPos, mpWindow->GetOutputSizePixel() );
                aPos = aRect.Center();
                bool bMapModeWasEnabled(mpWindow->IsMapModeEnabled());
                mpWindow->EnableMapMode(/*true*/);
                aPos = mpWindow->PixelToLogic(aPos);
                mpWindow->EnableMapMode(bMapModeWasEnabled);
            }

            SdrGrafObj* pGrafObj = mpView->InsertGraphic(aGraphic, nAction, aPos, pPickObj, nullptr);