blob: 72468e180ffe38fc6b688da688e536e0f5e5505d [file] [log] [blame]
jaepark27362762016-08-11 13:10:39 -07001// Copyright 2016 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
dsinclair114e46a2016-09-29 17:18:21 -07007#include "fpdfsdk/cpdfsdk_baannot.h"
jaepark27362762016-08-11 13:10:39 -07008
dsinclair488b7ad2016-10-04 11:55:50 -07009#include "core/fpdfapi/parser/cpdf_array.h"
10#include "core/fpdfapi/parser/cpdf_document.h"
11#include "core/fpdfapi/parser/cpdf_number.h"
12#include "core/fpdfapi/parser/cpdf_stream.h"
13#include "core/fpdfapi/parser/fpdf_parser_decode.h"
dsinclair114e46a2016-09-29 17:18:21 -070014#include "fpdfsdk/cpdfsdk_datetime.h"
dsinclair114e46a2016-09-29 17:18:21 -070015#include "fpdfsdk/cpdfsdk_pageview.h"
jaepark27362762016-08-11 13:10:39 -070016
17CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot,
18 CPDFSDK_PageView* pPageView)
19 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {}
20
21CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {}
22
23CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const {
24 return m_pAnnot;
25}
26
jaepark35512aa2016-08-29 17:15:08 -070027CPDF_Annot* CPDFSDK_BAAnnot::GetPDFPopupAnnot() const {
28 return m_pAnnot->GetPopupAnnot();
29}
30
jaepark27362762016-08-11 13:10:39 -070031CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const {
32 return m_pAnnot->GetAnnotDict();
33}
34
35void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) {
36 ASSERT(rect.right - rect.left >= GetMinWidth());
37 ASSERT(rect.top - rect.bottom >= GetMinHeight());
38
dsinclair38fd8442016-09-15 10:15:32 -070039 m_pAnnot->GetAnnotDict()->SetRectFor("Rect", rect);
jaepark27362762016-08-11 13:10:39 -070040}
41
42CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const {
jaeparka1d21112016-08-25 13:33:34 -070043 return m_pAnnot->GetRect();
jaepark27362762016-08-11 13:10:39 -070044}
45
jaepark956553e2016-08-31 06:49:27 -070046CPDF_Annot::Subtype CPDFSDK_BAAnnot::GetAnnotSubtype() const {
jaepark9ed91372016-08-26 16:16:10 -070047 return m_pAnnot->GetSubtype();
jaepark27362762016-08-11 13:10:39 -070048}
49
50void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice,
51 const CFX_Matrix* pUser2Device,
52 CPDF_Annot::AppearanceMode mode,
53 const CPDF_RenderOptions* pOptions) {
54 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device,
55 mode, pOptions);
56}
57
58FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() {
dsinclair38fd8442016-09-15 10:15:32 -070059 return !!m_pAnnot->GetAnnotDict()->GetDictFor("AP");
jaepark27362762016-08-11 13:10:39 -070060}
61
62FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
dsinclair38fd8442016-09-15 10:15:32 -070063 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP");
jaepark27362762016-08-11 13:10:39 -070064 if (!pAP)
65 return FALSE;
66
67 // Choose the right sub-ap
68 const FX_CHAR* ap_entry = "N";
69 if (mode == CPDF_Annot::Down)
70 ap_entry = "D";
71 else if (mode == CPDF_Annot::Rollover)
72 ap_entry = "R";
73 if (!pAP->KeyExist(ap_entry))
74 ap_entry = "N";
75
76 // Get the AP stream or subdirectory
dsinclair38fd8442016-09-15 10:15:32 -070077 CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry);
jaepark27362762016-08-11 13:10:39 -070078 return !!psub;
79}
80
81void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice,
82 const CFX_Matrix* pUser2Device,
83 const CPDF_RenderOptions* pOptions) {
84 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions);
85}
86
87void CPDFSDK_BAAnnot::ClearCachedAP() {
88 m_pAnnot->ClearCachedAP();
89}
90
91void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) {
92 if (sContents.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -070093 m_pAnnot->GetAnnotDict()->RemoveFor("Contents");
jaepark27362762016-08-11 13:10:39 -070094 else
dsinclair38fd8442016-09-15 10:15:32 -070095 m_pAnnot->GetAnnotDict()->SetStringFor("Contents",
96 PDF_EncodeText(sContents));
jaepark27362762016-08-11 13:10:39 -070097}
98
99CFX_WideString CPDFSDK_BAAnnot::GetContents() const {
dsinclair38fd8442016-09-15 10:15:32 -0700100 return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("Contents");
jaepark27362762016-08-11 13:10:39 -0700101}
102
103void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) {
104 if (sName.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -0700105 m_pAnnot->GetAnnotDict()->RemoveFor("NM");
jaepark27362762016-08-11 13:10:39 -0700106 else
dsinclair38fd8442016-09-15 10:15:32 -0700107 m_pAnnot->GetAnnotDict()->SetStringFor("NM", PDF_EncodeText(sName));
jaepark27362762016-08-11 13:10:39 -0700108}
109
110CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const {
dsinclair38fd8442016-09-15 10:15:32 -0700111 return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("NM");
jaepark27362762016-08-11 13:10:39 -0700112}
113
114void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) {
115 CPDFSDK_DateTime dt(st);
116 CFX_ByteString str = dt.ToPDFDateTimeString();
117
118 if (str.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -0700119 m_pAnnot->GetAnnotDict()->RemoveFor("M");
jaepark27362762016-08-11 13:10:39 -0700120 else
dsinclair38fd8442016-09-15 10:15:32 -0700121 m_pAnnot->GetAnnotDict()->SetStringFor("M", str);
jaepark27362762016-08-11 13:10:39 -0700122}
123
124FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const {
125 FX_SYSTEMTIME systime;
dsinclair38fd8442016-09-15 10:15:32 -0700126 CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M");
jaepark27362762016-08-11 13:10:39 -0700127
128 CPDFSDK_DateTime dt(str);
129 dt.ToSystemTime(systime);
130
131 return systime;
132}
133
134void CPDFSDK_BAAnnot::SetFlags(uint32_t nFlags) {
dsinclair38fd8442016-09-15 10:15:32 -0700135 m_pAnnot->GetAnnotDict()->SetIntegerFor("F", nFlags);
jaepark27362762016-08-11 13:10:39 -0700136}
137
138uint32_t CPDFSDK_BAAnnot::GetFlags() const {
dsinclair38fd8442016-09-15 10:15:32 -0700139 return m_pAnnot->GetAnnotDict()->GetIntegerFor("F");
jaepark27362762016-08-11 13:10:39 -0700140}
141
142void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) {
143 if (str.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -0700144 m_pAnnot->GetAnnotDict()->RemoveFor("AS");
jaepark27362762016-08-11 13:10:39 -0700145 else
dsinclair38fd8442016-09-15 10:15:32 -0700146 m_pAnnot->GetAnnotDict()->SetStringFor("AS", str);
jaepark27362762016-08-11 13:10:39 -0700147}
148
149CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const {
dsinclair38fd8442016-09-15 10:15:32 -0700150 return m_pAnnot->GetAnnotDict()->GetStringFor("AS");
jaepark27362762016-08-11 13:10:39 -0700151}
152
153void CPDFSDK_BAAnnot::SetStructParent(int key) {
dsinclair38fd8442016-09-15 10:15:32 -0700154 m_pAnnot->GetAnnotDict()->SetIntegerFor("StructParent", key);
jaepark27362762016-08-11 13:10:39 -0700155}
156
157int CPDFSDK_BAAnnot::GetStructParent() const {
dsinclair38fd8442016-09-15 10:15:32 -0700158 return m_pAnnot->GetAnnotDict()->GetIntegerFor("StructParent");
jaepark27362762016-08-11 13:10:39 -0700159}
160
161// border
162void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) {
dsinclair38fd8442016-09-15 10:15:32 -0700163 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border");
jaepark27362762016-08-11 13:10:39 -0700164 if (pBorder) {
165 pBorder->SetAt(2, new CPDF_Number(nWidth));
166 } else {
dsinclair38fd8442016-09-15 10:15:32 -0700167 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
jaepark27362762016-08-11 13:10:39 -0700168 if (!pBSDict) {
tsepez698c5712016-09-28 16:47:07 -0700169 pBSDict =
170 new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700171 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict);
jaepark27362762016-08-11 13:10:39 -0700172 }
dsinclair38fd8442016-09-15 10:15:32 -0700173 pBSDict->SetIntegerFor("W", nWidth);
jaepark27362762016-08-11 13:10:39 -0700174 }
175}
176
177int CPDFSDK_BAAnnot::GetBorderWidth() const {
tsepez698c5712016-09-28 16:47:07 -0700178 if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"))
jaepark27362762016-08-11 13:10:39 -0700179 return pBorder->GetIntegerAt(2);
tsepez698c5712016-09-28 16:47:07 -0700180
181 if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"))
dsinclair38fd8442016-09-15 10:15:32 -0700182 return pBSDict->GetIntegerFor("W", 1);
tsepez698c5712016-09-28 16:47:07 -0700183
jaepark27362762016-08-11 13:10:39 -0700184 return 1;
185}
186
187void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) {
dsinclair38fd8442016-09-15 10:15:32 -0700188 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
jaepark27362762016-08-11 13:10:39 -0700189 if (!pBSDict) {
tsepez698c5712016-09-28 16:47:07 -0700190 pBSDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700191 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict);
jaepark27362762016-08-11 13:10:39 -0700192 }
193
194 switch (nStyle) {
195 case BorderStyle::SOLID:
dsinclair38fd8442016-09-15 10:15:32 -0700196 pBSDict->SetNameFor("S", "S");
jaepark27362762016-08-11 13:10:39 -0700197 break;
198 case BorderStyle::DASH:
dsinclair38fd8442016-09-15 10:15:32 -0700199 pBSDict->SetNameFor("S", "D");
jaepark27362762016-08-11 13:10:39 -0700200 break;
201 case BorderStyle::BEVELED:
dsinclair38fd8442016-09-15 10:15:32 -0700202 pBSDict->SetNameFor("S", "B");
jaepark27362762016-08-11 13:10:39 -0700203 break;
204 case BorderStyle::INSET:
dsinclair38fd8442016-09-15 10:15:32 -0700205 pBSDict->SetNameFor("S", "I");
jaepark27362762016-08-11 13:10:39 -0700206 break;
207 case BorderStyle::UNDERLINE:
dsinclair38fd8442016-09-15 10:15:32 -0700208 pBSDict->SetNameFor("S", "U");
jaepark27362762016-08-11 13:10:39 -0700209 break;
210 default:
211 break;
212 }
213}
214
215BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const {
dsinclair38fd8442016-09-15 10:15:32 -0700216 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
jaepark27362762016-08-11 13:10:39 -0700217 if (pBSDict) {
dsinclair38fd8442016-09-15 10:15:32 -0700218 CFX_ByteString sBorderStyle = pBSDict->GetStringFor("S", "S");
jaepark27362762016-08-11 13:10:39 -0700219 if (sBorderStyle == "S")
220 return BorderStyle::SOLID;
221 if (sBorderStyle == "D")
222 return BorderStyle::DASH;
223 if (sBorderStyle == "B")
224 return BorderStyle::BEVELED;
225 if (sBorderStyle == "I")
226 return BorderStyle::INSET;
227 if (sBorderStyle == "U")
228 return BorderStyle::UNDERLINE;
229 }
230
dsinclair38fd8442016-09-15 10:15:32 -0700231 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border");
jaepark27362762016-08-11 13:10:39 -0700232 if (pBorder) {
233 if (pBorder->GetCount() >= 4) {
234 CPDF_Array* pDP = pBorder->GetArrayAt(3);
235 if (pDP && pDP->GetCount() > 0)
236 return BorderStyle::DASH;
237 }
238 }
239
240 return BorderStyle::SOLID;
241}
242
243void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) {
244 CPDF_Array* pArray = new CPDF_Array;
245 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f);
246 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f);
247 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f);
dsinclair38fd8442016-09-15 10:15:32 -0700248 m_pAnnot->GetAnnotDict()->SetFor("C", pArray);
jaepark27362762016-08-11 13:10:39 -0700249}
250
251void CPDFSDK_BAAnnot::RemoveColor() {
dsinclair38fd8442016-09-15 10:15:32 -0700252 m_pAnnot->GetAnnotDict()->RemoveFor("C");
jaepark27362762016-08-11 13:10:39 -0700253}
254
255FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const {
dsinclair38fd8442016-09-15 10:15:32 -0700256 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayFor("C")) {
jaepark27362762016-08-11 13:10:39 -0700257 size_t nCount = pEntry->GetCount();
258 if (nCount == 1) {
259 FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
260
261 color = FXSYS_RGB((int)g, (int)g, (int)g);
262
263 return TRUE;
264 } else if (nCount == 3) {
265 FX_FLOAT r = pEntry->GetNumberAt(0) * 255;
266 FX_FLOAT g = pEntry->GetNumberAt(1) * 255;
267 FX_FLOAT b = pEntry->GetNumberAt(2) * 255;
268
269 color = FXSYS_RGB((int)r, (int)g, (int)b);
270
271 return TRUE;
272 } else if (nCount == 4) {
273 FX_FLOAT c = pEntry->GetNumberAt(0);
274 FX_FLOAT m = pEntry->GetNumberAt(1);
275 FX_FLOAT y = pEntry->GetNumberAt(2);
276 FX_FLOAT k = pEntry->GetNumberAt(3);
277
278 FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
279 FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
280 FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
281
282 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255));
283
284 return TRUE;
285 }
286 }
287
288 return FALSE;
289}
290
291void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType,
292 const CFX_FloatRect& rcBBox,
293 const CFX_Matrix& matrix,
294 const CFX_ByteString& sContents,
295 const CFX_ByteString& sAPState) {
dsinclair38fd8442016-09-15 10:15:32 -0700296 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP");
jaepark27362762016-08-11 13:10:39 -0700297 if (!pAPDict) {
tsepez698c5712016-09-28 16:47:07 -0700298 pAPDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700299 m_pAnnot->GetAnnotDict()->SetFor("AP", pAPDict);
jaepark27362762016-08-11 13:10:39 -0700300 }
301
302 CPDF_Stream* pStream = nullptr;
303 CPDF_Dictionary* pParentDict = nullptr;
jaepark27362762016-08-11 13:10:39 -0700304 if (sAPState.IsEmpty()) {
305 pParentDict = pAPDict;
dsinclair38fd8442016-09-15 10:15:32 -0700306 pStream = pAPDict->GetStreamFor(sAPType);
jaepark27362762016-08-11 13:10:39 -0700307 } else {
dsinclair38fd8442016-09-15 10:15:32 -0700308 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictFor(sAPType);
jaepark27362762016-08-11 13:10:39 -0700309 if (!pAPTypeDict) {
tsepez698c5712016-09-28 16:47:07 -0700310 pAPTypeDict =
311 new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700312 pAPDict->SetFor(sAPType, pAPTypeDict);
jaepark27362762016-08-11 13:10:39 -0700313 }
314 pParentDict = pAPTypeDict;
dsinclair38fd8442016-09-15 10:15:32 -0700315 pStream = pAPTypeDict->GetStreamFor(sAPState);
jaepark27362762016-08-11 13:10:39 -0700316 }
317
318 if (!pStream) {
Tom Sepezc25a4212016-10-14 17:45:56 -0700319 pStream = new CPDF_Stream;
jaepark27362762016-08-11 13:10:39 -0700320 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
Tom Sepezc25a4212016-10-14 17:45:56 -0700321 pParentDict->SetReferenceFor(sAPType, pDoc,
322 pDoc->AddIndirectObject(pStream));
jaepark27362762016-08-11 13:10:39 -0700323 }
324
325 CPDF_Dictionary* pStreamDict = pStream->GetDict();
326 if (!pStreamDict) {
tsepez698c5712016-09-28 16:47:07 -0700327 pStreamDict =
328 new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700329 pStreamDict->SetNameFor("Type", "XObject");
330 pStreamDict->SetNameFor("Subtype", "Form");
331 pStreamDict->SetIntegerFor("FormType", 1);
jaepark27362762016-08-11 13:10:39 -0700332 pStream->InitStream(nullptr, 0, pStreamDict);
333 }
334
335 if (pStreamDict) {
dsinclair38fd8442016-09-15 10:15:32 -0700336 pStreamDict->SetMatrixFor("Matrix", matrix);
337 pStreamDict->SetRectFor("BBox", rcBBox);
jaepark27362762016-08-11 13:10:39 -0700338 }
339
tsepeze6db16e2016-09-19 10:45:09 -0700340 pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength());
jaepark27362762016-08-11 13:10:39 -0700341}
342
343FX_BOOL CPDFSDK_BAAnnot::IsVisible() const {
344 uint32_t nFlags = GetFlags();
345 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) ||
346 (nFlags & ANNOTFLAG_NOVIEW));
347}
348
349CPDF_Action CPDFSDK_BAAnnot::GetAction() const {
dsinclair38fd8442016-09-15 10:15:32 -0700350 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictFor("A"));
jaepark27362762016-08-11 13:10:39 -0700351}
352
353void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) {
tsepezbb577af2016-09-21 19:10:19 -0700354 CPDF_Dictionary* pDict = action.GetDict();
355 if (pDict != m_pAnnot->GetAnnotDict()->GetDictFor("A")) {
jaepark27362762016-08-11 13:10:39 -0700356 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
Tom Sepezc25a4212016-10-14 17:45:56 -0700357 m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc,
358 pDoc->AddIndirectObject(pDict));
jaepark27362762016-08-11 13:10:39 -0700359 }
360}
361
362void CPDFSDK_BAAnnot::RemoveAction() {
dsinclair38fd8442016-09-15 10:15:32 -0700363 m_pAnnot->GetAnnotDict()->RemoveFor("A");
jaepark27362762016-08-11 13:10:39 -0700364}
365
366CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const {
dsinclair38fd8442016-09-15 10:15:32 -0700367 return CPDF_AAction(m_pAnnot->GetAnnotDict()->GetDictFor("AA"));
jaepark27362762016-08-11 13:10:39 -0700368}
369
370void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) {
dsinclair38fd8442016-09-15 10:15:32 -0700371 if (aa.GetDict() != m_pAnnot->GetAnnotDict()->GetDictFor("AA"))
372 m_pAnnot->GetAnnotDict()->SetFor("AA", aa.GetDict());
jaepark27362762016-08-11 13:10:39 -0700373}
374
375void CPDFSDK_BAAnnot::RemoveAAction() {
dsinclair38fd8442016-09-15 10:15:32 -0700376 m_pAnnot->GetAnnotDict()->RemoveFor("AA");
jaepark27362762016-08-11 13:10:39 -0700377}
378
379CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) {
380 CPDF_AAction AAction = GetAAction();
381
382 if (AAction.ActionExist(eAAT))
383 return AAction.GetAction(eAAT);
384
385 if (eAAT == CPDF_AAction::ButtonUp)
386 return GetAction();
387
388 return CPDF_Action();
389}
390
391void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice,
392 CFX_Matrix* pUser2Device,
393 CPDF_RenderOptions* pOptions) {
394 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal);
395 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device,
396 CPDF_Annot::Normal, nullptr);
397}
jaepark35512aa2016-08-29 17:15:08 -0700398
399void CPDFSDK_BAAnnot::SetOpenState(bool bOpenState) {
400 if (CPDF_Annot* pAnnot = m_pAnnot->GetPopupAnnot())
401 pAnnot->SetOpenState(bOpenState);
402}