nss: upgrade to release 3.73
[LibreOffice.git] / vcl / source / pdf / ResourceDict.cxx
blob3490da30b89933a52284cfe20484a0b5a2affc51
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
11 #include <pdf/ResourceDict.hxx>
13 namespace vcl::pdf
15 namespace
17 void appendResourceMap(OStringBuffer& rBuf, const char* pPrefix,
18 std::map<OString, sal_Int32> const& rList)
20 if (rList.empty())
21 return;
22 rBuf.append('/');
23 rBuf.append(pPrefix);
24 rBuf.append("<<");
25 int ni = 0;
26 for (auto const& item : rList)
28 if (!item.first.isEmpty() && item.second > 0)
30 rBuf.append('/');
31 rBuf.append(item.first);
32 rBuf.append(' ');
33 rBuf.append(item.second);
34 rBuf.append(" 0 R");
35 if (((++ni) & 7) == 0)
36 rBuf.append('\n');
39 rBuf.append(">>\n");
43 void ResourceDict::append(OStringBuffer& rBuf, sal_Int32 nFontDictObject)
45 rBuf.append("<</Font ");
46 rBuf.append(nFontDictObject);
47 rBuf.append(" 0 R\n");
48 appendResourceMap(rBuf, "XObject", m_aXObjects);
49 appendResourceMap(rBuf, "ExtGState", m_aExtGStates);
50 appendResourceMap(rBuf, "Shading", m_aShadings);
51 appendResourceMap(rBuf, "Pattern", m_aPatterns);
52 rBuf.append("/ProcSet[/PDF/Text");
53 if (!m_aXObjects.empty())
54 rBuf.append("/ImageC/ImageI/ImageB");
55 rBuf.append("]\n>>\n");
58 } // end vcl::pdf
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */