summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-04-29 15:49:46 +0200
committerMichael Stahl <mstahl@redhat.com>2015-04-29 16:13:10 +0200
commit7368b6ca3f61e750765f42e97d0a00e10fcac516 (patch)
treeae6b24d1f38df9bab905289b557321e16c7e45a3 /unotools
parent7259901b25974c00c8f0ce8acb91096858cfff53 (diff)
rhbz#1213173: connectivity: Calc driver: prevent document being disposed
... by adding a XCloseListener that vetoes any attempt to close it. The Calc document can be opened by the user in the UI and closed again. Change-Id: Ied427b67274d925c911e516c0a50a4c0b2b18db9
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/misc/closeveto.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/unotools/source/misc/closeveto.cxx b/unotools/source/misc/closeveto.cxx
index 290a18cb715f..b33ef2902df9 100644
--- a/unotools/source/misc/closeveto.cxx
+++ b/unotools/source/misc/closeveto.cxx
@@ -51,8 +51,8 @@ namespace utl
class CloseListener_Impl : public CloseListener_Base
{
public:
- CloseListener_Impl()
- :m_bHasOwnership( false )
+ CloseListener_Impl(bool const bHasOwnership)
+ : m_bHasOwnership(bHasOwnership)
{
}
@@ -107,12 +107,13 @@ namespace utl
namespace
{
- void lcl_init( CloseVeto_Data& i_data, const Reference< XInterface >& i_closeable )
+ void lcl_init( CloseVeto_Data& i_data, const Reference< XInterface >& i_closeable,
+ bool const hasOwnership)
{
i_data.xCloseable.set( i_closeable, UNO_QUERY );
ENSURE_OR_RETURN_VOID( i_data.xCloseable.is(), "CloseVeto: the component is not closeable!" );
- i_data.pListener = new CloseListener_Impl;
+ i_data.pListener = new CloseListener_Impl(hasOwnership);
i_data.xCloseable->addCloseListener( i_data.pListener.get() );
}
@@ -138,10 +139,11 @@ namespace utl
}
//= CloseVeto
- CloseVeto::CloseVeto( const Reference< XInterface >& i_closeable )
+ CloseVeto::CloseVeto(const Reference< XInterface >& i_closeable,
+ bool const hasOwnership)
: m_xData(new CloseVeto_Data)
{
- lcl_init(*m_xData, i_closeable);
+ lcl_init(*m_xData, i_closeable, hasOwnership);
}
CloseVeto::~CloseVeto()