From c9a1a2acd51224f525f6ed246e52511192215dc0 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 2 Dec 2011 23:34:41 +0100 Subject: new comphelper::OStorageHelper::GetStreamAtPackageURL --- comphelper/source/misc/storagehelper.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'comphelper/source/misc/storagehelper.cxx') diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 0aee11e259ee..6fb41c9cedb9 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -598,6 +598,22 @@ uno::Reference< io::XStream > OStorageHelper::GetStreamAtPath( return xStorage->openStreamElement( aName, nOpenMode ); } +uno::Reference< io::XStream > OStorageHelper::GetStreamAtPackageURL( + uno::Reference< embed::XStorage > const& xParentStorage, + const ::rtl::OUString& rURL, sal_uInt32 const nOpenMode, + OStorageHelper::LifecycleProxy & rNastiness) +{ + static char const s_PkgScheme[] = "vnd.sun.star.Package:"; + if (0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( + rURL.getStr(), rURL.getLength(), + s_PkgScheme, SAL_N_ELEMENTS(s_PkgScheme) - 1)) + { + ::rtl::OUString const path(rURL.copy(SAL_N_ELEMENTS(s_PkgScheme)-1)); + return GetStreamAtPath(xParentStorage, path, nOpenMode, rNastiness); + } + return 0; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3