diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 12:58:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 14:20:20 +0200 |
commit | 8f719de217b1079bd985b3bc63bbfa97069483bc (patch) | |
tree | cb15a422b7df468d913cb0815d628f7c0bc4fd9b /svx/source/xml | |
parent | bfc298d02ca6275588d5897d97ced9498a3e91aa (diff) |
loplugin:flatten in svx
Change-Id: I31f33a5f693d5fdb8282181c5bd7f31971efe784
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100236
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/xml')
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index f9839c38b8ed..b9082b6325c2 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -105,63 +105,63 @@ GraphicInputStream::GraphicInputStream(GraphicObject const & aGraphicObject, con { maTempFile.EnableKillingFile(); - if (aGraphicObject.GetType() != GraphicType::NONE) - { - std::unique_ptr<SvStream> pStream = ::utl::UcbStreamHelper::CreateStream(maTempFile.GetURL(), StreamMode::WRITE | StreamMode::TRUNC); + if (aGraphicObject.GetType() == GraphicType::NONE) + return; - if (pStream) - { - const Graphic& aGraphic(aGraphicObject.GetGraphic()); - const GfxLink aGfxLink(aGraphic.GetGfxLink()); - bool bRet = false; + std::unique_ptr<SvStream> pStream = ::utl::UcbStreamHelper::CreateStream(maTempFile.GetURL(), StreamMode::WRITE | StreamMode::TRUNC); - if (aGfxLink.GetDataSize() && aGfxLink.GetData()) - { - if (rMimeType.isEmpty()) - { - pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); - bRet = (pStream->GetError() == ERRCODE_NONE); - } - else - { - GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); - bRet = (rFilter.ExportGraphic(aGraphic, "", *pStream, rFilter.GetExportFormatNumberForMediaType(rMimeType)) == ERRCODE_NONE); - } - } - else - { - if (aGraphic.GetType() == GraphicType::Bitmap) - { - GraphicFilter & rFilter = GraphicFilter::GetGraphicFilter(); - OUString aFormat = rMimeType; + if (!pStream) + return; - if (aGraphic.IsAnimated()) - aFormat = "image/gif"; - else if (aFormat.isEmpty()) - aFormat = "image/png"; + const Graphic& aGraphic(aGraphicObject.GetGraphic()); + const GfxLink aGfxLink(aGraphic.GetGfxLink()); + bool bRet = false; - bRet = (rFilter.ExportGraphic(aGraphic, "", *pStream, rFilter.GetExportFormatNumberForMediaType(aFormat)) == ERRCODE_NONE); - } - else if (rMimeType.isEmpty() && aGraphic.GetType() == GraphicType::GdiMetafile) - { - pStream->SetVersion(SOFFICE_FILEFORMAT_8); - pStream->SetCompressMode(SvStreamCompressFlags::ZBITMAP); - const_cast<GDIMetaFile&>(aGraphic.GetGDIMetaFile()).Write(*pStream); - bRet = (pStream->GetError() == ERRCODE_NONE); - } - else if (!rMimeType.isEmpty()) - { - GraphicFilter & rFilter = GraphicFilter::GetGraphicFilter(); - bRet = ( rFilter.ExportGraphic( aGraphic, "", *pStream, rFilter.GetExportFormatNumberForMediaType( rMimeType ) ) == ERRCODE_NONE ); - } - } + if (aGfxLink.GetDataSize() && aGfxLink.GetData()) + { + if (rMimeType.isEmpty()) + { + pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); + bRet = (pStream->GetError() == ERRCODE_NONE); + } + else + { + GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); + bRet = (rFilter.ExportGraphic(aGraphic, "", *pStream, rFilter.GetExportFormatNumberForMediaType(rMimeType)) == ERRCODE_NONE); + } + } + else + { + if (aGraphic.GetType() == GraphicType::Bitmap) + { + GraphicFilter & rFilter = GraphicFilter::GetGraphicFilter(); + OUString aFormat = rMimeType; - if (bRet) - { - pStream->Seek( 0 ); - mxStreamWrapper = new ::utl::OInputStreamWrapper(std::move(pStream)); - } + if (aGraphic.IsAnimated()) + aFormat = "image/gif"; + else if (aFormat.isEmpty()) + aFormat = "image/png"; + + bRet = (rFilter.ExportGraphic(aGraphic, "", *pStream, rFilter.GetExportFormatNumberForMediaType(aFormat)) == ERRCODE_NONE); + } + else if (rMimeType.isEmpty() && aGraphic.GetType() == GraphicType::GdiMetafile) + { + pStream->SetVersion(SOFFICE_FILEFORMAT_8); + pStream->SetCompressMode(SvStreamCompressFlags::ZBITMAP); + const_cast<GDIMetaFile&>(aGraphic.GetGDIMetaFile()).Write(*pStream); + bRet = (pStream->GetError() == ERRCODE_NONE); } + else if (!rMimeType.isEmpty()) + { + GraphicFilter & rFilter = GraphicFilter::GetGraphicFilter(); + bRet = ( rFilter.ExportGraphic( aGraphic, "", *pStream, rFilter.GetExportFormatNumberForMediaType( rMimeType ) ) == ERRCODE_NONE ); + } + } + + if (bRet) + { + pStream->Seek( 0 ); + mxStreamWrapper = new ::utl::OInputStreamWrapper(std::move(pStream)); } } |