From fb29e6eeeaad5255bb924ff59162a83ed80bfb0a Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 8 Mar 2018 17:54:37 +0900 Subject: svx: removing GraphicURL and OWN_ATTR_GRAFURL, fix writerfilter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5b84788a324cc68e3c4561e9a7376fcb1cfeeb67 Reviewed-on: https://gerrit.libreoffice.org/50933 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- writerfilter/source/dmapper/GraphicImport.cxx | 38 ++++++++++++--------------- writerfilter/source/dmapper/GraphicImport.hxx | 4 ++- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index a6452c3d1a7a..5847e7d4a324 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -654,8 +654,8 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) uno::Reference< beans::XPropertySet > xShapeProps ( xShape, uno::UNO_QUERY_THROW ); - OUString sUrl; - xShapeProps->getPropertyValue("GraphicURL") >>= sUrl; + uno::Reference xGraphic; + xShapeProps->getPropertyValue("Graphic") >>= xGraphic; sal_Int32 nRotation = 0; xShapeProps->getPropertyValue("RotateAngle") >>= nRotation; @@ -672,10 +672,6 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) bContainsEffects = true; } - beans::PropertyValues aMediaProperties( 1 ); - aMediaProperties[0].Name = "URL"; - aMediaProperties[0].Value <<= sUrl; - xShapeProps->getPropertyValue("Shadow") >>= m_pImpl->bShadow; if (m_pImpl->bShadow) { @@ -691,7 +687,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) // fdo#70457: transform XShape into a SwXTextGraphicObject only if there's no rotation if ( nRotation == 0 && !bContainsEffects ) - m_xGraphicObject = createGraphicObject( aMediaProperties, xShapeProps ); + m_xGraphicObject = createGraphicObject( xGraphic, xShapeProps ); bUseShape = !m_xGraphicObject.is( ); @@ -1111,20 +1107,18 @@ void GraphicImport::lcl_entry(int /*pos*/, writerfilter::Reference:: { } -uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const beans::PropertyValues& aMediaProperties, const uno::Reference& xShapeProps ) +uno::Reference GraphicImport::createGraphicObject(uno::Reference const & rxGraphic, + uno::Reference const & xShapeProps) { - uno::Reference< text::XTextContent > xGraphicObject; + uno::Reference xGraphicObject; try { - uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(m_xComponentContext) ); - uno::Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( aMediaProperties ); - - if(xGraphic.is()) + if (rxGraphic.is()) { uno::Reference< beans::XPropertySet > xGraphicObjectProperties( m_xTextFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY_THROW); - xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_GRAPHIC), uno::makeAny( xGraphic )); + xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_GRAPHIC), uno::makeAny(rxGraphic)); xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_ANCHOR_TYPE), uno::makeAny( m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR ? text::TextContentAnchorType_AT_CHARACTER : @@ -1293,7 +1287,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b m_pImpl->applyZOrder(xGraphicObjectProperties); //there seems to be no way to detect the original size via _real_ API - uno::Reference< beans::XPropertySet > xGraphicProperties( xGraphic, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xGraphicProperties(rxGraphic, uno::UNO_QUERY_THROW); if (m_pImpl->mpWrapPolygon.get() != nullptr) { @@ -1357,14 +1351,16 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference::Pointer_t /*ref*/) { - beans::PropertyValues aMediaProperties( 1 ); - aMediaProperties[0].Name = getPropertyName(PROP_INPUT_STREAM); + beans::PropertyValues aMediaProperties( 1 ); + aMediaProperties[0].Name = getPropertyName(PROP_INPUT_STREAM); - uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len ); - aMediaProperties[0].Value <<= xIStream; + uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len ); + aMediaProperties[0].Value <<= xIStream; - uno::Reference xPropertySet; - m_xGraphicObject = createGraphicObject( aMediaProperties, xPropertySet ); + uno::Reference xPropertySet; + uno::Reference xGraphicProvider(graphic::GraphicProvider::create(m_xComponentContext)); + uno::Reference xGraphic = xGraphicProvider->queryGraphic(aMediaProperties); + m_xGraphicObject = createGraphicObject(xGraphic, xPropertySet); } diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx index f513632e966b..c0943ce1a4f4 100644 --- a/writerfilter/source/dmapper/GraphicImport.hxx +++ b/writerfilter/source/dmapper/GraphicImport.hxx @@ -73,7 +73,9 @@ class GraphicImport : public LoggedProperties, public LoggedTable css::uno::Reference m_xShape; void ProcessShapeOptions(Value const & val); - css::uno::Reference createGraphicObject(const css::beans::PropertyValues& aMediaProperties, const css::uno::Reference& xShapeProps); + css::uno::Reference + createGraphicObject(css::uno::Reference const & rxGraphic, + css::uno::Reference const & xShapeProps); void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue ); -- cgit