1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBACCESS_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX
25 #define DBACCESS_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX
26 
27 #include "connectiondependent.hxx"
28 
29 /** === begin UNO includes === **/
30 #include <com/sun/star/sdb/tools/XObjectNames.hpp>
31 /** === end UNO includes === **/
32 
33 #include <comphelper/componentcontext.hxx>
34 #include <cppuhelper/implbase1.hxx>
35 
36 #include <memory>
37 
38 //........................................................................
39 namespace sdbtools
40 {
41 //........................................................................
42 
43 	//====================================================================
44 	//= ObjectNames
45 	//====================================================================
46     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::sdb::tools::XObjectNames
47                                     >   ObjectNames_Base;
48     struct ObjectNames_Impl;
49     /** default implementation for XObjectNames
50     */
51     class ObjectNames   :public ObjectNames_Base
52                         ,public ConnectionDependentComponent
53 	{
54     private:
55         ::std::auto_ptr< ObjectNames_Impl >   m_pImpl;
56 
57     public:
58         /** constructs the instance
59 
60             @param _rContext
61                 the component's context
62             @param  _rxConnection
63                 the connection to work with. Will be held weak. Must not be <NULL/>.
64 
65             @throws ::com::sun::star::lang::NullPointerException
66                 if _rxConnection is <NULL/>
67         */
68         ObjectNames(
69             const ::comphelper::ComponentContext& _rContext,
70             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
71         );
72 
73         // XObjectNames
74         virtual ::rtl::OUString SAL_CALL suggestName( ::sal_Int32 CommandType, const ::rtl::OUString& BaseName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
75         virtual ::rtl::OUString SAL_CALL convertToSQLName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
76         virtual ::sal_Bool SAL_CALL isNameUsed( ::sal_Int32 CommandType, const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
77         virtual ::sal_Bool SAL_CALL isNameValid( ::sal_Int32 CommandType, const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
78         virtual void SAL_CALL checkNameForCreate( ::sal_Int32 CommandType, const ::rtl::OUString& Name ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
79 
80     protected:
81         virtual ~ObjectNames();
82 
83     private:
84         ObjectNames();                                  // never implemented
85         ObjectNames( const ObjectNames& );              // never implemented
86         ObjectNames& operator=( const ObjectNames& );   // never implemented
87 	};
88 
89 //........................................................................
90 } // namespace sdbtools
91 //........................................................................
92 
93 #endif // DBACCESS_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX
94 
95