diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-11-05 23:37:30 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-11-11 22:06:44 +0100 |
commit | 6ab5c9e99dccec23a80eb1980dc46986b8c5abca (patch) | |
tree | dbab291c905b90f35e8892260e8257152b431325 /vcl/source | |
parent | a56ee7d45d82ce9ce47dab3fd95577a28b6f4db3 (diff) |
pdf: use a common call to parse a object
Previously, only Lookup method called parsing correctly, taking
into account that the object is in its own stream and has its
own elements vector. Many other methods called parse with the
wrong - document element vector. This changes the code so that
a common method is called in all instances with the correct
elements vector as the input parameter.
Change-Id: I7092f7ce683f07065da15cfa548b06c019efeed4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105491
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/filter/ipdf/pdfdocument.cxx | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 7c085abe3324..7a0a7b4dce65 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -2693,7 +2693,7 @@ PDFElement* PDFDictionaryElement::LookupElement(const OString& rDictionaryKey) return PDFDictionaryElement::Lookup(m_aItems, rDictionaryKey); } -PDFElement* PDFObjectElement::Lookup(const OString& rDictionaryKey) +void PDFObjectElement::parseIfNecessary() { if (m_aDictionary.empty()) { @@ -2704,7 +2704,11 @@ PDFElement* PDFObjectElement::Lookup(const OString& rDictionaryKey) // Normal object: elements are stored as members of the document itself. PDFDictionaryElement::Parse(m_rDoc.GetElements(), this, m_aDictionary); } +} +PDFElement* PDFObjectElement::Lookup(const OString& rDictionaryKey) +{ + parseIfNecessary(); return PDFDictionaryElement::Lookup(m_aDictionary, rDictionaryKey); } @@ -2730,9 +2734,7 @@ void PDFObjectElement::SetDictionaryOffset(sal_uInt64 nDictionaryOffset) sal_uInt64 PDFObjectElement::GetDictionaryOffset() { - if (m_aDictionary.empty()) - PDFDictionaryElement::Parse(m_rDoc.GetElements(), this, m_aDictionary); - + parseIfNecessary(); return m_nDictionaryOffset; } @@ -2777,9 +2779,7 @@ void PDFObjectElement::SetDictionaryLength(sal_uInt64 nDictionaryLength) sal_uInt64 PDFObjectElement::GetDictionaryLength() { - if (m_aDictionary.empty()) - PDFDictionaryElement::Parse(m_rDoc.GetElements(), this, m_aDictionary); - + parseIfNecessary(); return m_nDictionaryLength; } @@ -2789,8 +2789,7 @@ sal_uInt64 PDFObjectElement::GetArrayLength() const { return m_nArrayLength; } PDFDictionaryElement* PDFObjectElement::GetDictionary() { - if (m_aDictionary.empty()) - PDFDictionaryElement::Parse(m_rDoc.GetElements(), this, m_aDictionary); + parseIfNecessary(); return m_pDictionaryElement; } @@ -2818,9 +2817,7 @@ void PDFObjectElement::AddDictionaryReference(PDFReferenceElement* pReference) const std::map<OString, PDFElement*>& PDFObjectElement::GetDictionaryItems() { - if (m_aDictionary.empty()) - PDFDictionaryElement::Parse(m_rDoc.GetElements(), this, m_aDictionary); - + parseIfNecessary(); return m_aDictionary; } |