blob: 7d2a92ac101db7214d440a147c9f6282d181b642 [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"
15#include "fpdfsdk/cpdfsdk_document.h"
16#include "fpdfsdk/cpdfsdk_pageview.h"
jaepark27362762016-08-11 13:10:39 -070017
18CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot,
19 CPDFSDK_PageView* pPageView)
20 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {}
21
22CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {}
23
24CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const {
25 return m_pAnnot;
26}
27
jaepark35512aa2016-08-29 17:15:08 -070028CPDF_Annot* CPDFSDK_BAAnnot::GetPDFPopupAnnot() const {
29 return m_pAnnot->GetPopupAnnot();
30}
31
jaepark27362762016-08-11 13:10:39 -070032CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const {
33 return m_pAnnot->GetAnnotDict();
34}
35
36void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) {
37 ASSERT(rect.right - rect.left >= GetMinWidth());
38 ASSERT(rect.top - rect.bottom >= GetMinHeight());
39
dsinclair38fd8442016-09-15 10:15:32 -070040 m_pAnnot->GetAnnotDict()->SetRectFor("Rect", rect);
jaepark27362762016-08-11 13:10:39 -070041}
42
43CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const {
jaeparka1d21112016-08-25 13:33:34 -070044 return m_pAnnot->GetRect();
jaepark27362762016-08-11 13:10:39 -070045}
46
jaepark956553e2016-08-31 06:49:27 -070047CPDF_Annot::Subtype CPDFSDK_BAAnnot::GetAnnotSubtype() const {
jaepark9ed91372016-08-26 16:16:10 -070048 return m_pAnnot->GetSubtype();
jaepark27362762016-08-11 13:10:39 -070049}
50
51void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice,
52 const CFX_Matrix* pUser2Device,
53 CPDF_Annot::AppearanceMode mode,
54 const CPDF_RenderOptions* pOptions) {
55 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device,
56 mode, pOptions);
57}
58
59FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() {
dsinclair38fd8442016-09-15 10:15:32 -070060 return !!m_pAnnot->GetAnnotDict()->GetDictFor("AP");
jaepark27362762016-08-11 13:10:39 -070061}
62
63FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
dsinclair38fd8442016-09-15 10:15:32 -070064 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP");
jaepark27362762016-08-11 13:10:39 -070065 if (!pAP)
66 return FALSE;
67
68 // Choose the right sub-ap
69 const FX_CHAR* ap_entry = "N";
70 if (mode == CPDF_Annot::Down)
71 ap_entry = "D";
72 else if (mode == CPDF_Annot::Rollover)
73 ap_entry = "R";
74 if (!pAP->KeyExist(ap_entry))
75 ap_entry = "N";
76
77 // Get the AP stream or subdirectory
dsinclair38fd8442016-09-15 10:15:32 -070078 CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry);
jaepark27362762016-08-11 13:10:39 -070079 return !!psub;
80}
81
82void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice,
83 const CFX_Matrix* pUser2Device,
84 const CPDF_RenderOptions* pOptions) {
85 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions);
86}
87
88void CPDFSDK_BAAnnot::ClearCachedAP() {
89 m_pAnnot->ClearCachedAP();
90}
91
92void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) {
93 if (sContents.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -070094 m_pAnnot->GetAnnotDict()->RemoveFor("Contents");
jaepark27362762016-08-11 13:10:39 -070095 else
dsinclair38fd8442016-09-15 10:15:32 -070096 m_pAnnot->GetAnnotDict()->SetStringFor("Contents",
97 PDF_EncodeText(sContents));
jaepark27362762016-08-11 13:10:39 -070098}
99
100CFX_WideString CPDFSDK_BAAnnot::GetContents() const {
dsinclair38fd8442016-09-15 10:15:32 -0700101 return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("Contents");
jaepark27362762016-08-11 13:10:39 -0700102}
103
104void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) {
105 if (sName.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -0700106 m_pAnnot->GetAnnotDict()->RemoveFor("NM");
jaepark27362762016-08-11 13:10:39 -0700107 else
dsinclair38fd8442016-09-15 10:15:32 -0700108 m_pAnnot->GetAnnotDict()->SetStringFor("NM", PDF_EncodeText(sName));
jaepark27362762016-08-11 13:10:39 -0700109}
110
111CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const {
dsinclair38fd8442016-09-15 10:15:32 -0700112 return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("NM");
jaepark27362762016-08-11 13:10:39 -0700113}
114
115void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) {
116 CPDFSDK_DateTime dt(st);
117 CFX_ByteString str = dt.ToPDFDateTimeString();
118
119 if (str.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -0700120 m_pAnnot->GetAnnotDict()->RemoveFor("M");
jaepark27362762016-08-11 13:10:39 -0700121 else
dsinclair38fd8442016-09-15 10:15:32 -0700122 m_pAnnot->GetAnnotDict()->SetStringFor("M", str);
jaepark27362762016-08-11 13:10:39 -0700123}
124
125FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const {
126 FX_SYSTEMTIME systime;
dsinclair38fd8442016-09-15 10:15:32 -0700127 CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M");
jaepark27362762016-08-11 13:10:39 -0700128
129 CPDFSDK_DateTime dt(str);
130 dt.ToSystemTime(systime);
131
132 return systime;
133}
134
135void CPDFSDK_BAAnnot::SetFlags(uint32_t nFlags) {
dsinclair38fd8442016-09-15 10:15:32 -0700136 m_pAnnot->GetAnnotDict()->SetIntegerFor("F", nFlags);
jaepark27362762016-08-11 13:10:39 -0700137}
138
139uint32_t CPDFSDK_BAAnnot::GetFlags() const {
dsinclair38fd8442016-09-15 10:15:32 -0700140 return m_pAnnot->GetAnnotDict()->GetIntegerFor("F");
jaepark27362762016-08-11 13:10:39 -0700141}
142
143void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) {
144 if (str.IsEmpty())
dsinclair38fd8442016-09-15 10:15:32 -0700145 m_pAnnot->GetAnnotDict()->RemoveFor("AS");
jaepark27362762016-08-11 13:10:39 -0700146 else
dsinclair38fd8442016-09-15 10:15:32 -0700147 m_pAnnot->GetAnnotDict()->SetStringFor("AS", str);
jaepark27362762016-08-11 13:10:39 -0700148}
149
150CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const {
dsinclair38fd8442016-09-15 10:15:32 -0700151 return m_pAnnot->GetAnnotDict()->GetStringFor("AS");
jaepark27362762016-08-11 13:10:39 -0700152}
153
154void CPDFSDK_BAAnnot::SetStructParent(int key) {
dsinclair38fd8442016-09-15 10:15:32 -0700155 m_pAnnot->GetAnnotDict()->SetIntegerFor("StructParent", key);
jaepark27362762016-08-11 13:10:39 -0700156}
157
158int CPDFSDK_BAAnnot::GetStructParent() const {
dsinclair38fd8442016-09-15 10:15:32 -0700159 return m_pAnnot->GetAnnotDict()->GetIntegerFor("StructParent");
jaepark27362762016-08-11 13:10:39 -0700160}
161
162// border
163void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) {
dsinclair38fd8442016-09-15 10:15:32 -0700164 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border");
jaepark27362762016-08-11 13:10:39 -0700165 if (pBorder) {
166 pBorder->SetAt(2, new CPDF_Number(nWidth));
167 } else {
dsinclair38fd8442016-09-15 10:15:32 -0700168 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
jaepark27362762016-08-11 13:10:39 -0700169 if (!pBSDict) {
tsepez698c5712016-09-28 16:47:07 -0700170 pBSDict =
171 new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700172 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict);
jaepark27362762016-08-11 13:10:39 -0700173 }
dsinclair38fd8442016-09-15 10:15:32 -0700174 pBSDict->SetIntegerFor("W", nWidth);
jaepark27362762016-08-11 13:10:39 -0700175 }
176}
177
178int CPDFSDK_BAAnnot::GetBorderWidth() const {
tsepez698c5712016-09-28 16:47:07 -0700179 if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"))
jaepark27362762016-08-11 13:10:39 -0700180 return pBorder->GetIntegerAt(2);
tsepez698c5712016-09-28 16:47:07 -0700181
182 if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"))
dsinclair38fd8442016-09-15 10:15:32 -0700183 return pBSDict->GetIntegerFor("W", 1);
tsepez698c5712016-09-28 16:47:07 -0700184
jaepark27362762016-08-11 13:10:39 -0700185 return 1;
186}
187
188void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) {
dsinclair38fd8442016-09-15 10:15:32 -0700189 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
jaepark27362762016-08-11 13:10:39 -0700190 if (!pBSDict) {
tsepez698c5712016-09-28 16:47:07 -0700191 pBSDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700192 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict);
jaepark27362762016-08-11 13:10:39 -0700193 }
194
195 switch (nStyle) {
196 case BorderStyle::SOLID:
dsinclair38fd8442016-09-15 10:15:32 -0700197 pBSDict->SetNameFor("S", "S");
jaepark27362762016-08-11 13:10:39 -0700198 break;
199 case BorderStyle::DASH:
dsinclair38fd8442016-09-15 10:15:32 -0700200 pBSDict->SetNameFor("S", "D");
jaepark27362762016-08-11 13:10:39 -0700201 break;
202 case BorderStyle::BEVELED:
dsinclair38fd8442016-09-15 10:15:32 -0700203 pBSDict->SetNameFor("S", "B");
jaepark27362762016-08-11 13:10:39 -0700204 break;
205 case BorderStyle::INSET:
dsinclair38fd8442016-09-15 10:15:32 -0700206 pBSDict->SetNameFor("S", "I");
jaepark27362762016-08-11 13:10:39 -0700207 break;
208 case BorderStyle::UNDERLINE:
dsinclair38fd8442016-09-15 10:15:32 -0700209 pBSDict->SetNameFor("S", "U");
jaepark27362762016-08-11 13:10:39 -0700210 break;
211 default:
212 break;
213 }
214}
215
216BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const {
dsinclair38fd8442016-09-15 10:15:32 -0700217 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
jaepark27362762016-08-11 13:10:39 -0700218 if (pBSDict) {
dsinclair38fd8442016-09-15 10:15:32 -0700219 CFX_ByteString sBorderStyle = pBSDict->GetStringFor("S", "S");
jaepark27362762016-08-11 13:10:39 -0700220 if (sBorderStyle == "S")
221 return BorderStyle::SOLID;
222 if (sBorderStyle == "D")
223 return BorderStyle::DASH;
224 if (sBorderStyle == "B")
225 return BorderStyle::BEVELED;
226 if (sBorderStyle == "I")
227 return BorderStyle::INSET;
228 if (sBorderStyle == "U")
229 return BorderStyle::UNDERLINE;
230 }
231
dsinclair38fd8442016-09-15 10:15:32 -0700232 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border");
jaepark27362762016-08-11 13:10:39 -0700233 if (pBorder) {
234 if (pBorder->GetCount() >= 4) {
235 CPDF_Array* pDP = pBorder->GetArrayAt(3);
236 if (pDP && pDP->GetCount() > 0)
237 return BorderStyle::DASH;
238 }
239 }
240
241 return BorderStyle::SOLID;
242}
243
244void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) {
245 CPDF_Array* pArray = new CPDF_Array;
246 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f);
247 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f);
248 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f);
dsinclair38fd8442016-09-15 10:15:32 -0700249 m_pAnnot->GetAnnotDict()->SetFor("C", pArray);
jaepark27362762016-08-11 13:10:39 -0700250}
251
252void CPDFSDK_BAAnnot::RemoveColor() {
dsinclair38fd8442016-09-15 10:15:32 -0700253 m_pAnnot->GetAnnotDict()->RemoveFor("C");
jaepark27362762016-08-11 13:10:39 -0700254}
255
256FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const {
dsinclair38fd8442016-09-15 10:15:32 -0700257 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayFor("C")) {
jaepark27362762016-08-11 13:10:39 -0700258 size_t nCount = pEntry->GetCount();
259 if (nCount == 1) {
260 FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
261
262 color = FXSYS_RGB((int)g, (int)g, (int)g);
263
264 return TRUE;
265 } else if (nCount == 3) {
266 FX_FLOAT r = pEntry->GetNumberAt(0) * 255;
267 FX_FLOAT g = pEntry->GetNumberAt(1) * 255;
268 FX_FLOAT b = pEntry->GetNumberAt(2) * 255;
269
270 color = FXSYS_RGB((int)r, (int)g, (int)b);
271
272 return TRUE;
273 } else if (nCount == 4) {
274 FX_FLOAT c = pEntry->GetNumberAt(0);
275 FX_FLOAT m = pEntry->GetNumberAt(1);
276 FX_FLOAT y = pEntry->GetNumberAt(2);
277 FX_FLOAT k = pEntry->GetNumberAt(3);
278
279 FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
280 FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
281 FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
282
283 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255));
284
285 return TRUE;
286 }
287 }
288
289 return FALSE;
290}
291
292void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType,
293 const CFX_FloatRect& rcBBox,
294 const CFX_Matrix& matrix,
295 const CFX_ByteString& sContents,
296 const CFX_ByteString& sAPState) {
dsinclair38fd8442016-09-15 10:15:32 -0700297 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP");
jaepark27362762016-08-11 13:10:39 -0700298 if (!pAPDict) {
tsepez698c5712016-09-28 16:47:07 -0700299 pAPDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700300 m_pAnnot->GetAnnotDict()->SetFor("AP", pAPDict);
jaepark27362762016-08-11 13:10:39 -0700301 }
302
303 CPDF_Stream* pStream = nullptr;
304 CPDF_Dictionary* pParentDict = nullptr;
jaepark27362762016-08-11 13:10:39 -0700305 if (sAPState.IsEmpty()) {
306 pParentDict = pAPDict;
dsinclair38fd8442016-09-15 10:15:32 -0700307 pStream = pAPDict->GetStreamFor(sAPType);
jaepark27362762016-08-11 13:10:39 -0700308 } else {
dsinclair38fd8442016-09-15 10:15:32 -0700309 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictFor(sAPType);
jaepark27362762016-08-11 13:10:39 -0700310 if (!pAPTypeDict) {
tsepez698c5712016-09-28 16:47:07 -0700311 pAPTypeDict =
312 new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700313 pAPDict->SetFor(sAPType, pAPTypeDict);
jaepark27362762016-08-11 13:10:39 -0700314 }
315 pParentDict = pAPTypeDict;
dsinclair38fd8442016-09-15 10:15:32 -0700316 pStream = pAPTypeDict->GetStreamFor(sAPState);
jaepark27362762016-08-11 13:10:39 -0700317 }
318
319 if (!pStream) {
tsepeze6db16e2016-09-19 10:45:09 -0700320 pStream = new CPDF_Stream;
jaepark27362762016-08-11 13:10:39 -0700321 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
tsepezbb577af2016-09-21 19:10:19 -0700322 pParentDict->SetReferenceFor(sAPType, pDoc,
323 pDoc->AddIndirectObject(pStream));
jaepark27362762016-08-11 13:10:39 -0700324 }
325
326 CPDF_Dictionary* pStreamDict = pStream->GetDict();
327 if (!pStreamDict) {
tsepez698c5712016-09-28 16:47:07 -0700328 pStreamDict =
329 new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
dsinclair38fd8442016-09-15 10:15:32 -0700330 pStreamDict->SetNameFor("Type", "XObject");
331 pStreamDict->SetNameFor("Subtype", "Form");
332 pStreamDict->SetIntegerFor("FormType", 1);
jaepark27362762016-08-11 13:10:39 -0700333 pStream->InitStream(nullptr, 0, pStreamDict);
334 }
335
336 if (pStreamDict) {
dsinclair38fd8442016-09-15 10:15:32 -0700337 pStreamDict->SetMatrixFor("Matrix", matrix);
338 pStreamDict->SetRectFor("BBox", rcBBox);
jaepark27362762016-08-11 13:10:39 -0700339 }
340
tsepeze6db16e2016-09-19 10:45:09 -0700341 pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength());
jaepark27362762016-08-11 13:10:39 -0700342}
343
344FX_BOOL CPDFSDK_BAAnnot::IsVisible() const {
345 uint32_t nFlags = GetFlags();
346 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) ||
347 (nFlags & ANNOTFLAG_NOVIEW));
348}
349
350CPDF_Action CPDFSDK_BAAnnot::GetAction() const {
dsinclair38fd8442016-09-15 10:15:32 -0700351 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictFor("A"));
jaepark27362762016-08-11 13:10:39 -0700352}
353
354void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) {
tsepezbb577af2016-09-21 19:10:19 -0700355 CPDF_Dictionary* pDict = action.GetDict();
356 if (pDict != m_pAnnot->GetAnnotDict()->GetDictFor("A")) {
jaepark27362762016-08-11 13:10:39 -0700357 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
tsepezbb577af2016-09-21 19:10:19 -0700358 m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc,
359 pDoc->AddIndirectObject(pDict));
jaepark27362762016-08-11 13:10:39 -0700360 }
361}
362
363void CPDFSDK_BAAnnot::RemoveAction() {
dsinclair38fd8442016-09-15 10:15:32 -0700364 m_pAnnot->GetAnnotDict()->RemoveFor("A");
jaepark27362762016-08-11 13:10:39 -0700365}
366
367CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const {
dsinclair38fd8442016-09-15 10:15:32 -0700368 return CPDF_AAction(m_pAnnot->GetAnnotDict()->GetDictFor("AA"));
jaepark27362762016-08-11 13:10:39 -0700369}
370
371void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) {
dsinclair38fd8442016-09-15 10:15:32 -0700372 if (aa.GetDict() != m_pAnnot->GetAnnotDict()->GetDictFor("AA"))
373 m_pAnnot->GetAnnotDict()->SetFor("AA", aa.GetDict());
jaepark27362762016-08-11 13:10:39 -0700374}
375
376void CPDFSDK_BAAnnot::RemoveAAction() {
dsinclair38fd8442016-09-15 10:15:32 -0700377 m_pAnnot->GetAnnotDict()->RemoveFor("AA");
jaepark27362762016-08-11 13:10:39 -0700378}
379
380CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) {
381 CPDF_AAction AAction = GetAAction();
382
383 if (AAction.ActionExist(eAAT))
384 return AAction.GetAction(eAAT);
385
386 if (eAAT == CPDF_AAction::ButtonUp)
387 return GetAction();
388
389 return CPDF_Action();
390}
391
392void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice,
393 CFX_Matrix* pUser2Device,
394 CPDF_RenderOptions* pOptions) {
395 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal);
396 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device,
397 CPDF_Annot::Normal, nullptr);
398}
jaepark35512aa2016-08-29 17:15:08 -0700399
400void CPDFSDK_BAAnnot::SetOpenState(bool bOpenState) {
401 if (CPDF_Annot* pAnnot = m_pAnnot->GetPopupAnnot())
402 pAnnot->SetOpenState(bOpenState);
403}