2005-11-02 11:49:21 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
*
|
|
|
|
* $RCSfile: null_devicehelper.cxx,v $
|
|
|
|
*
|
2006-09-17 02:23:32 +00:00
|
|
|
* $Revision: 1.4 $
|
2005-11-02 11:49:21 +00:00
|
|
|
*
|
2006-09-17 02:23:32 +00:00
|
|
|
* last change: $Author: obo $ $Date: 2006-09-17 03:23:32 $
|
2005-11-02 11:49:21 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 02:23:32 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_canvas.hxx"
|
|
|
|
|
2005-11-02 11:49:21 +00:00
|
|
|
#include <canvas/debug.hxx>
|
|
|
|
#include <canvas/verbosetrace.hxx>
|
|
|
|
#include <canvas/canvastools.hxx>
|
|
|
|
#include <canvas/base/linepolypolygonbase.hxx>
|
|
|
|
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
#include <cppuhelper/compbase1.hxx>
|
|
|
|
|
|
|
|
#include <com/sun/star/lang/NoSupportException.hpp>
|
|
|
|
|
|
|
|
#include <basegfx/tools/canvastools.hxx>
|
|
|
|
|
|
|
|
#include "null_spritecanvas.hxx"
|
|
|
|
#include "null_canvasbitmap.hxx"
|
|
|
|
#include "null_devicehelper.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
namespace nullcanvas
|
|
|
|
{
|
|
|
|
DeviceHelper::DeviceHelper() :
|
|
|
|
mpSpriteCanvas( NULL ),
|
|
|
|
maSize(),
|
|
|
|
mbFullScreen(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeviceHelper::init( SpriteCanvas& rSpriteCanvas,
|
|
|
|
const ::basegfx::B2ISize& rSize,
|
|
|
|
bool bFullscreen )
|
|
|
|
{
|
|
|
|
mpSpriteCanvas = &rSpriteCanvas;
|
|
|
|
maSize = rSize;
|
|
|
|
mbFullScreen = bFullscreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeviceHelper::disposing()
|
|
|
|
{
|
|
|
|
// release all references
|
|
|
|
mpSpriteCanvas = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
geometry::RealSize2D DeviceHelper::getPhysicalResolution()
|
|
|
|
{
|
|
|
|
return geometry::RealSize2D( 75, 75 );
|
|
|
|
}
|
|
|
|
|
|
|
|
geometry::RealSize2D DeviceHelper::getPhysicalSize()
|
|
|
|
{
|
|
|
|
return geometry::RealSize2D( 210, 280 );
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< rendering::XLinePolyPolygon2D > DeviceHelper::createCompatibleLinePolyPolygon(
|
2006-06-20 01:15:29 +00:00
|
|
|
const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
|
2005-11-02 11:49:21 +00:00
|
|
|
const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points )
|
|
|
|
{
|
|
|
|
// disposed?
|
|
|
|
if( !mpSpriteCanvas )
|
|
|
|
return uno::Reference< rendering::XLinePolyPolygon2D >(); // we're disposed
|
|
|
|
|
|
|
|
return uno::Reference< rendering::XLinePolyPolygon2D >(
|
|
|
|
new ::canvas::LinePolyPolygonBase(
|
|
|
|
::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence( points ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< rendering::XBezierPolyPolygon2D > DeviceHelper::createCompatibleBezierPolyPolygon(
|
2006-06-20 01:15:29 +00:00
|
|
|
const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
|
2005-11-02 11:49:21 +00:00
|
|
|
const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points )
|
|
|
|
{
|
|
|
|
// disposed?
|
|
|
|
if( !mpSpriteCanvas )
|
|
|
|
return uno::Reference< rendering::XBezierPolyPolygon2D >(); // we're disposed
|
|
|
|
|
|
|
|
return uno::Reference< rendering::XBezierPolyPolygon2D >(
|
|
|
|
new ::canvas::LinePolyPolygonBase(
|
|
|
|
::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence( points ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleBitmap(
|
2006-06-20 01:15:29 +00:00
|
|
|
const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
|
2005-11-02 11:49:21 +00:00
|
|
|
const geometry::IntegerSize2D& size )
|
|
|
|
{
|
|
|
|
// disposed?
|
|
|
|
if( !mpSpriteCanvas )
|
|
|
|
return uno::Reference< rendering::XBitmap >(); // we're disposed
|
|
|
|
|
|
|
|
return uno::Reference< rendering::XBitmap >(
|
|
|
|
new CanvasBitmap(
|
|
|
|
::basegfx::unotools::b2ISizeFromIntegerSize2D( size ),
|
|
|
|
mpSpriteCanvas,
|
|
|
|
false ));
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileBitmap(
|
2006-06-20 01:15:29 +00:00
|
|
|
const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
|
|
|
|
const geometry::IntegerSize2D& /*size*/ )
|
2005-11-02 11:49:21 +00:00
|
|
|
{
|
|
|
|
return uno::Reference< rendering::XVolatileBitmap >();
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleAlphaBitmap(
|
2006-06-20 01:15:29 +00:00
|
|
|
const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
|
2005-11-02 11:49:21 +00:00
|
|
|
const geometry::IntegerSize2D& size )
|
|
|
|
{
|
|
|
|
// disposed?
|
|
|
|
if( !mpSpriteCanvas )
|
|
|
|
return uno::Reference< rendering::XBitmap >(); // we're disposed
|
|
|
|
|
|
|
|
return uno::Reference< rendering::XBitmap >(
|
|
|
|
new CanvasBitmap(
|
|
|
|
::basegfx::unotools::b2ISizeFromIntegerSize2D( size ),
|
|
|
|
mpSpriteCanvas,
|
|
|
|
true ));
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileAlphaBitmap(
|
2006-06-20 01:15:29 +00:00
|
|
|
const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
|
|
|
|
const geometry::IntegerSize2D& /*size*/ )
|
2005-11-02 11:49:21 +00:00
|
|
|
{
|
|
|
|
return uno::Reference< rendering::XVolatileBitmap >();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool DeviceHelper::hasFullScreenMode()
|
|
|
|
{
|
|
|
|
// TODO(F3): offer fullscreen mode the XCanvas way
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-06-20 01:15:29 +00:00
|
|
|
sal_Bool DeviceHelper::enterFullScreenMode( sal_Bool /*bEnter*/ )
|
2005-11-02 11:49:21 +00:00
|
|
|
{
|
|
|
|
// TODO(F3): offer fullscreen mode the XCanvas way
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-06-20 01:15:29 +00:00
|
|
|
::sal_Int32 DeviceHelper::createBuffers( ::sal_Int32 /*nBuffers*/ )
|
2005-11-02 11:49:21 +00:00
|
|
|
{
|
|
|
|
// TODO(F3): implement XBufferStrategy interface. For now, we
|
|
|
|
// _always_ will have exactly one backbuffer
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeviceHelper::destroyBuffers()
|
|
|
|
{
|
|
|
|
// TODO(F3): implement XBufferStrategy interface. For now, we
|
|
|
|
// _always_ will have exactly one backbuffer
|
|
|
|
}
|
|
|
|
|
|
|
|
::sal_Bool DeviceHelper::showBuffer( ::sal_Bool bUpdateAll )
|
|
|
|
{
|
|
|
|
// forward to sprite canvas helper
|
|
|
|
if( !mpSpriteCanvas )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return mpSpriteCanvas->updateScreen( bUpdateAll );
|
|
|
|
}
|
|
|
|
|
|
|
|
::sal_Bool DeviceHelper::switchBuffer( ::sal_Bool bUpdateAll )
|
|
|
|
{
|
|
|
|
// no difference for VCL canvas
|
|
|
|
return showBuffer( bUpdateAll );
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any DeviceHelper::getDeviceHandle() const
|
|
|
|
{
|
|
|
|
return uno::Any();
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any DeviceHelper::getSurfaceHandle() const
|
|
|
|
{
|
|
|
|
return uno::Any();
|
|
|
|
}
|
|
|
|
|
2006-06-20 01:15:29 +00:00
|
|
|
void DeviceHelper::notifySizeUpdate( const awt::Rectangle& /*rBounds*/ )
|
2005-11-02 11:49:21 +00:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeviceHelper::dumpScreenContent() const
|
|
|
|
{
|
|
|
|
OSL_TRACE( "%s\n",
|
|
|
|
BOOST_CURRENT_FUNCTION );
|
|
|
|
}
|
|
|
|
}
|