diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-12-14 13:41:57 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-12-15 17:44:36 +0100 |
commit | b0fc09daf1086423a9bd457d9a2c043e7ff41451 (patch) | |
tree | ef5870338c359bb8b733588c2d1ef979afda89c7 /include | |
parent | 7dfa45a62b3b942823af5ccd59897364788589c8 (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.
Change-Id: I3d1ed29b3a2c0e77ec606a1d09f7bc07e7860733
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 f2b108d88631..24153c2b2fd3 100644 --- a/include/comphelper/embeddedobjectcontainer.hxx +++ b/include/comphelper/embeddedobjectcontainer.hxx @@ -43,6 +43,7 @@ namespace comphelper virtual css::uno::Reference < css::embed::XStorage > getStorage() const = 0; virtual css::uno::Reference< css::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; css::uno::Reference < css::embed::XEmbeddedObject > Get_Impl( const OUString&, - const css::uno::Reference < css::embed::XEmbeddedObject >& xCopy); + const css::uno::Reference < css::embed::XEmbeddedObject >& xCopy, + OUString const* pBaseURL = nullptr); public: // add an embedded object to the container storage @@ -92,7 +94,7 @@ public: OUString GetEmbeddedObjectName( const css::uno::Reference < css::embed::XEmbeddedObject >& ); // retrieve an embedded object by name that either has been added already or is available in the container storage - css::uno::Reference < css::embed::XEmbeddedObject > GetEmbeddedObject( const OUString& ); + css::uno::Reference<css::embed::XEmbeddedObject> GetEmbeddedObject(const OUString&, OUString const* pBaseURL = nullptr); // create an object from a ClassId css::uno::Reference < css::embed::XEmbeddedObject > diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 5b32ae833c22..90e2f577458e 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -583,6 +583,8 @@ public: { return IsEnableSetModified(); } + virtual OUString getDocumentBaseURL() const override; + comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const; void ClearEmbeddedObjects(); |