1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_basctl.hxx" 30 31 #ifndef _BASCTL_BASIDECTRLR_HXX_ 32 #include <basidectrlr.hxx> 33 #endif 34 #include <cppuhelper/queryinterface.hxx> 35 #include <comphelper/sequence.hxx> 36 #include <com/sun/star/beans/PropertyAttribute.hpp> 37 38 #include <vcl/syswin.hxx> 39 40 #include <basidesh.hxx> 41 42 43 using namespace com::sun::star; 44 using namespace com::sun::star::uno; 45 using namespace com::sun::star::beans; 46 47 48 #define PROPERTY_ID_ICONID 1 49 #define PROPERTY_ICONID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconId" ) ) 50 51 52 //---------------------------------------------------------------------------- 53 54 BasicIDEController::BasicIDEController( BasicIDEShell* pViewShell ) 55 :OPropertyContainer( m_aBHelper ) 56 ,SfxBaseController( pViewShell ) 57 ,m_nIconId( ICON_MACROLIBRARY ) 58 { 59 registerProperty( PROPERTY_ICONID, PROPERTY_ID_ICONID, PropertyAttribute::READONLY, &m_nIconId, ::getCppuType( &m_nIconId ) ); 60 } 61 62 //---------------------------------------------------------------------------- 63 64 BasicIDEController::~BasicIDEController() 65 { 66 } 67 68 // XInterface 69 //---------------------------------------------------------------------------- 70 71 Any SAL_CALL BasicIDEController::queryInterface( const Type & rType ) throw(RuntimeException) 72 { 73 Any aReturn = SfxBaseController::queryInterface( rType ); 74 if ( !aReturn.hasValue() ) 75 aReturn = OPropertyContainer::queryInterface( rType ); 76 77 return aReturn; 78 } 79 80 //---------------------------------------------------------------------------- 81 82 void SAL_CALL BasicIDEController::acquire() throw() 83 { 84 SfxBaseController::acquire(); 85 } 86 87 //---------------------------------------------------------------------------- 88 89 void SAL_CALL BasicIDEController::release() throw() 90 { 91 SfxBaseController::release(); 92 } 93 94 95 // XTypeProvider ( ::SfxBaseController ) 96 //---------------------------------------------------------------------------- 97 98 Sequence< Type > SAL_CALL BasicIDEController::getTypes() throw(RuntimeException) 99 { 100 Sequence< Type > aTypes = ::comphelper::concatSequences( 101 SfxBaseController::getTypes(), 102 OPropertyContainer::getTypes() 103 ); 104 105 return aTypes; 106 } 107 108 //---------------------------------------------------------------------------- 109 110 Sequence< sal_Int8 > SAL_CALL BasicIDEController::getImplementationId() throw(RuntimeException) 111 { 112 static ::cppu::OImplementationId * pId = 0; 113 if ( !pId ) 114 { 115 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 116 if ( !pId ) 117 { 118 static ::cppu::OImplementationId aId; 119 pId = &aId; 120 } 121 } 122 return pId->getImplementationId(); 123 } 124 125 // XPropertySet 126 //---------------------------------------------------------------------------- 127 128 Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySetInfo() throw(RuntimeException) 129 { 130 Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); 131 return xInfo; 132 } 133 134 // OPropertySetHelper 135 //---------------------------------------------------------------------------- 136 137 ::cppu::IPropertyArrayHelper& BasicIDEController::getInfoHelper() 138 { 139 return *getArrayHelper(); 140 } 141 142 // OPropertyArrayUsageHelper 143 //---------------------------------------------------------------------------- 144 145 ::cppu::IPropertyArrayHelper* BasicIDEController::createArrayHelper( ) const 146 { 147 Sequence< Property > aProps; 148 describeProperties( aProps ); 149 return new ::cppu::OPropertyArrayHelper( aProps ); 150 } 151 152 //---------------------------------------------------------------------------- 153