[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Fri Nov 13 10:09:39 UTC 2020
vcl/source/gdi/pdfobjectcopier.cxx | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
New commits:
commit b62725ad8afa6fe9c426f968287b9e3528eb8268
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Nov 12 22:24:02 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Nov 13 11:08:57 2020 +0100
pdf: Improve dict and array format when copying with PDFObjectCopier
Change-Id: I4fcc4d912d4ce9d7800782b69811f877b85d9857
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105782
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/vcl/source/gdi/pdfobjectcopier.cxx b/vcl/source/gdi/pdfobjectcopier.cxx
index 4e5575c25952..0d67fe735561 100644
--- a/vcl/source/gdi/pdfobjectcopier.cxx
+++ b/vcl/source/gdi/pdfobjectcopier.cxx
@@ -100,17 +100,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())
@@ -127,10 +131,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");
}
@@ -138,8 +146,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