[Libreoffice-commits] core.git: Branch 'feature/cib_contract139' - 2 commits - drawinglayer/source include/drawinglayer sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 12 14:56:30 UTC 2019


 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx  |    7 +-
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |   29 +++++++++--
 include/drawinglayer/primitive2d/structuretagprimitive2d.hxx |    7 +-
 sd/source/ui/unoidl/unomodel.cxx                             |    3 -
 4 files changed, 37 insertions(+), 9 deletions(-)

New commits:
commit ad2f45a7bea201a9aec62af734d7bd009af57d6f
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Tue Mar 12 15:30:35 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Tue Mar 12 15:55:17 2019 +0100

    Close all opened List elements at the end of the page
    
    Change-Id: I7c1e11ec57537441417f6b1cebe137587883d8c1

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 8b0ab2b2d09e..c2259341781c 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1339,6 +1339,14 @@ namespace drawinglayer
             // add MetaFile comment, process recursively and add MetaFile comment
             mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA));
             process(rBlockPrimitive);
+
+            if (mnCurrentOutlineLevel >= 0 )
+            {
+                // end any opened List structure elements
+                for(sal_Int16 i(0); i <= mnCurrentOutlineLevel; ++i)
+                    mpPDFExtOutDevData->EndStructureElement();
+            }
+
             mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB));
         }
 
commit 79fcd1b1c970feac408912dc42aa9f48754037ab
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Tue Mar 12 13:51:04 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Tue Mar 12 15:54:45 2019 +0100

    Limit tagging of background objects to images
    
    i.e. don't tag background custom shapes and other than bitmap
    background fills
    
    Change-Id: I1d42012420f59e1e7b62affb8aca5a8c85688423

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 1573c7fb7880..8b0ab2b2d09e 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2292,18 +2292,31 @@ namespace drawinglayer
         {
             // structured tag primitive
             const vcl::PDFWriter::StructElement& rTagElement(rStructureTagCandidate.getStructureElement());
-            bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement) && !rStructureTagCandidate.isBackground());
+            bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement));
 
             if(mpPDFExtOutDevData && bTagUsed)
             {
-                // write start tag
-                mpPDFExtOutDevData->BeginStructureElement(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 b8cd7d7b4691..5b93cbeb6a3a 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1807,14 +1807,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 };


More information about the Libreoffice-commits mailing list