[Libreoffice-commits] core.git: Branch 'feature/pdfium-master' - svx/source

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jun 7 01:01:07 UTC 2018


 svx/source/svdraw/svdedtv2.cxx |    3 ++-
 svx/source/svdraw/svdpdf.cxx   |   31 +++++++++++++++++--------------
 svx/source/svdraw/svdpdf.hxx   |   10 +++++++---
 3 files changed, 26 insertions(+), 18 deletions(-)

New commits:
commit e8ed40a1aad32be21179afdb3b64a20be1f80d10
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Jun 6 20:58:18 2018 -0400

    svx: don't re-declare pdfium structs
    
    They aren't needed when fpdfview.h is
    included and clang reservedid plugin complains
    of the double-underscores.
    
    Also, wrap the PDFium importer class in
    HAVE_FEATURE_PDFIUM to avoid build failure
    when PDFium is missing.
    
    Change-Id: Ibc285aea575acf72541866c534ef943e0bb89466

diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index ae7fa5414fec..9adec973de3d 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -2057,13 +2057,14 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
             }
             else if (pGraf->isEmbeddedPdfData())
             {
+#if HAVE_FEATURE_PDFIUM
                 aLogicRect = pGraf->GetLogicRect();
                 ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect, pGraf->getEmbeddedPdfData());
                 if (pGraf->getEmbeddedPageNumber() < aFilter.GetPageCount())
                 {
                     nInsAnz = aFilter.DoImport(*pOL, nInsPos, pGraf->getEmbeddedPageNumber(), pProgrInfo);
                 }
-
+#endif // HAVE_FEATURE_PDFIUM
             }
         }
 
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 6347c7dc1352..609a6c0cddd7 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -26,7 +26,6 @@
 #include <fpdf_edit.h>
 #include <fpdf_save.h>
 #include <fpdf_text.h>
-#endif
 
 #include <vcl/bitmapaccess.hxx>
 #include <vcl/graph.hxx>
@@ -207,7 +206,7 @@ ImpSdrPdfImport::~ImpSdrPdfImport()
 }
 
 void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport,
-                                    int nPageIndex)
+                                int nPageIndex)
 {
     const int nPageCount = FPDF_GetPageCount(mpPdfDocument);
     if (nPageCount > 0 && nPageIndex >= 0 && nPageIndex < nPageCount)
@@ -232,19 +231,19 @@ void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pAction
         {
             FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage, nPageObjectIndex);
             ImportPdfObject(pPageObject, pTextPage, nPageObjectIndex);
-        if (pProgrInfo && pActionsToReport)
-        {
-            (*pActionsToReport)++;
+            if (pProgrInfo && pActionsToReport)
+            {
+                (*pActionsToReport)++;
 
                 if (*pActionsToReport >= 16)
-            {
-                if (!pProgrInfo->ReportActions(*pActionsToReport))
-                    break;
+                {
+                    if (!pProgrInfo->ReportActions(*pActionsToReport))
+                        break;
 
-                *pActionsToReport = 0;
+                    *pActionsToReport = 0;
+                }
             }
         }
-    }
 
         FPDFText_ClosePage(pTextPage);
         FPDF_ClosePage(pPdfPage);
@@ -1041,8 +1040,8 @@ void ImpSdrPdfImport::MapScaling()
 
 void ImpSdrPdfImport::ImportImage(FPDF_PAGEOBJECT pPageObject, int /*nPageObjectIndex*/)
 {
-    std::unique_ptr<std::remove_pointer<FPDF_BITMAP>::type, FPDFBitmapDeleter>
-                        bitmap(FPDFImageObj_GetBitmapBgra(pPageObject));
+    std::unique_ptr<std::remove_pointer<FPDF_BITMAP>::type, FPDFBitmapDeleter> bitmap(
+        FPDFImageObj_GetBitmapBgra(pPageObject));
     if (!bitmap)
     {
         SAL_WARN("sd.filter", "Failed to get IMAGE");
@@ -1220,7 +1219,8 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int /*nPageObjectI
     else
         mpVD->SetLineColor(COL_TRANSPARENT);
 
-    if (!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aPolyPoly)))
+    if (!mbLastObjWasPolyWithoutLine
+        || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aPolyPoly)))
     {
         SdrPathObj* pPath = new SdrPathObj(*mpModel, OBJ_POLY, aPolyPoly);
         SetAttributes(pPath);
@@ -1238,7 +1238,8 @@ Point ImpSdrPdfImport::PointsToLogic(double x, double y) const
     return aPos;
 }
 
-tools::Rectangle ImpSdrPdfImport::PointsToLogic(double left, double right, double top, double bottom) const
+tools::Rectangle ImpSdrPdfImport::PointsToLogic(double left, double right, double top,
+                                                double bottom) const
 {
     top = correctVertOrigin(top);
     bottom = correctVertOrigin(bottom);
@@ -1254,4 +1255,6 @@ tools::Rectangle ImpSdrPdfImport::PointsToLogic(double left, double right, doubl
     return aRect;
 }
 
+#endif // HAVE_FEATURE_PDFIUM
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdpdf.hxx b/svx/source/svdraw/svdpdf.hxx
index dfb4b9ad2946..37f112eeda28 100644
--- a/svx/source/svdraw/svdpdf.hxx
+++ b/svx/source/svdraw/svdpdf.hxx
@@ -20,6 +20,9 @@
 #ifndef INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX
 #define INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX
 
+#include <config_features.h>
+
+#if HAVE_FEATURE_PDFIUM
 #include <sal/config.h>
 
 #include <memory>
@@ -32,6 +35,8 @@
 #include <svx/xdash.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 
+#include <fpdfview.h>
+
 // Forward Declarations
 
 class SfxItemSet;
@@ -40,9 +45,6 @@ class SdrModel;
 class SdrPage;
 class SdrObject;
 class SvdProgressInfo;
-typedef struct fpdf_document_t__* FPDF_DOCUMENT;
-typedef struct fpdf_pageobject_t__* FPDF_PAGEOBJECT;  // (text, path, etc.)
-typedef struct fpdf_textpage_t__* FPDF_TEXTPAGE;
 
 // Helper Class to import PDF
 class ImpSdrPdfImport final
@@ -239,6 +241,8 @@ public:
                     SvdProgressInfo* pProgrInfo = nullptr);
 };
 
+#endif // HAVE_FEATURE_PDFIUM
+
 #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list