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