summaryrefslogtreecommitdiff
path: root/vcl/source/filter/ipdf/pdfdocument.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-03-27 15:39:04 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-03-27 15:31:13 +0000
commit2ba9d58d5978c94352c4c6cf9c47aa3de79d05fe (patch)
tree6a17246ed941468bdb59ba0f8642cbff50ad9251 /vcl/source/filter/ipdf/pdfdocument.cxx
parent4bb389319ec4510e16a519d229a452211112a04f (diff)
tdf#106693 vcl PDF export, norefxobj: handle multiple refs in copied dicts
When copying font definitions the dictionary has multiple values where the type is a reference. Improve PDFWriterImpl::copyExternalResource(), so that multiple references are copied correctly as well. With this the bugdoc (from comment 5) text appears in the output. Change-Id: I2343e616d8b36e3cdcbd4e713bd3f7fa7bce6d3b Reviewed-on: https://gerrit.libreoffice.org/35760 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl/source/filter/ipdf/pdfdocument.cxx')
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx29
1 files changed, 25 insertions, 4 deletions
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 926ebb0500fd..1a85c4f3fd5e 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -1933,7 +1933,7 @@ bool PDFNumberElement::Read(SvStream& rStream)
return false;
}
if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-'
- && ch != '.')
+ && ch != '.')
{
rStream.SeekRel(-1);
return false;
@@ -1941,7 +1941,7 @@ bool PDFNumberElement::Read(SvStream& rStream)
while (!rStream.IsEof())
{
if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-'
- && ch != '.')
+ && ch != '.')
{
rStream.SeekRel(-1);
m_nLength = rStream.Tell() - m_nOffset;
@@ -2446,8 +2446,10 @@ sal_uInt64 PDFObjectElement::GetArrayLength()
return m_nArrayLength;
}
-PDFDictionaryElement* PDFObjectElement::GetDictionary() const
+PDFDictionaryElement* PDFObjectElement::GetDictionary()
{
+ if (m_aDictionary.empty())
+ PDFDictionaryElement::Parse(m_rDoc.GetElements(), this, m_aDictionary);
return m_pDictionaryElement;
}
@@ -2456,6 +2458,25 @@ void PDFObjectElement::SetDictionary(PDFDictionaryElement* pDictionaryElement)
m_pDictionaryElement = pDictionaryElement;
}
+std::vector< std::pair<OString, PDFElement*> > PDFObjectElement::GetDictionaryItemsByOffset()
+{
+ std::vector< std::pair<OString, PDFElement*> > aRet;
+
+ for (const auto& rItem : m_aDictionary)
+ aRet.push_back(rItem);
+
+ PDFDictionaryElement* pDictionary = GetDictionary();
+ if (!pDictionary)
+ return aRet;
+
+ std::sort(aRet.begin(), aRet.end(), [pDictionary](const std::pair<OString, PDFElement*>& a, const std::pair<OString, PDFElement*>& b) -> bool
+ {
+ return pDictionary->GetKeyOffset(a.first) < pDictionary->GetKeyOffset(b.first);
+ });
+
+ return aRet;
+}
+
const std::map<OString, PDFElement*>& PDFObjectElement::GetDictionaryItems() const
{
return m_aDictionary;
@@ -2841,7 +2862,7 @@ bool PDFNameElement::Read(SvStream& rStream)
while (!rStream.IsEof())
{
if (rtl::isAsciiWhiteSpace(static_cast<unsigned char>(ch)) || ch == '/'
- || ch == '[' || ch == ']' || ch == '<' || ch == '>' || ch == '(')
+ || ch == '[' || ch == ']' || ch == '<' || ch == '>' || ch == '(')
{
rStream.SeekRel(-1);
m_aValue = aBuf.makeStringAndClear();