merge the formfield patch from ooo-build
[ooovba.git] / forms / source / component / ComboBox.hxx
blob4177ff297491635dd5225ca6c531586a1023ad13
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ComboBox.hxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _FORMS_COMBOBOX_HXX_
32 #define _FORMS_COMBOBOX_HXX_
34 #include "FormComponent.hxx"
35 #include "errorbroadcaster.hxx"
36 #include "entrylisthelper.hxx"
37 #include "cachedrowset.hxx"
39 /** === begin UNO includes === **/
40 #include <com/sun/star/util/XNumberFormatter.hpp>
41 #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
42 #include <com/sun/star/form/ListSourceType.hpp>
43 #include <com/sun/star/awt/XItemListener.hpp>
44 #include <com/sun/star/awt/XFocusListener.hpp>
45 /** === end UNO includes === **/
47 #include <connectivity/formattedcolumnvalue.hxx>
49 #include <cppuhelper/interfacecontainer.hxx>
51 #include <vcl/timer.hxx>
53 #include <tools/date.hxx>
55 //.........................................................................
56 namespace frm
59 //==================================================================
60 // OComboBoxModel
61 //==================================================================
62 class OComboBoxModel
63 :public OBoundControlModel
64 ,public OEntryListHelper
65 ,public OErrorBroadcaster
67 CachedRowSet m_aListRowSet; // the row set to fill the list
68 ::com::sun::star::uno::Any m_aBoundColumn; // obsolet
69 ::rtl::OUString m_aListSource; //
70 ::rtl::OUString m_aDefaultText; // DefaultText
71 ::com::sun::star::uno::Any m_aLastKnownValue;
73 StringSequence m_aDesignModeStringItems;
74 // upon loading, in some cases we reset fill our string item list ourself. We don't want
75 // to lose the user's items then, so we remember them here.
78 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter> m_xFormatter;
80 ::com::sun::star::form::ListSourceType m_eListSourceType; // type der list source
81 sal_Bool m_bEmptyIsNull; // LeerString wird als NULL interpretiert
83 ::std::auto_ptr< ::dbtools::FormattedColumnValue >
84 m_pValueFormatter;
88 protected:
89 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
91 public:
92 DECLARE_DEFAULT_LEAF_XTOR( OComboBoxModel );
94 virtual void SAL_CALL disposing();
96 // OPropertySetHelper
97 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
98 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
99 throw (::com::sun::star::uno::Exception);
100 virtual sal_Bool SAL_CALL convertFastPropertyValue(
101 ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
102 throw (::com::sun::star::lang::IllegalArgumentException);
104 // XLoadListener
105 virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
107 // XServiceInfo
108 IMPLEMENTATION_NAME(OComboBoxModel);
109 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
111 // UNO
112 DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel, OBoundControlModel);
113 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
115 // XPersistObject
116 virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
117 virtual void SAL_CALL
118 write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
119 virtual void SAL_CALL
120 read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
122 // OControlModel's property handling
123 virtual void describeFixedProperties(
124 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
125 ) const;
126 virtual void describeAggregateProperties(
127 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
128 ) const;
130 // XEventListener
131 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
133 // prevent method hiding
134 using OBoundControlModel::getFastPropertyValue;
136 protected:
137 // OBoundControlModel overridables
138 virtual ::com::sun::star::uno::Any
139 translateDbColumnToControlValue( );
140 virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset );
142 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
143 virtual void onDisconnectedDbColumn();
145 virtual ::com::sun::star::uno::Any
146 getDefaultForReset() const;
148 // OEntryListHelper overriables
149 virtual void stringItemListChanged( ControlModelLock& _rInstanceLock );
150 virtual void connectedExternalListSource( );
151 virtual void disconnectedExternalListSource( );
152 virtual void refreshInternalEntryList();
154 protected:
155 void loadData( bool _bForce );
157 DECLARE_XCLONEABLE();
160 //==================================================================
161 // OComboBoxControl
162 //==================================================================
164 class OComboBoxControl : public OBoundControl
166 public:
167 OComboBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
169 // XServiceInfo
170 IMPLEMENTATION_NAME(OComboBoxControl);
171 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
174 //.........................................................................
176 //.........................................................................
178 #endif // _FORMS_COMBOBOX_HXX_