{
switch ( cap )
{
-#ifdef HAVE_POPPLER_0_20
case Addition:
case Modification:
case Removal:
return true;
-#endif
default:
return false;
}
void PopplerAnnotationProxy::notifyAddition( Okular::Annotation *okl_ann, int page )
{
-#ifdef HAVE_POPPLER_0_20
// Export annotation to DOM
QDomDocument doc;
QDomElement dom_ann = doc.createElement( "root" );
okl_ann->setDisposeDataFunction( disposeAnnotation );
kDebug(PDFGenerator::PDFDebug) << okl_ann->uniqueName();
-#endif
}
void PopplerAnnotationProxy::notifyModification( const Okular::Annotation *okl_ann, int page, bool appearanceChanged )
{
-#ifdef HAVE_POPPLER_0_20
Q_UNUSED( page );
Q_UNUSED( appearanceChanged );
}
kDebug(PDFGenerator::PDFDebug) << okl_ann->uniqueName();
-#endif
}
void PopplerAnnotationProxy::notifyRemoval( Okular::Annotation *okl_ann, int page )
{
-#ifdef HAVE_POPPLER_0_20
Poppler::Annotation *ppl_ann = qvariant_cast<Poppler::Annotation*>( okl_ann->nativeId() );
if ( !ppl_ann ) // Ignore non-native annotations
okl_ann->setNativeId( qVariantFromValue(0) ); // So that we don't double-free in disposeAnnotation
kDebug(PDFGenerator::PDFDebug) << okl_ann->uniqueName();
-#endif
}
//END PopplerAnnotationProxy implementation
break;
}
-#ifdef HAVE_POPPLER_0_22
case Poppler::Annotation::AWidget:
{
annotation = new Okular::WidgetAnnotation();
break;
}
-#endif
-#ifdef HAVE_POPPLER_0_20
case Poppler::Annotation::AScreen:
{
-#ifdef HAVE_POPPLER_0_22
Okular::ScreenAnnotation * m = new Okular::ScreenAnnotation();
annotation = m;
tieToOkularAnn = true;
*doDelete = false;
-#else
- Poppler::ScreenAnnotation * screenann = static_cast< Poppler::ScreenAnnotation * >( ann );
- Okular::MovieAnnotation * m = new Okular::MovieAnnotation();
- annotation = m;
-
- m->setMovie( createMovieFromPopplerScreen( screenann->action() ) );
-#endif
break;
}
case Poppler::Annotation::AText:
*doDelete = false;
/* fallback */
}
-#endif
default:
{
// this is uber ugly but i don't know a better way to do it without introducing a poppler::annotation dependency on core
#include <config-okular-poppler.h>
-#ifdef HAVE_POPPLER_0_20
-# include <poppler-media.h>
-#endif
+#include <poppler-media.h>
#include "annots.h"
#include "formfields.h"
Q_DECLARE_METATYPE(Poppler::Annotation*)
Q_DECLARE_METATYPE(Poppler::FontInfo)
-#ifdef HAVE_POPPLER_0_20
Q_DECLARE_METATYPE(const Poppler::LinkMovie*)
-#endif
static const int defaultPageWidth = 595;
static const int defaultPageHeight = 842;
layout->addWidget(m_forceRaster);
layout->addStretch(1);
-#if defined(Q_WS_WIN) || !defined(HAVE_POPPLER_0_20)
- m_printAnnots->setVisible( false );
-#endif
setPrintAnnots( true ); // Default value
}
movie->setShowControls( popplerMovie->showControls() );
movie->setPlayMode( (Okular::Movie::PlayMode)popplerMovie->playMode() );
movie->setAutoPlay( false ); // will be triggered by external MovieAnnotation
-#ifdef HAVE_POPPLER_0_22
movie->setShowPosterImage( popplerMovie->showPosterImage() );
movie->setPosterImage( popplerMovie->posterImage() );
-#endif
return movie;
}
const Poppler::LinkBrowse *popplerLinkBrowse;
const Poppler::LinkAction *popplerLinkAction;
const Poppler::LinkSound *popplerLinkSound;
-#ifdef HAVE_POPPLER_0_20
const Poppler::LinkMovie *popplerLinkMovie;
-#endif
Okular::DocumentViewport viewport;
bool deletePopplerLink = true;
}
break;
-#ifdef HAVE_POPPLER_0_20
case Poppler::Link::Movie:
{
deletePopplerLink = false; // we'll delete it inside resolveMediaLinkReferences() after we have resolved all references
link = movieAction;
}
break;
-#endif
}
if ( deletePopplerLink )
OKULAR_EXPORT_PLUGIN(PDFGenerator, createAboutData())
-#ifdef HAVE_POPPLER_0_16
static void PDFGeneratorPopplerDebugFunction(const QString &message, const QVariant &closure)
{
Q_UNUSED(closure);
kDebug() << "[Poppler]" << message;
}
-#endif
PDFGenerator::PDFGenerator( QObject *parent, const QVariantList &args )
: Generator( parent, args ), pdfdoc( 0 ),
setFeature( ReadRawData );
setFeature( TiledRendering );
-#ifdef HAVE_POPPLER_0_16
// You only need to do it once not for each of the documents but it is cheap enough
// so doing it all the time won't hurt either
Poppler::setDebugErrorFunction(PDFGeneratorPopplerDebugFunction, QVariant());
-#endif
}
PDFGenerator::~PDFGenerator()
void PDFGenerator::resolveMediaLinkReference( Okular::Action *action )
{
-#ifdef HAVE_POPPLER_0_20
if ( !action )
return;
return;
resolveMediaLinks<Poppler::LinkMovie, Okular::MovieAction, Poppler::MovieAnnotation, Okular::MovieAnnotation>( action, Okular::Annotation::AMovie, annotationsHash );
-
-#endif
}
void PDFGenerator::resolveMediaLinkReferences( Okular::Page *page )
psConverter->setForceRasterize(forceRasterize);
psConverter->setTitle(pstitle);
-#ifdef HAVE_POPPLER_0_20
if (!printAnnots)
psConverter->setPSOptions(psConverter->psOptions() | Poppler::PSConverter::HideAnnotations );
-#endif
userMutex()->lock();
if (psConverter->convert())
}
else if ( key == "HasUnsupportedXfaForm" )
{
-#ifdef HAVE_POPPLER_0_22
QMutexLocker ml(userMutex());
return pdfdoc->formType() == Poppler::Document::XfaForm;
-#else
- return false;
-#endif
}
return QVariant();
}
void PDFGenerator::addPages( KConfigDialog *dlg )
{
-#ifdef HAVE_POPPLER_0_24
Ui_PDFSettingsWidget pdfsw;
QWidget* w = new QWidget(dlg);
pdfsw.setupUi(w);
dlg->addPage(w, PDFSettings::self(), i18n("PDF"), "application-pdf", i18n("PDF Backend Configuration") );
-#endif
}
bool PDFGenerator::setDocumentRenderHints()
}
SET_HINT("GraphicsAntialias", true, Poppler::Document::Antialiasing)
SET_HINT("TextAntialias", true, Poppler::Document::TextAntialiasing)
-#ifdef HAVE_POPPLER_0_12_1
SET_HINT("TextHinting", false, Poppler::Document::TextHinting)
-#endif
#undef SET_HINT
-#ifdef HAVE_POPPLER_0_24
// load thin line mode
const int thinLineMode = PDFSettings::enhanceThinLines();
const bool enableThinLineSolid = thinLineMode == PDFSettings::EnumEnhanceThinLines::Solid;
pdfdoc->setRenderHint(Poppler::Document::ThinLineShape, enableShapeLineSolid);
changed = true;
}
-#endif
return changed;
}
void PDFGenerator::addAnnotations( Poppler::Page * popplerPage, Okular::Page * page )
{
-#ifdef HAVE_POPPLER_0_28
QSet<Poppler::Annotation::SubType> subtypes;
subtypes << Poppler::Annotation::AFileAttachment
<< Poppler::Annotation::ASound
<< Poppler::Annotation::ACaret;
QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations( subtypes );
-#else
- QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations();
-#endif
foreach(Poppler::Annotation *a, popplerAnnotations)
{
{
page->addAnnotation(newann);
-#ifdef HAVE_POPPLER_0_22
if ( a->subType() == Poppler::Annotation::AScreen )
{
Poppler::ScreenAnnotation *annotScreen = static_cast<Poppler::ScreenAnnotation*>( a );
if ( pageClosingLink )
widgetAnnotation->setAdditionalAction( Okular::Annotation::PageClosing, createLinkFromPopplerLink( pageClosingLink ) );
}
-#endif
if ( !doDelete )
annotationsHash.insert( newann, a );
{
case SaveChanges:
{
- // Saving files with /Encrypt is not supported before Poppler 0.22
-#ifndef HAVE_POPPLER_0_22
- QMutexLocker locker( userMutex() );
- return pdfdoc->isEncrypted() ? false : true;
-#else
+ // Saving files with /Encrypt is supported after Poppler 0.22
return true;
-#endif
}
default: ;
}
QMutexLocker locker( userMutex() );
bool success = pdfConv->convert();
-#ifdef HAVE_POPPLER_0_12_1
if (!success)
{
switch (pdfConv->lastError())
{
case Poppler::BaseConverter::NotSupportedInputFileError:
-#ifndef HAVE_POPPLER_0_22
- // This can only happen with Poppler before 0.22
- *errorText = i18n("Saving files with /Encrypt is not supported.");
-#endif
+ // This can only happen with Poppler before 0.22 and /Encrypt
break;
case Poppler::BaseConverter::NoError:
break;
}
}
-#endif
delete pdfConv;
return success;
}