LibreOffice Module connectivity (master) 1
HConnection.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#pragma once
21
23#include <com/sun/star/util/XFlushable.hpp>
24#include <com/sun/star/sdbc/XDriver.hpp>
25#include <com/sun/star/sdb/application/XTableUIProvider.hpp>
28#include <comphelper/uno3.hxx>
30
32 {
34 {
35 public:
36 virtual ::osl::Mutex& getMutex() const = 0;
37 virtual void checkDisposed() const = 0;
38
39 protected:
41 };
42
43
44 // OHsqlConnection - wraps all methods to the real connection from the driver
45 // but when disposed it doesn't dispose the real connection
46
47 typedef ::cppu::WeakComponentImplHelper< css::util::XFlushable
48 , css::sdb::application::XTableUIProvider
50
53 ,public OConnectionWrapper
54 ,public IMethodGuardAccess
55 {
56 private:
58 css::uno::Reference< css::sdbc::XDriver > m_xDriver;
59 css::uno::Reference< css::uno::XComponentContext > m_xContext;
60 bool m_bIni;
62
63 protected:
64 virtual void SAL_CALL disposing() override;
65 virtual ~OHsqlConnection() override;
66
67 public:
69 const css::uno::Reference< css::sdbc::XDriver >& _rxDriver,
70 const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
71 const css::uno::Reference< css::uno::XComponentContext>& _rxContext
72 );
73
74 // XServiceInfo
77 DECLARE_XINTERFACE( )
78
79 // IMethodGuardAccess
80 virtual ::osl::Mutex& getMutex() const override;
81 virtual void checkDisposed() const override;
82
83 // XFlushable
84 virtual void SAL_CALL flush( ) override;
85 virtual void SAL_CALL addFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override;
86 virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override;
87
88 // XTableUIProvider
89 virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getTableIcon( const OUString& TableName, ::sal_Int32 ColorMode ) override;
90 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getTableEditor( const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& DocumentUI, const OUString& TableName ) override;
91
92 private:
93
104 css::uno::Reference< css::container::XNameAccess >
106
115 void impl_checkExistingTable_throw( const OUString& _rTableName );
116
119 bool impl_isTextTable_nothrow( const OUString& _rTableName );
120
123 css::uno::Reference< css::graphic::XGraphic >
125 };
126
127
128 // OHsqlConnection
129
130 class MethodGuard : public ::osl::MutexGuard
131 {
132 public:
133 MethodGuard( const IMethodGuardAccess& _rComponent )
134 : ::osl::MutexGuard( _rComponent.getMutex() )
135 {
136 _rComponent.checkDisposed();
137 }
138 };
139
140}
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void checkDisposed() const =0
virtual ::osl::Mutex & getMutex() const =0
MethodGuard(const IMethodGuardAccess &_rComponent)
css::uno::Reference< css::sdbc::XDriver > m_xDriver
Definition: HConnection.hxx:58
virtual void checkDisposed() const override
virtual ::osl::Mutex & getMutex() const override
css::uno::Reference< css::container::XNameAccess > impl_getTableContainer_throw()
retrieves our table container
OHsqlConnection(const css::uno::Reference< css::sdbc::XDriver > &_rxDriver, const css::uno::Reference< css::sdbc::XConnection > &_xConnection, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
Definition: HConnection.cxx:82
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: HConnection.hxx:59
virtual void SAL_CALL removeFlushListener(const css::uno::Reference< css::util::XFlushListener > &l) override
virtual void SAL_CALL disposing() override
Definition: HConnection.cxx:75
css::uno::Reference< css::graphic::XGraphic > impl_getTextTableIcon_nothrow()
retrieves the icon for HSQL TEXT TABLEs
bool impl_isTextTable_nothrow(const OUString &_rTableName)
checks whether the given table name refers to a HSQL TEXT TABLE
void impl_checkExistingTable_throw(const OUString &_rTableName)
checks whether the given table name denotes an existing table
virtual void SAL_CALL flush() override
virtual void SAL_CALL addFlushListener(const css::uno::Reference< css::util::XFlushListener > &l) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getTableEditor(const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI > &DocumentUI, const OUString &TableName) override
::comphelper::OInterfaceContainerHelper2 m_aFlushListeners
Definition: HConnection.hxx:57
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getTableIcon(const OUString &TableName, ::sal_Int32 ColorMode) override
::cppu::WeakComponentImplHelper< css::util::XFlushable, css::sdb::application::XTableUIProvider > OHsqlConnection_BASE
Definition: HConnection.hxx:49
#define SAL_NO_VTABLE
#define DECLARE_XTYPEPROVIDER()