diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-01-29 16:20:56 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-02-06 16:46:09 +0100 |
commit | bd66a0201fb6d1a127139287cc8b5bd27e3a92c3 (patch) | |
tree | 89c4cfd51c284bff5fbf57004b15e01c1f2dce36 | |
parent | f891420f1689711e819f87e10dcfe38fe64eb038 (diff) |
Process all of list item (Lbl + LBody) in 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
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 30 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx | 2 |
2 files changed, 29 insertions, 3 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index ce5c579b5646..71a6125e2ff1 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -563,7 +563,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 @@ -1232,9 +1234,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) @@ -1301,7 +1313,7 @@ namespace drawinglayer { // Dump as ListItem mpPDFExtOutDevData->BeginStructureElement( vcl::PDFWriter::ListItem ); - mpPDFExtOutDevData->BeginStructureElement( vcl::PDFWriter::LIBody ); + mbInListItem = true; } else { @@ -1315,7 +1327,8 @@ namespace drawinglayer if(bDumpAsListItem) { - mpPDFExtOutDevData->EndStructureElement(); + mpPDFExtOutDevData->EndStructureElement(); // end ListItem + mbInListItem = false; } mpPDFExtOutDevData->EndStructureElement(); @@ -1338,9 +1351,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 410f332cbd76..3806a683b4da 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, |