#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:
217
cppcanvas/source/mtfrenderer/bitmapaction.cxx
Normal file
217
cppcanvas/source/mtfrenderer/bitmapaction.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
137
cppcanvas/source/mtfrenderer/bitmapaction.hxx
Normal file
137
cppcanvas/source/mtfrenderer/bitmapaction.hxx
Normal 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 */
|
1226
cppcanvas/source/mtfrenderer/implrenderer.cxx
Normal file
1226
cppcanvas/source/mtfrenderer/implrenderer.cxx
Normal file
File diff suppressed because it is too large
Load Diff
118
cppcanvas/source/mtfrenderer/lineaction.cxx
Normal file
118
cppcanvas/source/mtfrenderer/lineaction.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
111
cppcanvas/source/mtfrenderer/lineaction.hxx
Normal file
111
cppcanvas/source/mtfrenderer/lineaction.hxx
Normal 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 */
|
90
cppcanvas/source/mtfrenderer/makefile.mk
Normal file
90
cppcanvas/source/mtfrenderer/makefile.mk
Normal 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
|
93
cppcanvas/source/mtfrenderer/mtftools.cxx
Normal file
93
cppcanvas/source/mtfrenderer/mtftools.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
89
cppcanvas/source/mtfrenderer/mtftools.hxx
Normal file
89
cppcanvas/source/mtfrenderer/mtftools.hxx
Normal 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 */
|
133
cppcanvas/source/mtfrenderer/outdevstate.hxx
Normal file
133
cppcanvas/source/mtfrenderer/outdevstate.hxx
Normal 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 */
|
128
cppcanvas/source/mtfrenderer/pointaction.cxx
Normal file
128
cppcanvas/source/mtfrenderer/pointaction.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
112
cppcanvas/source/mtfrenderer/pointaction.hxx
Normal file
112
cppcanvas/source/mtfrenderer/pointaction.hxx
Normal 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 */
|
197
cppcanvas/source/mtfrenderer/polypolyaction.cxx
Normal file
197
cppcanvas/source/mtfrenderer/polypolyaction.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
134
cppcanvas/source/mtfrenderer/polypolyaction.hxx
Normal file
134
cppcanvas/source/mtfrenderer/polypolyaction.hxx
Normal 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 */
|
158
cppcanvas/source/mtfrenderer/textaction.cxx
Normal file
158
cppcanvas/source/mtfrenderer/textaction.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
137
cppcanvas/source/mtfrenderer/textaction.hxx
Normal file
137
cppcanvas/source/mtfrenderer/textaction.hxx
Normal 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 */
|
Reference in New Issue
Block a user