[Libreoffice-commits] core.git: vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 23 02:04:11 UTC 2020
vcl/source/gdi/pdfobjectcopier.cxx | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
New commits:
commit 92134462f19ff234ce7615df34cc1fff6502727a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Nov 12 22:24:02 2020 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Nov 23 03:03:31 2020 +0100
pdf: Improve dict and array format when copying with PDFObjectCopier
Change-Id: I4fcc4d912d4ce9d7800782b69811f877b85d9857
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105811
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/source/gdi/pdfobjectcopier.cxx b/vcl/source/gdi/pdfobjectcopier.cxx
index d6323a17e91c..596ed3a2587d 100644
--- a/vcl/source/gdi/pdfobjectcopier.cxx
+++ b/vcl/source/gdi/pdfobjectcopier.cxx
@@ -102,17 +102,21 @@ sal_Int32 PDFObjectCopier::copyExternalResource(SvMemoryStream& rDocBuffer,
if (rObject.GetDictionary())
{
aLine.append("<< ");
-
+ bool bFirst = true;
for (auto const& rPair : rObject.GetDictionaryItems())
{
+ if (bFirst)
+ bFirst = false;
+ else
+ aLine.append(" ");
+
aLine.append("/");
aLine.append(rPair.first);
aLine.append(" ");
copyRecursively(aLine, rPair.second, rDocBuffer, rCopiedResources);
- aLine.append(" ");
}
- aLine.append(">>\n");
+ aLine.append(" >>\n");
}
if (filter::PDFStreamElement* pStream = rObject.GetStream())
@@ -129,10 +133,14 @@ sal_Int32 PDFObjectCopier::copyExternalResource(SvMemoryStream& rDocBuffer,
const std::vector<filter::PDFElement*>& rElements = pArray->GetElements();
+ bool bFirst = true;
for (auto const& pElement : rElements)
{
+ if (bFirst)
+ bFirst = false;
+ else
+ aLine.append(" ");
copyRecursively(aLine, pElement, rDocBuffer, rCopiedResources);
- aLine.append(" ");
}
aLine.append("]\n");
}
@@ -140,8 +148,7 @@ sal_Int32 PDFObjectCopier::copyExternalResource(SvMemoryStream& rDocBuffer,
// If the object has a number element outside a dictionary or array, copy that.
if (filter::PDFNumberElement* pNumber = rObject.GetNumberElement())
{
- aLine.append(static_cast<const char*>(pObjectStream->GetData()) + pNumber->GetLocation(),
- pNumber->GetLength());
+ pNumber->writeString(aLine);
aLine.append("\n");
}
More information about the Libreoffice-commits
mailing list