dev/null |binary download.lst | 8 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx | 2 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 91 drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx | 4 drawinglayer/source/tools/primitive2dxmldump.cxx | 3 editeng/source/editeng/impedit3.cxx | 4 external/postgresql/0001-Assume-that-stdbool.h-conforms-to-the-C-standard.patch.1 | 429 --- external/postgresql/UnpackedTarball_postgresql.mk | 1 filter/source/pdf/impdialog.cxx | 134 - filter/source/pdf/impdialog.hxx | 11 filter/source/pdf/pdfexport.cxx | 6 filter/uiconfig/ui/pdfgeneralpage.ui | 331 +- include/drawinglayer/primitive2d/structuretagprimitive2d.hxx | 6 include/vcl/filter/PDFiumLibrary.hxx | 41 include/vcl/pdfextoutdevdata.hxx | 4 include/vcl/pdfwriter.hxx | 111 sc/qa/uitest/calc_tests4/exportToPDF.py | 2 sc/source/ui/inc/output.hxx | 2 sc/source/ui/unoobj/docuno.cxx | 2 sc/source/ui/view/output.cxx | 16 sc/source/ui/view/output2.cxx | 14 sc/source/ui/view/printfun.cxx | 10 sd/qa/uitest/impress_tests/exportToPDF.py | 2 svx/source/sdr/contact/viewobjectcontact.cxx | 22 svx/source/table/viewcontactoftableobj.cxx | 6 sw/inc/EnhancedPDFExportHelper.hxx | 6 sw/qa/extras/layout/data/tdf144450.fodt | 168 + sw/qa/extras/layout/layout5.cxx | 61 sw/qa/extras/ww8export/ww8export4.cxx | 6 sw/qa/uitest/writer_tests4/exportToPDF.py | 2 sw/source/core/text/EnhancedPDFExportHelper.cxx | 214 - sw/source/core/text/itrform2.cxx | 36 sw/source/core/text/porfld.cxx | 2 sw/source/uibase/docvw/AnnotationWin2.cxx | 2 sw/source/writerfilter/dmapper/DomainMapper.cxx | 10 vcl/Library_vcl.mk | 1 vcl/inc/pdf/COSWriter.hxx | 173 + vcl/inc/pdf/EncryptionHashTransporter.hxx | 29 vcl/inc/pdf/IPDFEncryptor.hxx | 7 vcl/inc/pdf/PDFEncryptor.hxx | 1 vcl/inc/pdf/PDFEncryptorR6.hxx | 57 vcl/inc/pdf/ResourceDict.hxx | 3 vcl/inc/pdf/XmpMetadata.hxx | 10 vcl/inc/pdf/pdfwriter_impl.hxx | 23 vcl/qa/cppunit/PDFiumLibraryTest.cxx | 145 + vcl/qa/cppunit/data/StructureTreeExampleDocument.odt |binary vcl/qa/cppunit/data/StructureTreeExampleDocument.pdf |binary vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx | 211 + vcl/qa/cppunit/pdfexport/data/SimpleTestDocument.fodt | 350 ++ vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 84 vcl/source/filter/ipdf/pdfdocument.cxx | 8 vcl/source/gdi/pdfextoutdevdata.cxx | 9 vcl/source/gdi/pdfwriter.cxx | 2 vcl/source/gdi/pdfwriter_impl.cxx | 1299 ++++------ vcl/source/pdf/COSWriter.cxx | 194 + vcl/source/pdf/PDFEncryptionInitialization.cxx | 1 vcl/source/pdf/PDFEncryptor.cxx | 25 vcl/source/pdf/PDFEncryptorR6.cxx | 137 + vcl/source/pdf/PDFiumLibrary.cxx | 405 ++- vcl/source/pdf/ResourceDict.cxx | 24 vcl/source/pdf/XmpMetadata.cxx | 32 62 files changed, 3215 insertions(+), 1784 deletions(-)
New commits: commit 35186cd3639eb9d38c30c4c1505a85ce408a040f Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Jan 10 23:26:03 2025 +0900 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 15 11:57:42 2025 +0100 pdfium: add support for reading the structure tree + add test for reading the tree Change-Id: I2f0e9d1852d20b3aa20ec0bcdd3ebc65370d15dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180124 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index 28fc9a0f2606..1f20beab475f 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -183,6 +183,34 @@ public: virtual basegfx::B2DRectangle getCharBox(int nIndex, double fPageHeight) = 0; }; +class VCL_DLLPUBLIC PDFiumStructureElement +{ +public: + virtual ~PDFiumStructureElement() = default; + + virtual OUString getAltText() = 0; + virtual OUString getActualText() = 0; + virtual OUString getID() = 0; + virtual OUString getLang() = 0; + virtual OUString getTitle() = 0; + virtual OUString getType() = 0; + virtual OUString getObjectType() = 0; + + virtual int getNumberOfChildren() = 0; + virtual int getChildMarkedContentID(int nIndex) = 0; + virtual std::unique_ptr<PDFiumStructureElement> getChild(int nIndex) = 0; + virtual std::unique_ptr<PDFiumStructureElement> getParent() = 0; +}; + +class VCL_DLLPUBLIC PDFiumStructureTree +{ +public: + virtual ~PDFiumStructureTree() = default; + + virtual int getNumberOfChildren() = 0; + virtual std::unique_ptr<PDFiumStructureElement> getChild(int nIndex) = 0; +}; + class VCL_DLLPUBLIC PDFiumPage { public: @@ -197,6 +225,7 @@ public: virtual std::unique_ptr<PDFiumAnnotation> getAnnotation(int nIndex) = 0; virtual std::unique_ptr<PDFiumTextPage> getTextPage() = 0; + virtual std::unique_ptr<PDFiumStructureTree> getStructureTree() = 0; /// Get bitmap checksum of the page, without annotations/commenting. virtual BitmapChecksum getChecksum(int nMDPPerm) = 0; diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx index a15fb52a37e2..c1ace4a1568c 100644 --- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx +++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx @@ -486,6 +486,151 @@ CPPUNIT_TEST_FIXTURE(PDFiumLibraryTest, testTools) CPPUNIT_ASSERT_EQUAL(false, bool(aDateTime.IsUTC)); } +CPPUNIT_TEST_FIXTURE(PDFiumLibraryTest, testStructureTree) +{ + OUString aURL = getFullUrl(u"StructureTreeExampleDocument.pdf"); + SvFileStream aStream(aURL, StreamMode::READ); + GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); + Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); + auto pVectorGraphicData = aGraphic.getVectorGraphicData(); + CPPUNIT_ASSERT(pVectorGraphicData); + CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf, pVectorGraphicData->getType()); + auto& rDataContainer = pVectorGraphicData->getBinaryDataContainer(); + + auto pPdfium = vcl::pdf::PDFiumLibrary::get(); + CPPUNIT_ASSERT(pPdfium); + + auto pDocument + = pPdfium->openDocument(rDataContainer.getData(), rDataContainer.getSize(), OString()); + CPPUNIT_ASSERT(pDocument); + + CPPUNIT_ASSERT_EQUAL(1, pDocument->getPageCount()); + + auto pPage = pDocument->openPage(0); + CPPUNIT_ASSERT(pPage); + + auto pTree = pPage->getStructureTree(); + CPPUNIT_ASSERT(pTree); + CPPUNIT_ASSERT_EQUAL(1, pTree->getNumberOfChildren()); + + // Check the structure + { + auto pChildDocument = pTree->getChild(0); + CPPUNIT_ASSERT(pChildDocument); + CPPUNIT_ASSERT_EQUAL(5, pChildDocument->getNumberOfChildren()); + + CPPUNIT_ASSERT_EQUAL(u""_ustr, pChildDocument->getAltText()); + CPPUNIT_ASSERT_EQUAL(u""_ustr, pChildDocument->getActualText()); + CPPUNIT_ASSERT_EQUAL(u""_ustr, pChildDocument->getID()); + CPPUNIT_ASSERT_EQUAL(u""_ustr, pChildDocument->getLang()); + CPPUNIT_ASSERT_EQUAL(u""_ustr, pChildDocument->getTitle()); + CPPUNIT_ASSERT_EQUAL(u"Document"_ustr, pChildDocument->getType()); + CPPUNIT_ASSERT_EQUAL(u"StructElem"_ustr, pChildDocument->getObjectType()); + + { + auto pThis = pChildDocument->getChild(0); + CPPUNIT_ASSERT(pThis); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pThis->getType()); + CPPUNIT_ASSERT_EQUAL(1, pThis->getNumberOfChildren()); + CPPUNIT_ASSERT_EQUAL(0, pThis->getChildMarkedContentID(0)); + } + + { + auto pThis = pChildDocument->getChild(1); + CPPUNIT_ASSERT(pThis); + CPPUNIT_ASSERT_EQUAL(u"H1"_ustr, pThis->getType()); + CPPUNIT_ASSERT_EQUAL(2, pThis->getNumberOfChildren()); + CPPUNIT_ASSERT_EQUAL(1, pThis->getChildMarkedContentID(0)); + CPPUNIT_ASSERT_EQUAL(2, pThis->getChildMarkedContentID(1)); + } + + { + auto pThis = pChildDocument->getChild(2); + CPPUNIT_ASSERT(pThis); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pThis->getType()); + CPPUNIT_ASSERT_EQUAL(13, pThis->getNumberOfChildren()); + CPPUNIT_ASSERT_EQUAL(3, pThis->getChildMarkedContentID(0)); + { + auto pChild = pThis->getChild(1); + CPPUNIT_ASSERT_EQUAL(u"Code"_ustr, pChild->getType()); + CPPUNIT_ASSERT_EQUAL(4, pChild->getChildMarkedContentID(0)); + + // Check getParent + auto pThis2 = pChild->getParent(); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pThis2->getType()); + CPPUNIT_ASSERT_EQUAL(13, pThis2->getNumberOfChildren()); + } + CPPUNIT_ASSERT_EQUAL(5, pThis->getChildMarkedContentID(2)); + CPPUNIT_ASSERT_EQUAL(6, pThis->getChildMarkedContentID(3)); + { + auto pChild = pThis->getChild(4); + CPPUNIT_ASSERT_EQUAL(u"Span"_ustr, pChild->getType()); + CPPUNIT_ASSERT_EQUAL(7, pChild->getChildMarkedContentID(0)); + } + CPPUNIT_ASSERT_EQUAL(8, pThis->getChildMarkedContentID(5)); + CPPUNIT_ASSERT_EQUAL(9, pThis->getChildMarkedContentID(6)); + { + auto pChild = pThis->getChild(7); + CPPUNIT_ASSERT_EQUAL(u"Span"_ustr, pChild->getType()); + CPPUNIT_ASSERT_EQUAL(10, pChild->getChildMarkedContentID(0)); + } + CPPUNIT_ASSERT_EQUAL(11, pThis->getChildMarkedContentID(8)); + CPPUNIT_ASSERT_EQUAL(12, pThis->getChildMarkedContentID(9)); + { + auto pChild = pThis->getChild(10); + CPPUNIT_ASSERT_EQUAL(u"Span"_ustr, pChild->getType()); + CPPUNIT_ASSERT_EQUAL(13, pChild->getChildMarkedContentID(0)); + } + CPPUNIT_ASSERT_EQUAL(14, pThis->getChildMarkedContentID(11)); + { + auto pChild = pThis->getChild(12); + CPPUNIT_ASSERT_EQUAL(u"Span"_ustr, pChild->getType()); + CPPUNIT_ASSERT_EQUAL(15, pChild->getChildMarkedContentID(0)); + } + } + + { + auto pThis = pChildDocument->getChild(3); + CPPUNIT_ASSERT(pThis); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pThis->getType()); + CPPUNIT_ASSERT_EQUAL(4, pThis->getNumberOfChildren()); + CPPUNIT_ASSERT_EQUAL(16, pThis->getChildMarkedContentID(0)); + { + auto pChild = pThis->getChild(1); + CPPUNIT_ASSERT_EQUAL(u"Quote"_ustr, pChild->getType()); + CPPUNIT_ASSERT_EQUAL(17, pChild->getChildMarkedContentID(0)); + } + CPPUNIT_ASSERT_EQUAL(18, pThis->getChildMarkedContentID(2)); + { + auto pChild = pThis->getChild(3); + // Rectangle + CPPUNIT_ASSERT_EQUAL(u"Div"_ustr, pChild->getType()); + CPPUNIT_ASSERT_EQUAL(u"Only Text! - The Alt Text!"_ustr, pChild->getAltText()); + CPPUNIT_ASSERT_EQUAL(20, pChild->getChildMarkedContentID(0)); + { + // Text in rectangle + auto pRectangleElement = pChild->getChild(1); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pRectangleElement->getType()); + CPPUNIT_ASSERT_EQUAL(21, pRectangleElement->getChildMarkedContentID(0)); + } + } + } + + { + auto pThis = pChildDocument->getChild(4); + CPPUNIT_ASSERT(pThis); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pThis->getType()); + CPPUNIT_ASSERT_EQUAL(1, pThis->getNumberOfChildren()); + CPPUNIT_ASSERT_EQUAL(19, pThis->getChildMarkedContentID(0)); + } + + { + auto pThis = pChildDocument->getChild(5); + CPPUNIT_ASSERT(!pThis); + } + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/data/StructureTreeExampleDocument.odt b/vcl/qa/cppunit/data/StructureTreeExampleDocument.odt new file mode 100644 index 000000000000..18631b2df570 Binary files /dev/null and b/vcl/qa/cppunit/data/StructureTreeExampleDocument.odt differ diff --git a/vcl/qa/cppunit/data/StructureTreeExampleDocument.pdf b/vcl/qa/cppunit/data/StructureTreeExampleDocument.pdf new file mode 100644 index 000000000000..a89fb067060a Binary files /dev/null and b/vcl/qa/cppunit/data/StructureTreeExampleDocument.pdf differ diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 6b03bcc6ce53..9c13d5555aae 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -21,6 +21,7 @@ #include <fpdf_signature.h> #include <fpdf_formfill.h> #include <fpdf_attachment.h> +#include <fpdf_structtree.h> #include <osl/endian.h> #include <vcl/bitmap.hxx> @@ -338,6 +339,47 @@ public: int getOptionCount(PDFiumDocument* pDoc) override; }; +class PDFiumStructureElementImpl final : public PDFiumStructureElement +{ +private: + FPDF_STRUCTELEMENT mpStructureElement; + + PDFiumStructureElementImpl(const PDFiumStructureElementImpl&) = delete; + PDFiumStructureElementImpl& operator=(const PDFiumStructureElementImpl&) = delete; + +public: + PDFiumStructureElementImpl(FPDF_STRUCTELEMENT pStructureElement); + + OUString getAltText() override; + OUString getActualText() override; + OUString getID() override; + OUString getLang() override; + OUString getTitle() override; + OUString getType() override; + OUString getObjectType() override; + + int getNumberOfChildren() override; + int getChildMarkedContentID(int nIndex) override; + std::unique_ptr<PDFiumStructureElement> getChild(int nIndex) override; + std::unique_ptr<PDFiumStructureElement> getParent() override; +}; + +class PDFiumStructureTreeImpl final : public PDFiumStructureTree +{ +private: + FPDF_STRUCTTREE mpStructureTree; + + PDFiumStructureTreeImpl(const PDFiumStructureTreeImpl&) = delete; + PDFiumStructureTreeImpl& operator=(const PDFiumStructureTreeImpl&) = delete; + +public: + PDFiumStructureTreeImpl(FPDF_STRUCTTREE pStructureTree); + ~PDFiumStructureTreeImpl(); + + int getNumberOfChildren() override; + std::unique_ptr<PDFiumStructureElement> getChild(int nIndex) override; +}; + class PDFiumPageObjectImpl final : public PDFiumPageObject { private: @@ -463,6 +505,8 @@ public: std::unique_ptr<PDFiumTextPage> getTextPage() override; + std::unique_ptr<PDFiumStructureTree> getStructureTree() override; + BitmapChecksum getChecksum(int nMDPPerm) override; double getWidth() override; @@ -962,6 +1006,17 @@ std::unique_ptr<PDFiumTextPage> PDFiumPageImpl::getTextPage() return pPDFiumTextPage; } +std::unique_ptr<PDFiumStructureTree> PDFiumPageImpl::getStructureTree() +{ + std::unique_ptr<PDFiumStructureTree> pPDFiumStructureTree; + FPDF_STRUCTTREE pStructTree = FPDF_StructTree_GetForPage(mpPage); + if (pStructTree) + { + pPDFiumStructureTree = std::make_unique<PDFiumStructureTreeImpl>(pStructTree); + } + return pPDFiumStructureTree; +} + bool PDFiumPageImpl::hasLinks() { // This could be a full iterator, but at the moment we just determine if the list is empty or @@ -1598,6 +1653,119 @@ std::unique_ptr<PDFiumPageObject> PDFiumAnnotationImpl::getObject(int nIndex) return pPDFiumPageObject; } +PDFiumStructureElementImpl::PDFiumStructureElementImpl(FPDF_STRUCTELEMENT pStructureElement) + : mpStructureElement(pStructureElement) +{ +} + +OUString PDFiumStructureElementImpl::getAltText() +{ + return getUnicodeString([this](FPDF_WCHAR* buffer, unsigned long length) { + return FPDF_StructElement_GetAltText(mpStructureElement, buffer, length); + }); +} + +OUString PDFiumStructureElementImpl::getActualText() +{ + return getUnicodeString([this](FPDF_WCHAR* buffer, unsigned long length) { + return FPDF_StructElement_GetActualText(mpStructureElement, buffer, length); + }); +} + +OUString PDFiumStructureElementImpl::getID() +{ + return getUnicodeString([this](FPDF_WCHAR* buffer, unsigned long length) { + return FPDF_StructElement_GetID(mpStructureElement, buffer, length); + }); +} + +OUString PDFiumStructureElementImpl::getLang() +{ + return getUnicodeString([this](FPDF_WCHAR* buffer, unsigned long length) { + return FPDF_StructElement_GetLang(mpStructureElement, buffer, length); + }); +} + +OUString PDFiumStructureElementImpl::getType() +{ + return getUnicodeString([this](FPDF_WCHAR* buffer, unsigned long length) { + return FPDF_StructElement_GetType(mpStructureElement, buffer, length); + }); +} + +OUString PDFiumStructureElementImpl::getObjectType() +{ + return getUnicodeString([this](FPDF_WCHAR* buffer, unsigned long length) { + return FPDF_StructElement_GetObjType(mpStructureElement, buffer, length); + }); +} + +int PDFiumStructureElementImpl::getChildMarkedContentID(int nIndex) +{ + return FPDF_StructElement_GetChildMarkedContentID(mpStructureElement, nIndex); +} + +OUString PDFiumStructureElementImpl::getTitle() +{ + return getUnicodeString([this](FPDF_WCHAR* buffer, unsigned long length) { + return FPDF_StructElement_GetTitle(mpStructureElement, buffer, length); + }); +} + +int PDFiumStructureElementImpl::getNumberOfChildren() +{ + return FPDF_StructElement_CountChildren(mpStructureElement); +} + +std::unique_ptr<PDFiumStructureElement> PDFiumStructureElementImpl::getChild(int nIndex) +{ + std::unique_ptr<PDFiumStructureElement> pPDFiumStructureElement; + FPDF_STRUCTELEMENT pElement = FPDF_StructElement_GetChildAtIndex(mpStructureElement, nIndex); + if (pElement) + { + pPDFiumStructureElement = std::make_unique<PDFiumStructureElementImpl>(pElement); + } + return pPDFiumStructureElement; +} + +std::unique_ptr<PDFiumStructureElement> PDFiumStructureElementImpl::getParent() +{ + std::unique_ptr<PDFiumStructureElement> pPDFiumStructureElement; + FPDF_STRUCTELEMENT pElement = FPDF_StructElement_GetParent(mpStructureElement); + if (pElement) + { + pPDFiumStructureElement = std::make_unique<PDFiumStructureElementImpl>(pElement); + } + return pPDFiumStructureElement; +} + +PDFiumStructureTreeImpl::PDFiumStructureTreeImpl(FPDF_STRUCTTREE pStructureTree) + : mpStructureTree(pStructureTree) +{ +} + +PDFiumStructureTreeImpl::~PDFiumStructureTreeImpl() +{ + if (mpStructureTree) + FPDF_StructTree_Close(mpStructureTree); +} + +int PDFiumStructureTreeImpl::getNumberOfChildren() +{ + return FPDF_StructTree_CountChildren(mpStructureTree); +} + +std::unique_ptr<PDFiumStructureElement> PDFiumStructureTreeImpl::getChild(int nIndex) +{ + std::unique_ptr<PDFiumStructureElement> pPDFiumStructureElement; + FPDF_STRUCTELEMENT pElement = FPDF_StructTree_GetChildAtIndex(mpStructureTree, nIndex); + if (pElement) + { + pPDFiumStructureElement = std::make_unique<PDFiumStructureElementImpl>(pElement); + } + return pPDFiumStructureElement; +} + PDFiumTextPageImpl::PDFiumTextPageImpl(FPDF_TEXTPAGE pTextPage) : mpTextPage(pTextPage) { commit bee60b809a4767d4c9daf047909ad53f1d24f1aa Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Jan 10 14:24:11 2025 +0900 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 15 11:57:20 2025 +0100 pdf: add PDF 2.0 support for /Em and /Strongstructure element Add support to PDF export to handle /Em (Emphasis) and /Strong structure element and fallback to /Span if the PDF version is not PDF 2.0. Use /Em if "Emphasis" char style is used and /Strong if "Strong Emphasis" char style is used. Change-Id: I33d572748592bb20c7daf55716d1f2cc3e6bd989 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180123 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> 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 a648f9db6569..85464d7fb127 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10839,6 +10839,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 @@ -10850,11 +10852,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; } @@ -11449,6 +11454,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 || @@ -11485,6 +11492,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 || @@ -11684,6 +11693,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 || commit 9ec3778d9048942a9fedaeece638c5502e0f49a4 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Jan 10 13:19:09 2025 +0900 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 15 11:57:06 2025 +0100 pdf: add PDF 2.0 support for /Title structure element Add support to PDF export to handle /Title structure element and fallback to /P (paragraph) if the PDF version is not PDF 2.0. Then add /Title structure element in writer if the style name of the paragraph is "Title". Change-Id: Ia8faab09bf3c97423d154deb7f1eb69860ce857a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180122 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index a3af7b1b812f..b39341f72612 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -2631,6 +2631,7 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( case vcl::pdf::StructElement::H6: case vcl::pdf::StructElement::Paragraph: case vcl::pdf::StructElement::Heading: + case vcl::pdf::StructElement::Title: case vcl::pdf::StructElement::Caption: case vcl::pdf::StructElement::BlockQuote: case vcl::pdf::StructElement::Table: diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 9a6a1dcce76d..2367326180ad 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -154,26 +154,30 @@ struct PDFEncryptionProperties namespace pdf { -// for a definition of structural element types please refer to -// PDF Reference, 3rd ed. section 9.7.4 +// For a definition of structural element types please refer to +// PDF Reference, 3rd ed. section 9.7.4. +// +// In PDF 2.0 specification (ISO 32000-2) refer to section 14.8.4 enum class StructElement { - // special element to place outside the structure hierarchy + // Special element to place outside the structure hierarchy NonStructElement, + // Grouping elements Document, Part, Article, Section, Division, BlockQuote, Caption, TOC, TOCI, Index, - // block level elements + // Block level elements Paragraph, Heading, H1, H2, H3, H4, H5, H6, List, ListItem, LILabel, LIBody, Table, TableRow, TableHeader, TableData, + Title, // PDF 2.0 - // inline level elements + // Inline level elements Span, Quote, Note, Reference, BibEntry, Code, Link, Annot, Ruby, RB, RT, RP, Warichu, WT, WP, - // illustration elements + // Illustration elements Figure, Formula, Form }; diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 0f135c311ae1..6864554b7393 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -179,6 +179,7 @@ constexpr OUString aCaption = u"Caption"_ustr; 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; // PDF Tag Names: constexpr OUStringLiteral aDocumentString = u"Document"; @@ -722,7 +723,7 @@ void SwTaggedPDFHelper::SetAttributes(vcl::pdf::StructElement eType) case vcl::pdf::StructElement::Paragraph: case vcl::pdf::StructElement::Heading: case vcl::pdf::StructElement::BlockQuote: - + case vcl::pdf::StructElement::Title: bPlacement = bWritingMode = bSpaceBefore = @@ -1456,6 +1457,14 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() nPDFType = sal_uInt16(vcl::pdf::StructElement::Paragraph); aPDFType = sStyleName; + // Title + + if (sStyleName == constTitleStyleName) + { + nPDFType = sal_uInt16(vcl::pdf::StructElement::Title); + aPDFType = constTitleStyleName; + } + // Quotations: BlockQuote if (sStyleName == aQuotations) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 9cc331bde1e6..a648f9db6569 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10788,7 +10788,7 @@ void PDFWriterImpl::setOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID ) m_aOutline[nItem].m_nDestID = nDestID; } -const char* PDFWriterImpl::getStructureTag(vcl::pdf::StructElement eType ) +const char* PDFWriterImpl::getStructureTag(vcl::pdf::StructElement eType) { using namespace vcl::pdf; @@ -10837,15 +10837,35 @@ const char* PDFWriterImpl::getStructureTag(vcl::pdf::StructElement eType ) { StructElement::WP, "WP" }, { StructElement::Figure, "Figure" }, { StructElement::Formula, "Formula"}, - { StructElement::Form, "Form" } + { StructElement::Form, "Form" }, + { StructElement::Title, "Title" }, }); + // First handle fallbacks for elements that were added in a certain PDF version + + // PDF 1.5 fallbacks if (m_aContext.Version < PDFWriter::PDFVersion::PDF_1_5 && eType == StructElement::Annot) - return "Figure"; // fallback + eType = StructElement::Figure; + + // PDF 2.0 fallbacks + if (m_aContext.Version < PDFWriter::PDFVersion::PDF_2_0) + { + switch(eType) + { + case StructElement::Title: + eType = StructElement::Paragraph; + break; + default: + break; + } + } auto iterator = constTagStrings.find(eType); - return iterator != constTagStrings.end() ? iterator->second : "Div"; + if (iterator == constTagStrings.end()) + return "Div"; + + return iterator->second; } void PDFWriterImpl::addRoleMap(const OString& aAlias, vcl::pdf::StructElement eType) @@ -11344,6 +11364,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eVal == PDFWriter::Justify ) { if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Title || eType == vcl::pdf::StructElement::Heading || eType == vcl::pdf::StructElement::H1 || eType == vcl::pdf::StructElement::H2 || @@ -11410,6 +11431,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr { // only for ILSE and BLSE if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Title || eType == vcl::pdf::StructElement::Heading || eType == vcl::pdf::StructElement::H1 || eType == vcl::pdf::StructElement::H2 || @@ -11445,6 +11467,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr { // only for ILSE and BLSE if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Title || eType == vcl::pdf::StructElement::Heading || eType == vcl::pdf::StructElement::H1 || eType == vcl::pdf::StructElement::H2 || @@ -11588,6 +11611,7 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib case PDFWriter::EndIndent: // just for BLSE if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Title || eType == vcl::pdf::StructElement::Heading || eType == vcl::pdf::StructElement::H1 || eType == vcl::pdf::StructElement::H2 || @@ -11610,6 +11634,7 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib case PDFWriter::TextIndent: // paragraph like BLSE and additional elements if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Title || eType == vcl::pdf::StructElement::Heading || eType == vcl::pdf::StructElement::H1 || eType == vcl::pdf::StructElement::H2 || @@ -11641,6 +11666,7 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib case PDFWriter::BaselineShift: // only for ILSE and BLSE if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Title || eType == vcl::pdf::StructElement::Heading || eType == vcl::pdf::StructElement::H1 || eType == vcl::pdf::StructElement::H2 || commit 32efd40c1ee09badf5a776343d3a86b03e8d2645 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Thu Jan 9 09:23:41 2025 +0900 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 15 11:56:51 2025 +0100 pdf: change StructElement to enum class, move out of PDFWriter Moves the StructElement out of PDFWriter and changes it to enum class. This makes it mroe type safe, easier to search and more clear what type we are using. Change-Id: Icf469319a01f58397b131c3517bc75fba4072500 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179977 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx index 783a54a4c409..e34a1a2a1f6d 100644 --- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx @@ -27,7 +27,7 @@ using namespace com::sun::star; namespace drawinglayer::primitive2d { StructureTagPrimitive2D::StructureTagPrimitive2D( - const vcl::PDFWriter::StructElement& rStructureElement, + const vcl::pdf::StructElement& rStructureElement, bool bBackground, bool bIsImage, bool bIsDecorative, diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index fdb98edceff2..a3af7b1b812f 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -500,7 +500,7 @@ void VclMetafileProcessor2D::impEndSvtGraphicStroke(SvtGraphicStroke const* pSvt } } -void VclMetafileProcessor2D::popStructureElement(vcl::PDFWriter::StructElement eElem) +void VclMetafileProcessor2D::popStructureElement(vcl::pdf::StructElement eElem) { if (!maListElements.empty() && maListElements.top() == eElem) { @@ -511,14 +511,14 @@ void VclMetafileProcessor2D::popStructureElement(vcl::PDFWriter::StructElement e void VclMetafileProcessor2D::popListItem() { - popStructureElement(vcl::PDFWriter::LIBody); - popStructureElement(vcl::PDFWriter::ListItem); + popStructureElement(vcl::pdf::StructElement::LIBody); + popStructureElement(vcl::pdf::StructElement::ListItem); } void VclMetafileProcessor2D::popList() { popListItem(); - popStructureElement(vcl::PDFWriter::List); + popStructureElement(vcl::pdf::StructElement::List); } VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, @@ -1131,7 +1131,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D( mpOutputDevice->GetMapMode()); pPDFControl->TextFont.SetFontSize(aFontSize); - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Form); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Form); vcl::PDFWriter::StructAttributeValue role; switch (pPDFControl->Type) { @@ -1183,9 +1183,10 @@ void VclMetafileProcessor2D::processControlPrimitive2D( if (mpPDFExtOutDevData) { // no corresponding PDF Form, use Figure instead if (!bDecorative) - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Figure); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Figure); else - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement); + mpPDFExtOutDevData->WrapBeginStructureElement( + vcl::pdf::StructElement::NonStructElement); mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, vcl::PDFWriter::Block); auto const range(rControlPrimitive.getB2DRange(getViewInformation2D())); tools::Rectangle const aLogicRect(basegfx::fround<tools::Long>(range.getMinX()), @@ -1330,8 +1331,8 @@ void VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D( // this is a part of list item, start LILabel ( = bullet) if (mbInListItem) { - maListElements.push(vcl::PDFWriter::LILabel); - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::LILabel); + maListElements.push(vcl::pdf::StructElement::LILabel); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::LILabel); } // process recursively and add MetaFile comment @@ -1342,7 +1343,7 @@ void VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D( if (mbInListItem) { - if (maListElements.top() == vcl::PDFWriter::LILabel) + if (maListElements.top() == vcl::pdf::StructElement::LILabel) { maListElements.pop(); mpPDFExtOutDevData->EndStructureElement(); // end LILabel @@ -1370,7 +1371,7 @@ void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D( { // No Tagged PDF -> Dump as Paragraph // Emulate data handling from old ImpEditEngine::Paint - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Paragraph); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Paragraph); // Process recursively and add MetaFile comment process(rParagraphPrimitive); @@ -1395,8 +1396,8 @@ void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D( // increase List level for (sal_Int16 a(mnCurrentOutlineLevel); a != nNewOutlineLevel; ++a) { - maListElements.push(vcl::PDFWriter::List); - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::List); + maListElements.push(vcl::pdf::StructElement::List); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::List); } } else // if(nNewOutlineLevel < mnCurrentOutlineLevel) @@ -1426,14 +1427,14 @@ void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D( if (bDumpAsListItem) { // Dump as ListItem - maListElements.push(vcl::PDFWriter::ListItem); - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::ListItem); + maListElements.push(vcl::pdf::StructElement::ListItem); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::ListItem); mbInListItem = true; } else { // Dump as Paragraph - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Paragraph); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Paragraph); } // Process recursively and add MetaFile comment @@ -1476,8 +1477,8 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( // bullet has been already processed, start LIBody if (mbInListItem && mbBulletPresent) { - maListElements.push(vcl::PDFWriter::LIBody); - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::LIBody); + maListElements.push(vcl::pdf::StructElement::LIBody); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::LIBody); } // directdraw of text simple portion; use default processing @@ -2598,8 +2599,8 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( ::comphelper::ValueRestorationGuard const g(mpCurrentStructureTag, &rStructureTagCandidate); // structured tag primitive - const vcl::PDFWriter::StructElement& rTagElement(rStructureTagCandidate.getStructureElement()); - bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement)); + const vcl::pdf::StructElement& rTagElement(rStructureTagCandidate.getStructureElement()); + bool bTagUsed((vcl::pdf::StructElement::NonStructElement != rTagElement)); ::std::optional<sal_Int32> oAnchorParent; if (!rStructureTagCandidate.isTaggedSdrObject()) @@ -2622,26 +2623,26 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( mpPDFExtOutDevData->WrapBeginStructureElement(rTagElement); switch (rTagElement) { - case vcl::PDFWriter::H1: - case vcl::PDFWriter::H2: - case vcl::PDFWriter::H3: - case vcl::PDFWriter::H4: - case vcl::PDFWriter::H5: - case vcl::PDFWriter::H6: - case vcl::PDFWriter::Paragraph: - case vcl::PDFWriter::Heading: - case vcl::PDFWriter::Caption: - case vcl::PDFWriter::BlockQuote: - case vcl::PDFWriter::Table: - case vcl::PDFWriter::TableRow: - case vcl::PDFWriter::Formula: - case vcl::PDFWriter::Figure: - case vcl::PDFWriter::Annot: + case vcl::pdf::StructElement::H1: + case vcl::pdf::StructElement::H2: + case vcl::pdf::StructElement::H3: + case vcl::pdf::StructElement::H4: + case vcl::pdf::StructElement::H5: + case vcl::pdf::StructElement::H6: + case vcl::pdf::StructElement::Paragraph: + case vcl::pdf::StructElement::Heading: + case vcl::pdf::StructElement::Caption: + case vcl::pdf::StructElement::BlockQuote: + case vcl::pdf::StructElement::Table: + case vcl::pdf::StructElement::TableRow: + case vcl::pdf::StructElement::Formula: + case vcl::pdf::StructElement::Figure: + case vcl::pdf::StructElement::Annot: mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, vcl::PDFWriter::Block); break; - case vcl::PDFWriter::TableData: - case vcl::PDFWriter::TableHeader: + case vcl::pdf::StructElement::TableData: + case vcl::pdf::StructElement::TableHeader: mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, vcl::PDFWriter::Inline); break; @@ -2650,10 +2651,10 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( } switch (rTagElement) { - case vcl::PDFWriter::Table: - case vcl::PDFWriter::Formula: - case vcl::PDFWriter::Figure: - case vcl::PDFWriter::Annot: + case vcl::pdf::StructElement::Table: + case vcl::pdf::StructElement::Formula: + case vcl::pdf::StructElement::Figure: + case vcl::pdf::StructElement::Annot: { auto const range(rStructureTagCandidate.getB2DRange(getViewInformation2D())); tools::Rectangle const aLogicRect( @@ -2667,11 +2668,11 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( default: break; } - if (rTagElement == vcl::PDFWriter::Annot) + if (rTagElement == vcl::pdf::StructElement::Annot) { mpPDFExtOutDevData->SetStructureAnnotIds(rStructureTagCandidate.GetAnnotIds()); } - if (rTagElement == vcl::PDFWriter::TableHeader) + if (rTagElement == vcl::pdf::StructElement::TableHeader) { mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Scope, vcl::PDFWriter::Column); @@ -2682,7 +2683,8 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( { // background image: tag as artifact if (rStructureTagCandidate.isImage()) - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement); + mpPDFExtOutDevData->WrapBeginStructureElement( + vcl::pdf::StructElement::NonStructElement); // any other background object: do not tag else assert(false); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx index 07e81b360cec..e85df18f9e20 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx @@ -107,7 +107,7 @@ private: const attribute::LineStartEndAttribute* pEnd); void impStartSvtGraphicStroke(SvtGraphicStroke const* pSvtGraphicStroke); void impEndSvtGraphicStroke(SvtGraphicStroke const* pSvtGraphicStroke); - void popStructureElement(vcl::PDFWriter::StructElement eElem); + void popStructureElement(vcl::pdf::StructElement eElem); void popListItem(); void popList(); @@ -186,7 +186,7 @@ private: bool mbInListItem; bool mbBulletPresent; - std::stack<vcl::PDFWriter::StructElement> maListElements; + std::stack<vcl::pdf::StructElement> maListElements; primitive2d::StructureTagPrimitive2D const* mpCurrentStructureTag = nullptr; diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index 9e591a2281c0..b8d40bd51f75 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -1008,8 +1008,7 @@ void Primitive2dXmlDump::decomposeAndWrite( = static_cast<const StructureTagPrimitive2D&>(*pBasePrimitive); rWriter.startElement("structuretag"); rWriter.attribute("structureelement", - rStructureTagPrimitive2D.getStructureElement()); - + sal_Int32(rStructureTagPrimitive2D.getStructureElement())); decomposeAndWrite(rStructureTagPrimitive2D.getChildren(), rWriter); rWriter.endElement(); } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 068a6b56aa0f..699389cebbaa 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3357,7 +3357,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po return; if ( pPDFExtOutDevData ) - pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Paragraph); + pPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Paragraph); const tools::Long nParaHeight = rParaPortion.GetHeight(); if (rParaPortion.IsVisible() && ( @@ -3903,7 +3903,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po auto pUrlField = dynamic_cast<const SvxURLField*>(pFieldData); if (pUrlField) if (pPDFExtOutDevData->GetIsExportTaggedPDF()) - pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Link, u"Link"_ustr); + pPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Link, u"Link"_ustr); } } } diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 8827971fcda5..b89244fa0242 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -1365,7 +1365,7 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi rWriter.Push(); // tdf#152235 tag around the reference to the XObject on the page sal_Int32 const id = rWriter.EnsureStructureElement(); - rWriter.InitStructureElement(id, vcl::PDFWriter::NonStructElement, ::std::u16string_view()); + rWriter.InitStructureElement(id, vcl::pdf::StructElement::NonStructElement, ::std::u16string_view()); rWriter.BeginStructureElement(id); rWriter.SetStructureAttribute(vcl::PDFWriter::Type, vcl::PDFWriter::Pagination); rWriter.SetStructureAttribute(vcl::PDFWriter::Subtype, vcl::PDFWriter::Watermark); @@ -1463,7 +1463,7 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP rWriter.Push(); // tdf#152235 tag around the reference to the XObject on the page sal_Int32 const id = rWriter.EnsureStructureElement(); - rWriter.InitStructureElement(id, vcl::PDFWriter::NonStructElement, ::std::u16string_view()); + rWriter.InitStructureElement(id, vcl::pdf::StructElement::NonStructElement, ::std::u16string_view()); rWriter.BeginStructureElement(id); rWriter.SetStructureAttribute(vcl::PDFWriter::Type, vcl::PDFWriter::Pagination); rWriter.SetStructureAttribute(vcl::PDFWriter::Subtype, vcl::PDFWriter::Watermark); diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx index 15890959b004..170b44d5d9f3 100644 --- a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx @@ -43,7 +43,7 @@ namespace drawinglayer::primitive2d { private: /// the PDF structure element this grouping represents - vcl::PDFWriter::StructElement maStructureElement; + vcl::pdf::StructElement maStructureElement; /// flag for background object bool mbBackground; @@ -59,7 +59,7 @@ namespace drawinglayer::primitive2d public: /// constructor StructureTagPrimitive2D( - const vcl::PDFWriter::StructElement& rStructureElement, + const vcl::pdf::StructElement& rStructureElement, bool bBackground, bool bIsImage, bool bIsDecorative, @@ -68,7 +68,7 @@ namespace drawinglayer::primitive2d ::std::vector<sal_Int32> const* pAnnotIds = nullptr); /// data read access - const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; } + const vcl::pdf::StructElement& getStructureElement() const { return maStructureElement; } bool isBackground() const { return mbBackground; } bool isImage() const { return mbIsImage; } bool isDecorative() const { return mbIsDecorative; } diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx index 44ac3646f184..6ea175c905eb 100644 --- a/include/vcl/pdfextoutdevdata.hxx +++ b/include/vcl/pdfextoutdevdata.hxx @@ -391,9 +391,9 @@ public: @returns the id of the newly created structural element */ - sal_Int32 WrapBeginStructureElement(PDFWriter::StructElement eType, const OUString& rAlias = OUString()); + sal_Int32 WrapBeginStructureElement(vcl::pdf::StructElement eType, const OUString& rAlias = OUString()); sal_Int32 EnsureStructureElement(void const* key); - void InitStructureElement(sal_Int32 id, PDFWriter::StructElement eType, const OUString& rAlias); + void InitStructureElement(sal_Int32 id, vcl::pdf::StructElement eType, const OUString& rAlias); void BeginStructureElement(sal_Int32 id); /** end a logical structure element diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 531123f7bdb1..9a6a1dcce76d 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -152,6 +152,33 @@ struct PDFEncryptionProperties } }; +namespace pdf +{ +// for a definition of structural element types please refer to +// PDF Reference, 3rd ed. section 9.7.4 +enum class StructElement +{ + // special element to place outside the structure hierarchy + NonStructElement, + // Grouping elements + Document, Part, Article, Section, Division, BlockQuote, + Caption, TOC, TOCI, Index, + + // block level elements + Paragraph, Heading, H1, H2, H3, H4, H5, H6, + List, ListItem, LILabel, LIBody, + Table, TableRow, TableHeader, TableData, + + // inline level elements + Span, Quote, Note, Reference, BibEntry, Code, Link, Annot, + Ruby, RB, RT, RP, Warichu, WT, WP, + + // illustration elements + Figure, Formula, Form +}; + +} + class PDFWriter { ScopedVclPtr<PDFWriterImpl> xImplementation; @@ -201,29 +228,6 @@ public: // version 1.4 section 8.2.1, page 475 enum class DestAreaType { XYZ, FitRectangle }; - // for a definition of structural element types please refer to - // PDF Reference, 3rd ed. section 9.7.4 - enum StructElement - { - // special element to place outside the structure hierarchy - NonStructElement, - // Grouping elements - Document, Part, Article, Section, Division, BlockQuote, - Caption, TOC, TOCI, Index, - - // block level elements - Paragraph, Heading, H1, H2, H3, H4, H5, H6, - List, ListItem, LILabel, LIBody, - Table, TableRow, TableHeader, TableData, - - // inline level elements - Span, Quote, Note, Reference, BibEntry, Code, Link, Annot, - Ruby, RB, RT, RP, Warichu, WT, WP, - - // illustration elements - Figure, Formula, Form - }; - enum StructAttribute { // Artifacts @@ -1157,7 +1161,7 @@ public: */ VCL_DLLPUBLIC void BeginStructureElement(sal_Int32 id); VCL_DLLPUBLIC sal_Int32 EnsureStructureElement(); - VCL_DLLPUBLIC void InitStructureElement(sal_Int32 id, PDFWriter::StructElement eType, std::u16string_view rAlias); + VCL_DLLPUBLIC void InitStructureElement(sal_Int32 id, vcl::pdf::StructElement eType, std::u16string_view rAlias); /** end the current logical structure element diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index e19bc6f58100..d3d51f52fcc4 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -355,7 +355,7 @@ public: void SetSnapPixel(); - bool ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType, SCROW nRow = -1, + bool ReopenPDFStructureElement(vcl::pdf::StructElement aType, SCROW nRow = -1, SCCOL nCol = -1); void DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool bPage, bool bMergeCover = false); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 19ef534be1e6..06e8f47a6b9c 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2249,7 +2249,7 @@ static void lcl_PDFExportHelper(const OutputDevice* pDev, const OUString& rTabNa if (pPDF->GetIsExportTaggedPDF()) { if (bIsFirstPage) - pPDF->WrapBeginStructureElement(vcl::PDFWriter::Document, u"Workbook"_ustr); + pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::Document, u"Workbook"_ustr); else { // if there is a new worksheet(not first), delete and add new ScPDFState assert(pPDF->GetScPDFState()); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 417aa596b724..cc4a3bd6e2b4 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -298,13 +298,13 @@ void ScOutputData::SetSyntaxMode( bool bNewMode ) } } -bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType, SCROW nRow, SCCOL nCol) +bool ScOutputData::ReopenPDFStructureElement(vcl::pdf::StructElement aType, SCROW nRow, SCCOL nCol) { bool bReopenTag = false; vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(mpDev->GetExtOutDevData()); if (pPDF) { - if (aType == vcl::PDFWriter::Part) // Worksheet + if (aType == vcl::pdf::StructElement::Part) // Worksheet { if (pPDF->GetScPDFState()->m_WorksheetId != -1) { @@ -313,7 +313,7 @@ bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType bReopenTag = true; } } - else if (aType == vcl::PDFWriter::Table) + else if (aType == vcl::pdf::StructElement::Table) { if (pPDF->GetScPDFState()->m_TableId != -1) { @@ -322,7 +322,7 @@ bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType bReopenTag = true; } } - else if (aType == vcl::PDFWriter::TableRow) + else if (aType == vcl::pdf::StructElement::TableRow) { const auto aIter = pPDF->GetScPDFState()->m_TableRowMap.find(nRow); if (aIter != pPDF->GetScPDFState()->m_TableRowMap.end() && nRow == aIter->first) @@ -332,7 +332,7 @@ bool ScOutputData::ReopenPDFStructureElement(vcl::PDFWriter::StructElement aType bReopenTag = true; } } - else if (aType == vcl::PDFWriter::TableData) + else if (aType == vcl::pdf::StructElement::TableData) { const std::pair<SCROW, SCCOL> keyToFind = std::make_pair(nRow, nCol); const auto aIter = pPDF->GetScPDFState()->m_TableDataMap.find(keyToFind); @@ -1128,7 +1128,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) else { if (bTaggedPDF) - pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement); + pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement); // scan for rows with the same background: SCSIZE nSkip = 0; @@ -1298,7 +1298,7 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot if ( pAttr && !bSkipX ) { if (bTaggedPDF) - pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement); + pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement); ScShadowPart ePart = nPass ? pThisRowInfo->cellInfo(nCol).eVShadowPart : @@ -1461,7 +1461,7 @@ void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext) vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(mpDev->GetExtOutDevData()); bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF(); if (bTaggedPDF) - pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement); + pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement); DrawModeFlags nOldDrawMode = rRenderContext.GetDrawMode(); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 421edaafcc5f..4a3bdc5535ba 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1493,11 +1493,11 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic) bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF(); if (bTaggedPDF) { - bool bReopenTag = ReopenPDFStructureElement(vcl::PDFWriter::Table); + bool bReopenTag = ReopenPDFStructureElement(vcl::pdf::StructElement::Table); if (!bReopenTag) { sal_Int32 nId = pPDF->EnsureStructureElement(nullptr); - pPDF->InitStructureElement(nId, vcl::PDFWriter::Table, u"Table"_ustr); + pPDF->InitStructureElement(nId, vcl::pdf::StructElement::Table, u"Table"_ustr); pPDF->BeginStructureElement(nId); pPDF->GetScPDFState()->m_TableId = nId; } @@ -1571,12 +1571,12 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic) if (nLoopStartX != 0) { bReopenTag - = ReopenPDFStructureElement(vcl::PDFWriter::TableRow, nY); + = ReopenPDFStructureElement(vcl::pdf::StructElement::TableRow, nY); } if (!bReopenTag) { sal_Int32 nId = pPDF->EnsureStructureElement(nullptr); - pPDF->InitStructureElement(nId, vcl::PDFWriter::TableRow, u"TR"_ustr); + pPDF->InitStructureElement(nId, vcl::pdf::StructElement::TableRow, u"TR"_ustr); pPDF->BeginStructureElement(nId); pPDF->GetScPDFState()->m_TableRowMap.emplace(nY, nId); } @@ -1588,7 +1588,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic) for (SCCOL nX=nLoopStartX; nX<=nX2; nX++) { if (bTaggedPDF) - pPDF->WrapBeginStructureElement(vcl::PDFWriter::TableData, u"TD"_ustr); + pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::TableData, u"TD"_ustr); bool bMergeEmpty = false; const ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nX); @@ -2134,7 +2134,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic) if (!aString.isEmpty()) { if (bTaggedPDF) - pPDF->WrapBeginStructureElement(vcl::PDFWriter::Paragraph, u"P"_ustr); + pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::Paragraph, u"P"_ustr); // If the string is clipped, make it shorter for // better performance since drawing by HarfBuzz is @@ -4492,7 +4492,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) bool bReopenTag = false; if (bTaggedPDF) - bReopenTag = ReopenPDFStructureElement(vcl::PDFWriter::TableData, nY, nX); + bReopenTag = ReopenPDFStructureElement(vcl::pdf::StructElement::TableData, nY, nX); SCCOL nCellX = nX; // position where the cell really starts SCROW nCellY = nY; diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index a8c3990b1288..07f5225b87f5 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -554,11 +554,11 @@ void ScPrintFunc::DrawToDev(ScDocument& rDoc, OutputDevice* pDev, double /* nPri bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF(); if (bTaggedPDF) { - bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::PDFWriter::Part); + bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::pdf::StructElement::Part); if (!bReopen) { sal_Int32 nId = pPDF->EnsureStructureElement(nullptr); - pPDF->InitStructureElement(nId, vcl::PDFWriter::Part, u"Worksheet"_ustr); + pPDF->InitStructureElement(nId, vcl::pdf::StructElement::Part, u"Worksheet"_ustr); pPDF->BeginStructureElement(nId); pPDF->GetScPDFState()->m_WorksheetId = nId; } @@ -1624,11 +1624,11 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF(); if (bTaggedPDF) { - bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::PDFWriter::Part); + bool bReopen = aOutputData.ReopenPDFStructureElement(vcl::pdf::StructElement::Part); if (!bReopen) { sal_Int32 nId = pPDF->EnsureStructureElement(nullptr); - pPDF->InitStructureElement(nId, vcl::PDFWriter::Part, u"Worksheet"_ustr); + pPDF->InitStructureElement(nId, vcl::pdf::StructElement::Part, u"Worksheet"_ustr); pPDF->BeginStructureElement(nId); pPDF->GetScPDFState()->m_WorksheetId = nId; } @@ -1786,7 +1786,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); bool bTaggedPDF = pPDF && pPDF->GetIsExportTaggedPDF(); if (bTaggedPDF) - pPDF->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement); + pPDF->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement); const ScPrintHFParam& rParam = bHeader ? aHdr : aFtr; diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index ea1418f45850..728d03053a92 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -375,7 +375,7 @@ void ViewObjectContact::createStructureTag(drawinglayer::primitive2d::Primitive2 { if (nullptr != pSdrObj && !pSdrObj->IsDecorative()) { - vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement); + vcl::pdf::StructElement eElement(vcl::pdf::StructElement::NonStructElement); const SdrInventor nInventor(pSdrObj->GetObjInventor()); const SdrObjKind nIdentifier(pSdrObj->GetObjIdentifier()); const bool bIsTextObj(nullptr != DynCastSdrTextObj(pSdrObj)); @@ -387,22 +387,22 @@ void ViewObjectContact::createStructureTag(drawinglayer::primitive2d::Primitive2 if ( nInventor == SdrInventor::Default ) { if ( nIdentifier == SdrObjKind::Group ) - eElement = vcl::PDFWriter::Figure; + eElement = vcl::pdf::StructElement::Figure; else if (nIdentifier == SdrObjKind::Table) - eElement = vcl::PDFWriter::Table; + eElement = vcl::pdf::StructElement::Table; else if (nIdentifier == SdrObjKind::Media) - eElement = vcl::PDFWriter::Annot; + eElement = vcl::pdf::StructElement::Annot; else if ( nIdentifier == SdrObjKind::TitleText ) - eElement = vcl::PDFWriter::Heading; + eElement = vcl::pdf::StructElement::Heading; else if ( nIdentifier == SdrObjKind::OutlineText ) - eElement = vcl::PDFWriter::Division; + eElement = vcl::pdf::StructElement::Division; else if ( !bIsTextObj || !static_cast<const SdrTextObj&>(*pSdrObj).HasText() ) - eElement = vcl::PDFWriter::Figure; + eElement = vcl::pdf::StructElement::Figure; else - eElement = vcl::PDFWriter::Division; + eElement = vcl::pdf::StructElement::Division; } - if(vcl::PDFWriter::NonStructElement != eElement) + if(vcl::pdf::StructElement::NonStructElement != eElement) { SdrPage* pSdrPage(pSdrObj->getSdrPageFromSdrObject()); @@ -418,7 +418,7 @@ void ViewObjectContact::createStructureTag(drawinglayer::primitive2d::Primitive2 } ::std::vector<sal_Int32> annotIds; - if (eElement == vcl::PDFWriter::Annot + if (eElement == vcl::pdf::StructElement::Annot && !static_cast<SdrMediaObj*>(pSdrObj)->getURL().isEmpty()) { auto const pPDFExtOutDevData(GetObjectContact().GetPDFExtOutDevData()); @@ -445,7 +445,7 @@ void ViewObjectContact::createStructureTag(drawinglayer::primitive2d::Primitive2 rNewPrimitiveSequence = drawinglayer::primitive2d::Primitive2DContainer { new drawinglayer::primitive2d::StructureTagPrimitive2D( // lies to force silly VclMetafileProcessor2D to emit NonStructElement - vcl::PDFWriter::Division, + vcl::pdf::StructElement::Division, true, true, true, // Decorative diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index c9d230292c39..73940db300f5 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -360,8 +360,8 @@ namespace sdr::contact // first row, assume that it's a header row auto const eType( aCellPos.mnRow == 0 && rTableObj.getTableStyleSettings().mbUseFirstRow - ? vcl::PDFWriter::TableHeader - : vcl::PDFWriter::TableData); + ? vcl::pdf::StructElement::TableHeader + : vcl::pdf::StructElement::TableData); cell = drawinglayer::primitive2d::Primitive2DContainer { new drawinglayer::primitive2d::StructureTagPrimitive2D( eType, @@ -377,7 +377,7 @@ namespace sdr::contact { row = drawinglayer::primitive2d::Primitive2DContainer { new drawinglayer::primitive2d::StructureTagPrimitive2D( - vcl::PDFWriter::TableRow, + vcl::pdf::StructElement::TableRow, pPage->IsMasterPage(), false, false, diff --git a/sw/inc/EnhancedPDFExportHelper.hxx b/sw/inc/EnhancedPDFExportHelper.hxx index 450c9c2fe71a..8414a9a29ff2 100644 --- a/sw/inc/EnhancedPDFExportHelper.hxx +++ b/sw/inc/EnhancedPDFExportHelper.hxx @@ -154,11 +154,11 @@ class SwTaggedPDFHelper const Por_Info* mpPorInfo; void OpenTagImpl(void const* pKey); - sal_Int32 BeginTagImpl(void const* pKey,vcl::PDFWriter::StructElement aTagRole, const OUString& rTagName); - void BeginTag( vcl::PDFWriter::StructElement aTagRole, const OUString& rTagName ); + sal_Int32 BeginTagImpl(void const* pKey,vcl::pdf::StructElement aTagRole, const OUString& rTagName); + void BeginTag(vcl::pdf::StructElement aTagRole, const OUString& rTagName); void EndTag(); - void SetAttributes( vcl::PDFWriter::StructElement eType ); + void SetAttributes(vcl::pdf::StructElement eType); // These functions are called by the c'tor, d'tor void BeginNumberedListStructureElements(); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index ee221ccb66bf..0f135c311ae1 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -414,7 +414,7 @@ SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo, else if ( mpPorInfo ) BeginInlineStructureElements(); else - BeginTag( vcl::PDFWriter::NonStructElement, OUString() ); + BeginTag( vcl::pdf::StructElement::NonStructElement, OUString() ); #if OSL_DEBUG_LEVEL > 1 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); @@ -540,7 +540,7 @@ void SwTaggedPDFHelper::OpenTagImpl(void const*const pKey) } sal_Int32 SwTaggedPDFHelper::BeginTagImpl(void const*const pKey, - vcl::PDFWriter::StructElement const eType, const OUString& rString) + vcl::pdf::StructElement const eType, const OUString& rString) { // write new tag const sal_Int32 nId = mpPDFExtOutDevData->EnsureStructureElement(pKey); @@ -555,7 +555,7 @@ sal_Int32 SwTaggedPDFHelper::BeginTagImpl(void const*const pKey, return nId; } -void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const OUString& rString ) +void SwTaggedPDFHelper::BeginTag(vcl::pdf::StructElement eType, const OUString& rString) { void const* pKey(nullptr); @@ -598,12 +598,12 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const OUS SwTextNode const*const pTextNd = rTextFrame.GetTextNodeForParaProps(); const SwNodeNum* pNodeNum = pTextNd->GetNum(rTextFrame.getRootFrame()); - if ( vcl::PDFWriter::List == eType ) + if (vcl::pdf::StructElement::List == eType) { NumListIdMap& rNumListIdMap(mpPDFExtOutDevData->GetSwPDFState()->m_NumListIdMap); rNumListIdMap[ pNodeNum ] = nId; } - else if ( vcl::PDFWriter::LIBody == eType ) + else if (vcl::pdf::StructElement::LIBody == eType) { NumListBodyIdMap& rNumListBodyIdMap(mpPDFExtOutDevData->GetSwPDFState()->m_NumListBodyIdMap); rNumListBodyIdMap[ pNodeNum ] = nId; @@ -640,7 +640,7 @@ namespace { } // Sets the attributes according to the structure type. -void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) +void SwTaggedPDFHelper::SetAttributes(vcl::pdf::StructElement eType) { sal_Int32 nVal; @@ -669,17 +669,17 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) // Check which attributes to set: - switch ( eType ) + switch (eType) { - case vcl::PDFWriter::Document : + case vcl::pdf::StructElement::Document: bWritingMode = true; break; - case vcl::PDFWriter::Note: + case vcl::pdf::StructElement::Note: bPlacement = true; break; - case vcl::PDFWriter::Table : + case vcl::pdf::StructElement::Table: bPlacement = bWritingMode = bSpaceBefore = @@ -691,15 +691,15 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) bBox = true; break; - case vcl::PDFWriter::TableRow : + case vcl::pdf::StructElement::TableRow: bPlacement = bWritingMode = true; break; - case vcl::PDFWriter::TableHeader : + case vcl::pdf::StructElement::TableHeader: mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Scope, vcl::PDFWriter::Column); [[fallthrough]]; - case vcl::PDFWriter::TableData : + case vcl::pdf::StructElement::TableData: bPlacement = bWritingMode = bWidth = @@ -707,21 +707,21 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) bRowSpan = true; break; - case vcl::PDFWriter::Caption: + case vcl::pdf::StructElement::Caption: if (pFrame->IsSctFrame()) { break; } [[fallthrough]]; - case vcl::PDFWriter::H1 : - case vcl::PDFWriter::H2 : - case vcl::PDFWriter::H3 : - case vcl::PDFWriter::H4 : - case vcl::PDFWriter::H5 : - case vcl::PDFWriter::H6 : - case vcl::PDFWriter::Paragraph : - case vcl::PDFWriter::Heading : - case vcl::PDFWriter::BlockQuote : + case vcl::pdf::StructElement::H1: + case vcl::pdf::StructElement::H2: + case vcl::pdf::StructElement::H3: + case vcl::pdf::StructElement::H4: + case vcl::pdf::StructElement::H5: + case vcl::pdf::StructElement::H6: + case vcl::pdf::StructElement::Paragraph: + case vcl::pdf::StructElement::Heading: + case vcl::pdf::StructElement::BlockQuote: bPlacement = bWritingMode = @@ -733,8 +733,8 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) bTextAlign = true; break; - case vcl::PDFWriter::Formula : - case vcl::PDFWriter::Figure : + case vcl::pdf::StructElement::Formula: + case vcl::pdf::StructElement::Figure: bAltText = bPlacement = bWidth = @@ -742,7 +742,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) bBox = true; break; - case vcl::PDFWriter::Division: + case vcl::pdf::StructElement::Division: if (pFrame->IsFlyFrame()) // this can be something else too { bAltText = true; @@ -750,7 +750,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) } break; - case vcl::PDFWriter::NonStructElement: + case vcl::pdf::StructElement::NonStructElement: if (pFrame->IsHeaderFrame() || pFrame->IsFooterFrame()) { // ISO 14289-1:2014, Clause: 7.8 @@ -771,7 +771,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bPlacement ) { bool bIsFigureInline = false; - if (vcl::PDFWriter::Figure == eType) + if (vcl::pdf::StructElement::Figure == eType) { const SwFrame* pKeyFrame = static_cast<const SwFlyFrame&>(*pFrame).GetAnchorFrame(); if (const SwLayoutFrame* pUpperFrame = pKeyFrame->GetUpper()) @@ -779,8 +779,9 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) bIsFigureInline = true; } - eVal = vcl::PDFWriter::TableHeader == eType || vcl::PDFWriter::TableData == eType - || bIsFigureInline + eVal = vcl::pdf::StructElement::TableHeader == eType + || vcl::pdf::StructElement::TableData == eType + || bIsFigureInline ? vcl::PDFWriter::Inline : vcl::PDFWriter::Block; @@ -891,10 +892,10 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bBox ) { // BBox only for non-split tables: - if ( vcl::PDFWriter::Table != eType || + if (vcl::pdf::StructElement::Table != eType || ( pFrame->IsTabFrame() && !static_cast<const SwTabFrame*>(pFrame)->IsFollow() && - !static_cast<const SwTabFrame*>(pFrame)->HasFollow() ) ) + !static_cast<const SwTabFrame*>(pFrame)->HasFollow() )) { mpPDFExtOutDevData->SetStructureBoundingBox(pFrame->getFrameArea().SVRect()); } @@ -956,11 +957,11 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) // Check which attributes to set: - switch ( eType ) + switch (eType) { - case vcl::PDFWriter::Span : - case vcl::PDFWriter::Quote : - case vcl::PDFWriter::Code : + case vcl::pdf::StructElement::Span: + case vcl::pdf::StructElement::Quote: + case vcl::pdf::StructElement::Code: if( PortionType::HyphenStr == pPor->GetWhichPor() || PortionType::SoftHyphenStr == pPor->GetWhichPor() || PortionType::Hyphen == pPor->GetWhichPor() || PortionType::SoftHyphen == pPor->GetWhichPor() ) bActualText = true; @@ -972,15 +973,15 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) } break; - case vcl::PDFWriter::Link : - case vcl::PDFWriter::BibEntry : + case vcl::pdf::StructElement::Link: + case vcl::pdf::StructElement::BibEntry: bTextDecorationType = bBaselineShift = bLinkAttribute = bLanguage = true; break; - case vcl::PDFWriter::RT: + case vcl::pdf::StructElement::RT: { SwRubyPortion const*const pRuby(static_cast<SwRubyPortion const*>(pPor)); vcl::PDFWriter::StructAttributeValue nAlign = {}; @@ -1025,7 +1026,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) } break; - case vcl::PDFWriter::Annot: + case vcl::pdf::StructElement::Annot: bAnnotAttribute = bLanguage = true; break; @@ -1104,7 +1105,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) } } } - else if (mpNumInfo && eType == vcl::PDFWriter::List) + else if (mpNumInfo && eType == vcl::pdf::StructElement::List) { SwTextFrame const& rFrame(mpNumInfo->mrFrame); SwTextNode const& rNode(*rFrame.GetTextNodeForParaProps()); @@ -1288,16 +1289,16 @@ void SwTaggedPDFHelper::BeginNumberedListStructureElements() const bool bNewItemTag = bNewListTag || pTextNd->IsCountedInList(); // If the text node is not counted, we do not start a new list item: if ( bNewListTag ) - BeginTag( vcl::PDFWriter::List, aListString ); + BeginTag(vcl::pdf::StructElement::List, aListString); if ( bNewItemTag ) { - BeginTag( vcl::PDFWriter::ListItem, aListItemString ); + BeginTag(vcl::pdf::StructElement::ListItem, aListItemString); assert(rTextFrame.GetPara()); // check whether to open LBody now or delay until after Lbl if (!rTextFrame.GetPara()->HasNumberingPortion(SwParaPortion::OnlyNumbering)) { - BeginTag(vcl::PDFWriter::LIBody, aListBodyString); + BeginTag(vcl::pdf::StructElement::LIBody, aListBodyString); } } } @@ -1329,7 +1330,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // Document: Document - nPDFType = vcl::PDFWriter::Document; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Document); aPDFType = aDocumentString; break; @@ -1338,14 +1339,14 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // Header, Footer: NonStructElement - nPDFType = vcl::PDFWriter::NonStructElement; + nPDFType = sal_uInt16(vcl::pdf::StructElement::NonStructElement); break; case SwFrameType::FtnCont : // Footnote container: Division - nPDFType = vcl::PDFWriter::Division; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Division); aPDFType = aDivString; break; @@ -1355,7 +1356,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // Note: vcl::PDFWriter::Note is actually a ILSE. Nevertheless // we treat it like a grouping element! - nPDFType = vcl::PDFWriter::Note; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Note); aPDFType = aNoteString; break; @@ -1391,7 +1392,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } else if (SectionType::ToxHeader == pSection->GetType()) { - nPDFType = vcl::PDFWriter::Caption; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Caption); aPDFType = aCaptionString; } else if (SectionType::ToxContent == pSection->GetType()) @@ -1401,19 +1402,19 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() { if ( TOX_INDEX == pTOXBase->GetType() ) { - nPDFType = vcl::PDFWriter::Index; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Index); aPDFType = aIndexString; } else { - nPDFType = vcl::PDFWriter::TOC; + nPDFType = sal_uInt16(vcl::pdf::StructElement::TOC); aPDFType = aTOCString; } } } else if ( SectionType::Content == pSection->GetType() ) { - nPDFType = vcl::PDFWriter::Section; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Section); aPDFType = aSectString; } } @@ -1432,7 +1433,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if (!pTextNd->IsOutline() && rTextFrame.GetPara()->HasNumberingPortion(SwParaPortion::OnlyNumbering)) { - sal_Int32 const nId = BeginTagImpl(nullptr, vcl::PDFWriter::LIBody, aListBodyString); + sal_Int32 const nId = BeginTagImpl(nullptr, vcl::pdf::StructElement::LIBody, aListBodyString); SwNodeNum const*const pNodeNum(pTextNd->GetNum(rTextFrame.getRootFrame())); NumListBodyIdMap& rNumListBodyIdMap(mpPDFExtOutDevData->GetSwPDFState()->m_NumListBodyIdMap); rNumListBodyIdMap[ pNodeNum ] = nId; @@ -1452,14 +1453,14 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // This is the default. If the paragraph could not be mapped to // any of the standard pdf tags, we write a user defined tag // <stylename> with role = P - nPDFType = vcl::PDFWriter::Paragraph; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Paragraph); aPDFType = sStyleName; // Quotations: BlockQuote if (sStyleName == aQuotations) { - nPDFType = vcl::PDFWriter::BlockQuote; + nPDFType = sal_uInt16(vcl::pdf::StructElement::BlockQuote); aPDFType = aBlockQuoteString; } @@ -1467,7 +1468,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sStyleName == aCaption) { - nPDFType = vcl::PDFWriter::Caption; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Caption); aPDFType = aCaptionString; } @@ -1475,7 +1476,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sParentStyleName == aCaption) { - nPDFType = vcl::PDFWriter::Caption; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Caption); aPDFType = sStyleName + aCaptionString; } @@ -1483,7 +1484,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sStyleName == aHeading) { - nPDFType = vcl::PDFWriter::Heading; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Heading); aPDFType = aHString; } @@ -1535,7 +1536,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // ... and apparently the extra H7.. must be declared in // RoleMap, or veraPDF complains. nRealLevel = std::min(nRealLevel, 5); - nPDFType = o3tl::narrowing<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel); + nPDFType = o3tl::narrowing<sal_uInt16>(sal_uInt16(vcl::pdf::StructElement::H1) + nRealLevel); } // Section: TOCI @@ -1551,7 +1552,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if ( pTOXBase && TOX_INDEX != pTOXBase->GetType() ) { // Special case: Open additional TOCI tag: - BeginTagImpl(nullptr, vcl::PDFWriter::TOCI, aTOCIString); + BeginTagImpl(nullptr, vcl::pdf::StructElement::TOCI, aTOCIString); } } } @@ -1562,7 +1563,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // TabFrame: Table - nPDFType = vcl::PDFWriter::Table; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Table); aPDFType = aTableString; { @@ -1616,12 +1617,12 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if ( !static_cast<const SwRowFrame*>(pFrame)->IsRepeatedHeadline() ) { - nPDFType = vcl::PDFWriter::TableRow; + nPDFType = sal_uInt16(vcl::pdf::StructElement::TableRow); aPDFType = aTRString; } else { - nPDFType = vcl::PDFWriter::NonStructElement; + nPDFType = sal_uInt16(vcl::pdf::StructElement::NonStructElement); } break; @@ -1633,12 +1634,12 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() const SwTabFrame* pTable = static_cast<const SwCellFrame*>(pFrame)->FindTabFrame(); if ( pTable->IsInHeadline( *pFrame ) || lcl_IsHeadlineCell( *static_cast<const SwCellFrame*>(pFrame) ) ) { - nPDFType = vcl::PDFWriter::TableHeader; + nPDFType = sal_uInt16(vcl::pdf::StructElement::TableHeader); aPDFType = aTHString; } else { - nPDFType = vcl::PDFWriter::TableData; + nPDFType = sal_uInt16(vcl::pdf::StructElement::TableData); aPDFType = aTDString; } } @@ -1654,7 +1655,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // fly in content or fly at page if (mpFrameInfo->m_isLink) { // tdf#154939 additional inner link element for flys - nPDFType = vcl::PDFWriter::Link; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Link); aPDFType = aLinkString; } else @@ -1663,7 +1664,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if (pFly->GetAnchorFrame()->FindFooterOrHeader() != nullptr || pFly->GetFrameFormat()->GetAttrSet().Get(RES_DECORATIVE).GetValue()) { - nPDFType = vcl::PDFWriter::NonStructElement; + nPDFType = sal_uInt16(vcl::pdf::StructElement::NonStructElement); } else if (pFly->Lower() && pFly->Lower()->IsNoTextFrame()) { @@ -1682,18 +1683,18 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } if ( bFormula ) { - nPDFType = vcl::PDFWriter::Formula; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Formula); aPDFType = aFormulaString; } else { - nPDFType = vcl::PDFWriter::Figure; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Figure); aPDFType = aFigureString; } } else { - nPDFType = vcl::PDFWriter::Division; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Division); aPDFType = aDivString; } } @@ -1704,7 +1705,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if ( USHRT_MAX != nPDFType ) { - BeginTag( static_cast<vcl::PDFWriter::StructElement>(nPDFType), aPDFType ); + BeginTag(vcl::pdf::StructElement(nPDFType), aPDFType ); } } @@ -1869,7 +1870,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() case PortionType::PostIts: if (!mpPDFExtOutDevData->GetSwPDFState()->m_NoteIdMap.empty()) { - nPDFType = vcl::PDFWriter::Annot; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Annot); aPDFType = aAnnotString; } break; @@ -1879,7 +1880,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() // Check for alternative spelling: case PortionType::HyphenStr : case PortionType::SoftHyphenStr : - nPDFType = vcl::PDFWriter::Span; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Span); aPDFType = aSpanString; break; @@ -1903,7 +1904,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() { if (!isContinueSpan) { - nPDFType = vcl::PDFWriter::Link; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Link); aPDFType = aLinkString; assert(!mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink); mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink.emplace(pInetFormatAttr); @@ -1916,7 +1917,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() { if (!isContinueSpan) { - nPDFType = vcl::PDFWriter::Quote; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Quote); aPDFType = aQuoteString; CreateCurrentSpan(rInf, sStyleName); } @@ -1925,7 +1926,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() { if (!isContinueSpan) { - nPDFType = vcl::PDFWriter::Code; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Code); aPDFType = aCodeString; CreateCurrentSpan(rInf, sStyleName); } @@ -1945,7 +1946,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() nCurrentLanguage != nDefaultLang || !sStyleName.isEmpty()) { - nPDFType = vcl::PDFWriter::Span; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Span); if (!sStyleName.isEmpty()) aPDFType = sStyleName; else @@ -1957,7 +1958,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() break; case PortionType::Footnote : - nPDFType = vcl::PDFWriter::Link; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Link); aPDFType = aLinkString; break; @@ -1973,12 +1974,12 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() const SwField* pField = pHint->GetFormatField().GetField(); if ( SwFieldIds::GetRef == pField->Which() ) { - nPDFType = vcl::PDFWriter::Link; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Link); aPDFType = aLinkString; } else if ( SwFieldIds::TableOfAuthorities == pField->Which() ) { - nPDFType = vcl::PDFWriter::BibEntry; + nPDFType = sal_uInt16(vcl::pdf::StructElement::BibEntry); aPDFType = aBibEntryString; } } @@ -1994,15 +1995,15 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() switch (mpPorInfo->m_Mode) { case 0: - nPDFType = vcl::PDFWriter::Ruby; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Ruby); aPDFType = "Ruby"; break; case 1: - nPDFType = vcl::PDFWriter::RT; + nPDFType = sal_uInt16(vcl::pdf::StructElement::RT); aPDFType = "RT"; break; case 2: - nPDFType = vcl::PDFWriter::RB; + nPDFType = sal_uInt16(vcl::pdf::StructElement::RB); aPDFType = "RB"; break; } @@ -2013,15 +2014,15 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() switch (mpPorInfo->m_Mode) { case 0: - nPDFType = vcl::PDFWriter::Warichu; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Warichu); aPDFType = "Warichu"; break; case 1: - nPDFType = vcl::PDFWriter::WP; + nPDFType = sal_uInt16(vcl::pdf::StructElement::WP); aPDFType = "WP"; break; case 2: - nPDFType = vcl::PDFWriter::WT; + nPDFType = sal_uInt16(vcl::pdf::StructElement::WT); aPDFType = "WT"; break; } @@ -2035,7 +2036,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() assert(!isContinueSpan); // is at start if (mpPorInfo->m_Mode == 0) { // tdf#152218 link both directions - nPDFType = vcl::PDFWriter::Link; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Link); aPDFType = aLinkString; break; } @@ -2046,7 +2047,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() assert(!isContinueSpan); // is at start if (mpPorInfo->m_Mode == 1) { // only works for multiple lines via wrapper from PaintSwFrame - nPDFType = vcl::PDFWriter::LILabel; + nPDFType = sal_uInt16(vcl::pdf::StructElement::LILabel); aPDFType = aListLabelString; } break; @@ -2055,14 +2056,14 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() case PortionType::TabRight : case PortionType::TabCenter : case PortionType::TabDecimal : - nPDFType = vcl::PDFWriter::NonStructElement; + nPDFType = sal_uInt16(vcl::pdf::StructElement::NonStructElement); break; default: break; } if ( USHRT_MAX != nPDFType ) { - BeginTag( static_cast<vcl::PDFWriter::StructElement>(nPDFType), aPDFType ); + BeginTag( static_cast<vcl::pdf::StructElement>(nPDFType), aPDFType ); } } diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index e90b81f17b66..2cb76dc3f60c 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx -e ... etc. - the rest is truncated
