summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-03-28 17:55:06 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-03-28 19:02:03 +0000
commitf86c3fd8e95f378061d57b77d1c700e076996086 (patch)
treed4030ef0c88cb798730eb8b9f2e90dc16275fcf8 /vcl
parent6152bf9ee9b2e348dee854921a5a5db1cfc72995 (diff)
vcl PDF export, norefxobj: have the list of keys to copy at one place
To avoid repeting ourselves. Change-Id: I39667620b9cf391251327c8f66ad8b9649ead36f Reviewed-on: https://gerrit.libreoffice.org/35810 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 4b8b9542b46a..3b3a6d706a6d 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11078,11 +11078,6 @@ void PDFWriterImpl::writeReferenceXObject(ReferenceXObjectEmit& rEmit)
return;
}
- OString sColorSpaces = copyExternalResources(*pPage, "ColorSpace");
- OString sExtGStates = copyExternalResources(*pPage, "ExtGState");
- OString sFonts = copyExternalResources(*pPage, "Font");
- OString sXObjects = copyExternalResources(*pPage, "XObject");
-
filter::PDFObjectElement* pPageContents = pPage->LookupObject("Contents");
if (!pPageContents)
{
@@ -11093,8 +11088,6 @@ void PDFWriterImpl::writeReferenceXObject(ReferenceXObjectEmit& rEmit)
nWrappedFormObject = createObject();
// Write the form XObject wrapped below. This is a separate object from
// the wrapper, this way there is no need to alter the stream contents.
- if (!updateObject(nWrappedFormObject))
- return;
OStringBuffer aLine;
aLine.append(nWrappedFormObject);
@@ -11102,10 +11095,15 @@ void PDFWriterImpl::writeReferenceXObject(ReferenceXObjectEmit& rEmit)
aLine.append("<< /Type /XObject");
aLine.append(" /Subtype /Form");
aLine.append(" /Resources <<");
- aLine.append(sColorSpaces);
- aLine.append(sExtGStates);
- aLine.append(sFonts);
- aLine.append(sXObjects);
+ static const std::initializer_list<OString> aKeys =
+ {
+ "ColorSpace",
+ "ExtGState",
+ "Font",
+ "XObject"
+ };
+ for (const auto& rKey : aKeys)
+ aLine.append(copyExternalResources(*pPage, rKey));
aLine.append(">>");
aLine.append(" /BBox [ 0 0 ");
aLine.append(aSize.Width());
@@ -11137,6 +11135,8 @@ void PDFWriterImpl::writeReferenceXObject(ReferenceXObjectEmit& rEmit)
// Copy the original page stream to the form XObject stream.
aLine.append(static_cast<const sal_Char*>(rPageStream.GetData()), rPageStream.GetSize());
aLine.append("\nendstream\nendobj\n\n");
+ if (!updateObject(nWrappedFormObject))
+ return;
CHECK_RETURN2(writeBuffer(aLine.getStr(), aLine.getLength()));
}