Try again to compile with poppler 0.76.

[GB.PDF]
* BUG: Try again to compile with poppler 0.76.
This commit is contained in:
gambas 2019-05-01 14:39:44 +02:00
parent c14a481b95
commit 0f044b9512
2 changed files with 41 additions and 20 deletions

View file

@ -717,7 +717,7 @@ PDF document index
BEGIN_PROPERTY(PDFDOCUMENT_has_index)
GB.ReturnBoolean(THIS->index && THIS->index->getLength());
GB.ReturnBoolean(THIS->index && CPDF_index_count());
END_PROPERTY
@ -725,45 +725,45 @@ BEGIN_PROPERTY(PDFDOCUMENT_index)
if (!THIS->index) { GB.ReturnNull(); return; }
THIS->action=((OutlineItem*)THIS->index->get(THIS->currindex))->getAction();
THIS->action=(CPDF_index_get(THIS->currindex))->getAction();
RETURN_SELF();
END_PROPERTY
BEGIN_PROPERTY(PDFINDEX_count)
GB.ReturnInteger(THIS->index->getLength());
GB.ReturnInteger(CPDF_index_count());
END_PROPERTY
BEGIN_PROPERTY(PDFINDEX_has_children)
OutlineItem *item;
OutlineItem *item = CPDF_index_get(THIS->currindex);
item = (OutlineItem *)THIS->index->get (THIS->currindex);
GB.ReturnBoolean(item->getKids() && item->getKids()->getLength());
END_PROPERTY
BEGIN_PROPERTY(PDFINDEX_is_open)
OutlineItem *item;
item = (OutlineItem *)THIS->index->get (THIS->currindex);
OutlineItem *item = CPDF_index_get(THIS->currindex);
if (READ_PROPERTY)
{ GB.ReturnBoolean(item->isOpen()); return; }
{
GB.ReturnBoolean(item->isOpen());
return;
}
if (VPROP(GB_INTEGER)) item->open();
else item->close();
if (VPROP(GB_INTEGER))
item->open();
else
item->close();
END_PROPERTY
BEGIN_PROPERTY(PDFINDEX_title)
OutlineItem *item;
item = (OutlineItem *)THIS->index->get (THIS->currindex);
OutlineItem *item = CPDF_index_get(THIS->currindex);
return_unicode_string(item->getTitle(), item->getTitleLength());
END_PROPERTY
@ -792,8 +792,11 @@ END_METHOD
BEGIN_METHOD_VOID(PDFINDEX_next)
if ( (THIS->currindex+1) >= (uint32_t)THIS->index->getLength() )
{ GB.ReturnBoolean(true); return; }
if ((THIS->currindex + 1) >= (uint)CPDF_index_count())
{
GB.ReturnBoolean(true);
return;
}
THIS->currindex++;
GB.ReturnBoolean(false);
@ -802,9 +805,7 @@ END_METHOD
BEGIN_METHOD_VOID(PDFINDEX_child)
OutlineItem *item;
item = (OutlineItem *)THIS->index->get (THIS->currindex);
OutlineItem *item = CPDF_index_get(THIS->currindex);
if (!item->hasKids() || item->getKids()->getLength() == 0) { GB.ReturnBoolean(true); return; }

View file

@ -31,12 +31,19 @@
#include <Page.h>
#if POPPLER_VERSION_0_76
#include <vector>
#include <Outline.h>
#else
#include <goo/GooList.h>
#endif
#include <stdint.h>
#if POPPLER_VERSION_0_64
#if POPPLER_VERSION_0_76
#define const_LinkAction const LinkAction
#define const_LinkDest const LinkDest
#define const_GooList std::vector<OutlineItem*>
#define GooList std::vector<OutlineItem*>
#define const_GooString const GooString
#elif POPPLER_VERSION_0_64
#define const_LinkAction const LinkAction
#define const_LinkDest const LinkDest
#define const_GooList const GooList
@ -68,6 +75,19 @@ extern GB_DESC PdfModeDesc[];
#endif
#if POPPLER_VERSION_0_76
#define CPDF_index_get(_i) (THIS->index->at(_i))
#define CPDF_index_count() (THIS->index->size())
#else
#define CPDF_index_get(_i) ((OutlineItem *)(THIS->index->get(_i)))
#define CPDF_index_count() (THIS->index->getLength())
#endif
typedef
struct {
GB_BASE ob;