1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef DBACCESS_OBJECTNAMEAPPROVAL_HXX
29 #define DBACCESS_OBJECTNAMEAPPROVAL_HXX
30 
31 #ifndef DBACCESS_CONTAINERAPPROVE_HXX
32 #include "containerapprove.hxx"
33 #endif
34 
35 /** === begin UNO includes === **/
36 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
37 #include <com/sun/star/sdbc/XConnection.hpp>
38 #endif
39 /** === end UNO includes === **/
40 
41 //........................................................................
42 namespace dbaccess
43 {
44 //........................................................................
45 
46 	//====================================================================
47 	//= ObjectNameApproval
48 	//====================================================================
49     struct ObjectNameApproval_Impl;
50     /** implementation of the IContainerApprove interface which approves
51         elements for insertion into a query or tables container.
52 
53         The only check done by this instance is whether the query name is
54         not already used, taking into account that in some databases, queries
55         and tables share the same namespace.
56 
57         The class is not thread-safe.
58     */
59     class ObjectNameApproval : public IContainerApprove
60 	{
61         ::std::auto_ptr< ObjectNameApproval_Impl >   m_pImpl;
62 
63     public:
64         enum ObjectType
65         {
66             TypeQuery,
67             TypeTable
68         };
69 
70     public:
71         /** constructs the instance
72 
73             @param _rxConnection
74                 the connection relative to which the names should be checked. This connection
75                 will be held weak. In case it is closed, subsequent calls to this instance's
76                 methods throw a DisposedException.
77             @param _eType
78                 specifies which type of objects is to be approved with this instance
79         */
80         ObjectNameApproval(
81             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
82             ObjectType _eType
83         );
84         virtual ~ObjectNameApproval();
85 
86         // IContainerApprove
87         virtual void SAL_CALL approveElement( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
88 
89     };
90 
91 //........................................................................
92 } // namespace dbaccess
93 //........................................................................
94 
95 #endif // DBACCESS_OBJECTNAMEAPPROVAL_HXX
96