summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-03-16 19:48:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-03-25 19:42:03 +0000
commit11959d05b3df3a2b7670da2df1cc914b22eabae4 (patch)
tree4f2d905fa680f0b4cfa05257eaceaafe26ff8e5d /include
parent1c92038e2e4fdc556ec4ca1e00eff3ae355b683f (diff)
vcl,drawinglayer,svx,sw,sd: PDF/UA export: Annot StructElem for SdrMediaObj
veraPDF complains: Specification: ISO 14289-1:2014, Clause: 7.18.1, Test number: 1 An annotation, excluding annotations of subtype Widget, Popup or Link, shall be nested within an Annot tag This is very similar to Link annotations, that is to say, extremely complicated to get it thought the convoluted PDF export code, with additional complication that the StructElem is produced by drawinglayer and the page annotation by sw. Put another map into PDFExtOutDevData where sw code puts stuff for the SdrObject that drawinglayer can find. The test had the problem that PDFObjectParser::parse() could not handle: <</Nums[ 0 [ 6 0 R ] 1 6 0 R ]>> Fix dropping the "1". Change-Id: If5bf7c552e26ebb7e631030b8aaecd4281e77acc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149314 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/drawinglayer/primitive2d/structuretagprimitive2d.hxx6
-rw-r--r--include/svx/sdr/contact/objectcontact.hxx5
-rw-r--r--include/svx/sdr/contact/objectcontactofpageview.hxx1
-rw-r--r--include/vcl/pdfextoutdevdata.hxx14
-rw-r--r--include/vcl/pdfwriter.hxx7
5 files changed, 30 insertions, 3 deletions
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
index 40ad422c2b9a..8ee2b267b57f 100644
--- a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
@@ -51,6 +51,8 @@ namespace drawinglayer::primitive2d
bool mbIsImage;
/// anchor structure element (Writer)
sal_Int32 m_nAnchorStructureElementId;
+ /// for Annot structure element, the ids of the annotations
+ ::std::vector<sal_Int32> m_AnnotIds;
public:
/// constructor
@@ -59,7 +61,8 @@ namespace drawinglayer::primitive2d
bool bBackground,
bool bIsImage,
Primitive2DContainer&& aChildren,
- sal_Int32 nAnchorStructureElementId = -1);
+ sal_Int32 nAnchorStructureElementId = -1,
+ ::std::vector<sal_Int32> const* pAnnotIds = nullptr);
/// data read access
const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; }
@@ -67,6 +70,7 @@ namespace drawinglayer::primitive2d
bool isImage() const { return mbIsImage; }
bool isTaggedSdrObject() const;
sal_Int32 GetAnchorStructureElementId() const { return m_nAnchorStructureElementId; }
+ ::std::vector<sal_Int32> GetAnnotIds() const { return m_AnnotIds; }
/// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
diff --git a/include/svx/sdr/contact/objectcontact.hxx b/include/svx/sdr/contact/objectcontact.hxx
index 3e9b1b76d05d..40d631f3fae8 100644
--- a/include/svx/sdr/contact/objectcontact.hxx
+++ b/include/svx/sdr/contact/objectcontact.hxx
@@ -30,6 +30,10 @@ namespace tools { class Rectangle; }
class SdrPageView;
class OutputDevice;
+namespace vcl {
+ class PDFExtOutDevData;
+}
+
namespace basegfx {
class B2DRange;
class B2DHomMatrix;
@@ -138,6 +142,7 @@ public:
// pdf export? Default is false
virtual bool isOutputToPDFFile() const;
virtual bool isExportTaggedPDF() const;
+ virtual ::vcl::PDFExtOutDevData const* GetPDFExtOutDevData() const;
// gray display mode
virtual bool isDrawModeGray() const;
diff --git a/include/svx/sdr/contact/objectcontactofpageview.hxx b/include/svx/sdr/contact/objectcontactofpageview.hxx
index 8d18083b99b8..1512542dc395 100644
--- a/include/svx/sdr/contact/objectcontactofpageview.hxx
+++ b/include/svx/sdr/contact/objectcontactofpageview.hxx
@@ -93,6 +93,7 @@ namespace sdr::contact
// pdf export? Default is false
virtual bool isOutputToPDFFile() const override;
virtual bool isExportTaggedPDF() const override;
+ virtual ::vcl::PDFExtOutDevData const* GetPDFExtOutDevData() const override;
// gray display mode
virtual bool isDrawModeGray() const override;
diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 81ea37b86d9b..2f0360d1fdd5 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -25,10 +25,12 @@
#include <vcl/pdfwriter.hxx>
#include <vcl/extoutdevdata.hxx>
#include <vector>
+#include <map>
#include <memory>
class Graphic;
class GDIMetaFile;
+class SdrObject;
namespace vcl
{
@@ -91,6 +93,8 @@ class VCL_DLLPUBLIC PDFExtOutDevData final : public ExtOutDevData
std::vector< PDFExtOutDevBookmarkEntry > maBookmarks;
std::vector<OUString> maChapterNames;
+ // map from annotation SdrObject to annotation index
+ ::std::map<SdrObject const*, ::std::vector<sal_Int32>> m_ScreenAnnotations;
public:
@@ -266,7 +270,10 @@ public:
sal_Int32 CreateLink(const tools::Rectangle& rRect, OUString const& rAltText, sal_Int32 nPageNr = -1);
/// Create a Screen annotation.
- sal_Int32 CreateScreen(const tools::Rectangle& rRect, OUString const& rAltText, sal_Int32 nPageNr);
+ sal_Int32 CreateScreen(const tools::Rectangle& rRect, OUString const& rAltText, sal_Int32 nPageNr, SdrObject const* pObj);
+
+ /// Get back the annotations created for one SdrObject.
+ ::std::vector<sal_Int32> const& GetScreenAnnotIds(SdrObject const* pObj) const;
/** Set the destination for a link
<p>will change a URL type link to a dest link if necessary</p>
@@ -438,6 +445,11 @@ public:
*/
void SetStructureBoundingBox( const tools::Rectangle& rRect );
+ /** set the annotations that should be referenced as children of the
+ current structural element.
+ */
+ void SetStructureAnnotIds(::std::vector<sal_Int32> const& rAnnotIds);
+
/** set the ActualText attribute of a structural element
ActualText contains the Unicode text without layout artifacts that is shown by
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 8c9150f4dbca..9ab22190df0b 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -127,7 +127,7 @@ public:
Table, TableRow, TableHeader, TableData,
// inline level elements
- Span, Quote, Note, Reference, BibEntry, Code, Link,
+ Span, Quote, Note, Reference, BibEntry, Code, Link, Annot,
// illustration elements
Figure, Formula, Form
@@ -1147,6 +1147,11 @@ The following structure describes the permissions used in PDF security
*/
void SetStructureBoundingBox( const tools::Rectangle& rRect );
+ /** set the annotations that should be referenced as children of the
+ current structural element.
+ */
+ void SetStructureAnnotIds(::std::vector<sal_Int32> const& rAnnotIds);
+
/** set the ActualText attribute of a structural element
ActualText contains the Unicode text without layout artifacts that is shown by