tdf#164420 Fix unselected Check/Radio buttons not following themes in GTK
[LibreOffice.git] / include / dbaccess / dbsubcomponentcontroller.hxx
blob10687a2c2d4dfe4dab3855c90aa5f3a50bbe1985
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
21 #define INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
23 #include <memory>
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>
32 #include <cppuhelper/implbase.hxx>
33 #include <dbaccess/dbaccessdllapi.h>
34 #include <dbaccess/genericcontroller.hxx>
35 #include <rtl/ustring.hxx>
36 #include <sal/types.h>
38 namespace com::sun::star {
39 namespace beans { class XPropertySet; }
40 namespace frame { class XModel; }
41 namespace sdbc { class XConnection; }
42 namespace sdbc { class XDatabaseMetaData; }
43 namespace uno { class XComponentContext; }
44 namespace util { class XNumberFormatter; }
47 namespace dbtools {
48 class DatabaseMetaData;
49 class SQLExceptionInfo;
52 namespace dbaui
54 //= DBSubComponentController
56 typedef ::cppu::ImplInheritanceHelper< OGenericUnoController
57 , css::document::XScriptInvocationContext
58 , css::util::XModifiable
59 > DBSubComponentController_Base;
61 struct DBSubComponentController_Impl;
62 class UNLESS_MERGELIBS_MORE(DBACCESS_DLLPUBLIC) DBSubComponentController : public DBSubComponentController_Base
64 private:
65 ::std::unique_ptr<DBSubComponentController_Impl> m_pImpl;
67 private:
68 /** forces usage of a connection which we do not own
69 <p>To be used from within XInitialization::initialize, resp. impl_initialize, only.</p>
71 void initializeConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxForeignConn );
73 protected:
74 // OGenericUnoController - initialization
75 virtual void impl_initialize(const ::comphelper::NamedValueCollection& rArguments) override;
77 // OGenericUnoController
78 virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
80 virtual css::uno::Reference< css::frame::XModel > getPrivateModel() const override;
82 bool impl_isModified() const;
83 virtual void impl_onModifyChanged();
85 public:
86 bool isReadOnly() const;
87 bool isEditable() const;
88 void setEditable(bool _bEditable);
91 // asking for connection-related stuff
93 bool isConnected() const;
95 css::uno::Reference< css::sdbc::XDatabaseMetaData >
96 getMetaData( ) const;
99 // access to the data source / document
100 OUString getDataSourceName() const;
101 const css::uno::Reference< css::beans::XPropertySet >&
102 getDataSource() const;
103 bool haveDataSource() const;
105 css::uno::Reference< css::frame::XModel >
106 getDatabaseDocument() const;
108 /** provides access to the SDB-level database meta data of the current connection
110 const ::dbtools::DatabaseMetaData& getSdbMetaData() const;
112 /** appends an error in the current environment.
114 void appendError( const OUString& _rErrorMessage );
116 /** clears the error state.
118 void clearError();
120 /** @return
121 <TRUE/> when an error was set otherwise <FALSE/>
123 bool hasError() const;
125 /** returns the current error
127 const ::dbtools::SQLExceptionInfo& getError() const;
129 /** displays the current error, or does nothing if there is no current error
131 void displayError();
133 /** shows an info box with the string connection lost.
135 void connectionLostMessage() const;
137 /** gives access to the currently used connection
138 @return
139 the currently used connection.
141 const css::uno::Reference< css::sdbc::XConnection >&
142 getConnection() const;
144 /** returns the number formatter
146 css::uno::Reference< css::util::XNumberFormatter > const & getNumberFormatter() const;
148 // css::frame::XController
149 virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override;
150 virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > & xModel) override;
152 // XScriptInvocationContext
153 virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() override;
155 // XModifiable
156 virtual sal_Bool SAL_CALL isModified( ) override;
157 virtual void SAL_CALL setModified( sal_Bool bModified ) override;
159 // XModifyBroadcaster
160 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
161 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
163 // XTitle
164 virtual OUString SAL_CALL getTitle( ) override;
166 protected:
167 DBSubComponentController(const css::uno::Reference< css::uno::XComponentContext>& _rxORB);
168 virtual ~DBSubComponentController() override;
170 void disconnect();
171 virtual void reconnect( bool _bUI );
172 bool ensureConnected() {
173 if ( !isConnected() ) reconnect( false );
174 return isConnected();
177 /** called when our connection is being disposed
178 <p>The default implementation does a reconnect</p>
180 virtual void losingConnection( );
182 protected:
183 // XEventListener
184 virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
186 // OComponentHelper
187 virtual void SAL_CALL disposing() override;
189 // XInterface
190 virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
192 // XTypeProvider
193 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
195 protected:
196 sal_Int32 getCurrentStartNumber() const;
200 } // namespace dbaui
203 #endif // INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */