xref: /aoo41x/main/svx/source/inc/sqlparserclient.hxx (revision 3334a7e6)
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 SVX_SQLPARSERCLIENT_HXX
25 #define SVX_SQLPARSERCLIENT_HXX
26 
27 #include "svx/dbtoolsclient.hxx"
28 #include "svx/ParseContext.hxx"
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 
31 //........................................................................
32 namespace svxform
33 {
34 //........................................................................
35 
36 	//====================================================================
37 	//= OSQLParserClient
38 	//====================================================================
39 	class SVX_DLLPUBLIC OSQLParserClient : public ODbtoolsClient
40 							,public ::svxform::OParseContextClient
41 	{
42 	private:
43 		//add by BerryJia for fixing Bug97420 Time:2002-9-12-11:00(PRC time)
44 		::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
45 
46 	protected:
47 		mutable ::rtl::Reference< ::connectivity::simple::ISQLParser >	m_xParser;
48 
49 	protected:
50 		OSQLParserClient(
51 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
52         virtual bool ensureLoaded() const;
53 
54 	protected:
predicateTree(::rtl::OUString & _rErrorMessage,const::rtl::OUString & _rStatement,const::com::sun::star::uno::Reference<::com::sun::star::util::XNumberFormatter> & _rxFormatter,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> & _rxField) const55 		inline ::rtl::Reference< ::connectivity::simple::ISQLParseNode > predicateTree(
56 				::rtl::OUString& _rErrorMessage,
57 				const ::rtl::OUString& _rStatement,
58 				const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
59 				const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField
60 			) const
61 		{
62 			::rtl::Reference< ::connectivity::simple::ISQLParseNode > xReturn;
63             if ( ensureLoaded() )
64 				xReturn = m_xParser->predicateTree(_rErrorMessage, _rStatement, _rxFormatter, _rxField);
65 			return xReturn;
66 		}
67 	};
68 
69 //........................................................................
70 }	// namespace svxform
71 //........................................................................
72 
73 #endif // SVX_SQLPARSERCLIENT_HXX
74 
75 
76