summaryrefslogtreecommitdiff
path: root/canvas/source/vcl/spritecanvas.hxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-11-02 12:04:27 +0000
committerKurt Zenker <kz@openoffice.org>2005-11-02 12:04:27 +0000
commit0565f6b78e04cdb5828bf9d6abcd369d811da6cd (patch)
tree0a43a94eb357146070c9edae13f6a2a01f8c2db3 /canvas/source/vcl/spritecanvas.hxx
parentaaf62231a75359d356d04ab26fbee69ce8d5d371 (diff)
INTEGRATION: CWS canvas02 (1.7.4); FILE MERGED
2005/10/19 13:47:18 thb 1.7.4.5: #i48939# Adapted to GraphicDeviceBase changes; add screen dump facility; now providing the sprite bounds debug feature as a public property 2005/10/08 12:57:00 thb 1.7.4.4: RESYNC: (1.7-1.8); FILE MERGED 2005/07/21 14:52:49 thb 1.7.4.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas 2005/07/03 20:25:18 thb 1.7.4.2: #i48939# Reworked ParametricPolyPolygon, to extract state in an atomic operation; added more state checking 'isXDirty()' methods to canvascustomspritehelper; added various comments and notes 2005/06/17 23:49:52 thb 1.7.4.1: #i48939# Huge refactoring of canvas; as much functionality as possible is now common in a bunch of shared base classes (input checking, locking, sprite redraw, etc.); added scroll update optimization, transparently to all canvas implementations
Diffstat (limited to 'canvas/source/vcl/spritecanvas.hxx')
-rw-r--r--canvas/source/vcl/spritecanvas.hxx234
1 files changed, 123 insertions, 111 deletions
diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx
index cd33e5e992e0..92b0b8982601 100644
--- a/canvas/source/vcl/spritecanvas.hxx
+++ b/canvas/source/vcl/spritecanvas.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: spritecanvas.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: rt $ $Date: 2005-09-07 23:23:37 $
+ * last change: $Author: kz $ $Date: 2005-11-02 13:04:27 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -36,118 +36,119 @@
#ifndef _VCLCANVAS_SPRITECANVAS_HXX_
#define _VCLCANVAS_SPRITECANVAS_HXX_
-#ifndef _RTL_REF_HXX_
#include <rtl/ref.hxx>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
#include <com/sun/star/lang/XServiceName.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
-#endif
-#ifndef _COM_SUN_STAR_RENDERING_XSPRITECANVAS_HPP_
+#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
-#endif
-#ifndef _COM_SUN_STAR_RENDERING_XINTEGERBITMAP_HPP_
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
-#endif
-
-#ifndef _CPPUHELPER_COMPBASE6_HXX_
-#include <cppuhelper/compbase6.hxx>
-#endif
+#include <com/sun/star/rendering/XGraphicDevice.hpp>
+#include <com/sun/star/rendering/XBufferController.hpp>
+#include <com/sun/star/rendering/XColorSpace.hpp>
+#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-#ifndef _SV_VIRDEV_HXX
-#include <vcl/virdev.hxx>
-#endif
-
-#include <canvas/vclwrapper.hxx>
-#include <canvas/bitmapcanvasbase.hxx>
+#include <cppuhelper/compbase12.hxx>
+#include <comphelper/uno3.hxx>
-#include <memory>
+#include <canvas/base/spritecanvasbase.hxx>
+#include <canvas/base/basemutexhelper.hxx>
+#include <canvas/base/windowgraphicdevicebase.hxx>
-#include "redrawmanager.hxx"
-#include "spritesurface.hxx"
-#include "canvashelper.hxx"
-#include "backbuffer.hxx"
+#include "spritecanvashelper.hxx"
#include "impltools.hxx"
+#include "devicehelper.hxx"
#include "repainttarget.hxx"
-class OutputDevice;
-class Point;
-
-namespace com { namespace sun { namespace star { namespace uno
-{
- class XComponentContext;
- class RuntimeException;
-} } } }
-
namespace vclcanvas
{
- typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::rendering::XSpriteCanvas,
- ::com::sun::star::rendering::XIntegerBitmap,
- ::com::sun::star::awt::XWindow,
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::lang::XServiceName > CanvasBase_Base;
- typedef ::canvas::internal::BitmapCanvasBase< CanvasBase_Base, CanvasHelper, tools::LocalGuard > SpriteCanvas_Base;
-
- class SpriteCanvas : public SpriteCanvas_Base,
- public SpriteSurface,
+ typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::rendering::XSpriteCanvas,
+ ::com::sun::star::rendering::XIntegerBitmap,
+ ::com::sun::star::rendering::XGraphicDevice,
+ ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
+ ::com::sun::star::rendering::XBufferController,
+ ::com::sun::star::rendering::XColorSpace,
+ ::com::sun::star::awt::XWindow,
+ ::com::sun::star::util::XUpdatable,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base;
+ typedef ::canvas::WindowGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >,
+ DeviceHelper,
+ tools::LocalGuard,
+ ::cppu::OWeakObject > SpriteCanvasBase_Base;
+ /** Mixin SpriteSurface
+
+ Have to mixin the SpriteSurface before deriving from
+ ::canvas::SpriteCanvasBase, as this template should already
+ implement some of those interface methods.
+
+ The reason why this appears kinda convoluted is the fact that
+ we cannot specify non-IDL types as WeakComponentImplHelperN
+ template args, and furthermore, don't want to derive
+ ::canvas::SpriteCanvasBase directly from
+ ::canvas::SpriteSurface (because derivees of
+ ::canvas::SpriteCanvasBase have to explicitely forward the
+ XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
+ anyway). Basically, ::canvas::CanvasCustomSpriteBase should
+ remain a base class that provides implementation, not to
+ enforce any specific interface on its derivees.
+ */
+ class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
+ public ::canvas::SpriteSurface
+ {
+ };
+
+ typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
+ SpriteCanvasHelper,
+ tools::LocalGuard,
+ ::cppu::OWeakObject > SpriteCanvasBaseT;
+
+ /** Product of this component's factory.
+
+ The SpriteCanvas object combines the actual Window canvas with
+ the XGraphicDevice interface. This is because there's a
+ one-to-one relation between them, anyway, since each window
+ can have exactly one canvas and one associated
+ XGraphicDevice. And to avoid messing around with circular
+ references, this is implemented as one single object.
+ */
+ class SpriteCanvas : public SpriteCanvasBaseT,
public RepaintTarget
{
public:
- typedef ::rtl::Reference< SpriteCanvas > ImplRef;
+ SpriteCanvas( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& rxContext );
- SpriteCanvas( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+ /// For resource tracking
+ ~SpriteCanvas();
/// Dispose all internal references
virtual void SAL_CALL disposing();
- // XSpriteCanvas
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > >& animationBitmaps,
- sal_Int8 interpolationMode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCustomSprite > SAL_CALL createCustomSprite( const ::com::sun::star::geometry::RealSize2D& spriteSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite > SAL_CALL createClonedSprite( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
+ // Forwarding the XComponent implementation to the
+ // cppu::ImplHelper templated base
+ // Classname Base doing refcounting Base implementing the XComponent interface
+ // | | |
+ // V V V
+ DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase );
- // XComponent (comes implicitely with XWindow)
- virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XWindow
- virtual void SAL_CALL setPosSize( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setVisible( ::sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setEnable( ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ // XBufferController (partial)
+ virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSpriteCanvas (partial)
+ virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException);
-
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
@@ -156,45 +157,56 @@ namespace vclcanvas
// XServiceName
virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
- // factory
+ // component factory
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) throw ( ::com::sun::star::uno::Exception );
- // SpriteSurface
- virtual void showSprite( const Sprite::ImplRef& sprite );
- virtual void hideSprite( const Sprite::ImplRef& sprite );
- virtual void moveSprite( const Sprite::ImplRef& sprite,
- const Point& rOldPos,
- const Point& rNewPos,
- const Size& rSpriteSize );
- virtual void updateSprite( const Sprite::ImplRef& sprite,
- const Point& rPos,
- const Rectangle& rUpdateArea );
-
// RepaintTarget
virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
const ::Point& rPt,
const ::Size& rSz,
const GraphicAttr& rAttr ) const;
- protected:
- ~SpriteCanvas(); // we're a ref-counted UNO class. _We_ destroy ourselves.
+ /// Retrieve real output device for this Canvas
+ OutputDevice* getOutDev() const;
+
+ /// Get backbuffer for this canvas
+ BackBufferSharedPtr getBackBuffer() const;
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
private:
- // default: disabled copy/assignment
- SpriteCanvas(const SpriteCanvas&);
- SpriteCanvas& operator=( const SpriteCanvas& );
-
- /// Current bounds of the owning Window
- ::com::sun::star::awt::Rectangle maBounds;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
+ };
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
- WindowGraphicDevice::ImplRef mxDevice;
- BackBufferSharedPtr mpBackBuffer;
- ::std::auto_ptr< RedrawManager > mpRedrawManager; // handles smooth screen updates for us
+ typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
+ typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
- /// True, if the window this canvas is contained in, is visible
- bool mbIsVisible;
- };
}
#endif