merge the formfield patch from ooo-build
[ooovba.git] / canvas / source / directx / dx_spritedevicehelper.hxx
blobdc8ac76c4cd6827793732e65b8b053292d87b8df
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dx_spritedevicehelper.hxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DXCANVAS_SPRITEDEVICEHELPER_HXX
32 #define _DXCANVAS_SPRITEDEVICEHELPER_HXX
34 #include <com/sun/star/awt/Rectangle.hpp>
35 #include <com/sun/star/rendering/XGraphicDevice.hpp>
36 #include <com/sun/star/rendering/XBufferController.hpp>
38 #include "dx_rendermodule.hxx"
39 #include "dx_surfacebitmap.hxx"
40 #include "dx_devicehelper.hxx"
42 #include <canvas/rendering/isurfaceproxymanager.hxx>
44 #include <boost/utility.hpp>
47 namespace dxcanvas
49 class SpriteCanvas;
50 class SpriteCanvasHelper;
52 class SpriteDeviceHelper : public DeviceHelper
54 public:
55 SpriteDeviceHelper();
57 void init( Window& rWindow,
58 SpriteCanvas& rSpriteCanvas,
59 const ::com::sun::star::awt::Rectangle& rRect,
60 bool bFullscreen );
62 /// Dispose all internal references
63 void disposing();
65 // partial override XWindowGraphicDevice
66 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap(
67 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
68 const ::com::sun::star::geometry::IntegerSize2D& size );
69 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap(
70 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
71 const ::com::sun::star::geometry::IntegerSize2D& size );
72 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap(
73 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
74 const ::com::sun::star::geometry::IntegerSize2D& size );
75 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
76 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
77 const ::com::sun::star::geometry::IntegerSize2D& size );
79 sal_Bool hasFullScreenMode( );
80 sal_Bool enterFullScreenMode( sal_Bool bEnter );
82 ::sal_Int32 createBuffers( ::sal_Int32 nBuffers );
83 void destroyBuffers( );
84 ::sal_Bool showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll );
85 ::sal_Bool switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll );
87 const IDXRenderModuleSharedPtr& getRenderModule() const { return mpRenderModule; }
88 const DXSurfaceBitmapSharedPtr& getBackBuffer() const { return mpBackBuffer; }
89 const ::canvas::ISurfaceProxyManagerSharedPtr &getSurfaceProxy() const { return mpSurfaceProxyManager; }
91 ::com::sun::star::uno::Any isAccelerated() const;
93 void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
95 /** called when DumpScreenContent property is enabled on
96 XGraphicDevice, and writes out bitmaps of current screen.
98 void dumpScreenContent() const;
100 private:
101 void resizeBackBuffer( const ::basegfx::B2ISize& rNewSize );
102 HWND getHwnd() const;
104 /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
105 SpriteCanvas* mpSpriteCanvas;
107 DXSurfaceBitmapSharedPtr mpBackBuffer;
109 /// Instance passing out HW textures
110 ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxyManager;
112 /// Our encapsulation interface to DirectX
113 IDXRenderModuleSharedPtr mpRenderModule;
117 #endif /* _DXCANVAS_SPRITEDEVICEHELPER_HXX */