diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2025-01-09 09:23:41 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2025-01-11 14:46:11 +0100 |
commit | f3fc477dab60f4f1c741b4453b4d0d34d00a46ba (patch) | |
tree | 9274c38276ff0b3ed311f7ae34b7769cd45b2f8d | |
parent | de0023b819e56d696e2e20bcb766d536ecf41427 (diff) |
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 <quikee@gmail.com>
25 files changed, 451 insertions, 445 deletions
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 d931320718d4..eb218e5a234c 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 @@ -2592,8 +2593,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()) @@ -2616,26 +2617,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; @@ -2644,10 +2645,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( @@ -2661,11 +2662,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); @@ -2676,7 +2677,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 8daf466983ea..f76a6c4da9f8 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -344,8 +344,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, @@ -361,7 +361,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 8fc8764470b5..9c9604873471 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1158,7 +1158,7 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co } pDescriptor->Location = aRect; - pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Form); + pPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Form); pPDFExtOutDevData->CreateControl(*pDescriptor); pPDFExtOutDevData->EndStructureElement(); diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 3330129be981..98efbd700c3e 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -1444,7 +1444,7 @@ bool SwJumpFieldPortion::DescribePDFControl(const SwTextPaintInfo& rInf) const if (!m_sHelp.isEmpty()) aDescriptor.Description = m_sHelp; - pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Form); + pPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Form); pPDFExtOutDevData->CreateControl(aDescriptor); pPDFExtOutDevData->EndStructureElement(); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index e01d3e602b4b..6bd5eeb72992 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -169,7 +169,7 @@ void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt) dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData())); if (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF()) { - pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement, OUString()); + pPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::NonStructElement, OUString()); } pDev->Push(); diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 6781d0f935fd..2d931ba729f8 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -573,7 +573,7 @@ typedef ::std::variant<ObjReference, ObjReferenceObj, MCIDReference> PDFStructur struct PDFStructureElement { sal_Int32 m_nObject; - ::std::optional<PDFWriter::StructElement> m_oType; + std::optional<vcl::pdf::StructElement> m_oType; OString m_aAlias; sal_Int32 m_nOwnElement; // index into structure vector sal_Int32 m_nParentElement; // index into structure vector @@ -694,8 +694,8 @@ class PDFWriterImpl final : public VirtualDevice, public PDFObjectContainer public: friend struct vcl::pdf::PDFPage; - const char* getStructureTag( PDFWriter::StructElement ); - static const char* getAttributeTag( PDFWriter::StructAttribute eAtr ); + const char* getStructureTag(vcl::pdf::StructElement eElement); + static const char* getAttributeTag(PDFWriter::StructAttribute eAtr ); static const char* getAttributeValueTag( PDFWriter::StructAttributeValue eVal ); // returns true if compression was done @@ -857,7 +857,7 @@ private: /* the buffer where the data are encrypted, dynamically allocated */ std::vector<sal_uInt8> m_vEncryptionBuffer; - void addRoleMap(const OString& aAlias, PDFWriter::StructElement eType); + void addRoleMap(const OString& aAlias, vcl::pdf::StructElement eType); void checkAndEnableStreamEncryption( sal_Int32 nObject ) override; @@ -1295,7 +1295,7 @@ public: sal_Int32 createNote(const tools::Rectangle& rRect, const tools::Rectangle& rPopupRect, const PDFNote& rNote, sal_Int32 nPageNr); // structure elements sal_Int32 ensureStructureElement(); - void initStructureElement(sal_Int32 id, PDFWriter::StructElement eType, std::u16string_view rAlias); + void initStructureElement(sal_Int32 id, vcl::pdf::StructElement eType, std::u16string_view rAlias); void beginStructureElement(sal_Int32 id); void endStructureElement(); bool setCurrentStructureElement( sal_Int32 nElement ); diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index eb5116b66e18..76560578f4ff 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -105,8 +105,9 @@ struct SetPageTransition { sal_Int32 mnPage; }; struct EnsureStructureElement { sal_Int32 mnId; }; -struct InitStructureElement { - PDFWriter::StructElement mParaStructElement; +struct InitStructureElement +{ + vcl::pdf::StructElement mParaStructElement; OUString maAlias; sal_Int32 mnId; }; @@ -768,7 +769,7 @@ sal_Int32 PDFExtOutDevData::EnsureStructureElement(void const*const key) } void PDFExtOutDevData::InitStructureElement(sal_Int32 const id, - PDFWriter::StructElement const eType, const OUString& rAlias) + vcl::pdf::StructElement const eType, const OUString& rAlias) { mpPageSyncData->PushAction(mrOutDev, vcl::InitStructureElement{ eType, rAlias, id }); // update parent: required for hell fly anchor frames in sw, so that on the actual @@ -783,7 +784,7 @@ void PDFExtOutDevData::BeginStructureElement(sal_Int32 const id) } sal_Int32 PDFExtOutDevData::WrapBeginStructureElement( - PDFWriter::StructElement const eType, const OUString& rAlias) + vcl::pdf::StructElement const eType, const OUString& rAlias) { sal_Int32 const id = EnsureStructureElement(nullptr); InitStructureElement(id, eType, rAlias); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index ca91054c53de..98ed353df037 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -395,7 +395,7 @@ sal_Int32 PDFWriter::EnsureStructureElement() } void PDFWriter::InitStructureElement(sal_Int32 const id, - PDFWriter::StructElement const eType, std::u16string_view const rAlias) + vcl::pdf::StructElement const eType, std::u16string_view const rAlias) { return xImplementation->initStructureElement(id, eType, rAlias); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 5f93906462a8..526dc7ec97b1 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1938,7 +1938,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) assert(rEle.m_nOwnElement == 0 || rEle.m_oType); if (rEle.m_nOwnElement != rEle.m_nParentElement // emit the struct tree root // do not emit NonStruct and its children - && *rEle.m_oType == PDFWriter::NonStructElement) + && *rEle.m_oType == vcl::pdf::StructElement::NonStructElement) { return 0; } @@ -1948,7 +1948,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) if( child > 0 && o3tl::make_unsigned(child) < m_aStructure.size() ) { PDFStructureElement& rChild = m_aStructure[ child ]; - if (*rChild.m_oType != PDFWriter::NonStructElement) + if (*rChild.m_oType != vcl::pdf::StructElement::NonStructElement) { if( rChild.m_nParentElement == rEle.m_nOwnElement ) emitStructure( rChild ); @@ -2073,7 +2073,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) auto const it(m_aLinkPropertyMap.find(id)); assert(it != m_aLinkPropertyMap.end()); - if (*rEle.m_oType == PDFWriter::Form) + if (*rEle.m_oType == vcl::pdf::StructElement::Form) { assert(0 <= it->second && o3tl::make_unsigned(it->second) < m_aWidgets.size()); AppendAnnotKid(rEle, m_aWidgets[it->second]); @@ -10715,68 +10715,67 @@ void PDFWriterImpl::setOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID ) m_aOutline[nItem].m_nDestID = nDestID; } -const char* PDFWriterImpl::getStructureTag( PDFWriter::StructElement eType ) -{ - static constexpr auto aTagStrings = frozen::make_unordered_map<PDFWriter::StructElement, const char*>({ - { PDFWriter::NonStructElement, "NonStruct" }, - { PDFWriter::Document, "Document" }, - { PDFWriter::Part, "Part" }, - { PDFWriter::Article, "Art" }, - { PDFWriter::Section, "Sect" }, - { PDFWriter::Division, "Div" }, - { PDFWriter::BlockQuote, "BlockQuote" }, - { PDFWriter::Caption, "Caption" }, - { PDFWriter::TOC, "TOC" }, - { PDFWriter::TOCI, "TOCI" }, - { PDFWriter::Index, "Index" }, - { PDFWriter::Paragraph, "P" }, - { PDFWriter::Heading, "H" }, - { PDFWriter::H1, "H1" }, - { PDFWriter::H2, "H2" }, - { PDFWriter::H3, "H3" }, - { PDFWriter::H4, "H4" }, - { PDFWriter::H5, "H5" }, - { PDFWriter::H6, "H6" }, - { PDFWriter::List, "L" }, - { PDFWriter::ListItem, "LI" }, - { PDFWriter::LILabel, "Lbl" }, - { PDFWriter::LIBody, "LBody" }, - { PDFWriter::Table, "Table" }, - { PDFWriter::TableRow, "TR" }, - { PDFWriter::TableHeader, "TH" }, - { PDFWriter::TableData, "TD" }, - { PDFWriter::Span, "Span" }, - { PDFWriter::Quote, "Quote" }, - { PDFWriter::Note, "Note" }, - { PDFWriter::Reference, "Reference" }, - { PDFWriter::BibEntry, "BibEntry" }, - { PDFWriter::Code, "Code" }, - { PDFWriter::Link, "Link" }, - { PDFWriter::Annot, "Annot" }, - { PDFWriter::Ruby, "Ruby" }, - { PDFWriter::RB, "RB" }, - { PDFWriter::RT, "RT" }, - { PDFWriter::RP, "RP" }, - { PDFWriter::Warichu, "Warichu" }, - { PDFWriter::WT, "WT" }, - { PDFWriter::WP, "WP" }, - { PDFWriter::Figure, "Figure" }, - { PDFWriter::Formula, "Formula"}, - { PDFWriter::Form, "Form" } +const char* PDFWriterImpl::getStructureTag(vcl::pdf::StructElement eType ) +{ + using namespace vcl::pdf; + + static constexpr auto constTagStrings = frozen::make_unordered_map<StructElement, const char*>({ + { StructElement::NonStructElement, "NonStruct" }, + { StructElement::Document, "Document" }, + { StructElement::Part, "Part" }, + { StructElement::Article, "Art" }, + { StructElement::Section, "Sect" }, + { StructElement::Division, "Div" }, + { StructElement::BlockQuote, "BlockQuote" }, + { StructElement::Caption, "Caption" }, + { StructElement::TOC, "TOC" }, + { StructElement::TOCI, "TOCI" }, + { StructElement::Index, "Index" }, + { StructElement::Paragraph, "P" }, + { StructElement::Heading, "H" }, + { StructElement::H1, "H1" }, + { StructElement::H2, "H2" }, + { StructElement::H3, "H3" }, + { StructElement::H4, "H4" }, + { StructElement::H5, "H5" }, + { StructElement::H6, "H6" }, + { StructElement::List, "L" }, + { StructElement::ListItem, "LI" }, + { StructElement::LILabel, "Lbl" }, + { StructElement::LIBody, "LBody" }, + { StructElement::Table, "Table" }, + { StructElement::TableRow, "TR" }, + { StructElement::TableHeader, "TH" }, + { StructElement::TableData, "TD" }, + { StructElement::Span, "Span" }, + { StructElement::Quote, "Quote" }, + { StructElement::Note, "Note" }, + { StructElement::Reference, "Reference" }, + { StructElement::BibEntry, "BibEntry" }, + { StructElement::Code, "Code" }, + { StructElement::Link, "Link" }, + { StructElement::Annot, "Annot" }, + { StructElement::Ruby, "Ruby" }, + { StructElement::RB, "RB" }, + { StructElement::RT, "RT" }, + { StructElement::RP, "RP" }, + { StructElement::Warichu, "Warichu" }, + { StructElement::WT, "WT" }, + { StructElement::WP, "WP" }, + { StructElement::Figure, "Figure" }, + { StructElement::Formula, "Formula"}, + { StructElement::Form, "Form" } }); - if (eType == PDFWriter::Annot - && m_aContext.Version < PDFWriter::PDFVersion::PDF_1_5) - { + if (m_aContext.Version < PDFWriter::PDFVersion::PDF_1_5 && eType == StructElement::Annot) return "Figure"; // fallback - } - auto it = aTagStrings.find( eType ); + auto iterator = constTagStrings.find(eType); - return it != aTagStrings.end() ? it->second : "Div"; + return iterator != constTagStrings.end() ? iterator->second : "Div"; } -void PDFWriterImpl::addRoleMap(const OString& aAlias, PDFWriter::StructElement eType) +void PDFWriterImpl::addRoleMap(const OString& aAlias, vcl::pdf::StructElement eType) { OString aTag = getStructureTag(eType); // For PDF/UA it's not allowed to map an alias with the same name. @@ -10793,7 +10792,7 @@ void PDFWriterImpl::beginStructureElementMCSeq() // Document = SwPageFrame => this is not *inside* the page content // stream so do not emit MCID! m_aStructure[m_nCurrentStructElement].m_oType && - *m_aStructure[m_nCurrentStructElement].m_oType != PDFWriter::Document && + *m_aStructure[m_nCurrentStructElement].m_oType != vcl::pdf::StructElement::Document && ! m_aStructure[ m_nCurrentStructElement ].m_bOpenMCSeq // already opened sequence ) { @@ -10824,7 +10823,7 @@ void PDFWriterImpl::beginStructureElementMCSeq() else if( ! m_bEmitStructure && m_aContext.Tagged && m_nCurrentStructElement > 0 && m_aStructure[m_nCurrentStructElement].m_oType && - *m_aStructure[m_nCurrentStructElement].m_oType == PDFWriter::NonStructElement && + *m_aStructure[m_nCurrentStructElement].m_oType == vcl::pdf::StructElement::NonStructElement && ! m_aStructure[ m_nCurrentStructElement ].m_bOpenMCSeq // already opened sequence ) { @@ -10857,7 +10856,7 @@ void PDFWriterImpl::endStructureElementMCSeq(EndMode const endMode) && m_aStructure[m_nCurrentStructElement].m_oType && (m_bEmitStructure || (endMode != EndMode::OnlyStruct - && m_aStructure[m_nCurrentStructElement].m_oType == PDFWriter::NonStructElement)) + && m_aStructure[m_nCurrentStructElement].m_oType == vcl::pdf::StructElement::NonStructElement)) && m_aStructure[m_nCurrentStructElement].m_bOpenMCSeq) { writeBuffer( "EMC\n" ); @@ -10875,7 +10874,7 @@ bool PDFWriterImpl::checkEmitStructure() while( nEle > 0 && o3tl::make_unsigned(nEle) < m_aStructure.size() ) { if (m_aStructure[nEle].m_oType - && *m_aStructure[nEle].m_oType == PDFWriter::NonStructElement) + && *m_aStructure[nEle].m_oType == vcl::pdf::StructElement::NonStructElement) { bEmit = false; break; @@ -10901,13 +10900,13 @@ sal_Int32 PDFWriterImpl::ensureStructureElement() } void PDFWriterImpl::initStructureElement(sal_Int32 const id, - PDFWriter::StructElement const eType, std::u16string_view const rAlias) + vcl::pdf::StructElement const eType, std::u16string_view const rAlias) { if( ! m_aContext.Tagged ) return; if( m_nCurrentStructElement == 0 && - eType != PDFWriter::Document && eType != PDFWriter::NonStructElement ) + eType != vcl::pdf::StructElement::Document && eType != vcl::pdf::StructElement::NonStructElement ) { // struct tree root hit, but not beginning document // this might happen with setCurrentStructureElement @@ -10918,7 +10917,7 @@ void PDFWriterImpl::initStructureElement(sal_Int32 const id, auto it = std::find_if(rRootChildren.begin(), rRootChildren.end(), [&](sal_Int32 nElement) { return m_aStructure[nElement].m_oType - && *m_aStructure[nElement].m_oType == PDFWriter::Document; }); + && *m_aStructure[nElement].m_oType == vcl::pdf::StructElement::Document; }); if( it != rRootChildren.end() ) { m_nCurrentStructElement = *it; @@ -10946,7 +10945,7 @@ void PDFWriterImpl::initStructureElement(sal_Int32 const id, m_aStructure[m_nCurrentStructElement].m_aChildren.push_back(id); // handle alias names - if( !rAlias.empty() && eType != PDFWriter::NonStructElement ) + if( !rAlias.empty() && eType != vcl::pdf::StructElement::NonStructElement ) { OStringBuffer aNameBuf( rAlias.size() ); COSWriter::appendName( rAlias, aNameBuf ); @@ -10955,13 +10954,13 @@ void PDFWriterImpl::initStructureElement(sal_Int32 const id, addRoleMap(aAliasName, eType); } - if (m_bEmitStructure && eType != PDFWriter::NonStructElement) // don't create nonexistent objects + if (m_bEmitStructure && eType != vcl::pdf::StructElement::NonStructElement) // don't create nonexistent objects { rEle.m_nObject = createObject(); // update parent's kids list m_aStructure[ rEle.m_nParentElement ].m_aKids.emplace_back(ObjReference{rEle.m_nObject}); // ISO 14289-1:2014, Clause: 7.9 - if (*rEle.m_oType == PDFWriter::Note) + if (*rEle.m_oType == vcl::pdf::StructElement::Note) { m_StructElemObjsWithID.insert(rEle.m_nObject); } @@ -11106,7 +11105,7 @@ void removePlaceholderSE(std::vector<PDFStructureElement> & rStructure, PDFStruc void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) { if (rEle.m_nOwnElement != rEle.m_nParentElement - && *rEle.m_oType == PDFWriter::NonStructElement) + && *rEle.m_oType == vcl::pdf::StructElement::NonStructElement) { return; } @@ -11117,7 +11116,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) if( child > 0 && o3tl::make_unsigned(child) < m_aStructure.size() ) { PDFStructureElement& rChild = m_aStructure[ child ]; - if (*rChild.m_oType != PDFWriter::NonStructElement) + if (*rChild.m_oType != vcl::pdf::StructElement::NonStructElement) { //triggered when a child of the rEle element is found assert(rChild.m_nParentElement == rEle.m_nOwnElement); @@ -11152,7 +11151,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) // add Div in RoleMap, in case no one else did (TODO: is it needed? Is it dangerous?) OString aAliasName("Div"_ostr); - addRoleMap(aAliasName, PDFWriter::Division); + addRoleMap(aAliasName, vcl::pdf::StructElement::Division); while( rEle.m_aKids.size() > ncMaxPDFArraySize ) { @@ -11161,7 +11160,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) m_aStructure.emplace_back( ); PDFStructureElement& rEleNew = m_aStructure.back(); rEleNew.m_aAlias = aAliasName; - rEleNew.m_oType.emplace(PDFWriter::Division); // a new Div type container + rEleNew.m_oType.emplace(vcl::pdf::StructElement::Division); // a new Div type container rEleNew.m_nOwnElement = nNewId; rEleNew.m_nParentElement = nCurrentStructElement; //inherit the same page as the first child to be reparented @@ -11244,9 +11243,9 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr || (m_aContext.Tagged && (0 == m_aStructure[m_nCurrentStructElement].m_nParentElement || !m_aStructure[m_aStructure[m_nCurrentStructElement].m_nParentElement].m_oType - || *m_aStructure[m_aStructure[m_nCurrentStructElement].m_nParentElement].m_oType != PDFWriter::NonStructElement)))) + || *m_aStructure[m_aStructure[m_nCurrentStructElement].m_nParentElement].m_oType != vcl::pdf::StructElement::NonStructElement)))) { - PDFWriter::StructElement const eType = *m_aStructure[m_nCurrentStructElement].m_oType; + vcl::pdf::StructElement const eType = *m_aStructure[m_nCurrentStructElement].m_oType; switch( eAttr ) { case PDFWriter::Placement: @@ -11271,22 +11270,22 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eVal == PDFWriter::End || eVal == PDFWriter::Justify ) { - if( eType == PDFWriter::Paragraph || - eType == PDFWriter::Heading || - eType == PDFWriter::H1 || - eType == PDFWriter::H2 || - eType == PDFWriter::H3 || - eType == PDFWriter::H4 || - eType == PDFWriter::H5 || - eType == PDFWriter::H6 || - eType == PDFWriter::List || - eType == PDFWriter::ListItem || - eType == PDFWriter::LILabel || - eType == PDFWriter::LIBody || - eType == PDFWriter::Table || - eType == PDFWriter::TableRow || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Heading || + eType == vcl::pdf::StructElement::H1 || + eType == vcl::pdf::StructElement::H2 || + eType == vcl::pdf::StructElement::H3 || + eType == vcl::pdf::StructElement::H4 || + eType == vcl::pdf::StructElement::H5 || + eType == vcl::pdf::StructElement::H6 || + eType == vcl::pdf::StructElement::List || + eType == vcl::pdf::StructElement::ListItem || + eType == vcl::pdf::StructElement::LILabel || + eType == vcl::pdf::StructElement::LIBody || + eType == vcl::pdf::StructElement::Table || + eType == vcl::pdf::StructElement::TableRow || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } @@ -11296,12 +11295,12 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr case PDFWriter::Height: if( eVal == PDFWriter::Auto ) { - if( eType == PDFWriter::Figure || - eType == PDFWriter::Formula || - eType == PDFWriter::Form || - eType == PDFWriter::Table || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::Figure || + eType == vcl::pdf::StructElement::Formula || + eType == vcl::pdf::StructElement::Form || + eType == vcl::pdf::StructElement::Table || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } @@ -11313,8 +11312,8 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eVal == PDFWriter::After || eVal == PDFWriter::Justify ) { - if( eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } @@ -11325,8 +11324,8 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eVal == PDFWriter::Center || eVal == PDFWriter::End ) { - if( eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } @@ -11337,29 +11336,29 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eVal == PDFWriter::Auto ) { // only for ILSE and BLSE - if( eType == PDFWriter::Paragraph || - eType == PDFWriter::Heading || - eType == PDFWriter::H1 || - eType == PDFWriter::H2 || - eType == PDFWriter::H3 || - eType == PDFWriter::H4 || - eType == PDFWriter::H5 || - eType == PDFWriter::H6 || - eType == PDFWriter::List || - eType == PDFWriter::ListItem || - eType == PDFWriter::LILabel || - eType == PDFWriter::LIBody || - eType == PDFWriter::Table || - eType == PDFWriter::TableRow || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData || - eType == PDFWriter::Span || - eType == PDFWriter::Quote || - eType == PDFWriter::Note || - eType == PDFWriter::Reference || - eType == PDFWriter::BibEntry || - eType == PDFWriter::Code || - eType == PDFWriter::Link ) + if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Heading || + eType == vcl::pdf::StructElement::H1 || + eType == vcl::pdf::StructElement::H2 || + eType == vcl::pdf::StructElement::H3 || + eType == vcl::pdf::StructElement::H4 || + eType == vcl::pdf::StructElement::H5 || + eType == vcl::pdf::StructElement::H6 || + eType == vcl::pdf::StructElement::List || + eType == vcl::pdf::StructElement::ListItem || + eType == vcl::pdf::StructElement::LILabel || + eType == vcl::pdf::StructElement::LIBody || + eType == vcl::pdf::StructElement::Table || + eType == vcl::pdf::StructElement::TableRow || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData || + eType == vcl::pdf::StructElement::Span || + eType == vcl::pdf::StructElement::Quote || + eType == vcl::pdf::StructElement::Note || + eType == vcl::pdf::StructElement::Reference || + eType == vcl::pdf::StructElement::BibEntry || + eType == vcl::pdf::StructElement::Code || + eType == vcl::pdf::StructElement::Link) { bInsert = true; } @@ -11372,29 +11371,29 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eVal == PDFWriter::LineThrough ) { // only for ILSE and BLSE - if( eType == PDFWriter::Paragraph || - eType == PDFWriter::Heading || - eType == PDFWriter::H1 || - eType == PDFWriter::H2 || - eType == PDFWriter::H3 || - eType == PDFWriter::H4 || - eType == PDFWriter::H5 || - eType == PDFWriter::H6 || - eType == PDFWriter::List || - eType == PDFWriter::ListItem || - eType == PDFWriter::LILabel || - eType == PDFWriter::LIBody || - eType == PDFWriter::Table || - eType == PDFWriter::TableRow || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData || - eType == PDFWriter::Span || - eType == PDFWriter::Quote || - eType == PDFWriter::Note || - eType == PDFWriter::Reference || - eType == PDFWriter::BibEntry || - eType == PDFWriter::Code || - eType == PDFWriter::Link ) + if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Heading || + eType == vcl::pdf::StructElement::H1 || + eType == vcl::pdf::StructElement::H2 || + eType == vcl::pdf::StructElement::H3 || + eType == vcl::pdf::StructElement::H4 || + eType == vcl::pdf::StructElement::H5 || + eType == vcl::pdf::StructElement::H6 || + eType == vcl::pdf::StructElement::List || + eType == vcl::pdf::StructElement::ListItem || + eType == vcl::pdf::StructElement::LILabel || + eType == vcl::pdf::StructElement::LIBody || + eType == vcl::pdf::StructElement::Table || + eType == vcl::pdf::StructElement::TableRow || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData || + eType == vcl::pdf::StructElement::Span || + eType == vcl::pdf::StructElement::Quote || + eType == vcl::pdf::StructElement::Note || + eType == vcl::pdf::StructElement::Reference || + eType == vcl::pdf::StructElement::BibEntry || + eType == vcl::pdf::StructElement::Code || + eType == vcl::pdf::StructElement::Link) { bInsert = true; } @@ -11403,7 +11402,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr case PDFWriter::Scope: if (eVal == PDFWriter::Row || eVal == PDFWriter::Column || eVal == PDFWriter::Both) { - if (eType == PDFWriter::TableHeader + if (eType == vcl::pdf::StructElement::TableHeader && PDFWriter::PDFVersion::PDF_1_5 <= m_aContext.Version) { bInsert = true; @@ -11414,7 +11413,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr if (eVal == PDFWriter::Pagination || eVal == PDFWriter::Layout || eVal == PDFWriter::Page) // + Background for PDF >= 1.7 { - if (eType == PDFWriter::NonStructElement) + if (eType == vcl::pdf::StructElement::NonStructElement) { bInsert = true; } @@ -11423,7 +11422,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr case PDFWriter::Subtype: if (eVal == PDFWriter::Header || eVal == PDFWriter::Footer || eVal == PDFWriter::Watermark) { - if (eType == PDFWriter::NonStructElement + if (eType == vcl::pdf::StructElement::NonStructElement && PDFWriter::PDFVersion::PDF_1_7 <= m_aContext.Version) { bInsert = true; @@ -11433,7 +11432,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr case PDFWriter::Role: if (eVal == PDFWriter::Rb || eVal == PDFWriter::Cb || eVal == PDFWriter::Pb || eVal == PDFWriter::Tv) { - if (eType == PDFWriter::Form + if (eType == vcl::pdf::StructElement::Form && PDFWriter::PDFVersion::PDF_1_7 <= m_aContext.Version) { bInsert = true; @@ -11443,7 +11442,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr case PDFWriter::RubyAlign: if (eVal == PDFWriter::RStart || eVal == PDFWriter::RCenter || eVal == PDFWriter::REnd || eVal == PDFWriter::RJustify || eVal == PDFWriter::RDistribute) { - if (eType == PDFWriter::RT + if (eType == vcl::pdf::StructElement::RT && PDFWriter::PDFVersion::PDF_1_5 <= m_aContext.Version) { bInsert = true; @@ -11453,7 +11452,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr case PDFWriter::RubyPosition: if (eVal == PDFWriter::RBefore || eVal == PDFWriter::RAfter || eVal == PDFWriter::RWarichu || eVal == PDFWriter::RInline) { - if (eType == PDFWriter::RT + if (eType == vcl::pdf::StructElement::RT && PDFWriter::PDFVersion::PDF_1_5 <= m_aContext.Version) { bInsert = true; @@ -11471,7 +11470,7 @@ bool PDFWriterImpl::setStructureAttribute( enum PDFWriter::StructAttribute eAttr eVal == PDFWriter::UpperAlpha || eVal == PDFWriter::LowerAlpha ) { - if( eType == PDFWriter::List ) + if( eType == vcl::pdf::StructElement::List ) bInsert = true; } break; @@ -11507,7 +11506,7 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib return true; } - PDFWriter::StructElement const eType = *m_aStructure[m_nCurrentStructElement].m_oType; + vcl::pdf::StructElement const eType = *m_aStructure[m_nCurrentStructElement].m_oType; switch( eAttr ) { case PDFWriter::SpaceBefore: @@ -11515,52 +11514,52 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib case PDFWriter::StartIndent: case PDFWriter::EndIndent: // just for BLSE - if( eType == PDFWriter::Paragraph || - eType == PDFWriter::Heading || - eType == PDFWriter::H1 || - eType == PDFWriter::H2 || - eType == PDFWriter::H3 || - eType == PDFWriter::H4 || - eType == PDFWriter::H5 || - eType == PDFWriter::H6 || - eType == PDFWriter::List || - eType == PDFWriter::ListItem || - eType == PDFWriter::LILabel || - eType == PDFWriter::LIBody || - eType == PDFWriter::Table || - eType == PDFWriter::TableRow || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Heading || + eType == vcl::pdf::StructElement::H1 || + eType == vcl::pdf::StructElement::H2 || + eType == vcl::pdf::StructElement::H3 || + eType == vcl::pdf::StructElement::H4 || + eType == vcl::pdf::StructElement::H5 || + eType == vcl::pdf::StructElement::H6 || + eType == vcl::pdf::StructElement::List || + eType == vcl::pdf::StructElement::ListItem || + eType == vcl::pdf::StructElement::LILabel || + eType == vcl::pdf::StructElement::LIBody || + eType == vcl::pdf::StructElement::Table || + eType == vcl::pdf::StructElement::TableRow || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } break; case PDFWriter::TextIndent: // paragraph like BLSE and additional elements - if( eType == PDFWriter::Paragraph || - eType == PDFWriter::Heading || - eType == PDFWriter::H1 || - eType == PDFWriter::H2 || - eType == PDFWriter::H3 || - eType == PDFWriter::H4 || - eType == PDFWriter::H5 || - eType == PDFWriter::H6 || - eType == PDFWriter::LILabel || - eType == PDFWriter::LIBody || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Heading || + eType == vcl::pdf::StructElement::H1 || + eType == vcl::pdf::StructElement::H2 || + eType == vcl::pdf::StructElement::H3 || + eType == vcl::pdf::StructElement::H4 || + eType == vcl::pdf::StructElement::H5 || + eType == vcl::pdf::StructElement::H6 || + eType == vcl::pdf::StructElement::LILabel || + eType == vcl::pdf::StructElement::LIBody || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } break; case PDFWriter::Width: case PDFWriter::Height: - if( eType == PDFWriter::Figure || - eType == PDFWriter::Formula || - eType == PDFWriter::Form || - eType == PDFWriter::Table || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::Figure || + eType == vcl::pdf::StructElement::Formula || + eType == vcl::pdf::StructElement::Form || + eType == vcl::pdf::StructElement::Table || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } @@ -11568,29 +11567,29 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib case PDFWriter::LineHeight: case PDFWriter::BaselineShift: // only for ILSE and BLSE - if( eType == PDFWriter::Paragraph || - eType == PDFWriter::Heading || - eType == PDFWriter::H1 || - eType == PDFWriter::H2 || - eType == PDFWriter::H3 || - eType == PDFWriter::H4 || - eType == PDFWriter::H5 || - eType == PDFWriter::H6 || - eType == PDFWriter::List || - eType == PDFWriter::ListItem || - eType == PDFWriter::LILabel || - eType == PDFWriter::LIBody || - eType == PDFWriter::Table || - eType == PDFWriter::TableRow || - eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData || - eType == PDFWriter::Span || - eType == PDFWriter::Quote || - eType == PDFWriter::Note || - eType == PDFWriter::Reference || - eType == PDFWriter::BibEntry || - eType == PDFWriter::Code || - eType == PDFWriter::Link ) + if (eType == vcl::pdf::StructElement::Paragraph || + eType == vcl::pdf::StructElement::Heading || + eType == vcl::pdf::StructElement::H1 || + eType == vcl::pdf::StructElement::H2 || + eType == vcl::pdf::StructElement::H3 || + eType == vcl::pdf::StructElement::H4 || + eType == vcl::pdf::StructElement::H5 || + eType == vcl::pdf::StructElement::H6 || + eType == vcl::pdf::StructElement::List || + eType == vcl::pdf::StructElement::ListItem || + eType == vcl::pdf::StructElement::LILabel || + eType == vcl::pdf::StructElement::LIBody || + eType == vcl::pdf::StructElement::Table || + eType == vcl::pdf::StructElement::TableRow || + eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData || + eType == vcl::pdf::StructElement::Span || + eType == vcl::pdf::StructElement::Quote || + eType == vcl::pdf::StructElement::Note || + eType == vcl::pdf::StructElement::Reference || + eType == vcl::pdf::StructElement::BibEntry || + eType == vcl::pdf::StructElement::Code || + eType == vcl::pdf::StructElement::Link) { bInsert = true; } @@ -11598,18 +11597,18 @@ bool PDFWriterImpl::setStructureAttributeNumerical( enum PDFWriter::StructAttrib case PDFWriter::RowSpan: case PDFWriter::ColSpan: // only for table cells - if( eType == PDFWriter::TableHeader || - eType == PDFWriter::TableData ) + if (eType == vcl::pdf::StructElement::TableHeader || + eType == vcl::pdf::StructElement::TableData) { bInsert = true; } break; case PDFWriter::LinkAnnotation: - if( eType == PDFWriter::Link ) + if (eType == vcl::pdf::StructElement::Link) bInsert = true; break; case PDFWriter::NoteAnnotation: - if (eType == PDFWriter::Annot) + if (eType == vcl::pdf::StructElement::Annot) bInsert = true; break; default: break; @@ -11639,12 +11638,12 @@ void PDFWriterImpl::setStructureBoundingBox( const tools::Rectangle& rRect ) return; assert(m_aStructure[m_nCurrentStructElement].m_oType); - PDFWriter::StructElement const eType = *m_aStructure[m_nCurrentStructElement].m_oType; - if( eType == PDFWriter::Figure || - eType == PDFWriter::Formula || - eType == PDFWriter::Form || - eType == PDFWriter::Division || - eType == PDFWriter::Table ) + vcl::pdf::StructElement const eType = *m_aStructure[m_nCurrentStructElement].m_oType; + if (eType == vcl::pdf::StructElement::Figure || + eType == vcl::pdf::StructElement::Formula || + eType == vcl::pdf::StructElement::Form || + eType == vcl::pdf::StructElement::Division || + eType == vcl::pdf::StructElement::Table) { m_aStructure[ m_nCurrentStructElement ].m_aBBox = rRect; // convert to default user space now, since the mapmode may change |