summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2006-12-13 13:43:15 +0000
committerKurt Zenker <kz@openoffice.org>2006-12-13 13:43:15 +0000
commit4070056bdefe85af242d69aa21107e87b4c03604 (patch)
tree7e684f0f5cc634388fbc26bb276e01a8e532b35a
parent95db9da04904a300592cbd6f11615e0458f541b5 (diff)
INTEGRATION: CWS presfixes09 (1.2.4); FILE MERGED
2006/10/20 11:40:13 thb 1.2.4.7: #i10000# Removed post-merge compiler warnings; removed spurious semicolon after macro 2006/10/18 13:56:35 thb 1.2.4.6: RESYNC: (1.2-1.3); FILE MERGED 2006/04/25 12:53:36 thb 1.2.4.5: #i63943# Handling probe construction special 2006/04/21 12:44:22 thb 1.2.4.4: #i63088# Cloned Cyrille's patches accordingly 2006/03/13 12:37:59 thb 1.2.4.3: #i49357# Renamed macro 2006/03/08 17:59:44 thb 1.2.4.2: #i49357# Now also providing the C lib entry points again 2006/03/07 15:07:27 thb 1.2.4.1: #i49357# Reformatted (4-space tabs) & removed cruft; adapted to recent XWindow vs. XWindowListener changes; using dbo's new ServiceDecl goodness
-rw-r--r--canvas/source/cairo/cairo_spritecanvas.cxx217
1 files changed, 75 insertions, 142 deletions
diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx b/canvas/source/cairo/cairo_spritecanvas.cxx
index 7df7a30ca71b..8c810b4740ce 100644
--- a/canvas/source/cairo/cairo_spritecanvas.cxx
+++ b/canvas/source/cairo/cairo_spritecanvas.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: cairo_spritecanvas.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: obo $ $Date: 2006-09-17 03:21:04 $
+ * last change: $Author: kz $ $Date: 2006-12-13 14:43:15 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -48,6 +48,7 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
+#include <comphelper/servicedecl.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/point/b2dpoint.hxx>
@@ -60,34 +61,57 @@
using namespace ::cairo;
using namespace ::com::sun::star;
-#define IMPLEMENTATION_NAME "CairoCanvas::SpriteCanvas"
#define SERVICE_NAME "com.sun.star.rendering.CairoCanvas"
-namespace
+namespace cairocanvas
{
- static ::rtl::OUString SAL_CALL getImplementationName_SpriteCanvas()
+ SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments,
+ const uno::Reference< uno::XComponentContext >& rxContext ) :
+ mxComponentContext( rxContext ),
+ mpBackgroundCairo( NULL ),
+ mpBackgroundSurface( NULL )
{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
+ // #i64742# Only call initialize when not in probe mode
+ if( aArguments.getLength() != 0 )
+ initialize( aArguments );
}
- static uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_SpriteCanvas()
+ void SpriteCanvas::initialize( const uno::Sequence< uno::Any >& aArguments )
{
- uno::Sequence< ::rtl::OUString > aRet(1);
- aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ VERBOSE_TRACE("SpriteCanvas created %p\n", this);
- return aRet;
- }
+ // At index 1, we expect a system window handle here,
+ // containing a pointer to a valid window, on which to output
+ // At index 2, we expect the current window bound rect
+ CHECK_AND_THROW( aArguments.getLength() >= 4 &&
+ aArguments[1].getValueTypeClass() == uno::TypeClass_LONG,
+ "SpriteCanvas::initialize: wrong number of arguments, or wrong types" );
-}
+ awt::Rectangle aRect;
+ aArguments[2] >>= aRect;
-namespace cairocanvas
-{
- SpriteCanvas::SpriteCanvas( const uno::Reference< uno::XComponentContext >& rxContext ) :
- mxComponentContext( rxContext ),
- mpBackgroundCairo( NULL ),
- mpBackgroundSurface( NULL )
- {
- OSL_TRACE("SpriteCanvas created %p\n", this);
+ sal_Bool bIsFullscreen( sal_False );
+ aArguments[3] >>= bIsFullscreen;
+
+ // TODO(Q2): This now works for Solaris, but still warns for gcc
+ Window* pOutputWindow = (Window*) *reinterpret_cast<const sal_Int64*>(aArguments[0].getValue());
+
+ Size aPixelSize( pOutputWindow->GetOutputSizePixel() );
+ const ::basegfx::B2ISize aSize( aPixelSize.Width(),
+ aPixelSize.Height() );
+
+ CHECK_AND_THROW( pOutputWindow != NULL,
+ "SpriteCanvas::initialize: invalid Window pointer" );
+
+ // setup helper
+ maDeviceHelper.init( *pOutputWindow,
+ *this,
+ aSize,
+ bIsFullscreen );
+
+ maCanvasHelper.init( maRedrawManager,
+ *this,
+ aSize );
}
void SAL_CALL SpriteCanvas::disposing()
@@ -148,117 +172,53 @@ namespace cairocanvas
return !mbIsVisible ? false : SpriteCanvasBaseT::updateScreen( bUpdateAll );
}
- void SAL_CALL SpriteCanvas::initialize( const uno::Sequence< uno::Any >& aArguments ) throw( uno::Exception,
- uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
-
- OSL_TRACE( "SpriteCanvas::initialize called" );
- VERBOSE_TRACE( "SpriteCanvas::initialize called" );
-
- // At index 1, we expect a system window handle here,
- // containing a pointer to a valid window, on which to output
- // At index 2, we expect the current window bound rect
- CHECK_AND_THROW( aArguments.getLength() >= 4 &&
- aArguments[1].getValueTypeClass() == uno::TypeClass_LONG,
- "SpriteCanvas::initialize: wrong number of arguments, or wrong types" );
-
- awt::Rectangle aRect;
- aArguments[2] >>= aRect;
-// const ::basegfx::B2ISize aSize(aRect.Width,
-// aRect.Height);
-
- sal_Bool bIsFullscreen( sal_False );
- aArguments[3] >>= bIsFullscreen;
-
- // TODO(Q2): This now works for Solaris, but still warns for gcc
- Window* pOutputWindow = (Window*) *reinterpret_cast<const sal_Int64*>(aArguments[0].getValue());
-
- Size aPixelSize( pOutputWindow->GetOutputSizePixel() );
- const ::basegfx::B2ISize aSize( aPixelSize.Width(),
- aPixelSize.Height() );
-
- CHECK_AND_THROW( pOutputWindow != NULL,
- "SpriteCanvas::initialize: invalid Window pointer" );
-
- // setup helper
- maDeviceHelper.init( *pOutputWindow,
- *this,
- aSize,
- bIsFullscreen );
-
- maCanvasHelper.init( maRedrawManager,
- *this,
- aSize );
- }
-
- ::rtl::OUString SAL_CALL SpriteCanvas::getImplementationName() throw( uno::RuntimeException )
- {
- return getImplementationName_SpriteCanvas();
- }
-
- sal_Bool SAL_CALL SpriteCanvas::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
- {
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
- }
-
- uno::Sequence< ::rtl::OUString > SAL_CALL SpriteCanvas::getSupportedServiceNames() throw( uno::RuntimeException )
- {
- return getSupportedServiceNames_SpriteCanvas();
- }
-
::rtl::OUString SAL_CALL SpriteCanvas::getServiceName( ) throw (uno::RuntimeException)
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
}
- uno::Reference< uno::XInterface > SAL_CALL SpriteCanvas::createInstance( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::Exception )
- {
- return uno::Reference< uno::XInterface >( static_cast<cppu::OWeakObject*>( new SpriteCanvas( xContext ) ) );
- }
-
Surface* SpriteCanvas::getSurface( const ::basegfx::B2ISize& rSize, Content aContent )
{
- return maDeviceHelper.getSurface( rSize, aContent );
+ return maDeviceHelper.getSurface( rSize, aContent );
}
Surface* SpriteCanvas::getSurface( Content aContent )
{
- return maDeviceHelper.getSurface( aContent );
+ return maDeviceHelper.getSurface( aContent );
}
Surface* SpriteCanvas::getSurface( Bitmap& rBitmap )
{
- Surface *pSurface = NULL;
+ Surface *pSurface = NULL;
- BitmapSystemData aData;
- if( rBitmap.GetSystemData( aData ) ) {
- const Size& rSize = rBitmap.GetSizePixel();
+ BitmapSystemData aData;
+ if( rBitmap.GetSystemData( aData ) ) {
+ const Size& rSize = rBitmap.GetSizePixel();
- pSurface = maDeviceHelper.getSurface( aData, rSize );
- }
+ pSurface = maDeviceHelper.getSurface( aData, rSize );
+ }
- return pSurface;
+ return pSurface;
}
Surface* SpriteCanvas::getBufferSurface()
{
- return maDeviceHelper.getBufferSurface();
+ return maDeviceHelper.getBufferSurface();
}
Surface* SpriteCanvas::getWindowSurface()
{
- return maDeviceHelper.getWindowSurface();
+ return maDeviceHelper.getWindowSurface();
}
Surface* SpriteCanvas::getBackgroundSurface()
{
- return mpBackgroundSurface;
+ return mpBackgroundSurface;
}
const ::basegfx::B2ISize& SpriteCanvas::getSizePixel()
{
- return maDeviceHelper.getSizePixel();
+ return maDeviceHelper.getSizePixel();
}
void SpriteCanvas::setSizePixel( const ::basegfx::B2ISize& rSize )
@@ -280,55 +240,28 @@ namespace cairocanvas
void SpriteCanvas::flush()
{
- maDeviceHelper.flush();
+ maDeviceHelper.flush();
}
- bool SpriteCanvas::repaint( Surface* pSurface,
- const rendering::ViewState& viewState,
- const rendering::RenderState& renderState )
+ bool SpriteCanvas::repaint( Surface* pSurface,
+ const rendering::ViewState& viewState,
+ const rendering::RenderState& renderState )
{
- return maCanvasHelper.repaint( pSurface, viewState, renderState );
+ return maCanvasHelper.repaint( pSurface, viewState, renderState );
}
-}
-namespace
-{
- /* shared lib exports implemented with helpers */
- static struct ::cppu::ImplementationEntry s_component_entries [] =
- {
- {
- cairocanvas::SpriteCanvas::createInstance, getImplementationName_SpriteCanvas,
- getSupportedServiceNames_SpriteCanvas, ::cppu::createSingleComponentFactory,
- 0, 0
- },
- { 0, 0, 0, 0, 0, 0 }
- };
+ namespace sdecl = comphelper::service_decl;
+#if defined (__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+ sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl;
+ const sdecl::ServiceDecl cairoCanvasDecl(
+ serviceImpl,
+#else
+ const sdecl::ServiceDecl cairoCanvasDecl(
+ sdecl::class_<SpriteCanvas, sdecl::with_args<true> >(),
+#endif
+ "com.sun.star.comp.rendering.CairoCanvas",
+ SERVICE_NAME );
}
-
-/* Exported UNO methods for registration and object creation.
- ==========================================================
- */
-extern "C"
-{
- void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName,
- uno_Environment** ppEnv )
- {
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
- }
-
- sal_Bool SAL_CALL component_writeInfo( lang::XMultiServiceFactory* xMgr,
- registry::XRegistryKey* xRegistry )
- {
- return ::cppu::component_writeInfoHelper(
- xMgr, xRegistry, s_component_entries );
- }
-
- void * SAL_CALL component_getFactory( sal_Char const* implName,
- lang::XMultiServiceFactory* xMgr,
- registry::XRegistryKey* xRegistry )
- {
- return ::cppu::component_getFactoryHelper(
- implName, xMgr, xRegistry, s_component_entries );
- }
-}
+// The C shared lib entry points
+COMPHELPER_SERVICEDECL_EXPORTS1(cairocanvas::cairoCanvasDecl)