191c99ff4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
391c99ff4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
491c99ff4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
591c99ff4SAndrew Rist  * distributed with this work for additional information
691c99ff4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
791c99ff4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
891c99ff4SAndrew Rist  * "License"); you may not use this file except in compliance
991c99ff4SAndrew Rist  * with the License.  You may obtain a copy of the License at
1091c99ff4SAndrew Rist  *
1191c99ff4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1291c99ff4SAndrew Rist  *
1391c99ff4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1491c99ff4SAndrew Rist  * software distributed under the License is distributed on an
1591c99ff4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1691c99ff4SAndrew Rist  * KIND, either express or implied.  See the License for the
1791c99ff4SAndrew Rist  * specific language governing permissions and limitations
1891c99ff4SAndrew Rist  * under the License.
1991c99ff4SAndrew Rist  *
2091c99ff4SAndrew Rist  *************************************************************/
2191c99ff4SAndrew Rist 
2291c99ff4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX
25cdf0e10cSrcweir #define INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <rtl/ref.hxx>
28cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
31cdf0e10cSrcweir #include <com/sun/star/util/XUpdatable.hpp>
32cdf0e10cSrcweir #include <com/sun/star/rendering/XGraphicDevice.hpp>
33cdf0e10cSrcweir #include <com/sun/star/rendering/XColorSpace.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <canvas/parametricpolypolygon.hxx>
36cdf0e10cSrcweir #include <canvas/propertysethelper.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir /* Definition of GraphicDeviceBase class */
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace canvas
42cdf0e10cSrcweir {
43cdf0e10cSrcweir     /** Helper template base class for XGraphicDevice implementations.
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     	This base class provides partial implementations of the
46cdf0e10cSrcweir     	XGraphicDevice-related interface, such as XColorSpace.
47cdf0e10cSrcweir 
48cdf0e10cSrcweir         This template basically interposes itself between the full
49cdf0e10cSrcweir         interface you implement (i.e. not restricted to XGraphicDevice
50cdf0e10cSrcweir         etc.). The problem with UNO partial interface implementation
51cdf0e10cSrcweir         actually is, that you cannot do it the plain way, since
52cdf0e10cSrcweir         deriving from a common base subclass always introduces the
53cdf0e10cSrcweir         whole set of pure virtuals, that your baseclass helper just
54cdf0e10cSrcweir         overrided) and your implementation class. You then only have
55cdf0e10cSrcweir         to implement the functionality <em>besides</em>
56cdf0e10cSrcweir         XGraphicDevice. If you want to support the optional debug
57cdf0e10cSrcweir         XUpdatable interface, also add that to the base classes
58cdf0e10cSrcweir         (client code will call the corresponding update() method,
59cdf0e10cSrcweir         whenever a burst of animations is over).
60cdf0e10cSrcweir 
61cdf0e10cSrcweir         <pre>
62cdf0e10cSrcweir         Example:
63cdf0e10cSrcweir         typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::rendering::XGraphicDevice,
64cdf0e10cSrcweir         										  ::com::sun::star::rendering::XColorSpace,
65cdf0e10cSrcweir         										  ::com::sun::star::rendering::XPropertySet,
66cdf0e10cSrcweir                                                   ::com::sun::star::lang::XServiceInfo,
67cdf0e10cSrcweir                                                   ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
68cdf0e10cSrcweir 	    typedef ::canvas::internal::GraphicDeviceBase< GraphicDeviceBase, DeviceHelper > ExampleDevice_Base;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	    class ExampleDevice : public ExampleDevice_Base
71cdf0e10cSrcweir 		{
72cdf0e10cSrcweir 		};
73cdf0e10cSrcweir         </pre>
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         @tpl Base
76cdf0e10cSrcweir         Base class to use, most probably one of the
77cdf0e10cSrcweir         WeakComponentImplHelperN templates with the appropriate
78cdf0e10cSrcweir         interfaces. At least XGraphicDevice should be among them (why else
79cdf0e10cSrcweir         would you use this template, then?). Base class must have an
80cdf0e10cSrcweir         Base( const Mutex& ) constructor (like the
81cdf0e10cSrcweir         WeakComponentImplHelperN templates have). As the very least,
82cdf0e10cSrcweir         the base class must be derived from uno::XInterface, as some
83cdf0e10cSrcweir         error reporting mechanisms rely on that.
84cdf0e10cSrcweir 
85cdf0e10cSrcweir         @tpl DeviceHelper
86cdf0e10cSrcweir         Device helper implementation for the backend in question. This
87cdf0e10cSrcweir         object will be held as a member of this template class, and
88cdf0e10cSrcweir         basically gets forwarded all XGraphicDevice API calls that
89cdf0e10cSrcweir         could not be handled generically.
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         @tpl Mutex
92cdf0e10cSrcweir         Lock strategy to use. Defaults to using the
93*07a3d7f1SPedro Giffuni         BaseMutexHelper-provided lock.  Every time one of the methods is
94cdf0e10cSrcweir         entered, an object of type Mutex is created with m_aMutex as
95cdf0e10cSrcweir         the sole parameter, and destroyed again when the method scope
96cdf0e10cSrcweir         is left.
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         @tpl UnambiguousBase
99cdf0e10cSrcweir         Optional unambiguous base class for XInterface of Base. It's
100cdf0e10cSrcweir         sometimes necessary to specify this parameter, e.g. if Base
101cdf0e10cSrcweir         derives from multiple UNO interface (were each provides its
102cdf0e10cSrcweir         own version of XInterface, making the conversion ambiguous)
103cdf0e10cSrcweir      */
104cdf0e10cSrcweir     template< class Base,
105cdf0e10cSrcweir               class DeviceHelper,
106cdf0e10cSrcweir               class Mutex=::osl::MutexGuard,
107cdf0e10cSrcweir               class UnambiguousBase=::com::sun::star::uno::XInterface > class GraphicDeviceBase :
108cdf0e10cSrcweir         public Base
109cdf0e10cSrcweir     {
110cdf0e10cSrcweir     public:
111cdf0e10cSrcweir         typedef Base 			  BaseType;
112cdf0e10cSrcweir         typedef DeviceHelper	  DeviceHelperType;
113cdf0e10cSrcweir         typedef Mutex			  MutexType;
114cdf0e10cSrcweir         typedef UnambiguousBase	  UnambiguousBaseType;
115cdf0e10cSrcweir         typedef GraphicDeviceBase ThisType;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir         typedef ::rtl::Reference< GraphicDeviceBase > Reference;
118cdf0e10cSrcweir 
GraphicDeviceBase()119cdf0e10cSrcweir         GraphicDeviceBase() :
120cdf0e10cSrcweir             maDeviceHelper(),
121cdf0e10cSrcweir             maPropHelper(),
122cdf0e10cSrcweir             mbDumpScreenContent(false)
123cdf0e10cSrcweir         {
124cdf0e10cSrcweir             maPropHelper.initProperties( PropertySetHelper::MakeMap
125cdf0e10cSrcweir                                          ("HardwareAcceleration",
126cdf0e10cSrcweir                                           boost::bind(&DeviceHelper::isAccelerated,
127cdf0e10cSrcweir                                                       boost::ref(maDeviceHelper)))
128cdf0e10cSrcweir                                          ("DeviceHandle",
129cdf0e10cSrcweir                                           boost::bind(&DeviceHelper::getDeviceHandle,
130cdf0e10cSrcweir                                                       boost::ref(maDeviceHelper)))
131cdf0e10cSrcweir                                          ("SurfaceHandle",
132cdf0e10cSrcweir                                           boost::bind(&DeviceHelper::getSurfaceHandle,
133cdf0e10cSrcweir                                                       boost::ref(maDeviceHelper)))
134cdf0e10cSrcweir                                          ("DumpScreenContent",
135cdf0e10cSrcweir                                           boost::bind(&ThisType::getDumpScreenContent,
136cdf0e10cSrcweir                                                       this),
137cdf0e10cSrcweir                                           boost::bind(&ThisType::setDumpScreenContent,
138cdf0e10cSrcweir                                                       this,
139cdf0e10cSrcweir                                                       _1)));
140cdf0e10cSrcweir         }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir #if defined __SUNPRO_CC
143cdf0e10cSrcweir         using Base::disposing;
144cdf0e10cSrcweir #endif
disposing()145cdf0e10cSrcweir         virtual void SAL_CALL disposing()
146cdf0e10cSrcweir         {
147cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
148cdf0e10cSrcweir 
149cdf0e10cSrcweir             maDeviceHelper.disposing();
150cdf0e10cSrcweir 
151cdf0e10cSrcweir             // pass on to base class
152cdf0e10cSrcweir             cppu::WeakComponentImplHelperBase::disposing();
153cdf0e10cSrcweir         }
154cdf0e10cSrcweir 
155cdf0e10cSrcweir         // XGraphicDevice
getBufferController()156cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController > SAL_CALL getBufferController(  ) throw (::com::sun::star::uno::RuntimeException)
157cdf0e10cSrcweir         {
158cdf0e10cSrcweir             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController >();
159cdf0e10cSrcweir         }
160cdf0e10cSrcweir 
getDeviceColorSpace()161cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getDeviceColorSpace(  ) throw (::com::sun::star::uno::RuntimeException)
162cdf0e10cSrcweir         {
163cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir             return maDeviceHelper.getColorSpace();
166cdf0e10cSrcweir         }
167cdf0e10cSrcweir 
getPhysicalResolution()168cdf0e10cSrcweir         virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalResolution(  ) throw (::com::sun::star::uno::RuntimeException)
169cdf0e10cSrcweir         {
170cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
171cdf0e10cSrcweir 
172cdf0e10cSrcweir             return maDeviceHelper.getPhysicalResolution();
173cdf0e10cSrcweir         }
174cdf0e10cSrcweir 
getPhysicalSize()175cdf0e10cSrcweir         virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalSize(  ) throw (::com::sun::star::uno::RuntimeException)
176cdf0e10cSrcweir         {
177cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
178cdf0e10cSrcweir 
179cdf0e10cSrcweir             return maDeviceHelper.getPhysicalSize();
180cdf0e10cSrcweir         }
181cdf0e10cSrcweir 
createCompatibleLinePolyPolygon(const::com::sun::star::uno::Sequence<::com::sun::star::uno::Sequence<::com::sun::star::geometry::RealPoint2D>> & points)182cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > SAL_CALL createCompatibleLinePolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ) throw (::com::sun::star::uno::RuntimeException)
183cdf0e10cSrcweir         {
184cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir             return maDeviceHelper.createCompatibleLinePolyPolygon( this, points );
187cdf0e10cSrcweir         }
188cdf0e10cSrcweir 
createCompatibleBezierPolyPolygon(const::com::sun::star::uno::Sequence<::com::sun::star::uno::Sequence<::com::sun::star::geometry::RealBezierSegment2D>> & points)189cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > SAL_CALL createCompatibleBezierPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ) throw (::com::sun::star::uno::RuntimeException)
190cdf0e10cSrcweir         {
191cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
192cdf0e10cSrcweir 
193cdf0e10cSrcweir             return maDeviceHelper.createCompatibleBezierPolyPolygon( this, points );
194cdf0e10cSrcweir         }
195cdf0e10cSrcweir 
createCompatibleBitmap(const::com::sun::star::geometry::IntegerSize2D & size)196cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
197cdf0e10cSrcweir                                                                                                                                                                                          ::com::sun::star::uno::RuntimeException)
198cdf0e10cSrcweir         {
199cdf0e10cSrcweir             tools::verifyBitmapSize(size,
200cdf0e10cSrcweir                                     BOOST_CURRENT_FUNCTION,
201cdf0e10cSrcweir                                     static_cast< UnambiguousBaseType* >(this));
202cdf0e10cSrcweir 
203cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir             return maDeviceHelper.createCompatibleBitmap( this, size );
206cdf0e10cSrcweir         }
207cdf0e10cSrcweir 
createVolatileBitmap(const::com::sun::star::geometry::IntegerSize2D & size)208cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
209cdf0e10cSrcweir                                                                                                                                                                                                ::com::sun::star::uno::RuntimeException)
210cdf0e10cSrcweir         {
211cdf0e10cSrcweir             tools::verifyBitmapSize(size,
212cdf0e10cSrcweir                                     BOOST_CURRENT_FUNCTION,
213cdf0e10cSrcweir                                     static_cast< UnambiguousBaseType* >(this));
214cdf0e10cSrcweir 
215cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir             return maDeviceHelper.createVolatileBitmap( this, size );
218cdf0e10cSrcweir         }
219cdf0e10cSrcweir 
createCompatibleAlphaBitmap(const::com::sun::star::geometry::IntegerSize2D & size)220cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
221cdf0e10cSrcweir                                                                                                                                                                                               ::com::sun::star::uno::RuntimeException)
222cdf0e10cSrcweir         {
223cdf0e10cSrcweir             tools::verifyBitmapSize(size,
224cdf0e10cSrcweir                                     BOOST_CURRENT_FUNCTION,
225cdf0e10cSrcweir                                     static_cast< UnambiguousBaseType* >(this));
226cdf0e10cSrcweir 
227cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
228cdf0e10cSrcweir 
229cdf0e10cSrcweir             return maDeviceHelper.createCompatibleAlphaBitmap( this, size );
230cdf0e10cSrcweir         }
231cdf0e10cSrcweir 
createVolatileAlphaBitmap(const::com::sun::star::geometry::IntegerSize2D & size)232cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
233cdf0e10cSrcweir                                                                                                                                                                                                     ::com::sun::star::uno::RuntimeException)
234cdf0e10cSrcweir         {
235cdf0e10cSrcweir             tools::verifyBitmapSize(size,
236cdf0e10cSrcweir                                     BOOST_CURRENT_FUNCTION,
237cdf0e10cSrcweir                                     static_cast< UnambiguousBaseType* >(this));
238cdf0e10cSrcweir 
239cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
240cdf0e10cSrcweir 
241cdf0e10cSrcweir             return maDeviceHelper.createVolatileAlphaBitmap( this, size );
242cdf0e10cSrcweir         }
243cdf0e10cSrcweir 
getParametricPolyPolygonFactory()244cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory(  ) throw (::com::sun::star::uno::RuntimeException)
245cdf0e10cSrcweir         {
246cdf0e10cSrcweir             return this;
247cdf0e10cSrcweir         }
248cdf0e10cSrcweir 
hasFullScreenMode()249cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL hasFullScreenMode(  ) throw (::com::sun::star::uno::RuntimeException)
250cdf0e10cSrcweir         {
251cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
252cdf0e10cSrcweir 
253cdf0e10cSrcweir             return maDeviceHelper.hasFullScreenMode();
254cdf0e10cSrcweir         }
255cdf0e10cSrcweir 
enterFullScreenMode(::sal_Bool bEnter)256cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL enterFullScreenMode( ::sal_Bool bEnter ) throw (::com::sun::star::uno::RuntimeException)
257cdf0e10cSrcweir         {
258cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir             return maDeviceHelper.enterFullScreenMode( bEnter );
261cdf0e10cSrcweir         }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir         // XMultiServiceFactory
createInstance(const::rtl::OUString & aServiceSpecifier)264cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
265cdf0e10cSrcweir         {
266cdf0e10cSrcweir             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
267cdf0e10cSrcweir                 ParametricPolyPolygon::create(this,
268cdf0e10cSrcweir                                               aServiceSpecifier,
269cdf0e10cSrcweir                                               ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >()));
270cdf0e10cSrcweir         }
271cdf0e10cSrcweir 
createInstanceWithArguments(const::rtl::OUString & aServiceSpecifier,const::com::sun::star::uno::Sequence<::com::sun::star::uno::Any> & Arguments)272cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
273cdf0e10cSrcweir         {
274cdf0e10cSrcweir             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
275cdf0e10cSrcweir                 ParametricPolyPolygon::create(this,
276cdf0e10cSrcweir                                               aServiceSpecifier,
277cdf0e10cSrcweir                                               Arguments));
278cdf0e10cSrcweir         }
279cdf0e10cSrcweir 
getAvailableServiceNames()280cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames(  ) throw (::com::sun::star::uno::RuntimeException)
281cdf0e10cSrcweir         {
282cdf0e10cSrcweir             return ParametricPolyPolygon::getAvailableServiceNames();
283cdf0e10cSrcweir         }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 
286cdf0e10cSrcweir         // XUpdatable
update()287cdf0e10cSrcweir         virtual void SAL_CALL update() throw (com::sun::star::uno::RuntimeException)
288cdf0e10cSrcweir         {
289cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
290cdf0e10cSrcweir 
291cdf0e10cSrcweir             if( mbDumpScreenContent )
292cdf0e10cSrcweir                 maDeviceHelper.dumpScreenContent();
293cdf0e10cSrcweir         }
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 
296cdf0e10cSrcweir         // XPropertySet
getPropertySetInfo()297cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException)
298cdf0e10cSrcweir         {
299cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
300cdf0e10cSrcweir             return maPropHelper.getPropertySetInfo();
301cdf0e10cSrcweir         }
302cdf0e10cSrcweir 
setPropertyValue(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Any & aValue)303cdf0e10cSrcweir         virtual void SAL_CALL setPropertyValue( const ::rtl::OUString&            aPropertyName,
304cdf0e10cSrcweir                                                 const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException,
305cdf0e10cSrcweir                                                                                                   ::com::sun::star::beans::PropertyVetoException,
306cdf0e10cSrcweir                                                                                                   ::com::sun::star::lang::IllegalArgumentException,
307cdf0e10cSrcweir                                                                                                   ::com::sun::star::lang::WrappedTargetException,
308cdf0e10cSrcweir                                                                                                   ::com::sun::star::uno::RuntimeException)
309cdf0e10cSrcweir         {
310cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
311cdf0e10cSrcweir             maPropHelper.setPropertyValue( aPropertyName, aValue );
312cdf0e10cSrcweir         }
313cdf0e10cSrcweir 
getPropertyValue(const::rtl::OUString & aPropertyName)314cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException,
315cdf0e10cSrcweir                                                                                                                     ::com::sun::star::lang::WrappedTargetException,
316cdf0e10cSrcweir                                                                                                                     ::com::sun::star::uno::RuntimeException)
317cdf0e10cSrcweir         {
318cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
319cdf0e10cSrcweir             return maPropHelper.getPropertyValue( aPropertyName );
320cdf0e10cSrcweir         }
321cdf0e10cSrcweir 
addPropertyChangeListener(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertyChangeListener> & xListener)322cdf0e10cSrcweir         virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
323cdf0e10cSrcweir                                                          const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
324cdf0e10cSrcweir                                                                                                                                                                         ::com::sun::star::lang::WrappedTargetException,
325cdf0e10cSrcweir                                                                                                                                                                         ::com::sun::star::uno::RuntimeException)
326cdf0e10cSrcweir         {
327cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
328cdf0e10cSrcweir             maPropHelper.addPropertyChangeListener( aPropertyName,
329cdf0e10cSrcweir                                                     xListener );
330cdf0e10cSrcweir         }
331cdf0e10cSrcweir 
removePropertyChangeListener(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertyChangeListener> & xListener)332cdf0e10cSrcweir         virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
333cdf0e10cSrcweir                                                             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
334cdf0e10cSrcweir                                                                                                                                                                            ::com::sun::star::lang::WrappedTargetException,
335cdf0e10cSrcweir                                                                                                                                                                            ::com::sun::star::uno::RuntimeException)
336cdf0e10cSrcweir         {
337cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
338cdf0e10cSrcweir             maPropHelper.removePropertyChangeListener( aPropertyName,
339cdf0e10cSrcweir                                                        xListener );
340cdf0e10cSrcweir         }
341cdf0e10cSrcweir 
addVetoableChangeListener(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XVetoableChangeListener> & xListener)342cdf0e10cSrcweir         virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& aPropertyName,
343cdf0e10cSrcweir                                                          const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
344cdf0e10cSrcweir                                                                                                                                                                         ::com::sun::star::lang::WrappedTargetException,
345cdf0e10cSrcweir                                                                                                                                                                         ::com::sun::star::uno::RuntimeException)
346cdf0e10cSrcweir         {
347cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
348cdf0e10cSrcweir             maPropHelper.addVetoableChangeListener( aPropertyName,
349cdf0e10cSrcweir                                                     xListener );
350cdf0e10cSrcweir         }
351cdf0e10cSrcweir 
removeVetoableChangeListener(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XVetoableChangeListener> & xListener)352cdf0e10cSrcweir         virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& aPropertyName,
353cdf0e10cSrcweir                                                             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
354cdf0e10cSrcweir                                                                                                                                                                            ::com::sun::star::lang::WrappedTargetException,
355cdf0e10cSrcweir                                                                                                                                                                            ::com::sun::star::uno::RuntimeException)
356cdf0e10cSrcweir         {
357cdf0e10cSrcweir             MutexType aGuard( BaseType::m_aMutex );
358cdf0e10cSrcweir             maPropHelper.removeVetoableChangeListener( aPropertyName,
359cdf0e10cSrcweir                                                        xListener );
360cdf0e10cSrcweir         }
361cdf0e10cSrcweir 
362cdf0e10cSrcweir     protected:
~GraphicDeviceBase()363cdf0e10cSrcweir         ~GraphicDeviceBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
364cdf0e10cSrcweir 
getDumpScreenContent() const365cdf0e10cSrcweir         ::com::sun::star::uno::Any getDumpScreenContent() const
366cdf0e10cSrcweir         {
367cdf0e10cSrcweir             return ::com::sun::star::uno::makeAny( mbDumpScreenContent );
368cdf0e10cSrcweir         }
369cdf0e10cSrcweir 
setDumpScreenContent(const::com::sun::star::uno::Any & rAny)370cdf0e10cSrcweir         void setDumpScreenContent( const ::com::sun::star::uno::Any& rAny )
371cdf0e10cSrcweir         {
372cdf0e10cSrcweir             // TODO(Q1): this was mbDumpScreenContent =
373cdf0e10cSrcweir             // rAny.get<bool>(), only that gcc3.3 wouldn't eat it
374cdf0e10cSrcweir             rAny >>= mbDumpScreenContent;
375cdf0e10cSrcweir         }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir         DeviceHelperType  maDeviceHelper;
378cdf0e10cSrcweir         PropertySetHelper maPropHelper;
379cdf0e10cSrcweir         bool              mbDumpScreenContent;
380cdf0e10cSrcweir 
381cdf0e10cSrcweir     private:
382cdf0e10cSrcweir         GraphicDeviceBase( const GraphicDeviceBase& );
383cdf0e10cSrcweir         GraphicDeviceBase& operator=( const GraphicDeviceBase& );
384cdf0e10cSrcweir     };
385cdf0e10cSrcweir }
386cdf0e10cSrcweir 
387cdf0e10cSrcweir #endif /* INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX */
388