fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / dbaccess / dbsubcomponentcontroller.hxx
blob17319cb8432590218fbb34a7c41e538dea056e74
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 DBAUI_SUBCOMPONENTCONTROLLER_HXX
21 #define DBAUI_SUBCOMPONENTCONTROLLER_HXX
23 #include "genericcontroller.hxx"
25 #include <com/sun/star/document/XScriptInvocationContext.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
27 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
28 #include <com/sun/star/sdbc/XDataSource.hpp>
29 #include <com/sun/star/util/XNumberFormatter.hpp>
30 #include <com/sun/star/util/XModifiable.hpp>
32 #include <comphelper/broadcasthelper.hxx>
33 #include <comphelper/proparrhlp.hxx>
34 #include <comphelper/propertycontainer.hxx>
35 #include <connectivity/dbmetadata.hxx>
36 #include <cppuhelper/implbase2.hxx>
38 #include <memory>
40 //........................................................................
41 namespace dbaui
43 //........................................................................
45 //====================================================================
46 //= DBSubComponentController
47 //====================================================================
48 class DBSubComponentController;
50 typedef ::cppu::ImplInheritanceHelper2 < OGenericUnoController
51 , ::com::sun::star::document::XScriptInvocationContext
52 , ::com::sun::star::util::XModifiable
53 > DBSubComponentController_Base;
55 struct DBSubComponentController_Impl;
56 class DBACCESS_DLLPUBLIC DBSubComponentController : public DBSubComponentController_Base
58 private:
59 ::std::auto_ptr<DBSubComponentController_Impl> m_pImpl;
61 private:
62 /** forces usage of a connection which we do not own
63 <p>To be used from within XInitialization::initialize, resp. impl_initialize, only.</p>
65 void initializeConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxForeignConn );
67 protected:
68 // OGenericUnoController - initialization
69 virtual void impl_initialize();
71 // OGenericUnoController
72 virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
74 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getPrivateModel() const;
76 sal_Bool impl_isModified() const;
77 virtual void impl_onModifyChanged();
79 public:
81 sal_Bool isReadOnly() const;
82 sal_Bool isEditable() const;
83 void setEditable(sal_Bool _bEditable);
85 // ----------------------------------------------------------------
86 // asking for connection-related stuff
88 sal_Bool isConnected() const;
90 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
91 getMetaData( ) const;
93 // ----------------------------------------------------------------
94 // access to the data source / document
95 OUString getDataSourceName() const;
96 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >&
97 getDataSource() const;
98 sal_Bool haveDataSource() const;
100 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
101 getDatabaseDocument() const;
103 /** provides access to the SDB-level database meta data of the current connection
105 const ::dbtools::DatabaseMetaData& getSdbMetaData() const;
107 /** appends an error in the current environment.
109 void appendError(
110 const OUString& _rErrorMessage,
111 const ::dbtools::StandardSQLState _eSQLState = ::dbtools::SQL_GENERAL_ERROR,
112 const sal_Int32 _nErrorCode = 1000
115 /** clears the error state.
117 void clearError();
119 /** @return
120 <TRUE/> when an error was set otherwise <FALSE/>
122 sal_Bool hasError() const;
124 /** returns the current error
126 const ::dbtools::SQLExceptionInfo& getError() const;
128 /** displays the current error, or does nothing if there is no current error
130 void displayError();
132 /** shows an info box with the string conntection lost.
134 void connectionLostMessage() const;
136 /** gives access to the currently used connection
137 @return
138 the currently used connection.
140 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
141 getConnection() const;
143 /** returns the number formatter
145 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > getNumberFormatter() const;
147 // ::com::sun::star::frame::XController
148 virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
149 virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException );
151 // XScriptInvocationContext
152 virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (::com::sun::star::uno::RuntimeException);
154 // XModifiable
155 virtual ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException);
156 virtual void SAL_CALL setModified( ::sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
158 // XModifyBroadcaster
159 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
160 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
162 // XTitle
163 virtual OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException);
165 protected:
166 DBSubComponentController(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxORB);
167 virtual ~DBSubComponentController();
169 virtual void disconnect();
170 virtual void reconnect( sal_Bool _bUI );
171 sal_Bool ensureConnected( sal_Bool _bUI ) { if ( !isConnected() ) reconnect( _bUI ); return isConnected(); }
173 /** called when our connection is beeing disposed
174 <p>The default implementation does a reconnect</p>
176 virtual void losingConnection( );
178 protected:
179 // XEventListener
180 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
182 // OComponentHelper
183 virtual void SAL_CALL disposing();
185 // XInterface
186 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
188 // XTypeProvider
189 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
191 protected:
192 sal_Int32 getCurrentStartNumber() const;
194 private:
195 DBSubComponentController(); // never implemented
198 //........................................................................
199 } // namespace dbaui
200 //........................................................................
202 #endif // DBAUI_SUBCOMPONENTCONTROLLER_HXX
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */