blob: ee1d81806693b47716006a23f6dadb1d1c18ee0e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#include <qpdf/QPDFAnnotationObjectHelper.hh>
#include <qpdf/QTC.hh>
QPDFAnnotationObjectHelper::Members::~Members()
{
}
QPDFAnnotationObjectHelper::Members::Members()
{
}
QPDFAnnotationObjectHelper::QPDFAnnotationObjectHelper(QPDFObjectHandle oh) :
QPDFObjectHelper(oh)
{
}
std::string
QPDFAnnotationObjectHelper::getSubtype()
{
return this->oh.getKey("/Subtype").getName();
}
QPDFObjectHandle::Rectangle
QPDFAnnotationObjectHelper::getRect()
{
return this->oh.getKey("/Rect").getArrayAsRectangle();
}
QPDFObjectHandle
QPDFAnnotationObjectHelper::getAppearanceDictionary()
{
return this->oh.getKey("/AP");
}
std::string
QPDFAnnotationObjectHelper::getAppearanceState()
{
if (this->oh.getKey("/AS").isName())
{
QTC::TC("qpdf", "QPDFAnnotationObjectHelper AS present");
return this->oh.getKey("/AS").getName();
}
QTC::TC("qpdf", "QPDFAnnotationObjectHelper AS absent");
return "";
}
QPDFObjectHandle
QPDFAnnotationObjectHelper::getAppearanceStream(
std::string const& which,
std::string const& state)
{
QPDFObjectHandle ap = getAppearanceDictionary();
std::string desired_state = state.empty() ? getAppearanceState() : state;
if (ap.isDictionary())
{
QPDFObjectHandle ap_sub = ap.getKey(which);
if (ap_sub.isStream() && desired_state.empty())
{
QTC::TC("qpdf", "QPDFAnnotationObjectHelper AP stream");
return ap_sub;
}
if (ap_sub.isDictionary() && (! desired_state.empty()))
{
QTC::TC("qpdf", "QPDFAnnotationObjectHelper AP dictionary");
QPDFObjectHandle ap_sub_val = ap_sub.getKey(desired_state);
if (ap_sub_val.isStream())
{
QTC::TC("qpdf", "QPDFAnnotationObjectHelper AN sub stream");
return ap_sub_val;
}
}
}
QTC::TC("qpdf", "QPDFAnnotationObjectHelper AN null");
return QPDFObjectHandle::newNull();
}
|