summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-03-26 21:40:36 +0100
committerTomaž Vajngerl <quikee@gmail.com>2020-03-27 09:42:53 +0100
commit52a06aeb4d8b58245fa0363fe22c7f255bcfc310 (patch)
treee90d1fc2237659c7c6fd998f388bf12fc780acb9
parente3196f3dddad6e7825db3b35e8196be35b466fd9 (diff)
clean-up SdPdfFilter implementation
Change-Id: I17f76ac8eaf8781deef076ca99c21bab7b62569e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91156 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx36
1 files changed, 9 insertions, 27 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index b7bf48547bed..22df932e7ee8 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -19,7 +19,6 @@
#include <sal/config.h>
-#include <o3tl/safeint.hxx>
#include <sfx2/docfile.hxx>
#include <svx/svdograf.hxx>
@@ -30,16 +29,7 @@
#include <vcl/graph.hxx>
#include <vcl/pdfread.hxx>
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::graphic;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::ucb;
-using namespace ::sfx2;
-
-SdPdfFilter::SdPdfFilter(SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell)
+SdPdfFilter::SdPdfFilter(SfxMedium& rMedium, sd::DrawDocShell& rDocShell)
: SdFilter(rMedium, rDocShell)
{
}
@@ -48,14 +38,11 @@ SdPdfFilter::~SdPdfFilter() {}
bool SdPdfFilter::Import()
{
- //FIXME: Replace with parsing the PDF elements to allow editing.
- //FIXME: For now we import as images for simplicity.
-
const OUString aFileName(
mrMedium.GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::NONE));
// Rendering resolution.
- const double dResolutionDPI = 96.;
+ const double dResolutionDPI = 96.0;
std::vector<std::pair<Graphic, Size>> aGraphics;
if (vcl::ImportPDFUnloaded(aFileName, aGraphics, dResolutionDPI) == 0)
@@ -78,25 +65,20 @@ bool SdPdfFilter::Import()
// Create the page and insert the Graphic.
SdPage* pPage = mrDocument.GetSdPage(nPageNumber, PageKind::Standard);
- Size aGrfSize(OutputDevice::LogicToLogic(aSize, rGraphic.GetPrefMapMode(),
- MapMode(MapUnit::Map100thMM)));
+ Size aGraphicSize(OutputDevice::LogicToLogic(aSize, rGraphic.GetPrefMapMode(),
+ MapMode(MapUnit::Map100thMM)));
// Resize to original size based on 72 dpi to preserve page size.
- aGrfSize = Size(aGrfSize.Width() * 72. / dResolutionDPI,
- aGrfSize.Height() * 72. / dResolutionDPI);
+ aGraphicSize = Size(aGraphicSize.Width() * 72.0 / dResolutionDPI,
+ aGraphicSize.Height() * 72.0 / dResolutionDPI);
// Make the page size match the rendered image.
- pPage->SetSize(aGrfSize);
- Point aPos(0, 0);
+ pPage->SetSize(aGraphicSize);
+ Point aPosition(0, 0);
SdrGrafObj* pSdrGrafObj = new SdrGrafObj(pPage->getSdrModelFromSdrPage(), rGraphic,
- tools::Rectangle(aPos, aGrfSize));
+ tools::Rectangle(aPosition, aGraphicSize));
pPage->InsertObject(pSdrGrafObj);
-
- // we know that the initial bitmap we provided was just a placeholder,
- // we need to swap it out, so that on the next swap in, we render the
- // correct one
- // const_cast<GraphicObject&>(pSdrGrafObj->GetGraphicObject()).SwapOut();
}
return true;