LibreOffice Module connectivity (master) 1
conncleanup.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_CONNECTIVITY_CONNCLEANUP_HXX
21#define INCLUDED_CONNECTIVITY_CONNCLEANUP_HXX
22
24#include <com/sun/star/beans/XPropertyChangeListener.hpp>
25#include <com/sun/star/sdbc/XRowSetListener.hpp>
27
28
29namespace com::sun::star::beans { class XPropertySet; }
30namespace com::sun::star::sdbc { class XRowSet; }
31namespace com::sun::star::sdbc { class XConnection; }
32
33namespace dbtools
34{
35
36
37 //= OAutoConnectionDisposer
38
39 typedef ::cppu::WeakImplHelper < css::beans::XPropertyChangeListener,
40 css::sdbc::XRowSetListener
42
44 {
45 css::uno::Reference< css::sdbc::XConnection >
47 css::uno::Reference< css::sdbc::XRowSet > m_xRowSet; // needed to add as listener
48 bool m_bRSListening : 1; // true when we're listening on rowset
49 bool m_bPropertyListening : 1; // true when we're listening for property changes
50
51 public:
58 const css::uno::Reference< css::sdbc::XRowSet >& _rxRowSet,
59 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
60 );
61
62 private:
63 // XPropertyChangeListener
64 virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& _rEvent ) override;
65
66 // XEventListener
67 virtual void SAL_CALL disposing( const css::lang::EventObject& _rSource ) override;
68
69 // XRowSetListener
70 virtual void SAL_CALL cursorMoved( const css::lang::EventObject& event ) override;
71 virtual void SAL_CALL rowChanged( const css::lang::EventObject& event ) override;
72 virtual void SAL_CALL rowSetChanged( const css::lang::EventObject& event ) override;
73
74 void clearConnection();
75
76 void startRowSetListening();
77 void stopRowSetListening();
78 bool isRowSetListening() const { return m_bRSListening; }
79
80 void startPropertyListening( const css::uno::Reference< css::beans::XPropertySet >& _rxProps );
81 void stopPropertyListening( const css::uno::Reference< css::beans::XPropertySet >& _rxEventSource );
82 };
83
84
85} // namespace dbtools
86
87
88#endif // INCLUDED_CONNECTIVITY_CONNCLEANUP_HXX
89
90/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::sdbc::XConnection > m_xOriginalConnection
Definition: conncleanup.hxx:46
css::uno::Reference< css::sdbc::XRowSet > m_xRowSet
Definition: conncleanup.hxx:47
#define OOO_DLLPUBLIC_DBTOOLS
class SAL_NO_VTABLE XPropertySet
::cppu::WeakImplHelper< css::beans::XPropertyChangeListener, css::sdbc::XRowSetListener > OAutoConnectionDisposer_Base
Definition: conncleanup.hxx:41