summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2019-03-06 17:22:21 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2019-03-21 13:20:46 +0100
commita0fd6c4d1ea6d40573ad91922bf4e37992e87143 (patch)
tree88bbcb7b7b769fe61739f56a11f3a7bc61bdcf1c
parentc312dfb523f29acf40c2ccf74af30cce19be6697 (diff)
Limit tagging of background objects to images
i.e. don't tag custom shapes and other than bitmap background fills Change-Id: I1d42012420f59e1e7b62affb8aca5a8c85688423 Reviewed-on: https://gerrit.libreoffice.org/69258 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r--drawinglayer/source/primitive2d/structuretagprimitive2d.cxx7
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx23
-rw-r--r--include/drawinglayer/primitive2d/structuretagprimitive2d.hxx7
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx3
4 files changed, 29 insertions, 11 deletions
diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
index 41f5577efa16..c1aedc84a587 100644
--- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
@@ -31,10 +31,12 @@ namespace drawinglayer
StructureTagPrimitive2D::StructureTagPrimitive2D(
const vcl::PDFWriter::StructElement& rStructureElement,
bool bBackground,
+ bool bIsImage,
const Primitive2DContainer& rChildren)
: GroupPrimitive2D(rChildren),
maStructureElement(rStructureElement),
- mbBackground(bBackground)
+ mbBackground(bBackground),
+ mbIsImage(bIsImage)
{
}
@@ -44,7 +46,8 @@ namespace drawinglayer
{
const StructureTagPrimitive2D& rCompare = static_cast<const StructureTagPrimitive2D&>(rPrimitive);
- return (isBackground() == rCompare.isBackground());
+ return (isBackground() == rCompare.isBackground() &&
+ isImage() == rCompare.isImage());
}
return false;
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 1c3e73fc85b3..40eec9fc4245 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2213,20 +2213,31 @@ namespace drawinglayer
{
// structured tag primitive
const vcl::PDFWriter::StructElement& rTagElement(rStructureTagCandidate.getStructureElement());
- const bool bTagUsed(vcl::PDFWriter::NonStructElement != rTagElement);
- const bool bIsBackground(rStructureTagCandidate.isBackground());
+ bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement));
if(mpPDFExtOutDevData && bTagUsed)
{
- // Write start tag. For background elements use NonStructElement instead of real element type (e.g. Figure)
- // to guarantee it gets exported as artifact (tagged PDF)
- mpPDFExtOutDevData->BeginStructureElement(bIsBackground ? vcl::PDFWriter::NonStructElement : rTagElement);
+ // foreground object: tag as regular structure element
+ if (!rStructureTagCandidate.isBackground())
+ {
+ mpPDFExtOutDevData->BeginStructureElement(rTagElement);
+ }
+ // background object
+ else
+ {
+ // background image: tag as artifact
+ if (rStructureTagCandidate.isImage())
+ mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::NonStructElement);
+ // any other background object: do not tag
+ else
+ bTagUsed = false;
+ }
}
// process children normally
process(rStructureTagCandidate.getChildren());
- if(mpPDFExtOutDevData && bTagUsed)
+ if(mpPDFExtOutDevData && bTagUsed)
{
// write end tag
mpPDFExtOutDevData->EndStructureElement();
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
index b6e9ad94ede8..255dc5e64f56 100644
--- a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
@@ -48,20 +48,23 @@ namespace drawinglayer
/// the PDF structure element this grouping represents
vcl::PDFWriter::StructElement maStructureElement;
- ///Z flag for background contenht that may be handled as
- /// Tagged PDF '/Artifact'
+ /// flag for background object
bool mbBackground;
+ /// flag for image (OBJ_GRAF)
+ bool mbIsImage;
public:
/// constructor
StructureTagPrimitive2D(
const vcl::PDFWriter::StructElement& rStructureElement,
bool bBackground,
+ bool bIsImage,
const Primitive2DContainer& rChildren);
/// data read access
const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; }
bool isBackground() const { return mbBackground; }
+ bool isImage() const { return mbIsImage; }
/// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 06a91d3df357..32c02cc5423f 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1804,14 +1804,15 @@ drawinglayer::primitive2d::Primitive2DContainer ImplRenderPaintProc::createRedir
// embed Primitive2DSequence in a structure tag element for
// exactly this purpose (StructureTagPrimitive2D)
- //Z
const SdrPage* pSdrPage(pObject->getSdrPageFromSdrObject());
const bool bBackground(nullptr != pSdrPage && pSdrPage->IsMasterPage());
+ const bool bImage(pObject->GetObjIdentifier() == OBJ_GRAF);
const drawinglayer::primitive2d::Primitive2DReference xReference(
new drawinglayer::primitive2d::StructureTagPrimitive2D(
eElement,
bBackground,
+ bImage,
xRetval));
xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference };