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 #ifndef _TOOLKIT_AWT_VCLXREGION_HXX_ 25 #define _TOOLKIT_AWT_VCLXREGION_HXX_ 26 27 28 #include <com/sun/star/awt/XRegion.hpp> 29 #include <com/sun/star/lang/XTypeProvider.hpp> 30 #include <com/sun/star/lang/XUnoTunnel.hpp> 31 #include <cppuhelper/weak.hxx> 32 #include <osl/mutex.hxx> 33 34 #include <vcl/region.hxx> 35 36 // ---------------------------------------------------- 37 // class VCLXRegion 38 // ---------------------------------------------------- 39 40 class VCLXRegion : public ::com::sun::star::awt::XRegion, 41 public ::com::sun::star::lang::XTypeProvider, 42 public ::com::sun::star::lang::XUnoTunnel, 43 public ::cppu::OWeakObject 44 { 45 private: 46 ::osl::Mutex maMutex; 47 Region maRegion; 48 49 protected: GetMutex()50 ::osl::Mutex& GetMutex() { return maMutex; } 51 52 public: 53 VCLXRegion(); 54 ~VCLXRegion(); 55 SetRegion(const Region & rRegion)56 void SetRegion( const Region& rRegion ) { maRegion = rRegion; } GetRegion() const57 const Region& GetRegion() const { return maRegion; } 58 59 // ::com::sun::star::uno::XInterface 60 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); acquire()61 void SAL_CALL acquire() throw() { OWeakObject::acquire(); } release()62 void SAL_CALL release() throw() { OWeakObject::release(); } 63 64 // ::com::sun::star::lang::XUnoTunnel 65 static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); 66 static VCLXRegion* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); 67 sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); 68 69 // ::com::sun::star::lang::XTypeProvider 70 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); 71 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); 72 73 // ::com::sun::star::awt::XRegion 74 ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw(::com::sun::star::uno::RuntimeException); 75 void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException); 76 void SAL_CALL move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException); 77 void SAL_CALL unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); 78 void SAL_CALL intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); 79 void SAL_CALL excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); 80 void SAL_CALL xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); 81 void SAL_CALL unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); 82 void SAL_CALL intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); 83 void SAL_CALL excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); 84 void SAL_CALL xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); 85 ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > SAL_CALL getRectangles() throw(::com::sun::star::uno::RuntimeException); 86 87 }; 88 89 90 91 #endif // _TOOLKIT_AWT_VCLXREGION_HXX_ 92 93