INTEGRATION: CWS canvas05 (1.13.56); FILE MERGED
2008/06/09 12:51:48 thb 1.13.56.7: #i88081# Join from CWS impress144 (fixing the dxcanvas crash), extended for the other canvas impls 2008/04/21 07:28:29 thb 1.13.56.6: RESYNC: (1.14-1.15); FILE MERGED 2008/04/09 14:33:12 thb 1.13.56.5: Gave back vclcanvas the window surface; made cairocanvas consistent with rest (regarding setWindow) 2008/04/09 09:35:12 thb 1.13.56.4: Improved log output, fixed wrong arg check for vclcanvas 2007/12/20 22:19:00 thb 1.13.56.3: #i81092# #i78888# #i78925# #i79258# #i79437# #i84784# Large canvas rework, completing various areas such as color spaces, bitmap data access, true sprite and non-sprite implementations, and upstreaming the canvas parts of rodos emf+ rendering 2007/11/06 12:37:01 thb 1.13.56.2: RESYNC: (1.13-1.14); FILE MERGED 2007/10/01 13:02:04 thb 1.13.56.1: #i78888# #i78925# #i79258# #i79437# Merge from CWS picom
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: spritecanvas.cxx,v $
|
||||
* $Revision: 1.15 $
|
||||
* $Revision: 1.16 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "precompiled_canvas.hxx"
|
||||
|
||||
#include <canvas/debug.hxx>
|
||||
#include <tools/diagnose_ex.h>
|
||||
#include <canvas/verbosetrace.hxx>
|
||||
#include <canvas/canvastools.hxx>
|
||||
|
||||
@@ -39,10 +40,6 @@
|
||||
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <cppuhelper/factory.hxx>
|
||||
#include <cppuhelper/implementationentry.hxx>
|
||||
#include <comphelper/servicedecl.hxx>
|
||||
|
||||
#include <vcl/canvastools.hxx>
|
||||
#include <vcl/outdev.hxx>
|
||||
#include <vcl/window.hxx>
|
||||
@@ -53,27 +50,28 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "spritecanvas.hxx"
|
||||
#include "windowoutdevholder.hxx"
|
||||
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
#define SERVICE_NAME "com.sun.star.rendering.VCLCanvas"
|
||||
|
||||
namespace vclcanvas
|
||||
{
|
||||
SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments,
|
||||
const uno::Reference< uno::XComponentContext >& rxContext ) :
|
||||
maArguments(aArguments),
|
||||
mxComponentContext( rxContext )
|
||||
{
|
||||
// #i64742# Only call initialize when not in probe mode
|
||||
if( aArguments.getLength() != 0 )
|
||||
initialize( aArguments );
|
||||
}
|
||||
|
||||
void SpriteCanvas::initialize( const uno::Sequence< uno::Any >& aArguments )
|
||||
void SpriteCanvas::initialize()
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
// #i64742# Only call initialize when not in probe mode
|
||||
if( maArguments.getLength() == 0 )
|
||||
return;
|
||||
|
||||
OSL_TRACE( "SpriteCanvas created" );
|
||||
|
||||
// add our own property to GraphicDevice
|
||||
@@ -94,30 +92,37 @@ namespace vclcanvas
|
||||
|
||||
VERBOSE_TRACE( "VCLSpriteCanvas::initialize called" );
|
||||
|
||||
CHECK_AND_THROW( aArguments.getLength() >= 1,
|
||||
"SpriteCanvas::initialize: wrong number of arguments" );
|
||||
ENSURE_ARG_OR_THROW( maArguments.getLength() >= 1,
|
||||
"VCLSpriteCanvas::initialize: wrong number of arguments" );
|
||||
|
||||
// We expect a single Any here, containing a pointer to a valid
|
||||
// VCL window, on which to output
|
||||
if( aArguments.getLength() >= 1 &&
|
||||
aArguments[0].getValueTypeClass() == uno::TypeClass_HYPER )
|
||||
{
|
||||
sal_Int64 nWindowPtr = 0;
|
||||
aArguments[0] >>= nWindowPtr;
|
||||
Window* pOutputWindow = reinterpret_cast<Window*>(nWindowPtr);
|
||||
/* maArguments:
|
||||
0: ptr to creating instance (Window or VirtualDevice)
|
||||
1: SystemEnvData as a streamed Any (or empty for VirtualDevice)
|
||||
2: current bounds of creating instance
|
||||
3: bool, denoting always on top state for Window (always false for VirtualDevice)
|
||||
4: XWindow for creating Window (or empty for VirtualDevice)
|
||||
5: SystemGraphicsData as a streamed Any
|
||||
*/
|
||||
ENSURE_ARG_OR_THROW( maArguments.getLength() >= 4 &&
|
||||
maArguments[0].getValueTypeClass() == uno::TypeClass_HYPER &&
|
||||
maArguments[4].getValueTypeClass() == uno::TypeClass_INTERFACE,
|
||||
"VCLSpriteCanvas::initialize: wrong number of arguments, or wrong types" );
|
||||
|
||||
CHECK_AND_THROW( pOutputWindow != NULL,
|
||||
"SpriteCanvas::initialize: invalid Window pointer" );
|
||||
uno::Reference< awt::XWindow > xParentWindow;
|
||||
maArguments[4] >>= xParentWindow;
|
||||
|
||||
// setup helper
|
||||
maDeviceHelper.init( *pOutputWindow,
|
||||
*this );
|
||||
maCanvasHelper.init( *this,
|
||||
maDeviceHelper.getBackBuffer(),
|
||||
false, // no OutDev state preservation
|
||||
false ); // no alpha on surface
|
||||
maCanvasHelper.setRedrawManager( maRedrawManager );
|
||||
}
|
||||
OutDevProviderSharedPtr pOutDev( new WindowOutDevHolder(xParentWindow) );
|
||||
|
||||
// setup helper
|
||||
maDeviceHelper.init( pOutDev );
|
||||
setWindow(uno::Reference<awt::XWindow2>(xParentWindow, uno::UNO_QUERY_THROW));
|
||||
maCanvasHelper.init( maDeviceHelper.getBackBuffer(),
|
||||
*this,
|
||||
maRedrawManager,
|
||||
false, // no OutDev state preservation
|
||||
false ); // no alpha on surface
|
||||
|
||||
maArguments.realloc(0);
|
||||
}
|
||||
|
||||
SpriteCanvas::~SpriteCanvas()
|
||||
@@ -138,22 +143,12 @@ namespace vclcanvas
|
||||
|
||||
::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
// avoid repaints on hidden window (hidden: not mapped to
|
||||
// screen). Return failure, since the screen really has _not_
|
||||
// been updated (caller should try again later)
|
||||
return !mbIsVisible ? false : SpriteCanvasBaseT::showBuffer( bUpdateAll );
|
||||
return updateScreen( bUpdateAll );
|
||||
}
|
||||
|
||||
::sal_Bool SAL_CALL SpriteCanvas::switchBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
// avoid repaints on hidden window (hidden: not mapped to
|
||||
// screen). Return failure, since the screen really has _not_
|
||||
// been updated (caller should try again later)
|
||||
return !mbIsVisible ? false : SpriteCanvasBaseT::switchBuffer( bUpdateAll );
|
||||
return updateScreen( bUpdateAll );
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool bUpdateAll ) throw (uno::RuntimeException)
|
||||
@@ -169,7 +164,7 @@ namespace vclcanvas
|
||||
|
||||
::rtl::OUString SAL_CALL SpriteCanvas::getServiceName( ) throw (::com::sun::star::uno::RuntimeException)
|
||||
{
|
||||
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
|
||||
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SPRITECANVAS_SERVICE_NAME ) );
|
||||
}
|
||||
|
||||
bool SpriteCanvas::repaint( const GraphicObjectSharedPtr& rGrf,
|
||||
@@ -183,98 +178,4 @@ namespace vclcanvas
|
||||
|
||||
return maCanvasHelper.repaint( rGrf, viewState, renderState, rPt, rSz, rAttr );
|
||||
}
|
||||
|
||||
OutputDevice* SpriteCanvas::getOutDev() const
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
return maDeviceHelper.getOutDev();
|
||||
}
|
||||
|
||||
BackBufferSharedPtr SpriteCanvas::getBackBuffer() const
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
return maDeviceHelper.getBackBuffer();
|
||||
}
|
||||
|
||||
uno::Reference< beans::XPropertySetInfo > SAL_CALL SpriteCanvas::getPropertySetInfo() throw (uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
return maPropHelper.getPropertySetInfo();
|
||||
}
|
||||
|
||||
void SAL_CALL SpriteCanvas::setPropertyValue( const ::rtl::OUString& aPropertyName,
|
||||
const uno::Any& aValue ) throw (beans::UnknownPropertyException,
|
||||
beans::PropertyVetoException,
|
||||
lang::IllegalArgumentException,
|
||||
lang::WrappedTargetException,
|
||||
uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
maPropHelper.setPropertyValue( aPropertyName, aValue );
|
||||
}
|
||||
|
||||
uno::Any SAL_CALL SpriteCanvas::getPropertyValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException,
|
||||
lang::WrappedTargetException,
|
||||
uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
return maPropHelper.getPropertyValue( aPropertyName );
|
||||
}
|
||||
|
||||
void SAL_CALL SpriteCanvas::addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
|
||||
const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException,
|
||||
lang::WrappedTargetException,
|
||||
uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
maPropHelper.addPropertyChangeListener( aPropertyName,
|
||||
xListener );
|
||||
}
|
||||
|
||||
void SAL_CALL SpriteCanvas::removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
|
||||
const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException,
|
||||
lang::WrappedTargetException,
|
||||
uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
maPropHelper.removePropertyChangeListener( aPropertyName,
|
||||
xListener );
|
||||
}
|
||||
|
||||
void SAL_CALL SpriteCanvas::addVetoableChangeListener( const ::rtl::OUString& aPropertyName,
|
||||
const uno::Reference< beans::XVetoableChangeListener >& xListener ) throw (beans::UnknownPropertyException,
|
||||
lang::WrappedTargetException,
|
||||
uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
maPropHelper.addVetoableChangeListener( aPropertyName,
|
||||
xListener );
|
||||
}
|
||||
|
||||
void SAL_CALL SpriteCanvas::removeVetoableChangeListener( const ::rtl::OUString& aPropertyName,
|
||||
const uno::Reference< beans::XVetoableChangeListener >& xListener ) throw (beans::UnknownPropertyException,
|
||||
lang::WrappedTargetException,
|
||||
uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
maPropHelper.removeVetoableChangeListener( aPropertyName,
|
||||
xListener );
|
||||
}
|
||||
|
||||
namespace sdecl = comphelper::service_decl;
|
||||
#if defined (__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
|
||||
sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl;
|
||||
const sdecl::ServiceDecl vclCanvasDecl(
|
||||
serviceImpl,
|
||||
#else
|
||||
const sdecl::ServiceDecl vclCanvasDecl(
|
||||
sdecl::class_<SpriteCanvas, sdecl::with_args<true> >(),
|
||||
#endif
|
||||
"com.sun.star.comp.rendering.VCLCanvas",
|
||||
SERVICE_NAME );
|
||||
}
|
||||
|
||||
// The C shared lib entry points
|
||||
COMPHELPER_SERVICEDECL_EXPORTS1(vclcanvas::vclCanvasDecl)
|
||||
|
Reference in New Issue
Block a user