summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2022-11-17 18:57:34 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-11-22 13:04:00 +0100
commit87383b341a6bf515a209ad2e7a2a1289059b781e (patch)
tree8557d8a3b8c22272df2a46f4ab57752c80e583ed /sd
parent81791adc414adcaa9f43b5f449ad0f6752e01df7 (diff)
tdf#135638 svx,sd: PDF/UA export: tag SdrObject shapes as Figure etc.
Move the code that already exists in sd class ImplRenderPaintProc to ViewObjectContact::getPrimitive2DSequence(), where it is used by all applications, and take into account the caching there, which matters for performance. Change-Id: Iabc00b7c894f042673c7217199236a05a5d67959 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142901 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx68
1 files changed, 7 insertions, 61 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 36688e31640b..2deb5d296c22 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1534,15 +1534,12 @@ class ImplRenderPaintProc : public sdr::contact::ViewObjectContactRedirector
{
const SdrLayerAdmin& rLayerAdmin;
SdrPageView* pSdrPageView;
- vcl::PDFExtOutDevData* pPDFExtOutDevData;
-
- vcl::PDFWriter::StructElement ImplBegStructureTag( const SdrObject& rObject );
public:
bool IsVisible ( const SdrObject* pObj ) const;
bool IsPrintable( const SdrObject* pObj ) const;
- ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData );
+ ImplRenderPaintProc(const SdrLayerAdmin& rLA, SdrPageView* pView);
// all default implementations just call the same methods at the original. To do something
// different, override the method and at least do what the method does.
@@ -1554,10 +1551,9 @@ public:
}
-ImplRenderPaintProc::ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData )
-: rLayerAdmin ( rLA ),
- pSdrPageView ( pView ),
- pPDFExtOutDevData ( pData )
+ImplRenderPaintProc::ImplRenderPaintProc(const SdrLayerAdmin& rLA, SdrPageView *const pView)
+ : rLayerAdmin(rLA)
+ , pSdrPageView(pView)
{
}
@@ -1755,32 +1751,6 @@ static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape
}
}
-vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( const SdrObject& rObject )
-{
- vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement);
-
- if ( pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF() )
- {
- SdrInventor nInventor = rObject.GetObjInventor();
- SdrObjKind nIdentifier = rObject.GetObjIdentifier();
- bool bIsTextObj = DynCastSdrTextObj( &rObject ) != nullptr;
-
- if ( nInventor == SdrInventor::Default )
- {
- if ( nIdentifier == SdrObjKind::Group )
- eElement = vcl::PDFWriter::Section;
- else if ( nIdentifier == SdrObjKind::TitleText )
- eElement = vcl::PDFWriter::Heading;
- else if ( nIdentifier == SdrObjKind::OutlineText )
- eElement = vcl::PDFWriter::Division;
- else if ( !bIsTextObj || !static_cast<const SdrTextObj&>(rObject).HasText() )
- eElement = vcl::PDFWriter::Figure;
- }
- }
-
- return eElement;
-}
-
void ImplRenderPaintProc::createRedirectedPrimitive2DSequence(
const sdr::contact::ViewObjectContact& rOriginal,
const sdr::contact::DisplayInfo& rDisplayInfo,
@@ -1801,31 +1771,7 @@ void ImplRenderPaintProc::createRedirectedPrimitive2DSequence(
if(!IsVisible(pObject) || !IsPrintable(pObject))
return;
- const vcl::PDFWriter::StructElement eElement(ImplBegStructureTag( *pObject ));
- const bool bTagUsed(vcl::PDFWriter::NonStructElement != eElement);
-
- drawinglayer::primitive2d::Primitive2DContainer xRetval;
- sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo, xRetval);
-
- if(!xRetval.empty() && bTagUsed)
- {
- // embed Primitive2DSequence in a structure tag element for
- // exactly this purpose (StructureTagPrimitive2D)
-
- const bool bBackground(pSdrPage->IsMasterPage());
- const bool bImage(pObject->GetObjIdentifier() == SdrObjKind::Graphic);
-
- drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::StructureTagPrimitive2D(
- eElement,
- bBackground,
- bImage,
- std::move(xRetval)));
-
- xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference };
- }
-
- rVisitor.visit(xRetval);
+ sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo, rVisitor);
}
bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const
@@ -1959,7 +1905,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
}
ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
- pPV, pPDFExtOutDevData );
+ pPV);
// background color for outliner :o
SdPage* pPage = pPV ? static_cast<SdPage*>(pPV->GetPage()) : nullptr;
@@ -2192,7 +2138,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
SdrPageView* pPV = nullptr;
ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
- pOldSdView ? pOldSdView->GetSdrPageView() : nullptr, pPDFExtOutDevData );
+ pOldSdView ? pOldSdView->GetSdrPageView() : nullptr);
for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ )
{