diff options
-rw-r--r-- | include/vcl/pdfwriter.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 22 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 17 |
3 files changed, 37 insertions, 3 deletions
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 2367326180ad..0fb7c2122090 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -176,6 +176,7 @@ enum class StructElement // Inline level elements Span, Quote, Note, Reference, BibEntry, Code, Link, Annot, Ruby, RB, RT, RP, Warichu, WT, WP, + Emphasis, Strong, // PDF 2.0 // Illustration elements Figure, Formula, Form diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 6864554b7393..4c7e4e43e36b 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -180,6 +180,8 @@ constexpr OUString aHeading = u"Heading"_ustr; constexpr OUString aQuotation = u"Quotation"_ustr; constexpr OUString aSourceText = u"Source Text"_ustr; constexpr OUString constTitleStyleName = u"Title"_ustr; +constexpr OUString constEmphasisStyleName = u"Emphasis"_ustr; +constexpr OUString constStrongEmphasisStyleName = u"Strong Emphasis"_ustr; // PDF Tag Names: constexpr OUStringLiteral aDocumentString = u"Document"; @@ -1921,6 +1923,26 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() --m_nEndStructureElement; } } + // Emphasis + else if (sStyleName == constEmphasisStyleName) + { + if (!isContinueSpan) + { + nPDFType = sal_uInt16(vcl::pdf::StructElement::Emphasis); + aPDFType = constEmphasisStyleName; + CreateCurrentSpan(rInf, sStyleName); + } + } + // Strong + else if (sStyleName == constStrongEmphasisStyleName) + { + if (!isContinueSpan) + { + nPDFType = sal_uInt16(vcl::pdf::StructElement::Strong); + aPDFType = constStrongEmphasisStyleName; + CreateCurrentSpan(rInf, sStyleName); + } + } // Check for Quote/Code character style: else if (sStyleName == aQuotation) { diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 5e48c2fa8877..7e048c4d6dd3 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10768,6 +10768,8 @@ const char* PDFWriterImpl::getStructureTag(vcl::pdf::StructElement eType) { StructElement::Formula, "Formula"}, { StructElement::Form, "Form" }, { StructElement::Title, "Title" }, + { StructElement::Emphasis, "Em" }, + { StructElement::Strong, "Strong" }, }); // First handle fallbacks for elements that were added in a certain PDF version @@ -10779,11 +10781,14 @@ const char* PDFWriterImpl::getStructureTag(vcl::pdf::StructElement eType) // PDF 2.0 fallbacks if (m_aContext.Version < PDFWriter::PDFVersion::PDF_2_0) { - switch(eType) + switch (eType) { case StructElement::Title: - eType = StructElement::Paragraph; - break; + eType = StructElement::Paragraph; break; + case StructElement::Emphasis: + eType = StructElement::Span; break; + case StructElement::Strong: + eType = StructElement::Span; break; default: break; } @@ -11378,6 +11383,8 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eType == vcl::pdf::StructElement::TableData || eType == vcl::pdf::StructElement::Span || eType == vcl::pdf::StructElement::Quote || + eType == vcl::pdf::StructElement::Emphasis || + eType == vcl::pdf::StructElement::Strong || eType == vcl::pdf::StructElement::Note || eType == vcl::pdf::StructElement::Reference || eType == vcl::pdf::StructElement::BibEntry || @@ -11414,6 +11421,8 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eType == vcl::pdf::StructElement::TableData || eType == vcl::pdf::StructElement::Span || eType == vcl::pdf::StructElement::Quote || + eType == vcl::pdf::StructElement::Emphasis || + eType == vcl::pdf::StructElement::Strong || eType == vcl::pdf::StructElement::Note || eType == vcl::pdf::StructElement::Reference || eType == vcl::pdf::StructElement::BibEntry || @@ -11613,6 +11622,8 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib eType == vcl::pdf::StructElement::TableData || eType == vcl::pdf::StructElement::Span || eType == vcl::pdf::StructElement::Quote || + eType == vcl::pdf::StructElement::Emphasis || + eType == vcl::pdf::StructElement::Strong || eType == vcl::pdf::StructElement::Note || eType == vcl::pdf::StructElement::Reference || eType == vcl::pdf::StructElement::BibEntry || |