Finishing of outline items

This commit is contained in:
Jakub Melka
2019-11-30 16:26:32 +01:00
parent 39059c645e
commit 5954b7f409
21 changed files with 702 additions and 21 deletions

View File

@ -39,6 +39,13 @@ void PDFAction::apply(const std::function<void (const PDFAction*)>& callback)
}
}
std::vector<const PDFAction*> PDFAction::getActionList() const
{
std::vector<const PDFAction*> result;
fillActionList(result);
return result;
}
PDFActionPtr PDFAction::parseImpl(const PDFDocument* document, PDFObject object, std::set<PDFObjectReference>& usedReferences)
{
if (object.isReference())
@ -273,10 +280,37 @@ PDFActionPtr PDFAction::parseImpl(const PDFDocument* document, PDFObject object,
{
return PDFActionPtr(new PDFActionGoTo3DView(dictionary->get("TA"), dictionary->get("V")));
}
else if (name == "JavaScript")
{
QByteArray textJavaScript;
const PDFObject& javaScriptObject = document->getObject(dictionary->get("JS"));
if (javaScriptObject.isString())
{
textJavaScript = javaScriptObject.getString();
}
else if (javaScriptObject.isStream())
{
textJavaScript = document->getDecodedStream(javaScriptObject.getStream());
}
return PDFActionPtr(new PDFActionJavaScript(PDFEncoding::convertTextString(textJavaScript)));
}
return PDFActionPtr();
}
void PDFAction::fillActionList(std::vector<const PDFAction*>& actionList) const
{
actionList.push_back(this);
for (const PDFActionPtr& actionPointer : m_nextActions)
{
if (actionPointer)
{
actionPointer->fillActionList(actionList);
}
}
}
PDFDestination PDFDestination::parse(const PDFDocument* document, PDFObject object)
{
PDFDestination result;