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 #ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX
24 #define DBACCESS_CORE_API_QUERYCOMPOSER_HXX
25 
26 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
27 #include <connectivity/CommonTools.hxx>
28 #endif
29 #ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSER_HPP_
30 #include <com/sun/star/sdb/XSQLQueryComposer.hpp>
31 #endif
32 #ifndef _COM_SUN_STAR_SDB_XPARAMETERSSUPPLIER_HPP_
33 #include <com/sun/star/sdb/XParametersSupplier.hpp>
34 #endif
35 #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
36 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
37 #endif
38 #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
39 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
40 #endif
41 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #endif
44 #ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_
45 #include <com/sun/star/script/XTypeConverter.hpp>
46 #endif
47 #ifndef _CPPUHELPER_IMPLBASE5_HXX_
48 #include <cppuhelper/implbase5.hxx>
49 #endif
50 #ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
51 #include <connectivity/sqliterator.hxx>
52 #endif
53 #ifndef _CONNECTIVITY_SQLPARSE_HXX
54 #include <connectivity/sqlparse.hxx>
55 #endif
56 #ifndef _DBASHARED_APITOOLS_HXX_
57 #include "apitools.hxx"
58 #endif
59 #ifndef _COMPHELPER_BROADCASTHELPER_HXX_
60 #include <comphelper/broadcasthelper.hxx>
61 #endif
62 #ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_
63 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
64 #endif
65 
66 
67 
68 namespace com { namespace sun { namespace star { namespace util {
69 	class XNumberFormatsSupplier;
70 	class XNumberFormatter;
71 }}}}
72 
73 namespace dbaccess
74 {
75 	typedef ::cppu::ImplHelper5<	::com::sun::star::sdb::XSQLQueryComposer,
76 									::com::sun::star::sdb::XParametersSupplier,
77 									::com::sun::star::sdbcx::XTablesSupplier,
78 									::com::sun::star::sdbcx::XColumnsSupplier,
79 									::com::sun::star::lang::XServiceInfo	> OQueryComposer_BASE;
80 
81 	class OPrivateColumns;
82 	class OPrivateTables;
83 
84 	class OQueryComposer : 	public ::comphelper::OBaseMutex,
85 							public OSubComponent,
86 							public OQueryComposer_BASE
87 	{
88 		::std::vector< ::rtl::OUString>														 m_aFilters;
89 		::std::vector< ::rtl::OUString>														 m_aOrders;
90 		::rtl::OUString m_sOrgFilter;
91 		::rtl::OUString m_sOrgOrder;
92 		::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer> m_xComposer;
93 		::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer> m_xComposerHelper;
94 
95 	protected:
96 		virtual void SAL_CALL disposing();
97 		virtual ~OQueryComposer();
98 	public:
99 
100 		OQueryComposer(	const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection );
101 
102 		// ::com::sun::star::lang::XTypeProvider
103 		virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
104 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
105 		// com::sun::star::lang::XUnoTunnel
106 		virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
107 		// ::com::sun::star::uno::XInterface
108 		virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
109 				throw(::com::sun::star::uno::RuntimeException);
110 		virtual void SAL_CALL acquire() throw();
111         virtual void SAL_CALL release() throw();
112 		// XServiceInfo
113 		virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
114 		virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
115 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
116 		// XSQLQueryComposer
117 		virtual ::rtl::OUString SAL_CALL getQuery(  ) throw(::com::sun::star::uno::RuntimeException);
118 		virtual void SAL_CALL setQuery( const ::rtl::OUString& command ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
119 		virtual ::rtl::OUString SAL_CALL getComposedQuery(  ) throw(::com::sun::star::uno::RuntimeException);
120 		virtual ::rtl::OUString SAL_CALL getFilter(  ) throw(::com::sun::star::uno::RuntimeException);
121 		virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL getStructuredFilter(  ) throw(::com::sun::star::uno::RuntimeException);
122 		virtual ::rtl::OUString SAL_CALL getOrder(  ) throw(::com::sun::star::uno::RuntimeException);
123 		virtual void SAL_CALL appendFilterByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
124 		virtual void SAL_CALL appendOrderByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column, sal_Bool ascending ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
125 		virtual void SAL_CALL setFilter( const ::rtl::OUString& filter ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
126 		virtual void SAL_CALL setOrder( const ::rtl::OUString& order ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
127 		// XTablesSupplier
128 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables(  ) throw(::com::sun::star::uno::RuntimeException);
129 		// XColumnsSupplier
130 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns(  ) throw(::com::sun::star::uno::RuntimeException);
131 		// XParametersSupplier
132 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getParameters(  ) throw(::com::sun::star::uno::RuntimeException);
133 	};
134 }
135 #endif // DBACCESS_CORE_API_QUERYCOMPOSER_HXX
136