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_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX
29 #define DBACCESS_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX
30 
31 #include "connectiondependent.hxx"
32 
33 /** === begin UNO includes === **/
34 #include <com/sun/star/sdb/tools/XObjectNames.hpp>
35 /** === end UNO includes === **/
36 
37 #include <comphelper/componentcontext.hxx>
38 #include <cppuhelper/implbase1.hxx>
39 
40 #include <memory>
41 
42 //........................................................................
43 namespace sdbtools
44 {
45 //........................................................................
46 
47 	//====================================================================
48 	//= ObjectNames
49 	//====================================================================
50     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::sdb::tools::XObjectNames
51                                     >   ObjectNames_Base;
52     struct ObjectNames_Impl;
53     /** default implementation for XObjectNames
54     */
55     class ObjectNames   :public ObjectNames_Base
56                         ,public ConnectionDependentComponent
57 	{
58     private:
59         ::std::auto_ptr< ObjectNames_Impl >   m_pImpl;
60 
61     public:
62         /** constructs the instance
63 
64             @param _rContext
65                 the component's context
66             @param  _rxConnection
67                 the connection to work with. Will be held weak. Must not be <NULL/>.
68 
69             @throws ::com::sun::star::lang::NullPointerException
70                 if _rxConnection is <NULL/>
71         */
72         ObjectNames(
73             const ::comphelper::ComponentContext& _rContext,
74             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
75         );
76 
77         // XObjectNames
78         virtual ::rtl::OUString SAL_CALL suggestName( ::sal_Int32 CommandType, const ::rtl::OUString& BaseName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
79         virtual ::rtl::OUString SAL_CALL convertToSQLName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
80         virtual ::sal_Bool SAL_CALL isNameUsed( ::sal_Int32 CommandType, const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
81         virtual ::sal_Bool SAL_CALL isNameValid( ::sal_Int32 CommandType, const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
82         virtual void SAL_CALL checkNameForCreate( ::sal_Int32 CommandType, const ::rtl::OUString& Name ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
83 
84     protected:
85         virtual ~ObjectNames();
86 
87     private:
88         ObjectNames();                                  // never implemented
89         ObjectNames( const ObjectNames& );              // never implemented
90         ObjectNames& operator=( const ObjectNames& );   // never implemented
91 	};
92 
93 //........................................................................
94 } // namespace sdbtools
95 //........................................................................
96 
97 #endif // DBACCESS_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX
98 
99