bump product version to 4.1.6.2
[LibreOffice.git] / extensions / source / abpilot / datasourcehandling.hxx
blobc8efed9260a98a004b1d8a8b7da8446e67fa74c8
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 EXTENSIONS_ABP_DATASOURCEHANDLING_HXX
21 #define EXTENSIONS_ABP_DATASOURCEHANDLING_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include "abptypes.hxx"
26 //========================================================================
27 namespace com { namespace sun { namespace star {
28 namespace beans {
29 class XPropertySet;
31 } } }
33 class Window;
36 //.........................................................................
37 namespace abp
39 //.........................................................................
41 //=====================================================================
42 //= ODataSourceContext
43 //=====================================================================
44 struct ODataSourceContextImpl;
45 class ODataSource;
46 /// a non-UNO wrapper for the data source context
47 class ODataSourceContext
49 private:
50 ODataSourceContextImpl* m_pImpl;
52 public:
53 ODataSourceContext(
54 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB
56 ~ODataSourceContext();
58 /// retrieves the names of all data sources
59 void getDataSourceNames( StringBag& _rNames ) const SAL_THROW (( ));
61 /// disambiguates the given name by appending auccessive numbers
62 OUString& disambiguate(OUString& _rDataSourceName);
64 /// creates a new MORK data source
65 ODataSource createNewMORK( const OUString& _rName ) SAL_THROW (( ));
67 /// creates a new Thunderbird data source
68 ODataSource createNewThunderbird( const OUString& _rName ) SAL_THROW (( ));
70 /// creates a new Evolution local data source
71 ODataSource createNewEvolution( const OUString& _rName ) SAL_THROW (( ));
73 /// creates a new Evolution LDAP data source
74 ODataSource createNewEvolutionLdap( const OUString& _rName ) SAL_THROW (( ));
76 /// creates a new Evolution GROUPWISE data source
77 ODataSource createNewEvolutionGroupwise( const OUString& _rName ) SAL_THROW (( ));
79 /// creates a new KDE address book data source
80 ODataSource createNewKab( const OUString& _rName ) SAL_THROW (( ));
82 /// creates a new Mac OS X address book data source
83 ODataSource createNewMacab( const OUString& _rName ) SAL_THROW (( ));
85 /// creates a new LDAP data source
86 ODataSource createNewLDAP( const OUString& _rName ) SAL_THROW (( ));
88 /// creates a new Outlook data source
89 ODataSource createNewOutlook( const OUString& _rName ) SAL_THROW (( ));
91 /// creates a new Outlook express data source
92 ODataSource createNewOE( const OUString& _rName ) SAL_THROW (( ));
94 /// creates a new dBase data source
95 ODataSource createNewDBase( const OUString& _rName ) SAL_THROW (( ));
98 //=====================================================================
99 //= ODataSource
100 //=====================================================================
101 struct ODataSourceImpl;
102 struct PackageAccessControl;
103 /** a non-UNO wrapper for a data source
104 <p>This class allows to access data sources without the need to compile the respective file with
105 exception handling enabled (hopefully :).</p>
106 <p>In addition to wrapping an UNO data source, an instance of this class can handle at most
107 one valid connection, as obtained from the data source.</p>
109 class ODataSource
111 private:
112 ODataSourceImpl* m_pImpl;
114 public:
115 // ----------------------------------------------------------------
116 // - ctor/dtor/assignment
117 // ----------------------------------------------------------------
118 /// constructs an object which is initially invalid
119 ODataSource(
120 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB
123 /// copy ctor
124 ODataSource( const ODataSource& _rSource );
126 /// dtor
127 ~ODataSource( );
129 /// assignment
130 ODataSource& operator=( const ODataSource& _rSource );
132 // ----------------------------------------------------------------
133 /// checks whether or not the object represents a valid data source
134 sal_Bool isValid() const SAL_THROW (( ));
136 // ----------------------------------------------------------------
137 /// removes the data source represented by the object from the data source context
138 void remove() SAL_THROW (( ));
139 // TODO: put this into the context class
141 /// returns the name of the data source
142 OUString
143 getName() const SAL_THROW (( ));
145 /// renames the data source
146 sal_Bool rename( const OUString& _rName ) SAL_THROW (( ));
147 // TODO: put this into the context class
149 // ----------------------------------------------------------------
150 // - connection handling
151 // ----------------------------------------------------------------
152 /** connects to the data source represented by this object
153 @param _pMessageParent
154 the window to use as parent for any error messages. If this is <NULL/>, no messages are displayed
155 at all.
156 @see isConnected
158 sal_Bool connect( Window* _pMessageParent ) SAL_THROW (( ));
160 /// returns <TRUE/> if the object has a valid connection, obtained from it's data source
161 sal_Bool isConnected( ) const SAL_THROW (( ));
163 /// disconnects from the data source (i.e. disposes the UNO connection hold internally)
164 void disconnect( ) SAL_THROW (( ));
166 /// stores the database file
167 void store() SAL_THROW (( ));
169 /// register the data source under the given name in the configuration
170 void registerDataSource( const OUString& _sRegisteredDataSourceName ) SAL_THROW (( ));
172 // ----------------------------------------------------------------
173 /** retrieves the tables names from the connection
174 <p>to be called when <method>isConnection</method> returns <TRUE/> only</p>
176 const StringBag& getTableNames() const SAL_THROW (( ));
178 /** determines whether a given table exists
180 bool hasTable( const OUString& _rTableName ) const;
182 /// return the intern data source object
183 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataSource() const SAL_THROW (( ));
186 // ----------------------------------------------------------------
187 /** set a new data source.
188 <p>Available to selected clients only</p>
190 void setDataSource(
191 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDS
192 ,const OUString& _sName
193 ,PackageAccessControl
196 private:
197 ODataSource( ); // never implemented
200 //.........................................................................
201 } // namespace abp
202 //.........................................................................
204 #endif // EXTENSIONS_ABP_DATASOURCEHANDLING_HXX
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */