summaryrefslogtreecommitdiffstats
path: root/sd
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-04-08 20:34:29 -0400
committerJan Holesovsky <kendy@collabora.com>2018-06-07 10:45:20 +0200
commit0ce7e25c0d320da58d5de1d2d16bfddcbe29538c (patch)
treebcf176292c95c7c73e98142d57dfe4b86862cc4f /sd
parentsvx: import PDF images at correct possition and scale (diff)
downloadcore-0ce7e25c0d320da58d5de1d2d16bfddcbe29538c.tar.gz
core-0ce7e25c0d320da58d5de1d2d16bfddcbe29538c.zip
svx: import PDF text using PDFium
Change-Id: I7c75477f5257931f5182b8d65e898857526bf555
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index a9ccb82633c0..0ba79eaddf71 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -128,11 +128,13 @@ bool SdPdfFilter::Import()
// Create the page and insert the Graphic.
SdPage* pPage = mrDocument.GetSdPage(nPageNumber++, PageKind::Standard);
- Point aPos;
- Size aPagSize(pPage->GetSize());
+
+ SAL_WARN("sd.filter", "Graphic PrefSize: " << aGraphic.GetPrefSize());
Size aGrfSize(OutputDevice::LogicToLogic(aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(),
MapMode(MapUnit::Map100thMM)));
+ SAL_WARN("sd.filter", "Graphic Logic Size: " << aGrfSize);
+ Size aPagSize(pPage->GetSize());
aPagSize.AdjustWidth(-(pPage->GetLeftBorder() + pPage->GetRightBorder()));
aPagSize.AdjustHeight(-(pPage->GetUpperBorder() + pPage->GetLowerBorder()));
@@ -140,8 +142,8 @@ bool SdPdfFilter::Import()
if (((aGrfSize.Height() > aPagSize.Height()) || (aGrfSize.Width() > aPagSize.Width()))
&& aGrfSize.Height() && aPagSize.Height())
{
- double fGrfWH = static_cast<double>(aGrfSize.Width()) / aGrfSize.Height();
- double fWinWH = static_cast<double>(aPagSize.Width()) / aPagSize.Height();
+ const double fGrfWH = static_cast<double>(aGrfSize.Width()) / aGrfSize.Height();
+ const double fWinWH = static_cast<double>(aPagSize.Width()) / aPagSize.Height();
// adjust graphic to page size (scales)
if (fGrfWH < fWinWH)
@@ -157,9 +159,12 @@ bool SdPdfFilter::Import()
}
// set output rectangle for graphic
+ Point aPos;
aPos.setX(((aPagSize.Width() - aGrfSize.Width()) >> 1) + pPage->GetLeftBorder());
aPos.setY(((aPagSize.Height() - aGrfSize.Height()) >> 1) + pPage->GetUpperBorder());
+ SAL_WARN("sd.filter", "Graphic Pos: " << aPos);
+ SAL_WARN("sd.filter", "Graphic Logic Size: " << aGrfSize);
pPage->InsertObject(new SdrGrafObj(pPage->getSdrModelFromSdrPage(), aGraphic,
::tools::Rectangle(aPos, aGrfSize)));
}