summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2016-07-05 18:57:14 +0530
committerPranav Kant <pranavk@collabora.co.uk>2016-07-05 20:24:52 +0530
commit9fee132c18b658c9ea9fb1114c1fefa56b57532a (patch)
treee7035eaf23496f3368f10e4f037ce32c67c73afa
parent04081b6907132c867041dd492408b5349f26cd42 (diff)
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
-rw-r--r--sd/source/ui/func/fuinsert.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 63410aae10e1..d63bcc0e649f 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);