[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sd/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 1 06:47:47 UTC 2020
sd/source/filter/pdf/sdpdffilter.cxx | 36 ++++++++---------------------------
1 file changed, 9 insertions(+), 27 deletions(-)
New commits:
commit 44cf3b61538990608fcfe72c727d35e43cbef5f5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Mar 26 21:40:36 2020 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Apr 1 08:47:16 2020 +0200
clean-up SdPdfFilter implementation
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91156
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 52a06aeb4d8b58245fa0363fe22c7f255bcfc310)
Change-Id: I17f76ac8eaf8781deef076ca99c21bab7b62569e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91444
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index e40bd98b5799..810ee907bbdb 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -75,17 +75,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 com::sun::star::ui::dialogs;
-using namespace ::sfx2;
-
-SdPdfFilter::SdPdfFilter(SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell)
+SdPdfFilter::SdPdfFilter(SfxMedium& rMedium, sd::DrawDocShell& rDocShell)
: SdFilter(rMedium, rDocShell)
{
}
@@ -94,14 +84,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)
@@ -124,25 +111,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;
More information about the Libreoffice-commits
mailing list