本文整理汇总了C++中CPDF_Object::GetDirect方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Object::GetDirect方法的具体用法?C++ CPDF_Object::GetDirect怎么用?C++ CPDF_Object::GetDirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Object
的用法示例。
在下文中一共展示了CPDF_Object::GetDirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsContentUsedElsewhere
FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum,
CPDF_Dictionary* pThisPageDict) {
for (int i = 0; i < m_PageList.GetSize(); i++) {
CPDF_Dictionary* pPageDict = GetPage(i);
if (pPageDict == pThisPageDict) {
continue;
}
CPDF_Object* pContents =
pPageDict ? pPageDict->GetElement("Contents") : NULL;
if (!pContents) {
continue;
}
if (pContents->GetDirectType() == PDFOBJ_ARRAY) {
CPDF_Array* pArray = pContents->GetDirect()->AsArray();
for (FX_DWORD j = 0; j < pArray->GetCount(); j++) {
CPDF_Reference* pRef = ToReference(pArray->GetElement(j));
if (pRef && pRef->GetRefObjNum() == objnum)
return TRUE;
}
} else if (pContents->GetObjNum() == objnum) {
return TRUE;
}
}
return FALSE;
}
示例2: CountInterFormFonts
FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) {
if (!pFormDict) {
return 0;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return 0;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (!pFonts) {
return 0;
}
FX_DWORD dwCount = 0;
for (const auto& it : *pFonts) {
CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
if (CPDF_Dictionary* pDirect = ToDictionary(pObj->GetDirect())) {
if (pDirect->GetString("Type") == "Font") {
dwCount++;
}
}
}
return dwCount;
}
示例3: CountInterFormFonts
FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict)
{
if (pFormDict == NULL) {
return 0;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return 0;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return 0;
}
FX_DWORD dwCount = 0;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect != NULL && pDirect->GetType() == PDFOBJ_DICTIONARY) {
if (((CPDF_Dictionary*)pDirect)->GetString("Type") == "Font") {
dwCount ++;
}
}
}
return dwCount;
}
示例4: GetInterFormFont
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
FX_DWORD index,
CFX_ByteString& csNameTag) {
if (!pFormDict) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (!pFonts) {
return NULL;
}
FX_DWORD dwCount = 0;
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
if (pElement->GetString("Type") != "Font")
continue;
if (dwCount == index) {
csNameTag = csKey;
return pDocument->LoadFont(pElement);
}
dwCount++;
}
return NULL;
}
示例5: FindInterFormFont
FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict,
const CPDF_Font* pFont,
CFX_ByteString& csNameTag) {
if (!pFormDict || !pFont) {
return FALSE;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return FALSE;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (!pFonts) {
return FALSE;
}
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
if (pElement->GetString("Type") != "Font") {
continue;
}
if (pFont->GetFontDict() == pElement) {
csNameTag = csKey;
return TRUE;
}
}
return FALSE;
}
示例6: GetElementValue
CPDF_Object* CPDF_Dictionary::GetElementValue(FX_BSTR key) const
{
if (this == NULL) {
return NULL;
}
CPDF_Object* p = NULL;
m_Map.Lookup(key, (void*&)p);
return p->GetDirect();
}
示例7: PDFDocInit
FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
CPDF_Document* pSrcPDFDoc) {
if (!pDestPDFDoc || !pSrcPDFDoc)
return FALSE;
CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot();
if (!pNewRoot)
return FALSE;
// Set the document information////////////////////////////////////////////
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
return FALSE;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
DInfoDict->SetAt("Producer", new CPDF_String(producerstr));
// Set type////////////////////////////////////////////////////////////////
CFX_ByteString cbRootType = pNewRoot->GetString("Type", "");
if (cbRootType.Equal("")) {
pNewRoot->SetAt("Type", new CPDF_Name("Catalog"));
}
CPDF_Object* pElement = pNewRoot->GetElement("Pages");
CPDF_Dictionary* pNewPages =
pElement ? ToDictionary(pElement->GetDirect()) : nullptr;
if (!pNewPages) {
pNewPages = new CPDF_Dictionary;
FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages);
pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON));
}
CFX_ByteString cbPageType = pNewPages->GetString("Type", "");
if (cbPageType.Equal("")) {
pNewPages->SetAt("Type", new CPDF_Name("Pages"));
}
CPDF_Array* pKeysArray = pNewPages->GetArray("Kids");
if (!pKeysArray) {
CPDF_Array* pNewKids = new CPDF_Array;
FX_DWORD Kidsobjnum = -1;
Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids);
pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum));
pNewPages->SetAt("Count", new CPDF_Number(0));
}
return TRUE;
}
示例8: FindInterFormFont
FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
return FALSE;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return FALSE;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return FALSE;
}
if (csFontName.GetLength() > 0) {
csFontName.Remove(' ');
}
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey, csTmp;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font") {
continue;
}
pFont = pDocument->LoadFont(pElement);
if (pFont == NULL) {
continue;
}
CFX_ByteString csBaseFont;
csBaseFont = pFont->GetBaseFont();
csBaseFont.Remove(' ');
if (csBaseFont == csFontName) {
csNameTag = csKey;
return TRUE;
}
}
return FALSE;
}
示例9: GetNativeInterFormFont
CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return NULL;
}
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font") {
continue;
}
CPDF_Font* pFind = pDocument->LoadFont(pElement);
if (pFind == NULL) {
continue;
}
CFX_SubstFont* pSubst = (CFX_SubstFont*)pFind->GetSubstFont();
if (pSubst == NULL) {
continue;
}
if (pSubst->m_Charset == (int)charSet) {
csNameTag = csKey;
return pFind;
}
}
return NULL;
}
示例10: FindResFontSameCharset
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
CFX_ByteString& sFontAlias,
int32_t nCharset) {
if (!pResDict)
return NULL;
CPDF_Document* pDocument = GetDocument();
ASSERT(pDocument != NULL);
CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
if (pFonts == NULL)
return NULL;
CPDF_Font* pFind = NULL;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL)
continue;
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY)
continue;
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font")
continue;
CPDF_Font* pFont = pDocument->LoadFont(pElement);
if (pFont == NULL)
continue;
const CFX_SubstFont* pSubst = pFont->GetSubstFont();
if (pSubst == NULL)
continue;
if (pSubst->m_Charset == nCharset) {
sFontAlias = csKey;
pFind = pFont;
}
}
return pFind;
}
示例11: PDFDocInit
FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
CPDF_Document* pSrcPDFDoc) {
if (!pDestPDFDoc || !pSrcPDFDoc)
return FALSE;
CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot();
if (!pNewRoot)
return FALSE;
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
return FALSE;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
DInfoDict->SetFor("Producer", new CPDF_String(producerstr, FALSE));
CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
if (cbRootType.IsEmpty())
pNewRoot->SetFor("Type", new CPDF_Name("Catalog"));
CPDF_Object* pElement = pNewRoot->GetObjectFor("Pages");
CPDF_Dictionary* pNewPages =
pElement ? ToDictionary(pElement->GetDirect()) : nullptr;
if (!pNewPages) {
pNewPages = new CPDF_Dictionary(pDestPDFDoc->GetByteStringPool());
pNewRoot->SetReferenceFor("Pages", pDestPDFDoc,
pDestPDFDoc->AddIndirectObject(pNewPages));
}
CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", "");
if (cbPageType == "") {
pNewPages->SetFor("Type", new CPDF_Name("Pages"));
}
if (!pNewPages->GetArrayFor("Kids")) {
pNewPages->SetIntegerFor("Count", 0);
pNewPages->SetReferenceFor("Kids", pDestPDFDoc,
pDestPDFDoc->AddIndirectObject(new CPDF_Array));
}
return TRUE;
}
示例12: GetNativeInterFormFont
CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
uint8_t charSet,
CFX_ByteString& csNameTag) {
if (!pFormDict) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (!pFonts) {
return NULL;
}
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
if (pElement->GetString("Type") != "Font")
continue;
CPDF_Font* pFind = pDocument->LoadFont(pElement);
if (!pFind) {
continue;
}
CFX_SubstFont* pSubst = (CFX_SubstFont*)pFind->GetSubstFont();
if (!pSubst) {
continue;
}
if (pSubst->m_Charset == (int)charSet) {
csNameTag = csKey;
return pFind;
}
}
return NULL;
}
示例13: GetInterFormFont
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return NULL;
}
FX_DWORD dwCount = 0;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font") {
continue;
}
if (dwCount == index) {
csNameTag = csKey;
return pDocument->LoadFont(pElement);
}
dwCount ++;
}
return NULL;
}
示例14: GetLabel
CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const
{
CFX_WideString wsLabel;
if (m_pDocument == NULL) {
return wsLabel;
}
CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot();
if (pPDFRoot == NULL) {
return wsLabel;
}
CPDF_Dictionary* pLabels = pPDFRoot->GetDict(FX_BSTRC("PageLabels"));
CPDF_NumberTree numberTree(pLabels);
CPDF_Object* pValue = NULL;
int n = nPage;
while (n >= 0) {
pValue = numberTree.LookupValue(n);
if (pValue != NULL) {
break;
}
n--;
}
if (pValue != NULL) {
pValue = pValue->GetDirect();
if (pValue->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pLabel = (CPDF_Dictionary*)pValue;
if (pLabel->KeyExist(FX_BSTRC("P"))) {
wsLabel += pLabel->GetUnicodeText(FX_BSTRC("P"));
}
CFX_ByteString bsNumberingStyle = pLabel->GetString(FX_BSTRC("S"), NULL);
int nLabelNum = nPage - n + pLabel->GetInteger(FX_BSTRC("St"), 1);
CFX_WideString wsNumPortion = _GetLabelNumPortion(nLabelNum, bsNumberingStyle);
wsLabel += wsNumPortion;
return wsLabel;
}
}
wsLabel.Format(L"%d", nPage + 1);
return wsLabel;
}
示例15: FindResFontSameCharset
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
CFX_ByteString& sFontAlias,
int32_t nCharset) {
if (!pResDict)
return nullptr;
CPDF_Dictionary* pFonts = pResDict->GetDictBy("Font");
if (!pFonts)
return nullptr;
CPDF_Document* pDocument = GetDocument();
CPDF_Font* pFind = nullptr;
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
if (!pObj)
continue;
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
if (pElement->GetStringBy("Type") != "Font")
continue;
CPDF_Font* pFont = pDocument->LoadFont(pElement);
if (!pFont)
continue;
const CFX_SubstFont* pSubst = pFont->GetSubstFont();
if (!pSubst)
continue;
if (pSubst->m_Charset == nCharset) {
sFontAlias = csKey;
pFind = pFont;
}
}
return pFind;
}