From fa4c2961b8280456d4c1484565b973d312e0bd1c Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 25 Oct 2018 23:04:39 +0200 Subject: Mark the functions as override So when poppler API breaks (as it often does) it stops compiling and someone has to fix it From 82d68cebf870ac97fd27b626a08c3fb4dd94ea3e Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 25 Oct 2018 23:06:34 +0200 Subject: GBool -> bool It was just a typedef in poppler and it'll die in next versions From f099b8e143bbeb1de3c7e89f4764006c3de61ae4 Mon Sep 17 00:00:00 2001 From: Antonio Rojas Date: Fri, 2 Nov 2018 21:23:13 +0100 Subject: Fix build with poppler 0.71 Port away from removed API diff -u a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp --- a/filters/karbon/pdf/SvgOutputDev.cpp +++ b/filters/karbon/pdf/SvgOutputDev.cpp @@ -39,7 +39,7 @@ { public: Private(const QString &fname) - : svgFile(fname), defs(0), body(0), state(gTrue) + : svgFile(fname), defs(0), body(0), state(true) , brush(Qt::SolidPattern) {} ~Private() { @@ -52,7 +52,7 @@ QString defsData; QTextStream * defs; QTextStream * body; - GBool state; + bool state; QSizeF pageSize; QPen pen; QBrush brush; @@ -62,7 +62,7 @@ : d(new Private(fileName)) { if (! d->svgFile.open(QIODevice::WriteOnly)) { - d->state = gFalse; + d->state = false; return; } @@ -75,24 +75,24 @@ delete d; } -GBool SvgOutputDev::isOk() +bool SvgOutputDev::isOk() { return d->state; } -GBool SvgOutputDev::upsideDown() +bool SvgOutputDev::upsideDown() { - return gTrue; + return true; } -GBool SvgOutputDev::useDrawChar() +bool SvgOutputDev::useDrawChar() { - return gFalse; + return false; } -GBool SvgOutputDev::interpretType3Chars() +bool SvgOutputDev::interpretType3Chars() { - return gFalse; + return false; } void SvgOutputDev::startPage(int pageNum, GfxState *state, XRef */*xref*/) @@ -387,7 +387,7 @@ return stroke; } -void SvgOutputDev::drawString(GfxState * state, GooString * s) +void SvgOutputDev::drawString(GfxState * state, const GooString * s) { int render = state->getRender(); // check for invisible text -- this is used by Acrobat Capture @@ -476,7 +476,7 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s) void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool /*inlineImg*/) + bool /*interpolate*/, int *maskColors, bool inlineImg) { ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()); imgStr->reset(); @@ -550,7 +549,0 @@ -void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - GBool /*interpolate*/, int *maskColors, GBool inlineImg) -{ - drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg); -} - --- a/filters/karbon/pdf/SvgOutputDev.h +++ b/filters/karbon/pdf/SvgOutputDev.h @@ -20,11 +20,6 @@ #ifndef SVGOUTPUTDEV_H #define SVGOUTPUTDEV_H -// Don't show this warning: it's an issue in poppler -#ifdef __GNUC__ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - #include #include @@ -44,40 +44,37 @@ explicit SvgOutputDev(const QString &fileName); virtual ~SvgOutputDev(); - GBool isOk(); + bool isOk(); - virtual GBool upsideDown(); - virtual GBool useDrawChar(); - virtual GBool interpretType3Chars(); - virtual void startPage(int pageNum, GfxState *state, XRef *xref); - virtual void endPage(); + bool upsideDown() override; + bool useDrawChar() override; + bool interpretType3Chars() override; + void startPage(int pageNum, GfxState *state, XRef *xref) override; + void endPage() override; // path painting - virtual void stroke(GfxState * state); - virtual void fill(GfxState * state); - virtual void eoFill(GfxState *state); + void stroke(GfxState * state) override; + void fill(GfxState * state) override; + void eoFill(GfxState *state) override; // text - virtual void drawString(GfxState * state, GooString * s); + void drawString(GfxState * state, const GooString * s) override; // images - virtual void drawImage(GfxState *state, Object *ref, Stream *str, + void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); - virtual void drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg); + bool interpolate, int *maskColors, bool inlineImg) override; // styles - virtual void updateAll(GfxState *state); - virtual void updateFillColor(GfxState *state); - virtual void updateStrokeColor(GfxState *state); - virtual void updateFillOpacity(GfxState *state); - virtual void updateStrokeOpacity(GfxState *state); - virtual void updateLineJoin(GfxState *state); - virtual void updateLineCap(GfxState *state); - virtual void updateMiterLimit(GfxState *state); - virtual void updateLineWidth(GfxState *state); + void updateAll(GfxState *state) override; + void updateFillColor(GfxState *state) override; + void updateStrokeColor(GfxState *state) override; + void updateFillOpacity(GfxState *state) override; + void updateStrokeOpacity(GfxState *state) override; + void updateLineJoin(GfxState *state) override; + void updateLineCap(GfxState *state) override; + void updateMiterLimit(GfxState *state) override; + void updateLineWidth(GfxState *state) override; /// Dumps content to svg file void dumpContent(); --- a/filters/karbon/pdf/PdfImport.cpp +++ b/filters/karbon/pdf/PdfImport.cpp @@ -88,9 +88,9 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt SvgOutputDev * dev = new SvgOutputDev(m_chain->outputFile()); if (dev->isOk()) { int rotate = 0; - GBool useMediaBox = gTrue; - GBool crop = gFalse; - GBool printing = gFalse; + bool useMediaBox = true; + bool crop = false; + bool printing = false; pdfDoc->displayPages(dev, firstPage, lastPage, hDPI, vDPI, rotate, useMediaBox, crop, printing); dev->dumpContent(); }