1b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b0724fc6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b0724fc6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b0724fc6SAndrew Rist  * distributed with this work for additional information
6b0724fc6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b0724fc6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b0724fc6SAndrew Rist  * "License"); you may not use this file except in compliance
9b0724fc6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10b0724fc6SAndrew Rist  *
11b0724fc6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12b0724fc6SAndrew Rist  *
13b0724fc6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b0724fc6SAndrew Rist  * software distributed under the License is distributed on an
15b0724fc6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b0724fc6SAndrew Rist  * KIND, either express or implied.  See the License for the
17b0724fc6SAndrew Rist  * specific language governing permissions and limitations
18b0724fc6SAndrew Rist  * under the License.
19b0724fc6SAndrew Rist  *
20b0724fc6SAndrew Rist  *************************************************************/
21b0724fc6SAndrew Rist 
22b0724fc6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_toolkit.hxx"
26cdf0e10cSrcweir #include <com/sun/star/awt/XTextArea.hpp>
27cdf0e10cSrcweir #include <com/sun/star/awt/XVclWindowPeer.hpp>
28cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
30cdf0e10cSrcweir #include <com/sun/star/awt/VisualEffect.hpp>
31cdf0e10cSrcweir #include <com/sun/star/awt/LineEndFormat.hpp>
32cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicProvider.hpp>
33cdf0e10cSrcweir #include <com/sun/star/graphic/GraphicObject.hpp>
34cdf0e10cSrcweir #include <com/sun/star/util/Date.hpp>
35cdf0e10cSrcweir #include <com/sun/star/awt/ImageScaleMode.hpp>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <toolkit/controls/formattedcontrol.hxx>
39cdf0e10cSrcweir #include <toolkit/controls/roadmapcontrol.hxx>
40cdf0e10cSrcweir #include <toolkit/controls/unocontrols.hxx>
41cdf0e10cSrcweir #include <toolkit/controls/stdtabcontroller.hxx>
42cdf0e10cSrcweir #include <toolkit/helper/property.hxx>
43cdf0e10cSrcweir #include <toolkit/helper/unopropertyarrayhelper.hxx>
44cdf0e10cSrcweir #include <toolkit/helper/unomemorystream.hxx>
45cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx>
46cdf0e10cSrcweir #include <toolkit/helper/macros.hxx>
47cdf0e10cSrcweir #include <toolkit/helper/imagealign.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // for introspection
50cdf0e10cSrcweir #include <toolkit/awt/vclxwindows.hxx>
51cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
52cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
53cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
54cdf0e10cSrcweir #include <comphelper/extract.hxx>
55cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
56cdf0e10cSrcweir #include <vcl/svapp.hxx>
57cdf0e10cSrcweir #include <vcl/edit.hxx>
58cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX
59cdf0e10cSrcweir #include <vcl/button.hxx>
60cdf0e10cSrcweir #endif
61cdf0e10cSrcweir #include <vcl/group.hxx>
62cdf0e10cSrcweir #include <vcl/fixed.hxx>
63cdf0e10cSrcweir #include <vcl/lstbox.hxx>
64cdf0e10cSrcweir #include <vcl/combobox.hxx>
65cdf0e10cSrcweir #include <tools/debug.hxx>
66cdf0e10cSrcweir #include <tools/diagnose_ex.h>
67cdf0e10cSrcweir #include <tools/date.hxx>
68cdf0e10cSrcweir #include <tools/time.hxx>
69cdf0e10cSrcweir 
70cdf0e10cSrcweir #include <algorithm>
71cdf0e10cSrcweir #include <functional>
72cdf0e10cSrcweir 
73cdf0e10cSrcweir using namespace ::com::sun::star;
74cdf0e10cSrcweir using ::com::sun::star::graphic::XGraphic;
75cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
76cdf0e10cSrcweir using namespace ::toolkit;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir #define IMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \
79cdf0e10cSrcweir     ::rtl::OUString SAL_CALL ImplName::getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \
80cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ImplName::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)	\
81cdf0e10cSrcweir 							{ \
82cdf0e10cSrcweir 								::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = BaseClass::getSupportedServiceNames( ); \
83cdf0e10cSrcweir 								aNames.realloc( aNames.getLength() + 1 ); \
84cdf0e10cSrcweir 								aNames[ aNames.getLength() - 1 ] = ::rtl::OUString::createFromAscii( ServiceName ); \
85cdf0e10cSrcweir 								return aNames; \
86cdf0e10cSrcweir 							} \
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
90cdf0e10cSrcweir //	----------------------------------------------------
91cdf0e10cSrcweir //	class UnoControlEditModel
92cdf0e10cSrcweir //	----------------------------------------------------
UnoControlEditModel(const Reference<XMultiServiceFactory> & i_factory)93cdf0e10cSrcweir UnoControlEditModel::UnoControlEditModel( const Reference< XMultiServiceFactory >& i_factory )
94cdf0e10cSrcweir     :UnoControlModel( i_factory )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXEdit );
97cdf0e10cSrcweir }
98cdf0e10cSrcweir 
getServiceName()99cdf0e10cSrcweir ::rtl::OUString UnoControlEditModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel );
102cdf0e10cSrcweir }
103cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const104cdf0e10cSrcweir uno::Any UnoControlEditModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
105cdf0e10cSrcweir {
106cdf0e10cSrcweir     uno::Any aReturn;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     switch ( nPropId )
109cdf0e10cSrcweir     {
110cdf0e10cSrcweir     case BASEPROPERTY_LINE_END_FORMAT:
111cdf0e10cSrcweir         aReturn <<= (sal_Int16)awt::LineEndFormat::LINE_FEED;   // LF
112cdf0e10cSrcweir         break;
113cdf0e10cSrcweir     case BASEPROPERTY_DEFAULTCONTROL:
114cdf0e10cSrcweir         aReturn <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit );
115cdf0e10cSrcweir         break;
116cdf0e10cSrcweir     default:
117cdf0e10cSrcweir         aReturn = UnoControlModel::ImplGetDefaultValue( nPropId );
118cdf0e10cSrcweir         break;
119cdf0e10cSrcweir     }
120cdf0e10cSrcweir 	return aReturn;
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
getInfoHelper()123cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlEditModel::getInfoHelper()
124cdf0e10cSrcweir {
125cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
126cdf0e10cSrcweir 	if ( !pHelper )
127cdf0e10cSrcweir 	{
128cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
129cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
130cdf0e10cSrcweir 	}
131cdf0e10cSrcweir 	return *pHelper;
132cdf0e10cSrcweir }
133cdf0e10cSrcweir 
134cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()135cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
138cdf0e10cSrcweir 	return xInfo;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 
142cdf0e10cSrcweir //	----------------------------------------------------
143cdf0e10cSrcweir //	class UnoEditControl
144cdf0e10cSrcweir //	----------------------------------------------------
UnoEditControl(const Reference<XMultiServiceFactory> & i_factory)145cdf0e10cSrcweir UnoEditControl::UnoEditControl( const Reference< XMultiServiceFactory >& i_factory )
146cdf0e10cSrcweir 	:UnoControlBase( i_factory )
147cdf0e10cSrcweir     ,maTextListeners( *this )
148cdf0e10cSrcweir 	,mnMaxTextLen( 0 )
149cdf0e10cSrcweir 	,mbSetTextInPeer( sal_False )
150cdf0e10cSrcweir 	,mbSetMaxTextLenInPeer( sal_False )
151cdf0e10cSrcweir     ,mbHasTextProperty( sal_False )
152cdf0e10cSrcweir {
153cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
154cdf0e10cSrcweir 	maComponentInfos.nHeight = 12;
155cdf0e10cSrcweir 	mnMaxTextLen = 0;
156cdf0e10cSrcweir 	mbSetMaxTextLenInPeer = sal_False;
157cdf0e10cSrcweir }
158cdf0e10cSrcweir 
queryAggregation(const uno::Type & rType)159cdf0e10cSrcweir uno::Any SAL_CALL UnoEditControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir     uno::Any aReturn = UnoControlBase::queryAggregation( rType );
162cdf0e10cSrcweir     if ( !aReturn.hasValue() )
163cdf0e10cSrcweir         aReturn = UnoEditControl_Base::queryInterface( rType );
164cdf0e10cSrcweir     return aReturn;
165cdf0e10cSrcweir }
166cdf0e10cSrcweir 
queryInterface(const uno::Type & rType)167cdf0e10cSrcweir uno::Any SAL_CALL UnoEditControl::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
168cdf0e10cSrcweir {
169cdf0e10cSrcweir     return UnoControlBase::queryInterface( rType );
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
acquire()172cdf0e10cSrcweir void SAL_CALL UnoEditControl::acquire(  ) throw ()
173cdf0e10cSrcweir {
174cdf0e10cSrcweir     UnoControlBase::acquire();
175cdf0e10cSrcweir }
176cdf0e10cSrcweir 
release()177cdf0e10cSrcweir void SAL_CALL UnoEditControl::release(  ) throw ()
178cdf0e10cSrcweir {
179cdf0e10cSrcweir     UnoControlBase::release();
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
IMPLEMENT_FORWARD_XTYPEPROVIDER2(UnoEditControl,UnoControlBase,UnoEditControl_Base)182cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoEditControl, UnoControlBase, UnoEditControl_Base )
183cdf0e10cSrcweir 
184cdf0e10cSrcweir ::rtl::OUString UnoEditControl::GetComponentServiceName()
185cdf0e10cSrcweir {
186cdf0e10cSrcweir     // by default, we want a simple edit field
187cdf0e10cSrcweir 	::rtl::OUString sName( ::rtl::OUString::createFromAscii( "Edit" ) );
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     // but maybe we are to display multi-line text?
190cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_MULTILINE ) );
191cdf0e10cSrcweir 	sal_Bool b = sal_Bool();
192cdf0e10cSrcweir 	if ( ( aVal >>= b ) && b )
193cdf0e10cSrcweir 		sName= ::rtl::OUString::createFromAscii( "MultiLineEdit" );
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	return sName;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir 
setModel(const uno::Reference<awt::XControlModel> & _rModel)198cdf0e10cSrcweir sal_Bool SAL_CALL UnoEditControl::setModel(const uno::Reference< awt::XControlModel >& _rModel) throw ( uno::RuntimeException )
199cdf0e10cSrcweir {
200cdf0e10cSrcweir     sal_Bool bReturn = UnoControlBase::setModel( _rModel );
201cdf0e10cSrcweir     mbHasTextProperty = ImplHasProperty( BASEPROPERTY_TEXT );
202cdf0e10cSrcweir     return bReturn;
203cdf0e10cSrcweir }
204cdf0e10cSrcweir 
ImplSetPeerProperty(const::rtl::OUString & rPropName,const uno::Any & rVal)205cdf0e10cSrcweir void UnoEditControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
206cdf0e10cSrcweir {
207cdf0e10cSrcweir     sal_Bool bDone = sal_False;
208cdf0e10cSrcweir     if ( GetPropertyId( rPropName ) == BASEPROPERTY_TEXT )
209cdf0e10cSrcweir 	{
210cdf0e10cSrcweir         // #96986# use setText(), or text listener will not be called.
211cdf0e10cSrcweir         uno::Reference < awt::XTextComponent > xTextComponent( getPeer(), uno::UNO_QUERY );
212cdf0e10cSrcweir         if ( xTextComponent.is() )
213cdf0e10cSrcweir         {
214cdf0e10cSrcweir             ::rtl::OUString sText;
215cdf0e10cSrcweir             rVal >>= sText;
216cdf0e10cSrcweir             ImplCheckLocalize( sText );
217cdf0e10cSrcweir             xTextComponent->setText( sText );
218cdf0e10cSrcweir             bDone = sal_True;
219cdf0e10cSrcweir         }
220cdf0e10cSrcweir 	}
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     if ( !bDone )
223cdf0e10cSrcweir 		UnoControlBase::ImplSetPeerProperty( rPropName, rVal );
224cdf0e10cSrcweir }
225cdf0e10cSrcweir 
dispose()226cdf0e10cSrcweir void UnoEditControl::dispose() throw(uno::RuntimeException)
227cdf0e10cSrcweir {
228cdf0e10cSrcweir 	lang::EventObject aEvt( *this );
229cdf0e10cSrcweir 	maTextListeners.disposeAndClear( aEvt );
230cdf0e10cSrcweir 	UnoControl::dispose();
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
createPeer(const uno::Reference<awt::XToolkit> & rxToolkit,const uno::Reference<awt::XWindowPeer> & rParentPeer)233cdf0e10cSrcweir void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir 	UnoControl::createPeer( rxToolkit, rParentPeer );
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
238cdf0e10cSrcweir     if ( xText.is() )
239cdf0e10cSrcweir     {
240cdf0e10cSrcweir 	xText->addTextListener( this );
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	if ( mbSetMaxTextLenInPeer )
243cdf0e10cSrcweir 		xText->setMaxTextLen( mnMaxTextLen );
244cdf0e10cSrcweir 	if ( mbSetTextInPeer )
245cdf0e10cSrcweir 		xText->setText( maText );
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir }
248cdf0e10cSrcweir 
textChanged(const awt::TextEvent & e)249cdf0e10cSrcweir void UnoEditControl::textChanged(const awt::TextEvent& e) throw(uno::RuntimeException)
250cdf0e10cSrcweir {
251cdf0e10cSrcweir 	uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	if ( mbHasTextProperty )
254cdf0e10cSrcweir 	{
255cdf0e10cSrcweir 		uno::Any aAny;
256cdf0e10cSrcweir 		aAny <<= xText->getText();
257cdf0e10cSrcweir 		ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_False );
258cdf0e10cSrcweir 	}
259cdf0e10cSrcweir 	else
260cdf0e10cSrcweir 	{
261cdf0e10cSrcweir 		maText = xText->getText();
262cdf0e10cSrcweir 	}
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	if ( maTextListeners.getLength() )
265cdf0e10cSrcweir 		maTextListeners.textChanged( e );
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
addTextListener(const uno::Reference<awt::XTextListener> & l)268cdf0e10cSrcweir void UnoEditControl::addTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir 	maTextListeners.addInterface( l );
271cdf0e10cSrcweir }
272cdf0e10cSrcweir 
removeTextListener(const uno::Reference<awt::XTextListener> & l)273cdf0e10cSrcweir void UnoEditControl::removeTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir 	maTextListeners.removeInterface( l );
276cdf0e10cSrcweir }
277cdf0e10cSrcweir 
setText(const::rtl::OUString & aText)278cdf0e10cSrcweir void UnoEditControl::setText( const ::rtl::OUString& aText ) throw(uno::RuntimeException)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir 	if ( mbHasTextProperty )
281cdf0e10cSrcweir 	{
282cdf0e10cSrcweir 		uno::Any aAny;
283cdf0e10cSrcweir 		aAny <<= aText;
284cdf0e10cSrcweir 		ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_True );
285cdf0e10cSrcweir 	}
286cdf0e10cSrcweir 	else
287cdf0e10cSrcweir 	{
288cdf0e10cSrcweir 		maText = aText;
289cdf0e10cSrcweir 		mbSetTextInPeer = sal_True;
290cdf0e10cSrcweir 			uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
291cdf0e10cSrcweir 		if ( xText.is() )
292cdf0e10cSrcweir 			xText->setText( maText );
293cdf0e10cSrcweir 		}
294cdf0e10cSrcweir 
295cdf0e10cSrcweir     // Setting the property to the VCLXWindow doesn't call textChanged
296cdf0e10cSrcweir     if ( maTextListeners.getLength() )
297cdf0e10cSrcweir     {
298cdf0e10cSrcweir         awt::TextEvent aEvent;
299cdf0e10cSrcweir         aEvent.Source = *this;
300cdf0e10cSrcweir 		maTextListeners.textChanged( aEvent );
301cdf0e10cSrcweir     }
302cdf0e10cSrcweir }
303cdf0e10cSrcweir 
304cdf0e10cSrcweir namespace
305cdf0e10cSrcweir {
lcl_normalize(awt::Selection & _rSel)306cdf0e10cSrcweir     static void lcl_normalize( awt::Selection& _rSel )
307cdf0e10cSrcweir     {
308cdf0e10cSrcweir         if ( _rSel.Min > _rSel.Max )
309cdf0e10cSrcweir             ::std::swap( _rSel.Min, _rSel.Max );
310cdf0e10cSrcweir     }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir /*
313cdf0e10cSrcweir     static bool lcl_intersect( const awt::Selection& _rLHS, const awt::Selection& _rRHS )
314cdf0e10cSrcweir     {
315cdf0e10cSrcweir         OSL_PRECOND( _rLHS.Min <= _rLHS.Max, "lcl_intersect: LHS to be normalized!" );
316cdf0e10cSrcweir         OSL_PRECOND( _rRHS.Min <= _rRHS.Max, "lcl_intersect: RHS to be normalized!" );
317cdf0e10cSrcweir         return !( ( _rLHS.Max < _rRHS.Min ) || ( _rLHS.Min > _rRHS.Max ) );
318cdf0e10cSrcweir     }
319cdf0e10cSrcweir */
320cdf0e10cSrcweir }
321cdf0e10cSrcweir 
insertText(const awt::Selection & rSel,const::rtl::OUString & rNewText)322cdf0e10cSrcweir void UnoEditControl::insertText( const awt::Selection& rSel, const ::rtl::OUString& rNewText ) throw(uno::RuntimeException)
323cdf0e10cSrcweir {
324cdf0e10cSrcweir     // normalize the selection - OUString::replaceAt has a strange behaviour if the min is greater than the max
325cdf0e10cSrcweir     awt::Selection aSelection( rSel );
326cdf0e10cSrcweir     lcl_normalize( aSelection );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir     // preserve the selection resp. cursor position
329cdf0e10cSrcweir     awt::Selection aNewSelection( getSelection() );
330cdf0e10cSrcweir #ifdef ALSO_PRESERVE_COMPLETE_SELECTION
331cdf0e10cSrcweir         // (not sure - looks uglier ...)
332cdf0e10cSrcweir     sal_Int32 nDeletedCharacters = ( aSelection.Max - aSelection.Min ) - rNewText.getLength();
333cdf0e10cSrcweir     if ( aNewSelection.Min > aSelection.Min )
334cdf0e10cSrcweir         aNewSelection.Min -= nDeletedCharacters;
335cdf0e10cSrcweir     if ( aNewSelection.Max > aSelection.Max )
336cdf0e10cSrcweir         aNewSelection.Max -= nDeletedCharacters;
337cdf0e10cSrcweir #else
338cdf0e10cSrcweir     aNewSelection.Max = ::std::min( aNewSelection.Min, aNewSelection.Max ) + rNewText.getLength();
339cdf0e10cSrcweir     aNewSelection.Min = aNewSelection.Max;
340cdf0e10cSrcweir #endif
341cdf0e10cSrcweir 
342cdf0e10cSrcweir     ::rtl::OUString aOldText = getText();
343cdf0e10cSrcweir     ::rtl::OUString  aNewText = aOldText.replaceAt( aSelection.Min, aSelection.Max - aSelection.Min, rNewText );
344cdf0e10cSrcweir     setText( aNewText );
345cdf0e10cSrcweir 
346cdf0e10cSrcweir     setSelection( aNewSelection );
347cdf0e10cSrcweir }
348cdf0e10cSrcweir 
getText()349cdf0e10cSrcweir ::rtl::OUString UnoEditControl::getText() throw(uno::RuntimeException)
350cdf0e10cSrcweir {
351cdf0e10cSrcweir 	::rtl::OUString aText = maText;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 	if ( mbHasTextProperty )
354cdf0e10cSrcweir 		aText = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
355cdf0e10cSrcweir     else
356cdf0e10cSrcweir     {
357cdf0e10cSrcweir 		uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
358cdf0e10cSrcweir         if ( xText.is() )
359cdf0e10cSrcweir             aText = xText->getText();
360cdf0e10cSrcweir     }
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 	return aText;
363cdf0e10cSrcweir }
364cdf0e10cSrcweir 
getSelectedText(void)365cdf0e10cSrcweir ::rtl::OUString UnoEditControl::getSelectedText( void ) throw(uno::RuntimeException)
366cdf0e10cSrcweir {
367cdf0e10cSrcweir 	::rtl::OUString sSelected;
368cdf0e10cSrcweir 		uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
369cdf0e10cSrcweir 	if ( xText.is() )
370cdf0e10cSrcweir 		sSelected = xText->getSelectedText();
371cdf0e10cSrcweir 
372cdf0e10cSrcweir     return sSelected;
373cdf0e10cSrcweir }
374cdf0e10cSrcweir 
setSelection(const awt::Selection & aSelection)375cdf0e10cSrcweir void UnoEditControl::setSelection( const awt::Selection& aSelection ) throw(uno::RuntimeException)
376cdf0e10cSrcweir {
377cdf0e10cSrcweir 		uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
378cdf0e10cSrcweir 	if ( xText.is() )
379cdf0e10cSrcweir 		xText->setSelection( aSelection );
380cdf0e10cSrcweir }
381cdf0e10cSrcweir 
getSelection(void)382cdf0e10cSrcweir awt::Selection UnoEditControl::getSelection( void ) throw(uno::RuntimeException)
383cdf0e10cSrcweir {
384cdf0e10cSrcweir 	awt::Selection aSel;
385cdf0e10cSrcweir 		uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
386cdf0e10cSrcweir 	if ( xText.is() )
387cdf0e10cSrcweir 		aSel = xText->getSelection();
388cdf0e10cSrcweir 	return aSel;
389cdf0e10cSrcweir }
390cdf0e10cSrcweir 
isEditable(void)391cdf0e10cSrcweir sal_Bool UnoEditControl::isEditable( void ) throw(uno::RuntimeException)
392cdf0e10cSrcweir {
393cdf0e10cSrcweir 	return !ImplGetPropertyValue_BOOL( BASEPROPERTY_READONLY );
394cdf0e10cSrcweir }
395cdf0e10cSrcweir 
setEditable(sal_Bool bEditable)396cdf0e10cSrcweir void UnoEditControl::setEditable( sal_Bool bEditable ) throw(uno::RuntimeException)
397cdf0e10cSrcweir {
398cdf0e10cSrcweir 	uno::Any aAny;
399cdf0e10cSrcweir 	aAny <<= (sal_Bool)!bEditable;
400cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_READONLY ), aAny, sal_True );
401cdf0e10cSrcweir }
402cdf0e10cSrcweir 
getMaxTextLen()403cdf0e10cSrcweir sal_Int16 UnoEditControl::getMaxTextLen() throw(uno::RuntimeException)
404cdf0e10cSrcweir {
405cdf0e10cSrcweir 	sal_Int16 nMaxLen = mnMaxTextLen;
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 	if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN ) )
408cdf0e10cSrcweir 		nMaxLen = ImplGetPropertyValue_INT16( BASEPROPERTY_MAXTEXTLEN );
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 	return nMaxLen;
411cdf0e10cSrcweir }
412cdf0e10cSrcweir 
setMaxTextLen(sal_Int16 nLen)413cdf0e10cSrcweir void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) throw(uno::RuntimeException)
414cdf0e10cSrcweir {
415cdf0e10cSrcweir 	if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN) )
416cdf0e10cSrcweir 	{
417cdf0e10cSrcweir 		uno::Any aAny;
418cdf0e10cSrcweir 		aAny <<= (sal_Int16)nLen;
419cdf0e10cSrcweir 		ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MAXTEXTLEN ), aAny, sal_True );
420cdf0e10cSrcweir 	}
421cdf0e10cSrcweir 	else
422cdf0e10cSrcweir 	{
423cdf0e10cSrcweir 		mnMaxTextLen = nLen;
424cdf0e10cSrcweir 		mbSetMaxTextLenInPeer = sal_True;
425cdf0e10cSrcweir 			uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
426cdf0e10cSrcweir 		if ( xText.is() )
427cdf0e10cSrcweir 			xText->setMaxTextLen( mnMaxTextLen );
428cdf0e10cSrcweir 	}
429cdf0e10cSrcweir }
430cdf0e10cSrcweir 
getMinimumSize()431cdf0e10cSrcweir awt::Size UnoEditControl::getMinimumSize(  ) throw(uno::RuntimeException)
432cdf0e10cSrcweir {
433cdf0e10cSrcweir 	return Impl_getMinimumSize();
434cdf0e10cSrcweir }
435cdf0e10cSrcweir 
getPreferredSize()436cdf0e10cSrcweir awt::Size UnoEditControl::getPreferredSize(  ) throw(uno::RuntimeException)
437cdf0e10cSrcweir {
438cdf0e10cSrcweir 	return Impl_getPreferredSize();
439cdf0e10cSrcweir }
440cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)441cdf0e10cSrcweir awt::Size UnoEditControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
442cdf0e10cSrcweir {
443cdf0e10cSrcweir 	return Impl_calcAdjustedSize( rNewSize );
444cdf0e10cSrcweir }
445cdf0e10cSrcweir 
getMinimumSize(sal_Int16 nCols,sal_Int16 nLines)446cdf0e10cSrcweir awt::Size UnoEditControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException)
447cdf0e10cSrcweir {
448cdf0e10cSrcweir 	return Impl_getMinimumSize( nCols, nLines );
449cdf0e10cSrcweir }
450cdf0e10cSrcweir 
getColumnsAndLines(sal_Int16 & nCols,sal_Int16 & nLines)451cdf0e10cSrcweir void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException)
452cdf0e10cSrcweir {
453cdf0e10cSrcweir 	Impl_getColumnsAndLines( nCols, nLines );
454cdf0e10cSrcweir }
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 
457cdf0e10cSrcweir //	----------------------------------------------------
458cdf0e10cSrcweir //	class UnoControlFileControlModel
459cdf0e10cSrcweir //	----------------------------------------------------
UnoControlFileControlModel(const Reference<XMultiServiceFactory> & i_factory)460cdf0e10cSrcweir UnoControlFileControlModel::UnoControlFileControlModel( const Reference< XMultiServiceFactory >& i_factory )
461cdf0e10cSrcweir     :UnoControlModel( i_factory )
462cdf0e10cSrcweir {
463cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ALIGN );
464cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
465cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_BORDER );
466cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
467cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
468cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLED );
469cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
470cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
471cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
472cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HELPURL );
473cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
474cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_READONLY );
475cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_TABSTOP );
476cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_TEXT );
477cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
478cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
479cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
480cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
481cdf0e10cSrcweir }
482cdf0e10cSrcweir 
getServiceName()483cdf0e10cSrcweir ::rtl::OUString UnoControlFileControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
484cdf0e10cSrcweir {
485cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel );
486cdf0e10cSrcweir }
487cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const488cdf0e10cSrcweir uno::Any UnoControlFileControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
489cdf0e10cSrcweir {
490cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
491cdf0e10cSrcweir 	{
492cdf0e10cSrcweir 		uno::Any aAny;
493cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl );
494cdf0e10cSrcweir 		return aAny;
495cdf0e10cSrcweir 	}
496cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
497cdf0e10cSrcweir }
498cdf0e10cSrcweir 
getInfoHelper()499cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlFileControlModel::getInfoHelper()
500cdf0e10cSrcweir {
501cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
502cdf0e10cSrcweir 	if ( !pHelper )
503cdf0e10cSrcweir 	{
504cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
505cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
506cdf0e10cSrcweir 	}
507cdf0e10cSrcweir 	return *pHelper;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir 
510cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()511cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlFileControlModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
512cdf0e10cSrcweir {
513cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
514cdf0e10cSrcweir 	return xInfo;
515cdf0e10cSrcweir }
516cdf0e10cSrcweir 
517cdf0e10cSrcweir //	----------------------------------------------------
518cdf0e10cSrcweir //	class UnoFileControl
519cdf0e10cSrcweir //	----------------------------------------------------
UnoFileControl(const Reference<XMultiServiceFactory> & i_factory)520cdf0e10cSrcweir UnoFileControl::UnoFileControl( const Reference< XMultiServiceFactory >& i_factory )
521cdf0e10cSrcweir 	:UnoEditControl( i_factory )
522cdf0e10cSrcweir {
523cdf0e10cSrcweir }
524cdf0e10cSrcweir 
GetComponentServiceName()525cdf0e10cSrcweir ::rtl::OUString UnoFileControl::GetComponentServiceName()
526cdf0e10cSrcweir {
527cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "filecontrol" );
528cdf0e10cSrcweir }
529cdf0e10cSrcweir 
530cdf0e10cSrcweir //	----------------------------------------------------
531cdf0e10cSrcweir //	class GraphicControlModel
532cdf0e10cSrcweir //	----------------------------------------------------
ImplGetDefaultValue(sal_uInt16 nPropId) const533cdf0e10cSrcweir uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
534cdf0e10cSrcweir {
535cdf0e10cSrcweir     if ( nPropId == BASEPROPERTY_GRAPHIC )
536cdf0e10cSrcweir         return uno::makeAny( uno::Reference< graphic::XGraphic >() );
537cdf0e10cSrcweir 
538cdf0e10cSrcweir     return UnoControlModel::ImplGetDefaultValue( nPropId );
539cdf0e10cSrcweir }
getGraphicFromURL_nothrow(const::rtl::OUString & _rURL)540cdf0e10cSrcweir     uno::Reference< graphic::XGraphic > GraphicControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
541cdf0e10cSrcweir     {
542cdf0e10cSrcweir         uno::Reference< graphic::XGraphic > xGraphic;
543cdf0e10cSrcweir 
544cdf0e10cSrcweir         if( ( _rURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) )
545cdf0e10cSrcweir         {
546cdf0e10cSrcweir             // graphic manager uniqueid
547cdf0e10cSrcweir             rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
548cdf0e10cSrcweir             // get the DefaultContext
549cdf0e10cSrcweir             mxGrfObj = graphic::GraphicObject::createWithId( maContext.getUNOContext(), sID );
550cdf0e10cSrcweir         }
551cdf0e10cSrcweir         else // linked
552cdf0e10cSrcweir             mxGrfObj = NULL; // release the GraphicObject
553cdf0e10cSrcweir 
554cdf0e10cSrcweir         if ( !_rURL.getLength() )
555cdf0e10cSrcweir             return xGraphic;
556cdf0e10cSrcweir 
557cdf0e10cSrcweir         try
558cdf0e10cSrcweir         {
559cdf0e10cSrcweir             uno::Reference< graphic::XGraphicProvider > xProvider;
560cdf0e10cSrcweir             if ( maContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
561cdf0e10cSrcweir             {
562cdf0e10cSrcweir                 uno::Sequence< beans::PropertyValue > aMediaProperties(1);
563cdf0e10cSrcweir                 aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
564cdf0e10cSrcweir                 aMediaProperties[0].Value <<= _rURL;
565cdf0e10cSrcweir                 xGraphic = xProvider->queryGraphic( aMediaProperties );
566cdf0e10cSrcweir             }
567cdf0e10cSrcweir         }
568cdf0e10cSrcweir         catch( const Exception& )
569cdf0e10cSrcweir         {
570cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
571cdf0e10cSrcweir         }
572cdf0e10cSrcweir 
573cdf0e10cSrcweir         return xGraphic;
574cdf0e10cSrcweir     }
575cdf0e10cSrcweir 
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const::com::sun::star::uno::Any & rValue)576cdf0e10cSrcweir void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
577cdf0e10cSrcweir {
578cdf0e10cSrcweir     UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
579cdf0e10cSrcweir 
580cdf0e10cSrcweir     // - ImageAlign and ImagePosition need to correspond to each other
581cdf0e10cSrcweir     // - Graphic and ImageURL need to correspond to each other
582cdf0e10cSrcweir     try
583cdf0e10cSrcweir     {
584cdf0e10cSrcweir         switch ( nHandle )
585cdf0e10cSrcweir         {
586cdf0e10cSrcweir         case BASEPROPERTY_IMAGEURL:
587cdf0e10cSrcweir             if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
588cdf0e10cSrcweir             {
589cdf0e10cSrcweir                 mbAdjustingGraphic = true;
590cdf0e10cSrcweir                 ::rtl::OUString sImageURL;
591cdf0e10cSrcweir                 OSL_VERIFY( rValue >>= sImageURL );
592cdf0e10cSrcweir                 setDependentFastPropertyValue( BASEPROPERTY_GRAPHIC, uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
593cdf0e10cSrcweir                 mbAdjustingGraphic = false;
594cdf0e10cSrcweir             }
595cdf0e10cSrcweir             break;
596cdf0e10cSrcweir 
597cdf0e10cSrcweir         case BASEPROPERTY_GRAPHIC:
598cdf0e10cSrcweir             if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
599cdf0e10cSrcweir             {
600cdf0e10cSrcweir                 mbAdjustingGraphic = true;
601cdf0e10cSrcweir                 setDependentFastPropertyValue( BASEPROPERTY_IMAGEURL, uno::makeAny( ::rtl::OUString() ) );
602cdf0e10cSrcweir                 mbAdjustingGraphic = false;
603cdf0e10cSrcweir             }
604cdf0e10cSrcweir             break;
605cdf0e10cSrcweir 
606cdf0e10cSrcweir         case BASEPROPERTY_IMAGEALIGN:
607cdf0e10cSrcweir             if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEPOSITION ) )
608cdf0e10cSrcweir             {
609cdf0e10cSrcweir                 mbAdjustingImagePosition = true;
610cdf0e10cSrcweir                 sal_Int16 nUNOValue = 0;
611cdf0e10cSrcweir                 OSL_VERIFY( rValue >>= nUNOValue );
612cdf0e10cSrcweir                 setDependentFastPropertyValue( BASEPROPERTY_IMAGEPOSITION, uno::makeAny( getExtendedImagePosition( nUNOValue ) ) );
613cdf0e10cSrcweir                 mbAdjustingImagePosition = false;
614cdf0e10cSrcweir             }
615cdf0e10cSrcweir             break;
616cdf0e10cSrcweir         case BASEPROPERTY_IMAGEPOSITION:
617cdf0e10cSrcweir             if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEALIGN ) )
618cdf0e10cSrcweir             {
619cdf0e10cSrcweir                 mbAdjustingImagePosition = true;
620cdf0e10cSrcweir                 sal_Int16 nUNOValue = 0;
621cdf0e10cSrcweir                 OSL_VERIFY( rValue >>= nUNOValue );
622cdf0e10cSrcweir                 setDependentFastPropertyValue( BASEPROPERTY_IMAGEALIGN, uno::makeAny( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) );
623cdf0e10cSrcweir                 mbAdjustingImagePosition = false;
624cdf0e10cSrcweir             }
625cdf0e10cSrcweir             break;
626cdf0e10cSrcweir         }
627cdf0e10cSrcweir     }
628cdf0e10cSrcweir     catch( const ::com::sun::star::uno::Exception& )
629cdf0e10cSrcweir     {
630cdf0e10cSrcweir         OSL_ENSURE( sal_False, "GraphicControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" );
631cdf0e10cSrcweir         mbAdjustingImagePosition = sal_False;
632cdf0e10cSrcweir     }
633cdf0e10cSrcweir }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir //	----------------------------------------------------
636cdf0e10cSrcweir //	class UnoControlButtonModel
637cdf0e10cSrcweir //	----------------------------------------------------
UnoControlButtonModel(const Reference<XMultiServiceFactory> & i_factory)638cdf0e10cSrcweir UnoControlButtonModel::UnoControlButtonModel( const Reference< XMultiServiceFactory >& i_factory )
639cdf0e10cSrcweir     :GraphicControlModel( i_factory )
640cdf0e10cSrcweir {
641cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXButton );
642cdf0e10cSrcweir 
643cdf0e10cSrcweir     osl_incrementInterlockedCount( &m_refCount );
644cdf0e10cSrcweir     {
645cdf0e10cSrcweir         setFastPropertyValue_NoBroadcast( BASEPROPERTY_IMAGEPOSITION, ImplGetDefaultValue( BASEPROPERTY_IMAGEPOSITION ) );
646cdf0e10cSrcweir         // this ensures that our ImagePosition is consistent with our ImageAlign property (since both
647cdf0e10cSrcweir         // defaults are not per se consistent), since both are coupled in setFastPropertyValue_NoBroadcast
648cdf0e10cSrcweir     }
649cdf0e10cSrcweir     osl_decrementInterlockedCount( &m_refCount );
650cdf0e10cSrcweir }
651cdf0e10cSrcweir 
getServiceName()652cdf0e10cSrcweir ::rtl::OUString UnoControlButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
653cdf0e10cSrcweir {
654cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel );
655cdf0e10cSrcweir }
656cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const657cdf0e10cSrcweir uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
658cdf0e10cSrcweir {
659cdf0e10cSrcweir     switch ( nPropId )
660cdf0e10cSrcweir     {
661cdf0e10cSrcweir     case BASEPROPERTY_DEFAULTCONTROL:
662cdf0e10cSrcweir         return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ) );
663cdf0e10cSrcweir     case BASEPROPERTY_TOGGLE:
664cdf0e10cSrcweir         return uno::makeAny( (sal_Bool)sal_False );
665cdf0e10cSrcweir     case BASEPROPERTY_ALIGN:
666cdf0e10cSrcweir         return uno::makeAny( (sal_Int16)PROPERTY_ALIGN_CENTER );
667cdf0e10cSrcweir     case BASEPROPERTY_FOCUSONCLICK:
668cdf0e10cSrcweir         return uno::makeAny( (sal_Bool)sal_True );
669cdf0e10cSrcweir     }
670cdf0e10cSrcweir 
671cdf0e10cSrcweir     return GraphicControlModel::ImplGetDefaultValue( nPropId );
672cdf0e10cSrcweir }
673cdf0e10cSrcweir 
getInfoHelper()674cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper()
675cdf0e10cSrcweir {
676cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
677cdf0e10cSrcweir 	if ( !pHelper )
678cdf0e10cSrcweir 	{
679cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
680cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
681cdf0e10cSrcweir 	}
682cdf0e10cSrcweir 	return *pHelper;
683cdf0e10cSrcweir }
684cdf0e10cSrcweir 
685cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()686cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
687cdf0e10cSrcweir {
688cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
689cdf0e10cSrcweir 	return xInfo;
690cdf0e10cSrcweir }
691cdf0e10cSrcweir 
692cdf0e10cSrcweir //	----------------------------------------------------
693cdf0e10cSrcweir //	class UnoButtonControl
694cdf0e10cSrcweir //	----------------------------------------------------
UnoButtonControl(const uno::Reference<lang::XMultiServiceFactory> & i_factory)695cdf0e10cSrcweir UnoButtonControl::UnoButtonControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
696cdf0e10cSrcweir 	:UnoButtonControl_Base( i_factory )
697cdf0e10cSrcweir     ,maActionListeners( *this )
698cdf0e10cSrcweir 	,maItemListeners( *this )
699cdf0e10cSrcweir {
700cdf0e10cSrcweir 	maComponentInfos.nWidth = 50;
701cdf0e10cSrcweir 	maComponentInfos.nHeight = 14;
702cdf0e10cSrcweir }
703cdf0e10cSrcweir 
GetComponentServiceName()704cdf0e10cSrcweir ::rtl::OUString UnoButtonControl::GetComponentServiceName()
705cdf0e10cSrcweir {
706cdf0e10cSrcweir 	::rtl::OUString aName( ::rtl::OUString::createFromAscii( "pushbutton" ) );
707cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_PUSHBUTTONTYPE ) );
708cdf0e10cSrcweir 	sal_Int16 n = sal_Int16();
709cdf0e10cSrcweir 	if ( ( aVal >>= n ) && n )
710cdf0e10cSrcweir     {
711cdf0e10cSrcweir         // Use PushButtonType later when available...
712cdf0e10cSrcweir         switch ( n )
713cdf0e10cSrcweir         {
714cdf0e10cSrcweir             case 1 /*PushButtonType::OK*/:      aName= ::rtl::OUString::createFromAscii( "okbutton" );
715cdf0e10cSrcweir                                                 break;
716cdf0e10cSrcweir             case 2 /*PushButtonType::CANCEL*/:  aName= ::rtl::OUString::createFromAscii( "cancelbutton" );
717cdf0e10cSrcweir                                                 break;
718cdf0e10cSrcweir             case 3 /*PushButtonType::HELP*/:    aName= ::rtl::OUString::createFromAscii( "helpbutton" );
719cdf0e10cSrcweir                                                 break;
720cdf0e10cSrcweir             default:
721cdf0e10cSrcweir             {
722cdf0e10cSrcweir                 DBG_ERROR( "Unknown Button Type!" );
723cdf0e10cSrcweir             }
724cdf0e10cSrcweir 		}
725cdf0e10cSrcweir 	}
726cdf0e10cSrcweir 	return aName;
727cdf0e10cSrcweir }
728cdf0e10cSrcweir 
dispose()729cdf0e10cSrcweir void UnoButtonControl::dispose() throw(uno::RuntimeException)
730cdf0e10cSrcweir {
731cdf0e10cSrcweir 	lang::EventObject aEvt;
732cdf0e10cSrcweir 	aEvt.Source = (::cppu::OWeakObject*)this;
733cdf0e10cSrcweir 	maActionListeners.disposeAndClear( aEvt );
734cdf0e10cSrcweir 	maItemListeners.disposeAndClear( aEvt );
735cdf0e10cSrcweir 	UnoControlBase::dispose();
736cdf0e10cSrcweir }
737cdf0e10cSrcweir 
createPeer(const uno::Reference<awt::XToolkit> & rxToolkit,const uno::Reference<awt::XWindowPeer> & rParentPeer)738cdf0e10cSrcweir void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
739cdf0e10cSrcweir {
740cdf0e10cSrcweir 	UnoControlBase::createPeer( rxToolkit, rParentPeer );
741cdf0e10cSrcweir 
742cdf0e10cSrcweir     uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
743cdf0e10cSrcweir 	xButton->setActionCommand( maActionCommand );
744cdf0e10cSrcweir 	if ( maActionListeners.getLength() )
745cdf0e10cSrcweir 		xButton->addActionListener( &maActionListeners );
746cdf0e10cSrcweir 
747cdf0e10cSrcweir     uno::Reference< XToggleButton > xPushButton( getPeer(), uno::UNO_QUERY );
748cdf0e10cSrcweir     if ( xPushButton.is() )
749cdf0e10cSrcweir         xPushButton->addItemListener( this );
750cdf0e10cSrcweir }
751cdf0e10cSrcweir 
addActionListener(const uno::Reference<awt::XActionListener> & l)752cdf0e10cSrcweir void UnoButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
753cdf0e10cSrcweir {
754cdf0e10cSrcweir 	maActionListeners.addInterface( l );
755cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
756cdf0e10cSrcweir 	{
757cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
758cdf0e10cSrcweir 		xButton->addActionListener( &maActionListeners );
759cdf0e10cSrcweir 	}
760cdf0e10cSrcweir }
761cdf0e10cSrcweir 
removeActionListener(const uno::Reference<awt::XActionListener> & l)762cdf0e10cSrcweir void UnoButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
763cdf0e10cSrcweir {
764cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
765cdf0e10cSrcweir 	{
766cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
767cdf0e10cSrcweir 		xButton->removeActionListener( &maActionListeners );
768cdf0e10cSrcweir 	}
769cdf0e10cSrcweir 	maActionListeners.removeInterface( l );
770cdf0e10cSrcweir }
771cdf0e10cSrcweir 
addItemListener(const uno::Reference<awt::XItemListener> & l)772cdf0e10cSrcweir void UnoButtonControl::addItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException)
773cdf0e10cSrcweir {
774cdf0e10cSrcweir 	maItemListeners.addInterface( l );
775cdf0e10cSrcweir }
776cdf0e10cSrcweir 
removeItemListener(const uno::Reference<awt::XItemListener> & l)777cdf0e10cSrcweir void UnoButtonControl::removeItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException)
778cdf0e10cSrcweir {
779cdf0e10cSrcweir 	maItemListeners.removeInterface( l );
780cdf0e10cSrcweir }
781cdf0e10cSrcweir 
disposing(const lang::EventObject & Source)782cdf0e10cSrcweir void SAL_CALL UnoButtonControl::disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
783cdf0e10cSrcweir {
784cdf0e10cSrcweir     UnoControlBase::disposing( Source );
785cdf0e10cSrcweir }
786cdf0e10cSrcweir 
itemStateChanged(const awt::ItemEvent & rEvent)787cdf0e10cSrcweir void SAL_CALL UnoButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw (uno::RuntimeException)
788cdf0e10cSrcweir {
789cdf0e10cSrcweir     // forward to model
790cdf0e10cSrcweir 	uno::Any aAny;
791cdf0e10cSrcweir 	aAny <<= (sal_Int16)rEvent.Selected;
792cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
793cdf0e10cSrcweir 
794cdf0e10cSrcweir     // multiplex
795cdf0e10cSrcweir     ItemEvent aEvent( rEvent );
796cdf0e10cSrcweir     aEvent.Source = *this;
797cdf0e10cSrcweir     maItemListeners.itemStateChanged( aEvent );
798cdf0e10cSrcweir }
799cdf0e10cSrcweir 
setLabel(const::rtl::OUString & rLabel)800cdf0e10cSrcweir void UnoButtonControl::setLabel( const ::rtl::OUString&  rLabel ) throw(uno::RuntimeException)
801cdf0e10cSrcweir {
802cdf0e10cSrcweir 	uno::Any aAny;
803cdf0e10cSrcweir 	aAny <<= rLabel;
804cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
805cdf0e10cSrcweir }
806cdf0e10cSrcweir 
setActionCommand(const::rtl::OUString & rCommand)807cdf0e10cSrcweir void UnoButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
808cdf0e10cSrcweir {
809cdf0e10cSrcweir 	maActionCommand = rCommand;
810cdf0e10cSrcweir 	if ( getPeer().is() )
811cdf0e10cSrcweir 	{
812cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
813cdf0e10cSrcweir 		xButton->setActionCommand( rCommand );
814cdf0e10cSrcweir 	}
815cdf0e10cSrcweir }
816cdf0e10cSrcweir 
getMinimumSize()817cdf0e10cSrcweir awt::Size UnoButtonControl::getMinimumSize(  ) throw(uno::RuntimeException)
818cdf0e10cSrcweir {
819cdf0e10cSrcweir 	return Impl_getMinimumSize();
820cdf0e10cSrcweir }
821cdf0e10cSrcweir 
getPreferredSize()822cdf0e10cSrcweir awt::Size UnoButtonControl::getPreferredSize(  ) throw(uno::RuntimeException)
823cdf0e10cSrcweir {
824cdf0e10cSrcweir 	return Impl_getPreferredSize();
825cdf0e10cSrcweir }
826cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)827cdf0e10cSrcweir awt::Size UnoButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
828cdf0e10cSrcweir {
829cdf0e10cSrcweir 	return Impl_calcAdjustedSize( rNewSize );
830cdf0e10cSrcweir }
831cdf0e10cSrcweir 
832cdf0e10cSrcweir //	----------------------------------------------------
833cdf0e10cSrcweir //	class UnoControlImageControlModel
834cdf0e10cSrcweir //	----------------------------------------------------
UnoControlImageControlModel(const Reference<XMultiServiceFactory> & i_factory)835cdf0e10cSrcweir UnoControlImageControlModel::UnoControlImageControlModel( const Reference< XMultiServiceFactory >& i_factory )
836cdf0e10cSrcweir     :GraphicControlModel( i_factory )
837cdf0e10cSrcweir     ,mbAdjustingImageScaleMode( false )
838cdf0e10cSrcweir {
839cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXImageControl );
840cdf0e10cSrcweir }
841cdf0e10cSrcweir 
getServiceName()842cdf0e10cSrcweir ::rtl::OUString UnoControlImageControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
843cdf0e10cSrcweir {
844cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel );
845cdf0e10cSrcweir }
846cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const847cdf0e10cSrcweir uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
848cdf0e10cSrcweir {
849cdf0e10cSrcweir     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
850cdf0e10cSrcweir         return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ) );
851cdf0e10cSrcweir 
852cdf0e10cSrcweir     if ( nPropId == BASEPROPERTY_IMAGE_SCALE_MODE )
853*b6dc695eSAriel Constenla-Haile         return makeAny( awt::ImageScaleMode::ANISOTROPIC );
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 	return GraphicControlModel::ImplGetDefaultValue( nPropId );
856cdf0e10cSrcweir }
857cdf0e10cSrcweir 
getInfoHelper()858cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper()
859cdf0e10cSrcweir {
860cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
861cdf0e10cSrcweir 	if ( !pHelper )
862cdf0e10cSrcweir 	{
863cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
864cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
865cdf0e10cSrcweir 	}
866cdf0e10cSrcweir 	return *pHelper;
867cdf0e10cSrcweir }
868cdf0e10cSrcweir 
869cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()870cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlImageControlModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
871cdf0e10cSrcweir {
872cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
873cdf0e10cSrcweir 	return xInfo;
874cdf0e10cSrcweir }
875cdf0e10cSrcweir 
setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle,const::com::sun::star::uno::Any & _rValue)876cdf0e10cSrcweir void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception)
877cdf0e10cSrcweir {
878cdf0e10cSrcweir     GraphicControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
879cdf0e10cSrcweir 
880cdf0e10cSrcweir     // ScaleImage is an older (and less powerful) version of ScaleMode, but keep both in sync as far as possible
881cdf0e10cSrcweir     try
882cdf0e10cSrcweir     {
883cdf0e10cSrcweir         switch ( _nHandle )
884cdf0e10cSrcweir         {
885cdf0e10cSrcweir         case BASEPROPERTY_IMAGE_SCALE_MODE:
886cdf0e10cSrcweir             if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_SCALEIMAGE ) )
887cdf0e10cSrcweir             {
888cdf0e10cSrcweir                 mbAdjustingImageScaleMode = true;
889*b6dc695eSAriel Constenla-Haile                 sal_Int16 nScaleMode( awt::ImageScaleMode::ANISOTROPIC );
890cdf0e10cSrcweir                 OSL_VERIFY( _rValue >>= nScaleMode );
891*b6dc695eSAriel Constenla-Haile                 setDependentFastPropertyValue( BASEPROPERTY_SCALEIMAGE, uno::makeAny( sal_Bool( nScaleMode != awt::ImageScaleMode::NONE ) ) );
892cdf0e10cSrcweir                 mbAdjustingImageScaleMode = false;
893cdf0e10cSrcweir             }
894cdf0e10cSrcweir             break;
895cdf0e10cSrcweir         case BASEPROPERTY_SCALEIMAGE:
896cdf0e10cSrcweir             if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_IMAGE_SCALE_MODE ) )
897cdf0e10cSrcweir             {
898cdf0e10cSrcweir                 mbAdjustingImageScaleMode = true;
899cdf0e10cSrcweir                 sal_Bool bScale = sal_True;
900cdf0e10cSrcweir                 OSL_VERIFY( _rValue >>= bScale );
901*b6dc695eSAriel Constenla-Haile                 setDependentFastPropertyValue( BASEPROPERTY_IMAGE_SCALE_MODE, uno::makeAny( bScale ? awt::ImageScaleMode::ANISOTROPIC : awt::ImageScaleMode::NONE ) );
902cdf0e10cSrcweir                 mbAdjustingImageScaleMode = false;
903cdf0e10cSrcweir             }
904cdf0e10cSrcweir             break;
905cdf0e10cSrcweir         }
906cdf0e10cSrcweir     }
907cdf0e10cSrcweir     catch( const Exception& )
908cdf0e10cSrcweir     {
909cdf0e10cSrcweir         mbAdjustingImageScaleMode = false;
910cdf0e10cSrcweir         throw;
911cdf0e10cSrcweir     }
912cdf0e10cSrcweir }
913cdf0e10cSrcweir 
914cdf0e10cSrcweir //	----------------------------------------------------
915cdf0e10cSrcweir //	class UnoImageControlControl
916cdf0e10cSrcweir //	----------------------------------------------------
UnoImageControlControl(const Reference<XMultiServiceFactory> & i_factory)917cdf0e10cSrcweir UnoImageControlControl::UnoImageControlControl( const Reference< XMultiServiceFactory >& i_factory )
918cdf0e10cSrcweir 	:UnoImageControlControl_Base( i_factory )
919cdf0e10cSrcweir     ,maActionListeners( *this )
920cdf0e10cSrcweir {
921cdf0e10cSrcweir 	// Woher die Defaults nehmen?
922cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
923cdf0e10cSrcweir 	maComponentInfos.nHeight = 100;
924cdf0e10cSrcweir }
925cdf0e10cSrcweir 
GetComponentServiceName()926cdf0e10cSrcweir ::rtl::OUString UnoImageControlControl::GetComponentServiceName()
927cdf0e10cSrcweir {
928cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "fixedimage" );
929cdf0e10cSrcweir }
930cdf0e10cSrcweir 
dispose()931cdf0e10cSrcweir void UnoImageControlControl::dispose() throw(uno::RuntimeException)
932cdf0e10cSrcweir {
933cdf0e10cSrcweir 	lang::EventObject aEvt;
934cdf0e10cSrcweir 	aEvt.Source = (::cppu::OWeakObject*)this;
935cdf0e10cSrcweir 	maActionListeners.disposeAndClear( aEvt );
936cdf0e10cSrcweir 	UnoControl::dispose();
937cdf0e10cSrcweir }
938cdf0e10cSrcweir 
isTransparent()939cdf0e10cSrcweir sal_Bool UnoImageControlControl::isTransparent() throw(uno::RuntimeException)
940cdf0e10cSrcweir {
941cdf0e10cSrcweir 	return sal_True;
942cdf0e10cSrcweir }
943cdf0e10cSrcweir 
getMinimumSize()944cdf0e10cSrcweir awt::Size UnoImageControlControl::getMinimumSize(  ) throw(uno::RuntimeException)
945cdf0e10cSrcweir {
946cdf0e10cSrcweir 	return Impl_getMinimumSize();
947cdf0e10cSrcweir }
948cdf0e10cSrcweir 
getPreferredSize()949cdf0e10cSrcweir awt::Size UnoImageControlControl::getPreferredSize(  ) throw(uno::RuntimeException)
950cdf0e10cSrcweir {
951cdf0e10cSrcweir 	return Impl_getPreferredSize();
952cdf0e10cSrcweir }
953cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)954cdf0e10cSrcweir awt::Size UnoImageControlControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
955cdf0e10cSrcweir {
956cdf0e10cSrcweir 	return Impl_calcAdjustedSize( rNewSize );
957cdf0e10cSrcweir }
958cdf0e10cSrcweir 
959cdf0e10cSrcweir //	----------------------------------------------------
960cdf0e10cSrcweir //	class UnoControlRadioButtonModel
961cdf0e10cSrcweir //	----------------------------------------------------
UnoControlRadioButtonModel(const Reference<XMultiServiceFactory> & i_factory)962cdf0e10cSrcweir UnoControlRadioButtonModel::UnoControlRadioButtonModel( const Reference< XMultiServiceFactory >& i_factory )
963cdf0e10cSrcweir     :GraphicControlModel( i_factory )
964cdf0e10cSrcweir {
965cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXRadioButton );
966cdf0e10cSrcweir }
967cdf0e10cSrcweir 
getServiceName()968cdf0e10cSrcweir ::rtl::OUString UnoControlRadioButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
969cdf0e10cSrcweir {
970cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel );
971cdf0e10cSrcweir }
972cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const973cdf0e10cSrcweir uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
974cdf0e10cSrcweir {
975cdf0e10cSrcweir     switch ( nPropId )
976cdf0e10cSrcweir     {
977cdf0e10cSrcweir     case BASEPROPERTY_DEFAULTCONTROL:
978cdf0e10cSrcweir         return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ) );
979cdf0e10cSrcweir 
980cdf0e10cSrcweir     case BASEPROPERTY_VISUALEFFECT:
981cdf0e10cSrcweir         return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
982cdf0e10cSrcweir     }
983cdf0e10cSrcweir 
984cdf0e10cSrcweir     return GraphicControlModel::ImplGetDefaultValue( nPropId );
985cdf0e10cSrcweir }
986cdf0e10cSrcweir 
getInfoHelper()987cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper()
988cdf0e10cSrcweir {
989cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
990cdf0e10cSrcweir 	if ( !pHelper )
991cdf0e10cSrcweir 	{
992cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
993cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
994cdf0e10cSrcweir 	}
995cdf0e10cSrcweir 	return *pHelper;
996cdf0e10cSrcweir }
997cdf0e10cSrcweir 
998cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()999cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
1002cdf0e10cSrcweir 	return xInfo;
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir //	----------------------------------------------------
1008cdf0e10cSrcweir //	class UnoRadioButtonControl
1009cdf0e10cSrcweir //	----------------------------------------------------
UnoRadioButtonControl(const Reference<XMultiServiceFactory> & i_factory)1010cdf0e10cSrcweir UnoRadioButtonControl::UnoRadioButtonControl( const Reference< XMultiServiceFactory >& i_factory )
1011cdf0e10cSrcweir 	:UnoRadioButtonControl_Base( i_factory )
1012cdf0e10cSrcweir     ,maItemListeners( *this )
1013cdf0e10cSrcweir     ,maActionListeners( *this )
1014cdf0e10cSrcweir {
1015cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
1016cdf0e10cSrcweir 	maComponentInfos.nHeight = 12;
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir 
GetComponentServiceName()1019cdf0e10cSrcweir ::rtl::OUString UnoRadioButtonControl::GetComponentServiceName()
1020cdf0e10cSrcweir {
1021cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "radiobutton" );
1022cdf0e10cSrcweir }
1023cdf0e10cSrcweir 
dispose()1024cdf0e10cSrcweir void UnoRadioButtonControl::dispose() throw(uno::RuntimeException)
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir 	lang::EventObject aEvt;
1027cdf0e10cSrcweir 	aEvt.Source = (::cppu::OWeakObject*)this;
1028cdf0e10cSrcweir 	maItemListeners.disposeAndClear( aEvt );
1029cdf0e10cSrcweir 	UnoControlBase::dispose();
1030cdf0e10cSrcweir }
1031cdf0e10cSrcweir 
1032cdf0e10cSrcweir 
isTransparent()1033cdf0e10cSrcweir sal_Bool UnoRadioButtonControl::isTransparent() throw(uno::RuntimeException)
1034cdf0e10cSrcweir {
1035cdf0e10cSrcweir 	return sal_True;
1036cdf0e10cSrcweir }
1037cdf0e10cSrcweir 
createPeer(const uno::Reference<awt::XToolkit> & rxToolkit,const uno::Reference<awt::XWindowPeer> & rParentPeer)1038cdf0e10cSrcweir void UnoRadioButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
1039cdf0e10cSrcweir {
1040cdf0e10cSrcweir 	UnoControlBase::createPeer( rxToolkit, rParentPeer );
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir 	uno::Reference < awt::XRadioButton >  xRadioButton( getPeer(), uno::UNO_QUERY );
1043cdf0e10cSrcweir 	xRadioButton->addItemListener( this );
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir 	uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
1046cdf0e10cSrcweir 	xButton->setActionCommand( maActionCommand );
1047cdf0e10cSrcweir 	if ( maActionListeners.getLength() )
1048cdf0e10cSrcweir 		xButton->addActionListener( &maActionListeners );
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 	// as default, set the "AutoToggle" to true
1051cdf0e10cSrcweir 	// (it is set to false in VCLXToolkit::ImplCreateWindow because of #87254#, but we want to
1052cdf0e10cSrcweir 	// have it enabled by default because of 85071)
1053cdf0e10cSrcweir 	uno::Reference< awt::XVclWindowPeer >  xVclWindowPeer( getPeer(), uno::UNO_QUERY );
1054cdf0e10cSrcweir 	if ( xVclWindowPeer.is() )
1055cdf0e10cSrcweir 		xVclWindowPeer->setProperty( GetPropertyName( BASEPROPERTY_AUTOTOGGLE ), ::cppu::bool2any( sal_True ) );
1056cdf0e10cSrcweir }
1057cdf0e10cSrcweir 
addItemListener(const uno::Reference<awt::XItemListener> & l)1058cdf0e10cSrcweir void UnoRadioButtonControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir 	maItemListeners.addInterface( l );
1061cdf0e10cSrcweir }
1062cdf0e10cSrcweir 
removeItemListener(const uno::Reference<awt::XItemListener> & l)1063cdf0e10cSrcweir void UnoRadioButtonControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir 	maItemListeners.removeInterface( l );
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir 
addActionListener(const uno::Reference<awt::XActionListener> & l)1068cdf0e10cSrcweir void UnoRadioButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
1069cdf0e10cSrcweir {
1070cdf0e10cSrcweir 	maActionListeners.addInterface( l );
1071cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
1072cdf0e10cSrcweir 	{
1073cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
1074cdf0e10cSrcweir 		xButton->addActionListener( &maActionListeners );
1075cdf0e10cSrcweir 	}
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir 
removeActionListener(const uno::Reference<awt::XActionListener> & l)1078cdf0e10cSrcweir void UnoRadioButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
1079cdf0e10cSrcweir {
1080cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
1081cdf0e10cSrcweir 	{
1082cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
1083cdf0e10cSrcweir 		xButton->removeActionListener( &maActionListeners );
1084cdf0e10cSrcweir 	}
1085cdf0e10cSrcweir 	maActionListeners.removeInterface( l );
1086cdf0e10cSrcweir }
1087cdf0e10cSrcweir 
setLabel(const::rtl::OUString & rLabel)1088cdf0e10cSrcweir void UnoRadioButtonControl::setLabel( const ::rtl::OUString&  rLabel ) throw(uno::RuntimeException)
1089cdf0e10cSrcweir {
1090cdf0e10cSrcweir 	uno::Any aAny;
1091cdf0e10cSrcweir 	aAny <<= rLabel;
1092cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir 
setActionCommand(const::rtl::OUString & rCommand)1095cdf0e10cSrcweir void UnoRadioButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
1096cdf0e10cSrcweir {
1097cdf0e10cSrcweir 	maActionCommand = rCommand;
1098cdf0e10cSrcweir 	if ( getPeer().is() )
1099cdf0e10cSrcweir 	{
1100cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
1101cdf0e10cSrcweir 		xButton->setActionCommand( rCommand );
1102cdf0e10cSrcweir 	}
1103cdf0e10cSrcweir }
1104cdf0e10cSrcweir 
setState(sal_Bool bOn)1105cdf0e10cSrcweir void UnoRadioButtonControl::setState( sal_Bool bOn ) throw(uno::RuntimeException)
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir 	sal_Int16 nState = bOn ? 1 : 0;
1108cdf0e10cSrcweir 	uno::Any aAny;
1109cdf0e10cSrcweir 	aAny <<= nState;
1110cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
1111cdf0e10cSrcweir }
1112cdf0e10cSrcweir 
getState()1113cdf0e10cSrcweir sal_Bool UnoRadioButtonControl::getState() throw(uno::RuntimeException)
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir 	sal_Int16 nState = 0;
1116cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
1117cdf0e10cSrcweir 	aVal >>= nState;
1118cdf0e10cSrcweir 	return nState ? sal_True : sal_False;
1119cdf0e10cSrcweir }
1120cdf0e10cSrcweir 
itemStateChanged(const awt::ItemEvent & rEvent)1121cdf0e10cSrcweir void UnoRadioButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir 	uno::Any aAny;
1124cdf0e10cSrcweir 	aAny <<= (sal_Int16)rEvent.Selected;
1125cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
1126cdf0e10cSrcweir 
1127cdf0e10cSrcweir     // compatibility:
1128cdf0e10cSrcweir     // in OOo 1.0.x, when the user clicked a radio button in a group of buttons, this resulted
1129cdf0e10cSrcweir     // in _one_ itemStateChanged call for exactly the radio button which's state changed from
1130cdf0e10cSrcweir     // "0" to "1".
1131cdf0e10cSrcweir     // Nowadays, since the listener handling changed a lot towards 1.1 (the VCLXWindow reacts on more
1132cdf0e10cSrcweir     // basic events from the VCL-windows, not anymore on the Link-based events like in 1.0.x), this
1133cdf0e10cSrcweir     // isn't the case anymore: For instance, this method here gets called for the radio button
1134cdf0e10cSrcweir     // which is being implicitily _de_selected, too. This is pretty bad for compatibility.
1135cdf0e10cSrcweir     // Thus, we suppress all events with a new state other than "1". This is unlogical, and weird, when looking
1136cdf0e10cSrcweir     // from a pure API perspective, but it's _compatible_ with older product versions, and this is
1137cdf0e10cSrcweir     // all which matters here.
1138cdf0e10cSrcweir     // #i14703# - 2003-05-23 - fs@openoffice.org
1139cdf0e10cSrcweir     if ( 1 == rEvent.Selected )
1140cdf0e10cSrcweir     {
1141cdf0e10cSrcweir     	if ( maItemListeners.getLength() )
1142cdf0e10cSrcweir 	    	maItemListeners.itemStateChanged( rEvent );
1143cdf0e10cSrcweir     }
1144cdf0e10cSrcweir         // note that speaking stricly, this is wrong: When in 1.0.x, the user would have de-selected
1145cdf0e10cSrcweir         // a radio button _without_ selecing another one, this would have caused a notification.
1146cdf0e10cSrcweir         // With the change done here, this today won't cause a notification anymore.
1147cdf0e10cSrcweir         //
1148cdf0e10cSrcweir         // Fortunately, it's not possible for the user to de-select a radio button without selecting another on,
1149cdf0e10cSrcweir         // at least not via the regular UI. It _would_ be possible via the Accessibility API, which
1150cdf0e10cSrcweir         // counts as "user input", too. But in 1.0.x, there was no Accessibility API, so there is nothing
1151cdf0e10cSrcweir         // to be inconsistent with.
1152cdf0e10cSrcweir }
1153cdf0e10cSrcweir 
getMinimumSize()1154cdf0e10cSrcweir awt::Size UnoRadioButtonControl::getMinimumSize(  ) throw(uno::RuntimeException)
1155cdf0e10cSrcweir {
1156cdf0e10cSrcweir 	return Impl_getMinimumSize();
1157cdf0e10cSrcweir }
1158cdf0e10cSrcweir 
getPreferredSize()1159cdf0e10cSrcweir awt::Size UnoRadioButtonControl::getPreferredSize(  ) throw(uno::RuntimeException)
1160cdf0e10cSrcweir {
1161cdf0e10cSrcweir 	return Impl_getPreferredSize();
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)1164cdf0e10cSrcweir awt::Size UnoRadioButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
1165cdf0e10cSrcweir {
1166cdf0e10cSrcweir 	return Impl_calcAdjustedSize( rNewSize );
1167cdf0e10cSrcweir }
1168cdf0e10cSrcweir 
1169cdf0e10cSrcweir //	----------------------------------------------------
1170cdf0e10cSrcweir //	class UnoControlCheckBoxModel
1171cdf0e10cSrcweir //	----------------------------------------------------
UnoControlCheckBoxModel(const Reference<XMultiServiceFactory> & i_factory)1172cdf0e10cSrcweir UnoControlCheckBoxModel::UnoControlCheckBoxModel( const Reference< XMultiServiceFactory >& i_factory )
1173cdf0e10cSrcweir     :GraphicControlModel( i_factory )
1174cdf0e10cSrcweir {
1175cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCheckBox );
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir 
getServiceName()1178cdf0e10cSrcweir ::rtl::OUString UnoControlCheckBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
1179cdf0e10cSrcweir {
1180cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel );
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const1183cdf0e10cSrcweir uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
1184cdf0e10cSrcweir {
1185cdf0e10cSrcweir     switch ( nPropId )
1186cdf0e10cSrcweir     {
1187cdf0e10cSrcweir     case BASEPROPERTY_DEFAULTCONTROL:
1188cdf0e10cSrcweir         return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ) );
1189cdf0e10cSrcweir 
1190cdf0e10cSrcweir     case BASEPROPERTY_VISUALEFFECT:
1191cdf0e10cSrcweir         return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
1192cdf0e10cSrcweir     }
1193cdf0e10cSrcweir 
1194cdf0e10cSrcweir     return GraphicControlModel::ImplGetDefaultValue( nPropId );
1195cdf0e10cSrcweir }
1196cdf0e10cSrcweir 
getInfoHelper()1197cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper()
1198cdf0e10cSrcweir {
1199cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
1200cdf0e10cSrcweir 	if ( !pHelper )
1201cdf0e10cSrcweir 	{
1202cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
1203cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
1204cdf0e10cSrcweir 	}
1205cdf0e10cSrcweir 	return *pHelper;
1206cdf0e10cSrcweir }
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()1209cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
1210cdf0e10cSrcweir {
1211cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
1212cdf0e10cSrcweir 	return xInfo;
1213cdf0e10cSrcweir }
1214cdf0e10cSrcweir 
1215cdf0e10cSrcweir 
1216cdf0e10cSrcweir 
1217cdf0e10cSrcweir //	----------------------------------------------------
1218cdf0e10cSrcweir //	class UnoCheckBoxControl
1219cdf0e10cSrcweir //	----------------------------------------------------
UnoCheckBoxControl(const uno::Reference<lang::XMultiServiceFactory> & i_factory)1220cdf0e10cSrcweir UnoCheckBoxControl::UnoCheckBoxControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
1221cdf0e10cSrcweir 	:UnoCheckBoxControl_Base( i_factory )
1222cdf0e10cSrcweir     ,maItemListeners( *this ), maActionListeners( *this )
1223cdf0e10cSrcweir {
1224cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
1225cdf0e10cSrcweir 	maComponentInfos.nHeight = 12;
1226cdf0e10cSrcweir }
1227cdf0e10cSrcweir 
GetComponentServiceName()1228cdf0e10cSrcweir ::rtl::OUString UnoCheckBoxControl::GetComponentServiceName()
1229cdf0e10cSrcweir {
1230cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "checkbox" );
1231cdf0e10cSrcweir }
1232cdf0e10cSrcweir 
dispose()1233cdf0e10cSrcweir void UnoCheckBoxControl::dispose() throw(uno::RuntimeException)
1234cdf0e10cSrcweir {
1235cdf0e10cSrcweir 	lang::EventObject aEvt;
1236cdf0e10cSrcweir 	aEvt.Source = (::cppu::OWeakObject*)this;
1237cdf0e10cSrcweir 	maItemListeners.disposeAndClear( aEvt );
1238cdf0e10cSrcweir 	UnoControlBase::dispose();
1239cdf0e10cSrcweir }
1240cdf0e10cSrcweir 
isTransparent()1241cdf0e10cSrcweir sal_Bool UnoCheckBoxControl::isTransparent() throw(uno::RuntimeException)
1242cdf0e10cSrcweir {
1243cdf0e10cSrcweir 	return sal_True;
1244cdf0e10cSrcweir }
1245cdf0e10cSrcweir 
createPeer(const uno::Reference<awt::XToolkit> & rxToolkit,const uno::Reference<awt::XWindowPeer> & rParentPeer)1246cdf0e10cSrcweir void UnoCheckBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
1247cdf0e10cSrcweir {
1248cdf0e10cSrcweir 	UnoControlBase::createPeer( rxToolkit, rParentPeer );
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir 	uno::Reference < awt::XCheckBox >  xCheckBox( getPeer(), uno::UNO_QUERY );
1251cdf0e10cSrcweir 	xCheckBox->addItemListener( this );
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir 	uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
1254cdf0e10cSrcweir 	xButton->setActionCommand( maActionCommand );
1255cdf0e10cSrcweir 	if ( maActionListeners.getLength() )
1256cdf0e10cSrcweir 		xButton->addActionListener( &maActionListeners );
1257cdf0e10cSrcweir }
1258cdf0e10cSrcweir 
addItemListener(const uno::Reference<awt::XItemListener> & l)1259cdf0e10cSrcweir void UnoCheckBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
1260cdf0e10cSrcweir {
1261cdf0e10cSrcweir 	maItemListeners.addInterface( l );
1262cdf0e10cSrcweir }
1263cdf0e10cSrcweir 
removeItemListener(const uno::Reference<awt::XItemListener> & l)1264cdf0e10cSrcweir void UnoCheckBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
1265cdf0e10cSrcweir {
1266cdf0e10cSrcweir 	maItemListeners.removeInterface( l );
1267cdf0e10cSrcweir }
1268cdf0e10cSrcweir 
addActionListener(const uno::Reference<awt::XActionListener> & l)1269cdf0e10cSrcweir void UnoCheckBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
1270cdf0e10cSrcweir {
1271cdf0e10cSrcweir 	maActionListeners.addInterface( l );
1272cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
1273cdf0e10cSrcweir 	{
1274cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
1275cdf0e10cSrcweir 		xButton->addActionListener( &maActionListeners );
1276cdf0e10cSrcweir 	}
1277cdf0e10cSrcweir }
1278cdf0e10cSrcweir 
removeActionListener(const uno::Reference<awt::XActionListener> & l)1279cdf0e10cSrcweir void UnoCheckBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
1280cdf0e10cSrcweir {
1281cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
1282cdf0e10cSrcweir 	{
1283cdf0e10cSrcweir 		uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
1284cdf0e10cSrcweir 		xButton->removeActionListener( &maActionListeners );
1285cdf0e10cSrcweir 	}
1286cdf0e10cSrcweir 	maActionListeners.removeInterface( l );
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir 
setActionCommand(const::rtl::OUString & rCommand)1289cdf0e10cSrcweir void UnoCheckBoxControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir 	maActionCommand = rCommand;
1292cdf0e10cSrcweir 	if ( getPeer().is() )
1293cdf0e10cSrcweir 	{
1294cdf0e10cSrcweir 		uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
1295cdf0e10cSrcweir 		xButton->setActionCommand( rCommand );
1296cdf0e10cSrcweir 	}
1297cdf0e10cSrcweir }
1298cdf0e10cSrcweir 
1299cdf0e10cSrcweir 
setLabel(const::rtl::OUString & rLabel)1300cdf0e10cSrcweir void UnoCheckBoxControl::setLabel( const ::rtl::OUString&  rLabel ) throw(uno::RuntimeException)
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir 	uno::Any aAny;
1303cdf0e10cSrcweir 	aAny <<= rLabel;
1304cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
1305cdf0e10cSrcweir }
1306cdf0e10cSrcweir 
setState(short n)1307cdf0e10cSrcweir void UnoCheckBoxControl::setState( short n ) throw(uno::RuntimeException)
1308cdf0e10cSrcweir {
1309cdf0e10cSrcweir 	uno::Any aAny;
1310cdf0e10cSrcweir 	aAny <<= (sal_Int16)n;
1311cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
1312cdf0e10cSrcweir }
1313cdf0e10cSrcweir 
getState()1314cdf0e10cSrcweir short UnoCheckBoxControl::getState() throw(uno::RuntimeException)
1315cdf0e10cSrcweir {
1316cdf0e10cSrcweir 	short nState = 0;
1317cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
1318cdf0e10cSrcweir 	aVal >>= nState;
1319cdf0e10cSrcweir 	return nState;
1320cdf0e10cSrcweir }
1321cdf0e10cSrcweir 
enableTriState(sal_Bool b)1322cdf0e10cSrcweir void UnoCheckBoxControl::enableTriState( sal_Bool b ) throw(uno::RuntimeException)
1323cdf0e10cSrcweir {
1324cdf0e10cSrcweir 	uno::Any aAny;
1325cdf0e10cSrcweir 	aAny <<= b;
1326cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TRISTATE ), aAny, sal_True );
1327cdf0e10cSrcweir }
1328cdf0e10cSrcweir 
itemStateChanged(const awt::ItemEvent & rEvent)1329cdf0e10cSrcweir void UnoCheckBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
1330cdf0e10cSrcweir {
1331cdf0e10cSrcweir 	uno::Any aAny;
1332cdf0e10cSrcweir 	aAny <<= (sal_Int16)rEvent.Selected;
1333cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
1334cdf0e10cSrcweir 
1335cdf0e10cSrcweir 	if ( maItemListeners.getLength() )
1336cdf0e10cSrcweir 		maItemListeners.itemStateChanged( rEvent );
1337cdf0e10cSrcweir }
1338cdf0e10cSrcweir 
getMinimumSize()1339cdf0e10cSrcweir awt::Size UnoCheckBoxControl::getMinimumSize(  ) throw(uno::RuntimeException)
1340cdf0e10cSrcweir {
1341cdf0e10cSrcweir 	return Impl_getMinimumSize();
1342cdf0e10cSrcweir }
1343cdf0e10cSrcweir 
getPreferredSize()1344cdf0e10cSrcweir awt::Size UnoCheckBoxControl::getPreferredSize(  ) throw(uno::RuntimeException)
1345cdf0e10cSrcweir {
1346cdf0e10cSrcweir 	return Impl_getPreferredSize();
1347cdf0e10cSrcweir }
1348cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)1349cdf0e10cSrcweir awt::Size UnoCheckBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
1350cdf0e10cSrcweir {
1351cdf0e10cSrcweir 	return Impl_calcAdjustedSize( rNewSize );
1352cdf0e10cSrcweir }
1353cdf0e10cSrcweir 
1354cdf0e10cSrcweir //	----------------------------------------------------
1355cdf0e10cSrcweir //  class UnoControlFixedHyperlinkModel
1356cdf0e10cSrcweir //	----------------------------------------------------
UnoControlFixedHyperlinkModel(const Reference<XMultiServiceFactory> & i_factory)1357cdf0e10cSrcweir UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel( const Reference< XMultiServiceFactory >& i_factory )
1358cdf0e10cSrcweir     :UnoControlModel( i_factory )
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedHyperlink );
1361cdf0e10cSrcweir }
1362cdf0e10cSrcweir 
getServiceName()1363cdf0e10cSrcweir ::rtl::OUString UnoControlFixedHyperlinkModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
1364cdf0e10cSrcweir {
1365cdf0e10cSrcweir     return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedHyperlinkModel );
1366cdf0e10cSrcweir }
1367cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const1368cdf0e10cSrcweir uno::Any UnoControlFixedHyperlinkModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
1369cdf0e10cSrcweir {
1370cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
1371cdf0e10cSrcweir 	{
1372cdf0e10cSrcweir 		uno::Any aAny;
1373cdf0e10cSrcweir         aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedHyperlink );
1374cdf0e10cSrcweir 		return aAny;
1375cdf0e10cSrcweir 	}
1376cdf0e10cSrcweir 	else if ( nPropId == BASEPROPERTY_BORDER )
1377cdf0e10cSrcweir 	{
1378cdf0e10cSrcweir 		uno::Any aAny;
1379cdf0e10cSrcweir 		aAny <<= (sal_Int16)0;
1380cdf0e10cSrcweir 		return aAny;
1381cdf0e10cSrcweir 	}
1382cdf0e10cSrcweir     else if ( nPropId == BASEPROPERTY_URL )
1383cdf0e10cSrcweir     {
1384cdf0e10cSrcweir         uno::Any aAny;
1385cdf0e10cSrcweir         aAny <<= ::rtl::OUString();
1386cdf0e10cSrcweir         return aAny;
1387cdf0e10cSrcweir     }
1388cdf0e10cSrcweir 
1389cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir 
getInfoHelper()1392cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlFixedHyperlinkModel::getInfoHelper()
1393cdf0e10cSrcweir {
1394cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
1395cdf0e10cSrcweir 	if ( !pHelper )
1396cdf0e10cSrcweir 	{
1397cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
1398cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
1399cdf0e10cSrcweir 	}
1400cdf0e10cSrcweir 	return *pHelper;
1401cdf0e10cSrcweir }
1402cdf0e10cSrcweir 
1403cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()1404cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlFixedHyperlinkModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
1405cdf0e10cSrcweir {
1406cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
1407cdf0e10cSrcweir 	return xInfo;
1408cdf0e10cSrcweir }
1409cdf0e10cSrcweir 
1410cdf0e10cSrcweir //	----------------------------------------------------
1411cdf0e10cSrcweir //  class UnoFixedHyperlinkControl
1412cdf0e10cSrcweir //	----------------------------------------------------
UnoFixedHyperlinkControl(const Reference<XMultiServiceFactory> & i_factory)1413cdf0e10cSrcweir UnoFixedHyperlinkControl::UnoFixedHyperlinkControl( const Reference< XMultiServiceFactory >& i_factory )
1414cdf0e10cSrcweir 	:UnoControlBase( i_factory )
1415cdf0e10cSrcweir     ,maActionListeners( *this )
1416cdf0e10cSrcweir {
1417cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
1418cdf0e10cSrcweir 	maComponentInfos.nHeight = 12;
1419cdf0e10cSrcweir }
1420cdf0e10cSrcweir 
GetComponentServiceName()1421cdf0e10cSrcweir ::rtl::OUString UnoFixedHyperlinkControl::GetComponentServiceName()
1422cdf0e10cSrcweir {
1423cdf0e10cSrcweir     return ::rtl::OUString::createFromAscii( "fixedhyperlink" );
1424cdf0e10cSrcweir }
1425cdf0e10cSrcweir 
1426cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)1427cdf0e10cSrcweir uno::Any UnoFixedHyperlinkControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
1428cdf0e10cSrcweir {
1429cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
1430cdf0e10cSrcweir                                         SAL_STATIC_CAST( awt::XFixedHyperlink*, this ),
1431cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XLayoutConstrains*, this ) );
1432cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir 
1435cdf0e10cSrcweir // lang::XTypeProvider
1436cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoFixedHyperlinkControl )
1437cdf0e10cSrcweir     getCppuType( ( uno::Reference< awt::XFixedHyperlink>* ) NULL ),
1438cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
1439cdf0e10cSrcweir 	UnoControlBase::getTypes()
1440cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
1441cdf0e10cSrcweir 
1442cdf0e10cSrcweir sal_Bool UnoFixedHyperlinkControl::isTransparent() throw(uno::RuntimeException)
1443cdf0e10cSrcweir {
1444cdf0e10cSrcweir 	return sal_True;
1445cdf0e10cSrcweir }
1446cdf0e10cSrcweir 
setText(const::rtl::OUString & Text)1447cdf0e10cSrcweir void UnoFixedHyperlinkControl::setText( const ::rtl::OUString& Text ) throw(uno::RuntimeException)
1448cdf0e10cSrcweir {
1449cdf0e10cSrcweir 	uno::Any aAny;
1450cdf0e10cSrcweir 	aAny <<= Text;
1451cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
1452cdf0e10cSrcweir }
1453cdf0e10cSrcweir 
getText()1454cdf0e10cSrcweir ::rtl::OUString UnoFixedHyperlinkControl::getText() throw(uno::RuntimeException)
1455cdf0e10cSrcweir {
1456cdf0e10cSrcweir 	return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
1457cdf0e10cSrcweir }
1458cdf0e10cSrcweir 
setURL(const::rtl::OUString & URL)1459cdf0e10cSrcweir void UnoFixedHyperlinkControl::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException)
1460cdf0e10cSrcweir {
1461cdf0e10cSrcweir     uno::Any aAny;
1462cdf0e10cSrcweir     aAny <<= URL;
1463cdf0e10cSrcweir     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_URL ), aAny, sal_True );
1464cdf0e10cSrcweir }
1465cdf0e10cSrcweir 
getURL()1466cdf0e10cSrcweir ::rtl::OUString UnoFixedHyperlinkControl::getURL(  ) throw(::com::sun::star::uno::RuntimeException)
1467cdf0e10cSrcweir {
1468cdf0e10cSrcweir     return ImplGetPropertyValue_UString( BASEPROPERTY_URL );
1469cdf0e10cSrcweir }
1470cdf0e10cSrcweir 
setAlignment(short nAlign)1471cdf0e10cSrcweir void UnoFixedHyperlinkControl::setAlignment( short nAlign ) throw(uno::RuntimeException)
1472cdf0e10cSrcweir {
1473cdf0e10cSrcweir 	uno::Any aAny;
1474cdf0e10cSrcweir 	aAny <<= (sal_Int16)nAlign;
1475cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, sal_True );
1476cdf0e10cSrcweir }
1477cdf0e10cSrcweir 
getAlignment()1478cdf0e10cSrcweir short UnoFixedHyperlinkControl::getAlignment() throw(uno::RuntimeException)
1479cdf0e10cSrcweir {
1480cdf0e10cSrcweir 	short nAlign = 0;
1481cdf0e10cSrcweir 	if ( mxModel.is() )
1482cdf0e10cSrcweir 	{
1483cdf0e10cSrcweir 		uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
1484cdf0e10cSrcweir 		aVal >>= nAlign;
1485cdf0e10cSrcweir 	}
1486cdf0e10cSrcweir 	return nAlign;
1487cdf0e10cSrcweir }
1488cdf0e10cSrcweir 
getMinimumSize()1489cdf0e10cSrcweir awt::Size UnoFixedHyperlinkControl::getMinimumSize(  ) throw(uno::RuntimeException)
1490cdf0e10cSrcweir {
1491cdf0e10cSrcweir 	return Impl_getMinimumSize();
1492cdf0e10cSrcweir }
1493cdf0e10cSrcweir 
getPreferredSize()1494cdf0e10cSrcweir awt::Size UnoFixedHyperlinkControl::getPreferredSize(  ) throw(uno::RuntimeException)
1495cdf0e10cSrcweir {
1496cdf0e10cSrcweir 	return Impl_getPreferredSize();
1497cdf0e10cSrcweir }
1498cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)1499cdf0e10cSrcweir awt::Size UnoFixedHyperlinkControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
1500cdf0e10cSrcweir {
1501cdf0e10cSrcweir 	return Impl_calcAdjustedSize( rNewSize );
1502cdf0e10cSrcweir }
1503cdf0e10cSrcweir 
dispose()1504cdf0e10cSrcweir void UnoFixedHyperlinkControl::dispose() throw(uno::RuntimeException)
1505cdf0e10cSrcweir {
1506cdf0e10cSrcweir     lang::EventObject aEvt;
1507cdf0e10cSrcweir     aEvt.Source = (::cppu::OWeakObject*)this;
1508cdf0e10cSrcweir     maActionListeners.disposeAndClear( aEvt );
1509cdf0e10cSrcweir     UnoControlBase::dispose();
1510cdf0e10cSrcweir }
1511cdf0e10cSrcweir 
createPeer(const uno::Reference<awt::XToolkit> & rxToolkit,const uno::Reference<awt::XWindowPeer> & rParentPeer)1512cdf0e10cSrcweir void UnoFixedHyperlinkControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
1513cdf0e10cSrcweir {
1514cdf0e10cSrcweir     UnoControlBase::createPeer( rxToolkit, rParentPeer );
1515cdf0e10cSrcweir 
1516cdf0e10cSrcweir     uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
1517cdf0e10cSrcweir     if ( maActionListeners.getLength() )
1518cdf0e10cSrcweir         xFixedHyperlink->addActionListener( &maActionListeners );
1519cdf0e10cSrcweir }
1520cdf0e10cSrcweir 
addActionListener(const uno::Reference<awt::XActionListener> & l)1521cdf0e10cSrcweir void UnoFixedHyperlinkControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir     maActionListeners.addInterface( l );
1524cdf0e10cSrcweir     if( getPeer().is() && maActionListeners.getLength() == 1 )
1525cdf0e10cSrcweir     {
1526cdf0e10cSrcweir         uno::Reference < awt::XFixedHyperlink >  xFixedHyperlink( getPeer(), uno::UNO_QUERY );
1527cdf0e10cSrcweir         xFixedHyperlink->addActionListener( &maActionListeners );
1528cdf0e10cSrcweir     }
1529cdf0e10cSrcweir }
1530cdf0e10cSrcweir 
removeActionListener(const uno::Reference<awt::XActionListener> & l)1531cdf0e10cSrcweir void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
1532cdf0e10cSrcweir {
1533cdf0e10cSrcweir     if( getPeer().is() && maActionListeners.getLength() == 1 )
1534cdf0e10cSrcweir     {
1535cdf0e10cSrcweir         uno::Reference < awt::XFixedHyperlink >  xFixedHyperlink( getPeer(), uno::UNO_QUERY );
1536cdf0e10cSrcweir         xFixedHyperlink->removeActionListener( &maActionListeners );
1537cdf0e10cSrcweir     }
1538cdf0e10cSrcweir     maActionListeners.removeInterface( l );
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir 
1541cdf0e10cSrcweir //  ----------------------------------------------------
1542cdf0e10cSrcweir //  class UnoControlFixedTextModel
1543cdf0e10cSrcweir //  ----------------------------------------------------
UnoControlFixedTextModel(const Reference<XMultiServiceFactory> & i_factory)1544cdf0e10cSrcweir UnoControlFixedTextModel::UnoControlFixedTextModel( const Reference< XMultiServiceFactory >& i_factory )
1545cdf0e10cSrcweir     :UnoControlModel( i_factory )
1546cdf0e10cSrcweir {
1547cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedText );
1548cdf0e10cSrcweir }
1549cdf0e10cSrcweir 
getServiceName()1550cdf0e10cSrcweir ::rtl::OUString UnoControlFixedTextModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
1551cdf0e10cSrcweir {
1552cdf0e10cSrcweir     return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel );
1553cdf0e10cSrcweir }
1554cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const1555cdf0e10cSrcweir uno::Any UnoControlFixedTextModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
1556cdf0e10cSrcweir {
1557cdf0e10cSrcweir     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
1558cdf0e10cSrcweir     {
1559cdf0e10cSrcweir         uno::Any aAny;
1560cdf0e10cSrcweir         aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText );
1561cdf0e10cSrcweir         return aAny;
1562cdf0e10cSrcweir     }
1563cdf0e10cSrcweir     else if ( nPropId == BASEPROPERTY_BORDER )
1564cdf0e10cSrcweir     {
1565cdf0e10cSrcweir         uno::Any aAny;
1566cdf0e10cSrcweir         aAny <<= (sal_Int16)0;
1567cdf0e10cSrcweir         return aAny;
1568cdf0e10cSrcweir     }
1569cdf0e10cSrcweir 
1570cdf0e10cSrcweir     return UnoControlModel::ImplGetDefaultValue( nPropId );
1571cdf0e10cSrcweir }
1572cdf0e10cSrcweir 
getInfoHelper()1573cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlFixedTextModel::getInfoHelper()
1574cdf0e10cSrcweir {
1575cdf0e10cSrcweir     static UnoPropertyArrayHelper* pHelper = NULL;
1576cdf0e10cSrcweir     if ( !pHelper )
1577cdf0e10cSrcweir     {
1578cdf0e10cSrcweir         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
1579cdf0e10cSrcweir         pHelper = new UnoPropertyArrayHelper( aIDs );
1580cdf0e10cSrcweir     }
1581cdf0e10cSrcweir     return *pHelper;
1582cdf0e10cSrcweir }
1583cdf0e10cSrcweir 
1584cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()1585cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
1586cdf0e10cSrcweir {
1587cdf0e10cSrcweir     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
1588cdf0e10cSrcweir     return xInfo;
1589cdf0e10cSrcweir }
1590cdf0e10cSrcweir 
1591cdf0e10cSrcweir 
1592cdf0e10cSrcweir //  ----------------------------------------------------
1593cdf0e10cSrcweir //  class UnoFixedTextControl
1594cdf0e10cSrcweir //  ----------------------------------------------------
UnoFixedTextControl(const Reference<XMultiServiceFactory> & i_factory)1595cdf0e10cSrcweir UnoFixedTextControl::UnoFixedTextControl( const Reference< XMultiServiceFactory >& i_factory )
1596cdf0e10cSrcweir 	:UnoControlBase( i_factory )
1597cdf0e10cSrcweir {
1598cdf0e10cSrcweir     maComponentInfos.nWidth = 100;
1599cdf0e10cSrcweir     maComponentInfos.nHeight = 12;
1600cdf0e10cSrcweir }
1601cdf0e10cSrcweir 
GetComponentServiceName()1602cdf0e10cSrcweir ::rtl::OUString UnoFixedTextControl::GetComponentServiceName()
1603cdf0e10cSrcweir {
1604cdf0e10cSrcweir     return ::rtl::OUString::createFromAscii( "fixedtext" );
1605cdf0e10cSrcweir }
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)1608cdf0e10cSrcweir uno::Any UnoFixedTextControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
1609cdf0e10cSrcweir {
1610cdf0e10cSrcweir     uno::Any aRet = ::cppu::queryInterface( rType,
1611cdf0e10cSrcweir                                         SAL_STATIC_CAST( awt::XFixedText*, this ),
1612cdf0e10cSrcweir                                         SAL_STATIC_CAST( awt::XLayoutConstrains*, this ) );
1613cdf0e10cSrcweir     return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
1614cdf0e10cSrcweir }
1615cdf0e10cSrcweir 
1616cdf0e10cSrcweir // lang::XTypeProvider
1617cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoFixedTextControl )
1618cdf0e10cSrcweir     getCppuType( ( uno::Reference< awt::XFixedText>* ) NULL ),
1619cdf0e10cSrcweir     getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
1620cdf0e10cSrcweir     UnoControlBase::getTypes()
1621cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
1622cdf0e10cSrcweir 
1623cdf0e10cSrcweir sal_Bool UnoFixedTextControl::isTransparent() throw(uno::RuntimeException)
1624cdf0e10cSrcweir {
1625cdf0e10cSrcweir     return sal_True;
1626cdf0e10cSrcweir }
1627cdf0e10cSrcweir 
setText(const::rtl::OUString & Text)1628cdf0e10cSrcweir void UnoFixedTextControl::setText( const ::rtl::OUString& Text ) throw(uno::RuntimeException)
1629cdf0e10cSrcweir {
1630cdf0e10cSrcweir     uno::Any aAny;
1631cdf0e10cSrcweir     aAny <<= Text;
1632cdf0e10cSrcweir     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
1633cdf0e10cSrcweir }
1634cdf0e10cSrcweir 
getText()1635cdf0e10cSrcweir ::rtl::OUString UnoFixedTextControl::getText() throw(uno::RuntimeException)
1636cdf0e10cSrcweir {
1637cdf0e10cSrcweir     return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
1638cdf0e10cSrcweir }
1639cdf0e10cSrcweir 
setAlignment(short nAlign)1640cdf0e10cSrcweir void UnoFixedTextControl::setAlignment( short nAlign ) throw(uno::RuntimeException)
1641cdf0e10cSrcweir {
1642cdf0e10cSrcweir     uno::Any aAny;
1643cdf0e10cSrcweir     aAny <<= (sal_Int16)nAlign;
1644cdf0e10cSrcweir     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, sal_True );
1645cdf0e10cSrcweir }
1646cdf0e10cSrcweir 
getAlignment()1647cdf0e10cSrcweir short UnoFixedTextControl::getAlignment() throw(uno::RuntimeException)
1648cdf0e10cSrcweir {
1649cdf0e10cSrcweir     short nAlign = 0;
1650cdf0e10cSrcweir     if ( mxModel.is() )
1651cdf0e10cSrcweir     {
1652cdf0e10cSrcweir         uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
1653cdf0e10cSrcweir         aVal >>= nAlign;
1654cdf0e10cSrcweir     }
1655cdf0e10cSrcweir     return nAlign;
1656cdf0e10cSrcweir }
1657cdf0e10cSrcweir 
getMinimumSize()1658cdf0e10cSrcweir awt::Size UnoFixedTextControl::getMinimumSize(  ) throw(uno::RuntimeException)
1659cdf0e10cSrcweir {
1660cdf0e10cSrcweir     return Impl_getMinimumSize();
1661cdf0e10cSrcweir }
1662cdf0e10cSrcweir 
getPreferredSize()1663cdf0e10cSrcweir awt::Size UnoFixedTextControl::getPreferredSize(  ) throw(uno::RuntimeException)
1664cdf0e10cSrcweir {
1665cdf0e10cSrcweir     return Impl_getPreferredSize();
1666cdf0e10cSrcweir }
1667cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)1668cdf0e10cSrcweir awt::Size UnoFixedTextControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
1669cdf0e10cSrcweir {
1670cdf0e10cSrcweir     return Impl_calcAdjustedSize( rNewSize );
1671cdf0e10cSrcweir }
1672cdf0e10cSrcweir 
1673cdf0e10cSrcweir //	----------------------------------------------------
1674cdf0e10cSrcweir //	class UnoControlGroupBoxModel
1675cdf0e10cSrcweir //	----------------------------------------------------
UnoControlGroupBoxModel(const Reference<XMultiServiceFactory> & i_factory)1676cdf0e10cSrcweir UnoControlGroupBoxModel::UnoControlGroupBoxModel( const Reference< XMultiServiceFactory >& i_factory )
1677cdf0e10cSrcweir     :UnoControlModel( i_factory )
1678cdf0e10cSrcweir {
1679cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
1680cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLED );
1681cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
1682cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
1683cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
1684cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HELPURL );
1685cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_LABEL );
1686cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
1687cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
1688cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
1689cdf0e10cSrcweir }
1690cdf0e10cSrcweir 
getServiceName()1691cdf0e10cSrcweir ::rtl::OUString UnoControlGroupBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
1692cdf0e10cSrcweir {
1693cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel );
1694cdf0e10cSrcweir }
1695cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const1696cdf0e10cSrcweir uno::Any UnoControlGroupBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
1697cdf0e10cSrcweir {
1698cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
1699cdf0e10cSrcweir 	{
1700cdf0e10cSrcweir 		uno::Any aAny;
1701cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
1702cdf0e10cSrcweir 		return aAny;
1703cdf0e10cSrcweir 	}
1704cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
1705cdf0e10cSrcweir }
1706cdf0e10cSrcweir 
getInfoHelper()1707cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlGroupBoxModel::getInfoHelper()
1708cdf0e10cSrcweir {
1709cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
1710cdf0e10cSrcweir 	if ( !pHelper )
1711cdf0e10cSrcweir 	{
1712cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
1713cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
1714cdf0e10cSrcweir 	}
1715cdf0e10cSrcweir 	return *pHelper;
1716cdf0e10cSrcweir }
1717cdf0e10cSrcweir 
1718cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()1719cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
1720cdf0e10cSrcweir {
1721cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
1722cdf0e10cSrcweir 	return xInfo;
1723cdf0e10cSrcweir }
1724cdf0e10cSrcweir 
1725cdf0e10cSrcweir //	----------------------------------------------------
1726cdf0e10cSrcweir //	class UnoGroupBoxControl
1727cdf0e10cSrcweir //	----------------------------------------------------
UnoGroupBoxControl(const Reference<XMultiServiceFactory> & i_factory)1728cdf0e10cSrcweir UnoGroupBoxControl::UnoGroupBoxControl( const Reference< XMultiServiceFactory >& i_factory )
1729cdf0e10cSrcweir 	:UnoControlBase( i_factory )
1730cdf0e10cSrcweir {
1731cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
1732cdf0e10cSrcweir 	maComponentInfos.nHeight = 100;
1733cdf0e10cSrcweir }
1734cdf0e10cSrcweir 
GetComponentServiceName()1735cdf0e10cSrcweir ::rtl::OUString UnoGroupBoxControl::GetComponentServiceName()
1736cdf0e10cSrcweir {
1737cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "groupbox" );
1738cdf0e10cSrcweir }
1739cdf0e10cSrcweir 
isTransparent()1740cdf0e10cSrcweir sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
1741cdf0e10cSrcweir {
1742cdf0e10cSrcweir 	return sal_True;
1743cdf0e10cSrcweir }
1744cdf0e10cSrcweir 
1745cdf0e10cSrcweir // =====================================================================================================================
1746cdf0e10cSrcweir // = UnoControlListBoxModel_Data
1747cdf0e10cSrcweir // =====================================================================================================================
1748cdf0e10cSrcweir struct ListItem
1749cdf0e10cSrcweir {
1750cdf0e10cSrcweir     ::rtl::OUString ItemText;
1751cdf0e10cSrcweir     ::rtl::OUString ItemImageURL;
1752cdf0e10cSrcweir     Any             ItemData;
1753cdf0e10cSrcweir 
ListItemListItem1754cdf0e10cSrcweir     ListItem()
1755cdf0e10cSrcweir         :ItemText()
1756cdf0e10cSrcweir         ,ItemImageURL()
1757cdf0e10cSrcweir         ,ItemData()
1758cdf0e10cSrcweir     {
1759cdf0e10cSrcweir     }
1760cdf0e10cSrcweir 
ListItemListItem1761cdf0e10cSrcweir     ListItem( const ::rtl::OUString& i_rItemText )
1762cdf0e10cSrcweir         :ItemText( i_rItemText )
1763cdf0e10cSrcweir         ,ItemImageURL()
1764cdf0e10cSrcweir         ,ItemData()
1765cdf0e10cSrcweir     {
1766cdf0e10cSrcweir     }
1767cdf0e10cSrcweir };
1768cdf0e10cSrcweir 
1769cdf0e10cSrcweir typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > UnoListItem;
1770cdf0e10cSrcweir 
1771cdf0e10cSrcweir struct StripItemData : public ::std::unary_function< ListItem, UnoListItem >
1772cdf0e10cSrcweir {
operator ()StripItemData1773cdf0e10cSrcweir     UnoListItem operator()( const ListItem& i_rItem )
1774cdf0e10cSrcweir     {
1775cdf0e10cSrcweir         return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL );
1776cdf0e10cSrcweir     }
1777cdf0e10cSrcweir };
1778cdf0e10cSrcweir 
1779cdf0e10cSrcweir struct UnoControlListBoxModel_Data
1780cdf0e10cSrcweir {
UnoControlListBoxModel_DataUnoControlListBoxModel_Data1781cdf0e10cSrcweir     UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl )
1782cdf0e10cSrcweir         :m_bSettingLegacyProperty( false )
1783cdf0e10cSrcweir         ,m_rAntiImpl( i_rAntiImpl )
1784cdf0e10cSrcweir         ,m_aListItems()
1785cdf0e10cSrcweir     {
1786cdf0e10cSrcweir     }
1787cdf0e10cSrcweir 
getItemCountUnoControlListBoxModel_Data1788cdf0e10cSrcweir     sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); }
1789cdf0e10cSrcweir 
getItemUnoControlListBoxModel_Data1790cdf0e10cSrcweir     const ListItem& getItem( const sal_Int32 i_nIndex ) const
1791cdf0e10cSrcweir     {
1792cdf0e10cSrcweir         if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
1793cdf0e10cSrcweir             throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
1794cdf0e10cSrcweir         return m_aListItems[ i_nIndex ];
1795cdf0e10cSrcweir     }
1796cdf0e10cSrcweir 
getItemUnoControlListBoxModel_Data1797cdf0e10cSrcweir     ListItem& getItem( const sal_Int32 i_nIndex )
1798cdf0e10cSrcweir     {
1799cdf0e10cSrcweir         return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) );
1800cdf0e10cSrcweir     }
1801cdf0e10cSrcweir 
insertItemUnoControlListBoxModel_Data1802cdf0e10cSrcweir     ListItem& insertItem( const sal_Int32 i_nIndex )
1803cdf0e10cSrcweir     {
1804cdf0e10cSrcweir         if ( ( i_nIndex < 0 ) || ( i_nIndex > sal_Int32( m_aListItems.size() ) ) )
1805cdf0e10cSrcweir             throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
1806cdf0e10cSrcweir         return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() );
1807cdf0e10cSrcweir     }
1808cdf0e10cSrcweir 
getAllItemsUnoControlListBoxModel_Data1809cdf0e10cSrcweir     Sequence< UnoListItem > getAllItems() const
1810cdf0e10cSrcweir     {
1811cdf0e10cSrcweir         Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) );
1812cdf0e10cSrcweir         ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() );
1813cdf0e10cSrcweir         return aItems;
1814cdf0e10cSrcweir     }
1815cdf0e10cSrcweir 
copyItemsUnoControlListBoxModel_Data1816cdf0e10cSrcweir     void copyItems( const UnoControlListBoxModel_Data& i_copySource )
1817cdf0e10cSrcweir     {
1818cdf0e10cSrcweir         m_aListItems = i_copySource.m_aListItems;
1819cdf0e10cSrcweir     }
1820cdf0e10cSrcweir 
setAllItemsUnoControlListBoxModel_Data1821cdf0e10cSrcweir     void    setAllItems( const ::std::vector< ListItem >& i_rItems )
1822cdf0e10cSrcweir     {
1823cdf0e10cSrcweir         m_aListItems = i_rItems;
1824cdf0e10cSrcweir     }
1825cdf0e10cSrcweir 
removeItemUnoControlListBoxModel_Data1826cdf0e10cSrcweir     void    removeItem( const sal_Int32 i_nIndex )
1827cdf0e10cSrcweir     {
1828cdf0e10cSrcweir         if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
1829cdf0e10cSrcweir             throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
1830cdf0e10cSrcweir         m_aListItems.erase( m_aListItems.begin() + i_nIndex );
1831cdf0e10cSrcweir     }
1832cdf0e10cSrcweir 
removeAllItemsUnoControlListBoxModel_Data1833cdf0e10cSrcweir     void removeAllItems()
1834cdf0e10cSrcweir     {
1835cdf0e10cSrcweir         ::std::vector< ListItem > aEmpty;
1836cdf0e10cSrcweir         m_aListItems.swap( aEmpty );
1837cdf0e10cSrcweir     }
1838cdf0e10cSrcweir 
1839cdf0e10cSrcweir public:
1840cdf0e10cSrcweir     bool                        m_bSettingLegacyProperty;
1841cdf0e10cSrcweir 
1842cdf0e10cSrcweir private:
1843cdf0e10cSrcweir     UnoControlListBoxModel&     m_rAntiImpl;
1844cdf0e10cSrcweir     ::std::vector< ListItem >   m_aListItems;
1845cdf0e10cSrcweir };
1846cdf0e10cSrcweir 
1847cdf0e10cSrcweir // =====================================================================================================================
1848cdf0e10cSrcweir // = UnoControlListBoxModel
1849cdf0e10cSrcweir // =====================================================================================================================
1850cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
UnoControlListBoxModel(const Reference<XMultiServiceFactory> & i_factory,ConstructorMode const i_mode)1851cdf0e10cSrcweir UnoControlListBoxModel::UnoControlListBoxModel( const Reference< XMultiServiceFactory >& i_factory, ConstructorMode const i_mode )
1852cdf0e10cSrcweir     :UnoControlListBoxModel_Base( i_factory )
1853cdf0e10cSrcweir     ,m_pData( new UnoControlListBoxModel_Data( *this ) )
1854cdf0e10cSrcweir     ,m_aItemListListeners( GetMutex() )
1855cdf0e10cSrcweir {
1856cdf0e10cSrcweir     if ( i_mode == ConstructDefault )
1857cdf0e10cSrcweir     {
1858cdf0e10cSrcweir         UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
1859cdf0e10cSrcweir     }
1860cdf0e10cSrcweir }
1861cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
UnoControlListBoxModel(const UnoControlListBoxModel & i_rSource)1862cdf0e10cSrcweir UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource )
1863cdf0e10cSrcweir     :UnoControlListBoxModel_Base( i_rSource )
1864cdf0e10cSrcweir     ,m_pData( new UnoControlListBoxModel_Data( *this ) )
1865cdf0e10cSrcweir     ,m_aItemListListeners( GetMutex() )
1866cdf0e10cSrcweir {
1867cdf0e10cSrcweir     m_pData->copyItems( *i_rSource.m_pData );
1868cdf0e10cSrcweir }
~UnoControlListBoxModel()1869cdf0e10cSrcweir UnoControlListBoxModel::~UnoControlListBoxModel()
1870cdf0e10cSrcweir {
1871cdf0e10cSrcweir }
IMPL_SERVICEINFO_DERIVED(UnoControlListBoxModel,UnoControlModel,szServiceName2_UnoControlListBoxModel)1872cdf0e10cSrcweir IMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel )
1873cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
1874cdf0e10cSrcweir ::rtl::OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
1875cdf0e10cSrcweir {
1876cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
1877cdf0e10cSrcweir }
1878cdf0e10cSrcweir 
1879cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
ImplGetDefaultValue(sal_uInt16 nPropId) const1880cdf0e10cSrcweir uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
1881cdf0e10cSrcweir {
1882cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
1883cdf0e10cSrcweir 	{
1884cdf0e10cSrcweir 		uno::Any aAny;
1885cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox );
1886cdf0e10cSrcweir 		return aAny;
1887cdf0e10cSrcweir 	}
1888cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
1889cdf0e10cSrcweir }
1890cdf0e10cSrcweir 
1891cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getInfoHelper()1892cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper()
1893cdf0e10cSrcweir {
1894cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
1895cdf0e10cSrcweir 	if ( !pHelper )
1896cdf0e10cSrcweir 	{
1897cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
1898cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
1899cdf0e10cSrcweir 	}
1900cdf0e10cSrcweir 	return *pHelper;
1901cdf0e10cSrcweir }
1902cdf0e10cSrcweir 
1903cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
1904cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()1905cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
1906cdf0e10cSrcweir {
1907cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
1908cdf0e10cSrcweir 	return xInfo;
1909cdf0e10cSrcweir }
1910cdf0e10cSrcweir 
1911cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
1912cdf0e10cSrcweir namespace
1913cdf0e10cSrcweir {
1914cdf0e10cSrcweir     struct CreateListItem : public ::std::unary_function< ::rtl::OUString, ListItem >
1915cdf0e10cSrcweir     {
operator ()__anon0bbb5a550211::CreateListItem1916cdf0e10cSrcweir         ListItem operator()( const ::rtl::OUString& i_rItemText )
1917cdf0e10cSrcweir         {
1918cdf0e10cSrcweir             return ListItem( i_rItemText );
1919cdf0e10cSrcweir         }
1920cdf0e10cSrcweir     };
1921cdf0e10cSrcweir }
1922cdf0e10cSrcweir 
1923cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const uno::Any & rValue)1924cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
1925cdf0e10cSrcweir {
1926cdf0e10cSrcweir     UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
1927cdf0e10cSrcweir 
1928cdf0e10cSrcweir     if ( nHandle == BASEPROPERTY_STRINGITEMLIST )
1929cdf0e10cSrcweir 	{
1930cdf0e10cSrcweir         // reset selection
1931cdf0e10cSrcweir 		uno::Sequence<sal_Int16> aSeq;
1932cdf0e10cSrcweir 		uno::Any aAny;
1933cdf0e10cSrcweir 		aAny <<= aSeq;
1934cdf0e10cSrcweir 		setDependentFastPropertyValue( BASEPROPERTY_SELECTEDITEMS, aAny );
1935cdf0e10cSrcweir 
1936cdf0e10cSrcweir         if ( !m_pData->m_bSettingLegacyProperty )
1937cdf0e10cSrcweir         {
1938cdf0e10cSrcweir             // synchronize the legacy StringItemList property with our list items
1939cdf0e10cSrcweir             Sequence< ::rtl::OUString > aStringItemList;
1940cdf0e10cSrcweir             Any aPropValue;
1941cdf0e10cSrcweir             getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
1942cdf0e10cSrcweir             OSL_VERIFY( aPropValue >>= aStringItemList );
1943cdf0e10cSrcweir 
1944cdf0e10cSrcweir             ::std::vector< ListItem > aItems( aStringItemList.getLength() );
1945cdf0e10cSrcweir             ::std::transform(
1946cdf0e10cSrcweir                 aStringItemList.getConstArray(),
1947cdf0e10cSrcweir                 aStringItemList.getConstArray() + aStringItemList.getLength(),
1948cdf0e10cSrcweir                 aItems.begin(),
1949cdf0e10cSrcweir                 CreateListItem()
1950cdf0e10cSrcweir             );
1951cdf0e10cSrcweir             m_pData->setAllItems( aItems );
1952cdf0e10cSrcweir 
1953cdf0e10cSrcweir             // since an XItemListListener does not have a "all items modified" or some such method,
1954cdf0e10cSrcweir             // we simulate this by notifying removal of all items, followed by insertion of all new
1955cdf0e10cSrcweir             // items
1956cdf0e10cSrcweir             lang::EventObject aEvent;
1957cdf0e10cSrcweir             aEvent.Source = *this;
1958cdf0e10cSrcweir             m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
1959cdf0e10cSrcweir             // TODO: OPropertySetHelper calls into this method with the mutex locked ...
1960cdf0e10cSrcweir             // which is wrong for the above notifications ...
1961cdf0e10cSrcweir         }
1962cdf0e10cSrcweir 	}
1963cdf0e10cSrcweir }
1964cdf0e10cSrcweir 
1965cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
ImplNormalizePropertySequence(const sal_Int32 _nCount,sal_Int32 * _pHandles,uno::Any * _pValues,sal_Int32 * _pValidHandles) const1966cdf0e10cSrcweir void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
1967cdf0e10cSrcweir 	uno::Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
1968cdf0e10cSrcweir {
1969cdf0e10cSrcweir 	// dependencies we know:
1970cdf0e10cSrcweir 	// BASEPROPERTY_STRINGITEMLIST->BASEPROPERTY_SELECTEDITEMS
1971cdf0e10cSrcweir     ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_STRINGITEMLIST, BASEPROPERTY_SELECTEDITEMS );
1972cdf0e10cSrcweir 
1973cdf0e10cSrcweir 	UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
1974cdf0e10cSrcweir }
1975cdf0e10cSrcweir 
1976cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getItemCount()1977cdf0e10cSrcweir ::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() throw (RuntimeException)
1978cdf0e10cSrcweir {
1979cdf0e10cSrcweir 	::osl::MutexGuard aGuard( GetMutex() );
1980cdf0e10cSrcweir     return m_pData->getItemCount();
1981cdf0e10cSrcweir }
1982cdf0e10cSrcweir 
1983cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
insertItem(::sal_Int32 i_nPosition,const::rtl::OUString & i_rItemText,const::rtl::OUString & i_rItemImageURL)1984cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
1985cdf0e10cSrcweir {
1986cdf0e10cSrcweir     ::osl::ClearableMutexGuard aGuard( GetMutex() );
1987cdf0e10cSrcweir     // SYNCHRONIZED ----->
1988cdf0e10cSrcweir     ListItem& rItem( m_pData->insertItem( i_nPosition ) );
1989cdf0e10cSrcweir     rItem.ItemText = i_rItemText;
1990cdf0e10cSrcweir     rItem.ItemImageURL = i_rItemImageURL;
1991cdf0e10cSrcweir 
1992cdf0e10cSrcweir     impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
1993cdf0e10cSrcweir     // <----- SYNCHRONIZED
1994cdf0e10cSrcweir }
1995cdf0e10cSrcweir 
1996cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
insertItemText(::sal_Int32 i_nPosition,const::rtl::OUString & i_rItemText)1997cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
1998cdf0e10cSrcweir {
1999cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2000cdf0e10cSrcweir     // SYNCHRONIZED ----->
2001cdf0e10cSrcweir     ListItem& rItem( m_pData->insertItem( i_nPosition ) );
2002cdf0e10cSrcweir     rItem.ItemText = i_rItemText;
2003cdf0e10cSrcweir 
2004cdf0e10cSrcweir     impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
2005cdf0e10cSrcweir     // <----- SYNCHRONIZED
2006cdf0e10cSrcweir }
2007cdf0e10cSrcweir 
2008cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
insertItemImage(::sal_Int32 i_nPosition,const::rtl::OUString & i_rItemImageURL)2009cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
2010cdf0e10cSrcweir {
2011cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2012cdf0e10cSrcweir     // SYNCHRONIZED ----->
2013cdf0e10cSrcweir     ListItem& rItem( m_pData->insertItem( i_nPosition ) );
2014cdf0e10cSrcweir     rItem.ItemImageURL = i_rItemImageURL;
2015cdf0e10cSrcweir 
2016cdf0e10cSrcweir     impl_handleInsert( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
2017cdf0e10cSrcweir     // <----- SYNCHRONIZED
2018cdf0e10cSrcweir }
2019cdf0e10cSrcweir 
2020cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
removeItem(::sal_Int32 i_nPosition)2021cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
2022cdf0e10cSrcweir {
2023cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2024cdf0e10cSrcweir     // SYNCHRONIZED ----->
2025cdf0e10cSrcweir     m_pData->removeItem( i_nPosition );
2026cdf0e10cSrcweir 
2027cdf0e10cSrcweir     impl_handleRemove( i_nPosition, aGuard );
2028cdf0e10cSrcweir     // <----- SYNCHRONIZED
2029cdf0e10cSrcweir }
2030cdf0e10cSrcweir 
2031cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
removeAllItems()2032cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::removeAllItems(  ) throw (::com::sun::star::uno::RuntimeException)
2033cdf0e10cSrcweir {
2034cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2035cdf0e10cSrcweir     // SYNCHRONIZED ----->
2036cdf0e10cSrcweir     m_pData->removeAllItems();
2037cdf0e10cSrcweir 
2038cdf0e10cSrcweir     impl_handleRemove( -1, aGuard );
2039cdf0e10cSrcweir     // <----- SYNCHRONIZED
2040cdf0e10cSrcweir }
2041cdf0e10cSrcweir 
2042cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
setItemText(::sal_Int32 i_nPosition,const::rtl::OUString & i_rItemText)2043cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
2044cdf0e10cSrcweir {
2045cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2046cdf0e10cSrcweir     // SYNCHRONIZED ----->
2047cdf0e10cSrcweir     ListItem& rItem( m_pData->getItem( i_nPosition ) );
2048cdf0e10cSrcweir     rItem.ItemText = i_rItemText;
2049cdf0e10cSrcweir 
2050cdf0e10cSrcweir     impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
2051cdf0e10cSrcweir     // <----- SYNCHRONIZED
2052cdf0e10cSrcweir }
2053cdf0e10cSrcweir 
2054cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
setItemImage(::sal_Int32 i_nPosition,const::rtl::OUString & i_rItemImageURL)2055cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
2056cdf0e10cSrcweir {
2057cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2058cdf0e10cSrcweir     // SYNCHRONIZED ----->
2059cdf0e10cSrcweir     ListItem& rItem( m_pData->getItem( i_nPosition ) );
2060cdf0e10cSrcweir     rItem.ItemImageURL = i_rItemImageURL;
2061cdf0e10cSrcweir 
2062cdf0e10cSrcweir     impl_handleModify( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
2063cdf0e10cSrcweir     // <----- SYNCHRONIZED
2064cdf0e10cSrcweir }
2065cdf0e10cSrcweir 
2066cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
setItemTextAndImage(::sal_Int32 i_nPosition,const::rtl::OUString & i_rItemText,const::rtl::OUString & i_rItemImageURL)2067cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
2068cdf0e10cSrcweir {
2069cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2070cdf0e10cSrcweir     // SYNCHRONIZED ----->
2071cdf0e10cSrcweir     ListItem& rItem( m_pData->getItem( i_nPosition ) );
2072cdf0e10cSrcweir     rItem.ItemText = i_rItemText;
2073cdf0e10cSrcweir     rItem.ItemImageURL = i_rItemImageURL;
2074cdf0e10cSrcweir 
2075cdf0e10cSrcweir     impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
2076cdf0e10cSrcweir     // <----- SYNCHRONIZED
2077cdf0e10cSrcweir }
2078cdf0e10cSrcweir 
2079cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
setItemData(::sal_Int32 i_nPosition,const Any & i_rDataValue)2080cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException)
2081cdf0e10cSrcweir {
2082cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2083cdf0e10cSrcweir     ListItem& rItem( m_pData->getItem( i_nPosition ) );
2084cdf0e10cSrcweir     rItem.ItemData = i_rDataValue;
2085cdf0e10cSrcweir }
2086cdf0e10cSrcweir 
2087cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getItemText(::sal_Int32 i_nPosition)2088cdf0e10cSrcweir ::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
2089cdf0e10cSrcweir {
2090cdf0e10cSrcweir     ::osl::MutexGuard aGuard( GetMutex() );
2091cdf0e10cSrcweir     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
2092cdf0e10cSrcweir     return rItem.ItemText;
2093cdf0e10cSrcweir }
2094cdf0e10cSrcweir 
2095cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getItemImage(::sal_Int32 i_nPosition)2096cdf0e10cSrcweir ::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
2097cdf0e10cSrcweir {
2098cdf0e10cSrcweir 	::osl::MutexGuard aGuard( GetMutex() );
2099cdf0e10cSrcweir     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
2100cdf0e10cSrcweir     return rItem.ItemImageURL;
2101cdf0e10cSrcweir }
2102cdf0e10cSrcweir 
2103cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getItemTextAndImage(::sal_Int32 i_nPosition)2104cdf0e10cSrcweir beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
2105cdf0e10cSrcweir {
2106cdf0e10cSrcweir 	::osl::MutexGuard aGuard( GetMutex() );
2107cdf0e10cSrcweir     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
2108cdf0e10cSrcweir     return beans::Pair< ::rtl::OUString, ::rtl::OUString >( rItem.ItemText, rItem.ItemImageURL );
2109cdf0e10cSrcweir }
2110cdf0e10cSrcweir 
2111cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getItemData(::sal_Int32 i_nPosition)2112cdf0e10cSrcweir Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
2113cdf0e10cSrcweir {
2114cdf0e10cSrcweir 	::osl::ClearableMutexGuard aGuard( GetMutex() );
2115cdf0e10cSrcweir     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
2116cdf0e10cSrcweir     return rItem.ItemData;
2117cdf0e10cSrcweir }
2118cdf0e10cSrcweir 
2119cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getAllItems()2120cdf0e10cSrcweir Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL UnoControlListBoxModel::getAllItems(  ) throw (RuntimeException)
2121cdf0e10cSrcweir {
2122cdf0e10cSrcweir 	::osl::MutexGuard aGuard( GetMutex() );
2123cdf0e10cSrcweir     return m_pData->getAllItems();
2124cdf0e10cSrcweir }
2125cdf0e10cSrcweir 
2126cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
addItemListListener(const uno::Reference<awt::XItemListListener> & i_Listener)2127cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
2128cdf0e10cSrcweir {
2129cdf0e10cSrcweir     if ( i_Listener.is() )
2130cdf0e10cSrcweir         m_aItemListListeners.addInterface( i_Listener );
2131cdf0e10cSrcweir }
2132cdf0e10cSrcweir 
2133cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
removeItemListListener(const uno::Reference<awt::XItemListListener> & i_Listener)2134cdf0e10cSrcweir void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
2135cdf0e10cSrcweir {
2136cdf0e10cSrcweir     if ( i_Listener.is() )
2137cdf0e10cSrcweir         m_aItemListListeners.removeInterface( i_Listener );
2138cdf0e10cSrcweir }
2139cdf0e10cSrcweir 
2140cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
impl_getStringItemList(::std::vector<::rtl::OUString> & o_rStringItems) const2141cdf0e10cSrcweir void UnoControlListBoxModel::impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const
2142cdf0e10cSrcweir {
2143cdf0e10cSrcweir     Sequence< ::rtl::OUString > aStringItemList;
2144cdf0e10cSrcweir     Any aPropValue;
2145cdf0e10cSrcweir     getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
2146cdf0e10cSrcweir     OSL_VERIFY( aPropValue >>= aStringItemList );
2147cdf0e10cSrcweir 
2148cdf0e10cSrcweir     o_rStringItems.resize( size_t( aStringItemList.getLength() ) );
2149cdf0e10cSrcweir     ::std::copy(
2150cdf0e10cSrcweir         aStringItemList.getConstArray(),
2151cdf0e10cSrcweir         aStringItemList.getConstArray() + aStringItemList.getLength(),
2152cdf0e10cSrcweir         o_rStringItems.begin()
2153cdf0e10cSrcweir     );
2154cdf0e10cSrcweir }
2155cdf0e10cSrcweir 
2156cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
impl_setStringItemList_nolck(const::std::vector<::rtl::OUString> & i_rStringItems)2157cdf0e10cSrcweir void UnoControlListBoxModel::impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems )
2158cdf0e10cSrcweir {
2159cdf0e10cSrcweir     Sequence< ::rtl::OUString > aStringItems( i_rStringItems.size() );
2160cdf0e10cSrcweir     ::std::copy(
2161cdf0e10cSrcweir         i_rStringItems.begin(),
2162cdf0e10cSrcweir         i_rStringItems.end(),
2163cdf0e10cSrcweir         aStringItems.getArray()
2164cdf0e10cSrcweir     );
2165cdf0e10cSrcweir     m_pData->m_bSettingLegacyProperty = true;
2166cdf0e10cSrcweir     try
2167cdf0e10cSrcweir     {
2168cdf0e10cSrcweir         setFastPropertyValue( BASEPROPERTY_STRINGITEMLIST, uno::makeAny( aStringItems ) );
2169cdf0e10cSrcweir     }
2170cdf0e10cSrcweir     catch( const Exception& )
2171cdf0e10cSrcweir     {
2172cdf0e10cSrcweir         m_pData->m_bSettingLegacyProperty = false;
2173cdf0e10cSrcweir         throw;
2174cdf0e10cSrcweir     }
2175cdf0e10cSrcweir     m_pData->m_bSettingLegacyProperty = false;
2176cdf0e10cSrcweir }
2177cdf0e10cSrcweir 
2178cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
impl_handleInsert(const sal_Int32 i_nItemPosition,const::boost::optional<::rtl::OUString> & i_rItemText,const::boost::optional<::rtl::OUString> & i_rItemImageURL,::osl::ClearableMutexGuard & i_rClearBeforeNotify)2179cdf0e10cSrcweir void UnoControlListBoxModel::impl_handleInsert( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
2180cdf0e10cSrcweir         const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
2181cdf0e10cSrcweir {
2182cdf0e10cSrcweir     // SYNCHRONIZED ----->
2183cdf0e10cSrcweir     // sync with legacy StringItemList property
2184cdf0e10cSrcweir     ::std::vector< ::rtl::OUString > aStringItems;
2185cdf0e10cSrcweir     impl_getStringItemList( aStringItems );
2186cdf0e10cSrcweir     OSL_ENSURE( size_t( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" );
2187cdf0e10cSrcweir     if ( size_t( i_nItemPosition ) <= aStringItems.size() )
2188cdf0e10cSrcweir     {
2189cdf0e10cSrcweir         const ::rtl::OUString sItemText( !!i_rItemText ? *i_rItemText : ::rtl::OUString() );
2190cdf0e10cSrcweir         aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText );
2191cdf0e10cSrcweir     }
2192cdf0e10cSrcweir 
2193cdf0e10cSrcweir     i_rClearBeforeNotify.clear();
2194cdf0e10cSrcweir     // <----- SYNCHRONIZED
2195cdf0e10cSrcweir     impl_setStringItemList_nolck( aStringItems );
2196cdf0e10cSrcweir 
2197cdf0e10cSrcweir     // notify ItemListListeners
2198cdf0e10cSrcweir     impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted );
2199cdf0e10cSrcweir }
2200cdf0e10cSrcweir 
2201cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
impl_handleRemove(const sal_Int32 i_nItemPosition,::osl::ClearableMutexGuard & i_rClearBeforeNotify)2202cdf0e10cSrcweir void UnoControlListBoxModel::impl_handleRemove( const sal_Int32 i_nItemPosition, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
2203cdf0e10cSrcweir {
2204cdf0e10cSrcweir     // SYNCHRONIZED ----->
2205cdf0e10cSrcweir     const bool bAllItems = ( i_nItemPosition < 0 );
2206cdf0e10cSrcweir     // sync with legacy StringItemList property
2207cdf0e10cSrcweir     ::std::vector< ::rtl::OUString > aStringItems;
2208cdf0e10cSrcweir     impl_getStringItemList( aStringItems );
2209cdf0e10cSrcweir     if ( !bAllItems )
2210cdf0e10cSrcweir     {
2211cdf0e10cSrcweir         OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" );
2212cdf0e10cSrcweir         if ( size_t( i_nItemPosition ) < aStringItems.size() )
2213cdf0e10cSrcweir         {
2214cdf0e10cSrcweir             aStringItems.erase( aStringItems.begin() + i_nItemPosition );
2215cdf0e10cSrcweir         }
2216cdf0e10cSrcweir     }
2217cdf0e10cSrcweir     else
2218cdf0e10cSrcweir     {
2219cdf0e10cSrcweir         aStringItems.resize(0);
2220cdf0e10cSrcweir     }
2221cdf0e10cSrcweir 
2222cdf0e10cSrcweir     i_rClearBeforeNotify.clear();
2223cdf0e10cSrcweir     // <----- SYNCHRONIZED
2224cdf0e10cSrcweir     impl_setStringItemList_nolck( aStringItems );
2225cdf0e10cSrcweir 
2226cdf0e10cSrcweir     // notify ItemListListeners
2227cdf0e10cSrcweir     if ( bAllItems )
2228cdf0e10cSrcweir     {
2229cdf0e10cSrcweir         EventObject aEvent( *this );
2230cdf0e10cSrcweir         m_aItemListListeners.notifyEach( &XItemListListener::allItemsRemoved, aEvent );
2231cdf0e10cSrcweir     }
2232cdf0e10cSrcweir     else
2233cdf0e10cSrcweir     {
2234cdf0e10cSrcweir         impl_notifyItemListEvent_nolck( i_nItemPosition, ::boost::optional< ::rtl::OUString >(), ::boost::optional< ::rtl::OUString >(),
2235cdf0e10cSrcweir             &XItemListListener::listItemRemoved );
2236cdf0e10cSrcweir     }
2237cdf0e10cSrcweir }
2238cdf0e10cSrcweir 
2239cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
impl_handleModify(const sal_Int32 i_nItemPosition,const::boost::optional<::rtl::OUString> & i_rItemText,const::boost::optional<::rtl::OUString> & i_rItemImageURL,::osl::ClearableMutexGuard & i_rClearBeforeNotify)2240cdf0e10cSrcweir void UnoControlListBoxModel::impl_handleModify( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
2241cdf0e10cSrcweir         const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
2242cdf0e10cSrcweir {
2243cdf0e10cSrcweir     // SYNCHRONIZED ----->
2244cdf0e10cSrcweir     if ( !!i_rItemText )
2245cdf0e10cSrcweir     {
2246cdf0e10cSrcweir         // sync with legacy StringItemList property
2247cdf0e10cSrcweir         ::std::vector< ::rtl::OUString > aStringItems;
2248cdf0e10cSrcweir         impl_getStringItemList( aStringItems );
2249cdf0e10cSrcweir         OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" );
2250cdf0e10cSrcweir         if ( size_t( i_nItemPosition ) < aStringItems.size() )
2251cdf0e10cSrcweir         {
2252cdf0e10cSrcweir             aStringItems[ i_nItemPosition] = *i_rItemText;
2253cdf0e10cSrcweir         }
2254cdf0e10cSrcweir 
2255cdf0e10cSrcweir         i_rClearBeforeNotify.clear();
2256cdf0e10cSrcweir         // <----- SYNCHRONIZED
2257cdf0e10cSrcweir         impl_setStringItemList_nolck( aStringItems );
2258cdf0e10cSrcweir     }
2259cdf0e10cSrcweir     else
2260cdf0e10cSrcweir     {
2261cdf0e10cSrcweir         i_rClearBeforeNotify.clear();
2262cdf0e10cSrcweir         // <----- SYNCHRONIZED
2263cdf0e10cSrcweir     }
2264cdf0e10cSrcweir 
2265cdf0e10cSrcweir     // notify ItemListListeners
2266cdf0e10cSrcweir     impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified );
2267cdf0e10cSrcweir }
2268cdf0e10cSrcweir 
2269cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
impl_notifyItemListEvent_nolck(const sal_Int32 i_nItemPosition,const::boost::optional<::rtl::OUString> & i_rItemText,const::boost::optional<::rtl::OUString> & i_rItemImageURL,void (SAL_CALL XItemListListener::* NotificationMethod)(const ItemListEvent &))2270cdf0e10cSrcweir void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
2271cdf0e10cSrcweir     const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
2272cdf0e10cSrcweir     void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) )
2273cdf0e10cSrcweir {
2274cdf0e10cSrcweir     ItemListEvent aEvent;
2275cdf0e10cSrcweir     aEvent.Source = *this;
2276cdf0e10cSrcweir     aEvent.ItemPosition = i_nItemPosition;
2277cdf0e10cSrcweir     if ( !!i_rItemText )
2278cdf0e10cSrcweir     {
2279cdf0e10cSrcweir         aEvent.ItemText.IsPresent = sal_True;
2280cdf0e10cSrcweir         aEvent.ItemText.Value = *i_rItemText;
2281cdf0e10cSrcweir     }
2282cdf0e10cSrcweir     if ( !!i_rItemImageURL )
2283cdf0e10cSrcweir     {
2284cdf0e10cSrcweir         aEvent.ItemImageURL.IsPresent = sal_True;
2285cdf0e10cSrcweir         aEvent.ItemImageURL.Value = *i_rItemImageURL;
2286cdf0e10cSrcweir     }
2287cdf0e10cSrcweir 
2288cdf0e10cSrcweir     m_aItemListListeners.notifyEach( NotificationMethod, aEvent );
2289cdf0e10cSrcweir }
2290cdf0e10cSrcweir 
2291cdf0e10cSrcweir //	----------------------------------------------------
2292cdf0e10cSrcweir //	class UnoListBoxControl
2293cdf0e10cSrcweir //	----------------------------------------------------
UnoListBoxControl(const Reference<XMultiServiceFactory> & i_factory)2294cdf0e10cSrcweir UnoListBoxControl::UnoListBoxControl( const Reference< XMultiServiceFactory >& i_factory )
2295cdf0e10cSrcweir 	:UnoListBoxControl_Base( i_factory )
2296cdf0e10cSrcweir     ,maActionListeners( *this )
2297cdf0e10cSrcweir 	,maItemListeners( *this )
2298cdf0e10cSrcweir {
2299cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
2300cdf0e10cSrcweir 	maComponentInfos.nHeight = 12;
2301cdf0e10cSrcweir }
2302cdf0e10cSrcweir 
GetComponentServiceName()2303cdf0e10cSrcweir ::rtl::OUString UnoListBoxControl::GetComponentServiceName()
2304cdf0e10cSrcweir {
2305cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "listbox" );
2306cdf0e10cSrcweir }
IMPL_SERVICEINFO_DERIVED(UnoListBoxControl,UnoControlBase,szServiceName2_UnoControlListBox)2307cdf0e10cSrcweir IMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
2308cdf0e10cSrcweir 
2309cdf0e10cSrcweir void UnoListBoxControl::dispose() throw(uno::RuntimeException)
2310cdf0e10cSrcweir {
2311cdf0e10cSrcweir 	lang::EventObject aEvt;
2312cdf0e10cSrcweir 	aEvt.Source = (::cppu::OWeakObject*)this;
2313cdf0e10cSrcweir 	maActionListeners.disposeAndClear( aEvt );
2314cdf0e10cSrcweir 	maItemListeners.disposeAndClear( aEvt );
2315cdf0e10cSrcweir 	UnoControl::dispose();
2316cdf0e10cSrcweir }
2317cdf0e10cSrcweir 
ImplUpdateSelectedItemsProperty()2318cdf0e10cSrcweir void UnoListBoxControl::ImplUpdateSelectedItemsProperty()
2319cdf0e10cSrcweir {
2320cdf0e10cSrcweir     if ( getPeer().is() )
2321cdf0e10cSrcweir     {
2322cdf0e10cSrcweir     	uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
2323cdf0e10cSrcweir     	DBG_ASSERT( xListBox.is(), "XListBox?" );
2324cdf0e10cSrcweir 
2325cdf0e10cSrcweir     	uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos();
2326cdf0e10cSrcweir     	uno::Any aAny;
2327cdf0e10cSrcweir     	aAny <<= aSeq;
2328cdf0e10cSrcweir     	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny, sal_False );
2329cdf0e10cSrcweir     }
2330cdf0e10cSrcweir }
2331cdf0e10cSrcweir 
updateFromModel()2332cdf0e10cSrcweir void UnoListBoxControl::updateFromModel()
2333cdf0e10cSrcweir {
2334cdf0e10cSrcweir     UnoControlBase::updateFromModel();
2335cdf0e10cSrcweir 
2336cdf0e10cSrcweir     Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
2337cdf0e10cSrcweir     ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
2338cdf0e10cSrcweir 
2339cdf0e10cSrcweir     EventObject aEvent( getModel() );
2340cdf0e10cSrcweir     xItemListListener->itemListChanged( aEvent );
2341cdf0e10cSrcweir 
2342cdf0e10cSrcweir     // notify the change of the SelectedItems property, again. While our base class, in updateFromModel,
2343cdf0e10cSrcweir     // already did this, our peer(s) can only legitimately set the selection after they have the string
2344cdf0e10cSrcweir     // item list, which we just notified with the itemListChanged call.
2345cdf0e10cSrcweir     const ::rtl::OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
2346cdf0e10cSrcweir     ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) );
2347cdf0e10cSrcweir }
2348cdf0e10cSrcweir 
ImplSetPeerProperty(const::rtl::OUString & rPropName,const uno::Any & rVal)2349cdf0e10cSrcweir void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
2350cdf0e10cSrcweir {
2351cdf0e10cSrcweir     if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
2352cdf0e10cSrcweir         // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
2353cdf0e10cSrcweir         // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
2354cdf0e10cSrcweir         // will be forwarded to the peer, which will update itself accordingly.
2355cdf0e10cSrcweir         return;
2356cdf0e10cSrcweir 
2357cdf0e10cSrcweir 	UnoControl::ImplSetPeerProperty( rPropName, rVal );
2358cdf0e10cSrcweir }
2359cdf0e10cSrcweir 
createPeer(const uno::Reference<awt::XToolkit> & rxToolkit,const uno::Reference<awt::XWindowPeer> & rParentPeer)2360cdf0e10cSrcweir void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
2361cdf0e10cSrcweir {
2362cdf0e10cSrcweir 	UnoControl::createPeer( rxToolkit, rParentPeer );
2363cdf0e10cSrcweir 
2364cdf0e10cSrcweir 	uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2365cdf0e10cSrcweir 	xListBox->addItemListener( this );
2366cdf0e10cSrcweir 
2367cdf0e10cSrcweir 	if ( maActionListeners.getLength() )
2368cdf0e10cSrcweir 		xListBox->addActionListener( &maActionListeners );
2369cdf0e10cSrcweir }
2370cdf0e10cSrcweir 
addActionListener(const uno::Reference<awt::XActionListener> & l)2371cdf0e10cSrcweir void UnoListBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
2372cdf0e10cSrcweir {
2373cdf0e10cSrcweir 	maActionListeners.addInterface( l );
2374cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
2375cdf0e10cSrcweir 	{
2376cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2377cdf0e10cSrcweir 		xListBox->addActionListener( &maActionListeners );
2378cdf0e10cSrcweir 	}
2379cdf0e10cSrcweir }
2380cdf0e10cSrcweir 
removeActionListener(const uno::Reference<awt::XActionListener> & l)2381cdf0e10cSrcweir void UnoListBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
2382cdf0e10cSrcweir {
2383cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
2384cdf0e10cSrcweir 	{
2385cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2386cdf0e10cSrcweir 		xListBox->removeActionListener( &maActionListeners );
2387cdf0e10cSrcweir 	}
2388cdf0e10cSrcweir 	maActionListeners.removeInterface( l );
2389cdf0e10cSrcweir }
2390cdf0e10cSrcweir 
addItemListener(const uno::Reference<awt::XItemListener> & l)2391cdf0e10cSrcweir void UnoListBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
2392cdf0e10cSrcweir {
2393cdf0e10cSrcweir 	maItemListeners.addInterface( l );
2394cdf0e10cSrcweir }
2395cdf0e10cSrcweir 
removeItemListener(const uno::Reference<awt::XItemListener> & l)2396cdf0e10cSrcweir void UnoListBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
2397cdf0e10cSrcweir {
2398cdf0e10cSrcweir 	maItemListeners.removeInterface( l );
2399cdf0e10cSrcweir }
2400cdf0e10cSrcweir 
addItem(const::rtl::OUString & aItem,sal_Int16 nPos)2401cdf0e10cSrcweir void UnoListBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException)
2402cdf0e10cSrcweir {
2403cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq( 1 );
2404cdf0e10cSrcweir 	aSeq.getArray()[0] = aItem;
2405cdf0e10cSrcweir 	addItems( aSeq, nPos );
2406cdf0e10cSrcweir }
2407cdf0e10cSrcweir 
addItems(const uno::Sequence<::rtl::OUString> & aItems,sal_Int16 nPos)2408cdf0e10cSrcweir void UnoListBoxControl::addItems( const uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException)
2409cdf0e10cSrcweir {
2410cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
2411cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
2412cdf0e10cSrcweir 	aVal >>= aSeq;
2413cdf0e10cSrcweir 	sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
2414cdf0e10cSrcweir 	sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
2415cdf0e10cSrcweir 	sal_uInt16 nNewLen = nOldLen + nNewItems;
2416cdf0e10cSrcweir 
2417cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
2418cdf0e10cSrcweir 	::rtl::OUString* pNewData = aNewSeq.getArray();
2419cdf0e10cSrcweir 	::rtl::OUString* pOldData = aSeq.getArray();
2420cdf0e10cSrcweir 
2421cdf0e10cSrcweir 	if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
2422cdf0e10cSrcweir 		nPos = (sal_uInt16) nOldLen;
2423cdf0e10cSrcweir 
2424cdf0e10cSrcweir 	sal_uInt16 n;
2425cdf0e10cSrcweir 	// Items vor der Einfuege-Position
2426cdf0e10cSrcweir 	for ( n = 0; n < nPos; n++ )
2427cdf0e10cSrcweir 		pNewData[n] = pOldData[n];
2428cdf0e10cSrcweir 
2429cdf0e10cSrcweir 	// Neue Items
2430cdf0e10cSrcweir 	for ( n = 0; n < nNewItems; n++ )
2431cdf0e10cSrcweir 		pNewData[nPos+n] = aItems.getConstArray()[n];
2432cdf0e10cSrcweir 
2433cdf0e10cSrcweir 	// Rest der alten Items
2434cdf0e10cSrcweir 	for ( n = nPos; n < nOldLen; n++ )
2435cdf0e10cSrcweir 		pNewData[nNewItems+n] = pOldData[n];
2436cdf0e10cSrcweir 
2437cdf0e10cSrcweir 	uno::Any aAny;
2438cdf0e10cSrcweir 	aAny <<= aNewSeq;
2439cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
2440cdf0e10cSrcweir }
2441cdf0e10cSrcweir 
removeItems(sal_Int16 nPos,sal_Int16 nCount)2442cdf0e10cSrcweir void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException)
2443cdf0e10cSrcweir {
2444cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
2445cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
2446cdf0e10cSrcweir 	aVal >>= aSeq;
2447cdf0e10cSrcweir 	sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
2448cdf0e10cSrcweir 	if ( nOldLen && ( nPos < nOldLen ) )
2449cdf0e10cSrcweir 	{
2450cdf0e10cSrcweir 		if ( nCount > ( nOldLen-nPos ) )
2451cdf0e10cSrcweir 			nCount = nOldLen-nPos;
2452cdf0e10cSrcweir 
2453cdf0e10cSrcweir 		sal_uInt16 nNewLen = nOldLen - nCount;
2454cdf0e10cSrcweir 
2455cdf0e10cSrcweir 		uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
2456cdf0e10cSrcweir 		::rtl::OUString* pNewData = aNewSeq.getArray();
2457cdf0e10cSrcweir 		::rtl::OUString* pOldData = aSeq.getArray();
2458cdf0e10cSrcweir 
2459cdf0e10cSrcweir 		sal_uInt16 n;
2460cdf0e10cSrcweir 		// Items vor der Entfern-Position
2461cdf0e10cSrcweir 		for ( n = 0; n < nPos; n++ )
2462cdf0e10cSrcweir 			pNewData[n] = pOldData[n];
2463cdf0e10cSrcweir 
2464cdf0e10cSrcweir 		// Rest der Items
2465cdf0e10cSrcweir 		for ( n = nPos; n < (nOldLen-nCount); n++ )
2466cdf0e10cSrcweir 			pNewData[n] = pOldData[n+nCount];
2467cdf0e10cSrcweir 
2468cdf0e10cSrcweir 		uno::Any aAny;
2469cdf0e10cSrcweir 		aAny <<= aNewSeq;
2470cdf0e10cSrcweir 		ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
2471cdf0e10cSrcweir 	}
2472cdf0e10cSrcweir }
2473cdf0e10cSrcweir 
getItemCount()2474cdf0e10cSrcweir sal_Int16 UnoListBoxControl::getItemCount() throw(uno::RuntimeException)
2475cdf0e10cSrcweir {
2476cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
2477cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
2478cdf0e10cSrcweir 	aVal >>= aSeq;
2479cdf0e10cSrcweir 	return (sal_Int16)aSeq.getLength();
2480cdf0e10cSrcweir }
2481cdf0e10cSrcweir 
getItem(sal_Int16 nPos)2482cdf0e10cSrcweir ::rtl::OUString UnoListBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException)
2483cdf0e10cSrcweir {
2484cdf0e10cSrcweir 	::rtl::OUString aItem;
2485cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
2486cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
2487cdf0e10cSrcweir 	aVal >>= aSeq;
2488cdf0e10cSrcweir 	if ( nPos < aSeq.getLength() )
2489cdf0e10cSrcweir 		aItem = aSeq.getConstArray()[nPos];
2490cdf0e10cSrcweir 	return aItem;
2491cdf0e10cSrcweir }
2492cdf0e10cSrcweir 
getItems()2493cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> UnoListBoxControl::getItems() throw(uno::RuntimeException)
2494cdf0e10cSrcweir {
2495cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
2496cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
2497cdf0e10cSrcweir 	aVal >>= aSeq;
2498cdf0e10cSrcweir 	return aSeq;
2499cdf0e10cSrcweir }
2500cdf0e10cSrcweir 
getSelectedItemPos()2501cdf0e10cSrcweir sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(uno::RuntimeException)
2502cdf0e10cSrcweir {
2503cdf0e10cSrcweir 	sal_Int16 n = -1;
2504cdf0e10cSrcweir 	if ( getPeer().is() )
2505cdf0e10cSrcweir 	{
2506cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2507cdf0e10cSrcweir 		n = xListBox->getSelectedItemPos();
2508cdf0e10cSrcweir 	}
2509cdf0e10cSrcweir 	return n;
2510cdf0e10cSrcweir }
2511cdf0e10cSrcweir 
getSelectedItemsPos()2512cdf0e10cSrcweir uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(uno::RuntimeException)
2513cdf0e10cSrcweir {
2514cdf0e10cSrcweir 	uno::Sequence<sal_Int16> aSeq;
2515cdf0e10cSrcweir 	if ( getPeer().is() )
2516cdf0e10cSrcweir 	{
2517cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2518cdf0e10cSrcweir 		aSeq = xListBox->getSelectedItemsPos();
2519cdf0e10cSrcweir 	}
2520cdf0e10cSrcweir 	return aSeq;
2521cdf0e10cSrcweir }
2522cdf0e10cSrcweir 
getSelectedItem()2523cdf0e10cSrcweir ::rtl::OUString UnoListBoxControl::getSelectedItem() throw(uno::RuntimeException)
2524cdf0e10cSrcweir {
2525cdf0e10cSrcweir 	::rtl::OUString aItem;
2526cdf0e10cSrcweir 	if ( getPeer().is() )
2527cdf0e10cSrcweir 	{
2528cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2529cdf0e10cSrcweir 		aItem = xListBox->getSelectedItem();
2530cdf0e10cSrcweir 	}
2531cdf0e10cSrcweir 	return aItem;
2532cdf0e10cSrcweir }
2533cdf0e10cSrcweir 
getSelectedItems()2534cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> UnoListBoxControl::getSelectedItems() throw(uno::RuntimeException)
2535cdf0e10cSrcweir {
2536cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
2537cdf0e10cSrcweir 	if ( getPeer().is() )
2538cdf0e10cSrcweir 	{
2539cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2540cdf0e10cSrcweir 		aSeq = xListBox->getSelectedItems();
2541cdf0e10cSrcweir 	}
2542cdf0e10cSrcweir 	return aSeq;
2543cdf0e10cSrcweir }
2544cdf0e10cSrcweir 
selectItemPos(sal_Int16 nPos,sal_Bool bSelect)2545cdf0e10cSrcweir void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(uno::RuntimeException)
2546cdf0e10cSrcweir {
2547cdf0e10cSrcweir 	if ( getPeer().is() )
2548cdf0e10cSrcweir 	{
2549cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2550cdf0e10cSrcweir 		xListBox->selectItemPos( nPos, bSelect );
2551cdf0e10cSrcweir 	}
2552cdf0e10cSrcweir 	ImplUpdateSelectedItemsProperty();
2553cdf0e10cSrcweir }
2554cdf0e10cSrcweir 
selectItemsPos(const uno::Sequence<sal_Int16> & aPositions,sal_Bool bSelect)2555cdf0e10cSrcweir void UnoListBoxControl::selectItemsPos( const uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(uno::RuntimeException)
2556cdf0e10cSrcweir {
2557cdf0e10cSrcweir 	if ( getPeer().is() )
2558cdf0e10cSrcweir 	{
2559cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2560cdf0e10cSrcweir 		xListBox->selectItemsPos( aPositions, bSelect );
2561cdf0e10cSrcweir 	}
2562cdf0e10cSrcweir 	ImplUpdateSelectedItemsProperty();
2563cdf0e10cSrcweir }
2564cdf0e10cSrcweir 
selectItem(const::rtl::OUString & aItem,sal_Bool bSelect)2565cdf0e10cSrcweir void UnoListBoxControl::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(uno::RuntimeException)
2566cdf0e10cSrcweir {
2567cdf0e10cSrcweir 	if ( getPeer().is() )
2568cdf0e10cSrcweir 	{
2569cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2570cdf0e10cSrcweir 		xListBox->selectItem( aItem, bSelect );
2571cdf0e10cSrcweir 	}
2572cdf0e10cSrcweir 	ImplUpdateSelectedItemsProperty();
2573cdf0e10cSrcweir }
2574cdf0e10cSrcweir 
makeVisible(sal_Int16 nEntry)2575cdf0e10cSrcweir void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) throw(uno::RuntimeException)
2576cdf0e10cSrcweir {
2577cdf0e10cSrcweir 	if ( getPeer().is() )
2578cdf0e10cSrcweir 	{
2579cdf0e10cSrcweir 		uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
2580cdf0e10cSrcweir 		xListBox->makeVisible( nEntry );
2581cdf0e10cSrcweir 	}
2582cdf0e10cSrcweir }
2583cdf0e10cSrcweir 
setDropDownLineCount(sal_Int16 nLines)2584cdf0e10cSrcweir void UnoListBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException)
2585cdf0e10cSrcweir {
2586cdf0e10cSrcweir 	uno::Any aAny;
2587cdf0e10cSrcweir 	aAny <<= (sal_Int16)nLines;
2588cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
2589cdf0e10cSrcweir }
2590cdf0e10cSrcweir 
getDropDownLineCount()2591cdf0e10cSrcweir sal_Int16 UnoListBoxControl::getDropDownLineCount() throw(uno::RuntimeException)
2592cdf0e10cSrcweir {
2593cdf0e10cSrcweir 	return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
2594cdf0e10cSrcweir }
2595cdf0e10cSrcweir 
isMutipleMode()2596cdf0e10cSrcweir sal_Bool UnoListBoxControl::isMutipleMode() throw(uno::RuntimeException)
2597cdf0e10cSrcweir {
2598cdf0e10cSrcweir 	return ImplGetPropertyValue_BOOL( BASEPROPERTY_MULTISELECTION );
2599cdf0e10cSrcweir }
2600cdf0e10cSrcweir 
setMultipleMode(sal_Bool bMulti)2601cdf0e10cSrcweir void UnoListBoxControl::setMultipleMode( sal_Bool bMulti ) throw(uno::RuntimeException)
2602cdf0e10cSrcweir {
2603cdf0e10cSrcweir 	uno::Any aAny;
2604cdf0e10cSrcweir 	aAny <<= bMulti;
2605cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTISELECTION ), aAny, sal_True );
2606cdf0e10cSrcweir }
2607cdf0e10cSrcweir 
itemStateChanged(const awt::ItemEvent & rEvent)2608cdf0e10cSrcweir void UnoListBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
2609cdf0e10cSrcweir {
2610cdf0e10cSrcweir     ImplUpdateSelectedItemsProperty();
2611cdf0e10cSrcweir 	if ( maItemListeners.getLength() )
2612cdf0e10cSrcweir     {
2613cdf0e10cSrcweir         try
2614cdf0e10cSrcweir         {
2615cdf0e10cSrcweir 		    maItemListeners.itemStateChanged( rEvent );
2616cdf0e10cSrcweir         }
2617cdf0e10cSrcweir         catch( const Exception& e )
2618cdf0e10cSrcweir         {
2619cdf0e10cSrcweir #if OSL_DEBUG_LEVEL == 0
2620cdf0e10cSrcweir             (void) e; // suppress warning
2621cdf0e10cSrcweir #else
2622cdf0e10cSrcweir             ::rtl::OString sMessage( "UnoListBoxControl::itemStateChanged: caught an exception:\n" );
2623cdf0e10cSrcweir             sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
2624cdf0e10cSrcweir         	OSL_ENSURE( sal_False, sMessage.getStr() );
2625cdf0e10cSrcweir #endif
2626cdf0e10cSrcweir         }
2627cdf0e10cSrcweir     }
2628cdf0e10cSrcweir }
2629cdf0e10cSrcweir 
getMinimumSize()2630cdf0e10cSrcweir awt::Size UnoListBoxControl::getMinimumSize(  ) throw(uno::RuntimeException)
2631cdf0e10cSrcweir {
2632cdf0e10cSrcweir 	return Impl_getMinimumSize();
2633cdf0e10cSrcweir }
2634cdf0e10cSrcweir 
getPreferredSize()2635cdf0e10cSrcweir awt::Size UnoListBoxControl::getPreferredSize(  ) throw(uno::RuntimeException)
2636cdf0e10cSrcweir {
2637cdf0e10cSrcweir 	return Impl_getPreferredSize();
2638cdf0e10cSrcweir }
2639cdf0e10cSrcweir 
calcAdjustedSize(const awt::Size & rNewSize)2640cdf0e10cSrcweir awt::Size UnoListBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
2641cdf0e10cSrcweir {
2642cdf0e10cSrcweir 	return Impl_calcAdjustedSize( rNewSize );
2643cdf0e10cSrcweir }
2644cdf0e10cSrcweir 
getMinimumSize(sal_Int16 nCols,sal_Int16 nLines)2645cdf0e10cSrcweir awt::Size UnoListBoxControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException)
2646cdf0e10cSrcweir {
2647cdf0e10cSrcweir 	return Impl_getMinimumSize( nCols, nLines );
2648cdf0e10cSrcweir }
2649cdf0e10cSrcweir 
getColumnsAndLines(sal_Int16 & nCols,sal_Int16 & nLines)2650cdf0e10cSrcweir void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException)
2651cdf0e10cSrcweir {
2652cdf0e10cSrcweir 	Impl_getColumnsAndLines( nCols, nLines );
2653cdf0e10cSrcweir }
2654cdf0e10cSrcweir 
setModel(const uno::Reference<awt::XControlModel> & i_rModel)2655cdf0e10cSrcweir sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
2656cdf0e10cSrcweir {
2657cdf0e10cSrcweir 	::osl::MutexGuard aGuard( GetMutex() );
2658cdf0e10cSrcweir 
2659cdf0e10cSrcweir     const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
2660cdf0e10cSrcweir     OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" );
2661cdf0e10cSrcweir     const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
2662cdf0e10cSrcweir     OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" );
2663cdf0e10cSrcweir 
2664cdf0e10cSrcweir     if ( !UnoListBoxControl_Base::setModel( i_rModel ) )
2665cdf0e10cSrcweir         return sal_False;
2666cdf0e10cSrcweir 
2667cdf0e10cSrcweir     if ( xOldItems.is() )
2668cdf0e10cSrcweir         xOldItems->removeItemListListener( this );
2669cdf0e10cSrcweir     if ( xNewItems.is() )
2670cdf0e10cSrcweir         xNewItems->addItemListListener( this );
2671cdf0e10cSrcweir 
2672cdf0e10cSrcweir     return sal_True;
2673cdf0e10cSrcweir }
2674cdf0e10cSrcweir 
listItemInserted(const awt::ItemListEvent & i_rEvent)2675cdf0e10cSrcweir void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
2676cdf0e10cSrcweir {
2677cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2678cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" );
2679cdf0e10cSrcweir     if ( xPeerListener.is() )
2680cdf0e10cSrcweir         xPeerListener->listItemInserted( i_rEvent );
2681cdf0e10cSrcweir }
2682cdf0e10cSrcweir 
listItemRemoved(const awt::ItemListEvent & i_rEvent)2683cdf0e10cSrcweir void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
2684cdf0e10cSrcweir {
2685cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2686cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" );
2687cdf0e10cSrcweir     if ( xPeerListener.is() )
2688cdf0e10cSrcweir         xPeerListener->listItemRemoved( i_rEvent );
2689cdf0e10cSrcweir }
2690cdf0e10cSrcweir 
listItemModified(const awt::ItemListEvent & i_rEvent)2691cdf0e10cSrcweir void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
2692cdf0e10cSrcweir {
2693cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2694cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" );
2695cdf0e10cSrcweir     if ( xPeerListener.is() )
2696cdf0e10cSrcweir         xPeerListener->listItemModified( i_rEvent );
2697cdf0e10cSrcweir }
2698cdf0e10cSrcweir 
allItemsRemoved(const lang::EventObject & i_rEvent)2699cdf0e10cSrcweir void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
2700cdf0e10cSrcweir {
2701cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2702cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" );
2703cdf0e10cSrcweir     if ( xPeerListener.is() )
2704cdf0e10cSrcweir         xPeerListener->allItemsRemoved( i_rEvent );
2705cdf0e10cSrcweir }
2706cdf0e10cSrcweir 
itemListChanged(const lang::EventObject & i_rEvent)2707cdf0e10cSrcweir void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
2708cdf0e10cSrcweir {
2709cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2710cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" );
2711cdf0e10cSrcweir     if ( xPeerListener.is() )
2712cdf0e10cSrcweir         xPeerListener->itemListChanged( i_rEvent );
2713cdf0e10cSrcweir }
getActionListeners()2714cdf0e10cSrcweir ActionListenerMultiplexer& 	UnoListBoxControl::getActionListeners()
2715cdf0e10cSrcweir {
2716cdf0e10cSrcweir     return maActionListeners;
2717cdf0e10cSrcweir }
getItemListeners()2718cdf0e10cSrcweir ItemListenerMultiplexer& 	UnoListBoxControl::getItemListeners()
2719cdf0e10cSrcweir {
2720cdf0e10cSrcweir     return maItemListeners;
2721cdf0e10cSrcweir }
2722cdf0e10cSrcweir //	----------------------------------------------------
2723cdf0e10cSrcweir //	class UnoControlComboBoxModel
2724cdf0e10cSrcweir //	----------------------------------------------------
UnoControlComboBoxModel(const Reference<XMultiServiceFactory> & i_factory)2725cdf0e10cSrcweir UnoControlComboBoxModel::UnoControlComboBoxModel( const Reference< XMultiServiceFactory >& i_factory )
2726cdf0e10cSrcweir     :UnoControlListBoxModel( i_factory, ConstructWithoutProperties )
2727cdf0e10cSrcweir {
2728cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXComboBox );
2729cdf0e10cSrcweir }
2730cdf0e10cSrcweir 
IMPL_SERVICEINFO_DERIVED(UnoControlComboBoxModel,UnoControlModel,szServiceName2_UnoControlComboBoxModel)2731cdf0e10cSrcweir IMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel )
2732cdf0e10cSrcweir 
2733cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
2734cdf0e10cSrcweir {
2735cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
2736cdf0e10cSrcweir 	return xInfo;
2737cdf0e10cSrcweir }
2738cdf0e10cSrcweir // ---------------------------------------------------------------------------------------------------------------------
getInfoHelper()2739cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper()
2740cdf0e10cSrcweir {
2741cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
2742cdf0e10cSrcweir 	if ( !pHelper )
2743cdf0e10cSrcweir 	{
2744cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
2745cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
2746cdf0e10cSrcweir 	}
2747cdf0e10cSrcweir 	return *pHelper;
2748cdf0e10cSrcweir }
2749cdf0e10cSrcweir 
2750cdf0e10cSrcweir 
getServiceName()2751cdf0e10cSrcweir ::rtl::OUString UnoControlComboBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
2752cdf0e10cSrcweir {
2753cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel );
2754cdf0e10cSrcweir }
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const uno::Any & rValue)2755cdf0e10cSrcweir void SAL_CALL UnoControlComboBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
2756cdf0e10cSrcweir {
2757cdf0e10cSrcweir     UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
2758cdf0e10cSrcweir 
2759cdf0e10cSrcweir     if ( nHandle == BASEPROPERTY_STRINGITEMLIST && !m_pData->m_bSettingLegacyProperty)
2760cdf0e10cSrcweir 	{
2761cdf0e10cSrcweir         // synchronize the legacy StringItemList property with our list items
2762cdf0e10cSrcweir         Sequence< ::rtl::OUString > aStringItemList;
2763cdf0e10cSrcweir         Any aPropValue;
2764cdf0e10cSrcweir         getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
2765cdf0e10cSrcweir         OSL_VERIFY( aPropValue >>= aStringItemList );
2766cdf0e10cSrcweir 
2767cdf0e10cSrcweir         ::std::vector< ListItem > aItems( aStringItemList.getLength() );
2768cdf0e10cSrcweir         ::std::transform(
2769cdf0e10cSrcweir             aStringItemList.getConstArray(),
2770cdf0e10cSrcweir             aStringItemList.getConstArray() + aStringItemList.getLength(),
2771cdf0e10cSrcweir             aItems.begin(),
2772cdf0e10cSrcweir             CreateListItem()
2773cdf0e10cSrcweir         );
2774cdf0e10cSrcweir         m_pData->setAllItems( aItems );
2775cdf0e10cSrcweir 
2776cdf0e10cSrcweir         // since an XItemListListener does not have a "all items modified" or some such method,
2777cdf0e10cSrcweir         // we simulate this by notifying removal of all items, followed by insertion of all new
2778cdf0e10cSrcweir         // items
2779cdf0e10cSrcweir         lang::EventObject aEvent;
2780cdf0e10cSrcweir         aEvent.Source = *this;
2781cdf0e10cSrcweir         m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
2782cdf0e10cSrcweir         // TODO: OPropertySetHelper calls into this method with the mutex locked ...
2783cdf0e10cSrcweir         // which is wrong for the above notifications ...
2784cdf0e10cSrcweir 	}
2785cdf0e10cSrcweir }
2786cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const2787cdf0e10cSrcweir uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
2788cdf0e10cSrcweir {
2789cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
2790cdf0e10cSrcweir 	{
2791cdf0e10cSrcweir 		uno::Any aAny;
2792cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox );
2793cdf0e10cSrcweir 		return aAny;
2794cdf0e10cSrcweir 	}
2795cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
2796cdf0e10cSrcweir }
2797cdf0e10cSrcweir 
2798cdf0e10cSrcweir //	----------------------------------------------------
2799cdf0e10cSrcweir //	class UnoComboBoxControl
2800cdf0e10cSrcweir //	----------------------------------------------------
UnoComboBoxControl(const Reference<XMultiServiceFactory> & i_factory)2801cdf0e10cSrcweir UnoComboBoxControl::UnoComboBoxControl( const Reference< XMultiServiceFactory >& i_factory )
2802cdf0e10cSrcweir 	:UnoEditControl( i_factory )
2803cdf0e10cSrcweir 	,maActionListeners( *this )
2804cdf0e10cSrcweir     ,maItemListeners( *this )
2805cdf0e10cSrcweir {
2806cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;
2807cdf0e10cSrcweir 	maComponentInfos.nHeight = 12;
2808cdf0e10cSrcweir }
IMPL_SERVICEINFO_DERIVED(UnoComboBoxControl,UnoEditControl,szServiceName2_UnoControlComboBox)2809cdf0e10cSrcweir IMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox )
2810cdf0e10cSrcweir 
2811cdf0e10cSrcweir ::rtl::OUString UnoComboBoxControl::GetComponentServiceName()
2812cdf0e10cSrcweir {
2813cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "combobox" );
2814cdf0e10cSrcweir }
2815cdf0e10cSrcweir 
dispose()2816cdf0e10cSrcweir void UnoComboBoxControl::dispose() throw(uno::RuntimeException)
2817cdf0e10cSrcweir {
2818cdf0e10cSrcweir 	lang::EventObject aEvt;
2819cdf0e10cSrcweir 	aEvt.Source = (::cppu::OWeakObject*)this;
2820cdf0e10cSrcweir 	maActionListeners.disposeAndClear( aEvt );
2821cdf0e10cSrcweir 	maItemListeners.disposeAndClear( aEvt );
2822cdf0e10cSrcweir 	UnoControl::dispose();
2823cdf0e10cSrcweir }
queryAggregation(const uno::Type & rType)2824cdf0e10cSrcweir uno::Any UnoComboBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
2825cdf0e10cSrcweir {
2826cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
2827cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XComboBox*, this ) );
2828cdf0e10cSrcweir     if ( !aRet.hasValue() )
2829cdf0e10cSrcweir     {
2830cdf0e10cSrcweir         aRet = ::cppu::queryInterface( rType,
2831cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XItemListener*, this ) );
2832cdf0e10cSrcweir         if ( !aRet.hasValue() )
2833cdf0e10cSrcweir         {
2834cdf0e10cSrcweir             aRet = ::cppu::queryInterface( rType,
2835cdf0e10cSrcweir 										    SAL_STATIC_CAST( awt::XItemListListener*, this ) );
2836cdf0e10cSrcweir         }
2837cdf0e10cSrcweir     }
2838cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
2839cdf0e10cSrcweir }
2840cdf0e10cSrcweir // lang::XTypeProvider
2841cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoComboBoxControl )
2842cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XComboBox>* ) NULL ),
2843cdf0e10cSrcweir     getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ),
2844cdf0e10cSrcweir     getCppuType( ( uno::Reference< awt::XItemListListener>* ) NULL ),
2845cdf0e10cSrcweir 	UnoEditControl::getTypes()
2846cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
2847cdf0e10cSrcweir 
2848cdf0e10cSrcweir void UnoComboBoxControl::updateFromModel()
2849cdf0e10cSrcweir {
2850cdf0e10cSrcweir     UnoEditControl::updateFromModel();
2851cdf0e10cSrcweir 
2852cdf0e10cSrcweir     Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
2853cdf0e10cSrcweir     ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoComboBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
2854cdf0e10cSrcweir 
2855cdf0e10cSrcweir     EventObject aEvent( getModel() );
2856cdf0e10cSrcweir     xItemListListener->itemListChanged( aEvent );
2857cdf0e10cSrcweir }
ImplSetPeerProperty(const::rtl::OUString & rPropName,const uno::Any & rVal)2858cdf0e10cSrcweir void UnoComboBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
2859cdf0e10cSrcweir {
2860cdf0e10cSrcweir     if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
2861cdf0e10cSrcweir         // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
2862cdf0e10cSrcweir         // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
2863cdf0e10cSrcweir         // will be forwarded to the peer, which will update itself accordingly.
2864cdf0e10cSrcweir         return;
2865cdf0e10cSrcweir 
2866cdf0e10cSrcweir 	UnoEditControl::ImplSetPeerProperty( rPropName, rVal );
2867cdf0e10cSrcweir }
createPeer(const uno::Reference<awt::XToolkit> & rxToolkit,const uno::Reference<awt::XWindowPeer> & rParentPeer)2868cdf0e10cSrcweir void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
2869cdf0e10cSrcweir {
2870cdf0e10cSrcweir 	UnoEditControl::createPeer( rxToolkit, rParentPeer );
2871cdf0e10cSrcweir 
2872cdf0e10cSrcweir 	uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
2873cdf0e10cSrcweir 	if ( maActionListeners.getLength() )
2874cdf0e10cSrcweir 		xComboBox->addActionListener( &maActionListeners );
2875cdf0e10cSrcweir 	if ( maItemListeners.getLength() )
2876cdf0e10cSrcweir 		xComboBox->addItemListener( &maItemListeners );
2877cdf0e10cSrcweir }
2878cdf0e10cSrcweir 
addActionListener(const uno::Reference<awt::XActionListener> & l)2879cdf0e10cSrcweir void UnoComboBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
2880cdf0e10cSrcweir {
2881cdf0e10cSrcweir 	maActionListeners.addInterface( l );
2882cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
2883cdf0e10cSrcweir 	{
2884cdf0e10cSrcweir 		uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
2885cdf0e10cSrcweir 		xComboBox->addActionListener( &maActionListeners );
2886cdf0e10cSrcweir 	}
2887cdf0e10cSrcweir }
2888cdf0e10cSrcweir 
removeActionListener(const uno::Reference<awt::XActionListener> & l)2889cdf0e10cSrcweir void UnoComboBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
2890cdf0e10cSrcweir {
2891cdf0e10cSrcweir 	if( getPeer().is() && maActionListeners.getLength() == 1 )
2892cdf0e10cSrcweir 	{
2893cdf0e10cSrcweir 		uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
2894cdf0e10cSrcweir 		xComboBox->removeActionListener( &maActionListeners );
2895cdf0e10cSrcweir 	}
2896cdf0e10cSrcweir 	maActionListeners.removeInterface( l );
2897cdf0e10cSrcweir }
2898cdf0e10cSrcweir 
addItemListener(const uno::Reference<awt::XItemListener> & l)2899cdf0e10cSrcweir void UnoComboBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
2900cdf0e10cSrcweir {
2901cdf0e10cSrcweir 	maItemListeners.addInterface( l );
2902cdf0e10cSrcweir 	if( getPeer().is() && maItemListeners.getLength() == 1 )
2903cdf0e10cSrcweir 	{
2904cdf0e10cSrcweir 		uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
2905cdf0e10cSrcweir 		xComboBox->addItemListener( &maItemListeners );
2906cdf0e10cSrcweir 	}
2907cdf0e10cSrcweir }
2908cdf0e10cSrcweir 
removeItemListener(const uno::Reference<awt::XItemListener> & l)2909cdf0e10cSrcweir void UnoComboBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
2910cdf0e10cSrcweir {
2911cdf0e10cSrcweir 	if( getPeer().is() && maItemListeners.getLength() == 1 )
2912cdf0e10cSrcweir 	{
2913cdf0e10cSrcweir 		uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );	// MT: Mal alles so umstellen, schoener als Ref anlegen und query rufen
2914cdf0e10cSrcweir 		xComboBox->removeItemListener( &maItemListeners );
2915cdf0e10cSrcweir 	}
2916cdf0e10cSrcweir 	maItemListeners.removeInterface( l );
2917cdf0e10cSrcweir }
itemStateChanged(const awt::ItemEvent & rEvent)2918cdf0e10cSrcweir void UnoComboBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
2919cdf0e10cSrcweir {
2920cdf0e10cSrcweir 	if ( maItemListeners.getLength() )
2921cdf0e10cSrcweir     {
2922cdf0e10cSrcweir         try
2923cdf0e10cSrcweir         {
2924cdf0e10cSrcweir 		    maItemListeners.itemStateChanged( rEvent );
2925cdf0e10cSrcweir         }
2926cdf0e10cSrcweir         catch( const Exception& e )
2927cdf0e10cSrcweir         {
2928cdf0e10cSrcweir #if OSL_DEBUG_LEVEL == 0
2929cdf0e10cSrcweir             (void) e; // suppress warning
2930cdf0e10cSrcweir #else
2931cdf0e10cSrcweir             ::rtl::OString sMessage( "UnoComboBoxControl::itemStateChanged: caught an exception:\n" );
2932cdf0e10cSrcweir             sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
2933cdf0e10cSrcweir         	OSL_ENSURE( sal_False, sMessage.getStr() );
2934cdf0e10cSrcweir #endif
2935cdf0e10cSrcweir         }
2936cdf0e10cSrcweir     }
2937cdf0e10cSrcweir }
setModel(const uno::Reference<awt::XControlModel> & i_rModel)2938cdf0e10cSrcweir sal_Bool SAL_CALL UnoComboBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
2939cdf0e10cSrcweir {
2940cdf0e10cSrcweir 	::osl::MutexGuard aGuard( GetMutex() );
2941cdf0e10cSrcweir 
2942cdf0e10cSrcweir     const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
2943cdf0e10cSrcweir     OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoComboBoxControl::setModel: illegal old model!" );
2944cdf0e10cSrcweir     const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
2945cdf0e10cSrcweir     OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoComboBoxControl::setModel: illegal new model!" );
2946cdf0e10cSrcweir 
2947cdf0e10cSrcweir     if ( !UnoEditControl::setModel( i_rModel ) )
2948cdf0e10cSrcweir         return sal_False;
2949cdf0e10cSrcweir 
2950cdf0e10cSrcweir     if ( xOldItems.is() )
2951cdf0e10cSrcweir         xOldItems->removeItemListListener( this );
2952cdf0e10cSrcweir     if ( xNewItems.is() )
2953cdf0e10cSrcweir         xNewItems->addItemListListener( this );
2954cdf0e10cSrcweir 
2955cdf0e10cSrcweir     return sal_True;
2956cdf0e10cSrcweir }
2957cdf0e10cSrcweir 
listItemInserted(const awt::ItemListEvent & i_rEvent)2958cdf0e10cSrcweir void SAL_CALL UnoComboBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
2959cdf0e10cSrcweir {
2960cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2961cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemInserted: invalid peer!" );
2962cdf0e10cSrcweir     if ( xPeerListener.is() )
2963cdf0e10cSrcweir         xPeerListener->listItemInserted( i_rEvent );
2964cdf0e10cSrcweir }
2965cdf0e10cSrcweir 
listItemRemoved(const awt::ItemListEvent & i_rEvent)2966cdf0e10cSrcweir void SAL_CALL UnoComboBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
2967cdf0e10cSrcweir {
2968cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2969cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemRemoved: invalid peer!" );
2970cdf0e10cSrcweir     if ( xPeerListener.is() )
2971cdf0e10cSrcweir         xPeerListener->listItemRemoved( i_rEvent );
2972cdf0e10cSrcweir }
2973cdf0e10cSrcweir 
listItemModified(const awt::ItemListEvent & i_rEvent)2974cdf0e10cSrcweir void SAL_CALL UnoComboBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
2975cdf0e10cSrcweir {
2976cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2977cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemModified: invalid peer!" );
2978cdf0e10cSrcweir     if ( xPeerListener.is() )
2979cdf0e10cSrcweir         xPeerListener->listItemModified( i_rEvent );
2980cdf0e10cSrcweir }
2981cdf0e10cSrcweir 
allItemsRemoved(const lang::EventObject & i_rEvent)2982cdf0e10cSrcweir void SAL_CALL UnoComboBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
2983cdf0e10cSrcweir {
2984cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2985cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::allItemsRemoved: invalid peer!" );
2986cdf0e10cSrcweir     if ( xPeerListener.is() )
2987cdf0e10cSrcweir         xPeerListener->allItemsRemoved( i_rEvent );
2988cdf0e10cSrcweir }
2989cdf0e10cSrcweir 
itemListChanged(const lang::EventObject & i_rEvent)2990cdf0e10cSrcweir void SAL_CALL UnoComboBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
2991cdf0e10cSrcweir {
2992cdf0e10cSrcweir     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
2993cdf0e10cSrcweir     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::itemListChanged: invalid peer!" );
2994cdf0e10cSrcweir     if ( xPeerListener.is() )
2995cdf0e10cSrcweir         xPeerListener->itemListChanged( i_rEvent );
2996cdf0e10cSrcweir }
getActionListeners()2997cdf0e10cSrcweir ActionListenerMultiplexer& 	UnoComboBoxControl::getActionListeners()
2998cdf0e10cSrcweir {
2999cdf0e10cSrcweir     return maActionListeners;
3000cdf0e10cSrcweir }
getItemListeners()3001cdf0e10cSrcweir ItemListenerMultiplexer& 	UnoComboBoxControl::getItemListeners()
3002cdf0e10cSrcweir {
3003cdf0e10cSrcweir     return maItemListeners;
3004cdf0e10cSrcweir }
3005cdf0e10cSrcweir 
addItem(const::rtl::OUString & aItem,sal_Int16 nPos)3006cdf0e10cSrcweir void UnoComboBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException)
3007cdf0e10cSrcweir {
3008cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq( 1 );
3009cdf0e10cSrcweir 	aSeq.getArray()[0] = aItem;
3010cdf0e10cSrcweir 	addItems( aSeq, nPos );
3011cdf0e10cSrcweir }
3012cdf0e10cSrcweir 
addItems(const uno::Sequence<::rtl::OUString> & aItems,sal_Int16 nPos)3013cdf0e10cSrcweir void UnoComboBoxControl::addItems( const uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException)
3014cdf0e10cSrcweir {
3015cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
3016cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
3017cdf0e10cSrcweir 	aVal >>= aSeq;
3018cdf0e10cSrcweir 	sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
3019cdf0e10cSrcweir 	sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
3020cdf0e10cSrcweir 	sal_uInt16 nNewLen = nOldLen + nNewItems;
3021cdf0e10cSrcweir 
3022cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
3023cdf0e10cSrcweir 	::rtl::OUString* pNewData = aNewSeq.getArray();
3024cdf0e10cSrcweir 	const ::rtl::OUString* pOldData = aSeq.getConstArray();
3025cdf0e10cSrcweir 
3026cdf0e10cSrcweir 	if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
3027cdf0e10cSrcweir 		nPos = (sal_uInt16) nOldLen;
3028cdf0e10cSrcweir 
3029cdf0e10cSrcweir 	sal_uInt16 n;
3030cdf0e10cSrcweir 	// Items vor der Einfuege-Position
3031cdf0e10cSrcweir 	for ( n = 0; n < nPos; n++ )
3032cdf0e10cSrcweir 		pNewData[n] = pOldData[n];
3033cdf0e10cSrcweir 
3034cdf0e10cSrcweir 	// Neue Items
3035cdf0e10cSrcweir 	for ( n = 0; n < nNewItems; n++ )
3036cdf0e10cSrcweir 		pNewData[nPos+n] = aItems.getConstArray()[n];
3037cdf0e10cSrcweir 
3038cdf0e10cSrcweir 	// Rest der alten Items
3039cdf0e10cSrcweir 	for ( n = nPos; n < nOldLen; n++ )
3040cdf0e10cSrcweir 		pNewData[nNewItems+n] = pOldData[n];
3041cdf0e10cSrcweir 
3042cdf0e10cSrcweir 	uno::Any aAny;
3043cdf0e10cSrcweir 	aAny <<= aNewSeq;
3044cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
3045cdf0e10cSrcweir }
3046cdf0e10cSrcweir 
removeItems(sal_Int16 nPos,sal_Int16 nCount)3047cdf0e10cSrcweir void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException)
3048cdf0e10cSrcweir {
3049cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
3050cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
3051cdf0e10cSrcweir 	aVal >>= aSeq;
3052cdf0e10cSrcweir 	sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
3053cdf0e10cSrcweir 	if ( nOldLen && ( nPos < nOldLen ) )
3054cdf0e10cSrcweir 	{
3055cdf0e10cSrcweir 		if ( nCount > ( nOldLen-nPos ) )
3056cdf0e10cSrcweir 			nCount = nOldLen-nPos;
3057cdf0e10cSrcweir 
3058cdf0e10cSrcweir 		sal_uInt16 nNewLen = nOldLen - nCount;
3059cdf0e10cSrcweir 
3060cdf0e10cSrcweir 		uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
3061cdf0e10cSrcweir 		::rtl::OUString* pNewData = aNewSeq.getArray();
3062cdf0e10cSrcweir 		::rtl::OUString* pOldData = aSeq.getArray();
3063cdf0e10cSrcweir 
3064cdf0e10cSrcweir 		sal_uInt16 n;
3065cdf0e10cSrcweir 		// Items vor der Entfern-Position
3066cdf0e10cSrcweir 		for ( n = 0; n < nPos; n++ )
3067cdf0e10cSrcweir 			pNewData[n] = pOldData[n];
3068cdf0e10cSrcweir 
3069cdf0e10cSrcweir 		// Rest der Items
3070cdf0e10cSrcweir 		for ( n = nPos; n < (nOldLen-nCount); n++ )
3071cdf0e10cSrcweir 			pNewData[n] = pOldData[n+nCount];
3072cdf0e10cSrcweir 
3073cdf0e10cSrcweir 		uno::Any aAny;
3074cdf0e10cSrcweir 		aAny <<= aNewSeq;
3075cdf0e10cSrcweir 		ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
3076cdf0e10cSrcweir 	}
3077cdf0e10cSrcweir }
3078cdf0e10cSrcweir 
getItemCount()3079cdf0e10cSrcweir sal_Int16 UnoComboBoxControl::getItemCount() throw(uno::RuntimeException)
3080cdf0e10cSrcweir {
3081cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
3082cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
3083cdf0e10cSrcweir 	aVal >>= aSeq;
3084cdf0e10cSrcweir 	return (sal_Int16)aSeq.getLength();
3085cdf0e10cSrcweir }
3086cdf0e10cSrcweir 
getItem(sal_Int16 nPos)3087cdf0e10cSrcweir ::rtl::OUString UnoComboBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException)
3088cdf0e10cSrcweir {
3089cdf0e10cSrcweir 	::rtl::OUString aItem;
3090cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
3091cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
3092cdf0e10cSrcweir 	aVal >>= aSeq;
3093cdf0e10cSrcweir 	if ( nPos < aSeq.getLength() )
3094cdf0e10cSrcweir 		aItem = aSeq.getConstArray()[nPos];
3095cdf0e10cSrcweir 	return aItem;
3096cdf0e10cSrcweir }
3097cdf0e10cSrcweir 
getItems()3098cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> UnoComboBoxControl::getItems() throw(uno::RuntimeException)
3099cdf0e10cSrcweir {
3100cdf0e10cSrcweir 	uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
3101cdf0e10cSrcweir 	uno::Sequence< ::rtl::OUString> aSeq;
3102cdf0e10cSrcweir 	aVal >>= aSeq;
3103cdf0e10cSrcweir 	return aSeq;
3104cdf0e10cSrcweir }
3105cdf0e10cSrcweir 
setDropDownLineCount(sal_Int16 nLines)3106cdf0e10cSrcweir void UnoComboBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException)
3107cdf0e10cSrcweir {
3108cdf0e10cSrcweir 	uno::Any aAny;
3109cdf0e10cSrcweir 	aAny <<= nLines;
3110cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
3111cdf0e10cSrcweir }
3112cdf0e10cSrcweir 
getDropDownLineCount()3113cdf0e10cSrcweir sal_Int16 UnoComboBoxControl::getDropDownLineCount() throw(uno::RuntimeException)
3114cdf0e10cSrcweir {
3115cdf0e10cSrcweir 	return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
3116cdf0e10cSrcweir }
3117cdf0e10cSrcweir 
3118cdf0e10cSrcweir 
3119cdf0e10cSrcweir //	----------------------------------------------------
3120cdf0e10cSrcweir //	UnoSpinFieldControl
3121cdf0e10cSrcweir //	----------------------------------------------------
UnoSpinFieldControl(const Reference<XMultiServiceFactory> & i_factory)3122cdf0e10cSrcweir UnoSpinFieldControl::UnoSpinFieldControl( const Reference< XMultiServiceFactory >& i_factory )
3123cdf0e10cSrcweir 	:UnoEditControl( i_factory )
3124cdf0e10cSrcweir     ,maSpinListeners( *this )
3125cdf0e10cSrcweir {
3126cdf0e10cSrcweir     mbRepeat = sal_False;
3127cdf0e10cSrcweir }
3128cdf0e10cSrcweir 
3129cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)3130cdf0e10cSrcweir uno::Any UnoSpinFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
3131cdf0e10cSrcweir {
3132cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
3133cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XSpinField*, this ) );
3134cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
3135cdf0e10cSrcweir }
3136cdf0e10cSrcweir 
3137cdf0e10cSrcweir // lang::XTypeProvider
3138cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoSpinFieldControl )
3139cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XSpinField>* ) NULL ),
3140cdf0e10cSrcweir 	UnoEditControl::getTypes()
3141cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
3142cdf0e10cSrcweir 
3143cdf0e10cSrcweir void UnoSpinFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
3144cdf0e10cSrcweir {
3145cdf0e10cSrcweir 	UnoEditControl::createPeer( rxToolkit, rParentPeer );
3146cdf0e10cSrcweir 
3147cdf0e10cSrcweir     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3148cdf0e10cSrcweir     xField->enableRepeat( mbRepeat );
3149cdf0e10cSrcweir 	if ( maSpinListeners.getLength() )
3150cdf0e10cSrcweir 		xField->addSpinListener( &maSpinListeners );
3151cdf0e10cSrcweir }
3152cdf0e10cSrcweir 
3153cdf0e10cSrcweir 	// ::com::sun::star::awt::XSpinField
addSpinListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XSpinListener> & l)3154cdf0e10cSrcweir void UnoSpinFieldControl::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException)
3155cdf0e10cSrcweir {
3156cdf0e10cSrcweir 	maSpinListeners.addInterface( l );
3157cdf0e10cSrcweir 	if( getPeer().is() && maSpinListeners.getLength() == 1 )
3158cdf0e10cSrcweir 	{
3159cdf0e10cSrcweir 		uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3160cdf0e10cSrcweir 		xField->addSpinListener( &maSpinListeners );
3161cdf0e10cSrcweir 	}
3162cdf0e10cSrcweir }
3163cdf0e10cSrcweir 
removeSpinListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XSpinListener> & l)3164cdf0e10cSrcweir void UnoSpinFieldControl::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException)
3165cdf0e10cSrcweir {
3166cdf0e10cSrcweir 	if( getPeer().is() && maSpinListeners.getLength() == 1 )
3167cdf0e10cSrcweir 	{
3168cdf0e10cSrcweir 		uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3169cdf0e10cSrcweir 		xField->removeSpinListener( &maSpinListeners );
3170cdf0e10cSrcweir 	}
3171cdf0e10cSrcweir 	maSpinListeners.removeInterface( l );
3172cdf0e10cSrcweir }
3173cdf0e10cSrcweir 
up()3174cdf0e10cSrcweir void UnoSpinFieldControl::up() throw(::com::sun::star::uno::RuntimeException)
3175cdf0e10cSrcweir {
3176cdf0e10cSrcweir     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3177cdf0e10cSrcweir 	if ( xField.is() )
3178cdf0e10cSrcweir         xField->up();
3179cdf0e10cSrcweir }
3180cdf0e10cSrcweir 
down()3181cdf0e10cSrcweir void UnoSpinFieldControl::down() throw(::com::sun::star::uno::RuntimeException)
3182cdf0e10cSrcweir {
3183cdf0e10cSrcweir     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3184cdf0e10cSrcweir 	if ( xField.is() )
3185cdf0e10cSrcweir         xField->down();
3186cdf0e10cSrcweir }
3187cdf0e10cSrcweir 
first()3188cdf0e10cSrcweir void UnoSpinFieldControl::first() throw(::com::sun::star::uno::RuntimeException)
3189cdf0e10cSrcweir {
3190cdf0e10cSrcweir     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3191cdf0e10cSrcweir 	if ( xField.is() )
3192cdf0e10cSrcweir         xField->first();
3193cdf0e10cSrcweir }
3194cdf0e10cSrcweir 
last()3195cdf0e10cSrcweir void UnoSpinFieldControl::last() throw(::com::sun::star::uno::RuntimeException)
3196cdf0e10cSrcweir {
3197cdf0e10cSrcweir     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3198cdf0e10cSrcweir 	if ( xField.is() )
3199cdf0e10cSrcweir         xField->last();
3200cdf0e10cSrcweir }
3201cdf0e10cSrcweir 
enableRepeat(sal_Bool bRepeat)3202cdf0e10cSrcweir void UnoSpinFieldControl::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
3203cdf0e10cSrcweir {
3204cdf0e10cSrcweir     mbRepeat = bRepeat;
3205cdf0e10cSrcweir 
3206cdf0e10cSrcweir     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
3207cdf0e10cSrcweir 	if ( xField.is() )
3208cdf0e10cSrcweir         xField->enableRepeat( bRepeat );
3209cdf0e10cSrcweir }
3210cdf0e10cSrcweir 
3211cdf0e10cSrcweir //	----------------------------------------------------
3212cdf0e10cSrcweir //	class UnoControlDateFieldModel
3213cdf0e10cSrcweir //	----------------------------------------------------
UnoControlDateFieldModel(const Reference<XMultiServiceFactory> & i_factory)3214cdf0e10cSrcweir UnoControlDateFieldModel::UnoControlDateFieldModel( const Reference< XMultiServiceFactory >& i_factory )
3215cdf0e10cSrcweir     :UnoControlModel( i_factory )
3216cdf0e10cSrcweir {
3217cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXDateField );
3218cdf0e10cSrcweir }
3219cdf0e10cSrcweir 
getServiceName()3220cdf0e10cSrcweir ::rtl::OUString UnoControlDateFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
3221cdf0e10cSrcweir {
3222cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel );
3223cdf0e10cSrcweir }
3224cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const3225cdf0e10cSrcweir uno::Any UnoControlDateFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
3226cdf0e10cSrcweir {
3227cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
3228cdf0e10cSrcweir 	{
3229cdf0e10cSrcweir 		uno::Any aAny;
3230cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField );
3231cdf0e10cSrcweir 		return aAny;
3232cdf0e10cSrcweir 	}
3233cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
3234cdf0e10cSrcweir }
3235cdf0e10cSrcweir 
3236cdf0e10cSrcweir 
getInfoHelper()3237cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlDateFieldModel::getInfoHelper()
3238cdf0e10cSrcweir {
3239cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
3240cdf0e10cSrcweir 	if ( !pHelper )
3241cdf0e10cSrcweir 	{
3242cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
3243cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
3244cdf0e10cSrcweir 	}
3245cdf0e10cSrcweir 	return *pHelper;
3246cdf0e10cSrcweir }
3247cdf0e10cSrcweir 
3248cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()3249cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
3250cdf0e10cSrcweir {
3251cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
3252cdf0e10cSrcweir 	return xInfo;
3253cdf0e10cSrcweir }
3254cdf0e10cSrcweir 
3255cdf0e10cSrcweir 
3256cdf0e10cSrcweir 
3257cdf0e10cSrcweir //	----------------------------------------------------
3258cdf0e10cSrcweir //	class UnoDateFieldControl
3259cdf0e10cSrcweir //	----------------------------------------------------
UnoDateFieldControl(const Reference<XMultiServiceFactory> & i_factory)3260cdf0e10cSrcweir UnoDateFieldControl::UnoDateFieldControl( const Reference< XMultiServiceFactory >& i_factory )
3261cdf0e10cSrcweir     :UnoSpinFieldControl( i_factory )
3262cdf0e10cSrcweir {
3263cdf0e10cSrcweir     mnFirst = Date( 1, 1, 1900 ).GetDate();
3264cdf0e10cSrcweir     mnLast = Date( 31, 12, 2200 ).GetDate();
3265cdf0e10cSrcweir     mbLongFormat = 2;
3266cdf0e10cSrcweir }
3267cdf0e10cSrcweir 
GetComponentServiceName()3268cdf0e10cSrcweir ::rtl::OUString UnoDateFieldControl::GetComponentServiceName()
3269cdf0e10cSrcweir {
3270cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "datefield" );
3271cdf0e10cSrcweir }
3272cdf0e10cSrcweir 
3273cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)3274cdf0e10cSrcweir uno::Any UnoDateFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
3275cdf0e10cSrcweir {
3276cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
3277cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XDateField*, this ) );
3278cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
3279cdf0e10cSrcweir }
3280cdf0e10cSrcweir 
3281cdf0e10cSrcweir // lang::XTypeProvider
3282cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoDateFieldControl )
3283cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XDateField>* ) NULL ),
3284cdf0e10cSrcweir 	UnoSpinFieldControl::getTypes()
3285cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
3286cdf0e10cSrcweir 
3287cdf0e10cSrcweir void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
3288cdf0e10cSrcweir {
3289cdf0e10cSrcweir 	UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
3290cdf0e10cSrcweir 
3291cdf0e10cSrcweir 	uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
3292cdf0e10cSrcweir 	xField->setFirst( mnFirst );
3293cdf0e10cSrcweir     xField->setLast( mnLast );
3294cdf0e10cSrcweir     if ( mbLongFormat != 2 )    // not set
3295cdf0e10cSrcweir         xField->setLongFormat( mbLongFormat );
3296cdf0e10cSrcweir }
3297cdf0e10cSrcweir 
3298cdf0e10cSrcweir 
textChanged(const awt::TextEvent & e)3299cdf0e10cSrcweir void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
3300cdf0e10cSrcweir {
3301cdf0e10cSrcweir     uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
3302cdf0e10cSrcweir 
3303cdf0e10cSrcweir     // also change the text property (#i25106#)
3304cdf0e10cSrcweir     if ( xPeer.is() )
3305cdf0e10cSrcweir     {
3306cdf0e10cSrcweir         ::rtl::OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
3307cdf0e10cSrcweir         ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), sal_False );
3308cdf0e10cSrcweir     }
3309cdf0e10cSrcweir 
3310cdf0e10cSrcweir     // re-calc the Date property
3311cdf0e10cSrcweir     uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
3312cdf0e10cSrcweir 	uno::Any aValue;
3313cdf0e10cSrcweir     if ( xField->isEmpty() )
3314cdf0e10cSrcweir     {
3315cdf0e10cSrcweir         // the field says it's empty
3316cdf0e10cSrcweir         sal_Bool bEnforceFormat = sal_True;
3317cdf0e10cSrcweir         if ( xPeer.is() )
3318cdf0e10cSrcweir             xPeer->getProperty( GetPropertyName( BASEPROPERTY_ENFORCE_FORMAT ) ) >>= bEnforceFormat;
3319cdf0e10cSrcweir         if ( !bEnforceFormat )
3320cdf0e10cSrcweir         {
3321cdf0e10cSrcweir             // and it also says that it is currently accepting invalid inputs, without
3322cdf0e10cSrcweir             // forcing it to a valid date
3323cdf0e10cSrcweir             uno::Reference< awt::XTextComponent > xText( xPeer, uno::UNO_QUERY );
3324cdf0e10cSrcweir             if ( xText.is() && xText->getText().getLength() )
3325cdf0e10cSrcweir                 // and in real, the text of the peer is *not* empty
3326cdf0e10cSrcweir                 // -> simulate an invalid date, which is different from "no date"
3327cdf0e10cSrcweir                 aValue <<= util::Date( 0, 0, 0 );
3328cdf0e10cSrcweir         }
3329cdf0e10cSrcweir     }
3330cdf0e10cSrcweir     else
3331cdf0e10cSrcweir 		aValue <<= xField->getDate();
3332cdf0e10cSrcweir 
3333cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aValue, sal_False );
3334cdf0e10cSrcweir 
3335cdf0e10cSrcweir     // multiplex the event
3336cdf0e10cSrcweir     if ( GetTextListeners().getLength() )
3337cdf0e10cSrcweir 		GetTextListeners().textChanged( e );
3338cdf0e10cSrcweir }
3339cdf0e10cSrcweir 
setDate(sal_Int32 Date)3340cdf0e10cSrcweir void UnoDateFieldControl::setDate( sal_Int32 Date ) throw(uno::RuntimeException)
3341cdf0e10cSrcweir {
3342cdf0e10cSrcweir 	uno::Any aAny;
3343cdf0e10cSrcweir 	aAny <<= Date;
3344cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aAny, sal_True );
3345cdf0e10cSrcweir }
3346cdf0e10cSrcweir 
getDate()3347cdf0e10cSrcweir sal_Int32 UnoDateFieldControl::getDate() throw(uno::RuntimeException)
3348cdf0e10cSrcweir {
3349cdf0e10cSrcweir 	return ImplGetPropertyValue_INT32( BASEPROPERTY_DATE );
3350cdf0e10cSrcweir }
3351cdf0e10cSrcweir 
setMin(sal_Int32 Date)3352cdf0e10cSrcweir void UnoDateFieldControl::setMin( sal_Int32 Date ) throw(uno::RuntimeException)
3353cdf0e10cSrcweir {
3354cdf0e10cSrcweir 	uno::Any aAny;
3355cdf0e10cSrcweir 	aAny <<= Date;
3356cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), aAny, sal_True );
3357cdf0e10cSrcweir }
3358cdf0e10cSrcweir 
getMin()3359cdf0e10cSrcweir sal_Int32 UnoDateFieldControl::getMin() throw(uno::RuntimeException)
3360cdf0e10cSrcweir {
3361cdf0e10cSrcweir 	return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMIN );
3362cdf0e10cSrcweir }
3363cdf0e10cSrcweir 
setMax(sal_Int32 Date)3364cdf0e10cSrcweir void UnoDateFieldControl::setMax( sal_Int32 Date ) throw(uno::RuntimeException)
3365cdf0e10cSrcweir {
3366cdf0e10cSrcweir 	uno::Any aAny;
3367cdf0e10cSrcweir 	aAny <<= Date;
3368cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), aAny, sal_True );
3369cdf0e10cSrcweir }
3370cdf0e10cSrcweir 
getMax()3371cdf0e10cSrcweir sal_Int32 UnoDateFieldControl::getMax() throw(uno::RuntimeException)
3372cdf0e10cSrcweir {
3373cdf0e10cSrcweir 	return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMAX );
3374cdf0e10cSrcweir }
3375cdf0e10cSrcweir 
setFirst(sal_Int32 Date)3376cdf0e10cSrcweir void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(uno::RuntimeException)
3377cdf0e10cSrcweir {
3378cdf0e10cSrcweir 	mnFirst = Date;
3379cdf0e10cSrcweir 	if ( getPeer().is() )
3380cdf0e10cSrcweir 	{
3381cdf0e10cSrcweir 		uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
3382cdf0e10cSrcweir         xField->setFirst( Date );
3383cdf0e10cSrcweir     }
3384cdf0e10cSrcweir }
3385cdf0e10cSrcweir 
getFirst()3386cdf0e10cSrcweir sal_Int32 UnoDateFieldControl::getFirst() throw(uno::RuntimeException)
3387cdf0e10cSrcweir {
3388cdf0e10cSrcweir 	return mnFirst;
3389cdf0e10cSrcweir }
3390cdf0e10cSrcweir 
setLast(sal_Int32 Date)3391cdf0e10cSrcweir void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(uno::RuntimeException)
3392cdf0e10cSrcweir {
3393cdf0e10cSrcweir 	mnLast = Date;
3394cdf0e10cSrcweir 	if ( getPeer().is() )
3395cdf0e10cSrcweir 	{
3396cdf0e10cSrcweir 		uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
3397cdf0e10cSrcweir         xField->setLast( Date );
3398cdf0e10cSrcweir     }
3399cdf0e10cSrcweir }
3400cdf0e10cSrcweir 
getLast()3401cdf0e10cSrcweir sal_Int32 UnoDateFieldControl::getLast() throw(uno::RuntimeException)
3402cdf0e10cSrcweir {
3403cdf0e10cSrcweir 	return mnLast;
3404cdf0e10cSrcweir }
3405cdf0e10cSrcweir 
setLongFormat(sal_Bool bLong)3406cdf0e10cSrcweir void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) throw(uno::RuntimeException)
3407cdf0e10cSrcweir {
3408cdf0e10cSrcweir 	mbLongFormat = bLong;
3409cdf0e10cSrcweir 	if ( getPeer().is() )
3410cdf0e10cSrcweir 	{
3411cdf0e10cSrcweir 		uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
3412cdf0e10cSrcweir         xField->setLongFormat( bLong );
3413cdf0e10cSrcweir     }
3414cdf0e10cSrcweir }
3415cdf0e10cSrcweir 
isLongFormat()3416cdf0e10cSrcweir sal_Bool UnoDateFieldControl::isLongFormat() throw(uno::RuntimeException)
3417cdf0e10cSrcweir {
3418cdf0e10cSrcweir 	return ( mbLongFormat != 2 ) ? mbLongFormat : sal_False;
3419cdf0e10cSrcweir }
3420cdf0e10cSrcweir 
setEmpty()3421cdf0e10cSrcweir void UnoDateFieldControl::setEmpty() throw(uno::RuntimeException)
3422cdf0e10cSrcweir {
3423cdf0e10cSrcweir 	if ( getPeer().is() )
3424cdf0e10cSrcweir 	{
3425cdf0e10cSrcweir 		uno::Reference < awt::XDateField >  xField( getPeer(), uno::UNO_QUERY );
3426cdf0e10cSrcweir 		xField->setEmpty();
3427cdf0e10cSrcweir 	}
3428cdf0e10cSrcweir }
3429cdf0e10cSrcweir 
isEmpty()3430cdf0e10cSrcweir sal_Bool UnoDateFieldControl::isEmpty() throw(uno::RuntimeException)
3431cdf0e10cSrcweir {
3432cdf0e10cSrcweir 	sal_Bool bEmpty = sal_False;
3433cdf0e10cSrcweir 	if ( getPeer().is() )
3434cdf0e10cSrcweir 	{
3435cdf0e10cSrcweir 		uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
3436cdf0e10cSrcweir 		bEmpty = xField->isEmpty();
3437cdf0e10cSrcweir 	}
3438cdf0e10cSrcweir 	return bEmpty;
3439cdf0e10cSrcweir }
3440cdf0e10cSrcweir 
setStrictFormat(sal_Bool bStrict)3441cdf0e10cSrcweir void UnoDateFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
3442cdf0e10cSrcweir {
3443cdf0e10cSrcweir 	uno::Any aAny;
3444cdf0e10cSrcweir 	aAny <<= bStrict;
3445cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
3446cdf0e10cSrcweir }
3447cdf0e10cSrcweir 
isStrictFormat()3448cdf0e10cSrcweir sal_Bool UnoDateFieldControl::isStrictFormat() throw(uno::RuntimeException)
3449cdf0e10cSrcweir {
3450cdf0e10cSrcweir 	return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
3451cdf0e10cSrcweir }
3452cdf0e10cSrcweir 
3453cdf0e10cSrcweir //	----------------------------------------------------
3454cdf0e10cSrcweir //	class UnoControlTimeFieldModel
3455cdf0e10cSrcweir //	----------------------------------------------------
UnoControlTimeFieldModel(const Reference<XMultiServiceFactory> & i_factory)3456cdf0e10cSrcweir UnoControlTimeFieldModel::UnoControlTimeFieldModel( const Reference< XMultiServiceFactory >& i_factory )
3457cdf0e10cSrcweir     :UnoControlModel( i_factory )
3458cdf0e10cSrcweir {
3459cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXTimeField );
3460cdf0e10cSrcweir }
3461cdf0e10cSrcweir 
getServiceName()3462cdf0e10cSrcweir ::rtl::OUString UnoControlTimeFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
3463cdf0e10cSrcweir {
3464cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel );
3465cdf0e10cSrcweir }
3466cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const3467cdf0e10cSrcweir uno::Any UnoControlTimeFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
3468cdf0e10cSrcweir {
3469cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
3470cdf0e10cSrcweir 	{
3471cdf0e10cSrcweir 		uno::Any aAny;
3472cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField );
3473cdf0e10cSrcweir 		return aAny;
3474cdf0e10cSrcweir 	}
3475cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
3476cdf0e10cSrcweir }
3477cdf0e10cSrcweir 
3478cdf0e10cSrcweir 
getInfoHelper()3479cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlTimeFieldModel::getInfoHelper()
3480cdf0e10cSrcweir {
3481cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
3482cdf0e10cSrcweir 	if ( !pHelper )
3483cdf0e10cSrcweir 	{
3484cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
3485cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
3486cdf0e10cSrcweir 	}
3487cdf0e10cSrcweir 	return *pHelper;
3488cdf0e10cSrcweir }
3489cdf0e10cSrcweir 
3490cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()3491cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
3492cdf0e10cSrcweir {
3493cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
3494cdf0e10cSrcweir 	return xInfo;
3495cdf0e10cSrcweir }
3496cdf0e10cSrcweir 
3497cdf0e10cSrcweir 
3498cdf0e10cSrcweir 
3499cdf0e10cSrcweir //	----------------------------------------------------
3500cdf0e10cSrcweir //	class UnoTimeFieldControl
3501cdf0e10cSrcweir //	----------------------------------------------------
UnoTimeFieldControl(const Reference<XMultiServiceFactory> & i_factory)3502cdf0e10cSrcweir UnoTimeFieldControl::UnoTimeFieldControl( const Reference< XMultiServiceFactory >& i_factory )
3503cdf0e10cSrcweir     :UnoSpinFieldControl( i_factory )
3504cdf0e10cSrcweir {
3505cdf0e10cSrcweir     mnFirst = Time( 0, 0 ).GetTime();
3506cdf0e10cSrcweir     mnLast = Time( 23, 59, 59, 99 ).GetTime();
3507cdf0e10cSrcweir }
3508cdf0e10cSrcweir 
GetComponentServiceName()3509cdf0e10cSrcweir ::rtl::OUString UnoTimeFieldControl::GetComponentServiceName()
3510cdf0e10cSrcweir {
3511cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "timefield" );
3512cdf0e10cSrcweir }
3513cdf0e10cSrcweir 
3514cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)3515cdf0e10cSrcweir uno::Any UnoTimeFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
3516cdf0e10cSrcweir {
3517cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
3518cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XTimeField*, this ) );
3519cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
3520cdf0e10cSrcweir }
3521cdf0e10cSrcweir 
3522cdf0e10cSrcweir // lang::XTypeProvider
3523cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoTimeFieldControl )
3524cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XTimeField>* ) NULL ),
3525cdf0e10cSrcweir 	UnoSpinFieldControl::getTypes()
3526cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
3527cdf0e10cSrcweir 
3528cdf0e10cSrcweir void UnoTimeFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
3529cdf0e10cSrcweir {
3530cdf0e10cSrcweir 	UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
3531cdf0e10cSrcweir 
3532cdf0e10cSrcweir 	uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
3533cdf0e10cSrcweir 	xField->setFirst( mnFirst );
3534cdf0e10cSrcweir     xField->setLast( mnLast );
3535cdf0e10cSrcweir }
3536cdf0e10cSrcweir 
textChanged(const awt::TextEvent & e)3537cdf0e10cSrcweir void UnoTimeFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
3538cdf0e10cSrcweir {
3539cdf0e10cSrcweir     // also change the text property (#i25106#)
3540cdf0e10cSrcweir     uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
3541cdf0e10cSrcweir     ::rtl::OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
3542cdf0e10cSrcweir     ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), sal_False );
3543cdf0e10cSrcweir 
3544cdf0e10cSrcweir     // re-calc the Time property
3545cdf0e10cSrcweir 	uno::Reference < awt::XTimeField >  xField( getPeer(), uno::UNO_QUERY );
3546cdf0e10cSrcweir 	uno::Any aValue;
3547cdf0e10cSrcweir 	if ( !xField->isEmpty() )
3548cdf0e10cSrcweir 		aValue <<= xField->getTime();
3549cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aValue, sal_False );
3550cdf0e10cSrcweir 
3551cdf0e10cSrcweir     // multiplex the event
3552cdf0e10cSrcweir     if ( GetTextListeners().getLength() )
3553cdf0e10cSrcweir 		GetTextListeners().textChanged( e );
3554cdf0e10cSrcweir }
3555cdf0e10cSrcweir 
setTime(sal_Int32 Time)3556cdf0e10cSrcweir void UnoTimeFieldControl::setTime( sal_Int32 Time ) throw(uno::RuntimeException)
3557cdf0e10cSrcweir {
3558cdf0e10cSrcweir 	uno::Any aAny;
3559cdf0e10cSrcweir 	aAny <<= Time;
3560cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aAny, sal_True );
3561cdf0e10cSrcweir }
3562cdf0e10cSrcweir 
getTime()3563cdf0e10cSrcweir sal_Int32 UnoTimeFieldControl::getTime() throw(uno::RuntimeException)
3564cdf0e10cSrcweir {
3565cdf0e10cSrcweir 	return ImplGetPropertyValue_INT32( BASEPROPERTY_TIME );
3566cdf0e10cSrcweir }
3567cdf0e10cSrcweir 
setMin(sal_Int32 Time)3568cdf0e10cSrcweir void UnoTimeFieldControl::setMin( sal_Int32 Time ) throw(uno::RuntimeException)
3569cdf0e10cSrcweir {
3570cdf0e10cSrcweir 	uno::Any aAny;
3571cdf0e10cSrcweir 	aAny <<= Time;
3572cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), aAny, sal_True );
3573cdf0e10cSrcweir }
3574cdf0e10cSrcweir 
getMin()3575cdf0e10cSrcweir sal_Int32 UnoTimeFieldControl::getMin() throw(uno::RuntimeException)
3576cdf0e10cSrcweir {
3577cdf0e10cSrcweir 	return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMIN );
3578cdf0e10cSrcweir }
3579cdf0e10cSrcweir 
setMax(sal_Int32 Time)3580cdf0e10cSrcweir void UnoTimeFieldControl::setMax( sal_Int32 Time ) throw(uno::RuntimeException)
3581cdf0e10cSrcweir {
3582cdf0e10cSrcweir 	uno::Any aAny;
3583cdf0e10cSrcweir 	aAny <<= Time;
3584cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), aAny, sal_True );
3585cdf0e10cSrcweir }
3586cdf0e10cSrcweir 
getMax()3587cdf0e10cSrcweir sal_Int32 UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
3588cdf0e10cSrcweir {
3589cdf0e10cSrcweir 	return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMAX );
3590cdf0e10cSrcweir }
3591cdf0e10cSrcweir 
setFirst(sal_Int32 Time)3592cdf0e10cSrcweir void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(uno::RuntimeException)
3593cdf0e10cSrcweir {
3594cdf0e10cSrcweir 	mnFirst = Time;
3595cdf0e10cSrcweir 	if ( getPeer().is() )
3596cdf0e10cSrcweir 	{
3597cdf0e10cSrcweir 		uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
3598cdf0e10cSrcweir         xField->setFirst( mnFirst );
3599cdf0e10cSrcweir     }
3600cdf0e10cSrcweir }
3601cdf0e10cSrcweir 
getFirst()3602cdf0e10cSrcweir sal_Int32 UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
3603cdf0e10cSrcweir {
3604cdf0e10cSrcweir 	return mnFirst;
3605cdf0e10cSrcweir }
3606cdf0e10cSrcweir 
setLast(sal_Int32 Time)3607cdf0e10cSrcweir void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(uno::RuntimeException)
3608cdf0e10cSrcweir {
3609cdf0e10cSrcweir 	mnLast = Time;
3610cdf0e10cSrcweir 	if ( getPeer().is() )
3611cdf0e10cSrcweir 	{
3612cdf0e10cSrcweir 		uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
3613cdf0e10cSrcweir         xField->setFirst( mnLast );
3614cdf0e10cSrcweir     }
3615cdf0e10cSrcweir }
3616cdf0e10cSrcweir 
getLast()3617cdf0e10cSrcweir sal_Int32 UnoTimeFieldControl::getLast() throw(uno::RuntimeException)
3618cdf0e10cSrcweir {
3619cdf0e10cSrcweir 	return mnLast;
3620cdf0e10cSrcweir }
3621cdf0e10cSrcweir 
setEmpty()3622cdf0e10cSrcweir void UnoTimeFieldControl::setEmpty() throw(uno::RuntimeException)
3623cdf0e10cSrcweir {
3624cdf0e10cSrcweir 	if ( getPeer().is() )
3625cdf0e10cSrcweir 	{
3626cdf0e10cSrcweir 		uno::Reference < awt::XTimeField >  xField( getPeer(), uno::UNO_QUERY );
3627cdf0e10cSrcweir 		xField->setEmpty();
3628cdf0e10cSrcweir 	}
3629cdf0e10cSrcweir }
3630cdf0e10cSrcweir 
isEmpty()3631cdf0e10cSrcweir sal_Bool UnoTimeFieldControl::isEmpty() throw(uno::RuntimeException)
3632cdf0e10cSrcweir {
3633cdf0e10cSrcweir 	sal_Bool bEmpty = sal_False;
3634cdf0e10cSrcweir 	if ( getPeer().is() )
3635cdf0e10cSrcweir 	{
3636cdf0e10cSrcweir 		uno::Reference < awt::XTimeField >  xField( getPeer(), uno::UNO_QUERY );
3637cdf0e10cSrcweir 		bEmpty = xField->isEmpty();
3638cdf0e10cSrcweir 	}
3639cdf0e10cSrcweir 	return bEmpty;
3640cdf0e10cSrcweir }
3641cdf0e10cSrcweir 
setStrictFormat(sal_Bool bStrict)3642cdf0e10cSrcweir void UnoTimeFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
3643cdf0e10cSrcweir {
3644cdf0e10cSrcweir 	uno::Any aAny;
3645cdf0e10cSrcweir 	aAny <<= bStrict;
3646cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
3647cdf0e10cSrcweir }
3648cdf0e10cSrcweir 
isStrictFormat()3649cdf0e10cSrcweir sal_Bool UnoTimeFieldControl::isStrictFormat() throw(uno::RuntimeException)
3650cdf0e10cSrcweir {
3651cdf0e10cSrcweir 	return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
3652cdf0e10cSrcweir }
3653cdf0e10cSrcweir 
3654cdf0e10cSrcweir //	----------------------------------------------------
3655cdf0e10cSrcweir //	class UnoControlNumericFieldModel
3656cdf0e10cSrcweir //	----------------------------------------------------
UnoControlNumericFieldModel(const Reference<XMultiServiceFactory> & i_factory)3657cdf0e10cSrcweir UnoControlNumericFieldModel::UnoControlNumericFieldModel( const Reference< XMultiServiceFactory >& i_factory )
3658cdf0e10cSrcweir     :UnoControlModel( i_factory )
3659cdf0e10cSrcweir {
3660cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXNumericField );
3661cdf0e10cSrcweir }
3662cdf0e10cSrcweir 
getServiceName()3663cdf0e10cSrcweir ::rtl::OUString UnoControlNumericFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
3664cdf0e10cSrcweir {
3665cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel );
3666cdf0e10cSrcweir }
3667cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const3668cdf0e10cSrcweir uno::Any UnoControlNumericFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
3669cdf0e10cSrcweir {
3670cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
3671cdf0e10cSrcweir 	{
3672cdf0e10cSrcweir 		uno::Any aAny;
3673cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField );
3674cdf0e10cSrcweir 		return aAny;
3675cdf0e10cSrcweir 	}
3676cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
3677cdf0e10cSrcweir }
3678cdf0e10cSrcweir 
3679cdf0e10cSrcweir 
getInfoHelper()3680cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlNumericFieldModel::getInfoHelper()
3681cdf0e10cSrcweir {
3682cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
3683cdf0e10cSrcweir 	if ( !pHelper )
3684cdf0e10cSrcweir 	{
3685cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
3686cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
3687cdf0e10cSrcweir 	}
3688cdf0e10cSrcweir 	return *pHelper;
3689cdf0e10cSrcweir }
3690cdf0e10cSrcweir 
3691cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()3692cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlNumericFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
3693cdf0e10cSrcweir {
3694cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
3695cdf0e10cSrcweir 	return xInfo;
3696cdf0e10cSrcweir }
3697cdf0e10cSrcweir 
3698cdf0e10cSrcweir 
3699cdf0e10cSrcweir 
3700cdf0e10cSrcweir //	----------------------------------------------------
3701cdf0e10cSrcweir //	class UnoNumericFieldControl
3702cdf0e10cSrcweir //	----------------------------------------------------
UnoNumericFieldControl(const Reference<XMultiServiceFactory> & i_factory)3703cdf0e10cSrcweir UnoNumericFieldControl::UnoNumericFieldControl( const Reference< XMultiServiceFactory >& i_factory )
3704cdf0e10cSrcweir     :UnoSpinFieldControl( i_factory )
3705cdf0e10cSrcweir {
3706cdf0e10cSrcweir     mnFirst = 0;
3707cdf0e10cSrcweir     mnLast = 0x7FFFFFFF;
3708cdf0e10cSrcweir }
3709cdf0e10cSrcweir 
GetComponentServiceName()3710cdf0e10cSrcweir ::rtl::OUString UnoNumericFieldControl::GetComponentServiceName()
3711cdf0e10cSrcweir {
3712cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "numericfield" );
3713cdf0e10cSrcweir }
3714cdf0e10cSrcweir 
3715cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)3716cdf0e10cSrcweir uno::Any UnoNumericFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
3717cdf0e10cSrcweir {
3718cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
3719cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XNumericField*, this ) );
3720cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
3721cdf0e10cSrcweir }
3722cdf0e10cSrcweir 
3723cdf0e10cSrcweir // lang::XTypeProvider
3724cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoNumericFieldControl )
3725cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XNumericField>* ) NULL ),
3726cdf0e10cSrcweir 	UnoSpinFieldControl::getTypes()
3727cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
3728cdf0e10cSrcweir 
3729cdf0e10cSrcweir void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
3730cdf0e10cSrcweir {
3731cdf0e10cSrcweir 	UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
3732cdf0e10cSrcweir 
3733cdf0e10cSrcweir 	uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
3734cdf0e10cSrcweir 	xField->setFirst( mnFirst );
3735cdf0e10cSrcweir     xField->setLast( mnLast );
3736cdf0e10cSrcweir }
3737cdf0e10cSrcweir 
3738cdf0e10cSrcweir 
textChanged(const awt::TextEvent & e)3739cdf0e10cSrcweir void UnoNumericFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
3740cdf0e10cSrcweir {
3741cdf0e10cSrcweir 	uno::Reference < awt::XNumericField >  xField( getPeer(), uno::UNO_QUERY );
3742cdf0e10cSrcweir 	uno::Any aAny;
3743cdf0e10cSrcweir 	aAny <<= xField->getValue();
3744cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
3745cdf0e10cSrcweir 
3746cdf0e10cSrcweir 	if ( GetTextListeners().getLength() )
3747cdf0e10cSrcweir 		GetTextListeners().textChanged( e );
3748cdf0e10cSrcweir }
3749cdf0e10cSrcweir 
setValue(double Value)3750cdf0e10cSrcweir void UnoNumericFieldControl::setValue( double Value ) throw(uno::RuntimeException)
3751cdf0e10cSrcweir {
3752cdf0e10cSrcweir 	uno::Any aAny;
3753cdf0e10cSrcweir 	aAny <<= Value;
3754cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
3755cdf0e10cSrcweir }
3756cdf0e10cSrcweir 
getValue()3757cdf0e10cSrcweir double UnoNumericFieldControl::getValue() throw(uno::RuntimeException)
3758cdf0e10cSrcweir {
3759cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
3760cdf0e10cSrcweir }
3761cdf0e10cSrcweir 
setMin(double Value)3762cdf0e10cSrcweir void UnoNumericFieldControl::setMin( double Value ) throw(uno::RuntimeException)
3763cdf0e10cSrcweir {
3764cdf0e10cSrcweir 	uno::Any aAny;
3765cdf0e10cSrcweir 	aAny <<= Value;
3766cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
3767cdf0e10cSrcweir }
3768cdf0e10cSrcweir 
getMin()3769cdf0e10cSrcweir double UnoNumericFieldControl::getMin() throw(uno::RuntimeException)
3770cdf0e10cSrcweir {
3771cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
3772cdf0e10cSrcweir }
3773cdf0e10cSrcweir 
setMax(double Value)3774cdf0e10cSrcweir void UnoNumericFieldControl::setMax( double Value ) throw(uno::RuntimeException)
3775cdf0e10cSrcweir {
3776cdf0e10cSrcweir 	uno::Any aAny;
3777cdf0e10cSrcweir 	aAny <<= Value;
3778cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
3779cdf0e10cSrcweir }
3780cdf0e10cSrcweir 
getMax()3781cdf0e10cSrcweir double UnoNumericFieldControl::getMax() throw(uno::RuntimeException)
3782cdf0e10cSrcweir {
3783cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
3784cdf0e10cSrcweir }
3785cdf0e10cSrcweir 
setFirst(double Value)3786cdf0e10cSrcweir void UnoNumericFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
3787cdf0e10cSrcweir {
3788cdf0e10cSrcweir 	mnFirst = Value;
3789cdf0e10cSrcweir 	if ( getPeer().is() )
3790cdf0e10cSrcweir 	{
3791cdf0e10cSrcweir 		uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
3792cdf0e10cSrcweir         xField->setFirst( mnFirst );
3793cdf0e10cSrcweir     }
3794cdf0e10cSrcweir }
3795cdf0e10cSrcweir 
getFirst()3796cdf0e10cSrcweir double UnoNumericFieldControl::getFirst() throw(uno::RuntimeException)
3797cdf0e10cSrcweir {
3798cdf0e10cSrcweir 	return mnFirst;
3799cdf0e10cSrcweir }
3800cdf0e10cSrcweir 
setLast(double Value)3801cdf0e10cSrcweir void UnoNumericFieldControl::setLast( double Value ) throw(uno::RuntimeException)
3802cdf0e10cSrcweir {
3803cdf0e10cSrcweir 	mnLast = Value;
3804cdf0e10cSrcweir 	if ( getPeer().is() )
3805cdf0e10cSrcweir 	{
3806cdf0e10cSrcweir 		uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
3807cdf0e10cSrcweir         xField->setLast( mnLast );
3808cdf0e10cSrcweir     }
3809cdf0e10cSrcweir }
3810cdf0e10cSrcweir 
getLast()3811cdf0e10cSrcweir double UnoNumericFieldControl::getLast() throw(uno::RuntimeException)
3812cdf0e10cSrcweir {
3813cdf0e10cSrcweir 	return mnLast;
3814cdf0e10cSrcweir }
3815cdf0e10cSrcweir 
setStrictFormat(sal_Bool bStrict)3816cdf0e10cSrcweir void UnoNumericFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
3817cdf0e10cSrcweir {
3818cdf0e10cSrcweir 	uno::Any aAny;
3819cdf0e10cSrcweir 	aAny <<= bStrict;
3820cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
3821cdf0e10cSrcweir }
3822cdf0e10cSrcweir 
isStrictFormat()3823cdf0e10cSrcweir sal_Bool UnoNumericFieldControl::isStrictFormat() throw(uno::RuntimeException)
3824cdf0e10cSrcweir {
3825cdf0e10cSrcweir 	return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
3826cdf0e10cSrcweir }
3827cdf0e10cSrcweir 
setSpinSize(double Digits)3828cdf0e10cSrcweir void UnoNumericFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException)
3829cdf0e10cSrcweir {
3830cdf0e10cSrcweir 	uno::Any aAny;
3831cdf0e10cSrcweir 	aAny <<= Digits;
3832cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
3833cdf0e10cSrcweir }
3834cdf0e10cSrcweir 
getSpinSize()3835cdf0e10cSrcweir double UnoNumericFieldControl::getSpinSize() throw(uno::RuntimeException)
3836cdf0e10cSrcweir {
3837cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
3838cdf0e10cSrcweir }
3839cdf0e10cSrcweir 
setDecimalDigits(sal_Int16 Digits)3840cdf0e10cSrcweir void UnoNumericFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException)
3841cdf0e10cSrcweir {
3842cdf0e10cSrcweir 	uno::Any aAny;
3843cdf0e10cSrcweir 	aAny <<= Digits;
3844cdf0e10cSrcweir     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, sal_True );
3845cdf0e10cSrcweir }
3846cdf0e10cSrcweir 
getDecimalDigits()3847cdf0e10cSrcweir sal_Int16 UnoNumericFieldControl::getDecimalDigits() throw(uno::RuntimeException)
3848cdf0e10cSrcweir {
3849cdf0e10cSrcweir 	return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
3850cdf0e10cSrcweir }
3851cdf0e10cSrcweir 
3852cdf0e10cSrcweir //	----------------------------------------------------
3853cdf0e10cSrcweir //	class UnoControlCurrencyFieldModel
3854cdf0e10cSrcweir //	----------------------------------------------------
UnoControlCurrencyFieldModel(const Reference<XMultiServiceFactory> & i_factory)3855cdf0e10cSrcweir UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel( const Reference< XMultiServiceFactory >& i_factory )
3856cdf0e10cSrcweir     :UnoControlModel( i_factory )
3857cdf0e10cSrcweir {
3858cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCurrencyField );
3859cdf0e10cSrcweir }
3860cdf0e10cSrcweir 
getServiceName()3861cdf0e10cSrcweir ::rtl::OUString UnoControlCurrencyFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
3862cdf0e10cSrcweir {
3863cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel );
3864cdf0e10cSrcweir }
3865cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const3866cdf0e10cSrcweir uno::Any UnoControlCurrencyFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
3867cdf0e10cSrcweir {
3868cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
3869cdf0e10cSrcweir 	{
3870cdf0e10cSrcweir 		uno::Any aAny;
3871cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField );
3872cdf0e10cSrcweir 		return aAny;
3873cdf0e10cSrcweir 	}
3874cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_CURSYM_POSITION )
3875cdf0e10cSrcweir 	{
3876cdf0e10cSrcweir 		uno::Any aAny;
3877cdf0e10cSrcweir 		aAny <<= (sal_Bool)sal_False;
3878cdf0e10cSrcweir 		return aAny;
3879cdf0e10cSrcweir 	}
3880cdf0e10cSrcweir 
3881cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
3882cdf0e10cSrcweir }
3883cdf0e10cSrcweir 
getInfoHelper()3884cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlCurrencyFieldModel::getInfoHelper()
3885cdf0e10cSrcweir {
3886cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
3887cdf0e10cSrcweir 	if ( !pHelper )
3888cdf0e10cSrcweir 	{
3889cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
3890cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
3891cdf0e10cSrcweir 	}
3892cdf0e10cSrcweir 	return *pHelper;
3893cdf0e10cSrcweir }
3894cdf0e10cSrcweir 
3895cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()3896cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
3897cdf0e10cSrcweir {
3898cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
3899cdf0e10cSrcweir 	return xInfo;
3900cdf0e10cSrcweir }
3901cdf0e10cSrcweir 
3902cdf0e10cSrcweir //	----------------------------------------------------
3903cdf0e10cSrcweir //	class UnoCurrencyFieldControl
3904cdf0e10cSrcweir //	----------------------------------------------------
UnoCurrencyFieldControl(const Reference<XMultiServiceFactory> & i_factory)3905cdf0e10cSrcweir UnoCurrencyFieldControl::UnoCurrencyFieldControl( const Reference< XMultiServiceFactory >& i_factory )
3906cdf0e10cSrcweir     :UnoSpinFieldControl( i_factory )
3907cdf0e10cSrcweir {
3908cdf0e10cSrcweir     mnFirst = 0;
3909cdf0e10cSrcweir     mnLast = 0x7FFFFFFF;
3910cdf0e10cSrcweir }
3911cdf0e10cSrcweir 
GetComponentServiceName()3912cdf0e10cSrcweir ::rtl::OUString UnoCurrencyFieldControl::GetComponentServiceName()
3913cdf0e10cSrcweir {
3914cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "longcurrencyfield" );
3915cdf0e10cSrcweir }
3916cdf0e10cSrcweir 
3917cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)3918cdf0e10cSrcweir uno::Any UnoCurrencyFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
3919cdf0e10cSrcweir {
3920cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
3921cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XCurrencyField*, this ) );
3922cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
3923cdf0e10cSrcweir }
3924cdf0e10cSrcweir 
3925cdf0e10cSrcweir // lang::XTypeProvider
3926cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoCurrencyFieldControl )
3927cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XCurrencyField>* ) NULL ),
3928cdf0e10cSrcweir 	UnoSpinFieldControl::getTypes()
3929cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
3930cdf0e10cSrcweir 
3931cdf0e10cSrcweir void UnoCurrencyFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
3932cdf0e10cSrcweir {
3933cdf0e10cSrcweir 	UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
3934cdf0e10cSrcweir 
3935cdf0e10cSrcweir 	uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
3936cdf0e10cSrcweir 	xField->setFirst( mnFirst );
3937cdf0e10cSrcweir     xField->setLast( mnLast );
3938cdf0e10cSrcweir }
3939cdf0e10cSrcweir 
textChanged(const awt::TextEvent & e)3940cdf0e10cSrcweir void UnoCurrencyFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
3941cdf0e10cSrcweir {
3942cdf0e10cSrcweir 	uno::Reference < awt::XCurrencyField >  xField( getPeer(), uno::UNO_QUERY );
3943cdf0e10cSrcweir 	uno::Any aAny;
3944cdf0e10cSrcweir 	aAny <<= xField->getValue();
3945cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
3946cdf0e10cSrcweir 
3947cdf0e10cSrcweir 	if ( GetTextListeners().getLength() )
3948cdf0e10cSrcweir 		GetTextListeners().textChanged( e );
3949cdf0e10cSrcweir }
3950cdf0e10cSrcweir 
setValue(double Value)3951cdf0e10cSrcweir void UnoCurrencyFieldControl::setValue( double Value ) throw(uno::RuntimeException)
3952cdf0e10cSrcweir {
3953cdf0e10cSrcweir 	uno::Any aAny;
3954cdf0e10cSrcweir 	aAny <<= Value;
3955cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
3956cdf0e10cSrcweir }
3957cdf0e10cSrcweir 
getValue()3958cdf0e10cSrcweir double UnoCurrencyFieldControl::getValue() throw(uno::RuntimeException)
3959cdf0e10cSrcweir {
3960cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
3961cdf0e10cSrcweir }
3962cdf0e10cSrcweir 
setMin(double Value)3963cdf0e10cSrcweir void UnoCurrencyFieldControl::setMin( double Value ) throw(uno::RuntimeException)
3964cdf0e10cSrcweir {
3965cdf0e10cSrcweir 	uno::Any aAny;
3966cdf0e10cSrcweir 	aAny <<= Value;
3967cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
3968cdf0e10cSrcweir }
3969cdf0e10cSrcweir 
getMin()3970cdf0e10cSrcweir double UnoCurrencyFieldControl::getMin() throw(uno::RuntimeException)
3971cdf0e10cSrcweir {
3972cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
3973cdf0e10cSrcweir }
3974cdf0e10cSrcweir 
setMax(double Value)3975cdf0e10cSrcweir void UnoCurrencyFieldControl::setMax( double Value ) throw(uno::RuntimeException)
3976cdf0e10cSrcweir {
3977cdf0e10cSrcweir 	uno::Any aAny;
3978cdf0e10cSrcweir 	aAny <<= Value;
3979cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
3980cdf0e10cSrcweir }
3981cdf0e10cSrcweir 
getMax()3982cdf0e10cSrcweir double UnoCurrencyFieldControl::getMax() throw(uno::RuntimeException)
3983cdf0e10cSrcweir {
3984cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
3985cdf0e10cSrcweir }
3986cdf0e10cSrcweir 
setFirst(double Value)3987cdf0e10cSrcweir void UnoCurrencyFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
3988cdf0e10cSrcweir {
3989cdf0e10cSrcweir 	mnFirst = Value;
3990cdf0e10cSrcweir 	if ( getPeer().is() )
3991cdf0e10cSrcweir 	{
3992cdf0e10cSrcweir 		uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
3993cdf0e10cSrcweir         xField->setFirst( mnFirst );
3994cdf0e10cSrcweir     }
3995cdf0e10cSrcweir }
3996cdf0e10cSrcweir 
getFirst()3997cdf0e10cSrcweir double UnoCurrencyFieldControl::getFirst() throw(uno::RuntimeException)
3998cdf0e10cSrcweir {
3999cdf0e10cSrcweir 	return mnFirst;
4000cdf0e10cSrcweir }
4001cdf0e10cSrcweir 
setLast(double Value)4002cdf0e10cSrcweir void UnoCurrencyFieldControl::setLast( double Value ) throw(uno::RuntimeException)
4003cdf0e10cSrcweir {
4004cdf0e10cSrcweir 	mnLast = Value;
4005cdf0e10cSrcweir 	if ( getPeer().is() )
4006cdf0e10cSrcweir 	{
4007cdf0e10cSrcweir 		uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
4008cdf0e10cSrcweir         xField->setLast( mnLast );
4009cdf0e10cSrcweir     }
4010cdf0e10cSrcweir }
4011cdf0e10cSrcweir 
getLast()4012cdf0e10cSrcweir double UnoCurrencyFieldControl::getLast() throw(uno::RuntimeException)
4013cdf0e10cSrcweir {
4014cdf0e10cSrcweir 	return mnLast;
4015cdf0e10cSrcweir }
4016cdf0e10cSrcweir 
setStrictFormat(sal_Bool bStrict)4017cdf0e10cSrcweir void UnoCurrencyFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
4018cdf0e10cSrcweir {
4019cdf0e10cSrcweir 	uno::Any aAny;
4020cdf0e10cSrcweir 	aAny <<= bStrict;
4021cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
4022cdf0e10cSrcweir }
4023cdf0e10cSrcweir 
isStrictFormat()4024cdf0e10cSrcweir sal_Bool UnoCurrencyFieldControl::isStrictFormat() throw(uno::RuntimeException)
4025cdf0e10cSrcweir {
4026cdf0e10cSrcweir 	return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
4027cdf0e10cSrcweir }
4028cdf0e10cSrcweir 
setSpinSize(double Digits)4029cdf0e10cSrcweir void UnoCurrencyFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException)
4030cdf0e10cSrcweir {
4031cdf0e10cSrcweir 	uno::Any aAny;
4032cdf0e10cSrcweir 	aAny <<= Digits;
4033cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
4034cdf0e10cSrcweir }
4035cdf0e10cSrcweir 
getSpinSize()4036cdf0e10cSrcweir double UnoCurrencyFieldControl::getSpinSize() throw(uno::RuntimeException)
4037cdf0e10cSrcweir {
4038cdf0e10cSrcweir 	return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
4039cdf0e10cSrcweir }
4040cdf0e10cSrcweir 
setDecimalDigits(sal_Int16 Digits)4041cdf0e10cSrcweir void UnoCurrencyFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException)
4042cdf0e10cSrcweir {
4043cdf0e10cSrcweir 	uno::Any aAny;
4044cdf0e10cSrcweir 	aAny <<= Digits;
4045cdf0e10cSrcweir     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, sal_True );
4046cdf0e10cSrcweir }
4047cdf0e10cSrcweir 
getDecimalDigits()4048cdf0e10cSrcweir sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() throw(uno::RuntimeException)
4049cdf0e10cSrcweir {
4050cdf0e10cSrcweir 	return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
4051cdf0e10cSrcweir }
4052cdf0e10cSrcweir 
4053cdf0e10cSrcweir //	----------------------------------------------------
4054cdf0e10cSrcweir //	class UnoControlPatternFieldModel
4055cdf0e10cSrcweir //	----------------------------------------------------
UnoControlPatternFieldModel(const Reference<XMultiServiceFactory> & i_factory)4056cdf0e10cSrcweir UnoControlPatternFieldModel::UnoControlPatternFieldModel( const Reference< XMultiServiceFactory >& i_factory )
4057cdf0e10cSrcweir     :UnoControlModel( i_factory )
4058cdf0e10cSrcweir {
4059cdf0e10cSrcweir     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXPatternField );
4060cdf0e10cSrcweir }
4061cdf0e10cSrcweir 
getServiceName()4062cdf0e10cSrcweir ::rtl::OUString UnoControlPatternFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
4063cdf0e10cSrcweir {
4064cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel );
4065cdf0e10cSrcweir }
4066cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const4067cdf0e10cSrcweir uno::Any UnoControlPatternFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
4068cdf0e10cSrcweir {
4069cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
4070cdf0e10cSrcweir 	{
4071cdf0e10cSrcweir 		uno::Any aAny;
4072cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField );
4073cdf0e10cSrcweir 		return aAny;
4074cdf0e10cSrcweir 	}
4075cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
4076cdf0e10cSrcweir }
4077cdf0e10cSrcweir 
getInfoHelper()4078cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlPatternFieldModel::getInfoHelper()
4079cdf0e10cSrcweir {
4080cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
4081cdf0e10cSrcweir 	if ( !pHelper )
4082cdf0e10cSrcweir 	{
4083cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
4084cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
4085cdf0e10cSrcweir 	}
4086cdf0e10cSrcweir 	return *pHelper;
4087cdf0e10cSrcweir }
4088cdf0e10cSrcweir 
4089cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()4090cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlPatternFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
4091cdf0e10cSrcweir {
4092cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
4093cdf0e10cSrcweir 	return xInfo;
4094cdf0e10cSrcweir }
4095cdf0e10cSrcweir 
4096cdf0e10cSrcweir 
4097cdf0e10cSrcweir //	----------------------------------------------------
4098cdf0e10cSrcweir //	class UnoPatternFieldControl
4099cdf0e10cSrcweir //	----------------------------------------------------
UnoPatternFieldControl(const Reference<XMultiServiceFactory> & i_factory)4100cdf0e10cSrcweir UnoPatternFieldControl::UnoPatternFieldControl( const Reference< XMultiServiceFactory >& i_factory )
4101cdf0e10cSrcweir     :UnoSpinFieldControl( i_factory )
4102cdf0e10cSrcweir {
4103cdf0e10cSrcweir }
4104cdf0e10cSrcweir 
GetComponentServiceName()4105cdf0e10cSrcweir ::rtl::OUString UnoPatternFieldControl::GetComponentServiceName()
4106cdf0e10cSrcweir {
4107cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "patternfield" );
4108cdf0e10cSrcweir }
4109cdf0e10cSrcweir 
ImplSetPeerProperty(const::rtl::OUString & rPropName,const uno::Any & rVal)4110cdf0e10cSrcweir void UnoPatternFieldControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
4111cdf0e10cSrcweir {
4112cdf0e10cSrcweir 	sal_uInt16 nType = GetPropertyId( rPropName );
4113cdf0e10cSrcweir 	if ( ( nType == BASEPROPERTY_TEXT ) || ( nType == BASEPROPERTY_EDITMASK ) || ( nType == BASEPROPERTY_LITERALMASK ) )
4114cdf0e10cSrcweir 	{
4115cdf0e10cSrcweir 		// Die Masken koennen nicht nacheinander gesetzt werden.
4116cdf0e10cSrcweir 		::rtl::OUString Text = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
4117cdf0e10cSrcweir 		::rtl::OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
4118cdf0e10cSrcweir 		::rtl::OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
4119cdf0e10cSrcweir 
4120cdf0e10cSrcweir 		uno::Reference < awt::XPatternField >  xPF( getPeer(), uno::UNO_QUERY );
4121cdf0e10cSrcweir 		if (xPF.is())
4122cdf0e10cSrcweir 		{
4123cdf0e10cSrcweir             // same comment as in UnoControl::ImplSetPeerProperty - see there
4124cdf0e10cSrcweir             ::rtl::OUString sText( Text );
4125cdf0e10cSrcweir             ImplCheckLocalize( sText );
4126cdf0e10cSrcweir 			xPF->setString( sText );
4127cdf0e10cSrcweir 			xPF->setMasks( EditMask, LiteralMask );
4128cdf0e10cSrcweir 		}
4129cdf0e10cSrcweir 	}
4130cdf0e10cSrcweir 	else
4131cdf0e10cSrcweir 		UnoSpinFieldControl::ImplSetPeerProperty( rPropName, rVal );
4132cdf0e10cSrcweir }
4133cdf0e10cSrcweir 
4134cdf0e10cSrcweir 
4135cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)4136cdf0e10cSrcweir uno::Any UnoPatternFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
4137cdf0e10cSrcweir {
4138cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
4139cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XPatternField*, this ) );
4140cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
4141cdf0e10cSrcweir }
4142cdf0e10cSrcweir 
4143cdf0e10cSrcweir // lang::XTypeProvider
4144cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoPatternFieldControl )
4145cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XPatternField>* ) NULL ),
4146cdf0e10cSrcweir 	UnoSpinFieldControl::getTypes()
4147cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
4148cdf0e10cSrcweir 
4149cdf0e10cSrcweir void UnoPatternFieldControl::setString( const ::rtl::OUString& rString ) throw(uno::RuntimeException)
4150cdf0e10cSrcweir {
4151cdf0e10cSrcweir 	setText( rString );
4152cdf0e10cSrcweir }
4153cdf0e10cSrcweir 
getString()4154cdf0e10cSrcweir ::rtl::OUString UnoPatternFieldControl::getString() throw(uno::RuntimeException)
4155cdf0e10cSrcweir {
4156cdf0e10cSrcweir 	return getText();
4157cdf0e10cSrcweir }
4158cdf0e10cSrcweir 
setMasks(const::rtl::OUString & EditMask,const::rtl::OUString & LiteralMask)4159cdf0e10cSrcweir void UnoPatternFieldControl::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(uno::RuntimeException)
4160cdf0e10cSrcweir {
4161cdf0e10cSrcweir 	uno::Any aAny;
4162cdf0e10cSrcweir 	aAny <<= EditMask;
4163cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_EDITMASK ), aAny, sal_True );
4164cdf0e10cSrcweir 	aAny <<= LiteralMask;
4165cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LITERALMASK ), aAny, sal_True );
4166cdf0e10cSrcweir }
4167cdf0e10cSrcweir 
getMasks(::rtl::OUString & EditMask,::rtl::OUString & LiteralMask)4168cdf0e10cSrcweir void UnoPatternFieldControl::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(uno::RuntimeException)
4169cdf0e10cSrcweir {
4170cdf0e10cSrcweir 	EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
4171cdf0e10cSrcweir 	LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
4172cdf0e10cSrcweir }
4173cdf0e10cSrcweir 
setStrictFormat(sal_Bool bStrict)4174cdf0e10cSrcweir void UnoPatternFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
4175cdf0e10cSrcweir {
4176cdf0e10cSrcweir 	uno::Any aAny;
4177cdf0e10cSrcweir 	aAny <<= bStrict;
4178cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
4179cdf0e10cSrcweir }
4180cdf0e10cSrcweir 
isStrictFormat()4181cdf0e10cSrcweir sal_Bool UnoPatternFieldControl::isStrictFormat() throw(uno::RuntimeException)
4182cdf0e10cSrcweir {
4183cdf0e10cSrcweir 	return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
4184cdf0e10cSrcweir }
4185cdf0e10cSrcweir 
4186cdf0e10cSrcweir 
4187cdf0e10cSrcweir //	----------------------------------------------------
4188cdf0e10cSrcweir //	class UnoControlProgressBarModel
4189cdf0e10cSrcweir //	----------------------------------------------------
UnoControlProgressBarModel(const Reference<XMultiServiceFactory> & i_factory)4190cdf0e10cSrcweir UnoControlProgressBarModel::UnoControlProgressBarModel( const Reference< XMultiServiceFactory >& i_factory )
4191cdf0e10cSrcweir     :UnoControlModel( i_factory )
4192cdf0e10cSrcweir {
4193cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
4194cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_BORDER );
4195cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
4196cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
4197cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLED );
4198cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
4199cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
4200cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
4201cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HELPURL );
4202cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
4203cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
4204cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
4205cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MIN );
4206cdf0e10cSrcweir }
4207cdf0e10cSrcweir 
getServiceName()4208cdf0e10cSrcweir ::rtl::OUString UnoControlProgressBarModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
4209cdf0e10cSrcweir {
4210cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlProgressBarModel );
4211cdf0e10cSrcweir }
4212cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const4213cdf0e10cSrcweir uno::Any UnoControlProgressBarModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
4214cdf0e10cSrcweir {
4215cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
4216cdf0e10cSrcweir 	{
4217cdf0e10cSrcweir 		uno::Any aAny;
4218cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlProgressBar );
4219cdf0e10cSrcweir 		return aAny;
4220cdf0e10cSrcweir 	}
4221cdf0e10cSrcweir 
4222cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
4223cdf0e10cSrcweir }
4224cdf0e10cSrcweir 
getInfoHelper()4225cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlProgressBarModel::getInfoHelper()
4226cdf0e10cSrcweir {
4227cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
4228cdf0e10cSrcweir 	if ( !pHelper )
4229cdf0e10cSrcweir 	{
4230cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
4231cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
4232cdf0e10cSrcweir 	}
4233cdf0e10cSrcweir 	return *pHelper;
4234cdf0e10cSrcweir }
4235cdf0e10cSrcweir 
4236cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()4237cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlProgressBarModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
4238cdf0e10cSrcweir {
4239cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
4240cdf0e10cSrcweir 	return xInfo;
4241cdf0e10cSrcweir }
4242cdf0e10cSrcweir 
4243cdf0e10cSrcweir 
4244cdf0e10cSrcweir //	----------------------------------------------------
4245cdf0e10cSrcweir //	class UnoProgressBarControl
4246cdf0e10cSrcweir //	----------------------------------------------------
UnoProgressBarControl(const Reference<XMultiServiceFactory> & i_factory)4247cdf0e10cSrcweir UnoProgressBarControl::UnoProgressBarControl( const Reference< XMultiServiceFactory >& i_factory )
4248cdf0e10cSrcweir 	:UnoControlBase( i_factory )
4249cdf0e10cSrcweir {
4250cdf0e10cSrcweir }
4251cdf0e10cSrcweir 
GetComponentServiceName()4252cdf0e10cSrcweir ::rtl::OUString UnoProgressBarControl::GetComponentServiceName()
4253cdf0e10cSrcweir {
4254cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "ProgressBar" );
4255cdf0e10cSrcweir }
4256cdf0e10cSrcweir 
4257cdf0e10cSrcweir // uno::XInterface
queryAggregation(const uno::Type & rType)4258cdf0e10cSrcweir uno::Any UnoProgressBarControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
4259cdf0e10cSrcweir {
4260cdf0e10cSrcweir 	uno::Any aRet = ::cppu::queryInterface( rType,
4261cdf0e10cSrcweir 										SAL_STATIC_CAST( awt::XProgressBar*, this ) );
4262cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
4263cdf0e10cSrcweir }
4264cdf0e10cSrcweir 
4265cdf0e10cSrcweir // lang::XTypeProvider
4266cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( UnoProgressBarControl )
4267cdf0e10cSrcweir 	getCppuType( ( uno::Reference< awt::XProgressBar>* ) NULL ),
4268cdf0e10cSrcweir 	UnoControlBase::getTypes()
4269cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END
4270cdf0e10cSrcweir 
4271cdf0e10cSrcweir // ::com::sun::star::awt::XProgressBar
4272cdf0e10cSrcweir void UnoProgressBarControl::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
4273cdf0e10cSrcweir {
4274cdf0e10cSrcweir 	uno::Any aAny;
4275cdf0e10cSrcweir 	aAny <<= nColor;
4276cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_FILLCOLOR ), aAny, sal_True );
4277cdf0e10cSrcweir }
4278cdf0e10cSrcweir 
setBackgroundColor(sal_Int32 nColor)4279cdf0e10cSrcweir void UnoProgressBarControl::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
4280cdf0e10cSrcweir {
4281cdf0e10cSrcweir 	uno::Any aAny;
4282cdf0e10cSrcweir 	aAny <<= nColor;
4283cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_BACKGROUNDCOLOR ), aAny, sal_True );
4284cdf0e10cSrcweir }
4285cdf0e10cSrcweir 
setValue(sal_Int32 nValue)4286cdf0e10cSrcweir void UnoProgressBarControl::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException)
4287cdf0e10cSrcweir {
4288cdf0e10cSrcweir 	uno::Any aAny;
4289cdf0e10cSrcweir 	aAny <<= nValue;
4290cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE ), aAny, sal_True );
4291cdf0e10cSrcweir }
4292cdf0e10cSrcweir 
setRange(sal_Int32 nMin,sal_Int32 nMax)4293cdf0e10cSrcweir void UnoProgressBarControl::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException )
4294cdf0e10cSrcweir {
4295cdf0e10cSrcweir 	uno::Any aMin;
4296cdf0e10cSrcweir 	uno::Any aMax;
4297cdf0e10cSrcweir 
4298cdf0e10cSrcweir 	if ( nMin < nMax )
4299cdf0e10cSrcweir 	{
4300cdf0e10cSrcweir 		// take correct min and max
4301cdf0e10cSrcweir 		aMin <<= nMin;
4302cdf0e10cSrcweir 		aMax <<= nMax;
4303cdf0e10cSrcweir 	}
4304cdf0e10cSrcweir 	else
4305cdf0e10cSrcweir 	{
4306cdf0e10cSrcweir 		// change min and max
4307cdf0e10cSrcweir 		aMin <<= nMax;
4308cdf0e10cSrcweir 		aMax <<= nMin;
4309cdf0e10cSrcweir 	}
4310cdf0e10cSrcweir 
4311cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MIN ), aMin, sal_True );
4312cdf0e10cSrcweir 	ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MAX ), aMax, sal_True );
4313cdf0e10cSrcweir }
4314cdf0e10cSrcweir 
getValue()4315cdf0e10cSrcweir sal_Int32 UnoProgressBarControl::getValue() throw(::com::sun::star::uno::RuntimeException)
4316cdf0e10cSrcweir {
4317cdf0e10cSrcweir 	return ImplGetPropertyValue_INT32( BASEPROPERTY_PROGRESSVALUE );
4318cdf0e10cSrcweir }
4319cdf0e10cSrcweir 
4320cdf0e10cSrcweir 
4321cdf0e10cSrcweir //	----------------------------------------------------
4322cdf0e10cSrcweir //	class UnoControlFixedLineModel
4323cdf0e10cSrcweir //	----------------------------------------------------
UnoControlFixedLineModel(const Reference<XMultiServiceFactory> & i_factory)4324cdf0e10cSrcweir UnoControlFixedLineModel::UnoControlFixedLineModel( const Reference< XMultiServiceFactory >& i_factory )
4325cdf0e10cSrcweir     :UnoControlModel( i_factory )
4326cdf0e10cSrcweir {
4327cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
4328cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
4329cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLED );
4330cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
4331cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
4332cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
4333cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_HELPURL );
4334cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_LABEL );
4335cdf0e10cSrcweir     ImplRegisterProperty( BASEPROPERTY_ORIENTATION );
4336cdf0e10cSrcweir 	ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
4337cdf0e10cSrcweir }
4338cdf0e10cSrcweir 
getServiceName()4339cdf0e10cSrcweir ::rtl::OUString UnoControlFixedLineModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
4340cdf0e10cSrcweir {
4341cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedLineModel );
4342cdf0e10cSrcweir }
4343cdf0e10cSrcweir 
ImplGetDefaultValue(sal_uInt16 nPropId) const4344cdf0e10cSrcweir uno::Any UnoControlFixedLineModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
4345cdf0e10cSrcweir {
4346cdf0e10cSrcweir 	if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
4347cdf0e10cSrcweir 	{
4348cdf0e10cSrcweir 		uno::Any aAny;
4349cdf0e10cSrcweir 		aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedLine );
4350cdf0e10cSrcweir 		return aAny;
4351cdf0e10cSrcweir 	}
4352cdf0e10cSrcweir 	return UnoControlModel::ImplGetDefaultValue( nPropId );
4353cdf0e10cSrcweir }
4354cdf0e10cSrcweir 
getInfoHelper()4355cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UnoControlFixedLineModel::getInfoHelper()
4356cdf0e10cSrcweir {
4357cdf0e10cSrcweir 	static UnoPropertyArrayHelper* pHelper = NULL;
4358cdf0e10cSrcweir 	if ( !pHelper )
4359cdf0e10cSrcweir 	{
4360cdf0e10cSrcweir 		uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
4361cdf0e10cSrcweir 		pHelper = new UnoPropertyArrayHelper( aIDs );
4362cdf0e10cSrcweir 	}
4363cdf0e10cSrcweir 	return *pHelper;
4364cdf0e10cSrcweir }
4365cdf0e10cSrcweir 
4366cdf0e10cSrcweir // beans::XMultiPropertySet
getPropertySetInfo()4367cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UnoControlFixedLineModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
4368cdf0e10cSrcweir {
4369cdf0e10cSrcweir 	static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
4370cdf0e10cSrcweir 	return xInfo;
4371cdf0e10cSrcweir }
4372cdf0e10cSrcweir 
4373cdf0e10cSrcweir //	----------------------------------------------------
4374cdf0e10cSrcweir //	class UnoFixedLineControl
4375cdf0e10cSrcweir //	----------------------------------------------------
UnoFixedLineControl(const Reference<XMultiServiceFactory> & i_factory)4376cdf0e10cSrcweir UnoFixedLineControl::UnoFixedLineControl( const Reference< XMultiServiceFactory >& i_factory )
4377cdf0e10cSrcweir 	:UnoControlBase( i_factory )
4378cdf0e10cSrcweir {
4379cdf0e10cSrcweir 	maComponentInfos.nWidth = 100;		// ??
4380cdf0e10cSrcweir 	maComponentInfos.nHeight = 100;		// ??
4381cdf0e10cSrcweir }
4382cdf0e10cSrcweir 
GetComponentServiceName()4383cdf0e10cSrcweir ::rtl::OUString UnoFixedLineControl::GetComponentServiceName()
4384cdf0e10cSrcweir {
4385cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "FixedLine" );
4386cdf0e10cSrcweir }
4387cdf0e10cSrcweir 
isTransparent()4388cdf0e10cSrcweir sal_Bool UnoFixedLineControl::isTransparent() throw(uno::RuntimeException)
4389cdf0e10cSrcweir {
4390cdf0e10cSrcweir 	return sal_True;
4391cdf0e10cSrcweir }
4392cdf0e10cSrcweir 
4393