[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 2 commits - offapi/com sd/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 6 17:26:33 UTC 2020


 offapi/com/sun/star/graphic/XPdfDecomposer.idl |    2 -
 sd/source/filter/pdf/sdpdffilter.cxx           |   36 ++++++-------------------
 2 files changed, 11 insertions(+), 27 deletions(-)

New commits:
commit 92c204382522b2b363cbefb260b199476d04b992
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Mar 18 14:14:13 2020 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Jun 6 19:26:15 2020 +0200

    XPdfDecomposer - fix the described property name
    
    The propery name should be "PageIndex" and not "Page"
    
    Change-Id: Ic8d012abcfcb3381bb287bc43ca1d776c2c4ac95
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95632
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/offapi/com/sun/star/graphic/XPdfDecomposer.idl b/offapi/com/sun/star/graphic/XPdfDecomposer.idl
index aae6eda55347..a5563e0294e5 100644
--- a/offapi/com/sun/star/graphic/XPdfDecomposer.idl
+++ b/offapi/com/sun/star/graphic/XPdfDecomposer.idl
@@ -30,7 +30,7 @@ interface XPdfDecomposer : ::com::sun::star::uno::XInterface
         @param xDecompositionParameters
         Parameters for decomposition. Parameters include:
 
-        sal_Int32 Page - which page to use
+        sal_Int32 PageIndex - which page to use
 
         @since LibreOffice 7.0
      */
commit ce617fdcedb7f495b5b20859f54419443bba1d74
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: Sat Jun 6 19:26:02 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/+/95633
    Tested-by: Tomaž Vajngerl <quikee 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 88986fe0e477..8980e902ec73 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 #include <sfx2/docfile.hxx>
 #include <svx/svdograf.hxx>
 
@@ -27,16 +28,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)
 {
 }
@@ -45,14 +37,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)
@@ -75,25 +64,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