1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_vcl.hxx" 30*cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 31*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include <vcl/svapp.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 40*cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #include <vector> 43*cdf0e10cSrcweir #include <tools/debug.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir using ::rtl::OUString; 47*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 48*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 49*cdf0e10cSrcweir using namespace ::com::sun::star::container; 50*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir // ----------------------------------------------------------------------- 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir namespace vcl 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class DisplayInfo : public ::cppu::WeakAggImplHelper3< XPropertySet, XPropertySetInfo, XServiceInfo > 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir public: 60*cdf0e10cSrcweir DisplayInfo( sal_uInt32 nDisplay ); 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir // XPropertySet 63*cdf0e10cSrcweir virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (RuntimeException); 64*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException); 65*cdf0e10cSrcweir virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 66*cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 67*cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 68*cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 69*cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir // XPropertySetInfo 72*cdf0e10cSrcweir virtual Sequence< Property > SAL_CALL getProperties( ) throw (RuntimeException); 73*cdf0e10cSrcweir virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException); 74*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir // XServiceInfo 77*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); 78*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); 79*cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir private: 82*cdf0e10cSrcweir sal_uInt32 mnDisplay; 83*cdf0e10cSrcweir }; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir static const char* pScreenAreaName = "ScreenArea"; 86*cdf0e10cSrcweir static const char* pWorkAreaName = "WorkArea"; 87*cdf0e10cSrcweir static const char* pScreenName = "ScreenName"; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir // -------------------------------------------------------------------- 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir DisplayInfo::DisplayInfo( sal_uInt32 nDisplay ) 92*cdf0e10cSrcweir : mnDisplay( nDisplay ) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir // XPropertySet 97*cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL DisplayInfo::getPropertySetInfo( ) throw (RuntimeException) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir return this; 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir void SAL_CALL DisplayInfo::setPropertyValue( const OUString& /*aPropertyName* */, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir throw PropertyVetoException(); 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir Any SAL_CALL DisplayInfo::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir Rectangle aRect; 110*cdf0e10cSrcweir if( PropertyName.equalsAscii( pScreenAreaName ) ) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir aRect = Application::GetScreenPosSizePixel( mnDisplay ); 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir else if( PropertyName.equalsAscii( pWorkAreaName ) ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir aRect = Application::GetWorkAreaPosSizePixel( mnDisplay ); 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir else if( PropertyName.equalsAscii( pScreenName ) ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir return Any( Application::GetScreenName( mnDisplay ) ); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir else 123*cdf0e10cSrcweir throw UnknownPropertyException(); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir return Any( com::sun::star::awt::Rectangle( aRect.Left(), aRect.Top(), aRect.getWidth(), aRect.getHeight() ) ); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir void SAL_CALL DisplayInfo::addPropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 129*cdf0e10cSrcweir void SAL_CALL DisplayInfo::removePropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 130*cdf0e10cSrcweir void SAL_CALL DisplayInfo::addVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 131*cdf0e10cSrcweir void SAL_CALL DisplayInfo::removeVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir // XPropertySetInfo 134*cdf0e10cSrcweir Sequence< Property > SAL_CALL DisplayInfo::getProperties( ) throw (RuntimeException) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir Sequence< Property > aProps(2); 137*cdf0e10cSrcweir aProps[0] = getPropertyByName( OUString::createFromAscii( pScreenAreaName ) ); 138*cdf0e10cSrcweir aProps[1] = getPropertyByName( OUString::createFromAscii( pWorkAreaName ) ); 139*cdf0e10cSrcweir return aProps; 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir Property SAL_CALL DisplayInfo::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir if( aName.equalsAscii( pScreenAreaName ) || 145*cdf0e10cSrcweir aName.equalsAscii( pWorkAreaName ) ) 146*cdf0e10cSrcweir return Property( aName, 0, ::getCppuType( (::com::sun::star::awt::Rectangle const *)0 ), PropertyAttribute::READONLY ); 147*cdf0e10cSrcweir throw UnknownPropertyException(); 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir ::sal_Bool SAL_CALL DisplayInfo::hasPropertyByName( const OUString& Name ) throw (RuntimeException) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir return Name.equalsAscii( pScreenAreaName ) || 153*cdf0e10cSrcweir Name.equalsAscii( pWorkAreaName ); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir // XServiceInfo 157*cdf0e10cSrcweir OUString SAL_CALL DisplayInfo::getImplementationName( ) throw (RuntimeException) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir static OUString aImplementationName( RTL_CONSTASCII_USTRINGPARAM( "vcl::DisplayInfo" ) ); 160*cdf0e10cSrcweir return aImplementationName; 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir ::sal_Bool SAL_CALL DisplayInfo::supportsService( const OUString& ServiceName ) throw (RuntimeException) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir Sequence< OUString > aSN( getSupportedServiceNames() ); 166*cdf0e10cSrcweir for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir if( aSN[nService] == ServiceName ) 169*cdf0e10cSrcweir return sal_True; 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir return sal_False; 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir Sequence< OUString > SAL_CALL DisplayInfo::getSupportedServiceNames( ) throw (RuntimeException) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayInfo" ) ); 177*cdf0e10cSrcweir static Sequence< OUString > aServiceNames( &aServiceName, 1 ); 178*cdf0e10cSrcweir return aServiceNames; 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir // ==================================================================== 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir class DisplayAccess : public ::cppu::WeakAggImplHelper4< XPropertySet, XPropertySetInfo, XIndexAccess, XServiceInfo > 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir public: 186*cdf0e10cSrcweir DisplayAccess (); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir // XPropertySet 189*cdf0e10cSrcweir virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (RuntimeException); 190*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException); 191*cdf0e10cSrcweir virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 192*cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 193*cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 194*cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 195*cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir // XPropertySetInfo 198*cdf0e10cSrcweir virtual Sequence< Property > SAL_CALL getProperties( ) throw (RuntimeException); 199*cdf0e10cSrcweir virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException); 200*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir // XIndexAccess 203*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getCount() throw (RuntimeException); 204*cdf0e10cSrcweir virtual Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException); 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir // XElementAccess 207*cdf0e10cSrcweir virtual Type SAL_CALL getElementType( ) throw (RuntimeException); 208*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir // XServiceInfo 211*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); 212*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); 213*cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); 214*cdf0e10cSrcweir }; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir Sequence< OUString > DisplayAccess_getSupportedServiceNames() 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ); 219*cdf0e10cSrcweir static Sequence< OUString > aServiceNames( &aServiceName, 1 ); 220*cdf0e10cSrcweir return aServiceNames; 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir OUString DisplayAccess_getImplementationName() 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "vcl::DisplayAccess" ) ); 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory >& ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir return static_cast< ::cppu::OWeakObject * >( new DisplayAccess ); 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir DisplayAccess::DisplayAccess() 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir static const char* pMultiDisplayName = "MultiDisplay"; 238*cdf0e10cSrcweir static const char* pDefaultDisplayName = "DefaultDisplay"; 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir // XPropertySet 241*cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL DisplayAccess::getPropertySetInfo( ) throw (RuntimeException) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir return this; 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir void SAL_CALL DisplayAccess::setPropertyValue( const OUString& /*aPropertyName* */, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir throw PropertyVetoException(); 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir Any SAL_CALL DisplayAccess::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir Any aRet; 254*cdf0e10cSrcweir if( PropertyName.equalsAscii( pMultiDisplayName ) ) 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir aRet <<= sal_Bool( Application::IsMultiDisplay() ); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir else if( PropertyName.equalsAscii( pDefaultDisplayName ) ) 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir aRet <<= sal_Int32( Application::GetDefaultDisplayNumber() ); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir else 263*cdf0e10cSrcweir throw UnknownPropertyException(); 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir return aRet; 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir void SAL_CALL DisplayAccess::addPropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 269*cdf0e10cSrcweir void SAL_CALL DisplayAccess::removePropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 270*cdf0e10cSrcweir void SAL_CALL DisplayAccess::addVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 271*cdf0e10cSrcweir void SAL_CALL DisplayAccess::removeVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {} 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir // XPropertySetInfo 274*cdf0e10cSrcweir Sequence< Property > SAL_CALL DisplayAccess::getProperties( ) throw (RuntimeException) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir Sequence< Property > aProps(2); 277*cdf0e10cSrcweir aProps[0] = getPropertyByName( OUString::createFromAscii( pMultiDisplayName ) ); 278*cdf0e10cSrcweir aProps[1] = getPropertyByName( OUString::createFromAscii( pDefaultDisplayName ) ); 279*cdf0e10cSrcweir return aProps; 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir Property SAL_CALL DisplayAccess::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir if( aName.equalsAscii( pMultiDisplayName ) ) 285*cdf0e10cSrcweir return Property( aName, 0, ::getCppuType( (sal_Bool const *)0 ), PropertyAttribute::READONLY ); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir if( aName.equalsAscii( pDefaultDisplayName ) ) 288*cdf0e10cSrcweir return Property( aName, 0, ::getCppuType( (sal_Int32 const *)0 ), PropertyAttribute::READONLY ); 289*cdf0e10cSrcweir throw UnknownPropertyException(); 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir ::sal_Bool SAL_CALL DisplayAccess::hasPropertyByName( const OUString& Name ) throw (RuntimeException) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir return Name.equalsAscii( pMultiDisplayName ) || 295*cdf0e10cSrcweir Name.equalsAscii( pDefaultDisplayName ); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir // XIndexAccess 299*cdf0e10cSrcweir ::sal_Int32 SAL_CALL DisplayAccess::getCount() throw (RuntimeException) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir return Application::GetScreenCount(); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir Any SAL_CALL DisplayAccess::getByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir if( (Index < 0) || (Index >= getCount()) ) 307*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir return makeAny( Reference< XPropertySet >( new DisplayInfo( Index ) ) ); 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir // XElementAccess 313*cdf0e10cSrcweir Type SAL_CALL DisplayAccess::getElementType( ) throw (RuntimeException) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir return XPropertySet::static_type(); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir ::sal_Bool SAL_CALL DisplayAccess::hasElements() throw (RuntimeException) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir return true; 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir // XServiceInfo 324*cdf0e10cSrcweir OUString SAL_CALL DisplayAccess::getImplementationName( ) throw (RuntimeException) 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir return DisplayAccess_getImplementationName(); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir ::sal_Bool SAL_CALL DisplayAccess::supportsService( const OUString& ServiceName ) throw (RuntimeException) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir Sequence< OUString > aSN( DisplayAccess_getSupportedServiceNames() ); 332*cdf0e10cSrcweir for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir if( aSN[nService] == ServiceName ) 335*cdf0e10cSrcweir return sal_True; 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir return sal_False; 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir Sequence< OUString > SAL_CALL DisplayAccess::getSupportedServiceNames( ) throw (RuntimeException) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir return DisplayAccess_getSupportedServiceNames(); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir } // namespace vcl 346