summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-04-29 15:49:46 +0200
committerAndras Timar <andras.timar@collabora.com>2015-05-01 22:46:17 +0200
commit7844233ec04bcaecfb47bb42302b95f1289f542f (patch)
treeaecbaf2f979a3126ae1f7b4c164f3f9d949e1a7e /unotools
parent42e3e549da6e6ef8c75493615d1c826adda265dd (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. (cherry picked from commit 7368b6ca3f61e750765f42e97d0a00e10fcac516) Conflicts: unotools/source/misc/closeveto.cxx Change-Id: Ied427b67274d925c911e516c0a50a4c0b2b18db9 Reviewed-on: https://gerrit.libreoffice.org/15567 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/misc/closeveto.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/unotools/source/misc/closeveto.cxx b/unotools/source/misc/closeveto.cxx
index 4044fa775e4b..9ecf82e96852 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,11 +139,11 @@ namespace utl
}
//= CloseVeto
-
- CloseVeto::CloseVeto( const Reference< XInterface >& i_closeable )
- :m_pData( new CloseVeto_Data )
+ CloseVeto::CloseVeto(const Reference< XInterface >& i_closeable,
+ bool const hasOwnership)
+ : m_pData(new CloseVeto_Data)
{
- lcl_init( *m_pData, i_closeable );
+ lcl_init(*m_pData, i_closeable, hasOwnership);
}
CloseVeto::~CloseVeto()