diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-02-26 11:15:37 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-02-26 06:04:43 +0100 |
commit | 3400424877032595490f38711b5e8520ed889fee (patch) | |
tree | 970b521dd0c5d18f37362ec53ebd52c3fa80f5e9 | |
parent | 6fa55d39bc43383fcdb3276e9b7f612fa96d1b67 (diff) |
xmloff: remove unused code when loading/saving the bitmap table
Change-Id: I6bffe243e813079538a4cb57111266b41d7c03f1
Reviewed-on: https://gerrit.libreoffice.org/50333
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | svx/source/unodraw/XPropertyTable.cxx | 9 | ||||
-rw-r--r-- | svx/source/xml/xmlxtimp.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/FillStyleContext.cxx | 31 | ||||
-rw-r--r-- | xmloff/source/style/ImageStyle.cxx | 38 |
4 files changed, 12 insertions, 72 deletions
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index 86e530a3eca6..a2675cafa5f5 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -625,8 +625,17 @@ std::unique_ptr<XPropertyEntry> SvxUnoXBitmapTable::createEntry(const OUString& return std::unique_ptr<XPropertyEntry>(); auto xBitmap = rAny.get<uno::Reference<awt::XBitmap>>(); + if (!xBitmap.is()) + return nullptr; + uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY); + if (!xGraphic.is()) + return nullptr; + Graphic aGraphic(xGraphic); + if (!aGraphic) + return nullptr; + GraphicObject aGraphicObject(aGraphic); return o3tl::make_unique<XBitmapEntry>(aGraphicObject, rName); } diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx index 6005a5c0199d..af5215c99582 100644 --- a/svx/source/xml/xmlxtimp.cxx +++ b/svx/source/xml/xmlxtimp.cxx @@ -285,12 +285,6 @@ void SvxXMLTableImportContext::importBitmap( const uno::Reference< XAttributeLis if (xBitmap.is()) rAny <<= xBitmap; } - else if (aGraphicAny.has<uno::Reference<awt::XBitmap>>()) - { - auto xBitmap = aGraphicAny.get<uno::Reference<awt::XBitmap>>(); - if (xBitmap.is()) - rAny <<= xBitmap; - } } catch (const Exception&) { diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx index 5c89613e826f..7a565fe74ecb 100644 --- a/xmloff/source/style/FillStyleContext.cxx +++ b/xmloff/source/style/FillStyleContext.cxx @@ -184,37 +184,6 @@ void XMLBitmapStyleContext::EndElement() catch (container::ElementExistException&) {} } - else - { - OUString sURL; - maAny >>= sURL; - - if( sURL.isEmpty() && mxBase64Stream.is() ) - { - sURL = GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream ); - mxBase64Stream = nullptr; - maAny <<= sURL; - } - - uno::Reference< container::XNameContainer > xBitmap( GetImport().GetBitmapHelper() ); - - try - { - if(xBitmap.is()) - { - if( xBitmap->hasByName( maStrName ) ) - { - xBitmap->replaceByName( maStrName, maAny ); - } - else - { - xBitmap->insertByName( maStrName, maAny ); - } - } - } - catch( container::ElementExistException& ) - {} - } } bool XMLBitmapStyleContext::IsTransient() const diff --git a/xmloff/source/style/ImageStyle.cxx b/xmloff/source/style/ImageStyle.cxx index 5842b659dc11..9976327103d8 100644 --- a/xmloff/source/style/ImageStyle.cxx +++ b/xmloff/source/style/ImageStyle.cxx @@ -83,38 +83,6 @@ void XMLImageStyle::exportXML(OUString const & rStrName, uno::Any const & rValue rExport.AddEmbeddedXGraphicAsBase64(xGraphic); } } - else if (rValue.has<OUString>()) // TODO: Remove when GraphicObject URL aren't used anymore - { - OUString sImageURL = rValue.get<OUString>(); - - // Name - bool bEncoded = false; - rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, - rExport.EncodeStyleName( rStrName, - &bEncoded ) ); - if( bEncoded ) - rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, - rStrName ); - - // uri - const OUString aStr( rExport.AddEmbeddedGraphicObject( sImageURL ) ); - if( !aStr.isEmpty() ) - { - rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr ); - rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); - rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); - rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); - } - - // Do Write - SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_FILL_IMAGE, true, true ); - - if( !sImageURL.isEmpty() ) - { - // optional office:binary-data - rExport.AddEmbeddedGraphicObjectAsBase64( sImageURL ); - } - } } bool XMLImageStyle::importXML(uno::Reference<xml::sax::XAttributeList> const & xAttrList, @@ -179,7 +147,8 @@ bool XMLImageStyle::importXML(uno::Reference<xml::sax::XAttributeList> const & x } } - rValue <<= xGraphic; + if (xGraphic.is()) + rValue <<= xGraphic; if( !aDisplayName.isEmpty() ) { @@ -188,8 +157,7 @@ bool XMLImageStyle::importXML(uno::Reference<xml::sax::XAttributeList> const & x rStrName = aDisplayName; } - bool bRet = bHasName && bHasHRef; - return bRet; + return bHasName && bHasHRef; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |