summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h205
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp176
-rw-r--r--fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp2
-rw-r--r--fpdfsdk/src/fpdf_ext.cpp4
-rw-r--r--fpdfsdk/src/fpdfeditpage.cpp12
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp8
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp179
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp17
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp4
9 files changed, 167 insertions, 440 deletions
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index 801ed2a1a9..307a31cd20 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -1,7 +1,7 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_
@@ -10,37 +10,37 @@
#include "../fpdfapi/fpdf_parser.h"
#include "../fpdfapi/fpdf_render.h"
+class CFieldTree;
+class CPDF_AAction;
class CPDF_Action;
+class CPDF_ActionFields;
class CPDF_Annot;
class CPDF_AnnotList;
+class CPDF_ApSettings;
class CPDF_Bookmark;
class CPDF_BookmarkTree;
+class CPDF_DefaultAppearance;
class CPDF_Dest;
+class CPDF_DocJSActions;
+class CPDF_FileSpec;
+class CPDF_FormControl;
+class CPDF_FormField;
+class CPDF_FormNotify;
+class CPDF_IconFit;
+class CPDF_InterForm;
class CPDF_Link;
class CPDF_LinkList;
+class CPDF_LWinParam;
class CPDF_Metadata;
-class CPDF_NameTree;
class CPDF_NumberTree;
-class CPDF_TextObject;
-class CPDF_ViewerPreferences;
+class CPDF_OCContext;
class CPDF_Page;
class CPDF_RenderOptions;
+class CPDF_TextObject;
+class CPDF_ViewerPreferences;
class CXML_Element;
-class CPDF_OCContext;
-class CPDF_DocJSActions;
-class CPDF_ActionFields;
-class CPDF_AAction;
-class CPDF_FileSpec;
-class CPDF_IconFit;
-class CPDF_DefaultAppearance;
-class CPDF_InterForm;
-class CPDF_FormField;
-class CPDF_FormNotify;
-class CPDF_FormControl;
-class CPDF_LWinParam;
-class CFieldTree;
-class CPDF_ApSettings;
-class CPDF_NameTree
+
+class CPDF_NameTree
{
public:
@@ -71,7 +71,7 @@ protected:
CPDF_Dictionary* m_pRoot;
};
-class CPDF_BookmarkTree
+class CPDF_BookmarkTree
{
public:
CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
@@ -87,7 +87,7 @@ protected:
};
#define PDFBOOKMARK_ITALIC 1
#define PDFBOOKMARK_BOLD 2
-class CPDF_Bookmark
+class CPDF_Bookmark
{
public:
@@ -119,7 +119,7 @@ public:
#define PDFZOOM_FITBBOX 6
#define PDFZOOM_FITBHORZ 7
#define PDFZOOM_FITBVERT 8
-class CPDF_Dest
+class CPDF_Dest
{
public:
CPDF_Dest() : m_pObj(nullptr) { }
@@ -183,7 +183,7 @@ protected:
CFX_MapPtrTemplate<const CPDF_Dictionary*, void*> m_OCGStates;
};
-class CPDF_LWinParam
+class CPDF_LWinParam
{
public:
@@ -222,7 +222,7 @@ public:
CPDF_Dictionary* m_pDict;
};
-class CPDF_ActionFields
+class CPDF_ActionFields
{
public:
@@ -250,7 +250,7 @@ public:
#define PDFNAMED_FIRSTPAGE 3
#define PDFNAMED_LASTPAGE 4
#define PDFJS_MAXLENGTH 64
-class CPDF_Action
+class CPDF_Action
{
public:
enum ActionType {
@@ -289,92 +289,50 @@ public:
ActionType GetType() const;
-
-
CPDF_Dest GetDest(CPDF_Document* pDoc) const;
-
-
-
-
CFX_WideString GetFilePath() const;
-
-
-
FX_BOOL GetNewWindow() const
{
return m_pDict->GetBoolean("NewWindow");
}
-
-
-
CPDF_LWinParam GetWinParam() const;
-
-
-
CFX_ByteString GetURI(CPDF_Document* pDoc) const;
-
-
-
FX_BOOL GetMouseMap() const
{
return m_pDict->GetBoolean("IsMap");
}
-
-
-
CPDF_ActionFields GetWidgets() const
{
return this;
}
-
-
-
FX_BOOL GetHideStatus() const
{
return m_pDict->GetBoolean("H", TRUE);
}
-
-
-
CFX_ByteString GetNamedAction() const
{
return m_pDict->GetString("N");
}
-
-
-
FX_DWORD GetFlags() const
{
return m_pDict->GetInteger("Flags");
}
-
-
-
CFX_WideString GetJavaScript() const;
-
-
-
CPDF_Dictionary* GetAnnot() const;
-
-
-
FX_INT32 GetOperationType() const;
-
-
-
CPDF_Stream* GetSoundStream() const
{
return m_pDict->GetStream("Sound");
@@ -400,9 +358,6 @@ public:
return m_pDict->GetBoolean("Mix");
}
-
-
-
FX_DWORD GetSubActionsCount() const;
CPDF_Action GetSubAction(FX_DWORD iIndex) const;
@@ -410,7 +365,7 @@ public:
protected:
CPDF_Dictionary* m_pDict;
};
-class CPDF_AAction
+class CPDF_AAction
{
public:
@@ -458,7 +413,7 @@ public:
CPDF_Dictionary* m_pDict;
};
-class CPDF_DocJSActions
+class CPDF_DocJSActions
{
public:
CPDF_DocJSActions(CPDF_Document* pDoc);
@@ -482,7 +437,7 @@ protected:
CPDF_Document* m_pDocument;
};
-class CPDF_FileSpec
+class CPDF_FileSpec
{
public:
@@ -509,7 +464,7 @@ protected:
CPDF_Object *m_pObj;
};
-class CPDF_LinkList
+class CPDF_LinkList
{
public:
@@ -540,7 +495,7 @@ protected:
void LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList);
};
-class CPDF_Link
+class CPDF_Link
{
public:
CPDF_Link() : m_pDict(nullptr) { }
@@ -555,73 +510,65 @@ public:
protected:
CPDF_Dictionary* m_pDict;
};
-#define ANNOTFLAG_INVISIBLE 1
-#define ANNOTFLAG_HIDDEN 2
-#define ANNOTFLAG_PRINT 4
-#define ANNOTFLAG_NOZOOM 8
-#define ANNOTFLAG_NOROTATE 0x10
-#define ANNOTFLAG_NOVIEW 0x20
-#define ANNOTFLAG_READONLY 0x40
-#define ANNOTFLAG_LOCKED 0x80
-#define ANNOTFLAG_TOGGLENOVIEW 0x100
-class CPDF_Annot : public CFX_PrivateData
-{
-public:
-
- CPDF_Annot(CPDF_Dictionary* pDict);
-
- ~CPDF_Annot();
-
- CPDF_Dictionary* m_pAnnotDict;
- CFX_ByteString GetSubType() const;
+#define ANNOTFLAG_INVISIBLE 0x0001
+#define ANNOTFLAG_HIDDEN 0x0002
+#define ANNOTFLAG_PRINT 0x0004
+#define ANNOTFLAG_NOZOOM 0x0008
+#define ANNOTFLAG_NOROTATE 0x0010
+#define ANNOTFLAG_NOVIEW 0x0020
+#define ANNOTFLAG_READONLY 0x0040
+#define ANNOTFLAG_LOCKED 0x0080
+#define ANNOTFLAG_TOGGLENOVIEW 0x0100
- FX_DWORD GetFlags() const
- {
- return m_pAnnotDict->GetInteger("F");
- }
-
- void GetRect(CFX_FloatRect& rect) const;
-
- enum AppearanceMode {
+class CPDF_Annot : public CFX_PrivateData
+{
+ public:
+ enum AppearanceMode {
Normal,
Rollover,
Down
};
- FX_BOOL DrawAppearance(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
- AppearanceMode mode, const CPDF_RenderOptions* pOptions);
-
- FX_BOOL DrawInContext(const CPDF_Page* pPage, const CPDF_RenderContext* pContext,
- const CFX_AffineMatrix* pUser2Device, AppearanceMode mode);
-
- void ClearCachedAP();
+ CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList);
+ ~CPDF_Annot();
+ CFX_ByteString GetSubType() const;
- void DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
- const CPDF_RenderOptions* pOptions);
+ FX_DWORD GetFlags() const;
- CPDF_PageObject* GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* pOptions);
+ void GetRect(CFX_FloatRect& rect) const;
+ CPDF_Dictionary* GetAnnotDict();
+ FX_BOOL DrawAppearance(const CPDF_Page* pPage,
+ CFX_RenderDevice* pDevice,
+ const CFX_AffineMatrix* pUser2Device,
+ AppearanceMode mode,
+ const CPDF_RenderOptions* pOptions);
- int CountIRTNotes();
+ FX_BOOL DrawInContext(const CPDF_Page* pPage,
+ const CPDF_RenderContext* pContext,
+ const CFX_AffineMatrix* pUser2Device,
+ AppearanceMode mode);
- CPDF_Annot* GetIRTNote(int index);
+ void ClearCachedAP();
+ void DrawBorder(CFX_RenderDevice* pDevice,
+ const CFX_AffineMatrix* pUser2Device,
+ const CPDF_RenderOptions* pOptions);
- CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode);
-private:
+ CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode);
- CFX_MapPtrToPtr m_APMap;
-protected:
- friend class CPDF_AnnotList;
+ private:
+ CPDF_Dictionary* const m_pAnnotDict;
- CPDF_AnnotList* m_pList;
+ CPDF_AnnotList* const m_pList;
- CPDF_Reference* NewAnnotRef();
+ CFX_MapPtrToPtr m_APMap;
};
-class CPDF_AnnotList
+
+class CPDF_AnnotList
{
public:
@@ -693,7 +640,7 @@ protected:
#define COLORTYPE_GRAY 1
#define COLORTYPE_RGB 2
#define COLORTYPE_CMYK 3
-class CPDF_DefaultAppearance
+class CPDF_DefaultAppearance
{
public:
@@ -1023,7 +970,7 @@ protected:
#define FORMTEXT_COMB 0x800
#define FORMCOMBO_EDIT 0x100
#define FORMLIST_MULTISELECT 0x100
-class CPDF_FormField
+class CPDF_FormField
{
public:
@@ -1246,7 +1193,7 @@ protected:
CPDF_Font* m_pFont;
};
CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name, int nLevel = 0);
-class CPDF_IconFit
+class CPDF_IconFit
{
public:
@@ -1298,7 +1245,7 @@ public:
#define TEXTPOS_RIGHT 4
#define TEXTPOS_LEFT 5
#define TEXTPOS_OVERLAID 6
-class CPDF_FormControl
+class CPDF_FormControl
{
public:
@@ -1506,7 +1453,7 @@ protected:
friend class CPDF_InterForm;
friend class CPDF_FormField;
};
-class CPDF_FormNotify
+class CPDF_FormNotify
{
public:
@@ -1558,7 +1505,7 @@ public:
}
};
FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
-class CPDF_PageLabel
+class CPDF_PageLabel
{
public:
@@ -1622,7 +1569,7 @@ public:
protected:
CPDF_Document* m_pDoc;
};
-class CPDF_ApSettings
+class CPDF_ApSettings
{
public:
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index c8151bfa04..908333c0f6 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -23,7 +23,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm");
FX_BOOL bRegenerateAP = pAcroForm && pAcroForm->GetBoolean("NeedAppearances");
- for (FX_DWORD i = 0; i < pAnnots->GetCount(); i ++) {
+ for (FX_DWORD i = 0; i < pAnnots->GetCount(); ++i) {
CPDF_Dictionary* pDict = (CPDF_Dictionary*)pAnnots->GetElementValue(i);
if (pDict == NULL || pDict->GetType() != PDFOBJ_DICTIONARY) {
continue;
@@ -39,11 +39,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pAnnots->RemoveAt(i + 1);
pDict = pAnnots->GetDict(i);
}
- CPDF_Annot* pAnnot = FX_NEW CPDF_Annot(pDict);
- if (pAnnot == NULL) {
- break;
- }
- pAnnot->m_pList = this;
+ CPDF_Annot* pAnnot = new CPDF_Annot(pDict, this);
m_AnnotList.Add(pAnnot);
if (bRegenerateAP && pDict->GetConstString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget"))
if (CPDF_InterForm::UpdatingAPEnabled()) {
@@ -54,7 +50,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
CPDF_AnnotList::~CPDF_AnnotList()
{
int i = 0;
- for (i = 0; i < m_AnnotList.GetSize(); i ++) {
+ for (i = 0; i < m_AnnotList.GetSize(); ++i) {
delete (CPDF_Annot*)m_AnnotList[i];
}
for (i = 0; i < m_Borders.GetSize(); ++i) {
@@ -65,7 +61,7 @@ void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevi
CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix,
FX_BOOL bWidgetPass, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect)
{
- for (int i = 0; i < m_AnnotList.GetSize(); i ++) {
+ for (int i = 0; i < m_AnnotList.GetSize(); ++i) {
CPDF_Annot* pAnnot = (CPDF_Annot*)m_AnnotList[i];
FX_BOOL bWidget = pAnnot->GetSubType() == "Widget";
if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) {
@@ -83,7 +79,7 @@ void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevi
}
if (pOptions != NULL) {
IPDF_OCContext* pOCContext = pOptions->m_pOCContext;
- CPDF_Dictionary* pAnnotDict = pAnnot->m_pAnnotDict;
+ CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
if (pOCContext != NULL && pAnnotDict != NULL &&
!pOCContext->CheckOCGVisible(pAnnotDict->GetDict(FX_BSTRC("OC")))) {
continue;
@@ -132,28 +128,21 @@ void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDe
}
int CPDF_AnnotList::GetIndex(CPDF_Annot* pAnnot)
{
- for (int i = 0; i < m_AnnotList.GetSize(); i ++)
+ for (int i = 0; i < m_AnnotList.GetSize(); ++i)
if (m_AnnotList[i] == (FX_LPVOID)pAnnot) {
return i;
}
return -1;
}
-CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict)
+CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList)
+ : m_pAnnotDict(pDict),
+ m_pList(pList)
{
- m_pList = NULL;
- m_pAnnotDict = pDict;
}
CPDF_Annot::~CPDF_Annot()
{
ClearCachedAP();
}
-CPDF_Reference* CPDF_Annot::NewAnnotRef()
-{
- if (m_pAnnotDict->GetObjNum() == 0) {
- m_pList->m_pDocument->AddIndirectObject(m_pAnnotDict);
- }
- return CPDF_Reference::Create(m_pList->m_pDocument, m_pAnnotDict->GetObjNum());
-}
void CPDF_Annot::ClearCachedAP()
{
FX_POSITION pos = m_APMap.GetStartPosition();
@@ -169,6 +158,7 @@ CFX_ByteString CPDF_Annot::GetSubType() const
{
return m_pAnnotDict ? m_pAnnotDict->GetConstString(FX_BSTRC("Subtype")) : CFX_ByteStringC();
}
+
void CPDF_Annot::GetRect(CPDF_Rect& rect) const
{
if (m_pAnnotDict == NULL) {
@@ -177,6 +167,17 @@ void CPDF_Annot::GetRect(CPDF_Rect& rect) const
rect = m_pAnnotDict->GetRect("Rect");
rect.Normalize();
}
+
+FX_DWORD CPDF_Annot::GetFlags() const
+{
+ return m_pAnnotDict->GetInteger("F");
+}
+
+CPDF_Dictionary* CPDF_Annot::GetAnnotDict()
+{
+ return m_pAnnotDict;
+}
+
CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, CPDF_Annot::AppearanceMode mode)
{
CPDF_Dictionary* pAP = pAnnotDict->GetDict("AP");
@@ -273,102 +274,6 @@ FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage, const CPDF_RenderConte
((CPDF_RenderContext*)pContext)->AppendObjectList(pForm, &matrix);
return TRUE;
}
-CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* pOptions)
-{
- if (GetSubType() == "Popup") {
- return NULL;
- }
- FX_DWORD annot_flags = GetFlags();
- if (annot_flags & ANNOTFLAG_HIDDEN) {
- return NULL;
- }
- FX_BOOL bPrinting = bPrint || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW));
- if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) {
- return NULL;
- }
- if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) {
- return NULL;
- }
- CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS");
- char style_char;
- FX_FLOAT width;
- CPDF_Array* pDashArray = NULL;
- if (pBS == NULL) {
- CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border");
- style_char = 'S';
- if (pBorderArray) {
- width = pBorderArray->GetNumber(2);
- if (pBorderArray->GetCount() == 4) {
- pDashArray = pBorderArray->GetArray(3);
- if (pDashArray == NULL) {
- return NULL;
- }
- style_char = 'D';
- }
- } else {
- width = 1;
- }
- } else {
- CFX_ByteString style = pBS->GetString("S");
- pDashArray = pBS->GetArray("D");
- style_char = style[1];
- width = pBS->GetNumber("W");
- }
- if (width <= 0) {
- return NULL;
- }
- CPDF_Array* pColor = m_pAnnotDict->GetArray("C");
- FX_DWORD argb = 0xff000000;
- if (pColor != NULL) {
- int R = (FX_INT32)(pColor->GetNumber(0) * 255);
- int G = (FX_INT32)(pColor->GetNumber(1) * 255);
- int B = (FX_INT32)(pColor->GetNumber(2) * 255);
- argb = ArgbEncode(0xff, R, G, B);
- }
- nonstd::unique_ptr<CPDF_PathObject> pPathObject(new CPDF_PathObject());
- CPDF_GraphStateData *pGraphState = pPathObject->m_GraphState.GetModify();
- if (!pGraphState) {
- return NULL;
- }
- pGraphState->m_LineWidth = width;
- CPDF_ColorStateData *pColorData = pPathObject->m_ColorState.GetModify();
- if (!pColorData) {
- return NULL;
- }
- pColorData->m_StrokeRGB = argb;
- pPathObject->m_bStroke = TRUE;
- pPathObject->m_FillType = 0;
- if (style_char == 'D') {
- if (pDashArray) {
- FX_DWORD dash_count = pDashArray->GetCount();
- if (dash_count % 2) {
- dash_count ++;
- }
- pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, dash_count);
- pGraphState->m_DashCount = dash_count;
- FX_DWORD i;
- for (i = 0; i < pDashArray->GetCount(); i ++) {
- pGraphState->m_DashArray[i] = pDashArray->GetNumber(i);
- }
- if (i < dash_count) {
- pGraphState->m_DashArray[i] = pGraphState->m_DashArray[i - 1];
- }
- } else {
- pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, 2);
- pGraphState->m_DashCount = 2;
- pGraphState->m_DashArray[0] = pGraphState->m_DashArray[1] = 3 * 1.0f;
- }
- }
- CFX_FloatRect rect;
- GetRect(rect);
- width /= 2;
- CPDF_PathData *pPathData = pPathObject->m_Path.GetModify();
- if (pPathData) {
- pPathData->AppendRect(rect.left + width, rect.bottom + width, rect.right - width, rect.top - width);
- }
- pPathObject->CalcBoundingBox();
- return pPathObject.release();
-}
void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device, const CPDF_RenderOptions* pOptions)
{
if (GetSubType() == "Popup") {
@@ -438,12 +343,12 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p
if (pDashArray) {
FX_DWORD dash_count = pDashArray->GetCount();
if (dash_count % 2) {
- dash_count ++;
+ dash_count++;
}
graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count);
graph_state.m_DashCount = dash_count;
FX_DWORD i;
- for (i = 0; i < pDashArray->GetCount(); i ++) {
+ for (i = 0; i < pDashArray->GetCount(); ++i) {
graph_state.m_DashArray[i] = pDashArray->GetNumber(i);
}
if (i < dash_count) {
@@ -466,38 +371,3 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p
}
pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type);
}
-int CPDF_Annot::CountIRTNotes()
-{
- int count = 0;
- for (int i = 0; i < m_pList->Count(); i ++) {
- CPDF_Annot* pAnnot = m_pList->GetAt(i);
- if (pAnnot == NULL) {
- continue;
- }
- CPDF_Dictionary* pIRT = pAnnot->m_pAnnotDict->GetDict("IRT");
- if (pIRT != m_pAnnotDict) {
- continue;
- }
- count ++;
- }
- return count;
-}
-CPDF_Annot* CPDF_Annot::GetIRTNote(int index)
-{
- int count = 0;
- for (int i = 0; i < m_pList->Count(); i ++) {
- CPDF_Annot* pAnnot = m_pList->GetAt(i);
- if (pAnnot == NULL) {
- continue;
- }
- CPDF_Dictionary* pIRT = pAnnot->m_pAnnotDict->GetDict("IRT");
- if (pIRT != m_pAnnotDict) {
- continue;
- }
- if (count == index) {
- return pAnnot;
- }
- count ++;
- }
- return NULL;
-}
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
index 8e10cc22e3..9f04861e44 100644
--- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
@@ -19,7 +19,7 @@ CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandle
CPDF_Page* pPage = pAnnot->GetPDFPage();
m_pDocument = pPage->m_pDocument;
- m_pAnnotDict = pAnnot->GetPDFAnnot()->m_pAnnotDict;
+ m_pAnnotDict = pAnnot->GetPDFAnnot()->GetAnnotDict();
}
CBA_FontMap::CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict,
diff --git a/fpdfsdk/src/fpdf_ext.cpp b/fpdfsdk/src/fpdf_ext.cpp
index ae9cb9e44e..6d846dfb67 100644
--- a/fpdfsdk/src/fpdf_ext.cpp
+++ b/fpdfsdk/src/fpdf_ext.cpp
@@ -65,7 +65,7 @@ void CheckUnSupportAnnot(CPDF_Document * pDoc, CPDF_Annot* pPDFAnnot)
}
else if(cbSubType.Compare("Screen") ==0)
{
- CPDF_Dictionary* pAnnotDict = pPDFAnnot->m_pAnnotDict;
+ CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
CFX_ByteString cbString;
if(pAnnotDict->KeyExist("IT"))
cbString = pAnnotDict->GetString("IT");
@@ -90,7 +90,7 @@ void CheckUnSupportAnnot(CPDF_Document * pDoc, CPDF_Annot* pPDFAnnot)
}
else if(cbSubType.Compare("Widget") ==0)
{
- CPDF_Dictionary* pAnnotDict = pPDFAnnot->m_pAnnotDict;
+ CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
CFX_ByteString cbString;
if(pAnnotDict->KeyExist("FT"))
{
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index 2fdc7de3f5..205d0a01e8 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -305,13 +305,13 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
CFX_AffineMatrix matrix((FX_FLOAT)a,(FX_FLOAT)b,(FX_FLOAT)c,(FX_FLOAT)d,(FX_FLOAT)e,(FX_FLOAT)f);
rect.Transform(&matrix);
CPDF_Array *pRectArray = NULL;
- pRectArray = pAnnot->m_pAnnotDict->GetArray("Rect");
+ pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
if (!pRectArray) pRectArray=CPDF_Array::Create();
- pRectArray->SetAt(0,FX_NEW CPDF_Number(rect.left));
- pRectArray->SetAt(1,FX_NEW CPDF_Number(rect.bottom));
- pRectArray->SetAt(2,FX_NEW CPDF_Number(rect.right));
- pRectArray->SetAt(3,FX_NEW CPDF_Number(rect.top));
- pAnnot->m_pAnnotDict->SetAt("Rect",pRectArray);
+ pRectArray->SetAt(0, new CPDF_Number(rect.left));
+ pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
+ pRectArray->SetAt(2, new CPDF_Number(rect.right));
+ pRectArray->SetAt(3, new CPDF_Number(rect.top));
+ pAnnot->GetAnnotDict()->SetAt("Rect",pRectArray);
//Transform AP's rectangle
//To Do
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 6b7c60d7af..302cec597b 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -109,12 +109,10 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot)
ASSERT(pAnnot != NULL);
CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
- ASSERT(pPDFAnnot != NULL);
- ASSERT(pPDFAnnot->m_pAnnotDict != NULL);
CPDFSDK_DateTime curTime;
- pPDFAnnot->m_pAnnotDict->SetAtString("M", curTime.ToPDFDateTimeString());
- pPDFAnnot->m_pAnnotDict->SetAtNumber("F", (int)0);
+ pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString());
+ pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot))
{
@@ -454,7 +452,7 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Pag
ASSERT(pInterForm != NULL);
CPDFSDK_Widget* pWidget = NULL;
- if (CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInterForm(), pAnnot->m_pAnnotDict))
+ if (CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInterForm(), pAnnot->GetAnnotDict()))
{
pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm);
pInterForm->AddMap(pCtrl, pWidget);
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index e80d3b8e73..9a340a1a3a 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -555,17 +555,15 @@ CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const
{
ASSERT(m_pAnnot != NULL);
- return m_pAnnot->m_pAnnotDict;
+ return m_pAnnot->GetAnnotDict();
}
void CPDFSDK_BAAnnot::SetRect(const CPDF_Rect& rect)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
ASSERT(rect.right - rect.left >= GetMinWidth());
ASSERT(rect.top - rect.bottom >= GetMinHeight());
- m_pAnnot->m_pAnnotDict->SetAtRect("Rect", rect);
+ m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect);
}
CPDF_Rect CPDFSDK_BAAnnot::GetRect() const
@@ -606,18 +604,12 @@ void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matri
FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid()
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- return m_pAnnot->m_pAnnotDict->GetDict("AP") != NULL;
+ return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL;
}
FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Dictionary* pAP = m_pAnnot->m_pAnnotDict->GetDict("AP");
+ CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
if (pAP == NULL) return FALSE;
// Choose the right sub-ap
@@ -651,63 +643,45 @@ void CPDFSDK_BAAnnot::ClearCachedAP()
void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
if (sContents.IsEmpty())
- m_pAnnot->m_pAnnotDict->RemoveAt("Contents");
+ m_pAnnot->GetAnnotDict()->RemoveAt("Contents");
else
- m_pAnnot->m_pAnnotDict->SetAtString("Contents", PDF_EncodeText(sContents));
+ m_pAnnot->GetAnnotDict()->SetAtString("Contents", PDF_EncodeText(sContents));
}
CFX_WideString CPDFSDK_BAAnnot::GetContents() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- return m_pAnnot->m_pAnnotDict->GetUnicodeText("Contents");
+ return m_pAnnot->GetAnnotDict()->GetUnicodeText("Contents");
}
void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
if (sName.IsEmpty())
- m_pAnnot->m_pAnnotDict->RemoveAt("NM");
+ m_pAnnot->GetAnnotDict()->RemoveAt("NM");
else
- m_pAnnot->m_pAnnotDict->SetAtString("NM", PDF_EncodeText(sName));
+ m_pAnnot->GetAnnotDict()->SetAtString("NM", PDF_EncodeText(sName));
}
CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- return m_pAnnot->m_pAnnotDict->GetUnicodeText("NM");
+ return m_pAnnot->GetAnnotDict()->GetUnicodeText("NM");
}
void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
CPDFSDK_DateTime dt(st);
CFX_ByteString str = dt.ToPDFDateTimeString();
if (str.IsEmpty())
- m_pAnnot->m_pAnnotDict->RemoveAt("M");
+ m_pAnnot->GetAnnotDict()->RemoveAt("M");
else
- m_pAnnot->m_pAnnotDict->SetAtString("M", str);
+ m_pAnnot->GetAnnotDict()->SetAtString("M", str);
}
FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
FX_SYSTEMTIME systime;
- CFX_ByteString str = m_pAnnot->m_pAnnotDict->GetString("M");
+ CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetString("M");
CPDFSDK_DateTime dt(str);
dt.ToSystemTime(systime);
@@ -717,62 +691,41 @@ FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const
void CPDFSDK_BAAnnot::SetFlags(int nFlags)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- m_pAnnot->m_pAnnotDict->SetAtInteger("F", nFlags);
+ m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags);
}
int CPDFSDK_BAAnnot::GetFlags() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- return m_pAnnot->m_pAnnotDict->GetInteger("F");
+ return m_pAnnot->GetAnnotDict()->GetInteger("F");
}
void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
if (str.IsEmpty())
- m_pAnnot->m_pAnnotDict->RemoveAt("AS");
+ m_pAnnot->GetAnnotDict()->RemoveAt("AS");
else
- m_pAnnot->m_pAnnotDict->SetAtString("AS", str);
+ m_pAnnot->GetAnnotDict()->SetAtString("AS", str);
}
CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- return m_pAnnot->m_pAnnotDict->GetString("AS");
+ return m_pAnnot->GetAnnotDict()->GetString("AS");
}
void CPDFSDK_BAAnnot::SetStructParent(int key)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- m_pAnnot->m_pAnnotDict->SetAtInteger("StructParent", key);
+ m_pAnnot->GetAnnotDict()->SetAtInteger("StructParent", key);
}
int CPDFSDK_BAAnnot::GetStructParent() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- return m_pAnnot->m_pAnnotDict->GetInteger("StructParent");
+ return m_pAnnot->GetAnnotDict()->GetInteger("StructParent");
}
//border
void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border");
+ CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border");
if (pBorder)
{
@@ -780,12 +733,12 @@ void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth)
}
else
{
- CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS");
+ CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS");
if (!pBSDict)
{
pBSDict = FX_NEW CPDF_Dictionary;
- m_pAnnot->m_pAnnotDict->SetAt("BS", pBSDict);
+ m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict);
}
pBSDict->SetAtInteger("W", nWidth);
@@ -794,10 +747,7 @@ void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth)
int CPDFSDK_BAAnnot::GetBorderWidth() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border");
+ CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border");
if (pBorder)
{
@@ -805,7 +755,7 @@ int CPDFSDK_BAAnnot::GetBorderWidth() const
}
else
{
- CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS");
+ CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS");
if (pBSDict)
{
@@ -817,14 +767,11 @@ int CPDFSDK_BAAnnot::GetBorderWidth() const
void CPDFSDK_BAAnnot::SetBorderStyle(int nStyle)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS");
+ CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS");
if (!pBSDict)
{
- pBSDict = FX_NEW CPDF_Dictionary;
- m_pAnnot->m_pAnnotDict->SetAt("BS", pBSDict);
+ pBSDict = new CPDF_Dictionary;
+ m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict);
}
switch (nStyle)
@@ -849,10 +796,7 @@ void CPDFSDK_BAAnnot::SetBorderStyle(int nStyle)
int CPDFSDK_BAAnnot::GetBorderStyle() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS");
+ CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS");
if (pBSDict)
{
CFX_ByteString sBorderStyle = pBSDict->GetString("S", "S");
@@ -863,7 +807,7 @@ int CPDFSDK_BAAnnot::GetBorderStyle() const
if (sBorderStyle == "U") return BBS_UNDERLINE;
}
- CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border");
+ CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border");
if (pBorder)
{
if (pBorder->GetCount() >= 4)
@@ -879,14 +823,11 @@ int CPDFSDK_BAAnnot::GetBorderStyle() const
void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS");
+ CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS");
if (!pBSDict)
{
- pBSDict = FX_NEW CPDF_Dictionary;
- m_pAnnot->m_pAnnotDict->SetAt("BS", pBSDict);
+ pBSDict = new CPDF_Dictionary;
+ m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict);
}
CPDF_Array* pArray = FX_NEW CPDF_Array;
@@ -900,19 +841,16 @@ void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array)
void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
CPDF_Array* pDash = NULL;
- CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border");
+ CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border");
if (pBorder)
{
pDash = pBorder->GetArray(3);
}
else
{
- CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS");
+ CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS");
if (pBSDict)
{
pDash = pBSDict->GetArray("D");
@@ -930,30 +868,21 @@ void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const
void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Array* pArray = FX_NEW CPDF_Array;
+ CPDF_Array* pArray = new CPDF_Array;
pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f);
pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f);
pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f);
- m_pAnnot->m_pAnnotDict->SetAt("C", pArray);
+ m_pAnnot->GetAnnotDict()->SetAt("C", pArray);
}
void CPDFSDK_BAAnnot::RemoveColor()
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- m_pAnnot->m_pAnnotDict->RemoveAt("C") ;
+ m_pAnnot->GetAnnotDict()->RemoveAt("C");
}
FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- if (CPDF_Array* pEntry = m_pAnnot->m_pAnnotDict->GetArray("C"))
+ if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C"))
{
int nCount = pEntry->GetCount();
if (nCount == 1)
@@ -999,15 +928,12 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_
const CPDF_Matrix& matrix, const CFX_ByteString& sContents,
const CFX_ByteString& sAPState)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Dictionary* pAPDict = m_pAnnot->m_pAnnotDict->GetDict("AP");
+ CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP");
if (!pAPDict)
{
- pAPDict = FX_NEW CPDF_Dictionary;
- m_pAnnot->m_pAnnotDict->SetAt("AP", pAPDict);
+ pAPDict = new CPDF_Dictionary;
+ m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict);
}
CPDF_Stream* pStream = NULL;
@@ -1089,49 +1015,44 @@ FX_BOOL CPDFSDK_BAAnnot::IsVisible() const
CPDF_Action CPDFSDK_BAAnnot::GetAction() const
{
- return CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict("A"));
+ return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A"));
}
void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action)
{
ASSERT(action);
- if ((CPDF_Action&)action != CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict("A")))
+ if ((CPDF_Action&)action != CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A")))
{
CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
CPDF_Dictionary* pDict = action.GetDict();
if (pDict && pDict->GetObjNum() == 0) {
pDoc->AddIndirectObject(pDict);
}
- m_pAnnot->m_pAnnotDict->SetAtReference("A", pDoc, pDict->GetObjNum());
+ m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum());
}
}
void CPDFSDK_BAAnnot::RemoveAction()
{
- m_pAnnot->m_pAnnotDict->RemoveAt("A");
+ m_pAnnot->GetAnnotDict()->RemoveAt("A");
}
CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const
{
- return m_pAnnot->m_pAnnotDict->GetDict("AA");
+ return m_pAnnot->GetAnnotDict()->GetDict("AA");
}
void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
ASSERT(aa != NULL);
- if ((CPDF_AAction&)aa != m_pAnnot->m_pAnnotDict->GetDict("AA"))
- m_pAnnot->m_pAnnotDict->SetAt("AA", (CPDF_AAction&)aa);
+ if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA"))
+ m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa);
}
void CPDFSDK_BAAnnot::RemoveAAction()
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- m_pAnnot->m_pAnnotDict->RemoveAt("AA");
+ m_pAnnot->GetAnnotDict()->RemoveAt("AA");
}
CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT)
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 6fcdeac3af..efdcfc0c85 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -564,10 +564,7 @@ void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView, IXFA_Widget*
FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- CPDF_Dictionary* pAP = m_pAnnot->m_pAnnotDict->GetDict("AP");
+ CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
if (pAP == NULL) return FALSE;
// Choose the right sub-ap
@@ -638,7 +635,7 @@ int CPDFSDK_Widget::GetFieldFlags() const
CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm();
ASSERT(pPDFInterForm != NULL);
- CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnnot->m_pAnnotDict);
+ CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnnot->GetAnnotDict());
CPDF_FormField* pFormField = pFormControl->GetField();
return pFormField->GetFieldFlags();
}
@@ -2182,13 +2179,10 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_St
{
ASSERT(pImage != NULL);
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
CPDF_Document* pDoc = m_pPageView->GetPDFDocument();//pDocument->GetDocument();
ASSERT(pDoc != NULL);
- CPDF_Dictionary* pAPDict = m_pAnnot->m_pAnnotDict->GetDict("AP");
+ CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP");
ASSERT(pAPDict != NULL);
CPDF_Stream* pStream = pAPDict->GetStream(sAPType);
@@ -2223,10 +2217,7 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_St
void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- if (CPDF_Dictionary* pAPDict = m_pAnnot->m_pAnnotDict->GetDict("AP"))
+ if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"))
{
pAPDict->RemoveAt(sAPType);
}
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index a1d9453c52..b0b398d563 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -773,7 +773,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pag
FX_BOOL CPDFSDK_PageView::Annot_HasAppearance(CPDF_Annot* pAnnot)
{
- CPDF_Dictionary* pAnnotDic = pAnnot->m_pAnnotDict;
+ CPDF_Dictionary* pAnnotDic = pAnnot->GetAnnotDict();
if(pAnnotDic)
return pAnnotDic->KeyExist("AS");
return FALSE;
@@ -900,7 +900,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByDict(CPDF_Dictionary * pDict)
for(int i=0; i<nCount; i++)
{
CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i);
- if(pDict==pAnnot->GetPDFAnnot()->m_pAnnotDict)
+ if (pDict == pAnnot->GetPDFAnnot()->GetAnnotDict())
return pAnnot;
}
return NULL;