#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:
153
cppcanvas/inc/cppcanvas/basegfxfactory.hxx
Normal file
153
cppcanvas/inc/cppcanvas/basegfxfactory.hxx
Normal file
@@ -0,0 +1,153 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: basegfxfactory.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:57 $
|
||||
*
|
||||
* 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_BASEGFXFACTORY_HXX
|
||||
#define _CPPCANVAS_BASEGFXFACTORY_HXX
|
||||
|
||||
#ifndef _CPPCANVAS_CANVAS_HXX
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_BITMAPCANVAS_HXX
|
||||
#include <cppcanvas/bitmapcanvas.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_SPRITECANVAS_HXX
|
||||
#include <cppcanvas/spritecanvas.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_POLYPOLYGON_HXX
|
||||
#include <cppcanvas/polypolygon.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_BITMAP_HXX
|
||||
#include <cppcanvas/bitmap.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_RENDERER_HXX
|
||||
#include <cppcanvas/renderer.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_TEXT_HXX
|
||||
#include <cppcanvas/text.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_SPRITE_HXX
|
||||
#include <cppcanvas/sprite.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _BGFX_VECTOR_B2ISIZE_HXX
|
||||
#include <basegfx/vector/b2isize.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
class B2DPolygon;
|
||||
class B2DPolyPolygon;
|
||||
}
|
||||
|
||||
namespace rtl
|
||||
{
|
||||
class OUString;
|
||||
}
|
||||
|
||||
/* Definition of BaseGfxFactory class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
/** The BaseGfxFactory creates Canvas objects for various basegfx
|
||||
primitives, such as polygons and bitmaps (not yet
|
||||
implemented).
|
||||
|
||||
Please note that the objects created for a specific Canvas can
|
||||
only be drawn on exactly that canvas. You have to regenerate
|
||||
them for different canvases.
|
||||
*/
|
||||
class BaseGfxFactory
|
||||
{
|
||||
public:
|
||||
static BaseGfxFactory& getInstance();
|
||||
|
||||
/** Create a polygon from a ::basegfx::B2DPolygon
|
||||
|
||||
The created polygon initially has the same size in user
|
||||
coordinate space as the source polygon
|
||||
*/
|
||||
PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const;
|
||||
PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolyPolygon& rPoly ) const;
|
||||
|
||||
/** Create an uninitialized bitmap with the given size
|
||||
*/
|
||||
BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
|
||||
|
||||
/** Create a text portion with the given content string
|
||||
*/
|
||||
TextSharedPtr createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const;
|
||||
|
||||
private:
|
||||
friend struct InitInstance2;
|
||||
|
||||
// singleton
|
||||
BaseGfxFactory();
|
||||
~BaseGfxFactory();
|
||||
|
||||
// default: disabled copy/assignment
|
||||
BaseGfxFactory(const BaseGfxFactory&);
|
||||
BaseGfxFactory& operator=( const BaseGfxFactory& );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */
|
108
cppcanvas/inc/cppcanvas/bitmap.hxx
Normal file
108
cppcanvas/inc/cppcanvas/bitmap.hxx
Normal file
@@ -0,0 +1,108 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: bitmap.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:57 $
|
||||
*
|
||||
* 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_BITMAP_HXX
|
||||
#define _CPPCANVAS_BITMAP_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 _CPPCANVAS_CANVASGRAPHIC_HXX
|
||||
#include <cppcanvas/canvasgraphic.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_BITMAPCANVAS_HXX
|
||||
#include <cppcanvas/bitmapcanvas.hxx>
|
||||
#endif
|
||||
|
||||
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
|
||||
{
|
||||
class XBitmap;
|
||||
} } } } }
|
||||
|
||||
|
||||
/* Definition of Bitmap interface */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
|
||||
/** This interface defines a Bitmap canvas object
|
||||
|
||||
Consider this object part of the view, and not of the model
|
||||
data, as this bitmap can only be painted on its parent canvas
|
||||
*/
|
||||
class Bitmap : public virtual CanvasGraphic
|
||||
{
|
||||
public:
|
||||
virtual BitmapCanvasSharedPtr getBitmapCanvas() const = 0;
|
||||
|
||||
virtual ::com::sun::star::uno::Reference<
|
||||
::drafts::com::sun::star::rendering::XBitmap > getUNOBitmap() const = 0;
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_BITMAP_HXX */
|
103
cppcanvas/inc/cppcanvas/bitmapcanvas.hxx
Normal file
103
cppcanvas/inc/cppcanvas/bitmapcanvas.hxx
Normal file
@@ -0,0 +1,103 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: bitmapcanvas.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:57 $
|
||||
*
|
||||
* 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_BITMAPCANVAS_HXX
|
||||
#define _CPPCANVAS_BITMAPCANVAS_HXX
|
||||
|
||||
#ifndef _SAL_TYPES_H_
|
||||
#include <sal/types.h>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
|
||||
#include <external/boost/shared_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _BGFX_VECTOR_B2ISIZE_HXX
|
||||
#include <basegfx/vector/b2isize.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPCANVAS_CANVAS_HXX
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
/* Definition of BitmapCanvas */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
class BitmapCanvas;
|
||||
|
||||
// forward declaration, since cloneBitmapCanvas() also references BitmapCanvas
|
||||
typedef ::boost::shared_ptr< BitmapCanvas > BitmapCanvasSharedPtr;
|
||||
|
||||
/** BitmapCanvas interface
|
||||
*/
|
||||
class BitmapCanvas : public virtual Canvas
|
||||
{
|
||||
public:
|
||||
virtual ::basegfx::B2ISize getSize() const = 0;
|
||||
|
||||
virtual BitmapCanvasSharedPtr cloneBitmapCanvas() const = 0; // shared_ptr does not allow for covariant return types
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_BITMAPCANVAS_HXX */
|
139
cppcanvas/inc/cppcanvas/canvas.hxx
Normal file
139
cppcanvas/inc/cppcanvas/canvas.hxx
Normal file
@@ -0,0 +1,139 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: canvas.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:58 $
|
||||
*
|
||||
* 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_CANVAS_HXX
|
||||
#define _CPPCANVAS_CANVAS_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 _CPPCANVAS_FONT_HXX
|
||||
#include <cppcanvas/font.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_COLOR_HXX
|
||||
#include <cppcanvas/color.hxx>
|
||||
#endif
|
||||
|
||||
namespace rtl
|
||||
{
|
||||
class OUString;
|
||||
}
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
class B2DHomMatrix;
|
||||
class B2DPolyPolygon;
|
||||
}
|
||||
|
||||
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
|
||||
{
|
||||
class XCanvas;
|
||||
struct ViewState;
|
||||
} } } } }
|
||||
|
||||
|
||||
/* Definition of BitmapCanvas */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
class PolyPolygon;
|
||||
class Canvas;
|
||||
|
||||
// forward declaration, since PolyPolygon also references Canvas
|
||||
typedef ::boost::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
|
||||
|
||||
// forward declaration, since cloneCanvas() also references Canvas
|
||||
typedef ::boost::shared_ptr< Canvas > CanvasSharedPtr;
|
||||
|
||||
/** Canvas interface
|
||||
*/
|
||||
class Canvas
|
||||
{
|
||||
public:
|
||||
virtual ~Canvas() {}
|
||||
|
||||
virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
|
||||
virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
|
||||
|
||||
virtual void setClip( const PolyPolygonSharedPtr& rClipPoly ) = 0;
|
||||
virtual PolyPolygonSharedPtr getClip() const = 0;
|
||||
|
||||
virtual FontSharedPtr createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const = 0;
|
||||
|
||||
virtual ColorSharedPtr createColor() const = 0;
|
||||
|
||||
virtual CanvasSharedPtr cloneCanvas() const = 0;
|
||||
|
||||
// this should be considered private. if RTTI gets enabled
|
||||
// someday, remove that to a separate interface
|
||||
virtual ::com::sun::star::uno::Reference<
|
||||
::drafts::com::sun::star::rendering::XCanvas > getUNOCanvas() const = 0;
|
||||
virtual ::drafts::com::sun::star::rendering::ViewState getViewState() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_CANVAS_HXX */
|
208
cppcanvas/inc/cppcanvas/canvasgraphic.hxx
Normal file
208
cppcanvas/inc/cppcanvas/canvasgraphic.hxx
Normal file
@@ -0,0 +1,208 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: canvasgraphic.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:58 $
|
||||
*
|
||||
* 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_CANVASGRAPHIC_HXX
|
||||
#define _CPPCANVAS_CANVASGRAPHIC_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_COLOR_HXX
|
||||
#include <cppcanvas/color.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_CANVAS_HXX
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
#endif
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
class B2DHomMatrix;
|
||||
class B2DPolyPolygon;
|
||||
}
|
||||
|
||||
|
||||
/* Definition of CanvasGraphic interface */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
// forward declaration, since PolyPolygon also derives from CanvasGraphic
|
||||
typedef ::boost::shared_ptr< class PolyPolygon > PolyPolygonSharedPtr;
|
||||
|
||||
|
||||
/** This interface defines basic properties of
|
||||
objects that can be painted on a Canvas
|
||||
*/
|
||||
class CanvasGraphic
|
||||
{
|
||||
public:
|
||||
|
||||
/** These enums determine how the primitive color is combined
|
||||
with the background. When performing this calculations, it
|
||||
is assumed that all color values are premultiplied with
|
||||
the corresponding alpha values (if no alpha is specified,
|
||||
1.0 is assumed). Then, the following general compositing
|
||||
operation is performed:
|
||||
|
||||
C = Ca * Fa + Cb * Fb
|
||||
|
||||
where C is the result color, Ca and Cb are the input
|
||||
colors, premultiplied with alpha, and Fa and Fb are
|
||||
described for the different composite modes (wherein Aa
|
||||
and Ab denote source and destination alpha, respectively).
|
||||
*/
|
||||
enum CompositeOp
|
||||
{
|
||||
/// Clear destination. Fa = Fb = 0.
|
||||
CLEAR,
|
||||
|
||||
/// Copy source as-is to destination. Fa = 1, Fb = 0.
|
||||
SOURCE,
|
||||
|
||||
/// Leave destination as-is. Fa = 0, Fb = 1.
|
||||
DESTINATION,
|
||||
|
||||
/// Copy source over destination. Fa = 1, Fb = 1-Aa.
|
||||
OVER,
|
||||
|
||||
/// Copy source under destination. Fa = 1-Ab, Fb = 1.
|
||||
UNDER,
|
||||
|
||||
/// Copy source to destination, but limited to where the destination is. Fa = Ab, Fb = 0.
|
||||
INSIDE,
|
||||
|
||||
/// Leave destination as is, but only where source was. Fa = 0, Fb = Aa.
|
||||
INSIDE_REVERSE,
|
||||
|
||||
/// Copy source to destination, but limited to where destination is not. Fa = 1-Ab, Fb = 0.
|
||||
OUTSIDE,
|
||||
|
||||
/// Leave destination as is, but only where source has not been. Fa = 0, Fb = 1-Aa.
|
||||
OUTSIDE_REVERSE,
|
||||
|
||||
/// Copy source over destination, but only where destination is. Keep destination. Fa = Ab, Fb = 1-Aa.
|
||||
ATOP,
|
||||
|
||||
/// Copy destination over source, but only where source is. Keep source. Fa = 1-Ab, Fb = Aa.
|
||||
ATOP_REVERSE,
|
||||
|
||||
/// Take only parts where either source or destination, but not both are. Fa = 1-Ab, Fb = 1-Aa.
|
||||
XOR,
|
||||
|
||||
/** simply add contributions of both source and destination. The
|
||||
resulting color values are limited to the permissible color
|
||||
range, and clipped to the maximal value, if exceeded. Fa = 1, Fb = 1.
|
||||
*/
|
||||
ADD,
|
||||
|
||||
/// Fa = min(1,(1-Ab)/Aa), Fb = 1
|
||||
SATURATE
|
||||
};
|
||||
|
||||
virtual ~CanvasGraphic() {}
|
||||
|
||||
/** Set object transformation matrix
|
||||
*/
|
||||
virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
|
||||
/** Get object transformation matrix
|
||||
*/
|
||||
virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
|
||||
|
||||
/** Set object clipping polygon
|
||||
*/
|
||||
virtual void setClip( const PolyPolygonSharedPtr& rClipPoly ) = 0;
|
||||
/** Get object clipping polygon
|
||||
*/
|
||||
virtual PolyPolygonSharedPtr getClip() const = 0;
|
||||
|
||||
/** Set object color
|
||||
*/
|
||||
virtual void setRGBAColor( Color::IntSRGBA ) = 0;
|
||||
/** Get object color
|
||||
*/
|
||||
virtual Color::IntSRGBA getRGBAColor() const = 0;
|
||||
|
||||
/** Set object composite mode
|
||||
*/
|
||||
virtual void setCompositeOp( CompositeOp aOp ) = 0;
|
||||
/** Get object composite mode
|
||||
*/
|
||||
virtual CompositeOp getCompositeOp() const = 0;
|
||||
|
||||
/** Render to parent canvas
|
||||
|
||||
This method renders the content to the parent canvas,
|
||||
i.e. the canvas this object was constructed for.
|
||||
|
||||
@return whether the rendering finished successfully.
|
||||
*/
|
||||
virtual bool draw() const = 0;
|
||||
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::CanvasGraphic > CanvasGraphicSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_CANVASGRAPHIC_HXX */
|
98
cppcanvas/inc/cppcanvas/color.hxx
Normal file
98
cppcanvas/inc/cppcanvas/color.hxx
Normal file
@@ -0,0 +1,98 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: color.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:58 $
|
||||
*
|
||||
* 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_COLOR_HXX
|
||||
#define _CPPCANVAS_COLOR_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
|
||||
|
||||
|
||||
/* Definition of Color class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
class Color
|
||||
{
|
||||
public:
|
||||
/** Color in the sRGB color space, plus alpha channel
|
||||
|
||||
The four bytes of the sal_uInt32 are allocated as follows
|
||||
to the color channels and alpha: 0xRRGGBBAA.
|
||||
*/
|
||||
typedef sal_uInt32 IntSRGBA;
|
||||
|
||||
virtual ~Color() {}
|
||||
|
||||
virtual IntSRGBA getIntSRGBA( ::com::sun::star::uno::Sequence< double >& rDeviceColor ) const = 0;
|
||||
virtual ::com::sun::star::uno::Sequence< double > getDeviceColor( IntSRGBA aSRGBA ) const = 0;
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::Color > ColorSharedPtr;
|
||||
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_COLOR_HXX */
|
96
cppcanvas/inc/cppcanvas/customsprite.hxx
Normal file
96
cppcanvas/inc/cppcanvas/customsprite.hxx
Normal file
@@ -0,0 +1,96 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: customsprite.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:58 $
|
||||
*
|
||||
* 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_CUSTOMSPRITE_HXX
|
||||
#define _CPPCANVAS_CUSTOMSPRITE_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_SPRITE_HXX
|
||||
#include <cppcanvas/sprite.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_CANVAS_HXX
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
/* Definition of CustomSprite class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
|
||||
class CustomSprite : public virtual Sprite
|
||||
{
|
||||
public:
|
||||
|
||||
virtual CanvasSharedPtr getContentCanvas() const = 0;
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_CUSTOMSPRITE_HXX */
|
103
cppcanvas/inc/cppcanvas/font.hxx
Normal file
103
cppcanvas/inc/cppcanvas/font.hxx
Normal file
@@ -0,0 +1,103 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: font.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:59 $
|
||||
*
|
||||
* 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_FONT_HXX
|
||||
#define _CPPCANVAS_FONT_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
|
||||
|
||||
namespace rtl
|
||||
{
|
||||
class OUString;
|
||||
}
|
||||
|
||||
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
|
||||
{
|
||||
class XCanvasFont;
|
||||
} } } } }
|
||||
|
||||
/* Definition of Font class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
|
||||
class Font
|
||||
{
|
||||
public:
|
||||
virtual ~Font() {}
|
||||
|
||||
virtual ::rtl::OUString getName() const = 0;
|
||||
virtual double getCellSize() const = 0;
|
||||
|
||||
virtual ::com::sun::star::uno::Reference<
|
||||
::drafts::com::sun::star::rendering::XCanvasFont > getUNOFont() const = 0;
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::Font > FontSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_FONT_HXX */
|
134
cppcanvas/inc/cppcanvas/polypolygon.hxx
Normal file
134
cppcanvas/inc/cppcanvas/polypolygon.hxx
Normal file
@@ -0,0 +1,134 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: polypolygon.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:59 $
|
||||
*
|
||||
* 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_POLYPOLYGON_HXX
|
||||
#define _CPPCANVAS_POLYPOLYGON_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 _CPPCANVAS_CANVASGRAPHIC_HXX
|
||||
#include <cppcanvas/canvasgraphic.hxx>
|
||||
#endif
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
class B2DPolygon;
|
||||
class B2DPolyPolygon;
|
||||
}
|
||||
|
||||
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
|
||||
{
|
||||
class XPolyPolygon2D;
|
||||
} } } } }
|
||||
|
||||
|
||||
/* Definition of PolyPolygon interface */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
|
||||
/** This interface defines a PolyPolygon canvas object
|
||||
|
||||
Consider this object part of the view, and not of the model
|
||||
data. Although the given polygon is typically copied and held
|
||||
internally (to facilitate migration to incompatible canvases),
|
||||
::basegfx::B2DPolygon et al. are ref-counted copy-on-write
|
||||
classes, i.e. memory shouldn't be wasted. On the other hand,
|
||||
the API polygon created internally _does_ necessarily
|
||||
duplicate the data held, but can be easily flushed away via
|
||||
flush().
|
||||
*/
|
||||
class PolyPolygon : public virtual CanvasGraphic
|
||||
{
|
||||
public:
|
||||
virtual void addPolygon( const ::basegfx::B2DPolygon& rPoly ) = 0;
|
||||
virtual void addPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ) = 0;
|
||||
|
||||
/** Set polygon fill color
|
||||
*/
|
||||
virtual void setRGBAFillColor( Color::IntSRGBA ) = 0;
|
||||
/** Set polygon line color
|
||||
*/
|
||||
virtual void setRGBALineColor( Color::IntSRGBA ) = 0;
|
||||
/** Get polygon fill color
|
||||
*/
|
||||
virtual Color::IntSRGBA getRGBAFillColor() const = 0;
|
||||
/** Get polygon line color
|
||||
*/
|
||||
virtual Color::IntSRGBA getRGBALineColor() const = 0;
|
||||
|
||||
virtual void setStrokeWidth( const double& rStrokeWidth ) = 0;
|
||||
virtual double getStrokeWidth() const = 0;
|
||||
|
||||
virtual ::com::sun::star::uno::Reference<
|
||||
::drafts::com::sun::star::rendering::XPolyPolygon2D > getUNOPolyPolygon() const = 0;
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::PolyPolygon > PolyPolygonSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_POLYPOLYGON_HXX */
|
115
cppcanvas/inc/cppcanvas/renderer.hxx
Normal file
115
cppcanvas/inc/cppcanvas/renderer.hxx
Normal file
@@ -0,0 +1,115 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: renderer.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:40:59 $
|
||||
*
|
||||
* 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_HXX
|
||||
#define _CPPCANVAS_RENDERER_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_CANVASGRAPHIC_HXX
|
||||
#include <cppcanvas/canvasgraphic.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
/* Definition of Renderer interface */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
|
||||
class Renderer : public virtual CanvasGraphic
|
||||
{
|
||||
public:
|
||||
/** Render subset of metafile to given canvas
|
||||
|
||||
This method renders the given subset of the content to the
|
||||
given canvas. Previously cached data is used, if the
|
||||
canvases are identical. Otherwise, the equivalent of a
|
||||
flush() followed by a prefetch() with the given canvas is
|
||||
performed.
|
||||
|
||||
@param nStartIndex
|
||||
The index of the first action to be rendered (the indices
|
||||
correspond to the action indices of the originating
|
||||
GDIMetaFile).
|
||||
|
||||
@param nEndIndex
|
||||
The index of the first action _not_ painted anymore,
|
||||
i.e. the action after the last action rendered (the
|
||||
indices correspond to the action indices of the
|
||||
originating GDIMetaFile).
|
||||
|
||||
@return whether the rendering finished successfully.
|
||||
*/
|
||||
virtual bool drawSubset( int nStartIndex,
|
||||
int nEndIndex ) const = 0;
|
||||
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_RENDERER_HXX */
|
135
cppcanvas/inc/cppcanvas/sprite.hxx
Normal file
135
cppcanvas/inc/cppcanvas/sprite.hxx
Normal file
@@ -0,0 +1,135 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: sprite.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:41:00 $
|
||||
*
|
||||
* 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_SPRITE_HXX
|
||||
#define _CPPCANVAS_SPRITE_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
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
class B2DHomMatrix;
|
||||
class B2DPolyPolygon;
|
||||
class B2DPoint;
|
||||
}
|
||||
|
||||
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
|
||||
{
|
||||
class XSprite;
|
||||
} } } } }
|
||||
|
||||
|
||||
/* Definition of Sprite class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
|
||||
class Sprite
|
||||
{
|
||||
public:
|
||||
virtual ~Sprite() {}
|
||||
|
||||
virtual void setAlpha( const double& rAlpha ) = 0;
|
||||
|
||||
/** Set the sprite position on screen
|
||||
|
||||
This method differs from the XSprite::move() insofar, as
|
||||
no viewstate/renderstate transformations are applied to
|
||||
the specified position. The given position is interpreted
|
||||
in device coordinates (i.e. screen pixel)
|
||||
*/
|
||||
virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0;
|
||||
|
||||
/** Set the sprite position on screen
|
||||
|
||||
This method sets the sprite position in the view
|
||||
coordinate system of the parent canvas
|
||||
*/
|
||||
virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0;
|
||||
|
||||
virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
|
||||
|
||||
/** Set output clipping
|
||||
|
||||
This method differs from the XSprite::clip() insofar, as
|
||||
no viewstate/renderstate transformations are applied to
|
||||
the specified clip polygon. The given polygon is
|
||||
interpreted in device coordinates (i.e. screen pixel)
|
||||
*/
|
||||
virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
|
||||
|
||||
virtual void show() = 0;
|
||||
virtual void hide() = 0;
|
||||
|
||||
virtual ::com::sun::star::uno::Reference<
|
||||
::drafts::com::sun::star::rendering::XSprite > getUNOSprite() const = 0;
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::Sprite > SpriteSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_SPRITE_HXX */
|
121
cppcanvas/inc/cppcanvas/spritecanvas.hxx
Normal file
121
cppcanvas/inc/cppcanvas/spritecanvas.hxx
Normal file
@@ -0,0 +1,121 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: spritecanvas.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:41:00 $
|
||||
*
|
||||
* 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_SPRITECANVAS_HXX
|
||||
#define _CPPCANVAS_SPRITECANVAS_HXX
|
||||
|
||||
#ifndef _SAL_TYPES_H_
|
||||
#include <sal/types.h>
|
||||
#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_BITMAPCANVAS_HXX
|
||||
#include <cppcanvas/bitmapcanvas.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_SPRITE_HXX
|
||||
#include <cppcanvas/sprite.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_CUSTOMSPRITE_HXX
|
||||
#include <cppcanvas/customsprite.hxx>
|
||||
#endif
|
||||
|
||||
namespace drafts { namespace com { namespace sun { namespace star { namespace rendering
|
||||
{
|
||||
class XSpriteCanvas;
|
||||
} } } } }
|
||||
|
||||
|
||||
/* Definition of SpriteCanvas */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
class SpriteCanvas;
|
||||
|
||||
// forward declaration, since cloneSpriteCanvas() also references SpriteCanvas
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::SpriteCanvas > SpriteCanvasSharedPtr;
|
||||
|
||||
/** SpriteCanvas interface
|
||||
*/
|
||||
class SpriteCanvas : public virtual BitmapCanvas
|
||||
{
|
||||
public:
|
||||
virtual bool updateScreen() const = 0;
|
||||
|
||||
virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const = 0;
|
||||
virtual SpriteSharedPtr createClonedSprite( const SpriteSharedPtr& ) const = 0;
|
||||
|
||||
virtual SpriteCanvasSharedPtr cloneSpriteCanvas() const = 0; // shared_ptr does not allow for covariant return types
|
||||
|
||||
virtual ::com::sun::star::uno::Reference<
|
||||
::drafts::com::sun::star::rendering::XSpriteCanvas > getUNOSpriteCanvas() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_SPRITECANVAS_HXX */
|
94
cppcanvas/inc/cppcanvas/text.hxx
Normal file
94
cppcanvas/inc/cppcanvas/text.hxx
Normal file
@@ -0,0 +1,94 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: text.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:41:00 $
|
||||
*
|
||||
* 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_TEXT_HXX
|
||||
#define _CPPCANVAS_TEXT_HXX
|
||||
|
||||
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
|
||||
#include <external/boost/shared_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPCANVAS_CANVASGRAPHIC_HXX
|
||||
#include <cppcanvas/canvasgraphic.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
namespace rtl
|
||||
{
|
||||
class OUString;
|
||||
}
|
||||
|
||||
|
||||
/* Definition of Text interface */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
class Text : public virtual CanvasGraphic
|
||||
{
|
||||
public:
|
||||
virtual void setFont( const FontSharedPtr& ) = 0;
|
||||
virtual FontSharedPtr getFont() = 0;
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< ::cppcanvas::Text > TextSharedPtr;
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_TEXT_HXX */
|
179
cppcanvas/inc/cppcanvas/vclfactory.hxx
Normal file
179
cppcanvas/inc/cppcanvas/vclfactory.hxx
Normal file
@@ -0,0 +1,179 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: vclfactory.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:41:00 $
|
||||
*
|
||||
* 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_VCLFACTORY_HXX
|
||||
#define _CPPCANVAS_VCLFACTORY_HXX
|
||||
|
||||
#ifndef _CPPCANVAS_CANVAS_HXX
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_BITMAPCANVAS_HXX
|
||||
#include <cppcanvas/bitmapcanvas.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_SPRITECANVAS_HXX
|
||||
#include <cppcanvas/spritecanvas.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_POLYPOLYGON_HXX
|
||||
#include <cppcanvas/polypolygon.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_BITMAP_HXX
|
||||
#include <cppcanvas/bitmap.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_RENDERER_HXX
|
||||
#include <cppcanvas/renderer.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_TEXT_HXX
|
||||
#include <cppcanvas/text.hxx>
|
||||
#endif
|
||||
#ifndef _CPPCANVAS_SPRITE_HXX
|
||||
#include <cppcanvas/sprite.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
class Window;
|
||||
class Bitmap;
|
||||
class BitmapEx;
|
||||
class Polygon;
|
||||
class PolyPolygon;
|
||||
class Size;
|
||||
class Graphic;
|
||||
class GDIMetaFile;
|
||||
|
||||
namespace rtl
|
||||
{
|
||||
class OUString;
|
||||
}
|
||||
|
||||
/* Definition of VCLFactory class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
/** The VCLFactory creates Canvas objects for various VCL
|
||||
OutputDevice primitives, such as windows, polygons, bitmaps
|
||||
and metafiles.
|
||||
|
||||
Please note that the objects created for a specific Canvas can
|
||||
only be drawn on exactly that canvas. You have to regenerate
|
||||
them for different canvases.
|
||||
*/
|
||||
class VCLFactory
|
||||
{
|
||||
public:
|
||||
static VCLFactory& getInstance();
|
||||
|
||||
BitmapCanvasSharedPtr createCanvas( const ::Window& rVCLWindow );
|
||||
|
||||
SpriteCanvasSharedPtr createSpriteCanvas( const ::Window& rVCLWindow ) const;
|
||||
SpriteCanvasSharedPtr createFullscreenSpriteCanvas( const ::Window& rVCLWindow, const Size& rFullscreenSize ) const;
|
||||
|
||||
/** Create a polygon from a tools::Polygon
|
||||
|
||||
The created polygon initially has the same size in user
|
||||
coordinate space as the source polygon
|
||||
*/
|
||||
PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::Polygon& rPoly ) const;
|
||||
PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::PolyPolygon& rPoly ) const;
|
||||
|
||||
/** Create an uninitialized bitmap with the given size
|
||||
*/
|
||||
BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::Size& rSize ) const;
|
||||
|
||||
/** Create a bitmap from a VCL Bitmap
|
||||
*/
|
||||
BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::Bitmap& rBitmap ) const;
|
||||
BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::BitmapEx& rBmpEx ) const;
|
||||
|
||||
/** Create a renderer object from a Graphic
|
||||
|
||||
The created renderer initially draws the graphic
|
||||
one-by-one units large, in user coordinate space
|
||||
*/
|
||||
RendererSharedPtr createRenderer( const CanvasSharedPtr&, const ::Graphic& rGraphic ) const;
|
||||
/** Create a renderer object from a Metafile
|
||||
|
||||
The created renderer initially draws the metafile
|
||||
one-by-one units large, in user coordinate space
|
||||
*/
|
||||
RendererSharedPtr createRenderer( const CanvasSharedPtr&, const ::GDIMetaFile& rMtf ) const;
|
||||
|
||||
/** Create an animated sprite from a VCL animation
|
||||
*/
|
||||
SpriteSharedPtr createAnimatedSprite( const SpriteCanvasSharedPtr&, const ::Animation& rAnim ) const;
|
||||
|
||||
/** Create a text portion with the given content string
|
||||
*/
|
||||
TextSharedPtr createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const;
|
||||
|
||||
private:
|
||||
friend struct InitInstance;
|
||||
|
||||
// singleton
|
||||
VCLFactory();
|
||||
~VCLFactory();
|
||||
|
||||
// default: disabled copy/assignment
|
||||
VCLFactory(const VCLFactory&);
|
||||
VCLFactory& operator=( const VCLFactory& );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _CPPCANVAS_VCLFACTORY_HXX */
|
6
cppcanvas/prj/build.lst
Normal file
6
cppcanvas/prj/build.lst
Normal file
@@ -0,0 +1,6 @@
|
||||
cx cppcanvas : comphelper cppuhelper offuh tools vcl canvas basegfx NULL
|
||||
cx cppcanvas usr1 - all cx_mkout NULL
|
||||
cx cppcanvas\source\tools nmake - all cx_tools NULL
|
||||
cx cppcanvas\source\wrapper nmake - all cx_wrapper cx_tools NULL
|
||||
cx cppcanvas\source\mtfrenderer nmake - all cx_mtfrenderer cx_tools cx_wrapper NULL
|
||||
cx cppcanvas\util nmake - all cx_util cx_tools cx_wrapper cx_mtfrenderer NULL
|
19
cppcanvas/prj/d.lst
Normal file
19
cppcanvas/prj/d.lst
Normal file
@@ -0,0 +1,19 @@
|
||||
..\%__SRC%\bin\cppcanvas*.dll %_DEST%\bin%_EXT%\cppcanvas*.dll
|
||||
..\%__SRC%\lib\icppcanvas.lib %_DEST%\lib%_EXT%\icppcanvas.lib
|
||||
..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
|
||||
|
||||
mkdir: %_DEST%\inc%_EXT%\cppcanvas
|
||||
hedabu: ..\inc\cppcanvas\bitmap.hxx %_DEST%\inc%_EXT%\cppcanvas\bitmap.hxx
|
||||
hedabu: ..\inc\cppcanvas\bitmapcanvas.hxx %_DEST%\inc%_EXT%\cppcanvas\bitmapcanvas.hxx
|
||||
hedabu: ..\inc\cppcanvas\canvas.hxx %_DEST%\inc%_EXT%\cppcanvas\canvas.hxx
|
||||
hedabu: ..\inc\cppcanvas\canvasgraphic.hxx %_DEST%\inc%_EXT%\cppcanvas\canvasgraphic.hxx
|
||||
hedabu: ..\inc\cppcanvas\color.hxx %_DEST%\inc%_EXT%\cppcanvas\color.hxx
|
||||
hedabu: ..\inc\cppcanvas\customsprite.hxx %_DEST%\inc%_EXT%\cppcanvas\customsprite.hxx
|
||||
hedabu: ..\inc\cppcanvas\font.hxx %_DEST%\inc%_EXT%\cppcanvas\font.hxx
|
||||
hedabu: ..\inc\cppcanvas\polypolygon.hxx %_DEST%\inc%_EXT%\cppcanvas\polypolygon.hxx
|
||||
hedabu: ..\inc\cppcanvas\renderer.hxx %_DEST%\inc%_EXT%\cppcanvas\renderer.hxx
|
||||
hedabu: ..\inc\cppcanvas\sprite.hxx %_DEST%\inc%_EXT%\cppcanvas\sprite.hxx
|
||||
hedabu: ..\inc\cppcanvas\spritecanvas.hxx %_DEST%\inc%_EXT%\cppcanvas\spritecanvas.hxx
|
||||
hedabu: ..\inc\cppcanvas\text.hxx %_DEST%\inc%_EXT%\cppcanvas\text.hxx
|
||||
hedabu: ..\inc\cppcanvas\vclfactory.hxx %_DEST%\inc%_EXT%\cppcanvas\vclfactory.hxx
|
||||
hedabu: ..\inc\cppcanvas\basegfxfactory.hxx %_DEST%\inc%_EXT%\cppcanvas\basegfxfactory.hxx
|
96
cppcanvas/source/inc/action.hxx
Normal file
96
cppcanvas/source/inc/action.hxx
Normal 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 */
|
120
cppcanvas/source/inc/canvasgraphichelper.hxx
Normal file
120
cppcanvas/source/inc/canvasgraphichelper.hxx
Normal 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 */
|
160
cppcanvas/source/inc/implrenderer.hxx
Normal file
160
cppcanvas/source/inc/implrenderer.hxx
Normal 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 */
|
97
cppcanvas/source/inc/tools.hxx
Normal file
97
cppcanvas/source/inc/tools.hxx
Normal 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 */
|
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 */
|
169
cppcanvas/source/tools/canvasgraphichelper.cxx
Normal file
169
cppcanvas/source/tools/canvasgraphichelper.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
85
cppcanvas/source/tools/makefile.mk
Normal file
85
cppcanvas/source/tools/makefile.mk
Normal 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
|
100
cppcanvas/source/tools/tools.cxx
Normal file
100
cppcanvas/source/tools/tools.cxx
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
190
cppcanvas/source/wrapper/basegfxfactory.cxx
Normal file
190
cppcanvas/source/wrapper/basegfxfactory.cxx
Normal 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 ) );
|
||||
}
|
||||
|
||||
}
|
124
cppcanvas/source/wrapper/implbitmap.cxx
Normal file
124
cppcanvas/source/wrapper/implbitmap.cxx
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
117
cppcanvas/source/wrapper/implbitmap.hxx
Normal file
117
cppcanvas/source/wrapper/implbitmap.hxx
Normal 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 */
|
112
cppcanvas/source/wrapper/implbitmapcanvas.cxx
Normal file
112
cppcanvas/source/wrapper/implbitmapcanvas.cxx
Normal 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 ) );
|
||||
}
|
||||
}
|
||||
}
|
116
cppcanvas/source/wrapper/implbitmapcanvas.hxx
Normal file
116
cppcanvas/source/wrapper/implbitmapcanvas.hxx
Normal 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 */
|
158
cppcanvas/source/wrapper/implcanvas.cxx
Normal file
158
cppcanvas/source/wrapper/implcanvas.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
143
cppcanvas/source/wrapper/implcanvas.hxx
Normal file
143
cppcanvas/source/wrapper/implcanvas.hxx
Normal 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 */
|
100
cppcanvas/source/wrapper/implcolor.cxx
Normal file
100
cppcanvas/source/wrapper/implcolor.cxx
Normal 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 );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
105
cppcanvas/source/wrapper/implcolor.hxx
Normal file
105
cppcanvas/source/wrapper/implcolor.hxx
Normal 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 */
|
110
cppcanvas/source/wrapper/implcustomsprite.cxx
Normal file
110
cppcanvas/source/wrapper/implcustomsprite.cxx
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
110
cppcanvas/source/wrapper/implcustomsprite.hxx
Normal file
110
cppcanvas/source/wrapper/implcustomsprite.hxx
Normal 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 */
|
117
cppcanvas/source/wrapper/implfont.cxx
Normal file
117
cppcanvas/source/wrapper/implfont.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
122
cppcanvas/source/wrapper/implfont.hxx
Normal file
122
cppcanvas/source/wrapper/implfont.hxx
Normal 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 */
|
217
cppcanvas/source/wrapper/implpolypolygon.cxx
Normal file
217
cppcanvas/source/wrapper/implpolypolygon.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
135
cppcanvas/source/wrapper/implpolypolygon.hxx
Normal file
135
cppcanvas/source/wrapper/implpolypolygon.hxx
Normal 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 */
|
205
cppcanvas/source/wrapper/implsprite.cxx
Normal file
205
cppcanvas/source/wrapper/implsprite.cxx
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
129
cppcanvas/source/wrapper/implsprite.hxx
Normal file
129
cppcanvas/source/wrapper/implsprite.hxx
Normal 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 */
|
145
cppcanvas/source/wrapper/implspritecanvas.cxx
Normal file
145
cppcanvas/source/wrapper/implspritecanvas.cxx
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
118
cppcanvas/source/wrapper/implspritecanvas.hxx
Normal file
118
cppcanvas/source/wrapper/implspritecanvas.hxx
Normal 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 */
|
137
cppcanvas/source/wrapper/impltext.cxx
Normal file
137
cppcanvas/source/wrapper/impltext.cxx
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
112
cppcanvas/source/wrapper/impltext.hxx
Normal file
112
cppcanvas/source/wrapper/impltext.hxx
Normal 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 */
|
95
cppcanvas/source/wrapper/makefile.mk
Normal file
95
cppcanvas/source/wrapper/makefile.mk
Normal 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
|
368
cppcanvas/source/wrapper/vclfactory.cxx
Normal file
368
cppcanvas/source/wrapper/vclfactory.cxx
Normal 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 ) );
|
||||
}
|
||||
|
||||
}
|
4
cppcanvas/util/cppcanvas.flt
Normal file
4
cppcanvas/util/cppcanvas.flt
Normal file
@@ -0,0 +1,4 @@
|
||||
__CT
|
||||
Impl
|
||||
IMP
|
||||
internal
|
101
cppcanvas/util/makefile.mk
Normal file
101
cppcanvas/util/makefile.mk
Normal file
@@ -0,0 +1,101 @@
|
||||
#*************************************************************************
|
||||
#
|
||||
# $RCSfile: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.2 $
|
||||
#
|
||||
# last change: $Author: thb $ $Date: 2004-03-18 10:41:15 $
|
||||
#
|
||||
# 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=cppcanvas
|
||||
ENABLE_EXCEPTIONS=TRUE
|
||||
|
||||
|
||||
# --- Settings -----------------------------------------------------------
|
||||
|
||||
.INCLUDE : settings.mk
|
||||
|
||||
# --- Common ----------------------------------------------------------
|
||||
|
||||
LIB1TARGET=$(SLB)$/$(TARGET).lib
|
||||
LIB1FILES=\
|
||||
$(SLB)$/canvaswrapper.lib \
|
||||
$(SLB)$/metafilerenderer.lib \
|
||||
$(SLB)$/cppcanvastools.lib
|
||||
|
||||
SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
|
||||
SHL1IMPLIB= i$(TARGET)
|
||||
SHL1STDLIBS= $(TOOLSLIB) $(CPPULIB) $(SALLIB) $(VCLLIB) $(COMPHELPERLIB) $(CANVASTOOLSLIB) $(CPPUHELPERLIB) $(BASEGFXLIB)
|
||||
|
||||
SHL1LIBS= $(SLB)$/$(TARGET).lib
|
||||
|
||||
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
|
||||
DEF1NAME =$(SHL1TARGET)
|
||||
DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt \
|
||||
$(LIB1TARGET)
|
||||
|
||||
DEF1DES =CPPCanvas
|
||||
DEFLIB1NAME =$(TARGET)
|
||||
|
||||
# ==========================================================================
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
||||
$(MISC)$/$(SHL1TARGET).flt : makefile.mk
|
||||
@+$(TYPE) $(TARGET).flt > $@
|
Reference in New Issue
Block a user