diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-12-02 23:34:41 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-12-03 00:48:14 +0100 |
commit | c9a1a2acd51224f525f6ed246e52511192215dc0 (patch) | |
tree | cb7a2daf1ce8feb6982bab38eaff1a986c2c8ff9 /comphelper | |
parent | 18ab7abaa9426cd27092125637fdf5fb849b4a04 (diff) |
new comphelper::OStorageHelper::GetStreamAtPackageURL
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/inc/comphelper/storagehelper.hxx | 4 | ||||
-rw-r--r-- | comphelper/source/misc/storagehelper.cxx | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index 90685bf24fa6..c0aa735c8390 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -187,6 +187,10 @@ public: static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPath( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage, const ::rtl::OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness ); + static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPackageURL( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage, + const ::rtl::OUString& rURL, sal_uInt32 const nOpenMode, + LifecycleProxy & rNastiness ); }; } 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: */ |