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 #ifndef _DXCANVAS_DEVICEHELPER_HXX 29 #define _DXCANVAS_DEVICEHELPER_HXX 30 31 #include <com/sun/star/awt/Rectangle.hpp> 32 #include <com/sun/star/rendering/XGraphicDevice.hpp> 33 #include <com/sun/star/rendering/XBufferController.hpp> 34 35 #include "dx_rendermodule.hxx" 36 #include "dx_bitmap.hxx" 37 38 #include <canvas/rendering/isurfaceproxymanager.hxx> 39 40 #include <boost/utility.hpp> 41 42 43 /* Definition of DeviceHelper class */ 44 45 namespace dxcanvas 46 { 47 class DeviceHelper : private ::boost::noncopyable 48 { 49 public: 50 DeviceHelper(); 51 52 /** Init the device helper 53 54 @param hdc 55 private or class dc of the output device. is only stored, 56 not release 57 58 @param rDevice 59 Ref back to owning UNO device 60 */ 61 void init( HDC hdc, 62 com::sun::star::rendering::XGraphicDevice& rDevice ); 63 64 /// Dispose all internal references 65 void disposing(); 66 67 // XWindowGraphicDevice 68 ::com::sun::star::geometry::RealSize2D getPhysicalResolution(); 69 ::com::sun::star::geometry::RealSize2D getPhysicalSize(); 70 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon( 71 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 72 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ); 73 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon( 74 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 75 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ); 76 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap( 77 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 78 const ::com::sun::star::geometry::IntegerSize2D& size ); 79 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap( 80 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 81 const ::com::sun::star::geometry::IntegerSize2D& size ); 82 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap( 83 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 84 const ::com::sun::star::geometry::IntegerSize2D& size ); 85 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap( 86 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, 87 const ::com::sun::star::geometry::IntegerSize2D& size ); 88 89 sal_Bool hasFullScreenMode(); 90 sal_Bool enterFullScreenMode( sal_Bool bEnter ); 91 92 ::com::sun::star::uno::Any isAccelerated() const; 93 ::com::sun::star::uno::Any getDeviceHandle() const; 94 ::com::sun::star::uno::Any getSurfaceHandle() const; 95 ::com::sun::star::uno::Reference< 96 ::com::sun::star::rendering::XColorSpace > getColorSpace() const; 97 98 /** called when DumpScreenContent property is enabled on 99 XGraphicDevice, and writes out bitmaps of current screen. 100 */ 101 void dumpScreenContent() const {} 102 103 protected: 104 HDC getHDC() const { return mnHDC; } 105 com::sun::star::rendering::XGraphicDevice* getDevice() const { return mpDevice; } 106 107 private: 108 /** Phyical output device 109 110 Deliberately not a refcounted reference, because of 111 potential circular references for canvas. Needed to 112 create bitmaps 113 */ 114 com::sun::star::rendering::XGraphicDevice* mpDevice; 115 HDC mnHDC; 116 }; 117 118 typedef ::rtl::Reference< com::sun::star::rendering::XGraphicDevice > DeviceRef; 119 } 120 121 #endif /* _DXCANVAS_DEVICEHELPER_HXX */ 122