diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-12-18 15:01:38 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-12-23 08:21:14 +0100 |
commit | 0322a41224a7264bbe03a068647ab093bcc88f90 (patch) | |
tree | f3727c86193227546c9e5e5a393395f3da769522 /sc/source | |
parent | f3e0595fcba689b07f6419c2fb540731a3aadecf (diff) |
XStyleLoader::loadStylesFromURL Allow loading from stream
Change-Id: Iab0c301096118203466dd91c724c25f1283a0488
Reviewed-on: https://gerrit.libreoffice.org/85392
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/docshell/tablink.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/styleuno.cxx | 22 |
2 files changed, 25 insertions, 2 deletions
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 6d43206f4c0a..9ef612caa161 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -514,7 +514,8 @@ SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::share ScDocumentLoader::ScDocumentLoader(const OUString& rFileName, OUString& rFilterName, OUString& rOptions, - sal_uInt32 nRekCnt, weld::Window* pInteractionParent) + sal_uInt32 nRekCnt, weld::Window* pInteractionParent, + css::uno::Reference<css::io::XInputStream> xInputStream) : pDocShell(nullptr) , pMedium(nullptr) { @@ -524,6 +525,8 @@ ScDocumentLoader::ScDocumentLoader(const OUString& rFileName, std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName ); pMedium = CreateMedium(rFileName, pFilter, rOptions, pInteractionParent); + if (xInputStream.is()) + pMedium->setStreamToLoadFrom(xInputStream, true); if ( pMedium->GetError() != ERRCODE_NONE ) return ; diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index aed15b31427e..452c5dc3d345 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -529,7 +529,27 @@ void SAL_CALL ScStyleFamiliesObj::loadStylesFromURL( const OUString& aURL, OUString aFilter; // empty - detect OUString aFiltOpt; - ScDocumentLoader aLoader( aURL, aFilter, aFiltOpt ); + uno::Reference<io::XInputStream> xInputStream; + if (aURL == "private:stream") + { + for (const auto& rProp : aOptions) + { + if (rProp.Name == "InputStream") + { + rProp.Value >>= xInputStream; + if (!xInputStream.is()) + { + throw lang::IllegalArgumentException( + "Parameter 'InputStream' could not be converted " + "to type 'com::sun::star::io::XInputStream'", + nullptr, 0); + } + break; + } + } + } + + ScDocumentLoader aLoader( aURL, aFilter, aFiltOpt, 0, nullptr, xInputStream ); ScDocShell* pSource = aLoader.GetDocShell(); |