#110496# Merge from cws_srx645_canvas01: first working version of XCanvas C++ wrapper, providing encapsulation against possible API changes and some amount of convenience.

This commit is contained in:
Thorsten Behrens
2004-03-18 09:41:15 +00:00
parent 6e89341b50
commit f045b7b4f5
63 changed files with 9108 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
/*************************************************************************
*
* $RCSfile: action.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_ACTION_HXX
#define _CPPCANVAS_ACTION_HXX
#ifndef _SAL_CONFIG_H_
#include <sal/config.h>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
/* Definition of Action interface */
namespace cppcanvas
{
namespace internal
{
class Action
{
public:
virtual ~Action() {}
/** Render this action to the associated canvas
*/
virtual bool render() const = 0;
};
typedef ::boost::shared_ptr< Action > ActionSharedPtr;
}
}
#endif /* _CPPCANVAS_ACTION_HXX */

View File

@@ -0,0 +1,120 @@
/*************************************************************************
*
* $RCSfile: canvasgraphichelper.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_CANVASGRAPHICHELPER_HXX
#define _CPPCANVAS_CANVASGRAPHICHELPER_HXX
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#include <basegfx/polygon/b2dpolypolygon.hxx>
#endif
#include <cppcanvas/canvasgraphic.hxx>
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
class XGraphicDevice;
} } } } }
/* Definition of CanvasGraphicHelper class */
namespace cppcanvas
{
namespace internal
{
class CanvasGraphicHelper : public virtual CanvasGraphic
{
public:
CanvasGraphicHelper( const CanvasSharedPtr& rParentCanvas );
// CanvasGraphic implementation
virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix );
virtual ::basegfx::B2DHomMatrix getTransformation() const;
virtual void setClip( const PolyPolygonSharedPtr& rClipPoly );
virtual PolyPolygonSharedPtr getClip() const;
virtual void setRGBAColor( Color::IntSRGBA );
virtual Color::IntSRGBA getRGBAColor() const;
virtual void setCompositeOp( CompositeOp aOp );
virtual CompositeOp getCompositeOp() const;
protected:
// for our clients
// ===============
CanvasSharedPtr getCanvas() const;
::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XGraphicDevice > getGraphicDevice() const;
mutable ::drafts::com::sun::star::rendering::RenderState maRenderState; // for reasons of speed...
private:
PolyPolygonSharedPtr mpClipPolyPolygon;
CanvasSharedPtr mpCanvas;
::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XGraphicDevice > mxGraphicDevice;
};
}
}
#endif /* _CPPCANVAS_CANVASGRAPHICHELPER_HXX */

View File

@@ -0,0 +1,160 @@
/*************************************************************************
*
* $RCSfile: implrenderer.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLRENDERER_HXX
#define _CPPCANVAS_IMPLRENDERER_HXX
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#ifndef _CPPCANVAS_RENDERER_HXX
#include <cppcanvas/renderer.hxx>
#endif
#ifndef _CPPCANVAS_CANVAS_HXX
#include <cppcanvas/canvas.hxx>
#endif
#include "canvasgraphichelper.hxx"
#include "action.hxx"
#include <vector>
class GDIMetaFile;
class BitmapEx;
class VirtualDevice;
class Gradient;
namespace cppcanvas
{
namespace internal
{
struct OutDevState;
// state stack of OutputDevice, to correctly handle
// push/pop actions
typedef ::std::vector< OutDevState > VectorOfOutDevStates;
class ImplRenderer : public virtual Renderer, protected CanvasGraphicHelper
{
public:
ImplRenderer( const CanvasSharedPtr& rCanvas,
const GDIMetaFile& rMtf );
ImplRenderer( const CanvasSharedPtr& rCanvas,
const BitmapEx& rBmpEx );
virtual ~ImplRenderer();
virtual bool draw() const;
virtual bool drawSubset( int nStartIndex,
int nEndIndex ) const;
// element of the Renderer's action vector. Need to be
// public, since some functors need it, too.
struct MtfAction
{
MtfAction( const ActionSharedPtr& rAction,
int nOrigIndex ) :
mpAction( rAction ),
mnOrigIndex( nOrigIndex )
{
}
ActionSharedPtr mpAction;
int mnOrigIndex;
};
private:
// default: disabled copy/assignment
ImplRenderer(const ImplRenderer&);
ImplRenderer& operator=( const ImplRenderer& );
bool createActions( const CanvasSharedPtr& rCanvas,
VirtualDevice& rVDev,
GDIMetaFile& rMtf,
VectorOfOutDevStates& rStates );
bool createFillAndStroke( const ::PolyPolygon& rPolyPoly,
const CanvasSharedPtr& rCanvas,
int rActionIndex,
VectorOfOutDevStates& rStates );
void skipContent( GDIMetaFile& rMtf,
const char& rCommentString ) const;
void createGradientAction( const Rectangle& rRect,
const Gradient& rGradient,
VirtualDevice& rVDev,
const CanvasSharedPtr& rCanvas,
VectorOfOutDevStates& rStates );
// prefetched and prepared canvas actions
// (externally not visible)
typedef ::std::vector< MtfAction > ActionVector;
ActionVector maActions;
};
}
}
#endif /* _CPPCANVAS_IMPLRENDERER_HXX */

View File

@@ -0,0 +1,97 @@
/*************************************************************************
*
* $RCSfile: tools.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_TOOLS_HXX
#define _CPPCANVAS_TOOLS_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
#endif
#ifndef _CPPCANVAS_COLOR_HXX
#include <cppcanvas/color.hxx>
#endif
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
class XGraphicDevice;
} } } } }
namespace cppcanvas
{
namespace tools
{
::com::sun::star::uno::Sequence< double >
intSRGBAToDoubleSequence( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XGraphicDevice >&,
Color::IntSRGBA );
Color::IntSRGBA doubleSequenceToIntSRGBA( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XGraphicDevice >& rDevice,
const ::com::sun::star::uno::Sequence< double >& rColor );
}
}
#endif /* _CPPCANVAS_TOOLS_HXX */

View File

@@ -0,0 +1,217 @@
/*************************************************************************
*
* $RCSfile: bitmapaction.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "bitmapaction.hxx"
#include "outdevstate.hxx"
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XBITMAP_HPP__
#include <drafts/com/sun/star/rendering/XBitmap.hpp>
#endif
#ifndef _SV_BITMAPEX_HXX
#include <vcl/bitmapex.hxx>
#endif
#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
#endif
#ifndef _VCL_CANVASTOOLS_HXX
#include <vcl/canvastools.hxx>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#include "mtftools.hxx"
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
namespace cppcanvas
{
namespace internal
{
// free support functions
// ======================
namespace
{
/** Setup transformation such that the next render call is
moved rPoint away.
*/
void implSetupTransform( rendering::RenderState& rRenderState,
const Point& rPoint )
{
::basegfx::B2DHomMatrix aLocalTransformation;
aLocalTransformation.translate( rPoint.X(),
rPoint.Y() );
::canvas::tools::appendToRenderState( rRenderState,
aLocalTransformation );
}
/** Setup transformation such that the next render call is
moved rPoint away, and scaled according to the ratio
given by src and dst size.
*/
void implSetupTransform( rendering::RenderState& rRenderState,
const Point& rPoint,
const Size& rSrcSize,
const Size& rDstSize )
{
::basegfx::B2DHomMatrix aLocalTransformation;
aLocalTransformation.scale( static_cast<double>(rDstSize.Width()) / rSrcSize.Width(),
static_cast<double>(rDstSize.Height()) / rSrcSize.Height() );
aLocalTransformation.translate( rPoint.X(),
rPoint.Y() );
::canvas::tools::appendToRenderState( rRenderState,
aLocalTransformation );
}
/** Setup transformation such that the next render call
paints the content given by the src area into the dst
area. No clipping is set whatsoever.
*/
void implSetupTransform( rendering::RenderState& rRenderState,
const Point& rSrcPoint,
const Size& rSrcSize,
const Point& rDstPoint,
const Size& rDstSize )
{
::basegfx::B2DHomMatrix aLocalTransformation;
aLocalTransformation.scale( static_cast<double>(rDstSize.Width()) / rSrcSize.Width(),
static_cast<double>(rDstSize.Height()) / rSrcSize.Height() );
aLocalTransformation.translate( rDstPoint.X() - rSrcPoint.X(),
rDstPoint.Y() - rSrcPoint.Y() );
::canvas::tools::appendToRenderState( rRenderState,
aLocalTransformation );
}
}
BitmapAction::BitmapAction( const ::BitmapEx& rBmpEx,
const ::Point& rDstPoint,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
mxBitmap( ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(),
rBmpEx ) ),
mpCanvas( rCanvas ),
maState()
{
tools::initRenderState(maState,rState);
implSetupTransform( maState, rDstPoint );
}
BitmapAction::BitmapAction( const ::BitmapEx& rBmpEx,
const ::Point& rDstPoint,
const ::Size& rDstSize,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
mxBitmap( ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(),
rBmpEx ) ),
mpCanvas( rCanvas ),
maState()
{
tools::initRenderState(maState,rState);
implSetupTransform( maState, rDstPoint, rBmpEx.GetSizePixel(), rDstSize );
}
BitmapAction::BitmapAction( const ::BitmapEx& rBmpEx,
const ::Point& rSrcPoint,
const ::Size& rSrcSize,
const ::Point& rDstPoint,
const ::Size& rDstSize,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
mxBitmap( ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(),
rBmpEx ) ),
mpCanvas( rCanvas ),
maState()
{
tools::initRenderState(maState,rState);
// TODO: setup clipping/extract only part of the bitmap
implSetupTransform( maState, rSrcPoint, rSrcSize, rDstPoint, rDstSize );
}
BitmapAction::~BitmapAction()
{
}
bool BitmapAction::render() const
{
mpCanvas->getUNOCanvas()->drawBitmap( mxBitmap,
mpCanvas->getViewState(),
maState );
return true;
}
}
}

View File

@@ -0,0 +1,137 @@
/*************************************************************************
*
* $RCSfile: bitmapaction.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_BITMAPACTION_HXX
#define _CPPCANVAS_BITMAPACTION_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#include <cppcanvas/canvas.hxx>
#include "action.hxx"
class Point;
class Size;
class BitmapEx;
class Color;
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
class XBitmap;
} } } } }
/* Definition of internal::BitmapAction class */
namespace cppcanvas
{
namespace internal
{
struct OutDevState;
/** Encapsulated converter between GDIMetaFile and
XCanvas. The Canvas argument is deliberately placed at the
constructor, to force reconstruction of this object for a
new canvas. This considerably eases internal state
handling, since a lot of the internal state
(e.g. deviceColor) is Canvas-dependent.
*/
class BitmapAction : public Action
{
public:
BitmapAction( const ::BitmapEx&,
const ::Point& rDstPoint,
const CanvasSharedPtr&,
const OutDevState& );
BitmapAction( const ::BitmapEx&,
const ::Point& rDstPoint,
const ::Size& rDstSize,
const CanvasSharedPtr&,
const OutDevState& );
BitmapAction( const ::BitmapEx&,
const ::Point& rSrcPoint,
const ::Size& rSrcSize,
const ::Point& rDstPoint,
const ::Size& rDstSize,
const CanvasSharedPtr&,
const OutDevState& );
virtual ~BitmapAction();
virtual bool render() const;
private:
// default: disabled copy/assignment
BitmapAction(const BitmapAction&);
BitmapAction& operator = ( const BitmapAction& );
::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XBitmap > mxBitmap;
CanvasSharedPtr mpCanvas;
::drafts::com::sun::star::rendering::RenderState maState;
};
}
}
#endif /*_CPPCANVAS_BITMAPACTION_HXX */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,118 @@
/*************************************************************************
*
* $RCSfile: lineaction.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "lineaction.hxx"
#include "outdevstate.hxx"
#include "cppcanvas/canvas.hxx"
#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
#endif
#ifndef _VCL_CANVASTOOLS_HXX
#include <vcl/canvastools.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#include "mtftools.hxx"
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
namespace cppcanvas
{
namespace internal
{
LineAction::LineAction( const ::Point& rStartPoint,
const ::Point& rEndPoint,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
maStartPoint( rStartPoint ),
maEndPoint( rEndPoint ),
mpCanvas( rCanvas ),
maState()
{
tools::initRenderState(maState,rState);
maState.DeviceColor = rState.lineColor;
}
LineAction::~LineAction()
{
}
bool LineAction::render() const
{
mpCanvas->getUNOCanvas()->drawLine( ::vcl::unotools::point2DFromPoint(maStartPoint),
::vcl::unotools::point2DFromPoint(maEndPoint),
mpCanvas->getViewState(),
maState );
return true;
}
}
}

View File

@@ -0,0 +1,111 @@
/*************************************************************************
*
* $RCSfile: lineaction.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_LINEACTION_HXX
#define _CPPCANVAS_LINEACTION_HXX
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
#endif
#include "action.hxx"
#include <cppcanvas/canvas.hxx>
class Color;
/* Definition of internal::LineAction class */
namespace cppcanvas
{
namespace internal
{
struct OutDevState;
class LineAction : public Action
{
public:
LineAction( const ::Point&,
const ::Point&,
const CanvasSharedPtr&,
const OutDevState& );
virtual ~LineAction();
virtual bool render() const;
private:
// default: disabled copy/assignment
LineAction(const LineAction&);
LineAction& operator=( const LineAction& );
Point maStartPoint;
Point maEndPoint;
CanvasSharedPtr mpCanvas;
::drafts::com::sun::star::rendering::RenderState maState;
};
}
}
#endif /* _CPPCANVAS_LINEACTION_HXX */

View File

@@ -0,0 +1,90 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.2 $
#
# last change: $Author: thb $ $Date: 2004-03-18 10:41:04 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 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
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME=canvas
TARGET=metafilerenderer
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------------
.INCLUDE : settings.mk
# --- Common ----------------------------------------------------------
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
CDEFS+= -DVERBOSE
.ENDIF
SLOFILES = $(SLO)$/bitmapaction.obj \
$(SLO)$/implrenderer.obj \
$(SLO)$/lineaction.obj \
$(SLO)$/pointaction.obj \
$(SLO)$/polypolyaction.obj \
$(SLO)$/textaction.obj \
$(SLO)$/mtftools.obj
# ==========================================================================
.INCLUDE : target.mk

View File

@@ -0,0 +1,93 @@
/*************************************************************************
*
* $RCSfile: mtftools.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "mtftools.hxx"
#include "outdevstate.hxx"
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace tools
{
void initRenderState( ::drafts::com::sun::star::rendering::RenderState& renderState,
const struct ::cppcanvas::internal::OutDevState& outdevState )
{
::canvas::tools::initRenderState( renderState );
::canvas::tools::setRenderStateTransform( renderState,
outdevState.transform );
renderState.Clip = outdevState.xClipPoly;
}
}
}

View File

@@ -0,0 +1,89 @@
/*************************************************************************
*
* $RCSfile: mtftools.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_RENDERER_MTFTOOLS_HXX
#define _CPPCANVAS_RENDERER_MTFTOOLS_HXX
#ifndef _SAL_TYPES_H_
# include <sal/types.h>
#endif
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
struct RenderState;
} } } } }
namespace cppcanvas
{
namespace internal
{
struct OutDevState;
}
namespace tools
{
void initRenderState( ::drafts::com::sun::star::rendering::RenderState& renderState,
const ::cppcanvas::internal::OutDevState& outdevState );
}
}
#endif /* _CPPCANVAS_RENDERER_MTFTOOLS_HXX */

View File

@@ -0,0 +1,133 @@
/*************************************************************************
*
* $RCSfile: outdevstate.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_OUTDEVSTATE_HXX
#define _CPPCANVAS_OUTDEVSTATE_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_STRINGCONTEXT_HPP__
#include <drafts/com/sun/star/rendering/StringContext.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP__
#include <drafts/com/sun/star/rendering/XPolyPolygon2D.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XCANVASFONT_HPP__
#include <drafts/com/sun/star/rendering/XCanvasFont.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_TEXTDIRECTION_HPP__
#include <drafts/com/sun/star/rendering/TextDirection.hpp>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
namespace cppcanvas
{
namespace internal
{
struct OutDevState
{
OutDevState() :
textDirection( ::drafts::com::sun::star::rendering::TextDirection::LEFT_TO_RIGHT ),
isLineColorSet( false ),
isFillColorSet( false ),
isTextFillColorSet( false ),
isTextLineColorSet( false )
{
transform.identity();
fontTransform.identity();
}
::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XPolyPolygon2D > xClipPoly;
::com::sun::star::uno::Sequence< double > lineColor;
::com::sun::star::uno::Sequence< double > fillColor;
::com::sun::star::uno::Sequence< double > textColor;
::com::sun::star::uno::Sequence< double > textFillColor;
::com::sun::star::uno::Sequence< double > textLineColor;
::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XCanvasFont > xFont;
sal_Int8 textDirection;
::basegfx::B2DHomMatrix transform;
::basegfx::B2DHomMatrix fontTransform;
bool isLineColorSet;
bool isFillColorSet;
bool isTextFillColorSet;
bool isTextLineColorSet;
};
}
}
#endif /* _CPPCANVAS_OUTDEVSTATE_HXX */

View File

@@ -0,0 +1,128 @@
/*************************************************************************
*
* $RCSfile: pointaction.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "pointaction.hxx"
#include "outdevstate.hxx"
#include "cppcanvas/canvas.hxx"
#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
#endif
#ifndef _VCL_CANVASTOOLS_HXX
#include <vcl/canvastools.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#include "mtftools.hxx"
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
namespace cppcanvas
{
namespace internal
{
PointAction::PointAction( const ::Point& rPoint,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
maPoint( rPoint ),
mpCanvas( rCanvas ),
maState()
{
tools::initRenderState(maState,rState);
maState.DeviceColor = rState.lineColor;
}
PointAction::PointAction( const ::Point& rPoint,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState,
const ::Color& rAltColor ) :
maPoint( rPoint ),
mpCanvas( rCanvas ),
maState()
{
tools::initRenderState(maState,rState);
maState.DeviceColor = ::vcl::unotools::colorToDoubleSequence( rCanvas->getUNOCanvas()->getDevice(),
rAltColor );
}
PointAction::~PointAction()
{
}
bool PointAction::render() const
{
mpCanvas->getUNOCanvas()->drawPoint( ::vcl::unotools::point2DFromPoint(maPoint),
mpCanvas->getViewState(),
maState );
return true;
}
}
}

View File

@@ -0,0 +1,112 @@
/*************************************************************************
*
* $RCSfile: pointaction.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_POINTACTION_HXX
#define _CPPCANVAS_POINTACTION_HXX
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
#endif
#include "action.hxx"
#include <cppcanvas/canvas.hxx>
class Color;
/* Definition of internal::PointAction class */
namespace cppcanvas
{
namespace internal
{
struct OutDevState;
class PointAction : public Action
{
public:
PointAction( const ::Point&,
const CanvasSharedPtr&,
const OutDevState& );
PointAction( const ::Point&,
const CanvasSharedPtr&,
const OutDevState&,
const ::Color& );
virtual ~PointAction();
virtual bool render() const;
private:
// default: disabled copy/assignment
PointAction(const PointAction&);
PointAction& operator = ( const PointAction& );
::Point maPoint;
CanvasSharedPtr mpCanvas;
::drafts::com::sun::star::rendering::RenderState maState;
};
}
}
#endif /* _CPPCANVAS_POINTACTION_HXX */

View File

@@ -0,0 +1,197 @@
/*************************************************************************
*
* $RCSfile: polypolyaction.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "polypolyaction.hxx"
#include "outdevstate.hxx"
#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
#endif
#ifndef _VCL_CANVASTOOLS_HXX
#include <vcl/canvastools.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#include "mtftools.hxx"
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
namespace cppcanvas
{
namespace internal
{
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
rPolyPoly ) ),
mpCanvas( rCanvas ),
maState(),
maFillColor(),
maStrokeColor(),
mbFill( rState.isFillColorSet ),
mbStroke( rState.isLineColorSet )
{
tools::initRenderState(maState,rState);
if( mbFill )
maFillColor = rState.fillColor;
if( mbStroke )
maStrokeColor = rState.lineColor;
}
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState,
Mode mode ) :
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
rPolyPoly ) ),
mpCanvas( rCanvas ),
maState(),
maFillColor(),
maStrokeColor(),
mbFill( false ),
mbStroke( rState.isLineColorSet )
{
tools::initRenderState(maState,rState);
if( mbStroke )
maStrokeColor = rState.lineColor;
}
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState,
int nTransparency ) :
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
rPolyPoly ) ),
mpCanvas( rCanvas ),
maState(),
maFillColor(),
maStrokeColor(),
mbFill( rState.isFillColorSet ),
mbStroke( rState.isLineColorSet )
{
tools::initRenderState(maState,rState);
if( mbFill )
{
maFillColor = rState.fillColor;
// TODO: Color management
// adapt fill color transparency
maFillColor[3] = 1.0 - nTransparency / 100.0;
}
if( mbStroke )
{
maStrokeColor = rState.lineColor;
// TODO: Color management
// adapt fill color transparency
maStrokeColor[3] = 1.0 - nTransparency / 100.0;
}
}
PolyPolyAction::~PolyPolyAction()
{
}
bool PolyPolyAction::render() const
{
if( mbFill )
{
// don't want to have full maState mutable, thus
// selectively casting away const here.
const_cast<PolyPolyAction*>(this)->maState.DeviceColor = maFillColor;
// TODO: implement caching
mpCanvas->getUNOCanvas()->fillPolyPolygon( mxPolyPoly,
mpCanvas->getViewState(),
maState );
}
if( mbStroke )
{
// don't want to have full maState mutable, thus
// selectively casting away const here.
const_cast<PolyPolyAction*>(this)->maState.DeviceColor = maStrokeColor;
// TODO: implement caching
mpCanvas->getUNOCanvas()->drawPolyPolygon( mxPolyPoly,
mpCanvas->getViewState(),
maState );
}
return true;
}
}
}

View File

@@ -0,0 +1,134 @@
/*************************************************************************
*
* $RCSfile: polypolyaction.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_POLYPOLYACTION_HXX
#define _CPPCANVAS_POLYPOLYACTION_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP__
#include <drafts/com/sun/star/rendering/XPolyPolygon2D.hpp>
#endif
#include "action.hxx"
#include <cppcanvas/canvas.hxx>
class PolyPolygon;
class Color;
/* Definition of internal::PolyPolyAction class */
namespace cppcanvas
{
namespace internal
{
struct OutDevState;
class PolyPolyAction : public Action
{
public:
enum Mode
{
/// regardless of the state, only stroke polygon (if line color is set, that is)
strokeOnly
};
PolyPolyAction( const ::PolyPolygon&,
const CanvasSharedPtr&,
const OutDevState& );
PolyPolyAction( const ::PolyPolygon&,
const CanvasSharedPtr&,
const OutDevState&,
Mode );
/// For transparent painting of the given polygon (normally, we take the colors always opaque)
PolyPolyAction( const ::PolyPolygon&,
const CanvasSharedPtr&,
const OutDevState&,
int nTransparency );
virtual ~PolyPolyAction();
virtual bool render() const;
private:
// default: disabled copy/assignment
PolyPolyAction(const PolyPolyAction&);
PolyPolyAction& operator = ( const PolyPolyAction& );
::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XPolyPolygon2D > mxPolyPoly;
CanvasSharedPtr mpCanvas;
::drafts::com::sun::star::rendering::RenderState maState;
::com::sun::star::uno::Sequence< double > maFillColor;
::com::sun::star::uno::Sequence< double > maStrokeColor;
bool mbFill;
bool mbStroke;
};
}
}
#endif /* _CPPCANVAS_POLYPOLYACTION_HXX */

View File

@@ -0,0 +1,158 @@
/*************************************************************************
*
* $RCSfile: textaction.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "textaction.hxx"
#include "outdevstate.hxx"
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _SV_GEN_HXX
#include <tools/gen.hxx>
#endif
#ifndef _VCL_CANVASTOOLS_HXX
#include <vcl/canvastools.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#include "mtftools.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
void TextAction::init( const ::Point& rStartPoint,
const OutDevState& rState )
{
tools::initRenderState(maState,rState);
::basegfx::B2DHomMatrix aLocalTransformation( rState.fontTransform );
aLocalTransformation.translate( rStartPoint.X(),
rStartPoint.Y() );
::canvas::tools::appendToRenderState( maState,
aLocalTransformation );
maState.DeviceColor = rState.textColor;
}
TextAction::TextAction( const ::Point& rStartPoint,
const ::rtl::OUString& rText,
sal_Int32 nStartPos,
sal_Int32 nLen,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
mxFont( rState.xFont ),
maStringContext( rText, nStartPos, nLen ),
maOffsets(),
mpCanvas( rCanvas ),
maState(),
maTextDirection( rState.textDirection )
{
init( rStartPoint, rState );
}
TextAction::TextAction( const ::Point& rStartPoint,
const ::rtl::OUString& rText,
sal_Int32 nStartPos,
sal_Int32 nLen,
uno::Sequence< double > aOffsets,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) :
mxFont( rState.xFont ),
maStringContext( rText, nStartPos, nLen ),
maOffsets( aOffsets ),
mpCanvas( rCanvas ),
maState(),
maTextDirection( rState.textDirection )
{
init( rStartPoint, rState );
}
TextAction::~TextAction()
{
}
bool TextAction::render() const
{
if( maOffsets.getLength() )
mpCanvas->getUNOCanvas()->drawOffsettedText( maStringContext, mxFont, maOffsets,
mpCanvas->getViewState(), maState, maTextDirection );
else
mpCanvas->getUNOCanvas()->drawText( maStringContext, mxFont,
mpCanvas->getViewState(), maState, maTextDirection );
return true;
}
}
}

View File

@@ -0,0 +1,137 @@
/*************************************************************************
*
* $RCSfile: textaction.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_TEXTACTION_HXX
#define _CPPCANVAS_TEXTACTION_HXX
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_STRINGCONTEXT_HPP__
#include <drafts/com/sun/star/rendering/StringContext.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_TEXTDIRECTION_HPP_
#include <drafts/com/sun/star/rendering/TextDirection.hpp>
#endif
#include "action.hxx"
#include <cppcanvas/canvas.hxx>
class Point;
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
class XCanvasFont;
} } } } }
/* Definition of internal::LineAction class */
namespace cppcanvas
{
namespace internal
{
struct OutDevState;
class TextAction : public Action
{
public:
TextAction( const ::Point& rStartPoint,
const ::rtl::OUString& rText,
sal_Int32 nStartPos,
sal_Int32 nLen,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState );
TextAction( const ::Point& rStartPoint,
const ::rtl::OUString& rText,
sal_Int32 nStartPos,
sal_Int32 nLen,
::com::sun::star::uno::Sequence< double > aOffsets,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState );
virtual ~TextAction();
virtual bool render() const;
private:
// default: disabled copy/assignment
TextAction(const TextAction&);
TextAction& operator = ( const TextAction& );
void init( const ::Point& rStartPoint, const OutDevState& rState );
::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XCanvasFont > mxFont;
::drafts::com::sun::star::rendering::StringContext maStringContext;
::com::sun::star::uno::Sequence< double > maOffsets;
CanvasSharedPtr mpCanvas;
::drafts::com::sun::star::rendering::RenderState maState;
sal_Int8 maTextDirection;
};
}
}
#endif /* _CPPCANVAS_TEXTACTION_HXX */

View File

@@ -0,0 +1,169 @@
/*************************************************************************
*
* $RCSfile: canvasgraphichelper.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "canvasgraphichelper.hxx"
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP_
#include <drafts/com/sun/star/rendering/XGraphicDevice.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP_
#include <drafts/com/sun/star/rendering/XPolyPolygon2D.hpp>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#include <cppcanvas/polypolygon.hxx>
#include "tools.hxx"
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
/* Implementation of CanvasGraphicHelper class */
namespace cppcanvas
{
namespace internal
{
CanvasGraphicHelper::CanvasGraphicHelper( const CanvasSharedPtr& rParentCanvas ) :
mpClipPolyPolygon(),
mpCanvas( rParentCanvas ),
mxGraphicDevice()
{
OSL_ENSURE( mpCanvas.get() != NULL &&
mpCanvas->getUNOCanvas().is(),
"CanvasGraphicHelper::CanvasGraphicHelper: no valid canvas" );
if( mpCanvas.get() != NULL &&
mpCanvas->getUNOCanvas().is() )
{
mxGraphicDevice = mpCanvas->getUNOCanvas()->getDevice();
}
::canvas::tools::initRenderState( maRenderState );
}
void CanvasGraphicHelper::setTransformation( const ::basegfx::B2DHomMatrix& rMatrix )
{
::canvas::tools::setRenderStateTransform( maRenderState, rMatrix );
}
::basegfx::B2DHomMatrix CanvasGraphicHelper::getTransformation() const
{
::basegfx::B2DHomMatrix aMatrix;
return ::canvas::tools::getRenderStateTransform( aMatrix,
maRenderState );
}
void CanvasGraphicHelper::setClip( const PolyPolygonSharedPtr& rClipPoly )
{
mpClipPolyPolygon = rClipPoly;
maRenderState.Clip = rClipPoly.get() != NULL ? rClipPoly->getUNOPolyPolygon() : NULL;
}
PolyPolygonSharedPtr CanvasGraphicHelper::getClip() const
{
return mpClipPolyPolygon;
}
void CanvasGraphicHelper::setRGBAColor( Color::IntSRGBA aColor )
{
maRenderState.DeviceColor = tools::intSRGBAToDoubleSequence( mxGraphicDevice,
aColor );
}
Color::IntSRGBA CanvasGraphicHelper::getRGBAColor() const
{
return tools::doubleSequenceToIntSRGBA( mxGraphicDevice,
maRenderState.DeviceColor );
}
void CanvasGraphicHelper::setCompositeOp( CompositeOp aOp )
{
maRenderState.CompositeOperation = aOp;
}
CanvasGraphic::CompositeOp CanvasGraphicHelper::getCompositeOp() const
{
return static_cast<CompositeOp>(maRenderState.CompositeOperation);
}
CanvasSharedPtr CanvasGraphicHelper::getCanvas() const
{
return mpCanvas;
}
uno::Reference< rendering::XGraphicDevice > CanvasGraphicHelper::getGraphicDevice() const
{
return mxGraphicDevice;
}
}
}

View File

@@ -0,0 +1,85 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.2 $
#
# last change: $Author: thb $ $Date: 2004-03-18 10:41:08 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 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
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME=cppcanvas
TARGET=cppcanvastools
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------------
.INCLUDE : settings.mk
# --- Common ----------------------------------------------------------
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
CDEFS+= -DVERBOSE
.ENDIF
SLOFILES = $(SLO)$/canvasgraphichelper.obj \
$(SLO)$/tools.obj
# ==========================================================================
.INCLUDE : target.mk

View File

@@ -0,0 +1,100 @@
/*************************************************************************
*
* $RCSfile: tools.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "tools.hxx"
#include <vcl/salbtype.hxx>
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
namespace cppcanvas
{
namespace tools
{
uno::Sequence< double > intSRGBAToDoubleSequence( const uno::Reference< rendering::XGraphicDevice >& rDevice,
Color::IntSRGBA aColor )
{
uno::Sequence< double > aRes( 4 );
aRes[0] = aColor & 0xFF000000 >> 24U;
aRes[1] = aColor & 0xFF0000 >> 16U;
aRes[2] = aColor & 0xFF00 >> 8U;
aRes[3] = aColor & 0xFF;
return aRes;
}
Color::IntSRGBA doubleSequenceToIntSRGBA( const uno::Reference< rendering::XGraphicDevice >& rDevice,
const uno::Sequence< double >& rColor )
{
Color::IntSRGBA aRes( 0 );
aRes |= static_cast<UINT8>( 255*rColor[0] + .5 ) << 24U;
aRes |= static_cast<UINT8>( 255*rColor[1] + .5 ) << 16U;
aRes |= static_cast<UINT8>( 255*rColor[2] + .5 ) << 8U;
aRes |= static_cast<UINT8>( 255*rColor[3] + .5 );
return aRes;
}
}
}

View File

@@ -0,0 +1,190 @@
/*************************************************************************
*
* $RCSfile: basegfxfactory.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef INCLUDED_RTL_INSTANCE_HXX
#include <rtl/instance.hxx>
#endif
#ifndef INCLUDED_OSL_GETGLOBALMUTEX_HXX
#include <osl/getglobalmutex.hxx>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_INTERPOLATIONMODE_HPP_
#include <drafts/com/sun/star/rendering/InterpolationMode.hpp>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
#include <basegfx/polygon/b2dpolygon.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#include <basegfx/polygon/b2dpolypolygon.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#include <cppcanvas/basegfxfactory.hxx>
#include "implpolypolygon.hxx"
#include "implbitmap.hxx"
#include "impltext.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
/* Singleton handling */
struct InitInstance2
{
BaseGfxFactory* operator()()
{
return new BaseGfxFactory();
}
};
BaseGfxFactory& BaseGfxFactory::getInstance()
{
return *rtl_Instance< BaseGfxFactory, InitInstance2, ::osl::MutexGuard,
::osl::GetGlobalMutex >::create(
InitInstance2(), ::osl::GetGlobalMutex());
}
BaseGfxFactory::BaseGfxFactory()
{
}
BaseGfxFactory::~BaseGfxFactory()
{
}
PolyPolygonSharedPtr BaseGfxFactory::createPolyPolygon( const CanvasSharedPtr& rCanvas,
const ::basegfx::B2DPolygon& rPoly ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"BaseGfxFactory::createPolyPolygon(): Invalid canvas" );
if( rCanvas.get() == NULL )
return PolyPolygonSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return PolyPolygonSharedPtr();
return PolyPolygonSharedPtr(
new internal::ImplPolyPolygon( rCanvas,
::basegfx::unotools::xPolyPolygonFromB2DPolygon(
xCanvas->getDevice(),
rPoly) ) );
}
PolyPolygonSharedPtr BaseGfxFactory::createPolyPolygon( const CanvasSharedPtr& rCanvas,
const ::basegfx::B2DPolyPolygon& rPolyPoly ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"BaseGfxFactory::createPolyPolygon(): Invalid canvas" );
if( rCanvas.get() == NULL )
return PolyPolygonSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return PolyPolygonSharedPtr();
return PolyPolygonSharedPtr(
new internal::ImplPolyPolygon( rCanvas,
::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
xCanvas->getDevice(),
rPolyPoly) ) );
}
BitmapSharedPtr BaseGfxFactory::createBitmap( const CanvasSharedPtr& rCanvas,
const ::basegfx::B2ISize& rSize ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"BaseGfxFactory::createBitmap(): Invalid canvas" );
if( rCanvas.get() == NULL )
return BitmapSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return BitmapSharedPtr();
return BitmapSharedPtr(
new internal::ImplBitmap( rCanvas,
xCanvas->getDevice()->createCompatibleBitmap(
::basegfx::unotools::integerSize2DFromB2ISize(rSize) ) ) );
}
TextSharedPtr BaseGfxFactory::createText( const CanvasSharedPtr& rCanvas, const ::rtl::OUString& rText ) const
{
return TextSharedPtr( new internal::ImplText( rCanvas,
rText ) );
}
}

View File

@@ -0,0 +1,124 @@
/*************************************************************************
*
* $RCSfile: implbitmap.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "implbitmap.hxx"
#include "implbitmapcanvas.hxx"
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplBitmap::ImplBitmap( const CanvasSharedPtr& rParentCanvas,
const uno::Reference< rendering::XBitmap >& rBitmap ) :
CanvasGraphicHelper( rParentCanvas ),
mxBitmap( rBitmap ),
mpBitmapCanvas(
new ImplBitmapCanvas( uno::Reference< rendering::XBitmapCanvas >(rBitmap,
uno::UNO_QUERY) ) )
{
OSL_ENSURE( mxBitmap.is(), "ImplBitmap::ImplBitmap: no valid bitmap" );
}
ImplBitmap::~ImplBitmap()
{
}
bool ImplBitmap::draw() const
{
CanvasSharedPtr pCanvas( getCanvas() );
OSL_ENSURE( pCanvas.get() != NULL &&
pCanvas->getUNOCanvas().is(),
"ImplBitmap::draw: invalid canvas" );
if( pCanvas.get() == NULL ||
pCanvas->getUNOCanvas().is() )
return false;
// TODO: implement caching
pCanvas->getUNOCanvas()->drawBitmap( mxBitmap,
pCanvas->getViewState(),
maRenderState );
return true;
}
BitmapCanvasSharedPtr ImplBitmap::getBitmapCanvas() const
{
return mpBitmapCanvas;
}
uno::Reference< rendering::XBitmap > ImplBitmap::getUNOBitmap() const
{
return mxBitmap;
}
}
}

View File

@@ -0,0 +1,117 @@
/*************************************************************************
*
* $RCSfile: implbitmap.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLBITMAP_HXX
#define _CPPCANVAS_IMPLBITMAP_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XBITMAP_HPP__
#include <drafts/com/sun/star/rendering/XBitmap.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP__
#include <drafts/com/sun/star/rendering/XGraphicDevice.hpp>
#endif
#include <cppcanvas/bitmap.hxx>
#include "canvasgraphichelper.hxx"
/*Definition of ImplBitmap */
namespace cppcanvas
{
namespace internal
{
// share partial CanvasGraphic implementation from CanvasGraphicHelper
class ImplBitmap : public virtual ::cppcanvas::Bitmap, protected CanvasGraphicHelper
{
public:
ImplBitmap( const CanvasSharedPtr& rParentCanvas,
const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XBitmap >& rBitmap );
virtual ~ImplBitmap();
// CanvasGraphic implementation (that was not already implemented by CanvasGraphicHelper)
virtual bool draw() const;
virtual BitmapCanvasSharedPtr getBitmapCanvas() const;
// Bitmap implementation
virtual ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XBitmap > getUNOBitmap() const;
private:
// default: disabled copy/assignment
ImplBitmap(const ImplBitmap&);
ImplBitmap& operator=( const ImplBitmap& );
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XBitmap > mxBitmap;
BitmapCanvasSharedPtr mpBitmapCanvas;
};
}
}
#endif /* _CPPCANVAS_IMPLBITMAP_HXX */

View File

@@ -0,0 +1,112 @@
/*************************************************************************
*
* $RCSfile: implbitmapcanvas.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XCANVAS_HPP__
#include <drafts/com/sun/star/rendering/XCanvas.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XBITMAPCANVAS_HPP__
#include <drafts/com/sun/star/rendering/XBitmapCanvas.hpp>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#include "implbitmapcanvas.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplBitmapCanvas::ImplBitmapCanvas( const uno::Reference< rendering::XBitmapCanvas >& rCanvas ) :
ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
uno::UNO_QUERY) ),
mxBitmapCanvas( rCanvas ),
mxBitmap( rCanvas,
uno::UNO_QUERY )
{
OSL_ENSURE( mxBitmapCanvas.is(), "ImplBitmapCanvas::ImplBitmapCanvas(): Invalid canvas" );
OSL_ENSURE( mxBitmap.is(), "ImplBitmapCanvas::ImplBitmapCanvas(): Invalid bitmap" );
}
ImplBitmapCanvas::~ImplBitmapCanvas()
{
}
::basegfx::B2ISize ImplBitmapCanvas::getSize() const
{
OSL_ENSURE( mxBitmap.is(), "ImplBitmapCanvas::getSize(): Invalid canvas" );
return ::basegfx::unotools::b2ISizeFromIntegerSize2D( mxBitmap->getSize() );
}
BitmapCanvasSharedPtr ImplBitmapCanvas::cloneBitmapCanvas() const
{
return BitmapCanvasSharedPtr( new ImplBitmapCanvas( *this ) );
}
}
}

View File

@@ -0,0 +1,116 @@
/*************************************************************************
*
* $RCSfile: implbitmapcanvas.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLBITMAPCANVAS_HXX
#define _CPPCANVAS_IMPLBITMAPCANVAS_HXX
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XBITMAPCANVAS_HPP__
#include <drafts/com/sun/star/rendering/XBitmapCanvas.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XBITMAP_HPP__
#include <drafts/com/sun/star/rendering/XBitmap.hpp>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#ifndef _BGFX_VECTOR_B2DSIZE_HXX
#include <basegfx/vector/b2dsize.hxx>
#endif
#ifndef _CPPCANVAS_BITMAPCANVAS_HXX
#include <cppcanvas/bitmapcanvas.hxx>
#endif
#include "implcanvas.hxx"
namespace cppcanvas
{
namespace internal
{
// share Canvas implementation from ImplCanvas
class ImplBitmapCanvas : public virtual BitmapCanvas, protected virtual ImplCanvas
{
public:
ImplBitmapCanvas( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XBitmapCanvas >& rCanvas );
virtual ~ImplBitmapCanvas();
virtual ::basegfx::B2ISize getSize() const;
virtual BitmapCanvasSharedPtr cloneBitmapCanvas() const;
// take compiler-provided default copy constructor
//ImplBitmapCanvas(const ImplBitmapCanvas&);
private:
// default: disabled assignment
ImplBitmapCanvas& operator=( const ImplBitmapCanvas& );
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XBitmapCanvas > mxBitmapCanvas;
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XBitmap > mxBitmap;
};
}
}
#endif /* _CPPCANVAS_IMPLBITMAPCANVAS_HXX */

View File

@@ -0,0 +1,158 @@
/*************************************************************************
*
* $RCSfile: implcanvas.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "implcanvas.hxx"
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#include <basegfx/polygon/b2dpolypolygon.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XCANVAS_HPP_
#include <drafts/com/sun/star/rendering/XCanvas.hpp>
#endif
#include <canvas/canvastools.hxx>
#include <cppcanvas/polypolygon.hxx>
#include "implfont.hxx"
#include "implcolor.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplCanvas::ImplCanvas( const uno::Reference< rendering::XCanvas >& xCanvas ) :
maViewState(),
mpClipPolyPolygon(),
mxCanvas( xCanvas )
{
OSL_ENSURE( mxCanvas.is(), "Canvas::Canvas() invalid XCanvas" );
::canvas::tools::initViewState( maViewState );
}
ImplCanvas::~ImplCanvas()
{
}
void ImplCanvas::setTransformation( const ::basegfx::B2DHomMatrix& rMatrix )
{
::canvas::tools::setViewStateTransform( maViewState, rMatrix );
}
::basegfx::B2DHomMatrix ImplCanvas::getTransformation() const
{
::basegfx::B2DHomMatrix aMatrix;
return ::canvas::tools::getViewStateTransform( aMatrix,
maViewState );
}
void ImplCanvas::setClip( const PolyPolygonSharedPtr& rClipPoly )
{
mpClipPolyPolygon = rClipPoly;
maViewState.Clip = rClipPoly.get() != NULL ? rClipPoly->getUNOPolyPolygon() : NULL;
}
PolyPolygonSharedPtr ImplCanvas::getClip() const
{
return mpClipPolyPolygon;
}
FontSharedPtr ImplCanvas::createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const
{
return FontSharedPtr( new ImplFont( getUNOCanvas(), rFontName, rCellSize ) );
}
ColorSharedPtr ImplCanvas::createColor() const
{
return ColorSharedPtr( new ImplColor( getUNOCanvas()->getDevice() ) );
}
CanvasSharedPtr ImplCanvas::cloneCanvas() const
{
return CanvasSharedPtr( new ImplCanvas( *this ) );
}
uno::Reference< rendering::XCanvas > ImplCanvas::getUNOCanvas() const
{
OSL_ENSURE( mxCanvas.is(), "ImplCanvas::getUNOCanvas(): Invalid XCanvas" );
return mxCanvas;
}
rendering::ViewState ImplCanvas::getViewState() const
{
return maViewState;
}
}
}

View File

@@ -0,0 +1,143 @@
/*************************************************************************
*
* $RCSfile: implcanvas.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLCANVAS_HXX
#define _CPPCANVAS_IMPLCANVAS_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_VIEWSTATE_HPP__
#include <drafts/com/sun/star/rendering/ViewState.hpp>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#include <cppcanvas/canvas.hxx>
namespace rtl
{
class OUString;
}
namespace basegfx
{
class B2DHomMatrix;
class B2DPolyPolygon;
}
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
class XCanvas;
} } } } }
/* Definition of ImplCanvas */
namespace cppcanvas
{
namespace internal
{
class ImplCanvas : public virtual Canvas
{
public:
ImplCanvas( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XCanvas >& rCanvas );
virtual ~ImplCanvas();
virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix );
virtual ::basegfx::B2DHomMatrix getTransformation() const;
virtual void setClip( const PolyPolygonSharedPtr& rClipPoly );
virtual PolyPolygonSharedPtr getClip() const;
virtual FontSharedPtr createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const;
virtual ColorSharedPtr createColor() const;
virtual CanvasSharedPtr cloneCanvas() const;
virtual ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XCanvas > getUNOCanvas() const;
virtual ::drafts::com::sun::star::rendering::ViewState getViewState() const;
// take compiler-provided default copy constructor
//ImplCanvas(const ImplCanvas&);
private:
// default: disabled assignment
ImplCanvas& operator=( const ImplCanvas& );
::drafts::com::sun::star::rendering::ViewState maViewState;
PolyPolygonSharedPtr mpClipPolyPolygon;
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XCanvas > mxCanvas;
};
}
}
#endif /* _CPPCANVAS_IMPLCANVAS_HXX */

View File

@@ -0,0 +1,100 @@
/*************************************************************************
*
* $RCSfile: implcolor.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "implcolor.hxx"
#include "tools.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplColor::ImplColor( const uno::Reference< rendering::XGraphicDevice >& rDevice ) :
mxDevice( rDevice )
{
OSL_ENSURE( mxDevice.is(), "ImplColor::ImplColor(): Invalid graphic device" );
}
ImplColor::~ImplColor()
{
}
Color::IntSRGBA ImplColor::getIntSRGBA( uno::Sequence< double >& rDeviceColor ) const
{
OSL_ENSURE( mxDevice.is(), "ImplColor::getIntSRGBA(): Invalid graphic device" );
// TODO: Color space handling
return tools::doubleSequenceToIntSRGBA( mxDevice, rDeviceColor );
}
uno::Sequence< double > ImplColor::getDeviceColor( Color::IntSRGBA aSRGBA ) const
{
OSL_ENSURE( mxDevice.is(), "ImplColor::getDeviceColor(): Invalid graphic device" );
// TODO: Color space handling
return tools::intSRGBAToDoubleSequence( mxDevice, aSRGBA );
}
}
}

View File

@@ -0,0 +1,105 @@
/*************************************************************************
*
* $RCSfile: implcolor.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLCOLOR_HXX
#define _CPPCANVAS_IMPLCOLOR_HXX
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP__
#include <drafts/com/sun/star/rendering/XGraphicDevice.hpp>
#endif
#ifndef _CPPCANVAS_COLOR_HXX
#include <cppcanvas/color.hxx>
#endif
/* Definition of Color class */
namespace cppcanvas
{
namespace internal
{
class ImplColor : public Color
{
public:
ImplColor( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XGraphicDevice >& rDevice );
virtual ~ImplColor();
virtual IntSRGBA getIntSRGBA( ::com::sun::star::uno::Sequence< double >& rDeviceColor ) const;
virtual ::com::sun::star::uno::Sequence< double > getDeviceColor( IntSRGBA aSRGBA ) const;
private:
::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XGraphicDevice > mxDevice;
};
}
}
#endif /* _CPPCANVAS_IMPLCOLOR_HXX */

View File

@@ -0,0 +1,110 @@
/*************************************************************************
*
* $RCSfile: implcustomsprite.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "implcustomsprite.hxx"
#include "implcanvas.hxx"
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplCustomSprite::ImplCustomSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
const uno::Reference< rendering::XCustomSprite >& rSprite ) :
ImplSprite( rParentCanvas,
uno::Reference< rendering::XSprite >(rSprite,
uno::UNO_QUERY) ),
mpLastCanvas(),
mxCustomSprite( rSprite )
{
OSL_ENSURE( rParentCanvas.is(), "ImplCustomSprite::ImplCustomSprite(): Invalid canvas" );
OSL_ENSURE( mxCustomSprite.is(), "ImplCustomSprite::ImplCustomSprite(): Invalid sprite" );
}
ImplCustomSprite::~ImplCustomSprite()
{
}
CanvasSharedPtr ImplCustomSprite::getContentCanvas() const
{
OSL_ENSURE( mxCustomSprite.is(), "ImplCustomSprite::getContentCanvas(): Invalid sprite" );
if( !mxCustomSprite.is() )
return CanvasSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( mxCustomSprite->getContentCanvas() );
if( !xCanvas.is() )
return CanvasSharedPtr();
// cache content canvas C++ wrapper
if( mpLastCanvas.get() == NULL ||
mpLastCanvas->getUNOCanvas() != xCanvas )
{
mpLastCanvas = CanvasSharedPtr( new ImplCanvas( xCanvas ) );
}
return mpLastCanvas;
}
}
}

View File

@@ -0,0 +1,110 @@
/*************************************************************************
*
* $RCSfile: implcustomsprite.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLCUSTOMSPRITE_HXX
#define _CPPCANVAS_IMPLCUSTOMSPRITE_HXX
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#ifndef _CPPCANVAS_CANVAS_HXX
#include <cppcanvas/canvas.hxx>
#endif
#ifndef _CPPCANVAS_CUSTOMSPRITE_HXX
#include <cppcanvas/customsprite.hxx>
#endif
#include "implsprite.hxx"
namespace cppcanvas
{
namespace internal
{
// share Sprite implementation of ImplSprite
class ImplCustomSprite : public virtual CustomSprite, protected virtual ImplSprite
{
public:
ImplCustomSprite( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XSpriteCanvas >& rParentCanvas,
const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XCustomSprite >& rSprite );
virtual ~ImplCustomSprite();
virtual CanvasSharedPtr getContentCanvas() const;
private:
// default: disabled copy/assignment
ImplCustomSprite(const ImplCustomSprite&);
ImplCustomSprite& operator=( const ImplCustomSprite& );
mutable CanvasSharedPtr mpLastCanvas;
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XCustomSprite > mxCustomSprite;
};
}
}
#endif /* _CPPCANVAS_IMPLCUSTOMSPRITE_HXX */

View File

@@ -0,0 +1,117 @@
/*************************************************************************
*
* $RCSfile: implfont.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "implfont.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
/* Definition of Font class */
namespace cppcanvas
{
namespace internal
{
ImplFont::ImplFont( const uno::Reference< rendering::XCanvas >& rCanvas,
const ::rtl::OUString& rFontName,
const double& rCellSize ) :
mxCanvas( rCanvas ),
mxFont( NULL )
{
OSL_ENSURE( mxCanvas.is(), "ImplFont::ImplFont(): Invalid Canvas" );
rendering::FontRequest aFontRequest;
aFontRequest.FamilyName = rFontName;
aFontRequest.CellSize = rCellSize;
mxFont = mxCanvas->queryFont( aFontRequest );
}
ImplFont::~ImplFont()
{
}
::rtl::OUString ImplFont::getName() const
{
OSL_ENSURE( mxFont.is(), "ImplFont::getName(): Invalid Font" );
return mxFont->getFontRequest().FamilyName;
}
double ImplFont::getCellSize() const
{
OSL_ENSURE( mxFont.is(), "ImplFont::getCellSize(): Invalid Font" );
return mxFont->getFontRequest().CellSize;
}
uno::Reference< rendering::XCanvasFont > ImplFont::getUNOFont() const
{
OSL_ENSURE( mxFont.is(), "ImplFont::getUNOFont(): Invalid Font" );
return mxFont;
}
}
}

View File

@@ -0,0 +1,122 @@
/*************************************************************************
*
* $RCSfile: implfont.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLFONT_HXX
#define _CPPCANVAS_IMPLFONT_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XCANVAS_HPP__
#include <drafts/com/sun/star/rendering/XCanvas.hpp>
#endif
#ifndef _CPPCANVAS_FONT_HXX
#include <cppcanvas/font.hxx>
#endif
namespace rtl
{
class OUString;
}
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
class XCanvasFont;
} } } } }
/* Definition of Font class */
namespace cppcanvas
{
namespace internal
{
class ImplFont : public Font
{
public:
ImplFont( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XCanvas >& rCanvas,
const ::rtl::OUString& rFontName,
const double& rCellSize );
virtual ~ImplFont();
virtual ::rtl::OUString getName() const;
virtual double getCellSize() const;
virtual ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XCanvasFont > getUNOFont() const;
private:
::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XCanvas > mxCanvas;
::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XCanvasFont > mxFont;
};
}
}
#endif /* _CPPCANVAS_IMPLFONT_HXX */

View File

@@ -0,0 +1,217 @@
/*************************************************************************
*
* $RCSfile: implpolypolygon.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#include "implpolypolygon.hxx"
#include "tools.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplPolyPolygon::ImplPolyPolygon( const CanvasSharedPtr& rParentCanvas,
const uno::Reference< rendering::XPolyPolygon2D >& rPolyPoly ) :
CanvasGraphicHelper( rParentCanvas ),
mxPolyPoly( rPolyPoly ),
maFillColor(),
maStrokeColor(),
mbFillColorSet( false ),
mbStrokeColorSet( false )
{
OSL_ENSURE( mxPolyPoly.is(), "PolyPolygonImpl::PolyPolygonImpl: no valid polygon" );
}
ImplPolyPolygon::~ImplPolyPolygon()
{
}
void ImplPolyPolygon::addPolygon( const ::basegfx::B2DPolygon& rPoly )
{
OSL_ENSURE( mxPolyPoly.is(),
"ImplPolyPolygon::addPolygon(): Invalid polygon" );
if( !mxPolyPoly.is() )
return;
uno::Reference< rendering::XGraphicDevice > xDevice( getGraphicDevice() );
OSL_ENSURE( xDevice.is(),
"ImplPolyPolygon::addPolygon(): Invalid graphic device" );
if( !xDevice.is() )
return;
mxPolyPoly->addPolyPolygon( geometry::RealPoint2D(0.0, 0.0),
::basegfx::unotools::xPolyPolygonFromB2DPolygon(
xDevice,
rPoly) );
}
void ImplPolyPolygon::addPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly )
{
OSL_ENSURE( mxPolyPoly.is(),
"ImplPolyPolygon::addPolyPolygon(): Invalid polygon" );
if( !mxPolyPoly.is() )
return;
uno::Reference< rendering::XGraphicDevice > xDevice( getGraphicDevice() );
OSL_ENSURE( xDevice.is(),
"ImplPolyPolygon::addPolyPolygon(): Invalid graphic device" );
if( !xDevice.is() )
return;
mxPolyPoly->addPolyPolygon( geometry::RealPoint2D(0.0, 0.0),
::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
xDevice,
rPoly) );
}
void ImplPolyPolygon::setRGBAFillColor( Color::IntSRGBA aColor )
{
maFillColor = tools::intSRGBAToDoubleSequence( getGraphicDevice(),
aColor );
mbFillColorSet = true;
}
void ImplPolyPolygon::setRGBALineColor( Color::IntSRGBA aColor )
{
maStrokeColor = tools::intSRGBAToDoubleSequence( getGraphicDevice(),
aColor );
mbStrokeColorSet = true;
}
Color::IntSRGBA ImplPolyPolygon::getRGBAFillColor() const
{
return tools::doubleSequenceToIntSRGBA( getGraphicDevice(),
maFillColor );
}
Color::IntSRGBA ImplPolyPolygon::getRGBALineColor() const
{
return tools::doubleSequenceToIntSRGBA( getGraphicDevice(),
maStrokeColor );
}
void ImplPolyPolygon::setStrokeWidth( const double& rStrokeWidth )
{
maStrokeAttributes.StrokeWidth = rStrokeWidth;
}
double ImplPolyPolygon::getStrokeWidth() const
{
return maStrokeAttributes.StrokeWidth;
}
bool ImplPolyPolygon::draw() const
{
CanvasSharedPtr pCanvas( getCanvas() );
OSL_ENSURE( pCanvas.get() != NULL &&
pCanvas->getUNOCanvas().is(),
"ImplBitmap::draw: invalid canvas" );
if( pCanvas.get() == NULL ||
pCanvas->getUNOCanvas().is() )
return false;
if( mbFillColorSet )
{
maRenderState.DeviceColor = maFillColor;
pCanvas->getUNOCanvas()->fillPolyPolygon( mxPolyPoly,
pCanvas->getViewState(),
maRenderState );
}
if( mbStrokeColorSet )
{
maRenderState.DeviceColor = maStrokeColor;
pCanvas->getUNOCanvas()->strokePolyPolygon( mxPolyPoly,
pCanvas->getViewState(),
maRenderState,
maStrokeAttributes );
}
return true;
}
uno::Reference< rendering::XPolyPolygon2D > ImplPolyPolygon::getUNOPolyPolygon() const
{
return mxPolyPoly;
}
}
}

View File

@@ -0,0 +1,135 @@
/*************************************************************************
*
* $RCSfile: implpolypolygon.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CANVAS_IMPLPOLYPOLYGON_HXX
#define _CANVAS_IMPLPOLYPOLYGON_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP__
#include <drafts/com/sun/star/rendering/XPolyPolygon2D.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP__
#include <drafts/com/sun/star/rendering/XGraphicDevice.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_STROKEATTRIBUTES_HPP__
#include <drafts/com/sun/star/rendering/StrokeAttributes.hpp>
#endif
#include <cppcanvas/polypolygon.hxx>
#include "canvasgraphichelper.hxx"
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
{
struct RealPoint2D;
} } } } }
namespace cppcanvas
{
namespace internal
{
class ImplPolyPolygon : public virtual ::cppcanvas::PolyPolygon, protected CanvasGraphicHelper
{
public:
ImplPolyPolygon( const CanvasSharedPtr& rParentCanvas,
const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XPolyPolygon2D >& rPolyPoly );
virtual ~ImplPolyPolygon();
virtual void addPolygon( const ::basegfx::B2DPolygon& rPoly );
virtual void addPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly );
virtual void setRGBAFillColor( Color::IntSRGBA );
virtual void setRGBALineColor( Color::IntSRGBA );
virtual Color::IntSRGBA getRGBAFillColor() const;
virtual Color::IntSRGBA getRGBALineColor() const;
virtual void setStrokeWidth( const double& rStrokeWidth );
virtual double getStrokeWidth() const;
virtual bool draw() const;
virtual ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XPolyPolygon2D > getUNOPolyPolygon() const;
private:
// default: disabled copy/assignment
ImplPolyPolygon(const ImplPolyPolygon&);
ImplPolyPolygon& operator= ( const ImplPolyPolygon& );
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XPolyPolygon2D > mxPolyPoly;
::drafts::com::sun::star::rendering::StrokeAttributes maStrokeAttributes;
::com::sun::star::uno::Sequence< double > maFillColor;
::com::sun::star::uno::Sequence< double > maStrokeColor;
bool mbFillColorSet;
bool mbStrokeColorSet;
};
}
}
#endif /* _CANVAS_IMPLPOLYPOLYGON_HXX */

View File

@@ -0,0 +1,205 @@
/*************************************************************************
*
* $RCSfile: implsprite.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XSPRITE_HPP_
#include <drafts/com/sun/star/rendering/XSprite.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XANIMATEDSPRITE_HPP_
#include <drafts/com/sun/star/rendering/XAnimatedSprite.hpp>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#include "implsprite.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplSprite::ImplSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
const uno::Reference< rendering::XSprite >& rSprite ) :
mxGraphicDevice( rParentCanvas.is() ? rParentCanvas->getDevice() : NULL ),
mxSprite( rSprite ),
mxAnimatedSprite()
{
OSL_ENSURE( rParentCanvas.is() , "ImplSprite::ImplSprite(): Invalid canvas");
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::ImplSprite(): Invalid graphic device");
OSL_ENSURE( mxSprite.is(), "ImplSprite::ImplSprite(): Invalid sprite");
}
ImplSprite::ImplSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
const uno::Reference< rendering::XAnimatedSprite >& rSprite ) :
mxGraphicDevice( rParentCanvas.is() ? rParentCanvas->getDevice() : NULL ),
mxSprite( uno::Reference< rendering::XSprite >(rSprite,
uno::UNO_QUERY) ),
mxAnimatedSprite( rSprite )
{
OSL_ENSURE( rParentCanvas.is() , "ImplSprite::ImplSprite(): Invalid canvas");
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::ImplSprite(): Invalid graphic device");
OSL_ENSURE( mxSprite.is(), "ImplSprite::ImplSprite(): Invalid sprite");
}
ImplSprite::~ImplSprite()
{
}
void ImplSprite::setAlpha( const double& rAlpha )
{
OSL_ENSURE( mxSprite.is(), "ImplSprite::setAlpha(): Invalid sprite");
if( mxSprite.is() )
mxSprite->setAlpha( rAlpha );
}
void ImplSprite::movePixel( const ::basegfx::B2DPoint& rNewPos )
{
OSL_ENSURE( mxSprite.is(), "ImplSprite::movePixel(): Invalid sprite");
if( mxSprite.is() )
{
rendering::ViewState aViewState;
rendering::RenderState aRenderState;
::canvas::tools::initViewState( aViewState );
::canvas::tools::initRenderState( aRenderState );
mxSprite->move( ::basegfx::unotools::point2DFromB2DPoint( rNewPos ),
aViewState,
aRenderState );
}
}
void ImplSprite::move( const ::basegfx::B2DPoint& rNewPos )
{
// TODO: Not yet implemented. Need reference to parent canvas here
OSL_ENSURE( false, "ImplSprite::move(): Not yet implemented!");
}
void ImplSprite::transform( const ::basegfx::B2DHomMatrix& rMatrix )
{
OSL_ENSURE( mxSprite.is(), "ImplSprite::transform(): Invalid sprite");
if( mxSprite.is() )
{
geometry::AffineMatrix2D aMatrix;
mxSprite->transform( ::basegfx::unotools::affineMatrixFromHomMatrix( aMatrix,
rMatrix ) );
}
}
void ImplSprite::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly )
{
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::setClip(): Invalid canvas");
OSL_ENSURE( mxSprite.is(), "ImplSprite::transform(): Invalid sprite");
if( mxSprite.is() && mxGraphicDevice.is() )
{
rendering::ViewState aViewState;
rendering::RenderState aRenderState;
::canvas::tools::initViewState( aViewState );
::canvas::tools::initRenderState( aRenderState );
mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice,
rClipPoly ),
aViewState,
aRenderState );
}
}
void ImplSprite::show()
{
OSL_ENSURE( mxSprite.is(), "ImplSprite::show(): Invalid sprite");
if( mxSprite.is() )
mxSprite->show();
}
void ImplSprite::hide()
{
OSL_ENSURE( mxSprite.is(), "ImplSprite::hide(): Invalid sprite");
if( mxSprite.is() )
mxSprite->hide();
}
uno::Reference< rendering::XSprite > ImplSprite::getUNOSprite() const
{
return mxSprite;
}
uno::Reference< rendering::XGraphicDevice > ImplSprite::getGraphicDevice() const
{
return mxGraphicDevice;
}
}
}

View File

@@ -0,0 +1,129 @@
/*************************************************************************
*
* $RCSfile: implsprite.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLSPRITE_HXX
#define _CPPCANVAS_IMPLSPRITE_HXX
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XSPRITECANVAS_HPP_
#include <drafts/com/sun/star/rendering/XSpriteCanvas.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XSPRITE_HPP_
#include <drafts/com/sun/star/rendering/XSprites.hpp>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#ifndef _CPPCANVAS_SPRITE_HXX
#include <cppcanvas/sprite.hxx>
#endif
namespace cppcanvas
{
namespace internal
{
class ImplSprite : public virtual Sprite
{
public:
ImplSprite( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XSpriteCanvas >& rParentCanvas,
const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XSprite >& rSprite );
ImplSprite( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XSpriteCanvas >& rParentCanvas,
const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XAnimatedSprite >& rSprite );
virtual ~ImplSprite();
virtual void setAlpha( const double& rAlpha );
virtual void movePixel( const ::basegfx::B2DPoint& rNewPos );
virtual void move( const ::basegfx::B2DPoint& rNewPos );
virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix );
virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly );
virtual void show();
virtual void hide();
virtual ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XSprite > getUNOSprite() const;
::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XGraphicDevice >
getGraphicDevice() const;
private:
// default: disabled copy/assignment
ImplSprite(const ImplSprite&);
ImplSprite& operator=( const ImplSprite& );
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XGraphicDevice > mxGraphicDevice;
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XSprite > mxSprite;
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XAnimatedSprite > mxAnimatedSprite;
};
}
}
#endif /* _CPPCANVAS_IMPLSPRITE_HXX */

View File

@@ -0,0 +1,145 @@
/*************************************************************************
*
* $RCSfile: implspritecanvas.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#include "implspritecanvas.hxx"
#include "implcustomsprite.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
uno::UNO_QUERY) ),
ImplBitmapCanvas( uno::Reference< rendering::XBitmapCanvas >(rCanvas,
uno::UNO_QUERY) ),
mxSpriteCanvas( rCanvas )
{
OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::ImplSpriteCanvas(): Invalid canvas" );
}
ImplSpriteCanvas::~ImplSpriteCanvas()
{
}
bool ImplSpriteCanvas::updateScreen() const
{
OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::updateScreen(): Invalid canvas" );
if( !mxSpriteCanvas.is() )
return false;
return mxSpriteCanvas->updateScreen();
}
CustomSpriteSharedPtr ImplSpriteCanvas::createCustomSprite( const ::basegfx::B2DSize& rSize ) const
{
OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::createCustomSprite(): Invalid canvas" );
if( !mxSpriteCanvas.is() )
return CustomSpriteSharedPtr();
return CustomSpriteSharedPtr(
new ImplCustomSprite( mxSpriteCanvas,
mxSpriteCanvas->createCustomSprite( ::basegfx::unotools::size2DFromB2DSize(rSize) ) ) );
}
SpriteSharedPtr ImplSpriteCanvas::createClonedSprite( const SpriteSharedPtr& rSprite ) const
{
OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::createCustomSprite(): Invalid canvas" );
OSL_ENSURE( rSprite.get() != NULL && rSprite->getUNOSprite().is(),
"ImplSpriteCanvas::createCustomSprite(): Invalid sprite" );
if( !mxSpriteCanvas.is() ||
rSprite.get() == NULL ||
!rSprite->getUNOSprite().is() )
{
return SpriteSharedPtr();
}
return SpriteSharedPtr(
new ImplSprite( mxSpriteCanvas,
mxSpriteCanvas->createClonedSprite( rSprite->getUNOSprite() ) ) );
}
SpriteCanvasSharedPtr ImplSpriteCanvas::cloneSpriteCanvas() const
{
return SpriteCanvasSharedPtr( new ImplSpriteCanvas( *this ) );
}
uno::Reference< rendering::XSpriteCanvas > ImplSpriteCanvas::getUNOSpriteCanvas() const
{
return mxSpriteCanvas;
}
}
}

View File

@@ -0,0 +1,118 @@
/*************************************************************************
*
* $RCSfile: implspritecanvas.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPCANVAS_IMPLSPRITECANVAS_HXX
#define _CPPCANVAS_IMPLSPRITECANVAS_HXX
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XSPRITECANVAS_HPP__
#include <drafts/com/sun/star/rendering/XSpriteCanvas.hpp>
#endif
#ifndef _BGFX_VECTOR_B2DSIZE_HXX
#include <basegfx/vector/b2dsize.hxx>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <external/boost/shared_ptr.hpp>
#endif
#ifndef _CPPCANVAS_SPRITECANVAS_HXX
#include <cppcanvas/spritecanvas.hxx>
#endif
#include "implbitmapcanvas.hxx"
namespace cppcanvas
{
namespace internal
{
class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplBitmapCanvas
{
public:
ImplSpriteCanvas( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XSpriteCanvas >& rCanvas );
virtual ~ImplSpriteCanvas();
virtual bool updateScreen() const;
virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const;
virtual SpriteSharedPtr createClonedSprite( const SpriteSharedPtr& ) const;
virtual SpriteCanvasSharedPtr cloneSpriteCanvas() const;
virtual ::com::sun::star::uno::Reference<
::drafts::com::sun::star::rendering::XSpriteCanvas > getUNOSpriteCanvas() const;
// take compiler-provided default copy constructor
//ImplSpriteCanvas(const ImplSpriteCanvas&);
private:
// default: disabled assignment
ImplSpriteCanvas& operator=( const ImplSpriteCanvas& );
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XSpriteCanvas > mxSpriteCanvas;
};
}
}
#endif /* _CPPCANVAS_IMPLSPRITECANVAS_HXX */

View File

@@ -0,0 +1,137 @@
/*************************************************************************
*
* $RCSfile: impltext.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "impltext.hxx"
#include <canvas/canvastools.hxx>
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_TEXTDIRECTION_HPP__
#include <drafts/com/sun/star/rendering/TextDirection.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XCANVAS_HPP__
#include <drafts/com/sun/star/rendering/XCanvas.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_STRINGCONTEXT_HPP__
#include <drafts/com/sun/star/rendering/StringContext.hpp>
#endif
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
namespace internal
{
ImplText::ImplText( const CanvasSharedPtr& rParentCanvas,
const ::rtl::OUString& rText ) :
CanvasGraphicHelper( rParentCanvas ),
mpFont(),
maText(rText)
{
}
ImplText::~ImplText()
{
}
bool ImplText::draw() const
{
CanvasSharedPtr pCanvas( getCanvas() );
OSL_ENSURE( pCanvas.get() != NULL &&
pCanvas->getUNOCanvas().is(),
"ImplBitmap::draw: invalid canvas" );
rendering::StringContext aText;
aText.Text = maText;
aText.StartPosition = 0;
aText.Length = maText.getLength();
// TODO: implement caching
pCanvas->getUNOCanvas()->drawText( aText,
mpFont->getUNOFont(),
pCanvas->getViewState(),
maRenderState,
rendering::TextDirection::LEFT_TO_RIGHT );
return true;
}
void ImplText::setFont( const FontSharedPtr& rFont )
{
mpFont = rFont;
}
FontSharedPtr ImplText::getFont()
{
return mpFont;
}
}
}

View File

@@ -0,0 +1,112 @@
/*************************************************************************
*
* $RCSfile: impltext.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CANVAS_IMPLTEXT_HXX
#define _CANVAS_IMPLTEXT_HXX
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
#include <drafts/com/sun/star/rendering/RenderState.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_STRINGCONTEXT_HPP__
#include <drafts/com/sun/star/rendering/StringContext.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XCANVAS_HPP__
#include <drafts/com/sun/star/rendering/XCanvas.hpp>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_XCANVASFONT_HPP__
#include <drafts/com/sun/star/rendering/XCanvasFont.hpp>
#endif
#include <cppcanvas/text.hxx>
#include "canvasgraphichelper.hxx"
namespace cppcanvas
{
namespace internal
{
class ImplText : public virtual ::cppcanvas::Text, protected CanvasGraphicHelper
{
public:
ImplText( const CanvasSharedPtr& rParentCanvas,
const ::rtl::OUString& rText );
virtual ~ImplText();
virtual bool draw() const;
virtual void setFont( const FontSharedPtr& );
virtual FontSharedPtr getFont();
private:
// default: disabled copy/assignment
ImplText(const ImplText&);
ImplText& operator= ( const ImplText& );
FontSharedPtr mpFont;
::rtl::OUString maText;
};
}
}
#endif /* _CANVAS_IMPLTEXT_HXX */

View File

@@ -0,0 +1,95 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.2 $
#
# last change: $Author: thb $ $Date: 2004-03-18 10:41:14 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 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
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME=cppcanvas
TARGET=canvaswrapper
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------------
.INCLUDE : settings.mk
# --- Common ----------------------------------------------------------
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
CDEFS+= -DVERBOSE
.ENDIF
SLOFILES = $(SLO)$/implbitmap.obj \
$(SLO)$/implcanvas.obj \
$(SLO)$/implcolor.obj \
$(SLO)$/implfont.obj \
$(SLO)$/vclfactory.obj \
$(SLO)$/basegfxfactory.obj \
$(SLO)$/impltext.obj \
$(SLO)$/implpolypolygon.obj \
$(SLO)$/implbitmapcanvas.obj \
$(SLO)$/implspritecanvas.obj \
$(SLO)$/implsprite.obj \
$(SLO)$/implcustomsprite.obj
# ==========================================================================
.INCLUDE : target.mk

View File

@@ -0,0 +1,368 @@
/*************************************************************************
*
* $RCSfile: vclfactory.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: thb $ $Date: 2004-03-18 10:41:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef INCLUDED_RTL_INSTANCE_HXX
#include <rtl/instance.hxx>
#endif
#ifndef INCLUDED_OSL_GETGLOBALMUTEX_HXX
#include <osl/getglobalmutex.hxx>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_INTERPOLATIONMODE_HPP_
#include <drafts/com/sun/star/rendering/InterpolationMode.hpp>
#endif
#ifndef _SV_WINDOW_HXX
#include <vcl/window.hxx>
#endif
#ifndef _SV_GRAPH_HXX
#include <vcl/graph.hxx>
#endif
#ifndef _VCL_CANVASTOOLS_HXX
#include <vcl/canvastools.hxx>
#endif
#include <cppcanvas/vclfactory.hxx>
#include "implbitmapcanvas.hxx"
#include "implspritecanvas.hxx"
#include "implpolypolygon.hxx"
#include "implbitmap.hxx"
#include "implrenderer.hxx"
#include "impltext.hxx"
#include "implsprite.hxx"
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
namespace cppcanvas
{
/* Singleton handling */
struct InitInstance
{
VCLFactory* operator()()
{
return new VCLFactory();
}
};
VCLFactory& VCLFactory::getInstance()
{
return *rtl_Instance< VCLFactory, InitInstance, ::osl::MutexGuard,
::osl::GetGlobalMutex >::create(
InitInstance(), ::osl::GetGlobalMutex());
}
VCLFactory::VCLFactory()
{
}
VCLFactory::~VCLFactory()
{
}
BitmapCanvasSharedPtr VCLFactory::createCanvas( const ::Window& rVCLWindow )
{
return BitmapCanvasSharedPtr(
new internal::ImplBitmapCanvas(
uno::Reference< rendering::XBitmapCanvas >(
rVCLWindow.GetCanvas(),
uno::UNO_QUERY) ) );
}
SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const ::Window& rVCLWindow ) const
{
return SpriteCanvasSharedPtr(
new internal::ImplSpriteCanvas(
uno::Reference< rendering::XSpriteCanvas >(
rVCLWindow.GetCanvas(),
uno::UNO_QUERY) ) );
}
SpriteCanvasSharedPtr VCLFactory::createFullscreenSpriteCanvas( const ::Window& rVCLWindow,
const Size& rFullscreenSize ) const
{
return SpriteCanvasSharedPtr(
new internal::ImplSpriteCanvas(
uno::Reference< rendering::XSpriteCanvas >(
rVCLWindow.GetFullscreenCanvas( rFullscreenSize ),
uno::UNO_QUERY) ) );
}
PolyPolygonSharedPtr VCLFactory::createPolyPolygon( const CanvasSharedPtr& rCanvas,
const ::Polygon& rPoly ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"VCLFactory::createPolyPolygon(): Invalid canvas" );
if( rCanvas.get() == NULL )
return PolyPolygonSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return PolyPolygonSharedPtr();
return PolyPolygonSharedPtr(
new internal::ImplPolyPolygon( rCanvas,
::vcl::unotools::xPolyPolygonFromPolygon(
xCanvas->getDevice(),
rPoly) ) );
}
PolyPolygonSharedPtr VCLFactory::createPolyPolygon( const CanvasSharedPtr& rCanvas,
const ::PolyPolygon& rPolyPoly ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"VCLFactory::createPolyPolygon(): Invalid canvas" );
if( rCanvas.get() == NULL )
return PolyPolygonSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return PolyPolygonSharedPtr();
return PolyPolygonSharedPtr(
new internal::ImplPolyPolygon( rCanvas,
::vcl::unotools::xPolyPolygonFromPolyPolygon(
xCanvas->getDevice(),
rPolyPoly) ) );
}
BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& rCanvas,
const ::Size& rSize ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"VCLFactory::createBitmap(): Invalid canvas" );
if( rCanvas.get() == NULL )
return BitmapSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return BitmapSharedPtr();
return BitmapSharedPtr(
new internal::ImplBitmap( rCanvas,
xCanvas->getDevice()->createCompatibleBitmap(
::vcl::unotools::integerSize2DFromSize(rSize) ) ) );
}
BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& rCanvas,
const ::Bitmap& rBitmap ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"VCLFactory::createBitmap(): Invalid canvas" );
if( rCanvas.get() == NULL )
return BitmapSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return BitmapSharedPtr();
return BitmapSharedPtr( new internal::ImplBitmap( rCanvas,
::vcl::unotools::xBitmapFromBitmap(
xCanvas->getDevice(),
rBitmap) ) );
}
BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& rCanvas,
const ::BitmapEx& rBmpEx ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"VCLFactory::createBitmap(): Invalid canvas" );
if( rCanvas.get() == NULL )
return BitmapSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return BitmapSharedPtr();
return BitmapSharedPtr( new internal::ImplBitmap( rCanvas,
::vcl::unotools::xBitmapFromBitmapEx(
xCanvas->getDevice(),
rBmpEx) ) );
}
RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr& rCanvas, const ::Graphic& rGraphic ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"VCLFactory::createRenderer(): Invalid canvas" );
if( rCanvas.get() == NULL )
return RendererSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return RendererSharedPtr();
if( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
rGraphic.GetGDIMetaFile() ) );
else
return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
rGraphic.GetBitmapEx()) );
}
RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr& rCanvas, const ::GDIMetaFile& rMtf ) const
{
return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
rMtf ) );
}
SpriteSharedPtr VCLFactory::createAnimatedSprite( const SpriteCanvasSharedPtr& rCanvas, const ::Animation& rAnim ) const
{
OSL_ENSURE( rCanvas.get() != NULL &&
rCanvas->getUNOCanvas().is(),
"VCLFactory::createAnimatedSprite(): Invalid canvas" );
if( rCanvas.get() == NULL )
return SpriteSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
if( !xCanvas.is() )
return SpriteSharedPtr();
uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( rCanvas->getUNOSpriteCanvas() );
if( !xSpriteCanvas.is() )
return SpriteSharedPtr();
if( rAnim.IsEmpty() )
return SpriteSharedPtr();
const USHORT nBitmaps( rAnim.Count() );
uno::Sequence< uno::Reference< rendering::XBitmap > > aBitmapSequence( nBitmaps );
unsigned int i;
BitmapEx aBmpEx;
BitmapEx aRestoreBuffer;
aBmpEx.SetSizePixel( rAnim.GetDisplaySizePixel() );
aRestoreBuffer.SetSizePixel( rAnim.GetDisplaySizePixel() );
aBmpEx.Erase( ::Color( 255, 0,0,0 ) ); // clear alpha channel
aRestoreBuffer = aBmpEx;
const Point aEmptyPoint;
for( i=0; i<nBitmaps; ++i )
{
const AnimationBitmap& rAnimBmp( rAnim.Get(i) );
// Handle dispose according to GIF spec: a
// DISPOSE_PREVIOUS does _not_ mean to revert to the
// previous frame, but to revert to the last frame with
// DISPOSE_NOT
// dispose previous
if( rAnimBmp.eDisposal == DISPOSE_BACK )
{
// simply clear bitmap to transparent
aBmpEx.Erase( ::Color( 255, 0,0,0 ) );
}
else if( rAnimBmp.eDisposal == DISPOSE_PREVIOUS )
{
// copy in last known full frame
aBmpEx = aRestoreBuffer;
}
// I have exactly _no_ idea what DISPOSE_FULL is supposed
// to do. It's apparently not set anywhere in our code
OSL_ENSURE( rAnimBmp.eDisposal!=DISPOSE_FULL,
"VCLFactory::createAnimatedSprite(): Somebody set the deprecated DISPOSE_FULL at the Animation" );
// update display
aBmpEx.CopyPixel( Rectangle( rAnimBmp.aPosPix,
rAnimBmp.aSizePix ),
Rectangle( aEmptyPoint,
rAnimBmp.aSizePix ),
&rAnimBmp.aBmpEx );
// store last DISPOSE_NOT frame, for later
// DISPOSE_PREVIOUS updates
if( rAnimBmp.eDisposal == DISPOSE_NOT )
aRestoreBuffer = aBmpEx;
aBitmapSequence[i] = ::vcl::unotools::xBitmapFromBitmapEx(
xCanvas->getDevice(),
aBmpEx);
}
return SpriteSharedPtr( new internal::ImplSprite( xSpriteCanvas,
xSpriteCanvas->createSpriteFromBitmaps( aBitmapSequence,
rendering::InterpolationMode::NEAREST_NEIGHBOR ) ) );
}
TextSharedPtr VCLFactory::createText( const CanvasSharedPtr& rCanvas, const ::rtl::OUString& rText ) const
{
return TextSharedPtr( new internal::ImplText( rCanvas,
rText ) );
}
}