summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpvt_generateap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 24827e3f22..28b436a05c 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -58,12 +58,13 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict = pDRFontDict->GetDictFor(sFontName.Mid(1));
if (!pFontDict) {
- pFontDict = pDoc->AddIndirectDictionary(pDoc->GetByteStringPool());
+ pFontDict = new CPDF_Dictionary(pDoc->GetByteStringPool());
pFontDict->SetNameFor("Type", "Font");
pFontDict->SetNameFor("Subtype", "Type1");
pFontDict->SetNameFor("BaseFont", "Helvetica");
pFontDict->SetNameFor("Encoding", "WinAnsiEncoding");
- pDRFontDict->SetReferenceFor(sFontName.Mid(1), pDoc, pFontDict);
+ pDRFontDict->SetReferenceFor(sFontName.Mid(1), pDoc,
+ pDoc->AddIndirectObject(pFontDict));
}
CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict);
if (!pDefFont)
@@ -167,8 +168,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
}
CPDF_Stream* pNormalStream = pAPDict->GetStreamFor("N");
if (!pNormalStream) {
- pNormalStream = pDoc->AddIndirectStream();
- pAPDict->SetReferenceFor("N", pDoc, pNormalStream);
+ pNormalStream = new CPDF_Stream;
+ pAPDict->SetReferenceFor("N", pDoc, pDoc->AddIndirectObject(pNormalStream));
}
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
if (pStreamDict) {
@@ -182,7 +183,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
pStreamResList->SetFor("Font", pStreamResFontList);
}
if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetReferenceFor(sFontName, pDoc, pFontDict);
+ pStreamResFontList->SetReferenceFor(sFontName, pDoc,
+ pFontDict->GetObjNum());
} else {
pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone());
pStreamResList = pStreamDict->GetDictFor("Resources");
@@ -432,7 +434,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
pStreamResList->SetFor("Font", pStreamResFontList);
}
if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetReferenceFor(sFontName, pDoc, pFontDict);
+ pStreamResFontList->SetReferenceFor(sFontName, pDoc,
+ pFontDict->GetObjNum());
} else {
pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone());
pStreamResList = pStreamDict->GetDictFor("Resources");
@@ -556,8 +559,7 @@ CPDF_Dictionary* GenerateExtGStateDict(const CPDF_Dictionary& pAnnotDict,
CPDF_Dictionary* GenerateResourceFontDict(CPDF_Document* pDoc,
const CFX_ByteString& sFontDictName) {
- CPDF_Dictionary* pFontDict =
- pDoc->AddIndirectDictionary(pDoc->GetByteStringPool());
+ CPDF_Dictionary* pFontDict = new CPDF_Dictionary(pDoc->GetByteStringPool());
pFontDict->SetNameFor("Type", "Font");
pFontDict->SetNameFor("Subtype", "Type1");
pFontDict->SetNameFor("BaseFont", "Helvetica");
@@ -565,7 +567,8 @@ CPDF_Dictionary* GenerateResourceFontDict(CPDF_Document* pDoc,
CPDF_Dictionary* pResourceFontDict =
new CPDF_Dictionary(pDoc->GetByteStringPool());
- pResourceFontDict->SetReferenceFor(sFontDictName, pDoc, pFontDict);
+ pResourceFontDict->SetReferenceFor(sFontDictName, pDoc,
+ pDoc->AddIndirectObject(pFontDict));
return pResourceFontDict;
}
@@ -593,9 +596,9 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc,
CPDF_Dictionary* pAPDict = new CPDF_Dictionary(pDoc->GetByteStringPool());
pAnnotDict->SetFor("AP", pAPDict);
- CPDF_Stream* pNormalStream = pDoc->AddIndirectStream();
+ CPDF_Stream* pNormalStream = new CPDF_Stream;
pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize());
- pAPDict->SetReferenceFor("N", pDoc, pNormalStream);
+ pAPDict->SetReferenceFor("N", pDoc, pDoc->AddIndirectObject(pNormalStream));
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
pStreamDict->SetIntegerFor("FormType", 1);