diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-16 09:16:43 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-16 09:16:43 +0100 |
commit | 6083a8f188e2cd3fe6849e2112a6b06fbf8e1ad3 (patch) | |
tree | fe15c1470e806b7eb4ef132221c47474b19dd35c /oox | |
parent | ec935c9b83ff2872c039522398c49e070149eea1 (diff) |
Related: tdf#59699 DOCX import: fix linked graphics with relative URLs
Because the writerfilter::ooxml::OOXMLFastContextHandlerShape
constructor only sent the input stream (and not the full media
descriptor) to oox::shape::ShapeContextHandler, it's startFastElement()
tried to reconstruct a media descriptor from just the input stream. As a
result, the base URL of the document got lost at the time the
oox::drawingml::BlipContext constructor tried to call getAbsoluteUrl(),
to convert the relative URL to an absolute one.
Fix the problem by sending not only the input stream, but the full media
descriptor to the shape importer. As a bonus that makes code simpler,
too.
Change-Id: I1f06c04d0745aa7e2e06d4848cf454790d5073ca
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/shape/ShapeContextHandler.cxx | 33 | ||||
-rw-r--r-- | oox/source/shape/ShapeContextHandler.hxx | 13 |
2 files changed, 18 insertions, 28 deletions
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index ae14d4474efe..6e256ac21274 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -272,13 +272,7 @@ void SAL_CALL ShapeContextHandler::startFastElement const uno::Reference< xml::sax::XFastAttributeList > & Attribs) throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { - static const OUString sInputStream - ("InputStream"); - - uno::Sequence<beans::PropertyValue> aSeq(1); - aSeq[0].Name = sInputStream; - aSeq[0].Value <<= mxInputStream; - mxFilterBase->filter(aSeq); + mxFilterBase->filter(maMediaDescriptor); mpThemePtr.reset(new Theme()); @@ -573,19 +567,6 @@ void SAL_CALL ShapeContextHandler::setModel mxFilterBase->setTargetDocument(xComp); } -uno::Reference< io::XInputStream > SAL_CALL -ShapeContextHandler::getInputStream() throw (uno::RuntimeException, std::exception) -{ - return mxInputStream; -} - -void SAL_CALL ShapeContextHandler::setInputStream -(const uno::Reference< io::XInputStream > & the_value) - throw (uno::RuntimeException, std::exception) -{ - mxInputStream = the_value; -} - OUString SAL_CALL ShapeContextHandler::getRelationFragmentPath() throw (uno::RuntimeException, std::exception) { @@ -631,6 +612,18 @@ uno::Reference<document::XDocumentProperties> SAL_CALL ShapeContextHandler::getD return mxDocumentProperties; } +uno::Sequence<beans::PropertyValue> SAL_CALL ShapeContextHandler::getMediaDescriptor() + throw (uno::RuntimeException, std::exception) +{ + return maMediaDescriptor; +} + +void SAL_CALL ShapeContextHandler::setMediaDescriptor(const uno::Sequence<beans::PropertyValue>& rMediaDescriptor) + throw (uno::RuntimeException, std::exception) +{ + maMediaDescriptor = rMediaDescriptor; +} + OUString ShapeContextHandler::getImplementationName() throw (css::uno::RuntimeException, std::exception) { diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx index c336129b51e5..353b7c538777 100644 --- a/oox/source/shape/ShapeContextHandler.hxx +++ b/oox/source/shape/ShapeContextHandler.hxx @@ -120,13 +120,6 @@ public: (const css::uno::Reference< css::frame::XModel > & the_value) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL - getInputStream() throw (css::uno::RuntimeException, std::exception) override; - - virtual void SAL_CALL setInputStream - (const css::uno::Reference< css::io::XInputStream > & the_value) - throw (css::uno::RuntimeException, std::exception) override; - virtual OUString SAL_CALL getRelationFragmentPath() throw (css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL setRelationFragmentPath @@ -143,6 +136,10 @@ public: throw (css::uno::RuntimeException, std::exception) override; virtual css::uno::Reference<css::document::XDocumentProperties> SAL_CALL getDocumentProperties() throw (css::uno::RuntimeException, std::exception) override; + virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getMediaDescriptor() + throw (css::uno::RuntimeException, std::exception) override; + virtual void SAL_CALL setMediaDescriptor(const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor) + throw (css::uno::RuntimeException, std::exception) override; private: ShapeContextHandler(ShapeContextHandler &) = delete; @@ -165,11 +162,11 @@ private: css::uno::Reference<XFastContextHandler> mxWpgContext; css::uno::Reference<XFastContextHandler> mxChartShapeContext; css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties; + css::uno::Sequence<css::beans::PropertyValue> maMediaDescriptor; ::rtl::Reference< core::XmlFilterBase > mxFilterBase; drawingml::ThemePtr mpThemePtr; css::uno::Reference<css::drawing::XDrawPage> mxDrawPage; - css::uno::Reference<css::io::XInputStream> mxInputStream; OUString msRelationFragmentPath; css::uno::Reference<XFastContextHandler> getGraphicShapeContext(::sal_Int32 Element); |