Finishing of actions

This commit is contained in:
Jakub Melka
2019-11-24 15:43:27 +01:00
parent 18ac9166c0
commit a857e061b8
7 changed files with 339 additions and 4 deletions

View File

@ -71,6 +71,23 @@ void PDFOutlineItem::parseImpl(const PDFDocument* document,
currentOutlineItem->setTitle(PDFEncoding::convertTextString(titleObject.getString()));
}
currentOutlineItem->setAction(PDFAction::parse(document, dictionary->get("A")));
if (!currentOutlineItem->getAction() && dictionary->hasKey("Dest"))
{
currentOutlineItem->setAction(PDFActionPtr(new PDFActionGoTo(PDFDestination::parse(document, dictionary->get("Dest")))));
}
PDFDocumentDataLoaderDecorator loader(document);
std::vector<PDFReal> colors = loader.readNumberArrayFromDictionary(dictionary, "C", { 0.0, 0.0, 0.0 });
colors.resize(3, 0.0);
currentOutlineItem->setTextColor(QColor::fromRgbF(colors[0], colors[1], colors[2]));
PDFInteger flag = loader.readIntegerFromDictionary(dictionary, "F", 0);
currentOutlineItem->setFontItalics(flag & 0x1);
currentOutlineItem->setFontBold(flag & 0x2);
PDFObject structureElementObject = dictionary->get("SE");
if (structureElementObject.isReference())
{
currentOutlineItem->setStructureElement(structureElementObject.getReference());
}
// Parse children of this item
const PDFObject& firstItem = dictionary->get("First");
@ -97,6 +114,46 @@ void PDFOutlineItem::parseImpl(const PDFDocument* document,
}
}
PDFObjectReference PDFOutlineItem::getStructureElement() const
{
return m_structureElement;
}
void PDFOutlineItem::setStructureElement(PDFObjectReference structureElement)
{
m_structureElement = structureElement;
}
bool PDFOutlineItem::isFontBold() const
{
return m_fontBold;
}
void PDFOutlineItem::setFontBold(bool fontBold)
{
m_fontBold = fontBold;
}
bool PDFOutlineItem::isFontItalics() const
{
return m_fontItalics;
}
void PDFOutlineItem::setFontItalics(bool fontItalics)
{
m_fontItalics = fontItalics;
}
QColor PDFOutlineItem::getTextColor() const
{
return m_textColor;
}
void PDFOutlineItem::setTextColor(const QColor& textColor)
{
m_textColor = textColor;
}
const PDFAction* PDFOutlineItem::getAction() const
{
return m_action.get();