|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ANNOT_H |
|
#define ANNOT_H |
|
|
|
#include <memory> |
|
#include <atomic> |
|
#include <mutex> |
|
#include <vector> |
|
|
|
#include "AnnotStampImageHelper.h" |
|
#include "Object.h" |
|
#include "poppler_private_export.h" |
|
|
|
class XRef; |
|
class Gfx; |
|
class CharCodeToUnicode; |
|
class GfxFont; |
|
class GfxResources; |
|
class Page; |
|
class PDFDoc; |
|
class Form; |
|
class FormWidget; |
|
class FormField; |
|
class FormFieldButton; |
|
class FormFieldText; |
|
class FormFieldChoice; |
|
class FormFieldSignature; |
|
class PDFRectangle; |
|
class Movie; |
|
class LinkAction; |
|
class Sound; |
|
class FileSpec; |
|
|
|
enum AnnotLineEndingStyle |
|
{ |
|
annotLineEndingSquare, |
|
annotLineEndingCircle, |
|
annotLineEndingDiamond, |
|
annotLineEndingOpenArrow, |
|
annotLineEndingClosedArrow, |
|
annotLineEndingNone, |
|
annotLineEndingButt, |
|
annotLineEndingROpenArrow, |
|
annotLineEndingRClosedArrow, |
|
annotLineEndingSlash |
|
}; |
|
|
|
enum AnnotExternalDataType |
|
{ |
|
annotExternalDataMarkupUnknown, |
|
annotExternalDataMarkup3D |
|
}; |
|
|
|
enum class VariableTextQuadding |
|
{ |
|
leftJustified, |
|
centered, |
|
rightJustified |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotCoord |
|
{ |
|
public: |
|
AnnotCoord() : x(0), y(0) { } |
|
AnnotCoord(double _x, double _y) : x(_x), y(_y) { } |
|
|
|
double getX() const { return x; } |
|
double getY() const { return y; } |
|
|
|
protected: |
|
double x, y; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotPath |
|
{ |
|
public: |
|
AnnotPath(); |
|
explicit AnnotPath(Array *array); |
|
explicit AnnotPath(std::vector<AnnotCoord> &&coords); |
|
~AnnotPath(); |
|
|
|
AnnotPath(const AnnotPath &) = delete; |
|
AnnotPath &operator=(const AnnotPath &other) = delete; |
|
|
|
double getX(int coord) const; |
|
double getY(int coord) const; |
|
AnnotCoord *getCoord(int coord); |
|
int getCoordsLength() const { return coords.size(); } |
|
|
|
protected: |
|
std::vector<AnnotCoord> coords; |
|
|
|
void parsePathArray(Array *array); |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotCalloutLine |
|
{ |
|
public: |
|
AnnotCalloutLine(double x1, double y1, double x2, double y2); |
|
virtual ~AnnotCalloutLine(); |
|
|
|
AnnotCalloutLine(const AnnotCalloutLine &) = delete; |
|
AnnotCalloutLine &operator=(const AnnotCalloutLine &other) = delete; |
|
|
|
double getX1() const { return coord1.getX(); } |
|
double getY1() const { return coord1.getY(); } |
|
double getX2() const { return coord2.getX(); } |
|
double getY2() const { return coord2.getY(); } |
|
|
|
protected: |
|
AnnotCoord coord1, coord2; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotCalloutMultiLine : public AnnotCalloutLine |
|
{ |
|
public: |
|
AnnotCalloutMultiLine(double x1, double y1, double x2, double y2, double x3, double y3); |
|
~AnnotCalloutMultiLine() override; |
|
|
|
double getX3() const { return coord3.getX(); } |
|
double getY3() const { return coord3.getY(); } |
|
|
|
protected: |
|
AnnotCoord coord3; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotBorderEffect |
|
{ |
|
public: |
|
enum AnnotBorderEffectType |
|
{ |
|
borderEffectNoEffect, |
|
borderEffectCloudy |
|
}; |
|
|
|
explicit AnnotBorderEffect(Dict *dict); |
|
|
|
AnnotBorderEffectType getEffectType() const { return effectType; } |
|
double getIntensity() const { return intensity; } |
|
|
|
private: |
|
AnnotBorderEffectType effectType; |
|
double intensity; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotQuadrilaterals |
|
{ |
|
public: |
|
class POPPLER_PRIVATE_EXPORT AnnotQuadrilateral |
|
{ |
|
public: |
|
AnnotQuadrilateral(); |
|
AnnotQuadrilateral(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); |
|
|
|
AnnotCoord coord1, coord2, coord3, coord4; |
|
}; |
|
|
|
AnnotQuadrilaterals(Array *array, PDFRectangle *rect); |
|
AnnotQuadrilaterals(std::unique_ptr<AnnotQuadrilateral[]> &&quads, int quadsLength); |
|
~AnnotQuadrilaterals(); |
|
|
|
AnnotQuadrilaterals(const AnnotQuadrilaterals &) = delete; |
|
AnnotQuadrilaterals &operator=(const AnnotQuadrilaterals &other) = delete; |
|
|
|
double getX1(int quadrilateral); |
|
double getY1(int quadrilateral); |
|
double getX2(int quadrilateral); |
|
double getY2(int quadrilateral); |
|
double getX3(int quadrilateral); |
|
double getY3(int quadrilateral); |
|
double getX4(int quadrilateral); |
|
double getY4(int quadrilateral); |
|
int getQuadrilateralsLength() const { return quadrilateralsLength; } |
|
|
|
protected: |
|
std::unique_ptr<AnnotQuadrilateral[]> quadrilaterals; |
|
int quadrilateralsLength; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotBorder |
|
{ |
|
public: |
|
enum AnnotBorderType |
|
{ |
|
typeArray, |
|
typeBS |
|
}; |
|
|
|
enum AnnotBorderStyle |
|
{ |
|
borderSolid, |
|
borderDashed, |
|
borderBeveled, |
|
borderInset, |
|
borderUnderlined |
|
}; |
|
|
|
virtual ~AnnotBorder(); |
|
|
|
AnnotBorder(const AnnotBorder &) = delete; |
|
AnnotBorder &operator=(const AnnotBorder &other) = delete; |
|
|
|
virtual void setWidth(double new_width) { width = new_width; } |
|
|
|
virtual AnnotBorderType getType() const = 0; |
|
virtual double getWidth() const { return width; } |
|
virtual const std::vector<double> &getDash() const { return dash; } |
|
virtual AnnotBorderStyle getStyle() const { return style; } |
|
|
|
virtual Object writeToObject(XRef *xref) const = 0; |
|
virtual std::unique_ptr<AnnotBorder> copy() const = 0; |
|
|
|
protected: |
|
AnnotBorder(); |
|
|
|
bool parseDashArray(Object *dashObj); |
|
|
|
AnnotBorderType type; |
|
double width; |
|
static const int DASH_LIMIT = 10; |
|
std::vector<double> dash; |
|
AnnotBorderStyle style; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotBorderArray : public AnnotBorder |
|
{ |
|
public: |
|
AnnotBorderArray(); |
|
explicit AnnotBorderArray(Array *array); |
|
|
|
void setHorizontalCorner(double hc) { horizontalCorner = hc; } |
|
void setVerticalCorner(double vc) { verticalCorner = vc; } |
|
|
|
double getHorizontalCorner() const { return horizontalCorner; } |
|
double getVerticalCorner() const { return verticalCorner; } |
|
|
|
std::unique_ptr<AnnotBorder> copy() const override; |
|
|
|
private: |
|
AnnotBorderType getType() const override { return typeArray; } |
|
Object writeToObject(XRef *xref) const override; |
|
|
|
double horizontalCorner; |
|
double verticalCorner; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotBorderBS : public AnnotBorder |
|
{ |
|
public: |
|
AnnotBorderBS(); |
|
explicit AnnotBorderBS(Dict *dict); |
|
|
|
private: |
|
AnnotBorderType getType() const override { return typeBS; } |
|
Object writeToObject(XRef *xref) const override; |
|
|
|
const char *getStyleName() const; |
|
|
|
std::unique_ptr<AnnotBorder> copy() const override; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotColor |
|
{ |
|
public: |
|
enum AnnotColorSpace |
|
{ |
|
colorTransparent = 0, |
|
colorGray = 1, |
|
colorRGB = 3, |
|
colorCMYK = 4 |
|
}; |
|
|
|
AnnotColor(); |
|
explicit AnnotColor(double gray); |
|
AnnotColor(double r, double g, double b); |
|
AnnotColor(double c, double m, double y, double k); |
|
explicit AnnotColor(Array *array, int adjust = 0); |
|
|
|
void adjustColor(int adjust); |
|
|
|
AnnotColorSpace getSpace() const { return (AnnotColorSpace)length; } |
|
const double *getValues() const { return values; } |
|
|
|
Object writeToObject(XRef *xref) const; |
|
|
|
private: |
|
double values[4]; |
|
int length; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT DefaultAppearance |
|
{ |
|
public: |
|
DefaultAppearance(Object &&fontNameA, double fontPtSizeA, std::unique_ptr<AnnotColor> &&fontColorA); |
|
explicit DefaultAppearance(const GooString *da); |
|
void setFontName(Object &&fontNameA); |
|
const Object &getFontName() const { return fontName; } |
|
void setFontPtSize(double fontPtSizeA); |
|
double getFontPtSize() const { return fontPtSize; } |
|
void setFontColor(std::unique_ptr<AnnotColor> fontColorA); |
|
const AnnotColor *getFontColor() const { return fontColor.get(); } |
|
std::string toAppearanceString() const; |
|
|
|
DefaultAppearance(const DefaultAppearance &) = delete; |
|
DefaultAppearance &operator=(const DefaultAppearance &) = delete; |
|
|
|
private: |
|
Object fontName; |
|
double fontPtSize; |
|
std::unique_ptr<AnnotColor> fontColor; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotIconFit |
|
{ |
|
public: |
|
enum AnnotIconFitScaleWhen |
|
{ |
|
scaleAlways, |
|
scaleBigger, |
|
scaleSmaller, |
|
scaleNever |
|
}; |
|
|
|
enum AnnotIconFitScale |
|
{ |
|
scaleAnamorphic, |
|
scaleProportional |
|
}; |
|
|
|
explicit AnnotIconFit(Dict *dict); |
|
|
|
AnnotIconFitScaleWhen getScaleWhen() { return scaleWhen; } |
|
AnnotIconFitScale getScale() { return scale; } |
|
double getLeft() { return left; } |
|
double getBottom() { return bottom; } |
|
bool getFullyBounds() { return fullyBounds; } |
|
|
|
protected: |
|
AnnotIconFitScaleWhen scaleWhen; |
|
AnnotIconFitScale scale; |
|
double left; |
|
double bottom; |
|
bool fullyBounds; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotAppearance |
|
{ |
|
public: |
|
enum AnnotAppearanceType |
|
{ |
|
appearNormal, |
|
appearRollover, |
|
appearDown |
|
}; |
|
|
|
AnnotAppearance(PDFDoc *docA, Object *dict); |
|
~AnnotAppearance(); |
|
|
|
|
|
Object getAppearanceStream(AnnotAppearanceType type, const char *state); |
|
|
|
|
|
std::unique_ptr<GooString> getStateKey(int i); |
|
int getNumStates(); |
|
|
|
|
|
|
|
void removeAllStreams(); |
|
|
|
|
|
bool referencesStream(Ref refToStream); |
|
|
|
private: |
|
static bool referencesStream(const Object *stateObj, Ref refToStream); |
|
void removeStream(Ref refToStream); |
|
void removeStateStreams(const Object *state); |
|
|
|
protected: |
|
PDFDoc *doc; |
|
Object appearDict; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotAppearanceCharacs |
|
{ |
|
public: |
|
enum AnnotAppearanceCharacsTextPos |
|
{ |
|
captionNoIcon, |
|
captionNoCaption, |
|
captionBelow, |
|
captionAbove, |
|
captionRight, |
|
captionLeft, |
|
captionOverlaid |
|
}; |
|
|
|
explicit AnnotAppearanceCharacs(Dict *dict); |
|
~AnnotAppearanceCharacs(); |
|
|
|
AnnotAppearanceCharacs(const AnnotAppearanceCharacs &) = delete; |
|
AnnotAppearanceCharacs &operator=(const AnnotAppearanceCharacs &) = delete; |
|
|
|
int getRotation() const { return rotation; } |
|
const AnnotColor *getBorderColor() const { return borderColor.get(); } |
|
void setBorderColor(std::unique_ptr<AnnotColor> &&color) { borderColor = std::move(color); } |
|
const AnnotColor *getBackColor() const { return backColor.get(); } |
|
void setBackColor(std::unique_ptr<AnnotColor> &&color) { backColor = std::move(color); } |
|
const GooString *getNormalCaption() const { return normalCaption.get(); } |
|
const GooString *getRolloverCaption() { return rolloverCaption.get(); } |
|
const GooString *getAlternateCaption() { return alternateCaption.get(); } |
|
const AnnotIconFit *getIconFit() { return iconFit.get(); } |
|
AnnotAppearanceCharacsTextPos getPosition() const { return position; } |
|
|
|
std::unique_ptr<AnnotAppearanceCharacs> copy() const; |
|
|
|
protected: |
|
int rotation; |
|
std::unique_ptr<AnnotColor> borderColor; |
|
std::unique_ptr<AnnotColor> backColor; |
|
std::unique_ptr<GooString> normalCaption; |
|
std::unique_ptr<GooString> rolloverCaption; |
|
std::unique_ptr<GooString> alternateCaption; |
|
|
|
|
|
|
|
std::unique_ptr<AnnotIconFit> iconFit; |
|
AnnotAppearanceCharacsTextPos position; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotAppearanceBBox |
|
{ |
|
public: |
|
explicit AnnotAppearanceBBox(PDFRectangle *rect); |
|
|
|
void setBorderWidth(double w) { borderWidth = w; } |
|
|
|
|
|
void extendTo(double x, double y); |
|
void getBBoxRect(double bbox[4]) const; |
|
|
|
|
|
double getPageXMin() const; |
|
double getPageYMin() const; |
|
double getPageXMax() const; |
|
double getPageYMax() const; |
|
|
|
private: |
|
double origX, origY, borderWidth; |
|
double minX, minY, maxX, maxY; |
|
}; |
|
|
|
|
|
|
|
|
|
class Matrix; |
|
|
|
class AnnotAppearanceBuilder |
|
{ |
|
public: |
|
AnnotAppearanceBuilder(); |
|
~AnnotAppearanceBuilder(); |
|
|
|
AnnotAppearanceBuilder(const AnnotAppearanceBuilder &) = delete; |
|
AnnotAppearanceBuilder &operator=(const AnnotAppearanceBuilder &) = delete; |
|
|
|
void setDrawColor(const AnnotColor *color, bool fill); |
|
void setLineStyleForBorder(const AnnotBorder *border); |
|
void setTextFont(const Object &fontName, double fontSize); |
|
void drawCircle(double cx, double cy, double r, bool fill); |
|
void drawEllipse(double cx, double cy, double rx, double ry, bool fill, bool stroke); |
|
void drawCircleTopLeft(double cx, double cy, double r); |
|
void drawCircleBottomRight(double cx, double cy, double r); |
|
void drawLineEnding(AnnotLineEndingStyle endingStyle, double x, double y, double size, bool fill, const Matrix &m); |
|
void drawLineEndSquare(double x, double y, double size, bool fill, const Matrix &m); |
|
void drawLineEndCircle(double x, double y, double size, bool fill, const Matrix &m); |
|
void drawLineEndDiamond(double x, double y, double size, bool fill, const Matrix &m); |
|
void drawLineEndArrow(double x, double y, double size, int orientation, bool isOpen, bool fill, const Matrix &m); |
|
void drawLineEndSlash(double x, double y, double size, const Matrix &m); |
|
void drawFieldBorder(const FormField *field, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect); |
|
bool drawFormField(const FormField *field, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, |
|
const GooString *appearState, XRef *xref, Dict *resourcesDict); |
|
static double lineEndingXShorten(AnnotLineEndingStyle endingStyle, double size); |
|
static double lineEndingXExtendBBox(AnnotLineEndingStyle endingStyle, double size); |
|
void writeString(const std::string &str); |
|
|
|
void append(const char *text); |
|
void appendf(const char *fmt, ...) GOOSTRING_FORMAT; |
|
|
|
const GooString *buffer() const; |
|
|
|
private: |
|
enum DrawTextFlags |
|
{ |
|
NoDrawTextFlags = 0, |
|
MultilineDrawTextFlag = 1, |
|
EmitMarkedContentDrawTextFlag = 2, |
|
ForceZapfDingbatsDrawTextFlag = 4, |
|
TurnTextToStarsDrawTextFlag = 8 |
|
}; |
|
|
|
bool drawListBox(const FormFieldChoice *fieldChoice, const AnnotBorder *border, const PDFRectangle *rect, const GooString *da, const GfxResources *resources, VariableTextQuadding quadding, XRef *xref, Dict *resourcesDict); |
|
bool drawFormFieldButton(const FormFieldButton *field, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, |
|
const GooString *appearState, XRef *xref, Dict *resourcesDict); |
|
bool drawFormFieldText(const FormFieldText *fieldText, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, XRef *xref, |
|
Dict *resourcesDict); |
|
bool drawFormFieldChoice(const FormFieldChoice *fieldChoice, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, |
|
XRef *xref, Dict *resourcesDict); |
|
bool drawSignatureFieldText(const FormFieldSignature *field, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, |
|
XRef *xref, Dict *resourcesDict); |
|
void drawSignatureFieldText(const GooString &text, const Form *form, const DefaultAppearance &da, const AnnotBorder *border, const PDFRectangle *rect, XRef *xref, Dict *resourcesDict, double leftMargin, bool centerVertically, |
|
bool centerHorizontally); |
|
bool drawText(const GooString *text, const Form *form, const GooString *da, const GfxResources *resources, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, |
|
const VariableTextQuadding quadding, XRef *xref, Dict *resourcesDict, const int flags = NoDrawTextFlags, const int nCombs = 0); |
|
void drawArrowPath(double x, double y, const Matrix &m, int orientation = 1); |
|
|
|
GooString *appearBuf; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT Annot |
|
{ |
|
friend class Annots; |
|
friend class Page; |
|
|
|
public: |
|
enum AnnotFlag |
|
{ |
|
flagUnknown = 0x0000, |
|
flagInvisible = 0x0001, |
|
flagHidden = 0x0002, |
|
flagPrint = 0x0004, |
|
flagNoZoom = 0x0008, |
|
flagNoRotate = 0x0010, |
|
flagNoView = 0x0020, |
|
flagReadOnly = 0x0040, |
|
flagLocked = 0x0080, |
|
flagToggleNoView = 0x0100, |
|
flagLockedContents = 0x0200 |
|
}; |
|
|
|
enum AnnotSubtype |
|
{ |
|
typeUnknown, |
|
typeText, |
|
typeLink, |
|
typeFreeText, |
|
typeLine, |
|
typeSquare, |
|
typeCircle, |
|
typePolygon, |
|
typePolyLine, |
|
typeHighlight, |
|
typeUnderline, |
|
typeSquiggly, |
|
typeStrikeOut, |
|
typeStamp, |
|
typeCaret, |
|
typeInk, |
|
typePopup, |
|
typeFileAttachment, |
|
typeSound, |
|
typeMovie, |
|
typeWidget, |
|
typeScreen, |
|
typePrinterMark, |
|
typeTrapNet, |
|
typeWatermark, |
|
type3D, |
|
typeRichMedia |
|
}; |
|
|
|
|
|
|
|
|
|
enum AdditionalActionsType |
|
{ |
|
actionCursorEntering, |
|
actionCursorLeaving, |
|
actionMousePressed, |
|
actionMouseReleased, |
|
actionFocusIn, |
|
actionFocusOut, |
|
actionPageOpening, |
|
actionPageClosing, |
|
actionPageVisible, |
|
actionPageInvisible |
|
}; |
|
|
|
enum FormAdditionalActionsType |
|
{ |
|
actionFieldModified, |
|
actionFormatField, |
|
actionValidateField, |
|
actionCalculateField, |
|
}; |
|
|
|
Annot(PDFDoc *docA, PDFRectangle *rectA); |
|
Annot(PDFDoc *docA, Object &&dictObject); |
|
Annot(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
bool isOk() { return ok; } |
|
|
|
void incRefCnt(); |
|
void decRefCnt(); |
|
|
|
virtual void draw(Gfx *gfx, bool printing); |
|
|
|
virtual Object getAppearanceResDict(); |
|
|
|
bool match(const Ref *refA) const { return ref == *refA; } |
|
|
|
double getXMin(); |
|
double getYMin(); |
|
double getXMax(); |
|
double getYMax(); |
|
|
|
void setRect(const PDFRectangle *rect); |
|
void setRect(double x1, double y1, double x2, double y2); |
|
|
|
|
|
|
|
virtual void setContents(std::unique_ptr<GooString> &&new_content); |
|
void setName(GooString *new_name); |
|
void setModified(GooString *new_modified); |
|
void setFlags(unsigned int new_flags); |
|
|
|
void setBorder(std::unique_ptr<AnnotBorder> &&new_border); |
|
void setColor(std::unique_ptr<AnnotColor> &&new_color); |
|
|
|
void setAppearanceState(const char *state); |
|
|
|
|
|
PDFDoc *getDoc() const { return doc; } |
|
bool getHasRef() const { return hasRef; } |
|
Ref getRef() const { return ref; } |
|
const Object &getAnnotObj() const { return annotObj; } |
|
AnnotSubtype getType() const { return type; } |
|
const PDFRectangle &getRect() const { return *rect; } |
|
void getRect(double *x1, double *y1, double *x2, double *y2) const; |
|
const GooString *getContents() const { return contents.get(); } |
|
int getPageNum() const { return page; } |
|
const GooString *getName() const { return name.get(); } |
|
const GooString *getModified() const { return modified.get(); } |
|
unsigned int getFlags() const { return flags; } |
|
Object getAppearance() const; |
|
void setNewAppearance(Object &&newAppearance); |
|
AnnotAppearance *getAppearStreams() const { return appearStreams.get(); } |
|
const GooString *getAppearState() const { return appearState.get(); } |
|
AnnotBorder *getBorder() const { return border.get(); } |
|
AnnotColor *getColor() const { return color.get(); } |
|
int getTreeKey() const { return treeKey; } |
|
|
|
int getId() { return ref.num; } |
|
|
|
|
|
bool inRect(double x, double y) const; |
|
|
|
|
|
static void layoutText(const GooString *text, GooString *outBuf, int *i, const GfxFont &font, double *width, double widthLimit, int *charCount, bool noReencode, bool *newFontNeeded = nullptr); |
|
|
|
private: |
|
void readArrayNum(Object *pdfArray, int key, double *value); |
|
|
|
|
|
void initialize(PDFDoc *docA, Dict *dict); |
|
void setPage(int pageIndex, bool updateP); |
|
|
|
protected: |
|
virtual ~Annot(); |
|
virtual void removeReferencedObjects(); |
|
Object createForm(const GooString *appearBuf, const double *bbox, bool transparencyGroup, Dict *resDict); |
|
Object createForm(const GooString *appearBuf, const double *bbox, bool transparencyGroup, Object &&resDictObject); |
|
Dict *createResourcesDict(const char *formName, Object &&formStream, const char *stateName, double opacity, const char *blendMode); |
|
bool isVisible(bool printing); |
|
int getRotation() const; |
|
|
|
|
|
|
|
void update(const char *key, Object &&value); |
|
|
|
|
|
virtual void invalidateAppearance(); |
|
|
|
Object annotObj; |
|
|
|
std::atomic_int refCnt; |
|
|
|
|
|
AnnotSubtype type; |
|
std::unique_ptr<PDFRectangle> rect; |
|
|
|
|
|
std::unique_ptr<GooString> contents; |
|
std::unique_ptr<GooString> name; |
|
std::unique_ptr<GooString> modified; |
|
int page; |
|
unsigned int flags; |
|
std::unique_ptr<AnnotAppearance> appearStreams; |
|
Object appearance; |
|
|
|
std::unique_ptr<AnnotAppearanceBBox> appearBBox; |
|
std::unique_ptr<GooString> appearState; |
|
int treeKey; |
|
Object oc; |
|
|
|
PDFDoc *doc; |
|
Ref ref; |
|
std::unique_ptr<AnnotBorder> border; |
|
std::unique_ptr<AnnotColor> color; |
|
bool ok; |
|
|
|
bool hasRef; |
|
mutable std::recursive_mutex mutex; |
|
|
|
bool hasBeenUpdated = false; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotPopup : public Annot |
|
{ |
|
public: |
|
AnnotPopup(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotPopup(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotPopup() override; |
|
|
|
bool hasParent() const { return parentRef != Ref::INVALID(); } |
|
void setParent(Annot *parentA); |
|
bool getOpen() const { return open; } |
|
void setOpen(bool openA); |
|
|
|
protected: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
Ref parentRef; |
|
bool open; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotMarkup : public Annot |
|
{ |
|
public: |
|
enum AnnotMarkupReplyType |
|
{ |
|
replyTypeR, |
|
replyTypeGroup |
|
}; |
|
|
|
AnnotMarkup(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotMarkup(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotMarkup() override; |
|
|
|
|
|
const GooString *getLabel() const { return label.get(); } |
|
AnnotPopup *getPopup() const { return popup.get(); } |
|
double getOpacity() const { return opacity; } |
|
|
|
const GooString *getDate() const { return date.get(); } |
|
bool isInReplyTo() const { return inReplyTo != Ref::INVALID(); } |
|
int getInReplyToID() const { return inReplyTo.num; } |
|
const GooString *getSubject() const { return subject.get(); } |
|
AnnotMarkupReplyType getReplyTo() const { return replyTo; } |
|
AnnotExternalDataType getExData() const { return exData; } |
|
|
|
|
|
void setPopup(std::unique_ptr<AnnotPopup> &&new_popup); |
|
void setLabel(std::unique_ptr<GooString> &&new_label); |
|
void setOpacity(double opacityA); |
|
void setDate(GooString *new_date); |
|
|
|
protected: |
|
void removeReferencedObjects() override; |
|
|
|
std::unique_ptr<GooString> label; |
|
std::unique_ptr<AnnotPopup> popup; |
|
double opacity; |
|
|
|
std::unique_ptr<GooString> date; |
|
Ref inReplyTo; |
|
std::unique_ptr<GooString> subject; |
|
AnnotMarkupReplyType replyTo; |
|
|
|
|
|
|
|
AnnotExternalDataType exData; |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotText : public AnnotMarkup |
|
{ |
|
public: |
|
enum AnnotTextState |
|
{ |
|
stateUnknown, |
|
|
|
stateMarked, |
|
stateUnmarked, |
|
|
|
stateAccepted, |
|
stateRejected, |
|
stateCancelled, |
|
stateCompleted, |
|
stateNone |
|
}; |
|
|
|
AnnotText(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotText(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotText() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
|
|
bool getOpen() const { return open; } |
|
const GooString *getIcon() const { return icon.get(); } |
|
AnnotTextState getState() const { return state; } |
|
|
|
void setOpen(bool openA); |
|
void setIcon(GooString *new_icon); |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
bool open; |
|
std::unique_ptr<GooString> icon; |
|
AnnotTextState state; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotMovie : public Annot |
|
{ |
|
public: |
|
AnnotMovie(PDFDoc *docA, PDFRectangle *rect, Movie *movieA); |
|
AnnotMovie(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotMovie() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
const GooString *getTitle() const { return title.get(); } |
|
Movie *getMovie() { return movie.get(); } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
std::unique_ptr<GooString> title; |
|
std::unique_ptr<Movie> movie; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotScreen : public Annot |
|
{ |
|
public: |
|
AnnotScreen(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotScreen(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotScreen() override; |
|
|
|
const GooString *getTitle() const { return title.get(); } |
|
|
|
AnnotAppearanceCharacs *getAppearCharacs() { return appearCharacs.get(); } |
|
LinkAction *getAction() { return action.get(); } |
|
std::unique_ptr<LinkAction> getAdditionalAction(AdditionalActionsType type); |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
std::unique_ptr<GooString> title; |
|
|
|
std::unique_ptr<AnnotAppearanceCharacs> appearCharacs; |
|
|
|
std::unique_ptr<LinkAction> action; |
|
Object additionalActions; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotLink : public Annot |
|
{ |
|
public: |
|
enum AnnotLinkEffect |
|
{ |
|
effectNone, |
|
effectInvert, |
|
effectOutline, |
|
effectPush |
|
}; |
|
|
|
AnnotLink(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotLink(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotLink() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
|
|
LinkAction *getAction() const { return action.get(); } |
|
AnnotLinkEffect getLinkEffect() const { return linkEffect; } |
|
AnnotQuadrilaterals *getQuadrilaterals() const { return quadrilaterals.get(); } |
|
|
|
protected: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
std::unique_ptr<LinkAction> action; |
|
AnnotLinkEffect linkEffect; |
|
|
|
|
|
std::unique_ptr<AnnotQuadrilaterals> quadrilaterals; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotFreeText : public AnnotMarkup |
|
{ |
|
public: |
|
enum AnnotFreeTextIntent |
|
{ |
|
intentFreeText, |
|
intentFreeTextCallout, |
|
intentFreeTextTypeWriter |
|
}; |
|
|
|
static const double undefinedFontPtSize; |
|
|
|
AnnotFreeText(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotFreeText(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotFreeText() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
Object getAppearanceResDict() override; |
|
void setContents(std::unique_ptr<GooString> &&new_content) override; |
|
|
|
void setDefaultAppearance(const DefaultAppearance &da); |
|
void setQuadding(VariableTextQuadding new_quadding); |
|
void setStyleString(GooString *new_string); |
|
void setCalloutLine(AnnotCalloutLine *line); |
|
void setIntent(AnnotFreeTextIntent new_intent); |
|
|
|
|
|
std::unique_ptr<DefaultAppearance> getDefaultAppearance() const; |
|
VariableTextQuadding getQuadding() const { return quadding; } |
|
|
|
const GooString *getStyleString() const { return styleString.get(); } |
|
AnnotCalloutLine *getCalloutLine() const { return calloutLine.get(); } |
|
AnnotFreeTextIntent getIntent() const { return intent; } |
|
AnnotBorderEffect *getBorderEffect() const { return borderEffect.get(); } |
|
PDFRectangle *getRectangle() const { return rectangle.get(); } |
|
AnnotLineEndingStyle getEndStyle() const { return endStyle; } |
|
|
|
protected: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
void generateFreeTextAppearance(); |
|
|
|
|
|
std::unique_ptr<GooString> appearanceString; |
|
|
|
|
|
VariableTextQuadding quadding; |
|
|
|
std::unique_ptr<GooString> styleString; |
|
std::unique_ptr<AnnotCalloutLine> calloutLine; |
|
AnnotFreeTextIntent intent; |
|
std::unique_ptr<AnnotBorderEffect> borderEffect; |
|
std::unique_ptr<PDFRectangle> rectangle; |
|
|
|
|
|
AnnotLineEndingStyle endStyle; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotLine : public AnnotMarkup |
|
{ |
|
public: |
|
enum AnnotLineIntent |
|
{ |
|
intentLineArrow, |
|
intentLineDimension |
|
}; |
|
|
|
enum AnnotLineCaptionPos |
|
{ |
|
captionPosInline, |
|
captionPosTop |
|
}; |
|
|
|
AnnotLine(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotLine(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotLine() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
Object getAppearanceResDict() override; |
|
void setContents(std::unique_ptr<GooString> &&new_content) override; |
|
|
|
void setVertices(double x1, double y1, double x2, double y2); |
|
void setStartEndStyle(AnnotLineEndingStyle start, AnnotLineEndingStyle end); |
|
void setInteriorColor(std::unique_ptr<AnnotColor> &&new_color); |
|
void setLeaderLineLength(double len); |
|
void setLeaderLineExtension(double len); |
|
void setCaption(bool new_cap); |
|
void setIntent(AnnotLineIntent new_intent); |
|
|
|
|
|
AnnotLineEndingStyle getStartStyle() const { return startStyle; } |
|
AnnotLineEndingStyle getEndStyle() const { return endStyle; } |
|
AnnotColor *getInteriorColor() const { return interiorColor.get(); } |
|
double getLeaderLineLength() const { return leaderLineLength; } |
|
double getLeaderLineExtension() const { return leaderLineExtension; } |
|
bool getCaption() const { return caption; } |
|
AnnotLineIntent getIntent() const { return intent; } |
|
double getLeaderLineOffset() const { return leaderLineOffset; } |
|
AnnotLineCaptionPos getCaptionPos() const { return captionPos; } |
|
Dict *getMeasure() const { return measure; } |
|
double getCaptionTextHorizontal() const { return captionTextHorizontal; } |
|
double getCaptionTextVertical() const { return captionTextVertical; } |
|
double getX1() const { return coord1->getX(); } |
|
double getY1() const { return coord1->getY(); } |
|
double getX2() const { return coord2->getX(); } |
|
double getY2() const { return coord2->getY(); } |
|
|
|
protected: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
void generateLineAppearance(); |
|
|
|
|
|
std::unique_ptr<AnnotCoord> coord1; |
|
std::unique_ptr<AnnotCoord> coord2; |
|
|
|
|
|
|
|
|
|
AnnotLineEndingStyle startStyle; |
|
AnnotLineEndingStyle endStyle; |
|
std::unique_ptr<AnnotColor> interiorColor; |
|
double leaderLineLength; |
|
double leaderLineExtension; |
|
bool caption; |
|
AnnotLineIntent intent; |
|
double leaderLineOffset; |
|
AnnotLineCaptionPos captionPos; |
|
Dict *measure; |
|
double captionTextHorizontal; |
|
double captionTextVertical; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotTextMarkup : public AnnotMarkup |
|
{ |
|
public: |
|
AnnotTextMarkup(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType); |
|
AnnotTextMarkup(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotTextMarkup() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
|
|
void setType(AnnotSubtype new_type); |
|
|
|
void setQuadrilaterals(AnnotQuadrilaterals *quadPoints); |
|
|
|
AnnotQuadrilaterals *getQuadrilaterals() const { return quadrilaterals.get(); } |
|
|
|
protected: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
std::unique_ptr<AnnotQuadrilaterals> quadrilaterals; |
|
|
|
private: |
|
bool shouldCreateApperance(Gfx *gfx) const; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotStamp : public AnnotMarkup |
|
{ |
|
public: |
|
AnnotStamp(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotStamp(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotStamp() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
void setIcon(GooString *new_icon); |
|
|
|
void setCustomImage(AnnotStampImageHelper *stampImageHelperA); |
|
|
|
void clearCustomImage(); |
|
|
|
|
|
const GooString *getIcon() const { return icon.get(); } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
void generateStampDefaultAppearance(); |
|
void generateStampCustomAppearance(); |
|
|
|
std::unique_ptr<GooString> icon; |
|
AnnotStampImageHelper *stampImageHelper; |
|
Ref updatedAppearanceStream; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotGeometry : public AnnotMarkup |
|
{ |
|
public: |
|
AnnotGeometry(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType); |
|
AnnotGeometry(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotGeometry() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
void setType(AnnotSubtype new_type); |
|
void setInteriorColor(std::unique_ptr<AnnotColor> &&new_color); |
|
|
|
|
|
AnnotColor *getInteriorColor() const { return interiorColor.get(); } |
|
AnnotBorderEffect *getBorderEffect() const { return borderEffect.get(); } |
|
PDFRectangle *getGeometryRect() const { return geometryRect.get(); } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
std::unique_ptr<AnnotColor> interiorColor; |
|
std::unique_ptr<AnnotBorderEffect> borderEffect; |
|
std::unique_ptr<PDFRectangle> geometryRect; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotPolygon : public AnnotMarkup |
|
{ |
|
public: |
|
enum AnnotPolygonIntent |
|
{ |
|
polygonCloud, |
|
polylineDimension, |
|
polygonDimension |
|
}; |
|
|
|
AnnotPolygon(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType); |
|
AnnotPolygon(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotPolygon() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
void generatePolyLineAppearance(AnnotAppearanceBuilder *appearBuilder); |
|
void setType(AnnotSubtype new_type); |
|
void setVertices(AnnotPath *path); |
|
void setStartEndStyle(AnnotLineEndingStyle start, AnnotLineEndingStyle end); |
|
void setInteriorColor(std::unique_ptr<AnnotColor> &&new_color); |
|
void setIntent(AnnotPolygonIntent new_intent); |
|
|
|
|
|
AnnotPath *getVertices() const { return vertices.get(); } |
|
AnnotLineEndingStyle getStartStyle() const { return startStyle; } |
|
AnnotLineEndingStyle getEndStyle() const { return endStyle; } |
|
AnnotColor *getInteriorColor() const { return interiorColor.get(); } |
|
AnnotBorderEffect *getBorderEffect() const { return borderEffect.get(); } |
|
AnnotPolygonIntent getIntent() const { return intent; } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
|
|
std::unique_ptr<AnnotPath> vertices; |
|
|
|
|
|
AnnotLineEndingStyle startStyle; |
|
AnnotLineEndingStyle endStyle; |
|
|
|
|
|
std::unique_ptr<AnnotColor> interiorColor; |
|
std::unique_ptr<AnnotBorderEffect> borderEffect; |
|
AnnotPolygonIntent intent; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotCaret : public AnnotMarkup |
|
{ |
|
public: |
|
enum AnnotCaretSymbol |
|
{ |
|
symbolNone, |
|
symbolP |
|
}; |
|
|
|
AnnotCaret(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotCaret(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotCaret() override; |
|
|
|
void setSymbol(AnnotCaretSymbol new_symbol); |
|
|
|
|
|
AnnotCaretSymbol getSymbol() const { return symbol; } |
|
PDFRectangle *getCaretRect() const { return caretRect.get(); } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
AnnotCaretSymbol symbol; |
|
std::unique_ptr<PDFRectangle> caretRect; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotInk : public AnnotMarkup |
|
{ |
|
public: |
|
AnnotInk(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotInk(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotInk() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
void setInkList(AnnotPath **paths, int n_paths); |
|
|
|
|
|
AnnotPath **getInkList() const { return inkList; } |
|
int getInkListLength() const { return inkListLength; } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
void writeInkList(AnnotPath **paths, int n_paths, Array *dest_array); |
|
void parseInkList(Array *src_array); |
|
void freeInkList(); |
|
|
|
|
|
AnnotPath **inkList; |
|
int inkListLength; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotFileAttachment : public AnnotMarkup |
|
{ |
|
public: |
|
AnnotFileAttachment(PDFDoc *docA, PDFRectangle *rect, GooString *filename); |
|
AnnotFileAttachment(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotFileAttachment() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
|
|
Object *getFile() { return &file; } |
|
const GooString *getName() const { return name.get(); } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
|
|
Object file; |
|
|
|
|
|
std::unique_ptr<GooString> name; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AnnotSound : public AnnotMarkup |
|
{ |
|
public: |
|
AnnotSound(PDFDoc *docA, PDFRectangle *rect, Sound *soundA); |
|
AnnotSound(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotSound() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
|
|
|
|
Sound *getSound() { return sound.get(); } |
|
const GooString *getName() const { return name.get(); } |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
|
|
std::unique_ptr<Sound> sound; |
|
|
|
|
|
std::unique_ptr<GooString> name; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotWidget : public Annot |
|
{ |
|
public: |
|
enum AnnotWidgetHighlightMode |
|
{ |
|
highlightModeNone, |
|
highlightModeInvert, |
|
highlightModeOutline, |
|
highlightModePush |
|
}; |
|
|
|
AnnotWidget(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
AnnotWidget(PDFDoc *docA, Object *dictObject, Object *obj, FormField *fieldA); |
|
~AnnotWidget() override; |
|
|
|
void draw(Gfx *gfx, bool printing) override; |
|
void invalidateAppearance() override; |
|
|
|
void generateFieldAppearance(); |
|
void updateAppearanceStream(); |
|
|
|
AnnotWidgetHighlightMode getMode() { return mode; } |
|
AnnotAppearanceCharacs *getAppearCharacs() { return appearCharacs.get(); } |
|
void setAppearCharacs(std::unique_ptr<AnnotAppearanceCharacs> &&appearCharacsA) { appearCharacs = std::move(appearCharacsA); } |
|
LinkAction *getAction() { return action.get(); } |
|
std::unique_ptr<LinkAction> getAdditionalAction(AdditionalActionsType type); |
|
std::unique_ptr<LinkAction> getFormAdditionalAction(FormAdditionalActionsType type); |
|
Dict *getParent() { return parent; } |
|
|
|
bool setFormAdditionalAction(FormAdditionalActionsType type, const std::string &js); |
|
|
|
void setField(FormField *f) { field = f; }; |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
Form *form; |
|
FormField *field; |
|
AnnotWidgetHighlightMode mode; |
|
std::unique_ptr<AnnotAppearanceCharacs> appearCharacs; |
|
std::unique_ptr<LinkAction> action; |
|
Object additionalActions; |
|
|
|
|
|
Dict *parent; |
|
Ref updatedAppearanceStream; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class Annot3D : public Annot |
|
{ |
|
class Activation |
|
{ |
|
public: |
|
enum ActivationATrigger |
|
{ |
|
aTriggerUnknown, |
|
aTriggerPageOpened, |
|
aTriggerPageVisible, |
|
aTriggerUserAction |
|
}; |
|
|
|
enum ActivationAState |
|
{ |
|
aStateUnknown, |
|
aStateEnabled, |
|
aStateDisabled |
|
}; |
|
|
|
enum ActivationDTrigger |
|
{ |
|
dTriggerUnknown, |
|
dTriggerPageClosed, |
|
dTriggerPageInvisible, |
|
dTriggerUserAction |
|
}; |
|
|
|
enum ActivationDState |
|
{ |
|
dStateUnknown, |
|
dStateUninstantiaded, |
|
dStateInstantiated, |
|
dStateLive |
|
}; |
|
|
|
explicit Activation(Dict *dict); |
|
|
|
private: |
|
ActivationATrigger aTrigger; |
|
ActivationAState aState; |
|
ActivationDTrigger dTrigger; |
|
ActivationDState dState; |
|
bool displayToolbar; |
|
bool displayNavigation; |
|
}; |
|
|
|
public: |
|
Annot3D(PDFDoc *docA, PDFRectangle *rect); |
|
Annot3D(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~Annot3D() override; |
|
|
|
|
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
std::unique_ptr<Activation> activation; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT AnnotRichMedia : public Annot |
|
{ |
|
public: |
|
class POPPLER_PRIVATE_EXPORT Params |
|
{ |
|
public: |
|
explicit Params(Dict *dict); |
|
~Params(); |
|
|
|
Params(const Params &) = delete; |
|
Params &operator=(const Params &) = delete; |
|
|
|
const GooString *getFlashVars() const; |
|
|
|
private: |
|
|
|
std::unique_ptr<GooString> flashVars; |
|
}; |
|
|
|
class POPPLER_PRIVATE_EXPORT Instance |
|
{ |
|
public: |
|
enum Type |
|
{ |
|
type3D, |
|
typeFlash, |
|
typeSound, |
|
typeVideo |
|
}; |
|
|
|
explicit Instance(Dict *dict); |
|
~Instance(); |
|
|
|
Instance(const Instance &) = delete; |
|
Instance &operator=(const Instance &) = delete; |
|
|
|
Type getType() const; |
|
Params *getParams() const; |
|
|
|
private: |
|
|
|
Type type; |
|
std::unique_ptr<Params> params; |
|
}; |
|
|
|
class POPPLER_PRIVATE_EXPORT Configuration |
|
{ |
|
public: |
|
enum Type |
|
{ |
|
type3D, |
|
typeFlash, |
|
typeSound, |
|
typeVideo |
|
}; |
|
|
|
explicit Configuration(Dict *dict); |
|
~Configuration(); |
|
|
|
Configuration(const Configuration &) = delete; |
|
Configuration &operator=(const Configuration &) = delete; |
|
|
|
Type getType() const; |
|
const GooString *getName() const; |
|
int getInstancesCount() const; |
|
Instance *getInstance(int index) const; |
|
|
|
private: |
|
|
|
Type type; |
|
std::unique_ptr<GooString> name; |
|
Instance **instances; |
|
int nInstances; |
|
}; |
|
|
|
class Content; |
|
|
|
class POPPLER_PRIVATE_EXPORT Asset |
|
{ |
|
public: |
|
Asset(); |
|
~Asset(); |
|
|
|
Asset(const Asset &) = delete; |
|
Asset &operator=(const Asset &) = delete; |
|
|
|
const GooString *getName() const; |
|
Object *getFileSpec() const; |
|
|
|
private: |
|
friend class AnnotRichMedia::Content; |
|
|
|
std::unique_ptr<GooString> name; |
|
Object fileSpec; |
|
}; |
|
|
|
class POPPLER_PRIVATE_EXPORT Content |
|
{ |
|
public: |
|
explicit Content(Dict *dict); |
|
~Content(); |
|
|
|
Content(const Content &) = delete; |
|
Content &operator=(const Content &) = delete; |
|
|
|
int getConfigurationsCount() const; |
|
Configuration *getConfiguration(int index) const; |
|
|
|
int getAssetsCount() const; |
|
Asset *getAsset(int index) const; |
|
|
|
private: |
|
|
|
Configuration **configurations; |
|
int nConfigurations; |
|
|
|
Asset **assets; |
|
int nAssets; |
|
}; |
|
|
|
class POPPLER_PRIVATE_EXPORT Activation |
|
{ |
|
public: |
|
enum Condition |
|
{ |
|
conditionPageOpened, |
|
conditionPageVisible, |
|
conditionUserAction |
|
}; |
|
|
|
explicit Activation(Dict *dict); |
|
|
|
Condition getCondition() const; |
|
|
|
private: |
|
|
|
Condition condition; |
|
}; |
|
|
|
class POPPLER_PRIVATE_EXPORT Deactivation |
|
{ |
|
public: |
|
enum Condition |
|
{ |
|
conditionPageClosed, |
|
conditionPageInvisible, |
|
conditionUserAction |
|
}; |
|
|
|
explicit Deactivation(Dict *dict); |
|
|
|
Condition getCondition() const; |
|
|
|
private: |
|
|
|
Condition condition; |
|
}; |
|
|
|
class POPPLER_PRIVATE_EXPORT Settings |
|
{ |
|
public: |
|
explicit Settings(Dict *dict); |
|
~Settings(); |
|
|
|
Settings(const Settings &) = delete; |
|
Settings &operator=(const Settings &) = delete; |
|
|
|
Activation *getActivation() const; |
|
Deactivation *getDeactivation() const; |
|
|
|
private: |
|
|
|
std::unique_ptr<Activation> activation; |
|
std::unique_ptr<Deactivation> deactivation; |
|
}; |
|
|
|
AnnotRichMedia(PDFDoc *docA, PDFRectangle *rect); |
|
AnnotRichMedia(PDFDoc *docA, Object &&dictObject, const Object *obj); |
|
~AnnotRichMedia() override; |
|
|
|
Content *getContent() const; |
|
|
|
Settings *getSettings() const; |
|
|
|
private: |
|
void initialize(PDFDoc *docA, Dict *dict); |
|
|
|
|
|
std::unique_ptr<Content> content; |
|
|
|
|
|
std::unique_ptr<Settings> settings; |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class POPPLER_PRIVATE_EXPORT Annots |
|
{ |
|
public: |
|
|
|
Annots(PDFDoc *docA, int page, Object *annotsObj); |
|
|
|
~Annots(); |
|
|
|
Annots(const Annots &) = delete; |
|
Annots &operator=(const Annots &) = delete; |
|
|
|
const std::vector<Annot *> &getAnnots() { return annots; } |
|
|
|
void appendAnnot(Annot *annot); |
|
bool removeAnnot(Annot *annot); |
|
|
|
private: |
|
Annot *createAnnot(Object &&dictObject, const Object *obj); |
|
Annot *findAnnot(Ref *ref); |
|
|
|
PDFDoc *doc; |
|
std::vector<Annot *> annots; |
|
}; |
|
|
|
#endif |
|
|