25#include <com/sun/star/embed/XStorage.hpp>
26#include <com/sun/star/embed/ElementModes.hpp>
27#include <osl/diagnose.h>
50 uno::Reference< io::XInputStream > xInputStream;
58 sal_uInt64 nBytes = pStream->
TellEnd();
67 OSL_ASSERT(!rURI.isEmpty());
68 uno::Reference < io::XInputStream > xInStream;
72 if (aURI.startsWith(
"/"))
75 sal_Int32 nQueryPos = aURI.indexOf(
'?');
77 aURI = aURI.copy(0, nQueryPos);
80 sal_Int32 nSepPos = aURI.indexOf(
'/' );
85 const OUString
sName = ::rtl::Uri::decode(
86 aURI, rtl_UriDecodeStrict, rtl_UriCharClassRelSegment);
87 if (
sName.isEmpty() && !aURI.isEmpty())
88 throw uno::Exception(
"Could not decode URI for stream element.",
nullptr);
90 uno::Reference< io::XStream >
xStream;
91 if (!rxStore->hasByName(
sName))
92 SAL_WARN(
"xmlsecurity.helper",
"expected stream, but not found: " <<
sName);
96 throw uno::RuntimeException();
97 xInStream =
xStream->getInputStream();
101 const OUString aStoreName = ::rtl::Uri::decode(
102 aURI.copy( 0, nSepPos ), rtl_UriDecodeStrict, rtl_UriCharClassRelSegment);
103 if (aStoreName.isEmpty() && !aURI.isEmpty())
104 throw uno::Exception(
"Could not decode URI for stream element.",
nullptr);
106 OUString aElement = aURI.copy( nSepPos+1 );
107 uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aStoreName, embed::ElementModes::READ );
virtual sal_uInt64 TellEnd()
css::uno::Reference< css::io::XInputStream > SAL_CALL getUriBinding(const OUString &uri) override
static css::uno::Reference< css::io::XInputStream > OpenInputStream(const css::uno::Reference< css::embed::XStorage > &rxStore, const OUString &rURI)
css::uno::Reference< css::embed::XStorage > mxStorage
void SAL_CALL setUriBinding(const OUString &uri, const css::uno::Reference< css::io::XInputStream > &aInputStream) override
#define SAL_WARN(area, stream)