fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / dlg / odbcconfig.hxx
blob1631b714be6cd688e3818ab17f8d026a2a07d909
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_SOURCE_UI_DLG_ODBCCONFIG_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
23 #include "commontypes.hxx"
25 #if defined(WNT) || (defined (UNX) && !defined(ANDROID) && !defined(IOS))
26 #define HAVE_ODBC_SUPPORT
27 #endif
29 #if defined(WNT) && defined(HAVE_ODBC_SUPPORT)
30 #define HAVE_ODBC_ADMINISTRATION
31 #endif
33 #include <tools/link.hxx>
34 #include <osl/module.h>
36 #include <memory>
38 namespace dbaui
41 // OOdbcLibWrapper
42 /** base for helper classes wrapping functionality from an ODBC library
44 class OOdbcLibWrapper
46 oslModule m_pOdbcLib; // the library handle
47 OUString m_sLibPath; // the path to the library
49 public:
50 #ifdef HAVE_ODBC_SUPPORT
51 bool isLoaded() const { return NULL != m_pOdbcLib; }
52 #else
53 sal_Bool isLoaded() const { return sal_False; }
54 #endif
55 OUString getLibraryName() const { return m_sLibPath; }
57 protected:
58 #ifndef HAVE_ODBC_SUPPORT
59 OOdbcLibWrapper() : m_pOdbcLib(NULL) { }
60 #else
61 OOdbcLibWrapper();
62 #endif
63 ~OOdbcLibWrapper();
65 oslGenericFunction loadSymbol(const sal_Char* _pFunctionName);
67 /// load the lib
68 bool load(const sal_Char* _pLibPath);
69 /// unload the lib
70 void unload();
73 // OOdbcEnumeration
74 struct OdbcTypesImpl;
75 class OOdbcEnumeration : public OOdbcLibWrapper
77 #ifdef HAVE_ODBC_SUPPORT
78 // entry points for ODBC administration
79 oslGenericFunction m_pAllocHandle;
80 oslGenericFunction m_pFreeHandle;
81 oslGenericFunction m_pSetEnvAttr;
82 oslGenericFunction m_pDataSources;
84 #endif
85 OdbcTypesImpl* m_pImpl;
86 // needed because we can't have a member of type SQLHANDLE: this would require us to include the respective
87 // ODBC file, which would lead to a lot of conflicts with other includes
89 public:
90 OOdbcEnumeration();
91 ~OOdbcEnumeration();
93 void getDatasourceNames(StringBag& _rNames);
95 protected:
96 /// ensure that an ODBC environment is allocated
97 bool allocEnv();
98 /// free any allocated ODBC environment
99 void freeEnv();
102 // OOdbcManagement
103 #ifdef HAVE_ODBC_ADMINISTRATION
104 class ProcessTerminationWait;
105 class OOdbcManagement
107 ::std::unique_ptr< ProcessTerminationWait > m_pProcessWait;
108 Link<> m_aAsyncFinishCallback;
110 public:
111 OOdbcManagement( const Link<>& _rAsyncFinishCallback );
112 ~OOdbcManagement();
114 bool manageDataSources_async();
115 bool isRunning() const;
117 #endif
119 } // namespace dbaui
121 #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */