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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 29 15:37:34 UTC 2019


 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   30 +++++++++++--
 drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx |    2 
 2 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 98270dafaba733db4660bbd22f2f1f96bf1d6282
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Tue Jan 29 16:20:56 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Tue Jan 29 16:35:11 2019 +0100

    Process entire list item (Lbl + LBody) in tagged PDF-compliant way
    
    implemented as described in
    https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G21.1021281
    
    Change-Id: I943c35cb8ee833ff46ff594e6b6c1025450b9ca4

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index bbc7d80361a7..ece83ddc8c52 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -565,7 +565,9 @@ namespace drawinglayer
             mnSvtGraphicStrokeCount(0),
             mfCurrentUnifiedTransparence(0.0),
             mpPDFExtOutDevData(dynamic_cast< vcl::PDFExtOutDevData* >(rOutDev.GetExtOutDevData())),
-            mnCurrentOutlineLevel(-1)
+            mnCurrentOutlineLevel(-1),
+            mbInListItem(false),
+            mbBulletPresent(false)
         {
             OSL_ENSURE(rOutDev.GetConnectMetaFile(), "VclMetafileProcessor2D: Used on OutDev which has no MetaFile Target (!)");
             // draw to logic coordinates, do not initialize maCurrentTransformation to viewTransformation
@@ -1234,9 +1236,19 @@ namespace drawinglayer
             // "XTEXT_EOC" is used, use here, too.
             const OString aCommentString("XTEXT_EOC");
 
+            // this is a part of list item, start LILabel ( = bullet)
+            if(mbInListItem)
+                mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::LILabel);
+
             // process recursively and add MetaFile comment
             process(rBulletPrimitive);
             mpMetaFile->AddAction(new MetaCommentAction(aCommentString));
+
+            if(mbInListItem)
+            {
+                mpPDFExtOutDevData->EndStructureElement(); // end LILabel
+                mbBulletPresent = true;
+            }
         }
 
         void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D(const primitive2d::TextHierarchyParagraphPrimitive2D& rParagraphPrimitive)
@@ -1303,7 +1315,7 @@ namespace drawinglayer
             {
                 // Dump as ListItem
                 mpPDFExtOutDevData->BeginStructureElement( vcl::PDFWriter::ListItem );
-                mpPDFExtOutDevData->BeginStructureElement( vcl::PDFWriter::LIBody );
+                mbInListItem = true;
             }
             else
             {
@@ -1317,7 +1329,8 @@ namespace drawinglayer
 
             if(bDumpAsListItem)
             {
-                mpPDFExtOutDevData->EndStructureElement();
+                mpPDFExtOutDevData->EndStructureElement(); // end ListItem
+                mbInListItem = false;
             }
 
             mpPDFExtOutDevData->EndStructureElement();
@@ -1340,9 +1353,20 @@ namespace drawinglayer
             const DrawModeFlags nOriginalDrawMode(mpOutputDevice->GetDrawMode());
             adaptTextToFillDrawMode();
 
+            // this is a 2nd portion of list item
+            // bullet has been already processed, start LIBody
+            if (mbInListItem && mbBulletPresent)
+                mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::LIBody);
+
             // directdraw of text simple portion; use default processing
             RenderTextSimpleOrDecoratedPortionPrimitive2D(rTextCandidate);
 
+            if (mbInListItem && mbBulletPresent)
+            {
+                mpPDFExtOutDevData->EndStructureElement(); // end LIBody
+                mbBulletPresent = false;
+            }
+
             // restore DrawMode
             mpOutputDevice->SetDrawMode(nOriginalDrawMode);
 
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
index a897d17ddfff..3b9f39f804a6 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
@@ -174,6 +174,8 @@ namespace drawinglayer
             // like '/L', '/LI', 'LBody' instead of simple '/P' (Paragraph).
             // The value -1 means 'no OutlineLevel' and values >= 0 express the level.
             sal_Int16                           mnCurrentOutlineLevel;
+            bool mbInListItem;
+            bool mbBulletPresent;
 
         protected:
             /*  the local processor for BasePrimitive2D-Implementation based primitives,


More information about the Libreoffice-commits mailing list