Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _FORMS_COMBOBOX_HXX_
30 : : #define _FORMS_COMBOBOX_HXX_
31 : :
32 : : #include "FormComponent.hxx"
33 : : #include "errorbroadcaster.hxx"
34 : : #include "entrylisthelper.hxx"
35 : : #include "cachedrowset.hxx"
36 : :
37 : : #include <com/sun/star/util/XNumberFormatter.hpp>
38 : : #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
39 : : #include <com/sun/star/form/ListSourceType.hpp>
40 : : #include <com/sun/star/awt/XItemListener.hpp>
41 : : #include <com/sun/star/awt/XFocusListener.hpp>
42 : :
43 : : #include <connectivity/formattedcolumnvalue.hxx>
44 : :
45 : : #include <cppuhelper/interfacecontainer.hxx>
46 : :
47 : : #include <vcl/timer.hxx>
48 : :
49 : : //.........................................................................
50 : : namespace frm
51 : : {
52 : :
53 : : //==================================================================
54 : : // OComboBoxModel
55 : : //==================================================================
56 : : class OComboBoxModel
57 : : :public OBoundControlModel
58 : : ,public OEntryListHelper
59 : : ,public OErrorBroadcaster
60 : : {
61 : : CachedRowSet m_aListRowSet; // the row set to fill the list
62 : : ::com::sun::star::uno::Any m_aBoundColumn; // obsolet
63 : : ::rtl::OUString m_aListSource; //
64 : : ::rtl::OUString m_aDefaultText; // DefaultText
65 : : ::com::sun::star::uno::Any m_aLastKnownValue;
66 : :
67 : : StringSequence m_aDesignModeStringItems;
68 : : // upon loading, in some cases we reset fill our string item list ourself. We don't want
69 : : // to lose the user's items then, so we remember them here.
70 : :
71 : :
72 : : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter> m_xFormatter;
73 : :
74 : : ::com::sun::star::form::ListSourceType m_eListSourceType; // ListSource's type
75 : : sal_Bool m_bEmptyIsNull; // Empty string is interpreted as NULL
76 : :
77 : : ::std::auto_ptr< ::dbtools::FormattedColumnValue >
78 : : m_pValueFormatter;
79 : :
80 : :
81 : :
82 : : protected:
83 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
84 : :
85 : : public:
86 : : DECLARE_DEFAULT_LEAF_XTOR( OComboBoxModel );
87 : :
88 : : virtual void SAL_CALL disposing();
89 : :
90 : : // OPropertySetHelper
91 : : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
92 : : virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
93 : : throw (::com::sun::star::uno::Exception);
94 : : virtual sal_Bool SAL_CALL convertFastPropertyValue(
95 : : ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
96 : : throw (::com::sun::star::lang::IllegalArgumentException);
97 : :
98 : : // XLoadListener
99 : : virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
100 : :
101 : : // XServiceInfo
102 [ + - ]: 14 : IMPLEMENTATION_NAME(OComboBoxModel);
103 : : virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
104 : :
105 : : // UNO
106 : 190984 : DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel, OBoundControlModel);
107 : : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
108 : :
109 : : // XPersistObject
110 : : virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
111 : : virtual void SAL_CALL
112 : : write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
113 : : virtual void SAL_CALL
114 : : read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
115 : :
116 : : // OControlModel's property handling
117 : : virtual void describeFixedProperties(
118 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
119 : : ) const;
120 : : virtual void describeAggregateProperties(
121 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
122 : : ) const;
123 : :
124 : : // XEventListener
125 : : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
126 : :
127 : : // prevent method hiding
128 : : using OBoundControlModel::getFastPropertyValue;
129 : :
130 : : protected:
131 : : // OBoundControlModel overridables
132 : : virtual ::com::sun::star::uno::Any
133 : : translateDbColumnToControlValue( );
134 : : virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset );
135 : :
136 : : virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
137 : : virtual void onDisconnectedDbColumn();
138 : :
139 : : virtual ::com::sun::star::uno::Any
140 : : getDefaultForReset() const;
141 : :
142 : : virtual void resetNoBroadcast();
143 : :
144 : : // OEntryListHelper overriables
145 : : virtual void stringItemListChanged( ControlModelLock& _rInstanceLock );
146 : : virtual void connectedExternalListSource( );
147 : : virtual void disconnectedExternalListSource( );
148 : : virtual void refreshInternalEntryList();
149 : :
150 : : protected:
151 : : void loadData( bool _bForce );
152 : :
153 : : DECLARE_XCLONEABLE();
154 : : };
155 : :
156 : : //==================================================================
157 : : // OComboBoxControl
158 : : //==================================================================
159 : :
160 [ - + ]: 24 : class OComboBoxControl : public OBoundControl
161 : : {
162 : : public:
163 : : OComboBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
164 : :
165 : : // XServiceInfo
166 [ # # ]: 0 : IMPLEMENTATION_NAME(OComboBoxControl);
167 : : virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
168 : : };
169 : :
170 : : //.........................................................................
171 : : }
172 : : //.........................................................................
173 : :
174 : : #endif // _FORMS_COMBOBOX_HXX_
175 : :
176 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|