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 DBAUI_COLUMNCONTROLWINDOW_HXX
24 #define DBAUI_COLUMNCONTROLWINDOW_HXX
25 
26 #ifndef DBAUI_FIELDDESCRIPTIONCONTROL_HXX
27 #include "FieldDescControl.hxx"
28 #endif
29 #ifndef DBAUI_TYPEINFO_HXX
30 #include "TypeInfo.hxx"
31 #endif
32 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #endif
35 #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_
36 #include <com/sun/star/util/XNumberFormatter.hpp>
37 #endif
38 
39 //.........................................................................
40 namespace dbaui
41 {
42 //.........................................................................
43 	// =============================================================================================
44 	// OColumnControlWindow
45 	// =============================================================================================
46 	class OColumnControlWindow : public OFieldDescControl
47 	{
48 		::com::sun::star::lang::Locale		m_aLocale;
49 		::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>	m_xORB;
50 		::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>			m_xConnection;
51 		mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > 	m_xFormatter;	// a number formatter working with the connection's NumberFormatsSupplier
52 
53 		OTypeInfoMap				m_aDestTypeInfo;
54 		::std::vector<OTypeInfoMap::iterator> m_aDestTypeInfoIndex;
55 
56 		mutable TOTypeInfoSP		m_pTypeInfo; // default type
57 		String						m_sTypeNames;		// these type names are the ones out of the resource file
58 		::rtl::OUString				m_sAutoIncrementValue;
59 		sal_Bool					m_bAutoIncrementEnabled;
60 	protected:
61 		virtual void		ActivateAggregate( EControlType eType );
62 		virtual void		DeactivateAggregate( EControlType eType );
63 
64 		virtual ::com::sun::star::lang::Locale	GetLocale() const;
65 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const;
66 		virtual TOTypeInfoSP		getTypeInfo(sal_Int32 _nPos);
67 		virtual sal_Bool			isAutoIncrementValueEnabled() const;
68 		virtual ::rtl::OUString		getAutoIncrementValue() const;
69 		virtual void				CellModified(long nRow, sal_uInt16 nColId );
70 
71 	public:
72 		OColumnControlWindow(Window* pParent
73 							,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
74 		virtual ~OColumnControlWindow();
75 
76 		void setConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xCon);
77 
78 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData();
79 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection();
80 		virtual const OTypeInfoMap*	getTypeInfo() const;
81 		TOTypeInfoSP getDefaultTyp() const;
82 	};
83 //.........................................................................
84 }	// namespace dbaui
85 //.........................................................................
86 #endif // DBAUI_COLUMNCONTROLWINDOW_HXX
87