diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-11-30 13:59:53 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-12-01 17:01:20 +0100 |
commit | 56ff8262d8ace8fd99326e290597cb901654ea11 (patch) | |
tree | 75eaa8bfe45414fdaabe2164aaaa2c014c71c2d2 | |
parent | 336602a15d481c4502e66778aec8d37727922152 (diff) |
tdf#135192 svx: PDF/UA export: implement tags for SdrTableObj
There seems to be no way to check for isExportTaggedPDF() in
ViewContactOfTableObj::createViewIndependentPrimitive2DSequence()
so simply always add the tags.
Change-Id: I816ed1f3811c4efad6ca28366591d135bf823c5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143499
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontact.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/viewcontactoftableobj.cxx | 30 | ||||
-rw-r--r-- | vcl/qa/cppunit/pdfexport/data/tdf135192-1.fodp | 239 | ||||
-rw-r--r-- | vcl/qa/cppunit/pdfexport/pdfexport.cxx | 95 |
4 files changed, 364 insertions, 2 deletions
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 8580603850ea..9d88819a9fe2 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -400,6 +400,8 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr { if ( nIdentifier == SdrObjKind::Group ) eElement = vcl::PDFWriter::Section; + else if (nIdentifier == SdrObjKind::Table) + eElement = vcl::PDFWriter::Table; else if ( nIdentifier == SdrObjKind::TitleText ) eElement = vcl::PDFWriter::Heading; else if ( nIdentifier == SdrObjKind::OutlineText ) diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 2d71f83ef337..df271a3e2404 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -33,8 +33,10 @@ #include <drawinglayer/attribute/sdrlineattribute.hxx> #include <drawinglayer/attribute/sdrshadowattribute.hxx> #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <drawinglayer/primitive2d/structuretagprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <svx/svdpage.hxx> #include <svx/framelink.hxx> #include <svx/framelinkarray.hxx> #include <svx/sdooitm.hxx> @@ -217,6 +219,7 @@ namespace sdr::contact const sal_Int32 nRowCount(xTable->getRowCount()); const sal_Int32 nColCount(xTable->getColumnCount()); const sal_Int32 nAllCount(nRowCount * nColCount); + SdrPage const*const pPage(rTableObj.getSdrPageFromSdrObject()); if(nAllCount) { @@ -230,7 +233,7 @@ namespace sdr::contact // GetGeoRect() to not trigger any calculations. It's the unrotated geometry. const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(rTableObj.GetGeoRect()); - // To create the CellBorderPrimitives, use the tolling from svx::frame::Array + // To create the CellBorderPrimitives, use the tooling from svx::frame::Array // which is capable of creating the needed visualization. Fill it during the // anyways needed run over the table. svx::frame::Array aArray; @@ -241,11 +244,13 @@ namespace sdr::contact // create single primitives per cell for(aCellPos.mnRow = 0; aCellPos.mnRow < nRowCount; aCellPos.mnRow++) { + drawinglayer::primitive2d::Primitive2DContainer row; // add RowHeight to CellBorderArray for primitive creation aArray.SetRowHeight(aCellPos.mnRow, rTableLayouter.getRowHeight(aCellPos.mnRow)); for(aCellPos.mnCol = 0; aCellPos.mnCol < nColCount; aCellPos.mnCol++) { + drawinglayer::primitive2d::Primitive2DContainer cell; // add ColWidth to CellBorderArray for primitive creation, only // needs to be done in the 1st run if(0 == aCellPos.mnRow) @@ -324,7 +329,7 @@ namespace sdr::contact const drawinglayer::primitive2d::Primitive2DReference xCellReference( new drawinglayer::primitive2d::SdrCellPrimitive2D( aCellMatrix, aAttribute)); - aRetval.append(xCellReference); + cell.append(xCellReference); } // Create cell primitive without text. @@ -347,7 +352,28 @@ namespace sdr::contact aRetvalForShadow.append(xCellReference); } } + if (pPage) + { + cell = drawinglayer::primitive2d::Primitive2DContainer { + new drawinglayer::primitive2d::StructureTagPrimitive2D( + vcl::PDFWriter::TableData, + pPage->IsMasterPage(), + false, + std::move(cell)) }; + } + row.append(cell); + } + + if (pPage) + { + row = drawinglayer::primitive2d::Primitive2DContainer { + new drawinglayer::primitive2d::StructureTagPrimitive2D( + vcl::PDFWriter::TableRow, + pPage->IsMasterPage(), + false, + std::move(row)) }; } + aRetval.append(row); } // now create all CellBorderPrimitives diff --git a/vcl/qa/cppunit/pdfexport/data/tdf135192-1.fodp b/vcl/qa/cppunit/pdfexport/data/tdf135192-1.fodp new file mode 100644 index 000000000000..6168dd2a28dd --- /dev/null +++ b/vcl/qa/cppunit/pdfexport/data/tdf135192-1.fodp @@ -0,0 +1,239 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.presentation"> + <office:meta><meta:creation-date>2020-07-27T11:44:30.444393550</meta:creation-date><meta:editing-duration>PT2M31S</meta:editing-duration><meta:editing-cycles>2</meta:editing-cycles><meta:generator>LibreOfficeDev/7.5.0.0.alpha1$Linux_X86_64 LibreOffice_project/0c0fef37f8ea5528584324f72328f23b7fcc92d7</meta:generator><dc:title>Impress</dc:title><dc:date>2020-07-27T11:47:01.552127285</dc:date><meta:document-statistic meta:object-count="29"/></office:meta> + <office:font-face-decls> + <style:font-face style:name="Amiri" svg:font-family="Amiri" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="roman" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <draw:gradient draw:name="Filled" draw:style="linear" draw:start-color="#ffffff" draw:end-color="#cccccc" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="30deg" draw:border="0%"/> + <draw:gradient draw:name="Filled_20_Blue" draw:display-name="Filled Blue" draw:style="linear" draw:start-color="#729fcf" draw:end-color="#355269" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="30deg" draw:border="0%"/> + <draw:gradient draw:name="Filled_20_Green" draw:display-name="Filled Green" draw:style="linear" draw:start-color="#77bc65" draw:end-color="#127622" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="30deg" draw:border="0%"/> + <draw:gradient draw:name="Filled_20_Red" draw:display-name="Filled Red" draw:style="linear" draw:start-color="#ff6d6d" draw:end-color="#c9211e" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="30deg" draw:border="0%"/> + <draw:gradient draw:name="Filled_20_Yellow" draw:display-name="Filled Yellow" draw:style="linear" draw:start-color="#ffde59" draw:end-color="#b47804" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="30deg" draw:border="0%"/> + <draw:gradient draw:name="Shapes" draw:style="rectangular" draw:cx="50%" draw:cy="50%" draw:start-color="#cccccc" draw:end-color="#ffffff" draw:start-intensity="100%" draw:end-intensity="100%" draw:angle="0deg" draw:border="0%"/> + <draw:marker draw:name="Arrow" svg:viewBox="0 0 20 30" svg:d="M10 0l-10 30h20z"/> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465af" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" style:writing-mode="lr-tb"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:punctuation-wrap="simple" style:line-break="strict" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="0%" style:font-name="Liberation Sans" fo:font-size="24pt" fo:language="en" fo:country="GB" style:font-name-asian="Amiri" style:font-size-asian="24pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Amiri" style:font-size-complex="24pt" style:language-complex="ar" style:country-complex="SA"/> + </style:default-style> + <style:style style:name="standard" style:family="graphic"> + <style:graphic-properties draw:stroke="solid" svg:stroke-width="0cm" svg:stroke-color="#3465a4" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:marker-end-width="0.2cm" draw:marker-end-center="false" draw:fill="solid" draw:fill-color="#729fcf" draw:textarea-horizontal-align="justify" fo:padding-top="0.125cm" fo:padding-bottom="0.125cm" fo:padding-left="0.25cm" fo:padding-right="0.25cm" draw:shadow="hidden" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"> + <text:list-style style:name="standard"> + <text:list-level-style-bullet text:level="1" text:bullet-char="●"> + <style:list-level-properties text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="2" text:bullet-char="●"> + <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="3" text:bullet-char="●"> + <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="4" text:bullet-char="●"> + <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" text:bullet-char="●"> + <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" text:bullet-char="●"> + <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" text:bullet-char="●"> + <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" text:bullet-char="●"> + <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" text:bullet-char="●"> + <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" text:bullet-char="●"> + <style:list-level-properties text:space-before="5.4cm" text:min-label-width="0.6cm"/> + <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/> + </text:list-level-style-bullet> + </text:list-style> + </style:graphic-properties> + <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-indent="0cm"/> + <style:text-properties fo:font-variant="normal" fo:text-transform="none" style:use-window-font-color="true" loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="0%" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="18pt" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:letter-kerning="true" style:text-emphasize="none" style:font-relief="none" style:text-overline-style="none" style:text-overline-color="font-color"/> + </style:style> + <style:style style:name="default" style:family="table-cell"> + <loext:graphic-properties draw:fill="solid" draw:fill-color="#ccccff" draw:textarea-horizontal-align="left" draw:textarea-vertical-align="top" fo:padding-top="0.13cm" fo:padding-bottom="0.13cm" fo:padding-left="0.25cm" fo:padding-right="0.25cm"/> + <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-indent="0cm" fo:border="0.03pt solid #ffffff"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="0%" style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="18pt" style:letter-kerning="true" style:font-name-asian="Amiri" style:font-family-asian="Amiri" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="18pt" style:font-name-complex="Amiri" style:font-family-complex="Amiri" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="18pt"/> + </style:style> + <style:style style:name="gray1" style:family="table-cell" style:parent-style-name="default"> + <loext:graphic-properties draw:fill="solid" draw:fill-color="#e6e6e6"/> + </style:style> + <style:style style:name="gray2" style:family="table-cell" style:parent-style-name="default"> + <loext:graphic-properties draw:fill="solid" draw:fill-color="#cccccc"/> + </style:style> + <style:style style:name="gray3" style:family="table-cell" style:parent-style-name="default"> + <loext:graphic-properties draw:fill="solid" draw:fill-color="#b3b3b3"/> + </style:style> + <table:table-template table:name="default"> + <table:first-row table:style-name="gray3"/> + <table:last-row table:style-name="gray3"/> + <table:first-column table:style-name="gray3"/> + <table:last-column table:style-name="gray3"/> + <table:body table:style-name="gray1"/> + <table:odd-rows table:style-name="gray2"/> + <table:odd-columns table:style-name="gray2"/> + </table:table-template> + <style:style style:name="Impress1-notes" style:family="presentation"> + <style:graphic-properties draw:stroke="none" draw:fill="none"/> + <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="0cm"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="0%" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="20pt" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:letter-kerning="true" style:text-emphasize="none" style:font-relief="none" style:text-overline-style="none" style:text-overline-color="font-color"/> + </style:style> + <style:presentation-page-layout style:name="AL0T26"> + <presentation:placeholder presentation:object="handout" svg:x="2.058cm" svg:y="1.743cm" svg:width="10.556cm" svg:height="-0.231cm"/> + <presentation:placeholder presentation:object="handout" svg:x="15.414cm" svg:y="1.743cm" svg:width="10.556cm" svg:height="-0.231cm"/> + <presentation:placeholder presentation:object="handout" svg:x="2.058cm" svg:y="3.612cm" svg:width="10.556cm" svg:height="-0.231cm"/> + <presentation:placeholder presentation:object="handout" svg:x="15.414cm" svg:y="3.612cm" svg:width="10.556cm" svg:height="-0.231cm"/> + <presentation:placeholder presentation:object="handout" svg:x="2.058cm" svg:y="5.481cm" svg:width="10.556cm" svg:height="-0.231cm"/> + <presentation:placeholder presentation:object="handout" svg:x="15.414cm" svg:y="5.481cm" svg:width="10.556cm" svg:height="-0.231cm"/> + </style:presentation-page-layout> + <style:presentation-page-layout style:name="AL1T1"> + <presentation:placeholder presentation:object="title" svg:x="2.058cm" svg:y="1.743cm" svg:width="23.912cm" svg:height="3.507cm"/> + <presentation:placeholder presentation:object="outline" svg:x="2.058cm" svg:y="5.838cm" svg:width="23.912cm" svg:height="13.23cm"/> + </style:presentation-page-layout> + </office:styles> + <office:automatic-styles> + <style:page-layout style:name="PM0"> + <style:page-layout-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:page-width="21cm" fo:page-height="29.7cm" style:print-orientation="portrait"/> + </style:page-layout> + <style:page-layout style:name="PM1"> + <style:page-layout-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:page-width="28cm" fo:page-height="21cm" style:print-orientation="landscape"/> + </style:page-layout> + <style:style style:name="dp2" style:family="drawing-page"> + <style:drawing-page-properties presentation:display-header="true" presentation:display-footer="true" presentation:display-page-number="false" presentation:display-date-time="true"/> + </style:style> + <style:style style:name="dp3" style:family="drawing-page"> + <style:drawing-page-properties presentation:background-visible="true" presentation:background-objects-visible="true" presentation:display-footer="true" presentation:display-page-number="true" presentation:display-date-time="true"/> + </style:style> + <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard"> + <style:graphic-properties draw:stroke="none" draw:fill="none" draw:fill-color="#ffffff" draw:auto-grow-height="false" fo:min-height="1.485cm"/> + <style:paragraph-properties style:writing-mode="lr-tb"/> + </style:style> + <style:style style:name="gr2" style:family="graphic" style:parent-style-name="standard"> + <style:graphic-properties draw:stroke="none" draw:fill="none" draw:fill-color="#ffffff" draw:textarea-vertical-align="bottom" draw:auto-grow-height="false" fo:min-height="1.485cm"/> + <style:paragraph-properties style:writing-mode="lr-tb"/> + </style:style> + <style:style style:name="gr3" style:family="graphic"> + <style:graphic-properties style:protect="size"/> + </style:style> + <style:style style:name="pr5" style:family="presentation" style:parent-style-name="Impress1-notes"> + <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.364cm"/> + <style:paragraph-properties style:writing-mode="lr-tb"/> + </style:style> + <style:style style:name="co1" style:family="table-column"> + <style:table-column-properties style:column-width="6cm" style:use-optimal-column-width="false"/> + </style:style> + <style:style style:name="ro1" style:family="table-row"> + <style:table-row-properties style:row-height="1.742cm" style:use-optimal-row-height="false"/> + </style:style> + <style:style style:name="P1" style:family="paragraph"> + <style:text-properties fo:font-size="14pt"/> + </style:style> + <style:style style:name="P3" style:family="paragraph"> + <style:paragraph-properties fo:text-align="end"/> + <style:text-properties fo:font-size="14pt"/> + </style:style> + <style:style style:name="T1" style:family="text"> + <style:text-properties fo:font-size="14pt"/> + </style:style> + <style:style style:name="T2" style:family="text"> + <style:text-properties fo:font-size="18pt" style:font-size-asian="18pt" style:font-size-complex="18pt"/> + </style:style> + </office:automatic-styles> + <office:master-styles> + <draw:layer-set> + <draw:layer draw:name="layout"/> + <draw:layer draw:name="background"/> + <draw:layer draw:name="backgroundobjects"/> + <draw:layer draw:name="controls"/> + <draw:layer draw:name="measurelines"/> + </draw:layer-set> + <style:handout-master presentation:presentation-page-layout-name="AL0T26" style:page-layout-name="PM0" draw:style-name="dp2"> + <draw:frame draw:style-name="gr1" draw:text-style-name="P2" draw:layer="backgroundobjects" svg:width="9.113cm" svg:height="1.484cm" svg:x="0cm" svg:y="0cm" presentation:class="header"> + <draw:text-box> + <text:p text:style-name="P1"><text:span text:style-name="T1"><presentation:header/></text:span></text:p> + </draw:text-box> + </draw:frame> + <draw:frame draw:style-name="gr1" draw:text-style-name="P4" draw:layer="backgroundobjects" svg:width="9.113cm" svg:height="1.484cm" svg:x="11.886cm" svg:y="0cm" presentation:class="date-time"> + <draw:text-box> + <text:p text:style-name="P3"><text:span text:style-name="T1"><presentation:date-time/></text:span></text:p> + </draw:text-box> + </draw:frame> + <draw:frame draw:style-name="gr2" draw:text-style-name="P2" draw:layer="backgroundobjects" svg:width="9.113cm" svg:height="1.484cm" svg:x="0cm" svg:y="28.215cm" presentation:class="footer"> + <draw:text-box> + <text:p text:style-name="P1"><text:span text:style-name="T1"><presentation:footer/></text:span></text:p> + </draw:text-box> + </draw:frame> + <draw:frame draw:style-name="gr2" draw:text-style-name="P4" draw:layer="backgroundobjects" svg:width="9.113cm" svg:height="1.484cm" svg:x="11.886cm" svg:y="28.215cm" presentation:class="page-number"> + <draw:text-box> + <text:p text:style-name="P3"><text:span text:style-name="T1"><text:page-number><number></text:page-number></text:span></text:p> + </draw:text-box> + </draw:frame> + <draw:page-thumbnail draw:layer="backgroundobjects" svg:width="8.999cm" svg:height="6.749cm" svg:x="1cm" svg:y="2.898cm"/> + <draw:page-thumbnail draw:layer="backgroundobjects" svg:width="8.999cm" svg:height="6.749cm" svg:x="1cm" svg:y="11.474cm"/> + <draw:page-thumbnail draw:layer="backgroundobjects" svg:width="8.999cm" svg:height="6.749cm" svg:x="1cm" svg:y="20.05cm"/> + <draw:page-thumbnail draw:layer="backgroundobjects" svg:width="8.999cm" svg:height="6.749cm" svg:x="11cm" svg:y="2.898cm"/> + <draw:page-thumbnail draw:layer="backgroundobjects" svg:width="8.999cm" svg:height="6.749cm" svg:x="11cm" svg:y="11.474cm"/> + <draw:page-thumbnail draw:layer="backgroundobjects" svg:width="8.999cm" svg:height="6.749cm" svg:x="11cm" svg:y="20.05cm"/> + </style:handout-master> + </office:master-styles> + <office:body> + <office:presentation> + <draw:page draw:name="page1" draw:style-name="dp3" draw:master-page-name="Impress1" presentation:presentation-page-layout-name="AL1T1"> + <office:forms form:automatic-focus="false" form:apply-design-mode="false"/> + <draw:frame draw:style-name="standard" draw:layer="layout" svg:width="17.999cm" svg:height="3.483cm" svg:x="2cm" svg:y="6cm" presentation:class="table" presentation:user-transformed="true"> + <table:table table:template-name="default" table:use-first-row-styles="true" table:use-banding-rows-styles="true"> + <table:table-column table:style-name="co1"/> + <table:table-column table:style-name="co1"/> + <table:table-column table:style-name="co1"/> + <table:table-row table:style-name="ro1" table:default-cell-style-name="gray3"> + <table:table-cell/> + <table:table-cell> + <text:p><text:span text:style-name="T2">Average starting score</text:span></text:p> + </table:table-cell> + <table:table-cell> + <text:p><text:span text:style-name="T2">Average improved score</text:span></text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1" table:default-cell-style-name="gray2"> + <table:table-cell> + <text:p><text:span text:style-name="T2">Images</text:span></text:p> + </table:table-cell> + <table:table-cell> + <text:p><text:span text:style-name="T2">35%</text:span></text:p> + </table:table-cell> + <table:table-cell> + <text:p><text:span text:style-name="T2">91%</text:span></text:p> + </table:table-cell> + </table:table-row> + </table:table> + </draw:frame> + <presentation:notes draw:style-name="dp2"> + <draw:page-thumbnail draw:style-name="gr3" draw:layer="layout" svg:width="14.848cm" svg:height="11.136cm" svg:x="3.075cm" svg:y="2.257cm" draw:page-number="1" presentation:class="page"/> + <draw:frame presentation:style-name="pr5" draw:text-style-name="P5" draw:layer="layout" svg:width="16.799cm" svg:height="13.364cm" svg:x="2.1cm" svg:y="14.107cm" presentation:class="notes" presentation:placeholder="true"> + <draw:text-box/> + </draw:frame> + </presentation:notes> + </draw:page> + <presentation:settings presentation:mouse-visible="false"/> + </office:presentation> + </office:body> +</office:document>
\ No newline at end of file diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 1e7a6788acf4..8756dc9b5d77 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -3389,6 +3389,101 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf57423) CPPUNIT_ASSERT_EQUAL(int(4), nDiv); } +CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf135192) +{ + aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + + // Enable PDF/UA + uno::Sequence<beans::PropertyValue> aFilterData( + comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) } })); + aMediaDescriptor["FilterData"] <<= aFilterData; + saveAsPDF(u"tdf135192-1.fodp"); + + vcl::filter::PDFDocument aDocument; + SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); + CPPUNIT_ASSERT(aDocument.Read(aStream)); + + // The document has one page. + std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); + + int nTable(0); + for (const auto& rDocElement : aDocument.GetElements()) + { + auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); + if (!pObject1) + continue; + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + if (pType1 && pType1->GetValue() == "StructElem") + { + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + if (pS1 && pS1->GetValue() == "Table") + { + int nTR(0); + auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K")); + CPPUNIT_ASSERT(pKids1); + // there can be additional children, such as MCID ref + for (auto pKid1 : pKids1->GetElements()) + { + auto pRefKid1 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKid1); + if (pRefKid1) + { + auto pObject2 = pRefKid1->LookupObject(); + if (pObject2) + { + auto pType2 = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject2->Lookup("Type")); + if (pType2 && pType2->GetValue() == "StructElem") + { + auto pS2 = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject2->Lookup("S")); + if (pS2 && pS2->GetValue() == "TR") + { + int nTD(0); + auto pKids2 = dynamic_cast<vcl::filter::PDFArrayElement*>( + pObject2->Lookup("K")); + CPPUNIT_ASSERT(pKids2); + for (auto pKid2 : pKids2->GetElements()) + { + auto pRefKid2 + = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pKid2); + if (pRefKid2) + { + auto pObject3 = pRefKid2->LookupObject(); + if (pObject3) + { + auto pType3 + = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject3->Lookup("Type")); + if (pType3 && pType3->GetValue() == "StructElem") + { + auto pS3 = dynamic_cast< + vcl::filter::PDFNameElement*>( + pObject3->Lookup("S")); + if (pS3 && pS3->GetValue() == "TD") + { + ++nTD; + } + } + } + } + } + CPPUNIT_ASSERT_EQUAL(int(3), nTD); + ++nTR; + } + } + } + } + } + CPPUNIT_ASSERT_EQUAL(int(2), nTR); + ++nTable; + } + } + } + CPPUNIT_ASSERT_EQUAL(int(1), nTable); +} + CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf142129) { loadFromURL(u"master.odm"); |