LibreOffice Module dbaccess (master) 1
dbsubcomponentcontroller.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_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
21#define INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
22
23#include <memory>
24
25#include <com/sun/star/document/XScriptInvocationContext.hpp>
26#include <com/sun/star/lang/EventObject.hpp>
27#include <com/sun/star/uno/Any.hxx>
28#include <com/sun/star/uno/Reference.hxx>
29#include <com/sun/star/uno/Sequence.hxx>
30#include <com/sun/star/uno/Type.hxx>
31#include <com/sun/star/util/XModifiable.hpp>
35#include <rtl/ustring.hxx>
36#include <sal/types.h>
37
38namespace com::sun::star {
39 namespace beans { class XPropertySet; }
40 namespace beans { struct PropertyValue; }
41 namespace document { class XEmbeddedScripts; }
42 namespace frame { class XModel; }
43 namespace sdbc { class XConnection; }
44 namespace sdbc { class XDatabaseMetaData; }
45 namespace uno { class XComponentContext; }
46 namespace util { class XModifyListener; }
47 namespace util { class XNumberFormatter; }
48}
49
50namespace dbtools {
51 class DatabaseMetaData;
52 class SQLExceptionInfo;
53}
54
55namespace dbaui
56{
57 //= DBSubComponentController
58
59 typedef ::cppu::ImplInheritanceHelper< OGenericUnoController
60 , css::document::XScriptInvocationContext
61 , css::util::XModifiable
63
66 {
67 private:
68 ::std::unique_ptr<DBSubComponentController_Impl> m_pImpl;
69
70 private:
74 void initializeConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxForeignConn );
75
76 protected:
77 // OGenericUnoController - initialization
78 virtual void impl_initialize() override;
79
80 // OGenericUnoController
81 virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
82
83 virtual css::uno::Reference< css::frame::XModel > getPrivateModel() const override;
84
85 bool impl_isModified() const;
86 virtual void impl_onModifyChanged();
87
88 public:
89 bool isReadOnly() const;
90 bool isEditable() const;
91 void setEditable(bool _bEditable);
92
93
94 // asking for connection-related stuff
95
96 bool isConnected() const;
97
98 css::uno::Reference< css::sdbc::XDatabaseMetaData >
99 getMetaData( ) const;
100
101
102 // access to the data source / document
103 OUString getDataSourceName() const;
104 const css::uno::Reference< css::beans::XPropertySet >&
105 getDataSource() const;
106 bool haveDataSource() const;
107
108 css::uno::Reference< css::frame::XModel >
109 getDatabaseDocument() const;
110
113 const ::dbtools::DatabaseMetaData& getSdbMetaData() const;
114
117 void appendError( const OUString& _rErrorMessage );
118
121 void clearError();
122
126 bool hasError() const;
127
130 const ::dbtools::SQLExceptionInfo& getError() const;
131
134 void displayError();
135
138 void connectionLostMessage() const;
139
144 const css::uno::Reference< css::sdbc::XConnection >&
145 getConnection() const;
146
149 css::uno::Reference< css::util::XNumberFormatter > const & getNumberFormatter() const;
150
151 // css::frame::XController
152 virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override;
153 virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > & xModel) override;
154
155 // XScriptInvocationContext
156 virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() override;
157
158 // XModifiable
159 virtual sal_Bool SAL_CALL isModified( ) override;
160 virtual void SAL_CALL setModified( sal_Bool bModified ) override;
161
162 // XModifyBroadcaster
163 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
164 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
165
166 // XTitle
167 virtual OUString SAL_CALL getTitle( ) override;
168
169 protected:
170 DBSubComponentController(const css::uno::Reference< css::uno::XComponentContext>& _rxORB);
171 virtual ~DBSubComponentController() override;
172
173 void disconnect();
174 virtual void reconnect( bool _bUI );
176 if ( !isConnected() ) reconnect( false );
177 return isConnected();
178 }
179
183 virtual void losingConnection( );
184
185 protected:
186 // XEventListener
187 virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
188
189 // OComponentHelper
190 virtual void SAL_CALL disposing() override;
191
192 // XInterface
193 virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
194
195 // XTypeProvider
196 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
197
198 protected:
199 sal_Int32 getCurrentStartNumber() const;
200 };
201
202
203} // namespace dbaui
204
205
206#endif // INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
207
208/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
::std::unique_ptr< DBSubComponentController_Impl > m_pImpl
#define DBACCESS_DLLPUBLIC
class SAL_NO_VTABLE XPropertySet
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
css::uno::Reference< css::uno::XInterface > getDataSource(const css::uno::Reference< css::uno::XInterface > &_rxDependentObject)
css::uno::Reference< css::util::XNumberFormatter > getNumberFormatter(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
creates a number formatter
::cppu::ImplInheritanceHelper< OGenericUnoController, css::document::XScriptInvocationContext, css::util::XModifiable > DBSubComponentController_Base
Reference< XConnection > getConnection(const Reference< XRowSet > &_rxRowSet)
std::u16string_view getTitle(std::u16string_view aPath)
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
Reference< XModel > xModel
the model of the sub component. Might be <NULL>
unsigned char sal_Bool