include/oox/export/drawingml.hxx | 33 +-- oox/source/export/drawingml.cxx | 279 ++++++++++++--------------- oox/source/export/shapes.cxx | 10 oox/source/export/vmlexport.cxx | 4 sc/source/filter/excel/xeescher.cxx | 2 sw/source/filter/ww8/docxattributeoutput.cxx | 6 6 files changed, 162 insertions(+), 172 deletions(-)
New commits: commit c86a81192e6a39ca82850156fccb78b2a4ccc3c6 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Dec 3 12:53:58 2023 +0900 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Dec 10 12:37:11 2023 +0100 oox: Refactor and simplify writing to storage with GraphicExport Change-Id: I743dc99e0228b59050fb4926c8ef56bed8e82060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160252 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 1be8b2752d30d3c024e46526e9d31c1e7066799c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160382 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index fd293c28b5d2..70827d256b8d 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -140,28 +140,28 @@ protected: virtual ~DMLTextExport() {} }; -constexpr const char* getComponentDir(DocumentType eDocumentType) +constexpr std::u16string_view getComponentDir(DocumentType eDocumentType) { switch (eDocumentType) { - case DOCUMENT_DOCX: return "word"; - case DOCUMENT_PPTX: return "ppt"; - case DOCUMENT_XLSX: return "xl"; + case DOCUMENT_DOCX: return u"word"; + case DOCUMENT_PPTX: return u"ppt"; + case DOCUMENT_XLSX: return u"xl"; } - return ""; + return u""; } -constexpr const char* getRelationCompPrefix(DocumentType eDocumentType) +constexpr std::u16string_view getRelationCompPrefix(DocumentType eDocumentType) { switch (eDocumentType) { - case DOCUMENT_DOCX: return ""; + case DOCUMENT_DOCX: return u""; case DOCUMENT_PPTX: - case DOCUMENT_XLSX: return "../"; + case DOCUMENT_XLSX: return u"../"; } - return ""; + return u""; } class OOX_DLLPUBLIC GraphicExportCache @@ -251,12 +251,15 @@ public: } }; -class GraphicExport +class OOX_DLLPUBLIC GraphicExport { +private: sax_fastparser::FSHelperPtr mpFS; oox::core::XmlFilterBase* mpFilterBase; DocumentType meDocumentType; + OUString writeNewEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia); + public: GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFilterBase, DocumentType eDocumentType) : mpFS(pFS) @@ -319,8 +322,8 @@ protected: void WriteStyleProperties( sal_Int32 nTokenId, const css::uno::Sequence< css::beans::PropertyValue >& aProperties ); - const char* GetComponentDir() const; - const char* GetRelationCompPrefix() const; + OUString GetComponentDir() const; + OUString GetRelationCompPrefix() const; static bool EqualGradients( const css::awt::Gradient2& rGradient1, const css::awt::Gradient2& rGradient2 ); bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet); @@ -349,7 +352,7 @@ public: void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; } /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship - OUString writeGraphicToStorage( const Graphic &rGraphic , bool bRelPathToMedia = false ); + OUString writeGraphicToStorage(const Graphic &rGraphic , bool bRelPathToMedia = false); void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index b44ab8b21f47..0bb2272d6ecf 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1256,14 +1256,14 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc mpFS->endElementNS( XML_a, XML_ln ); } -const char* DrawingML::GetComponentDir() const +OUString DrawingML::GetComponentDir() const { - return getComponentDir(meDocumentType); + return OUString(getComponentDir(meDocumentType)); } -const char* DrawingML::GetRelationCompPrefix() const +OUString DrawingML::GetRelationCompPrefix() const { - return getRelationCompPrefix(meDocumentType); + return OUString(getRelationCompPrefix(meDocumentType)); } void GraphicExport::writeBlip(Graphic const& rGraphic, std::vector<model::BlipEffect> const& rEffects, bool bRelPathToMedia) @@ -1384,136 +1384,135 @@ void GraphicExport::writeBlip(Graphic const& rGraphic, std::vector<model::BlipEf mpFS->endElementNS(XML_a, XML_blip); } -OUString GraphicExport::writeToStorage(const Graphic& rGraphic , bool bRelPathToMedia) +OUString GraphicExport::writeNewEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia) { - GfxLink aLink = rGraphic.GetGfxLink (); - BitmapChecksum aChecksum = rGraphic.GetChecksum(); + GfxLink const& rLink = rGraphic.GetGfxLink(); + OUString sMediaType; - const char* pExtension = ""; - OUString sRelId; - OUString sPath; + OUString aExtension; - // tdf#74670 tdf#91286 Save image only once - GraphicExportCache& rGraphicExportCache = GraphicExportCache::get(); - sPath = rGraphicExportCache.findExportGraphics(aChecksum); + SvMemoryStream aStream; + const void* aData = rLink.GetData(); + std::size_t nDataSize = rLink.GetDataSize(); - if (sPath.isEmpty()) + switch (rLink.GetType()) { - SvMemoryStream aStream; - const void* aData = aLink.GetData(); - std::size_t nDataSize = aLink.GetDataSize(); - - switch (aLink.GetType()) - { - case GfxLinkType::NativeGif: - sMediaType = "image/gif"; - pExtension = ".gif"; - break; + case GfxLinkType::NativeGif: + sMediaType = "image/gif"; + aExtension = "gif"; + break; - // #i15508# added BMP type for better exports - // export not yet active, so adding for reference (not checked) - case GfxLinkType::NativeBmp: - sMediaType = "image/bmp"; - pExtension = ".bmp"; - break; + // #i15508# added BMP type for better exports + // export not yet active, so adding for reference (not checked) + case GfxLinkType::NativeBmp: + sMediaType = "image/bmp"; + aExtension = "bmp"; + break; - case GfxLinkType::NativeJpg: - sMediaType = "image/jpeg"; - pExtension = ".jpeg"; - break; - case GfxLinkType::NativePng: - sMediaType = "image/png"; - pExtension = ".png"; - break; - case GfxLinkType::NativeSvg: - sMediaType = "image/svg"; - pExtension = ".svg"; - break; - case GfxLinkType::NativeTif: - sMediaType = "image/tiff"; - pExtension = ".tif"; - break; - case GfxLinkType::NativeWmf: - sMediaType = "image/x-wmf"; - pExtension = ".wmf"; - break; - case GfxLinkType::NativeMet: - sMediaType = "image/x-met"; - pExtension = ".met"; - break; - case GfxLinkType::NativePct: - sMediaType = "image/x-pict"; - pExtension = ".pct"; - break; - case GfxLinkType::NativeMov: - sMediaType = "application/movie"; - pExtension = ".MOV"; - break; - default: + case GfxLinkType::NativeJpg: + sMediaType = "image/jpeg"; + aExtension = "jpeg"; + break; + case GfxLinkType::NativePng: + sMediaType = "image/png"; + aExtension = "png"; + break; + case GfxLinkType::NativeTif: + sMediaType = "image/tiff"; + aExtension = "tif"; + break; + case GfxLinkType::NativeWmf: + sMediaType = "image/x-wmf"; + aExtension = "wmf"; + break; + case GfxLinkType::NativeMet: + sMediaType = "image/x-met"; + aExtension = "met"; + break; + case GfxLinkType::NativePct: + sMediaType = "image/x-pict"; + aExtension = "pct"; + break; + case GfxLinkType::NativeMov: + sMediaType = "application/movie"; + aExtension = "MOV"; + break; + default: + { + GraphicType aType = rGraphic.GetType(); + if (aType == GraphicType::Bitmap || aType == GraphicType::GdiMetafile) { - GraphicType aType = rGraphic.GetType(); - if (aType == GraphicType::Bitmap || aType == GraphicType::GdiMetafile) + if (aType == GraphicType::Bitmap) { - if (aType == GraphicType::Bitmap) - { - (void)GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::PNG); - sMediaType = "image/png"; - pExtension = ".png"; - } - else - { - (void)GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::EMF); - sMediaType = "image/x-emf"; - pExtension = ".emf"; - } + (void)GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::PNG); + sMediaType = "image/png"; + aExtension = "png"; } else { - SAL_WARN("oox.shape", "unhandled graphic type " << static_cast<int>(aType)); - /*Earlier, even in case of unhandled graphic types we were - proceeding to write the image, which would eventually - write an empty image with a zero size, and return a valid - relationID, which is incorrect. - */ - return sRelId; + (void)GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::EMF); + sMediaType = "image/x-emf"; + aExtension = "emf"; } - - aData = aStream.GetData(); - nDataSize = aStream.GetEndOfData(); - break; } + else + { + SAL_WARN("oox.shape", "unhandled graphic type " << static_cast<int>(aType)); + + /*Earlier, even in case of unhandled graphic types we were + proceeding to write the image, which would eventually + write an empty image with a zero size, and return a valid + relationID, which is incorrect. + */ + return OUString(); + } + + aData = aStream.GetData(); + nDataSize = aStream.GetEndOfData(); } + break; + } - sal_Int32 nImageCount = rGraphicExportCache.nextImageCount(); - Reference<XOutputStream> xOutStream = mpFilterBase->openFragmentStream( - OUStringBuffer() - .appendAscii(getComponentDir(meDocumentType)) - .append("/media/image" + OUString::number(nImageCount)) - .appendAscii(pExtension) - .makeStringAndClear(), - sMediaType); - xOutStream->writeBytes(Sequence<sal_Int8>(static_cast<const sal_Int8*>(aData), nDataSize)); - xOutStream->closeOutput(); + GraphicExportCache& rGraphicExportCache = GraphicExportCache::get(); + auto sImageCountString = OUString::number(rGraphicExportCache.nextImageCount()); - const OString sRelPathToMedia = "media/image"; - OString sRelationCompPrefix; - if (bRelPathToMedia) - sRelationCompPrefix = "../"; - else - sRelationCompPrefix = getRelationCompPrefix(meDocumentType); - sPath = OUStringBuffer() - .appendAscii(sRelationCompPrefix.getStr()) - .appendAscii(sRelPathToMedia.getStr()) - .append(nImageCount) - .appendAscii(pExtension) - .makeStringAndClear(); + OUString sComponentDir(getComponentDir(meDocumentType)); + + OUString sImagePath = sComponentDir + "/media/image" + sImageCountString + "." + aExtension; + + Reference<XOutputStream> xOutStream = mpFilterBase->openFragmentStream(sImagePath, sMediaType); + xOutStream->writeBytes(Sequence<sal_Int8>(static_cast<const sal_Int8*>(aData), nDataSize)); + xOutStream->closeOutput(); - rGraphicExportCache.addExportGraphics(aChecksum, sPath); + OUString sRelationCompPrefix; + if (bRelPathToMedia) + sRelationCompPrefix = "../"; + else + sRelationCompPrefix = getRelationCompPrefix(meDocumentType); + + OUString sPath = sRelationCompPrefix + "media/image" + sImageCountString + "." + aExtension; + + rGraphicExportCache.addExportGraphics(rGraphic.GetChecksum(), sPath); + + return sPath; +} + +OUString GraphicExport::writeToStorage(const Graphic& rGraphic , bool bRelPathToMedia) +{ + OUString sPath; + + GraphicExportCache& rGraphicExportCache = GraphicExportCache::get(); + sPath = rGraphicExportCache.findExportGraphics(rGraphic.GetChecksum()); + + if (sPath.isEmpty()) + { + sPath = writeNewEntryToStorage(rGraphic, bRelPathToMedia); + + if (sPath.isEmpty()) + return OUString(); // couldn't store - just return empty string } - sRelId = mpFilterBase->addRelation( mpFS->getOutputStream(), - oox::getRelationship(Relationship::IMAGE), - sPath ); + OUString sRelId = mpFilterBase->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::IMAGE), sPath); return sRelId; } @@ -1586,10 +1585,7 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra { sal_Int32 nImageCount = GraphicExportCache::get().nextImageCount(); - OUString sFileName = OUStringBuffer() - .appendAscii(GetComponentDir()) - .append("/media/media" + OUString::number(nImageCount) + aExtension) - .makeStringAndClear(); + OUString sFileName = GetComponentDir() + "/media/media" + OUString::number(nImageCount) + aExtension; // copy the video stream Reference<XOutputStream> xOutStream = mpFB->openFragmentStream(sFileName, aMimeType); @@ -1600,9 +1596,8 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra xOutStream->closeOutput(); // create the relation - OUString aPath = OUStringBuffer().appendAscii(GetRelationCompPrefix()) - .append("media/media" + OUString::number(nImageCount) + aExtension) - .makeStringAndClear(); + OUString aPath = GetRelationCompPrefix() + "media/media" + OUString::number(nImageCount) + aExtension; + aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), aPath); aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), aPath); } @@ -6081,16 +6076,14 @@ OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< sal sal_Int32 nWdpImageCount = rGraphicExportCache.nextWdpImageCount(); OUString sFileName = "media/hdphoto" + OUString::number(nWdpImageCount) + ".wdp"; - OUString sFragment = OUStringBuffer().appendAscii(GetComponentDir()).append( "/" + sFileName).makeStringAndClear(); + OUString sFragment = GetComponentDir() + "/" + sFileName; Reference< XOutputStream > xOutStream = mpFB->openFragmentStream(sFragment, "image/vnd.ms-photo"); xOutStream->writeBytes( rPictureData ); xOutStream->closeOutput(); - aId = mpFB->addRelation( mpFS->getOutputStream(), - oox::getRelationship(Relationship::HDPHOTO), - OUStringBuffer() - .appendAscii( GetRelationCompPrefix() ) - .append( sFileName ) ); + aId = mpFB->addRelation(mpFS->getOutputStream(), + oox::getRelationship(Relationship::HDPHOTO), + Concat2View(GetRelationCompPrefix() + sFileName)); rGraphicExportCache.addToWdpCache(rFileId, aId); @@ -6194,7 +6187,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference<css::drawing::XShape>& rX mpFS->startElementNS(XML_a, XML_graphicData, XML_uri, "http://schemas.openxmlformats.org/drawingml/2006/diagram"); - OUString sRelationCompPrefix = OUString::createFromAscii(GetRelationCompPrefix()); + OUString sRelationCompPrefix = GetRelationCompPrefix(); // add data relation OUString dataFileName = "diagrams/data" + OUString::number(nDiagramId) + ".xml"; @@ -6260,7 +6253,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference<css::drawing::XShape>& rX uno::Reference<xml::sax::XWriter> writer = xml::sax::Writer::create(comphelper::getProcessComponentContext()); - OUString sDir = OUString::createFromAscii(GetComponentDir()); + OUString sDir = GetComponentDir(); // write data file serializer.set(dataDom, uno::UNO_QUERY); @@ -6360,7 +6353,7 @@ void DrawingML::writeDiagramRels(const uno::Sequence<uno::Sequence<uno::Any>>& x mpFB->addRelation(xOutStream, sType, Concat2View("../" + sFragment)); - OUString sDir = OUString::createFromAscii(GetComponentDir()); + OUString sDir = GetComponentDir(); uno::Reference<io::XOutputStream> xBinOutStream = mpFB->openFragmentStream(sDir + "/" + sFragment, sContentType); diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 48fb95145edd..0558892fe894 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2689,10 +2689,10 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) assert(!sRelationType.isEmpty()); assert(!sSuffix.isEmpty()); - OUString sFileName - = "embeddings/oleObject" + OUString::number(++m_nEmbeddedObjects) + "." + sSuffix; - uno::Reference<io::XOutputStream> const xOutStream(mpFB->openFragmentStream( - OUString::createFromAscii(GetComponentDir()) + "/" + sFileName, sMediaType)); + OUString sNumber = OUString::number(++m_nEmbeddedObjects); + OUString sFileName = "embeddings/oleObject" + sNumber + "." + sSuffix; + OUString sFilePath = GetComponentDir() + "/" + sFileName; + uno::Reference<io::XOutputStream> const xOutStream(mpFB->openFragmentStream(sFilePath, sMediaType)); assert(xOutStream.is()); // no reason why that could fail try @@ -2706,7 +2706,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) sRelId = mpFB->addRelation( mpFS->getOutputStream(), sRelationType, - Concat2View(OUString::createFromAscii(GetRelationCompPrefix()) + sFileName)); + Concat2View(GetRelationCompPrefix() + sFileName)); } sal_Int64 nAspect; commit 0018360f9343fd6a3ace82a5c305ad0c64812b52 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Sep 17 23:00:17 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Dec 10 12:36:57 2023 +0100 oox: remove returning sRelId and rename WriteImage Rename WriteImage -> writeGraphicToStorage to make it more clear what the method does. Remove returning the rel ID string in some methods that write the graphic into the stream (or the call chain), as it is never used later on, so it is better to not return it if it is not used (it could be abused). Change-Id: I78558671b82aedb34bd0f37bf7781c47ebf1cf5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157235 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 33c347fb3b0fbbae9c1005b1ca7a6105284a6d31) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160381 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index be0633110c74..fd293c28b5d2 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -265,7 +265,7 @@ public: {} OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = false); - OUString writeBlip(Graphic const& rGraphic, std::vector<model::BlipEffect> const& rEffects, bool bRelPathToMedia = false); + void writeBlip(Graphic const& rGraphic, std::vector<model::BlipEffect> const& rEffects, bool bRelPathToMedia = false); }; class OOX_DLLPUBLIC DrawingML @@ -349,7 +349,7 @@ public: void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; } /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship - OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false ); + OUString writeGraphicToStorage( const Graphic &rGraphic , bool bRelPathToMedia = false ); void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); @@ -419,7 +419,7 @@ public: void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float fFirstCharHeight); - OUString WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet, + void WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet, css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, bool bRelPathToMedia); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 20d22ec1aef0..b44ab8b21f47 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1266,11 +1266,9 @@ const char* DrawingML::GetRelationCompPrefix() const return getRelationCompPrefix(meDocumentType); } -OUString GraphicExport::writeBlip(Graphic const& rGraphic, std::vector<model::BlipEffect> const& rEffects, bool bRelPathToMedia) +void GraphicExport::writeBlip(Graphic const& rGraphic, std::vector<model::BlipEffect> const& rEffects, bool bRelPathToMedia) { - OUString sRelId; - - sRelId = writeToStorage(rGraphic, bRelPathToMedia); + OUString sRelId = writeToStorage(rGraphic, bRelPathToMedia); mpFS->startElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), sRelId); @@ -1384,8 +1382,6 @@ OUString GraphicExport::writeBlip(Graphic const& rGraphic, std::vector<model::Bl } mpFS->endElementNS(XML_a, XML_blip); - - return sRelId; } OUString GraphicExport::writeToStorage(const Graphic& rGraphic , bool bRelPathToMedia) @@ -1522,10 +1518,10 @@ OUString GraphicExport::writeToStorage(const Graphic& rGraphic , bool bRelPathTo return sRelId; } -OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) +OUString DrawingML::writeGraphicToStorage( const Graphic& rGraphic , bool bRelPathToMedia ) { - GraphicExport exporter(mpFS, mpFB, meDocumentType); - return exporter.writeToStorage(rGraphic, bRelPathToMedia); + GraphicExport aExporter(mpFS, mpFB, meDocumentType); + return aExporter.writeToStorage(rGraphic, bRelPathToMedia); } void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::drawing::XShape>& xShape) @@ -1683,17 +1679,17 @@ void DrawingML::WriteImageBrightnessContrastTransparence(uno::Reference<beans::X } } -OUString DrawingML::WriteXGraphicBlip(uno::Reference<beans::XPropertySet> const & rXPropSet, +void DrawingML::WriteXGraphicBlip(uno::Reference<beans::XPropertySet> const & rXPropSet, uno::Reference<graphic::XGraphic> const & rxGraphic, bool bRelPathToMedia) { OUString sRelId; if (!rxGraphic.is()) - return sRelId; + return; Graphic aGraphic(rxGraphic); - sRelId = WriteImage(aGraphic, bRelPathToMedia); + sRelId = writeGraphicToStorage(aGraphic, bRelPathToMedia); mpFS->startElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), sRelId); @@ -1702,8 +1698,6 @@ OUString DrawingML::WriteXGraphicBlip(uno::Reference<beans::XPropertySet> const WriteArtisticEffect(rXPropSet); mpFS->endElementNS(XML_a, XML_blip); - - return sRelId; } void DrawingML::WriteXGraphicBlipMode(uno::Reference<beans::XPropertySet> const & rXPropSet, @@ -3155,12 +3149,12 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS BitmapEx aDestBitmap(Bitmap(aDestSize, vcl::PixelFormat::N24_BPP), aMask); aDestBitmap.CopyPixel(aDestRect, aSourceRect, &aSourceBitmap); Graphic aDestGraphic(aDestBitmap); - sRelationId = WriteImage(aDestGraphic); + sRelationId = writeGraphicToStorage(aDestGraphic); fBulletSizeRel = 1.0f; } else { - sRelationId = WriteImage(aGraphic); + sRelationId = writeGraphicToStorage(aGraphic); } mpFS->singleElementNS( XML_a, XML_buSzPct, diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 0ef1d3a05447..1e99801a18b6 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -717,7 +717,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& const uno::Reference<graphic::XGraphic>& xGraphic = pSdrGrafObj->getSignatureLineUnsignedGraphic(); Graphic aGraphic(xGraphic); - OUString aImageId = m_pTextExport->GetDrawingML().WriteImage(aGraphic, false); + OUString aImageId = m_pTextExport->GetDrawingML().writeGraphicToStorage(aGraphic, false); pAttrList->add(FSNS(XML_r, XML_id), aImageId); imageData = true; } @@ -731,7 +731,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& aStream.Seek(0); Graphic aGraphic; GraphicConverter::Import(aStream, aGraphic); - OUString aImageId = m_pTextExport->GetDrawingML().WriteImage(aGraphic, false); + OUString aImageId = m_pTextExport->GetDrawingML().writeGraphicToStorage(aGraphic, false); pAttrList->add(FSNS(XML_r, XML_id), aImageId); imageData = true; } diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 3d931a258508..0be53503cd81 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -439,7 +439,7 @@ void XclExpImgData::SaveXml( XclExpXmlStream& rStrm ) sax_fastparser::FSHelperPtr pWorksheet = rStrm.GetCurrentStream(); DrawingML aDML(pWorksheet, &rStrm, drawingml::DOCUMENT_XLSX); - OUString rId = aDML.WriteImage( maGraphic ); + OUString rId = aDML.writeGraphicToStorage(maGraphic); pWorksheet->singleElement(XML_picture, FSNS(XML_r, XML_id), rId); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a920684b4a71..af1a940dad71 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5109,7 +5109,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size aGraphic = *pOLENode->GetGraphic(); m_rDrawingML.SetFS(m_pSerializer); // to be sure that we write to the right stream - OUString aImageId = m_rDrawingML.WriteImage(aGraphic, false); + OUString aImageId = m_rDrawingML.writeGraphicToStorage(aGraphic, false); aRelId = OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8); nImageType = XML_embed; @@ -5757,7 +5757,7 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S // write preview image const Graphic* pGraphic = rNode.GetGraphic(); m_rDrawingML.SetFS(m_pSerializer); - OUString sImageId = m_rDrawingML.WriteImage( *pGraphic ); + OUString sImageId = m_rDrawingML.writeGraphicToStorage(*pGraphic); if ( sDrawAspect == "Content" ) { @@ -10148,7 +10148,7 @@ void DocxAttributeOutput::BulletDefinition(int nId, const Graphic& rGraphic, Siz XML_style, aStyle.getStr(), FSNS(XML_o, XML_bullet), "t"); - OUString aRelId = m_rDrawingML.WriteImage(rGraphic); + OUString aRelId = m_rDrawingML.writeGraphicToStorage(rGraphic); m_pSerializer->singleElementNS( XML_v, XML_imagedata, FSNS(XML_r, XML_id), OUStringToOString(aRelId, RTL_TEXTENCODING_UTF8), FSNS(XML_o, XML_title), "");