From b09c377888e2e75859fff37fdf9408065eb522d6 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 11 Apr 2023 19:24:25 +0900 Subject: oox: write graphic (blip) in ThemeExport - BlipFill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Share the graphic writing from DrawingML class, which needed a bit of refactoring and use it when writing the BlipFill when exporting a theme with ThemeExport. Change-Id: I89bf3be98f607b7641d231982af2f7a5e2c3d3a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150261 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl --- oox/source/export/ThemeExport.cxx | 13 +++++++++++-- oox/source/export/drawingml.cxx | 20 ++++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'oox/source/export') diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx index 8f00058e0bb1..16da603fa14c 100644 --- a/oox/source/export/ThemeExport.cxx +++ b/oox/source/export/ThemeExport.cxx @@ -34,8 +34,10 @@ void writeRelativeRectangle(sax_fastparser::FSHelperPtr pFS, sal_Int32 nToken, } } // end anonymous namespace -ThemeExport::ThemeExport(oox::core::XmlFilterBase* pFilterBase) +ThemeExport::ThemeExport(oox::core::XmlFilterBase* pFilterBase, + oox::drawingml::DocumentType eDocumentType) : mpFilterBase(pFilterBase) + , meDocumentType(eDocumentType) { } @@ -579,7 +581,14 @@ OString convertRectangleAlignment(model::RectangleAlignment eFlipMode) } } // end anonymous ns -void ThemeExport::writeBlip(model::BlipFill const& /*rBlipFil*/) {} +void ThemeExport::writeBlip(model::BlipFill const& rBlipFil) +{ + if (!rBlipFil.mxGraphic.is()) + return; + oox::drawingml::GraphicExport aExporter(mpFS, mpFilterBase, meDocumentType); + Graphic aGraphic(rBlipFil.mxGraphic); + aExporter.writeBlip(aGraphic, false); +} void ThemeExport::writeBlipFill(model::BlipFill const& rBlipFill) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 97c5210d95f6..f58e76eda95e 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1475,7 +1475,23 @@ const char* DrawingML::GetRelationCompPrefix() const return getRelationCompPrefix(meDocumentType); } -OUString GraphicExport::write(const Graphic& rGraphic , bool bRelPathToMedia) +OUString GraphicExport::writeBlip(Graphic const& rGraphic , bool bRelPathToMedia) +{ + OUString sRelId; + + sRelId = writeToStorage(rGraphic, bRelPathToMedia); + + mpFS->startElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), sRelId); + + //WriteImageBrightnessContrastTransparence(rXPropSet); + //WriteArtisticEffect(rXPropSet); + + mpFS->endElementNS(XML_a, XML_blip); + + return sRelId; +} + +OUString GraphicExport::writeToStorage(const Graphic& rGraphic , bool bRelPathToMedia) { GfxLink aLink = rGraphic.GetGfxLink (); BitmapChecksum aChecksum = rGraphic.GetChecksum(); @@ -1608,7 +1624,7 @@ OUString GraphicExport::write(const Graphic& rGraphic , bool bRelPathToMedia) OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) { GraphicExport exporter(mpFS, mpFB, meDocumentType); - return exporter.write(rGraphic, bRelPathToMedia); + return exporter.writeToStorage(rGraphic, bRelPathToMedia); } void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference& xShape) -- cgit