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_basctl.hxx"
26 
27 #ifndef _BASCTL_BASIDECTRLR_HXX_
28 #include <basidectrlr.hxx>
29 #endif
30 #include <cppuhelper/queryinterface.hxx>
31 #include <comphelper/sequence.hxx>
32 #include <com/sun/star/beans/PropertyAttribute.hpp>
33 
34 #include <vcl/syswin.hxx>
35 
36 #include <basidesh.hxx>
37 
38 
39 using namespace com::sun::star;
40 using namespace com::sun::star::uno;
41 using namespace com::sun::star::beans;
42 
43 
44 #define PROPERTY_ID_ICONID      1
45 #define PROPERTY_ICONID         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconId" ) )
46 
47 
48 //----------------------------------------------------------------------------
49 
BasicIDEController(BasicIDEShell * pViewShell)50 BasicIDEController::BasicIDEController( BasicIDEShell* pViewShell )
51 	:OPropertyContainer( m_aBHelper )
52 	,SfxBaseController( pViewShell )
53     ,m_nIconId( ICON_MACROLIBRARY )
54 {
55 	registerProperty( PROPERTY_ICONID, PROPERTY_ID_ICONID, PropertyAttribute::READONLY, &m_nIconId, ::getCppuType( &m_nIconId ) );
56 }
57 
58 //----------------------------------------------------------------------------
59 
~BasicIDEController()60 BasicIDEController::~BasicIDEController()
61 {
62 }
63 
64 // XInterface
65 //----------------------------------------------------------------------------
66 
queryInterface(const Type & rType)67 Any SAL_CALL BasicIDEController::queryInterface( const Type & rType ) throw(RuntimeException)
68 {
69     Any aReturn = SfxBaseController::queryInterface( rType );
70     if ( !aReturn.hasValue() )
71 		aReturn = OPropertyContainer::queryInterface( rType );
72 
73     return aReturn;
74 }
75 
76 //----------------------------------------------------------------------------
77 
acquire()78 void SAL_CALL BasicIDEController::acquire() throw()
79 {
80 	SfxBaseController::acquire();
81 }
82 
83 //----------------------------------------------------------------------------
84 
release()85 void SAL_CALL BasicIDEController::release() throw()
86 {
87 	SfxBaseController::release();
88 }
89 
90 
91 // XTypeProvider ( ::SfxBaseController )
92 //----------------------------------------------------------------------------
93 
getTypes()94 Sequence< Type > SAL_CALL BasicIDEController::getTypes() throw(RuntimeException)
95 {
96     Sequence< Type > aTypes = ::comphelper::concatSequences(
97 		SfxBaseController::getTypes(),
98 		OPropertyContainer::getTypes()
99         );
100 
101 	return aTypes;
102 }
103 
104 //----------------------------------------------------------------------------
105 
getImplementationId()106 Sequence< sal_Int8 > SAL_CALL BasicIDEController::getImplementationId() throw(RuntimeException)
107 {
108 	static ::cppu::OImplementationId * pId = 0;
109 	if ( !pId )
110 	{
111 		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
112 		if ( !pId )
113 		{
114 			static ::cppu::OImplementationId aId;
115 			pId = &aId;
116 		}
117 	}
118 	return pId->getImplementationId();
119 }
120 
121 // XPropertySet
122 //----------------------------------------------------------------------------
123 
getPropertySetInfo()124 Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySetInfo() throw(RuntimeException)
125 {
126 	Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
127 	return xInfo;
128 }
129 
130 // OPropertySetHelper
131 //----------------------------------------------------------------------------
132 
getInfoHelper()133 ::cppu::IPropertyArrayHelper& BasicIDEController::getInfoHelper()
134 {
135 	return *getArrayHelper();
136 }
137 
138 // OPropertyArrayUsageHelper
139 //----------------------------------------------------------------------------
140 
createArrayHelper() const141 ::cppu::IPropertyArrayHelper* BasicIDEController::createArrayHelper( ) const
142 {
143     Sequence< Property > aProps;
144 	describeProperties( aProps );
145     return new ::cppu::OPropertyArrayHelper( aProps );
146 }
147 
148 //----------------------------------------------------------------------------
149