drawinglayer/source/primitive2d/structuretagprimitive2d.cxx | 2 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 87 +- drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx | 4 drawinglayer/source/tools/primitive2dxmldump.cxx | 3 editeng/source/editeng/impedit3.cxx | 2 filter/source/pdf/pdfexport.cxx | 4 include/drawinglayer/primitive2d/structuretagprimitive2d.hxx | 6 include/vcl/pdfextoutdevdata.hxx | 4 include/vcl/pdfwriter.hxx | 52 - svx/source/sdr/contact/viewobjectcontact.cxx | 22 svx/source/table/viewcontactoftableobj.cxx | 6 sw/inc/EnhancedPDFExportHelper.hxx | 6 sw/source/core/text/EnhancedPDFExportHelper.cxx | 174 ++-- sw/source/core/text/itrform2.cxx | 2 sw/source/core/text/porfld.cxx | 2 sw/source/uibase/docvw/AnnotationWin2.cxx | 2 vcl/inc/pdf/pdfwriter_impl.hxx | 10 vcl/source/gdi/pdfextoutdevdata.cxx | 9 vcl/source/gdi/pdfwriter.cxx | 2 vcl/source/gdi/pdfwriter_impl.cxx | 432 +++++------ 20 files changed, 419 insertions(+), 412 deletions(-)
New commits: commit d9eaa53093c08e5d9e436428b28339496b4cd020 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Jan 9 09:23:41 2025 +0900 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Feb 6 10:24:41 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 <qui...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180877 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx index 47af55ab9b57..5655d482ea09 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, Primitive2DContainer&& aChildren, diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 61958120474a..e2129f53f654 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -498,7 +498,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) { @@ -509,14 +509,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); } // init static break iterator @@ -1139,7 +1139,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) { @@ -1190,7 +1190,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D( if (mpPDFExtOutDevData) { // no corresponding PDF Form, use Figure instead - mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Figure); + mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Figure); mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, vcl::PDFWriter::Block); auto const range(rControlPrimitive.getB2DRange(getViewInformation2D())); tools::Rectangle const aLogicRect( @@ -1334,8 +1334,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 @@ -1346,7 +1346,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 @@ -1374,7 +1374,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); @@ -1399,8 +1399,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) @@ -1430,14 +1430,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 @@ -1480,8 +1480,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 @@ -2548,8 +2548,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()) @@ -2572,26 +2572,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; @@ -2600,10 +2600,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( @@ -2615,11 +2615,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); @@ -2630,7 +2630,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 c315281ebf61..54bd80842fa5 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(); @@ -193,7 +193,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 54569c4cf7f5..c93d5c0bc77b 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -984,8 +984,7 @@ void Primitive2dXmlDump::decomposeAndWrite( = dynamic_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 096550bde30d..c27f9355d9f4 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3411,7 +3411,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 = pPortion->GetHeight(); if ( pPortion->IsVisible() && ( diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 7dc2426a1e75..92e813349435 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -1354,7 +1354,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); @@ -1452,7 +1452,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 0d7e6ba57735..2857ea570b4b 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; @@ -57,7 +57,7 @@ namespace drawinglayer::primitive2d public: /// constructor StructureTagPrimitive2D( - const vcl::PDFWriter::StructElement& rStructureElement, + const vcl::pdf::StructElement& rStructureElement, bool bBackground, bool bIsImage, Primitive2DContainer&& aChildren, @@ -65,7 +65,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 isTaggedSdrObject() const; diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx index e5615da7b260..a7422d3a441f 100644 --- a/include/vcl/pdfextoutdevdata.hxx +++ b/include/vcl/pdfextoutdevdata.hxx @@ -383,9 +383,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 0748bf6df933..dc72cb5c44e8 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -153,6 +153,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 VCL_DLLPUBLIC PDFWriter { ScopedVclPtr<PDFWriterImpl> xImplementation; @@ -202,29 +229,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 @@ -1154,7 +1158,7 @@ public: */ void BeginStructureElement(sal_Int32 id); 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); /** end the current logical structure element diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 55ea9681785d..3c25c8dea11f 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -365,7 +365,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)); @@ -377,22 +377,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()); @@ -408,7 +408,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()); @@ -434,7 +434,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, std::move(rNewPrimitiveSequence)) diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index ac7472c7126c..6ed5101149f3 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -377,8 +377,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, @@ -393,7 +393,7 @@ namespace sdr::contact { row = drawinglayer::primitive2d::Primitive2DContainer { new drawinglayer::primitive2d::StructureTagPrimitive2D( - vcl::PDFWriter::TableRow, + vcl::pdf::StructElement::TableRow, pPage->IsMasterPage(), false, std::move(row)) }; 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 4ccb43e053b8..d95a26bc1941 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -409,7 +409,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(); @@ -535,7 +535,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); @@ -550,7 +550,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); @@ -593,12 +593,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; @@ -635,7 +635,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; @@ -664,17 +664,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 = @@ -686,15 +686,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 = @@ -702,21 +702,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 = @@ -728,8 +728,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 = @@ -737,7 +737,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; @@ -745,7 +745,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 @@ -765,8 +765,8 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bPlacement ) { - eVal = vcl::PDFWriter::TableHeader == eType || - vcl::PDFWriter::TableData == eType ? + eVal = vcl::pdf::StructElement::TableHeader == eType || + vcl::pdf::StructElement::TableData == eType ? vcl::PDFWriter::Inline : vcl::PDFWriter::Block; @@ -877,10 +877,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()); } @@ -941,11 +941,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; @@ -957,21 +957,21 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) } break; - case vcl::PDFWriter::Link : + case vcl::pdf::StructElement::Link: bTextDecorationType = bBaselineShift = bLinkAttribute = bLanguage = true; break; - case vcl::PDFWriter::BibEntry : + 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 = {}; @@ -1073,7 +1073,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) LinkLinkLink(*mpPDFExtOutDevData, aPorRect); } } - 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()); @@ -1257,16 +1257,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); } } } @@ -1298,7 +1298,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // Document: Document - nPDFType = vcl::PDFWriter::Document; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Document); aPDFType = aDocumentString; break; @@ -1307,14 +1307,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; @@ -1324,7 +1324,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; @@ -1360,7 +1360,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()) @@ -1370,19 +1370,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; } } @@ -1401,7 +1401,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; @@ -1421,14 +1421,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; } @@ -1436,7 +1436,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sStyleName == aCaption) { - nPDFType = vcl::PDFWriter::Caption; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Caption); aPDFType = aCaptionString; } @@ -1444,7 +1444,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sParentStyleName == aCaption) { - nPDFType = vcl::PDFWriter::Caption; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Caption); aPDFType = sStyleName + aCaptionString; } @@ -1452,7 +1452,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sStyleName == aHeading) { - nPDFType = vcl::PDFWriter::Heading; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Heading); aPDFType = aHString; } @@ -1504,7 +1504,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 @@ -1520,7 +1520,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); } } } @@ -1531,7 +1531,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // TabFrame: Table - nPDFType = vcl::PDFWriter::Table; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Table); aPDFType = aTableString; { @@ -1585,12 +1585,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; @@ -1602,12 +1602,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; } } @@ -1623,7 +1623,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 @@ -1632,7 +1632,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()) { @@ -1651,18 +1651,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; } } @@ -1673,7 +1673,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if ( USHRT_MAX != nPDFType ) { - BeginTag( static_cast<vcl::PDFWriter::StructElement>(nPDFType), aPDFType ); + BeginTag(vcl::pdf::StructElement(nPDFType), aPDFType ); } } @@ -1840,7 +1840,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; @@ -1864,7 +1864,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); @@ -1877,7 +1877,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() { if (!isContinueSpan) { - nPDFType = vcl::PDFWriter::Quote; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Quote); aPDFType = aQuoteString; CreateCurrentSpan(rInf, sStyleName); } @@ -1886,7 +1886,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() { if (!isContinueSpan) { - nPDFType = vcl::PDFWriter::Code; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Code); aPDFType = aCodeString; CreateCurrentSpan(rInf, sStyleName); } @@ -1906,7 +1906,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 @@ -1918,7 +1918,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() break; case PortionType::Footnote : - nPDFType = vcl::PDFWriter::Link; + nPDFType = sal_uInt16(vcl::pdf::StructElement::Link); aPDFType = aLinkString; break; @@ -1934,12 +1934,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; } } @@ -1955,15 +1955,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; } @@ -1974,15 +1974,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; } @@ -1996,7 +1996,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; } @@ -2007,7 +2007,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; @@ -2016,14 +2016,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 2c0640aa8979..2c4af9e717af 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1159,7 +1159,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 d2ae4be00d1b..48fc0d05e530 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -1449,7 +1449,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 c42cd5fc593b..70b29c739165 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -167,7 +167,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 0da6ad7698af..33b696fbbbbc 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -570,7 +570,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 @@ -683,8 +683,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 @@ -844,7 +844,7 @@ private: /* the buffer where the data are encrypted, dynamically allocated */ std::vector<sal_uInt8> m_vEncryptionBuffer; - void addRoleMap(OString aAlias, PDFWriter::StructElement eType); + void addRoleMap(OString aAlias, vcl::pdf::StructElement eType); void checkAndEnableStreamEncryption( sal_Int32 nObject ) override; @@ -1282,7 +1282,7 @@ public: void createNote( const tools::Rectangle& rRect, 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 168a03860020..f08866d60a59 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -103,8 +103,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; }; @@ -761,7 +762,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 @@ -776,7 +777,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 aa1a52d8b8bc..ed728cb3d007 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -396,7 +396,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 871bc328ac87..264d4ed6d5da 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1948,7 +1948,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; } @@ -1958,7 +1958,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 ); @@ -2101,7 +2101,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]); @@ -10698,57 +10698,59 @@ 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_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 aTagStrings = frozen::make_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 + if (eType == StructElement::Annot && m_aContext.Version < PDFWriter::PDFVersion::PDF_1_5) { return "Figure"; // fallback @@ -10759,7 +10761,7 @@ const char* PDFWriterImpl::getStructureTag( PDFWriter::StructElement eType ) return it != aTagStrings.end() ? it->second : "Div"; } -void PDFWriterImpl::addRoleMap(OString aAlias, PDFWriter::StructElement eType) +void PDFWriterImpl::addRoleMap(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. @@ -10776,7 +10778,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 ) { @@ -10807,7 +10809,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 ) { @@ -10840,7 +10842,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 " ); @@ -10858,7 +10860,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; @@ -10887,13 +10889,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 @@ -10904,7 +10906,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; @@ -10932,7 +10934,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 ); @@ -10941,13 +10943,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); } @@ -11092,7 +11094,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; } @@ -11103,7 +11105,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); @@ -11138,7 +11140,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 ) { @@ -11147,7 +11149,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 @@ -11230,9 +11232,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: @@ -11257,22 +11259,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; } @@ -11282,12 +11284,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; } @@ -11299,8 +11301,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; } @@ -11311,8 +11313,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; } @@ -11323,29 +11325,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; } @@ -11358,29 +11360,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; } @@ -11389,7 +11391,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; @@ -11400,7 +11402,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; } @@ -11409,7 +11411,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; @@ -11419,7 +11421,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; @@ -11429,7 +11431,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; @@ -11439,7 +11441,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; @@ -11457,7 +11459,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; @@ -11493,7 +11495,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: @@ -11501,52 +11503,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; } @@ -11554,29 +11556,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; } @@ -11584,14 +11586,14 @@ 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 ) -e ... etc. - the rest is truncated