SHA256
1
0
forked from pool/libreoffice
libreoffice/revert-allow-impress-import-of-embedded-color-tables-libs-gui-2.diff

113 lines
4.5 KiB
Diff
Raw Normal View History

commit d45dea82e9688229accf4b7975ffcaac3df2e2c4
Author: Petr Mladek <pmladek@suse.cz>
Date: Mon Sep 5 12:18:19 2011 +0200
Revert "add a helper class to do path resolution"
Broke .odp export and needed more love (bnc#715931)
This reverts commit 7e93c8c7e0d54a6f0d53ab43041e658f3a14e9a4.
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx
index d9aa6c6..2f83331 100644
--- comphelper/inc/comphelper/storagehelper.hxx
+++ comphelper/inc/comphelper/storagehelper.hxx
@@ -171,26 +171,6 @@ public:
static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
static sal_Bool PathHasSegment( const ::rtl::OUString& aPath, const ::rtl::OUString& aSegment );
-
- // Methods to allow easy use of hierachical names inside storages
-
- // Unfortunately - the impl.s of XStorage like to invalidate all
- // their sub streams and storages when you release references, so
- // it is necessary to keep references to all storages down the
- // path - this is 'beautiful' (TM). So we need this ugly hack:
- class LifecycleProxyImpl;
- class LifecycleProxy {
- public:
- LifecycleProxyImpl *pBadness;
- LifecycleProxy();
- ~LifecycleProxy();
- };
- static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorageAtPath(
- 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 > GetStreamAtPath(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
- const ::rtl::OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness );
};
}
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index 2491418..f703cd3 100644
--- comphelper/source/misc/storagehelper.cxx
+++ comphelper/source/misc/storagehelper.cxx
@@ -36,7 +36,6 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/IllegalTypeException.hpp>
-#include <vector>
#include <rtl/digest.h>
#include <ucbhelper/content.hxx>
@@ -527,58 +526,6 @@ sal_Bool OStorageHelper::PathHasSegment( const ::rtl::OUString& aPath, const ::r
return bResult;
}
-class OStorageHelper::LifecycleProxyImpl : public std::vector< uno::Reference< embed::XStorage > > {};
-OStorageHelper::LifecycleProxy::LifecycleProxy() :
- pBadness( new OStorageHelper::LifecycleProxyImpl() ) { }
-OStorageHelper::LifecycleProxy::~LifecycleProxy() { delete pBadness; }
-
-static void splitPath( std::vector<rtl::OUString> &rElems,
- const ::rtl::OUString& rPath )
-{
- for (sal_Int32 i = 0; i >= 0;)
- rElems.push_back( rPath.getToken( 0, '/', i ) );
-}
-
-static uno::Reference< embed::XStorage > LookupStorageAtPath(
- const uno::Reference< embed::XStorage > &xParentStorage,
- std::vector<rtl::OUString> &rElems, sal_uInt32 nOpenMode,
- OStorageHelper::LifecycleProxy &rNastiness )
-{
- uno::Reference< embed::XStorage > xStorage( xParentStorage );
- rNastiness.pBadness->push_back( xStorage );
- for( size_t i = 0; i < rElems.size() && xStorage.is(); i++ )
- {
- xStorage = xStorage->openStorageElement( rElems[i], nOpenMode );
- rNastiness.pBadness->push_back( xStorage );
- }
- return xStorage;
-}
-
-uno::Reference< embed::XStorage > OStorageHelper::GetStorageAtPath(
- const uno::Reference< embed::XStorage > &xStorage,
- const ::rtl::OUString& rPath, sal_uInt32 nOpenMode,
- OStorageHelper::LifecycleProxy &rNastiness )
-{
- std::vector<rtl::OUString> aElems;
- splitPath( aElems, rPath );
- return LookupStorageAtPath( xStorage, aElems, nOpenMode, rNastiness );
-}
-
-uno::Reference< io::XStream > OStorageHelper::GetStreamAtPath(
- const uno::Reference< embed::XStorage > &xParentStorage,
- const ::rtl::OUString& rPath, sal_uInt32 nOpenMode,
- OStorageHelper::LifecycleProxy &rNastiness )
-{
- std::vector<rtl::OUString> aElems;
- splitPath( aElems, rPath );
- rtl::OUString aName( aElems.back() );
- aElems.pop_back();
- uno::Reference< embed::XStorage > xStorage(
- LookupStorageAtPath( xParentStorage, aElems, nOpenMode, rNastiness ),
- uno::UNO_QUERY_THROW );
- return xStorage->openStreamElement( aName, nOpenMode );
-}
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */