summaryrefslogtreecommitdiff
path: root/cppcanvas/source/wrapper
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 /cppcanvas/source/wrapper
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.
Diffstat (limited to 'cppcanvas/source/wrapper')
-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
23 files changed, 3285 insertions, 0 deletions
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 ) );
+ }
+
+}