1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_toolkit.hxx"
26 
27 #include <toolkit/controls/unocontrolcontainermodel.hxx>
28 #include <toolkit/helper/property.hxx>
29 #include <toolkit/helper/servicenames.hxx>
30 #include <toolkit/helper/unopropertyarrayhelper.hxx>
31 
32 //	----------------------------------------------------
33 //	class UnoControlContainerModel
34 //	----------------------------------------------------
UnoControlContainerModel(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & i_factory)35 UnoControlContainerModel::UnoControlContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
36     :UnoControlModel( i_factory )
37 {
38 	ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
39 	ImplRegisterProperty( BASEPROPERTY_BORDER );
40     ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
41 	ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
42 	ImplRegisterProperty( BASEPROPERTY_ENABLED );
43 	ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
44 	ImplRegisterProperty( BASEPROPERTY_HELPURL );
45 	ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
46 	ImplRegisterProperty( BASEPROPERTY_TEXT );
47 }
48 
getServiceName()49 ::rtl::OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
50 {
51 	return ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel );
52 }
53 
ImplGetDefaultValue(sal_uInt16 nPropId) const54 ::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
55 {
56 	::com::sun::star::uno::Any aDefault;
57 	if ( nPropId == BASEPROPERTY_BORDER )
58 		aDefault <<= (sal_Int16) 0;
59 	else
60 		aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId );
61 	return aDefault;
62 }
63 
64 
getPropertySetInfo()65 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
66 {
67 	static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
68 	return xInfo;
69 }
70 
getInfoHelper()71 ::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
72 {
73 	::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlContainerModel*)this)->GetMutex() );
74 
75 	static UnoPropertyArrayHelper* pHelper = NULL;
76 	if ( !pHelper )
77 	{
78 		::com::sun::star::uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
79 		pHelper = new UnoPropertyArrayHelper( aIDs );
80 	}
81 	return *pHelper;
82 }
83 
84 
85 
86 
87