[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - svx/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 26 10:26:42 UTC 2019


 svx/source/svdraw/svdpdf.cxx |   27 ++++++++++++++-------------
 svx/source/svdraw/svdpdf.hxx |   10 +++++++---
 2 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 76f7698008eb49ed5ae2098a3c10def0a5d6274a
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Jun 6 20:58:18 2018 -0400
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Mar 26 11:26:20 2019 +0100

    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
    Reviewed-on: https://gerrit.libreoffice.org/69622
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 5193ce50b2f6..d776e3771bc0 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -206,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)
@@ -231,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);
@@ -1040,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,9 +1220,10 @@ 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(OBJ_POLY, aPolyPoly);
+        SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aPolyPoly);
         pPath->SetModel(mpModel);
         SetAttributes(pPath);
         InsertObj(pPath, false);
diff --git a/svx/source/svdraw/svdpdf.hxx b/svx/source/svdraw/svdpdf.hxx
index 6b4b0d63a816..d3ea4aece8c4 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
@@ -238,6 +240,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