summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx16
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx2
2 files changed, 15 insertions, 3 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c5078143874c..31daa05a73bd 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10080,6 +10080,16 @@ const char* PDFWriterImpl::getStructureTag( PDFWriter::StructElement eType )
return it != aTagStrings.end() ? it->second : "Div";
}
+void PDFWriterImpl::addRoleMap(OString aAlias, PDFWriter::StructElement eType)
+{
+ OString aTag = getStructureTag(eType);
+ // For PDF/UA it's not allowed to map an alias with the same name.
+ // Not sure if this allowed, necessary or recommended otherwise, so
+ // only enable filtering when PDF/UA is enabled.
+ if (!m_bIsPDF_UA || aAlias != aTag)
+ m_aRoleMap[aAlias] = aTag;
+}
+
void PDFWriterImpl::beginStructureElementMCSeq()
{
if( m_bEmitStructure &&
@@ -10209,7 +10219,7 @@ sal_Int32 PDFWriterImpl::beginStructureElement( PDFWriter::StructElement eType,
appendName( rAlias, aNameBuf );
OString aAliasName( aNameBuf.makeStringAndClear() );
rEle.m_aAlias = aAliasName;
- m_aRoleMap[ aAliasName ] = getStructureTag( eType );
+ addRoleMap(aAliasName, eType);
}
if (g_bDebugDisableCompression)
@@ -10331,8 +10341,8 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle )
std::list< sal_Int32 > aNewChildren;
// add Div in RoleMap, in case no one else did (TODO: is it needed? Is it dangerous?)
- OString aAliasName( "Div" );
- m_aRoleMap[ aAliasName ] = getStructureTag( PDFWriter::Division );
+ OString aAliasName("Div");
+ addRoleMap(aAliasName, PDFWriter::Division);
while( rEle.m_aKids.size() > ncMaxPDFArraySize )
{
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index cccd38fe161f..82afd47e850e 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -759,6 +759,8 @@ i12626
/* the buffer where the data are encrypted, dynamically allocated */
std::vector<sal_uInt8> m_vEncryptionBuffer;
+ void addRoleMap(OString aAlias, PDFWriter::StructElement eType);
+
/* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */
void checkAndEnableStreamEncryption( sal_Int32 nObject );