comphelper::LifecycleProxy: make writing work:
The storage implementation forgets any writes unless all storages are committed.
This commit is contained in:
@@ -65,6 +65,8 @@ public:
|
|||||||
::boost::scoped_ptr<Impl> m_pBadness;
|
::boost::scoped_ptr<Impl> m_pBadness;
|
||||||
LifecycleProxy();
|
LifecycleProxy();
|
||||||
~LifecycleProxy();
|
~LifecycleProxy();
|
||||||
|
// commit the storages: necessary for writes to streams to take effect!
|
||||||
|
void commitStorages();
|
||||||
};
|
};
|
||||||
|
|
||||||
class COMPHELPER_DLLPUBLIC OStorageHelper
|
class COMPHELPER_DLLPUBLIC OStorageHelper
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <com/sun/star/embed/ElementModes.hpp>
|
#include <com/sun/star/embed/ElementModes.hpp>
|
||||||
#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp>
|
#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp>
|
||||||
|
#include <com/sun/star/embed/XTransactedObject.hpp>
|
||||||
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
|
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
|
||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||||
@@ -551,6 +552,20 @@ LifecycleProxy::LifecycleProxy()
|
|||||||
: m_pBadness( new Impl() ) { }
|
: m_pBadness( new Impl() ) { }
|
||||||
LifecycleProxy::~LifecycleProxy() { }
|
LifecycleProxy::~LifecycleProxy() { }
|
||||||
|
|
||||||
|
void LifecycleProxy::commitStorages()
|
||||||
|
{
|
||||||
|
for (Impl::reverse_iterator iter = m_pBadness->rbegin();
|
||||||
|
iter != m_pBadness->rend(); ++iter) // reverse order (outwards)
|
||||||
|
{
|
||||||
|
uno::Reference<embed::XTransactedObject> const xTransaction(*iter,
|
||||||
|
uno::UNO_QUERY);
|
||||||
|
if (xTransaction.is())
|
||||||
|
{
|
||||||
|
xTransaction->commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void splitPath( std::vector<rtl::OUString> &rElems,
|
static void splitPath( std::vector<rtl::OUString> &rElems,
|
||||||
const ::rtl::OUString& rPath )
|
const ::rtl::OUString& rPath )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user