summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <thb@openoffice.org>2004-03-18 09:41:15 +0000
committerThorsten Behrens <thb@openoffice.org>2004-03-18 09:41:15 +0000
commitf045b7b4f5e841dbb130ef9fda6c06eb88bc979a (patch)
treec4eb01fea041fd8f7ba62b1e191afbc394f584e6
parent6e89341b5045a01e823364633ef0fbfd44ebdfd5 (diff)
#110496# Merge from cws_srx645_canvas01: first working version of XCanvas C++ wrapper, providing encapsulation against possible API changes and some amount of convenience.
-rw-r--r--cppcanvas/inc/cppcanvas/basegfxfactory.hxx153
-rw-r--r--cppcanvas/inc/cppcanvas/bitmap.hxx108
-rw-r--r--cppcanvas/inc/cppcanvas/bitmapcanvas.hxx103
-rw-r--r--cppcanvas/inc/cppcanvas/canvas.hxx139
-rw-r--r--cppcanvas/inc/cppcanvas/canvasgraphic.hxx208
-rw-r--r--cppcanvas/inc/cppcanvas/color.hxx98
-rw-r--r--cppcanvas/inc/cppcanvas/customsprite.hxx96
-rw-r--r--cppcanvas/inc/cppcanvas/font.hxx103
-rw-r--r--cppcanvas/inc/cppcanvas/polypolygon.hxx134
-rw-r--r--cppcanvas/inc/cppcanvas/renderer.hxx115
-rw-r--r--cppcanvas/inc/cppcanvas/sprite.hxx135
-rw-r--r--cppcanvas/inc/cppcanvas/spritecanvas.hxx121
-rw-r--r--cppcanvas/inc/cppcanvas/text.hxx94
-rw-r--r--cppcanvas/inc/cppcanvas/vclfactory.hxx179
-rw-r--r--cppcanvas/prj/build.lst6
-rw-r--r--cppcanvas/prj/d.lst19
-rw-r--r--cppcanvas/source/inc/action.hxx96
-rw-r--r--cppcanvas/source/inc/canvasgraphichelper.hxx120
-rw-r--r--cppcanvas/source/inc/implrenderer.hxx160
-rw-r--r--cppcanvas/source/inc/tools.hxx97
-rw-r--r--cppcanvas/source/mtfrenderer/bitmapaction.cxx217
-rw-r--r--cppcanvas/source/mtfrenderer/bitmapaction.hxx137
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx1226
-rw-r--r--cppcanvas/source/mtfrenderer/lineaction.cxx118
-rw-r--r--cppcanvas/source/mtfrenderer/lineaction.hxx111
-rw-r--r--cppcanvas/source/mtfrenderer/makefile.mk90
-rw-r--r--cppcanvas/source/mtfrenderer/mtftools.cxx93
-rw-r--r--cppcanvas/source/mtfrenderer/mtftools.hxx89
-rw-r--r--cppcanvas/source/mtfrenderer/outdevstate.hxx133
-rw-r--r--cppcanvas/source/mtfrenderer/pointaction.cxx128
-rw-r--r--cppcanvas/source/mtfrenderer/pointaction.hxx112
-rw-r--r--cppcanvas/source/mtfrenderer/polypolyaction.cxx197
-rw-r--r--cppcanvas/source/mtfrenderer/polypolyaction.hxx134
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx158
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.hxx137
-rw-r--r--cppcanvas/source/tools/canvasgraphichelper.cxx169
-rw-r--r--cppcanvas/source/tools/makefile.mk85
-rw-r--r--cppcanvas/source/tools/tools.cxx100
-rw-r--r--cppcanvas/source/wrapper/basegfxfactory.cxx190
-rw-r--r--cppcanvas/source/wrapper/implbitmap.cxx124
-rw-r--r--cppcanvas/source/wrapper/implbitmap.hxx117
-rw-r--r--cppcanvas/source/wrapper/implbitmapcanvas.cxx112
-rw-r--r--cppcanvas/source/wrapper/implbitmapcanvas.hxx116
-rw-r--r--cppcanvas/source/wrapper/implcanvas.cxx158
-rw-r--r--cppcanvas/source/wrapper/implcanvas.hxx143
-rw-r--r--cppcanvas/source/wrapper/implcolor.cxx100
-rw-r--r--cppcanvas/source/wrapper/implcolor.hxx105
-rw-r--r--cppcanvas/source/wrapper/implcustomsprite.cxx110
-rw-r--r--cppcanvas/source/wrapper/implcustomsprite.hxx110
-rw-r--r--cppcanvas/source/wrapper/implfont.cxx117
-rw-r--r--cppcanvas/source/wrapper/implfont.hxx122
-rw-r--r--cppcanvas/source/wrapper/implpolypolygon.cxx217
-rw-r--r--cppcanvas/source/wrapper/implpolypolygon.hxx135
-rw-r--r--cppcanvas/source/wrapper/implsprite.cxx205
-rw-r--r--cppcanvas/source/wrapper/implsprite.hxx129
-rw-r--r--cppcanvas/source/wrapper/implspritecanvas.cxx145
-rw-r--r--cppcanvas/source/wrapper/implspritecanvas.hxx118
-rw-r--r--cppcanvas/source/wrapper/impltext.cxx137
-rw-r--r--cppcanvas/source/wrapper/impltext.hxx112
-rw-r--r--cppcanvas/source/wrapper/makefile.mk95
-rw-r--r--cppcanvas/source/wrapper/vclfactory.cxx368
-rw-r--r--cppcanvas/util/cppcanvas.flt4
-rw-r--r--cppcanvas/util/makefile.mk101
63 files changed, 9108 insertions, 0 deletions
diff --git a/cppcanvas/inc/cppcanvas/basegfxfactory.hxx b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx
new file mode 100644
index 000000000000..665c1ae9d98d
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/bitmap.hxx b/cppcanvas/inc/cppcanvas/bitmap.hxx
new file mode 100644
index 000000000000..54c34ad06310
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/bitmap.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx b/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx
new file mode 100644
index 000000000000..dd447df9b599
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/canvas.hxx b/cppcanvas/inc/cppcanvas/canvas.hxx
new file mode 100644
index 000000000000..bc82b296cb35
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/canvas.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/canvasgraphic.hxx b/cppcanvas/inc/cppcanvas/canvasgraphic.hxx
new file mode 100644
index 000000000000..b986cfd4536f
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/canvasgraphic.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/color.hxx b/cppcanvas/inc/cppcanvas/color.hxx
new file mode 100644
index 000000000000..2adf71b30683
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/color.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/customsprite.hxx b/cppcanvas/inc/cppcanvas/customsprite.hxx
new file mode 100644
index 000000000000..2990133c9783
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/customsprite.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/font.hxx b/cppcanvas/inc/cppcanvas/font.hxx
new file mode 100644
index 000000000000..6439fb8cf3d2
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/font.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/polypolygon.hxx b/cppcanvas/inc/cppcanvas/polypolygon.hxx
new file mode 100644
index 000000000000..728928ed410d
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/polypolygon.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/renderer.hxx b/cppcanvas/inc/cppcanvas/renderer.hxx
new file mode 100644
index 000000000000..08b57e5ab630
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/renderer.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/sprite.hxx b/cppcanvas/inc/cppcanvas/sprite.hxx
new file mode 100644
index 000000000000..16505b0936b7
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/sprite.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/spritecanvas.hxx b/cppcanvas/inc/cppcanvas/spritecanvas.hxx
new file mode 100644
index 000000000000..3d2f9ef3d55f
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/spritecanvas.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/text.hxx b/cppcanvas/inc/cppcanvas/text.hxx
new file mode 100644
index 000000000000..d979bfd67950
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/text.hxx
@@ -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 */
diff --git a/cppcanvas/inc/cppcanvas/vclfactory.hxx b/cppcanvas/inc/cppcanvas/vclfactory.hxx
new file mode 100644
index 000000000000..cd4ebe76036f
--- /dev/null
+++ b/cppcanvas/inc/cppcanvas/vclfactory.hxx
@@ -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 */
diff --git a/cppcanvas/prj/build.lst b/cppcanvas/prj/build.lst
new file mode 100644
index 000000000000..51d44515a806
--- /dev/null
+++ b/cppcanvas/prj/build.lst
@@ -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
diff --git a/cppcanvas/prj/d.lst b/cppcanvas/prj/d.lst
new file mode 100644
index 000000000000..ff1de83ee49b
--- /dev/null
+++ b/cppcanvas/prj/d.lst
@@ -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
diff --git a/cppcanvas/source/inc/action.hxx b/cppcanvas/source/inc/action.hxx
new file mode 100644
index 000000000000..f071be58ae27
--- /dev/null
+++ b/cppcanvas/source/inc/action.hxx
@@ -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 */
diff --git a/cppcanvas/source/inc/canvasgraphichelper.hxx b/cppcanvas/source/inc/canvasgraphichelper.hxx
new file mode 100644
index 000000000000..ca24fa46140d
--- /dev/null
+++ b/cppcanvas/source/inc/canvasgraphichelper.hxx
@@ -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 */
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
new file mode 100644
index 000000000000..23818a64b741
--- /dev/null
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -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 */
diff --git a/cppcanvas/source/inc/tools.hxx b/cppcanvas/source/inc/tools.hxx
new file mode 100644
index 000000000000..29fb7ac58823
--- /dev/null
+++ b/cppcanvas/source/inc/tools.hxx
@@ -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 */
diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.cxx b/cppcanvas/source/mtfrenderer/bitmapaction.cxx
new file mode 100644
index 000000000000..18bc72f9b44a
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/bitmapaction.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.hxx b/cppcanvas/source/mtfrenderer/bitmapaction.hxx
new file mode 100644
index 000000000000..b951fccef8f1
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/bitmapaction.hxx
@@ -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 */
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
new file mode 100644
index 000000000000..f3f50c2e9139
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -0,0 +1,1226 @@
+/*************************************************************************
+ *
+ * $RCSfile: implrenderer.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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+
+#include <cppcanvas/canvas.hxx>
+
+#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 "implrenderer.hxx"
+#include "tools.hxx"
+#include "outdevstate.hxx"
+
+#include "action.hxx"
+#include "bitmapaction.hxx"
+#include "lineaction.hxx"
+#include "pointaction.hxx"
+#include "polypolyaction.hxx"
+#include "textaction.hxx"
+
+#include <vector>
+#include <algorithm>
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+#ifndef _DRAFTS_COM_SUN_STAR_GEOMETRY_REALPOINT2D_HPP__
+#include <drafts/com/sun/star/geometry/RealPoint2D.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_RENDERING_VIEWSTATE_HPP__
+#include <drafts/com/sun/star/rendering/ViewState.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_XCANVASFONT_HPP__
+#include <drafts/com/sun/star/rendering/XCanvasFont.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_XCANVAS_HPP__
+#include <drafts/com/sun/star/rendering/XCanvas.hpp>
+#endif
+
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#endif
+
+#ifndef _SV_GDIMTF_HXX
+#include <vcl/gdimtf.hxx>
+#endif
+
+#ifndef _SV_METAACT_HXX
+#include <vcl/metaact.hxx>
+#endif
+
+#ifndef _SV_VIRDEV_HXX
+#include <vcl/virdev.hxx>
+#endif
+
+#ifndef _TL_POLY_HXX
+#include <tools/poly.hxx>
+#endif
+
+#include "outdevstate.hxx"
+
+
+using namespace ::drafts::com::sun::star;
+using namespace ::com::sun::star;
+
+
+// free support functions
+// ======================
+namespace
+{
+ template < class MetaActionType > void setStateColor( MetaActionType* pAct,
+ bool& rIsColorSet,
+ uno::Sequence< double >& rColorSequence,
+ const cppcanvas::CanvasSharedPtr& rCanvas )
+ {
+ // set rIsColorSet and check for true at the same time
+ if( (rIsColorSet=pAct->IsSetting()) )
+ {
+ ::Color aColor( pAct->GetColor() );
+
+ // force alpha part of color to
+ // opaque. transparent painting is done
+ // explicitely via META_TRANSPARENT_ACTION
+ aColor.SetTransparency(0);
+ //aColor.SetTransparency(128);
+
+ rColorSequence = ::vcl::unotools::colorToDoubleSequence( rCanvas->getUNOCanvas()->getDevice(),
+ aColor );
+ }
+ }
+
+ // Doing that via inline class. Compilers tend to not inline free
+ // functions.
+ class ActionIndexComparator
+ {
+ public:
+ ActionIndexComparator() {}
+
+ bool operator()( const ::cppcanvas::internal::ImplRenderer::MtfAction& rLHS,
+ const ::cppcanvas::internal::ImplRenderer::MtfAction& rRHS )
+ {
+ return rLHS.mnOrigIndex < rRHS.mnOrigIndex;
+ }
+ };
+
+ // state stack manipulators
+ // ------------------------
+ void clearStateStack( ::cppcanvas::internal::VectorOfOutDevStates& rStates )
+ {
+ rStates.clear();
+ const ::cppcanvas::internal::OutDevState aDefaultState;
+ rStates.push_back( aDefaultState );
+ }
+
+ ::cppcanvas::internal::OutDevState& getState( ::cppcanvas::internal::VectorOfOutDevStates& rStates )
+ {
+ return rStates.back();
+ }
+
+ void pushState( ::cppcanvas::internal::VectorOfOutDevStates& rStates )
+ {
+ rStates.push_back( getState( rStates ) );
+ }
+
+ void popState( ::cppcanvas::internal::VectorOfOutDevStates& rStates )
+ {
+ rStates.pop_back();
+ }
+
+}
+
+
+namespace cppcanvas
+{
+ namespace internal
+ {
+ bool ImplRenderer::createFillAndStroke( const ::PolyPolygon& rPolyPoly,
+ const CanvasSharedPtr& rCanvas,
+ int rActionIndex,
+ VectorOfOutDevStates& rStates )
+ {
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::PolyPolyAction( rPolyPoly, rCanvas, getState( rStates ) ) ),
+ rActionIndex ) );
+
+ return true;
+ }
+
+ void ImplRenderer::skipContent( GDIMetaFile& rMtf,
+ const char& rCommentString ) const
+ {
+ MetaAction* pCurrAct;
+ while( (pCurrAct=rMtf.NextAction()) )
+ {
+ if( pCurrAct->GetType() == META_COMMENT_ACTION &&
+ static_cast<MetaCommentAction*>(pCurrAct)->GetComment().CompareIgnoreCaseToAscii( rCommentString ) == COMPARE_EQUAL )
+ {
+ // requested comment found, done
+ return;
+ }
+ }
+
+ // EOF
+ return;
+ }
+
+ void ImplRenderer::createGradientAction( const Rectangle& rRect,
+ const Gradient& rGradient,
+ VirtualDevice& rVDev,
+ const CanvasSharedPtr& rCanvas,
+ VectorOfOutDevStates& rStates )
+ {
+ DBG_TESTSOLARMUTEX();
+
+ // TODO: Use native canvas gradients here (saves a lot of UNO calls)
+ GDIMetaFile aTmpMtf;
+
+ rVDev.AddGradientActions( rRect,
+ rGradient,
+ aTmpMtf );
+
+ pushState( rStates );
+ createActions( rCanvas, rVDev, aTmpMtf, rStates );
+ popState( rStates );
+ }
+
+ bool ImplRenderer::createActions( const CanvasSharedPtr& rCanvas,
+ VirtualDevice& rVDev,
+ GDIMetaFile& rMtf,
+ VectorOfOutDevStates& rStates )
+ {
+ /* TODO:
+ =====
+
+ - Float-Transparency (skipped for prototype
+ - bitmap fillings (do that via comments)
+ - gradient fillings (do that via comments)
+
+ - think about mapping. _If_ we do everything in logical
+ coordinates (which would solve the probs for stroke
+ widths and and text offsets), then we would have to
+ recalc scaling for every drawing operation. This is
+ because the outdev map mode might change at any time.
+
+ */
+
+ // Loop over every metaaction
+ // ==========================
+ MetaAction* pCurrAct;
+ int nCurrActionIndex;
+
+ // TODO: think about caching
+ for( nCurrActionIndex=0, pCurrAct=rMtf.FirstAction();
+ pCurrAct;
+ ++nCurrActionIndex, pCurrAct = rMtf.NextAction() )
+ {
+ // execute every action, to keep VDev state up-to-date
+ // (currently used only for the map mode, and for
+ // line/fill color when processing a
+ // META_TRANSPARENT_ACTION)
+ pCurrAct->Execute( &rVDev );
+
+ switch( pCurrAct->GetType() )
+ {
+ // ------------------------------------------------------------
+
+ // In the first part of this monster-switch, we
+ // handle all state-changing meta actions. These
+ // are all handled locally.
+
+ // ------------------------------------------------------------
+
+ case META_PUSH_ACTION:
+ pushState( rStates );
+ break;
+
+ case META_POP_ACTION:
+ popState( rStates );
+ break;
+
+ // monitor clip regions, to assemble clip polygon on our own
+ case META_CLIPREGION_ACTION:
+ case META_ISECTRECTCLIPREGION_ACTION:
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ case META_MOVECLIPREGION_ACTION:
+ // TODO: NYI
+ break;
+
+ case META_LINECOLOR_ACTION:
+ setStateColor( static_cast<MetaLineColorAction*>(pCurrAct),
+ getState( rStates ).isLineColorSet,
+ getState( rStates ).lineColor,
+ rCanvas );
+ break;
+
+ case META_FILLCOLOR_ACTION:
+ setStateColor( static_cast<MetaFillColorAction*>(pCurrAct),
+ getState( rStates ).isFillColorSet,
+ getState( rStates ).fillColor,
+ rCanvas );
+ break;
+
+ case META_TEXTCOLOR_ACTION:
+ {
+ // Text color is set unconditionally, thus, no
+ // use of setStateColor here
+ ::Color aColor( static_cast<MetaTextColorAction*>(pCurrAct)->GetColor() );
+
+ // force alpha part of color to
+ // opaque. transparent painting is done
+ // explicitely via META_TRANSPARENT_ACTION
+ aColor.SetTransparency(0);
+
+ getState( rStates ).textColor =
+ ::vcl::unotools::colorToDoubleSequence( rCanvas->getUNOCanvas()->getDevice(),
+ aColor );
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION:
+ setStateColor( static_cast<MetaTextFillColorAction*>(pCurrAct),
+ getState( rStates ).isTextFillColorSet,
+ getState( rStates ).textFillColor,
+ rCanvas );
+ break;
+
+ case META_TEXTLINECOLOR_ACTION:
+ setStateColor( static_cast<MetaTextLineColorAction*>(pCurrAct),
+ getState( rStates ).isTextLineColorSet,
+ getState( rStates ).textLineColor,
+ rCanvas );
+ break;
+
+ case META_TEXTALIGN_ACTION:
+ // TODO: NYI
+ break;
+
+ case META_FONT_ACTION:
+ {
+ // TODO: For now, only dummy implementation
+ rendering::FontRequest aFontRequest;
+ const ::Font& rFont( static_cast<MetaFontAction*>(pCurrAct)->GetFont() );
+
+ aFontRequest.FamilyName = rFont.GetName();
+ aFontRequest.StyleName = rFont.GetStyleName();
+
+ // TODO: use correct scale direction, font
+ // height might be width or anything else
+ const Size aSize( 0, rFont.GetHeight() );
+ aFontRequest.CellSize = rVDev.LogicToPixel( aSize ).Height();
+
+ const short nFontAngle( rFont.GetOrientation() );
+
+ // setup state-local text transformation,
+ // should the font be rotated
+ if( nFontAngle != 0 )
+ {
+ // VCL font does not access system structs here
+ const double rAngle( nFontAngle * (F_PI / 1800.0) );
+
+ // reset transform
+ getState( rStates ).fontTransform.identity();
+
+ // rotate by given angle
+ getState( rStates ).fontTransform.rotate( -rAngle );
+ }
+
+ getState( rStates ).xFont = rCanvas->getUNOCanvas()->queryFont( aFontRequest );
+ }
+ break;
+
+ case META_RASTEROP_ACTION:
+ // TODO: NYI
+ break;
+
+ case META_REFPOINT_ACTION:
+ // TODO: NYI
+ break;
+
+ case META_LAYOUTMODE_ACTION:
+ {
+ // TODO: A lot is missing here
+ switch( static_cast<MetaLayoutModeAction*>(pCurrAct)->GetLayoutMode() )
+ {
+ case TEXT_LAYOUT_BIDI_RTL:
+ case TEXT_LAYOUT_TEXTORIGIN_RIGHT:
+ getState( rStates ).textDirection = rendering::TextDirection::RIGHT_TO_LEFT;
+ break;
+
+ case TEXT_LAYOUT_BIDI_LTR:
+ case TEXT_LAYOUT_BIDI_STRONG:
+ case TEXT_LAYOUT_TEXTORIGIN_LEFT:
+ case TEXT_LAYOUT_COMPLEX_DISABLED:
+ case TEXT_LAYOUT_ENABLE_LIGATURES:
+ case TEXT_LAYOUT_SUBSTITUTE_DIGITS:
+ getState( rStates ).textDirection = rendering::TextDirection::LEFT_TO_RIGHT;
+ break;
+ }
+ }
+ break;
+
+ // ------------------------------------------------------------
+
+ // In the second part of this monster-switch, we
+ // handle all recursing meta actions. These are the
+ // ones generating a metafile by themselves, which is
+ // then processed by recursively calling this method.
+
+ // ------------------------------------------------------------
+
+ case META_GRADIENT_ACTION:
+ {
+ MetaGradientAction* pGradAct = static_cast<MetaGradientAction*>(pCurrAct);
+ createGradientAction( pGradAct->GetRect(),
+ pGradAct->GetGradient(),
+ rVDev,
+ rCanvas,
+ rStates );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ // TODO: use native Canvas hatches here
+ GDIMetaFile aTmpMtf;
+
+ rVDev.AddHatchActions( static_cast<MetaHatchAction*>(pCurrAct)->GetPolyPolygon(),
+ static_cast<MetaHatchAction*>(pCurrAct)->GetHatch(),
+ aTmpMtf );
+ createActions( rCanvas, rVDev, aTmpMtf, rStates );
+ }
+ break;
+
+ case META_EPS_ACTION:
+ {
+ MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pCurrAct);
+ const GDIMetaFile& pSubstitute = pAct->GetSubstitute();
+
+ const Size aMtfSizePix( rVDev.LogicToPixel( pSubstitute.GetPrefSize(),
+ pSubstitute.GetPrefMapMode() ) );
+
+ // skip null-sized output
+ if( aMtfSizePix.Width() != 0 &&
+ aMtfSizePix.Height() != 0 )
+ {
+ const Point aEmptyPt;
+ const Point aMtfOriginPix( rVDev.LogicToPixel( aEmptyPt,
+ pSubstitute.GetPrefMapMode() ) );
+
+ // Setup local transform, such that the
+ // metafile renders itself into the given
+ // output rectangle
+ pushState( rStates );
+
+ getState( rStates ).transform.translate( -aMtfOriginPix.X(), -aMtfOriginPix.Y() );
+ getState( rStates ).transform.scale( 1.0 / aMtfSizePix.Width(),
+ 1.0 / aMtfSizePix.Height() );
+
+ createActions( rCanvas, rVDev,
+ const_cast<GDIMetaFile&>(pAct->GetSubstitute()),
+ rStates );
+
+ popState( rStates );
+ }
+ }
+ break;
+
+ // handle metafile comments, to retrieve
+ // meta-information for gradients, fills and
+ // strokes. May skip actions, and may recurse.
+ case META_COMMENT_ACTION:
+ {
+ MetaCommentAction* pAct = static_cast<MetaCommentAction*>(pCurrAct);
+
+ // Handle gradients
+ if ( pAct->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+ {
+ MetaGradientExAction* pGradAction = NULL;
+ bool bDone( false );
+ while( !bDone &&
+ (pCurrAct=rMtf.NextAction()) )
+ {
+ switch( pCurrAct->GetType() )
+ {
+ // extract gradient info
+ case META_GRADIENTEX_ACTION:
+ pGradAction = static_cast<MetaGradientExAction*>(pCurrAct);
+ break;
+
+ // skip broken-down rendering, output gradient when sequence is ended
+ case META_COMMENT_ACTION:
+ if( static_cast<MetaCommentAction*>(pCurrAct)->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL )
+ {
+ bDone = true;
+
+ if( pGradAction )
+ {
+ pushState( rStates );
+
+ // TODO: Hack! If
+ // current state
+ // already contains a
+ // clipping, we'll
+ // overwrite it here!
+ getState( rStates ).xClipPoly = ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
+ rVDev.LogicToPixel( pGradAction->GetPolyPolygon() ) );
+
+ createGradientAction( pGradAction->GetPolyPolygon().GetBoundRect(),
+ pGradAction->GetGradient(),
+ rVDev,
+ rCanvas,
+ rStates );
+
+ popState( rStates );
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ // Handle drawing layer strokes
+ else if( pAct->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) )
+ {
+ // TODO: Later
+#if 0
+ const BYTE* pData = pAct->GetData();
+ if ( pData )
+ {
+ SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
+
+ SvtGraphicStroke aStroke;
+ aMemStm >> aStroke;
+
+ // TODO: respect exceptions, like
+ // start/end arrows and joins not
+ // displayable via Canvas
+
+ // TODO: use correct scale direction, stroke
+ // width might be height or anything else
+ const Size aSize( aStroke.getStrokeWidth(), 0 );
+
+ internal::StrokeAction aStrokeAction( rVDev.LogicToPixel( aStroke.getPath() ),
+ aStroke.getTransparency(),
+ rVDev.LogicToPixel( aSize ).Width(),
+ aStroke.getJoinType(),
+ aStroke.getDashArray(),
+ aStroke.getMiterLimit(),
+ aStroke.getCapType(),
+ rCanvas,
+ getState( rStates ) );
+
+ aStrokeAction.render( rViewState );
+
+ // skip broken-down render output
+ skipContent( rMtf, "XPATHSTROKE_SEQ_END" );
+ }
+#endif
+ }
+
+ // Handle drawing layer fills
+ else if( pAct->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) )
+ {
+ // TODO: Later
+#if 0
+ const BYTE* pData = pAct->GetData();
+ if ( pData )
+ {
+ SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
+
+ SvtGraphicFill aFill;
+ aMemStm >> aFill;
+
+ switch( aFill.getType() )
+ {
+ case SvtGraphicFill::fillSolid:
+ {
+ internal::SolidFillAction aFillAction( rVDev.LogicToPixel( aFill.getPath() ),
+ aFill.getFillColor(),
+ aFill.getTransparency(),
+ aFill.getFillRule(),
+ rCanvas,
+ getState( rStates ) );
+ aFillAction.render( rViewState );
+ }
+ break;
+
+ case SvtGraphicFill::fillGradient:
+ {
+ internal::GradientFillAction aFillAction( rVDev.LogicToPixel( aFill.getPath() ),
+ aFill.getTransparency(),
+ aFill.getFillRule(),
+ aFill.getTransform(),
+ aFill.getGradientType(),
+ aFill.getGradient1stColor(),
+ aFill.getGradient2ndColor(),
+ aFill.getGradientStepCount(),
+ rCanvas,
+ getState( rStates ) );
+ aFillAction.render( rViewState );
+ }
+ break;
+
+ case SvtGraphicFill::fillHatch:
+ {
+ internal::HatchedFillAction aFillAction( rVDev.LogicToPixel( aFill.getPath() ),
+ aFill.getTransparency(),
+ aFill.getFillRule(),
+ aFill.getTransform(),
+ aFill.getHatchType(),
+ aFill.getHatchColor(),
+ rCanvas,
+ getState( rStates ) );
+ aFillAction.render( rViewState );
+ }
+ break;
+
+ case SvtGraphicFill::fillTexture:
+ {
+ internal::BitmapFillAction aFillAction( rVDev.LogicToPixel( aFill.getPath() ),
+ aFill.getTransparency(),
+ aFill.getFillRule(),
+ aFill.getTransform(),
+ aFill.getFillGraphic(),
+ rCanvas,
+ getState( rStates ) );
+ aFillAction.render( rViewState );
+ }
+ break;
+ }
+
+ // skip broken-down render output
+ skipContent( rMtf, "XPATHFILL_SEQ_END" );
+ }
+#endif
+ }
+ }
+ break;
+
+ // ------------------------------------------------------------
+
+ // In the third part of this monster-switch, we
+ // handle all 'acting' meta actions. These are all
+ // processed by constructing function objects for
+ // them, which will later ease caching.
+
+ // ------------------------------------------------------------
+
+ case META_POINT_ACTION:
+ {
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::PointAction(
+ rVDev.LogicToPixel( static_cast<MetaPointAction*>(pCurrAct)->GetPoint() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_PIXEL_ACTION:
+ {
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::PointAction(
+ rVDev.LogicToPixel(
+ static_cast<MetaPixelAction*>(pCurrAct)->GetPoint() ),
+ rCanvas,
+ getState( rStates ),
+ static_cast<MetaPixelAction*>(pCurrAct)->GetColor() ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_LINE_ACTION:
+ {
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::LineAction(
+ rVDev.LogicToPixel( static_cast<MetaLineAction*>(pCurrAct)->GetStartPoint() ),
+ rVDev.LogicToPixel( static_cast<MetaLineAction*>(pCurrAct)->GetEndPoint() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_RECT_ACTION:
+ createFillAndStroke( ::PolyPolygon( ::Polygon( rVDev.LogicToPixel( static_cast<MetaRectAction*>(pCurrAct)->GetRect() ) ) ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+
+ case META_ROUNDRECT_ACTION:
+ createFillAndStroke( rVDev.LogicToPixel( Polygon( static_cast<MetaRoundRectAction*>(pCurrAct)->GetRect(),
+ static_cast<MetaRoundRectAction*>(pCurrAct)->GetHorzRound(),
+ static_cast<MetaRoundRectAction*>(pCurrAct)->GetVertRound() ) ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+
+ case META_ELLIPSE_ACTION:
+ {
+ const Rectangle& rRect = static_cast<MetaEllipseAction*>(pCurrAct)->GetRect();
+ createFillAndStroke( rVDev.LogicToPixel( Polygon( rRect.Center(),
+ rRect.GetWidth() >> 1,
+ rRect.GetHeight() >> 1 ) ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+ }
+
+ case META_ARC_ACTION:
+ createFillAndStroke( rVDev.LogicToPixel( Polygon( static_cast<MetaArcAction*>(pCurrAct)->GetRect(),
+ static_cast<MetaArcAction*>(pCurrAct)->GetStartPoint(),
+ static_cast<MetaArcAction*>(pCurrAct)->GetEndPoint(), POLY_ARC ) ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+
+ case META_PIE_ACTION:
+ createFillAndStroke( rVDev.LogicToPixel( Polygon( static_cast<MetaPieAction*>(pCurrAct)->GetRect(),
+ static_cast<MetaPieAction*>(pCurrAct)->GetStartPoint(),
+ static_cast<MetaPieAction*>(pCurrAct)->GetEndPoint(), POLY_PIE ) ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+
+ case META_CHORD_ACTION:
+ createFillAndStroke( rVDev.LogicToPixel( Polygon( static_cast<MetaChordAction*>(pCurrAct)->GetRect(),
+ static_cast<MetaChordAction*>(pCurrAct)->GetStartPoint(),
+ static_cast<MetaChordAction*>(pCurrAct)->GetEndPoint(), POLY_CHORD ) ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+
+ case META_POLYLINE_ACTION:
+ {
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::PolyPolyAction(
+ rVDev.LogicToPixel( static_cast<MetaPolyLineAction*>(pCurrAct)->GetPolygon() ),
+ rCanvas,
+ getState( rStates ),
+ internal::PolyPolyAction::strokeOnly ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_POLYGON_ACTION:
+ createFillAndStroke( rVDev.LogicToPixel( static_cast<MetaPolygonAction*>(pCurrAct)->GetPolygon() ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+
+ case META_POLYPOLYGON_ACTION:
+ createFillAndStroke( rVDev.LogicToPixel( static_cast<MetaPolyPolygonAction*>(pCurrAct)->GetPolyPolygon() ),
+ rCanvas, nCurrActionIndex,
+ rStates );
+ break;
+
+ case META_BMP_ACTION:
+ {
+ MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmap(),
+ rVDev.LogicToPixel( pAct->GetPoint() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmap(),
+ rVDev.LogicToPixel( pAct->GetPoint() ),
+ rVDev.LogicToPixel( pAct->GetSize() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmap(),
+ pAct->GetSrcPoint(),
+ pAct->GetSrcSize(),
+ rVDev.LogicToPixel( pAct->GetDestPoint() ),
+ rVDev.LogicToPixel( pAct->GetDestSize() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmapEx(),
+ rVDev.LogicToPixel( pAct->GetPoint() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmapEx(),
+ rVDev.LogicToPixel( pAct->GetPoint() ),
+ rVDev.LogicToPixel( pAct->GetSize() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmapEx(),
+ pAct->GetSrcPoint(),
+ pAct->GetSrcSize(),
+ rVDev.LogicToPixel( pAct->GetDestPoint() ),
+ rVDev.LogicToPixel( pAct->GetDestSize() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_MASK_ACTION:
+ {
+ MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pCurrAct);
+
+ // TODO: masking NYI. Further members: mask color
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmap(),
+ rVDev.LogicToPixel( pAct->GetPoint() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_MASKSCALE_ACTION:
+ {
+ MetaMaskScaleAction* pAct = static_cast<MetaMaskScaleAction*>(pCurrAct);
+
+ // TODO: masking NYI. Further members: mask color
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmap(),
+ rVDev.LogicToPixel( pAct->GetPoint() ),
+ rVDev.LogicToPixel( pAct->GetSize() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_MASKSCALEPART_ACTION:
+ {
+ MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pCurrAct);
+
+ // TODO: masking NYI. Further members: mask color
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::BitmapAction(
+ pAct->GetBitmap(),
+ pAct->GetSrcPoint(),
+ pAct->GetSrcSize(),
+ rVDev.LogicToPixel( pAct->GetDestPoint() ),
+ rVDev.LogicToPixel( pAct->GetDestSize() ),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_GRADIENTEX_ACTION:
+ // TODO: use native Canvas gradients here
+ // action is ignored here, because redundant to META_GRADIENT_ACTION
+ break;
+
+ case META_WALLPAPER_ACTION:
+ // TODO: NYI
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::PolyPolyAction(
+ rVDev.LogicToPixel( pAct->GetPolyPolygon() ),
+ rCanvas,
+ getState( rStates ),
+ pAct->GetTransparence() ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_FLOATTRANSPARENT_ACTION:
+ // TODO: NYI. This has to be rendered into a separate bitmap canvas
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ MetaTextAction* pAct = static_cast<MetaTextAction*>(pCurrAct);
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::TextAction(
+ rVDev.LogicToPixel(pAct->GetPoint()),
+ pAct->GetText(),
+ pAct->GetIndex(),
+ pAct->GetLen(),
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pCurrAct);
+
+ uno::Sequence< double > offsets( ::comphelper::arrayToSequence<long int, double>( pAct->GetDXArray(),
+ pAct->GetLen() ) );
+
+ // convert offsets to physical
+
+ // TODO: use correct scale direction, text advancement
+ // might be horizontal, vertical, or anything else
+ int i;
+ for( i=0; i<offsets.getLength(); ++i )
+ {
+ const Size aSize( static_cast<long>( offsets[i] + .5 ), 0 );
+ offsets[i] = rVDev.LogicToPixel( aSize ).Width();
+ }
+
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr(
+ new internal::TextAction(
+ rVDev.LogicToPixel(pAct->GetPoint()),
+ pAct->GetText(),
+ pAct->GetIndex(),
+ pAct->GetLen(),
+ offsets,
+ rCanvas,
+ getState( rStates ) ) ),
+ nCurrActionIndex ) );
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ case META_STRETCHTEXT_ACTION:
+ case META_TEXTLINE_ACTION:
+ // TODO: NYI
+ DBG_ERROR("META_TEXT* not yet supported");
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ ImplRenderer::ImplRenderer( const CanvasSharedPtr& rCanvas,
+ const GDIMetaFile& rMtf ) :
+ CanvasGraphicHelper( rCanvas ),
+ maActions()
+ {
+ OSL_ENSURE( rCanvas.get() != NULL && rCanvas->getUNOCanvas().is(),
+ "ImplRenderer::ImplRenderer(): Invalid canvas" );
+ OSL_ENSURE( rCanvas->getUNOCanvas()->getDevice().is(),
+ "ImplRenderer::ImplRenderer(): Invalid graphic device" );
+
+ // make sure canvas and graphic device are valid; action
+ // creation don't check that every time
+ if( rCanvas.get() == NULL ||
+ !rCanvas->getUNOCanvas().is() ||
+ !rCanvas->getUNOCanvas()->getDevice().is() )
+ {
+ // leave actions empty
+ return;
+ }
+
+ VectorOfOutDevStates aStateStack;
+
+ VirtualDevice aVDev;
+ aVDev.EnableOutput( FALSE );
+
+ // Setup VDev for state tracking and mapping
+ // =========================================
+
+ aVDev.SetMapMode( rMtf.GetPrefMapMode() );
+
+ const Size aMtfSizePix( aVDev.LogicToPixel( rMtf.GetPrefSize(),
+ rMtf.GetPrefMapMode() ) );
+ const Point aEmptyPt;
+ const Point aMtfOriginPix( aVDev.LogicToPixel( aEmptyPt ) );
+
+ // skip null-sized output
+ if( aMtfSizePix.Width() != 0 &&
+ aMtfSizePix.Height() != 0 )
+ {
+ // init state stack
+ clearStateStack( aStateStack );
+
+ // Setup local state, such that the metafile renders
+ // itself into a one-by-one square for identity view
+ // and render transformations
+ getState( aStateStack ).transform.translate( -aMtfOriginPix.X(), -aMtfOriginPix.Y() );
+ getState( aStateStack ).transform.scale( 1.0 / aMtfSizePix.Width(),
+ 1.0 / aMtfSizePix.Height() );
+
+ createActions( rCanvas,
+ aVDev,
+ const_cast<GDIMetaFile&>(rMtf), // HACK:
+ // we're
+ // changing
+ // the
+ // current
+ // action
+ // in
+ // createActions!
+ aStateStack );
+ }
+ }
+
+ ImplRenderer::ImplRenderer( const CanvasSharedPtr& rCanvas,
+ const BitmapEx& rBmpEx ) :
+ CanvasGraphicHelper( rCanvas ),
+ maActions()
+ {
+ OSL_ENSURE( rCanvas.get() != NULL && rCanvas->getUNOCanvas().is(),
+ "ImplRenderer::ImplRenderer(): Invalid canvas" );
+ OSL_ENSURE( rCanvas->getUNOCanvas()->getDevice().is(),
+ "ImplRenderer::ImplRenderer(): Invalid graphic device" );
+
+ // make sure canvas and graphic device are valid; action
+ // creation don't check that every time
+ if( rCanvas.get() == NULL ||
+ !rCanvas->getUNOCanvas().is() ||
+ !rCanvas->getUNOCanvas()->getDevice().is() )
+ {
+ // leave actions empty
+ return;
+ }
+
+ OutDevState aState;
+
+ const Size aBmpSize( rBmpEx.GetSizePixel() );
+
+ // Setup local state, such that the bitmap renders itself
+ // into a one-by-one square for identity view and render
+ // transformations
+ aState.transform.scale( 1.0 / aBmpSize.Width(),
+ 1.0 / aBmpSize.Height() );
+
+ // create a single action for the provided BitmapEx
+ maActions.push_back(
+ MtfAction(
+ ActionSharedPtr( new BitmapAction(rBmpEx,
+ Point(),
+ rCanvas,
+ aState) ),
+ 0 ) );
+ }
+
+ ImplRenderer::~ImplRenderer()
+ {
+ }
+
+ namespace
+ {
+ class ActionRenderer
+ {
+ public:
+ ActionRenderer() :
+ mbRet( true )
+ {
+ }
+
+ bool result()
+ {
+ return mbRet;
+ }
+
+ void operator()( const ::cppcanvas::internal::ImplRenderer::MtfAction& rAction )
+ {
+ // ANDing the result. We want to fail if at least
+ // one action failed.
+ mbRet &= rAction.mpAction->render();
+ }
+
+ private:
+ bool mbRet;
+ };
+ }
+
+ bool ImplRenderer::drawSubset( int startIndex,
+ int endIndex ) const
+ {
+ OSL_ENSURE( startIndex<=endIndex,
+ "ImplRenderer::draw() invalid action range" );
+
+ // find start and end action
+ ActionVector::const_iterator aIterBegin( ::std::lower_bound( maActions.begin(),
+ maActions.end(),
+ MtfAction( ActionSharedPtr(), startIndex ),
+ ActionIndexComparator() ) );
+ ActionVector::const_iterator aIterEnd( ::std::lower_bound( maActions.begin(),
+ maActions.end(),
+ MtfAction( ActionSharedPtr(), endIndex ),
+ ActionIndexComparator() ) );
+
+ // render subset of actions
+ return ::std::for_each( aIterBegin, aIterEnd, ActionRenderer() ).result();
+ }
+
+ bool ImplRenderer::draw() const
+ {
+ return ::std::for_each( maActions.begin(), maActions.end(), ActionRenderer() ).result();
+ }
+ }
+}
diff --git a/cppcanvas/source/mtfrenderer/lineaction.cxx b/cppcanvas/source/mtfrenderer/lineaction.cxx
new file mode 100644
index 000000000000..b82150527fdc
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/lineaction.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/mtfrenderer/lineaction.hxx b/cppcanvas/source/mtfrenderer/lineaction.hxx
new file mode 100644
index 000000000000..177eea849a43
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/lineaction.hxx
@@ -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 */
diff --git a/cppcanvas/source/mtfrenderer/makefile.mk b/cppcanvas/source/mtfrenderer/makefile.mk
new file mode 100644
index 000000000000..ec6e056c0032
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/makefile.mk
@@ -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
diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx
new file mode 100644
index 000000000000..bfd13cab443c
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/mtftools.cxx
@@ -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;
+ }
+
+ }
+
+}
diff --git a/cppcanvas/source/mtfrenderer/mtftools.hxx b/cppcanvas/source/mtfrenderer/mtftools.hxx
new file mode 100644
index 000000000000..6050b2130d94
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/mtftools.hxx
@@ -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 */
diff --git a/cppcanvas/source/mtfrenderer/outdevstate.hxx b/cppcanvas/source/mtfrenderer/outdevstate.hxx
new file mode 100644
index 000000000000..a794c677b225
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/outdevstate.hxx
@@ -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 */
diff --git a/cppcanvas/source/mtfrenderer/pointaction.cxx b/cppcanvas/source/mtfrenderer/pointaction.cxx
new file mode 100644
index 000000000000..fe1a01e873fa
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/pointaction.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/mtfrenderer/pointaction.hxx b/cppcanvas/source/mtfrenderer/pointaction.hxx
new file mode 100644
index 000000000000..5a994e27909d
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/pointaction.hxx
@@ -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 */
diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.cxx b/cppcanvas/source/mtfrenderer/polypolyaction.cxx
new file mode 100644
index 000000000000..047ef34b063c
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/polypolyaction.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.hxx b/cppcanvas/source/mtfrenderer/polypolyaction.hxx
new file mode 100644
index 000000000000..e89816b3efa9
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/polypolyaction.hxx
@@ -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 */
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
new file mode 100644
index 000000000000..3544e4a6e931
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/mtfrenderer/textaction.hxx b/cppcanvas/source/mtfrenderer/textaction.hxx
new file mode 100644
index 000000000000..3bd00e398bd5
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/textaction.hxx
@@ -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 */
diff --git a/cppcanvas/source/tools/canvasgraphichelper.cxx b/cppcanvas/source/tools/canvasgraphichelper.cxx
new file mode 100644
index 000000000000..18f8f000b012
--- /dev/null
+++ b/cppcanvas/source/tools/canvasgraphichelper.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/tools/makefile.mk b/cppcanvas/source/tools/makefile.mk
new file mode 100644
index 000000000000..19bde08596ae
--- /dev/null
+++ b/cppcanvas/source/tools/makefile.mk
@@ -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
diff --git a/cppcanvas/source/tools/tools.cxx b/cppcanvas/source/tools/tools.cxx
new file mode 100644
index 000000000000..85ba827c77d7
--- /dev/null
+++ b/cppcanvas/source/tools/tools.cxx
@@ -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;
+ }
+ }
+}
diff --git a/cppcanvas/source/wrapper/basegfxfactory.cxx b/cppcanvas/source/wrapper/basegfxfactory.cxx
new file mode 100644
index 000000000000..556e51047cf1
--- /dev/null
+++ b/cppcanvas/source/wrapper/basegfxfactory.cxx
@@ -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 ) );
+ }
+
+}
diff --git a/cppcanvas/source/wrapper/implbitmap.cxx b/cppcanvas/source/wrapper/implbitmap.cxx
new file mode 100644
index 000000000000..9ed4ab22f947
--- /dev/null
+++ b/cppcanvas/source/wrapper/implbitmap.cxx
@@ -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;
+ }
+ }
+}
diff --git a/cppcanvas/source/wrapper/implbitmap.hxx b/cppcanvas/source/wrapper/implbitmap.hxx
new file mode 100644
index 000000000000..f4c45fd577d1
--- /dev/null
+++ b/cppcanvas/source/wrapper/implbitmap.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implbitmapcanvas.cxx b/cppcanvas/source/wrapper/implbitmapcanvas.cxx
new file mode 100644
index 000000000000..f9448f088f2c
--- /dev/null
+++ b/cppcanvas/source/wrapper/implbitmapcanvas.cxx
@@ -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 ) );
+ }
+ }
+}
diff --git a/cppcanvas/source/wrapper/implbitmapcanvas.hxx b/cppcanvas/source/wrapper/implbitmapcanvas.hxx
new file mode 100644
index 000000000000..03d0301b0093
--- /dev/null
+++ b/cppcanvas/source/wrapper/implbitmapcanvas.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implcanvas.cxx b/cppcanvas/source/wrapper/implcanvas.cxx
new file mode 100644
index 000000000000..515c460172e1
--- /dev/null
+++ b/cppcanvas/source/wrapper/implcanvas.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/wrapper/implcanvas.hxx b/cppcanvas/source/wrapper/implcanvas.hxx
new file mode 100644
index 000000000000..d511273fcdfc
--- /dev/null
+++ b/cppcanvas/source/wrapper/implcanvas.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implcolor.cxx b/cppcanvas/source/wrapper/implcolor.cxx
new file mode 100644
index 000000000000..5831dfdb4ba5
--- /dev/null
+++ b/cppcanvas/source/wrapper/implcolor.cxx
@@ -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 );
+ }
+
+ }
+}
diff --git a/cppcanvas/source/wrapper/implcolor.hxx b/cppcanvas/source/wrapper/implcolor.hxx
new file mode 100644
index 000000000000..8129e17b4bef
--- /dev/null
+++ b/cppcanvas/source/wrapper/implcolor.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implcustomsprite.cxx b/cppcanvas/source/wrapper/implcustomsprite.cxx
new file mode 100644
index 000000000000..39e50bfe9c9f
--- /dev/null
+++ b/cppcanvas/source/wrapper/implcustomsprite.cxx
@@ -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;
+ }
+ }
+}
diff --git a/cppcanvas/source/wrapper/implcustomsprite.hxx b/cppcanvas/source/wrapper/implcustomsprite.hxx
new file mode 100644
index 000000000000..e14aa47c7b1c
--- /dev/null
+++ b/cppcanvas/source/wrapper/implcustomsprite.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implfont.cxx b/cppcanvas/source/wrapper/implfont.cxx
new file mode 100644
index 000000000000..23ace7fd3206
--- /dev/null
+++ b/cppcanvas/source/wrapper/implfont.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/wrapper/implfont.hxx b/cppcanvas/source/wrapper/implfont.hxx
new file mode 100644
index 000000000000..94d40709c470
--- /dev/null
+++ b/cppcanvas/source/wrapper/implfont.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implpolypolygon.cxx b/cppcanvas/source/wrapper/implpolypolygon.cxx
new file mode 100644
index 000000000000..c6a820615d7e
--- /dev/null
+++ b/cppcanvas/source/wrapper/implpolypolygon.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/wrapper/implpolypolygon.hxx b/cppcanvas/source/wrapper/implpolypolygon.hxx
new file mode 100644
index 000000000000..356d54a7b531
--- /dev/null
+++ b/cppcanvas/source/wrapper/implpolypolygon.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implsprite.cxx b/cppcanvas/source/wrapper/implsprite.cxx
new file mode 100644
index 000000000000..fed595efb83c
--- /dev/null
+++ b/cppcanvas/source/wrapper/implsprite.cxx
@@ -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;
+ }
+ }
+}
diff --git a/cppcanvas/source/wrapper/implsprite.hxx b/cppcanvas/source/wrapper/implsprite.hxx
new file mode 100644
index 000000000000..a84ec739efa9
--- /dev/null
+++ b/cppcanvas/source/wrapper/implsprite.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/implspritecanvas.cxx b/cppcanvas/source/wrapper/implspritecanvas.cxx
new file mode 100644
index 000000000000..85789581f061
--- /dev/null
+++ b/cppcanvas/source/wrapper/implspritecanvas.cxx
@@ -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;
+ }
+
+ }
+}
diff --git a/cppcanvas/source/wrapper/implspritecanvas.hxx b/cppcanvas/source/wrapper/implspritecanvas.hxx
new file mode 100644
index 000000000000..995bff4ebe03
--- /dev/null
+++ b/cppcanvas/source/wrapper/implspritecanvas.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/impltext.cxx b/cppcanvas/source/wrapper/impltext.cxx
new file mode 100644
index 000000000000..d47d2676355a
--- /dev/null
+++ b/cppcanvas/source/wrapper/impltext.cxx
@@ -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;
+ }
+ }
+}
diff --git a/cppcanvas/source/wrapper/impltext.hxx b/cppcanvas/source/wrapper/impltext.hxx
new file mode 100644
index 000000000000..5e5c7069a0aa
--- /dev/null
+++ b/cppcanvas/source/wrapper/impltext.hxx
@@ -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 */
diff --git a/cppcanvas/source/wrapper/makefile.mk b/cppcanvas/source/wrapper/makefile.mk
new file mode 100644
index 000000000000..06d92795103e
--- /dev/null
+++ b/cppcanvas/source/wrapper/makefile.mk
@@ -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
diff --git a/cppcanvas/source/wrapper/vclfactory.cxx b/cppcanvas/source/wrapper/vclfactory.cxx
new file mode 100644
index 000000000000..ec6a75ea60e2
--- /dev/null
+++ b/cppcanvas/source/wrapper/vclfactory.cxx
@@ -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 ) );
+ }
+
+}
diff --git a/cppcanvas/util/cppcanvas.flt b/cppcanvas/util/cppcanvas.flt
new file mode 100644
index 000000000000..90ec48c26d4e
--- /dev/null
+++ b/cppcanvas/util/cppcanvas.flt
@@ -0,0 +1,4 @@
+__CT
+Impl
+IMP
+internal
diff --git a/cppcanvas/util/makefile.mk b/cppcanvas/util/makefile.mk
new file mode 100644
index 000000000000..96f7743fb8b3
--- /dev/null
+++ b/cppcanvas/util/makefile.mk
@@ -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 > $@