diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-12-14 13:41:57 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-17 16:24:01 +0000 |
commit | fe4c7f20c272cf7a984d0db79199fe74bd31fc86 (patch) | |
tree | 298756014401717a1148306d7715a5772105301b /include | |
parent | aed57fec1530b4f377f8105b167ab9343c22bc37 (diff) |
fix missing BaseURL when loading embedded objects
When the object is edited in the UI, the m_xClient is set to a
SfxInPlaceClient and the DocumentBaseURL is retrieved from it. But if
the object is not edited, it will be loaded during export via the API
and without a m_xClient; in this case the DocumentBaseURL must have been
set previously to be available during import.
There appears to be no way to get the URL of the document via the API
while it is being imported; SfxBaseModel's m_sURL is unfortunately only
initialized from SfxObjectShell::FinishedLoading().
During ODF import, the SvXMLEmbeddedObjectHelper creates the
embedded object, so let's make it pass in the parent's BaseURL.
The "DefaultParentBaseURL" parameter already exists but was unused
previously.
(cherry picked from commit b0fc09daf1086423a9bd457d9a2c043e7ff41451)
(cherry picked from commit 4118f8f4c20ae711b95ab3052656bde673aa8852)
sw: loading embedded ODF objects requires unordf component
(cherry picked from commit b3b7982f4690f4ac0f0e9680970ba544157c36dc)
Change-Id: I3d1ed29b3a2c0e77ec606a1d09f7bc07e7860733
Reviewed-on: https://gerrit.libreoffice.org/20761
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/embeddedobjectcontainer.hxx | 6 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx index 842a3e7f804c..a689ca605818 100644 --- a/include/comphelper/embeddedobjectcontainer.hxx +++ b/include/comphelper/embeddedobjectcontainer.hxx @@ -43,6 +43,7 @@ namespace comphelper virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const = 0; virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const = 0; virtual bool isEnableSetModified() const = 0; + virtual OUString getDocumentBaseURL() const = 0; protected: ~IEmbeddedHelper() {} @@ -54,7 +55,8 @@ class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer EmbedImpl* pImpl; ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > Get_Impl( const OUString&, - const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xCopy); + const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xCopy, + OUString const* pBaseURL = nullptr); public: // add an embedded object to the container storage @@ -92,7 +94,7 @@ public: OUString GetEmbeddedObjectName( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ); // retrieve an embedded object by name that either has been added already or is available in the container storage - ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > GetEmbeddedObject( const OUString& ); + ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > GetEmbeddedObject( const OUString&, OUString const* pBaseURL = nullptr ); // create an object from a ClassId ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index ce8ab3018f6f..58e79f0cff25 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -582,6 +582,8 @@ public: { return IsEnableSetModified(); } + virtual OUString getDocumentBaseURL() const SAL_OVERRIDE; + comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const; void ClearEmbeddedObjects(); |