diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
commit | 941020379b1ea1ec7c564c21e68ea1674cda7683 (patch) | |
tree | 40fcaf109d6d585bcdc0faf7ea6c0812b3cc9a39 /cppcanvas | |
parent | 0692507dcc62e94c7af88388961db1d7d12d6dbd (diff) | |
parent | 0d2916e03ea51529e15995830a1a8c36bd72e442 (diff) |
Merge branch 'master' into feature/gnumake4
Conflicts:
basebmp/prj/d.lst
basebmp/test/basictest.cxx
basebmp/test/makefile.mk
basegfx/inc/basegfx/basegfxdllapi.h
basegfx/inc/basegfx/tools/debugplotter.hxx
basegfx/inc/basegfx/tuple/b2ituple.hxx
basegfx/prj/d.lst
basegfx/source/numeric/makefile.mk
basegfx/source/polygon/makefile.mk
basegfx/source/range/makefile.mk
basegfx/source/raster/makefile.mk
basegfx/source/tuple/makefile.mk
basegfx/source/vector/makefile.mk
basegfx/test/basegfx1d.cxx
basegfx/test/makefile.mk
basegfx/util/makefile.mk
canvas/Library_canvasfactory.mk
canvas/Module_canvas.mk
canvas/prj/build.lst
canvas/prj/d.lst
canvas/source/cairo/cairo_canvashelper_texturefill.cxx
canvas/source/cairo/makefile.mk
canvas/source/tools/makefile.mk
comphelper/qa/string/makefile.mk
cppcanvas/Module_cppcanvas.mk
cppcanvas/inc/cppcanvas/cppcanvasdllapi.h
cppcanvas/prj/build.lst
cppcanvas/prj/d.lst
cppcanvas/source/mtfrenderer/makefile.mk
cppcanvas/util/makefile.mk
i18npool/source/search/makefile.mk
regexp/Library_regexp.mk
regexp/prj/d.lst
sax/CppunitTest_sax.mk
sax/Library_sax.mk
sax/prj/d.lst
sax/qa/cppunit/test_converter.cxx
sax/source/expatwrap/attrlistimpl.hxx
sax/util/makefile.mk
svtools/Library_svt.mk
tools/Executable_sspretty.mk
ucbhelper/prj/d.lst
ucbhelper/source/provider/configureucb.cxx
ucbhelper/source/provider/provconf.cxx
ucbhelper/util/makefile.mk
unotools/Library_utl.mk
unotools/Module_unotools.mk
unotools/Package_inc.mk
unotools/prj/build.lst
vcl/Library_desktop_detector.mk
vcl/Library_vcl.mk
vcl/Library_vclplug_gtk.mk
vcl/aqua/source/gdi/salprn.cxx
vcl/inc/aqua/saldata.hxx
vcl/unx/generic/gdi/salgdi3.cxx
Diffstat (limited to 'cppcanvas')
72 files changed, 2238 insertions, 142 deletions
diff --git a/cppcanvas/inc/cppcanvas/basegfxfactory.hxx b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx index e59b3e71985b..5cb87aaeb5d3 100644 --- a/cppcanvas/inc/cppcanvas/basegfxfactory.hxx +++ b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,3 +104,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/bitmap.hxx b/cppcanvas/inc/cppcanvas/bitmap.hxx index cd17ec1837c9..425428b24ab5 100644 --- a/cppcanvas/inc/cppcanvas/bitmap.hxx +++ b/cppcanvas/inc/cppcanvas/bitmap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -78,3 +79,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_BITMAP_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx b/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx index 896f0c72845e..4221833bc29e 100644 --- a/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx +++ b/cppcanvas/inc/cppcanvas/bitmapcanvas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,3 +65,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_BITMAPCANVAS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/canvas.hxx b/cppcanvas/inc/cppcanvas/canvas.hxx index e08adeac2912..385006fdba46 100644 --- a/cppcanvas/inc/cppcanvas/canvas.hxx +++ b/cppcanvas/inc/cppcanvas/canvas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,3 +115,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_CANVAS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/canvasgraphic.hxx b/cppcanvas/inc/cppcanvas/canvasgraphic.hxx index 24467771dc50..4ae43fb4334c 100644 --- a/cppcanvas/inc/cppcanvas/canvasgraphic.hxx +++ b/cppcanvas/inc/cppcanvas/canvasgraphic.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -168,3 +169,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_CANVASGRAPHIC_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/color.hxx b/cppcanvas/inc/cppcanvas/color.hxx index 9a5237c264b7..6a8e872f328d 100644 --- a/cppcanvas/inc/cppcanvas/color.hxx +++ b/cppcanvas/inc/cppcanvas/color.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_COLOR_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/cppcanvasdllapi.h b/cppcanvas/inc/cppcanvas/cppcanvasdllapi.h index a2640bc5bbff..aeaf68b73330 100644 --- a/cppcanvas/inc/cppcanvas/cppcanvasdllapi.h +++ b/cppcanvas/inc/cppcanvas/cppcanvasdllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
diff --git a/cppcanvas/inc/cppcanvas/customsprite.hxx b/cppcanvas/inc/cppcanvas/customsprite.hxx index 15e1c1185aad..bd92fbd6f76a 100644 --- a/cppcanvas/inc/cppcanvas/customsprite.hxx +++ b/cppcanvas/inc/cppcanvas/customsprite.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,3 +52,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_CUSTOMSPRITE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/font.hxx b/cppcanvas/inc/cppcanvas/font.hxx index 2077ae811c85..b8d864321fd8 100644 --- a/cppcanvas/inc/cppcanvas/font.hxx +++ b/cppcanvas/inc/cppcanvas/font.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_FONT_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/polypolygon.hxx b/cppcanvas/inc/cppcanvas/polypolygon.hxx index a32e0c19ae50..0adc9426b692 100644 --- a/cppcanvas/inc/cppcanvas/polypolygon.hxx +++ b/cppcanvas/inc/cppcanvas/polypolygon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_POLYPOLYGON_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/renderer.hxx b/cppcanvas/inc/cppcanvas/renderer.hxx index 09852ff9e530..a01b438670a8 100644 --- a/cppcanvas/inc/cppcanvas/renderer.hxx +++ b/cppcanvas/inc/cppcanvas/renderer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -148,3 +149,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_RENDERER_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/sprite.hxx b/cppcanvas/inc/cppcanvas/sprite.hxx index 3a80a8137754..08c2beb2286a 100644 --- a/cppcanvas/inc/cppcanvas/sprite.hxx +++ b/cppcanvas/inc/cppcanvas/sprite.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,3 +115,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_SPRITE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/spritecanvas.hxx b/cppcanvas/inc/cppcanvas/spritecanvas.hxx index e5fda82d2e41..df29d4345a85 100644 --- a/cppcanvas/inc/cppcanvas/spritecanvas.hxx +++ b/cppcanvas/inc/cppcanvas/spritecanvas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_SPRITECANVAS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/text.hxx b/cppcanvas/inc/cppcanvas/text.hxx index 6fd54b4e0106..1787103141ae 100644 --- a/cppcanvas/inc/cppcanvas/text.hxx +++ b/cppcanvas/inc/cppcanvas/text.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,3 +54,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_TEXT_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/cppcanvas/vclfactory.hxx b/cppcanvas/inc/cppcanvas/vclfactory.hxx index 44e07b4bb921..14d9e6cbd5a8 100644 --- a/cppcanvas/inc/cppcanvas/vclfactory.hxx +++ b/cppcanvas/inc/cppcanvas/vclfactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -146,3 +147,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_VCLFACTORY_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/pch/precompiled_cppcanvas.cxx b/cppcanvas/inc/pch/precompiled_cppcanvas.cxx index 8b82ed878284..04b6f76e6ab5 100644 --- a/cppcanvas/inc/pch/precompiled_cppcanvas.cxx +++ b/cppcanvas/inc/pch/precompiled_cppcanvas.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,3 +28,4 @@ #include "precompiled_cppcanvas.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/inc/pch/precompiled_cppcanvas.hxx b/cppcanvas/inc/pch/precompiled_cppcanvas.hxx index b1bd1d18e74e..87c94a92a0ff 100644 --- a/cppcanvas/inc/pch/precompiled_cppcanvas.hxx +++ b/cppcanvas/inc/pch/precompiled_cppcanvas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,3 +31,4 @@ #ifdef PRECOMPILED_HEADERS #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/prj/build.lst b/cppcanvas/prj/build.lst index f3be4db2c69a..2dfe3a2c101e 100644 --- a/cppcanvas/prj/build.lst +++ b/cppcanvas/prj/build.lst @@ -1,3 +1,4 @@ cx cppcanvas : comphelper cppuhelper offuh tools vcl basegfx canvas NULL cx cppcanvas\prj nmake - all cx_prj NULL +cx cppcanvas\source\uno nmake - all cx_uno cx_tools cx_wrapper cx_mtfrenderer cx_util NULL diff --git a/cppcanvas/prj/d.lst b/cppcanvas/prj/d.lst index e69de29bb2d1..c103198198f6 100644 --- a/cppcanvas/prj/d.lst +++ b/cppcanvas/prj/d.lst @@ -0,0 +1,2 @@ +..\%__SRC%\lib\lib*.* %_DEST%\lib\lib*.* +..\%__SRC%\misc\mtfrenderer.component %_DEST%\xml\mtfrenderer.component diff --git a/cppcanvas/source/inc/action.hxx b/cppcanvas/source/inc/action.hxx index 9be2b5309e0f..971cfcb4609f 100644 --- a/cppcanvas/source/inc/action.hxx +++ b/cppcanvas/source/inc/action.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <sal/types.h> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif namespace basegfx { @@ -162,3 +161,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_ACTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/inc/canvasgraphichelper.hxx b/cppcanvas/source/inc/canvasgraphichelper.hxx index 40cda1d2d186..6d49939be1b7 100644 --- a/cppcanvas/source/inc/canvasgraphichelper.hxx +++ b/cppcanvas/source/inc/canvasgraphichelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -84,3 +85,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_CANVASGRAPHICHELPER_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx index c3613af135a9..3c1ec6de127f 100644 --- a/cppcanvas/source/inc/implrenderer.hxx +++ b/cppcanvas/source/inc/implrenderer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <sal/types.h> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif #include <cppcanvas/renderer.hxx> #include <cppcanvas/canvas.hxx> @@ -47,6 +46,11 @@ class Gradient; class BitmapEx; class MapMode; class Size; +class Rectangle; +class Font; +class PolyPolygon; +class Point; +class MetaCommentAction; namespace basegfx { class B2DPolyPolygon; @@ -60,11 +64,110 @@ namespace cppcanvas { struct OutDevState; struct ActionFactoryParameters; + struct EMFPObject; + struct XForm; // state stack of OutputDevice, to correctly handle // push/pop actions typedef ::std::vector< OutDevState > VectorOfOutDevStates; + // EMF+ + // TODO: replace? + struct XForm + { + float eM11; + float eM12; + float eM21; + float eM22; + float eDx; + float eDy; + XForm() + { + SetIdentity (); + }; + + void SetIdentity () + { + eM11 = eM22 = 1.0f; + eDx = eDy = eM12 = eM21 = 0.0f; + } + + void Set (float m11, float m12, float dx, float m21, float m22, float dy) + { + eM11 = m11; + eM12 = m12; + eDx = dx; + eM21 = m21; + eM22 = m22; + eDy = dy; + } + + void Set (XForm f) + { + eM11 = f.eM11; + eM12 = f.eM12; + eM21 = f.eM21; + eM22 = f.eM22; + eDx = f.eDx; + eDy = f.eDy; + } + + void Multiply (float m11, float m12, float dx, float m21, float m22, float dy) + { + eM11 = eM11*m11 + eM12*m21; + eM12 = eM11*m12 + eM12*m22; + eM21 = eM21*m11 + eM22*m21; + eM22 = eM21*m12 + eM22*m22; + eDx *= eDx*m11 + eDy*m21 + dx; + eDy *= eDx*m12 + eDy*m22 + dy; + } + + void Multiply (XForm f) + { + eM11 = eM11*f.eM11 + eM12*f.eM21; + eM12 = eM11*f.eM12 + eM12*f.eM22; + eM21 = eM21*f.eM11 + eM22*f.eM21; + eM22 = eM21*f.eM12 + eM22*f.eM22; + eDx *= eDx*f.eM11 + eDy*f.eM21 + f.eDx; + eDy *= eDx*f.eM12 + eDy*f.eM22 + f.eDy; + } + +#ifdef OSL_BIGENDIAN +// currently unused +static float GetSwapFloat( SvStream& rSt ) +{ + float fTmp; + sal_Int8* pPtr = (sal_Int8*)&fTmp; + rSt >> pPtr[3] >> pPtr[2] >> pPtr[1] >> pPtr[0]; // Little Endian <-> Big Endian switch + return fTmp; +} +#endif + + friend SvStream& operator>>( SvStream& rIn, XForm& rXForm ) + { + if ( sizeof( float ) != 4 ) + { + OSL_FAIL( "EnhWMFReader::sizeof( float ) != 4" ); + rXForm = XForm(); + } + else + { +#ifdef OSL_BIGENDIAN + rXForm.eM11 = GetSwapFloat( rIn ); + rXForm.eM12 = GetSwapFloat( rIn ); + rXForm.eM21 = GetSwapFloat( rIn ); + rXForm.eM22 = GetSwapFloat( rIn ); + rXForm.eDx = GetSwapFloat( rIn ); + rXForm.eDy = GetSwapFloat( rIn ); +#else + rIn >> rXForm.eM11 >> rXForm.eM12 >> rXForm.eM21 >> rXForm.eM22 + >> rXForm.eDx >> rXForm.eDy; +#endif + } + return rIn; + } + }; + class ImplRenderer : public virtual Renderer, protected CanvasGraphicHelper { public: @@ -103,6 +206,14 @@ namespace cppcanvas // (externally not visible) typedef ::std::vector< MtfAction > ActionVector; + /* EMF+ */ + void ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, sal_uInt32 flags = 0); + void ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags = 0); + void MapToDevice (double &x, double &y); + ::basegfx::B2DPoint Map (::basegfx::B2DPoint& p); + ::basegfx::B2DPoint Map (double ix, double iy); + ::basegfx::B2DSize MapSize (double iwidth, double iheight); + ::basegfx::B2DRange MapRectangle (double ix, double iy, double iwidth, double iheight); private: // default: disabled copy/assignment @@ -155,8 +266,35 @@ namespace cppcanvas ActionVector::const_iterator& o_rRangeBegin, ActionVector::const_iterator& o_rRangeEnd ) const; + void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags); + void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas ); + void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor); ActionVector maActions; + + /* EMF+ */ + XForm aBaseTransform; + XForm aWorldTransform; + EMFPObject* aObjects [256]; + float fPageScale; + sal_Int32 nOriginX; + sal_Int32 nOriginY; + sal_Int32 nHDPI; + sal_Int32 nVDPI; + ::PolyPolygon aClippingPolygon; + /* EMF+ emf header info */ + sal_Int32 nFrameLeft; + sal_Int32 nFrameTop; + sal_Int32 nFrameRight; + sal_Int32 nFrameBottom; + sal_Int32 nPixX; + sal_Int32 nPixY; + sal_Int32 nMmX; + sal_Int32 nMmY; + /* multipart object data */ + bool mbMultipart; + sal_uInt16 mMFlags; + SvMemoryStream mMStream; }; @@ -185,3 +323,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLRENDERER_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/inc/tools.hxx b/cppcanvas/source/inc/tools.hxx index f6d157d2c60e..bdd9848822fa 100644 --- a/cppcanvas/source/inc/tools.hxx +++ b/cppcanvas/source/inc/tools.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_TOOLS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.cxx b/cppcanvas/source/mtfrenderer/bitmapaction.cxx index fd0bb268b6f5..cbbd817cc0ec 100644 --- a/cppcanvas/source/mtfrenderer/bitmapaction.cxx +++ b/cppcanvas/source/mtfrenderer/bitmapaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -236,3 +237,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.hxx b/cppcanvas/source/mtfrenderer/bitmapaction.hxx index 6c41579d39dd..e6c7b83ee626 100644 --- a/cppcanvas/source/mtfrenderer/bitmapaction.hxx +++ b/cppcanvas/source/mtfrenderer/bitmapaction.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,5 @@ namespace cppcanvas } #endif /*_CPPCANVAS_BITMAPACTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx b/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx index 15096c4cfec6..9cd01fc42a03 100644 --- a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx +++ b/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx b/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx index 2c6ad0411f4b..8cef77f1dd26 100644 --- a/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx +++ b/cppcanvas/source/mtfrenderer/cachedprimitivebase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,5 @@ namespace cppcanvas } #endif /*_CPPCANVAS_CACHEDPRIMITIVEBASE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx new file mode 100644 index 000000000000..e90db4032bf6 --- /dev/null +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -0,0 +1,1617 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/stream.hxx> +#include <vcl/metaact.hxx> +#include <svtools/filter.hxx> +#include <basegfx/tools/canvastools.hxx> +#include <basegfx/tools/gradienttools.hxx> +#include <basegfx/tools/tools.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/vector/b2dsize.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/b2drectangle.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <vcl/canvastools.hxx> +#include <rtl/ustring.hxx> +#include <sal/alloca.h> + +#include <com/sun/star/rendering/XCanvas.hpp> +#include <com/sun/star/rendering/TexturingMode.hpp> + +#include <bitmapaction.hxx> +#include <implrenderer.hxx> +#include <outdevstate.hxx> +#include <polypolyaction.hxx> +#include <textaction.hxx> + +#define EmfPlusRecordTypeHeader 16385 +#define EmfPlusRecordTypeEndOfFile 16386 +#define EmfPlusRecordTypeGetDC 16388 +#define EmfPlusRecordTypeObject 16392 +#define EmfPlusRecordTypeFillRects 16394 +#define EmfPlusRecordTypeFillPolygon 16396 +#define EmfPlusRecordTypeDrawLines 16397 +#define EmfPlusRecordTypeFillPath 16404 +#define EmfPlusRecordTypeDrawPath 16405 +#define EmfPlusRecordTypeDrawImagePoints 16411 +#define EmfPlusRecordTypeDrawString 16412 +#define EmfPlusRecordTypeSetRenderingOrigin 16413 +#define EmfPlusRecordTypeSetAntiAliasMode 16414 +#define EmfPlusRecordTypeSetTextRenderingHint 16415 +#define EmfPlusRecordTypeSetInterpolationMode 16417 +#define EmfPlusRecordTypeSetPixelOffsetMode 16418 +#define EmfPlusRecordTypeSetCompositingQuality 16420 +#define EmfPlusRecordTypeSave 16421 +#define EmfPlusRecordTypeSetWorldTransform 16426 +#define EmfPlusRecordTypeResetWorldTransform 16427 +#define EmfPlusRecordTypeSetPageTransform 16432 +#define EmfPlusRecordTypeSetClipPath 16435 +#define EmfPlusRecordTypeSetClipRegion 16436 +#define EmfPlusRecordTypeDrawDriverString 16438 + +#define EmfPlusObjectTypeBrush 0x100 +#define EmfPlusObjectTypePen 0x200 +#define EmfPlusObjectTypePath 0x300 +#define EmfPlusObjectTypeRegion 0x400 +#define EmfPlusObjectTypeImage 0x500 +#define EmfPlusObjectTypeFont 0x600 +#define EmfPlusObjectTypeStringFormat 0x700 +#define EmfPlusObjectTypeImageAttributes 0x800 + +#define EmfPlusRegionInitialStateRectangle 0x10000000 +#define EmfPlusRegionInitialStatePath 0x10000001 +#define EmfPlusRegionInitialStateEmpty 0x10000002 +#define EmfPlusRegionInitialStateInfinite 0x10000003 + +#define EMFP_DEBUG(x) +//#define EMFP_DEBUG(x) x + +using namespace ::com::sun::star; + +namespace cppcanvas +{ + namespace internal + { + + EMFP_DEBUG (void dumpWords (SvStream& s, int i) + { + sal_uInt32 pos = s.Tell (); + sal_Int16 data; + for (; i > 0; i --) { + s >> data; + printf ("EMF+\tdata: %04hX\n", data); + } + s.Seek (pos); + }); + + struct EMFPObject + { + }; + + struct EMFPPath : public EMFPObject + { + ::basegfx::B2DPolyPolygon aPolygon; + sal_Int32 nPoints; + float* pPoints; + sal_uInt8* pPointTypes; + + public: + EMFPPath (sal_Int32 _nPoints, bool bLines = false) + { + if( _nPoints<0 || sal_uInt32(_nPoints)>SAL_MAX_INT32/(2*sizeof(float)) ) + _nPoints = SAL_MAX_INT32/(2*sizeof(float)); + nPoints = _nPoints; + pPoints = new float [nPoints*2]; + if (!bLines) + pPointTypes = new sal_uInt8 [_nPoints]; + else + pPointTypes = NULL; + } + + ~EMFPPath () + { + delete [] pPoints; + delete [] pPointTypes; + } + + // TODO: remove rR argument when debug code is not longer needed + void Read (SvStream& s, sal_uInt32 pathFlags, ImplRenderer& rR) + { + for (int i = 0; i < nPoints; i ++) { + if (pathFlags & 0x4000) { + // points are stored in short 16bit integer format + sal_uInt16 x, y; + + s >> x >> y; + EMFP_DEBUG (printf ("EMF+\tpoint [x,y]: %hd,%hd\n", x, y)); + pPoints [i*2] = x; + pPoints [i*2 + 1] = y; + } else { + // points are stored in Single (float) format + s >> pPoints [i*2] >> pPoints [i*2 + 1]; + EMFP_DEBUG (printf ("EMF+\tpoint [x,y]: %f,%f\n", pPoints [i*2], pPoints [i*2 + 1])); + } + } + + if (pPointTypes) + for (int i = 0; i < nPoints; i ++) { + s >> pPointTypes [i]; + EMFP_DEBUG (printf ("EMF+\tpoint type: %x\n", pPointTypes [i])); + } + + aPolygon.clear (); + + // debug code + const ::basegfx::B2DRectangle aBounds (::basegfx::tools::getRange (GetPolygon (rR))); + EMFP_DEBUG (printf ("EMF+\tpolygon bounding box: %f,%f %fx%f (mapped)\n", aBounds.getMinX (), aBounds.getMinY (), aBounds.getWidth (), aBounds.getHeight ())); + } + + ::basegfx::B2DPolyPolygon& GetPolygon (ImplRenderer& rR, bool bMapIt = true) + { + ::basegfx::B2DPolygon polygon; + + aPolygon.clear (); + + int last_normal = 0, p = 0; + ::basegfx::B2DPoint prev, mapped; + bool hasPrev = false; + for (int i = 0; i < nPoints; i ++) { + if (p && pPointTypes && (pPointTypes [i] == 0)) { + aPolygon.append (polygon); + last_normal = i; + p = 0; + polygon.clear (); + } + + if (bMapIt) + mapped = rR.Map (pPoints [i*2], pPoints [i*2 + 1]); + else + mapped = ::basegfx::B2DPoint (pPoints [i*2], pPoints [i*2 + 1]); + //EMFP_DEBUG (printf ("polygon point: %f,%f mapped: %f,%f\n", pPoints [i*2], pPoints [i*2 + 1], mapped.getX (), mapped.getY ())); + if (pPointTypes) { + if ((pPointTypes [i] & 0x07) == 3) { + if (((i - last_normal )% 3) == 1) { + polygon.setNextControlPoint (p - 1, mapped); + continue; + } else if (((i - last_normal) % 3) == 2) { + prev = mapped; + hasPrev = true; + continue; + } + } else + last_normal = i; + } + polygon.append (mapped); + if (hasPrev) { + polygon.setPrevControlPoint (p, prev); + hasPrev = false; + } + p ++; + if (pPointTypes && (pPointTypes [i] & 0x80)) { // closed polygon + polygon.setClosed (true); + aPolygon.append (polygon); + last_normal = i + 1; + p = 0; + polygon.clear (); + } + } + + if (polygon.count ()) + aPolygon.append (polygon); + + return aPolygon; + } + }; + + struct EMFPRegion : public EMFPObject + { + sal_Int32 parts; + sal_Int32 *combineMode; + sal_Int32 initialState; + EMFPPath *initialPath; + float ix, iy, iw, ih; + + EMFPRegion () + { + combineMode = NULL; + initialPath = NULL; + } + + ~EMFPRegion () + { + if (combineMode) { + delete [] combineMode; + combineMode = NULL; + } + if (initialPath) { + delete initialPath; + initialPath = NULL; + } + } + + void Read (SvStream& s) + { + sal_uInt32 header; + + s >> header >> parts; + + EMFP_DEBUG (printf ("EMF+\tregion\n")); + EMFP_DEBUG (printf ("EMF+\theader: 0x%08x parts: %d\n", header, parts)); + + if (parts) { + if( parts<0 || sal_uInt32(parts)>SAL_MAX_INT32/sizeof(sal_Int32) ) + parts = SAL_MAX_INT32/sizeof(sal_Int32); + + combineMode = new sal_Int32 [parts]; + + for (int i = 0; i < parts; i ++) { + s >> combineMode [i]; + EMFP_DEBUG (printf ("EMF+\tcombine mode [%d]: 0x%08x\n", i, combineMode [i])); + } + } + + s >> initialState; + EMFP_DEBUG (printf ("EMF+\tinitial state: 0x%08x\n", initialState)); + } + }; + + struct EMFPBrush : public EMFPObject + { + ::Color solidColor; + sal_uInt32 type; + sal_uInt32 additionalFlags; + + /* linear gradient */ + sal_Int32 wrapMode; + float areaX, areaY, areaWidth, areaHeight; + ::Color secondColor; // first color is stored in solidColor; + XForm transformation; + bool hasTransformation; + sal_Int32 blendPoints; + float* blendPositions; + float* blendFactors; + sal_Int32 colorblendPoints; + float* colorblendPositions; + ::Color* colorblendColors; + sal_Int32 surroundColorsNumber; + ::Color* surroundColors; + EMFPPath *path; + + public: + EMFPBrush () + { + blendPositions = NULL; + colorblendPositions = NULL; + colorblendColors = NULL; + surroundColors = NULL; + path = NULL; + hasTransformation = false; + } + + ~EMFPBrush () + { + if (blendPositions != NULL) { + delete[] blendPositions; + blendPositions = NULL; + } + if (colorblendPositions != NULL) { + delete[] colorblendPositions; + colorblendPositions = NULL; + } + if (colorblendColors != NULL) { + delete[] colorblendColors; + colorblendColors = NULL; + } + if (surroundColors != NULL) { + delete[] surroundColors; + surroundColors = NULL; + } + if (path) { + delete path; + path = NULL; + } + } + + sal_uInt32 GetType() const { return type; } + const ::Color& GetColor() const { return solidColor; } + + void Read (SvStream& s, ImplRenderer& rR) + { + sal_uInt32 header; + + s >> header >> type; + + EMFP_DEBUG (printf ("EMF+\tbrush\nEMF+\theader: 0x%08x type: %d\n", header, type)); + + switch (type) { + case 0: + { + sal_uInt32 color; + + s >> color; + solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); + EMFP_DEBUG (printf ("EMF+\tsolid color: 0x%08x\n", color)); + + break; + } + // path gradient + case 3: + { + s >> additionalFlags >> wrapMode; + + EMFP_DEBUG (printf ("EMF+\tpath gradient, additional flags: 0x%02x\n", additionalFlags)); + + sal_uInt32 color; + + s >> color; + solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); + EMFP_DEBUG (printf ("EMF+\tcenter color: 0x%08x\n", color)); + + s >> areaX >> areaY; + EMFP_DEBUG (printf ("EMF+\tcenter point: %f,%f\n", areaX, areaY)); + + s >> surroundColorsNumber; + EMFP_DEBUG (printf ("EMF+\tsurround colors: %d\n", surroundColorsNumber)); + + if( surroundColorsNumber<0 || sal_uInt32(surroundColorsNumber)>SAL_MAX_INT32/sizeof(::Color) ) + surroundColorsNumber = SAL_MAX_INT32/sizeof(::Color); + + surroundColors = new ::Color [surroundColorsNumber]; + for (int i = 0; i < surroundColorsNumber; i++) { + s >> color; + surroundColors[i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); + if (i == 0) + secondColor = surroundColors [0]; + EMFP_DEBUG (printf ("EMF+\tsurround color[%d]: 0x%08x\n", i, color)); + } + + if (additionalFlags & 0x01) { + sal_Int32 pathLength; + + s >> pathLength; + EMFP_DEBUG (printf ("EMF+\tpath length: %d\n", pathLength)); + + sal_uInt32 pos = s.Tell (); + EMFP_DEBUG (dumpWords (s, 32)); + + sal_uInt32 pathHeader; + sal_Int32 pathPoints, pathFlags; + s >> pathHeader >> pathPoints >> pathFlags; + + EMFP_DEBUG (printf ("EMF+\tpath (brush path gradient)\n")); + EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", pathHeader, pathPoints, pathFlags)); + + path = new EMFPPath (pathPoints); + path->Read (s, pathFlags, rR); + + s.Seek (pos + pathLength); + + const ::basegfx::B2DRectangle aBounds (::basegfx::tools::getRange (path->GetPolygon (rR, false))); + areaWidth = aBounds.getWidth (); + areaHeight = aBounds.getHeight (); + + EMFP_DEBUG (printf ("EMF+\tpolygon bounding box: %f,%f %fx%f\n", aBounds.getMinX (), aBounds.getMinY (), aBounds.getWidth (), aBounds.getHeight ())); + + + if (additionalFlags & 0x02) { + EMFP_DEBUG (printf ("EMF+\tuse transformation\n", color)); + s >> transformation; + hasTransformation = true; + EMFP_DEBUG (printf ("EMF+\tm11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n", + transformation.eM11, transformation.eM12, + transformation.eM21, transformation.eM22, + transformation.eDx, transformation.eDy)); + } + if (additionalFlags & 0x08) { + s >> blendPoints; + EMFP_DEBUG (printf ("EMF+\tuse blend, points: %d\n", blendPoints)); + if( blendPoints<0 || sal_uInt32(blendPoints)>SAL_MAX_INT32/(2*sizeof(float)) ) + blendPoints = SAL_MAX_INT32/(2*sizeof(float)); + blendPositions = new float [2*blendPoints]; + blendFactors = blendPositions + blendPoints; + for (int i=0; i < blendPoints; i ++) { + s >> blendPositions [i]; + EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, blendPositions [i])); + } + for (int i=0; i < blendPoints; i ++) { + s >> blendFactors [i]; + EMFP_DEBUG (printf ("EMF+\tfactor[%d]: %f\n", i, blendFactors [i])); + } + } + + if (additionalFlags & 0x04) { + s >> colorblendPoints; + EMFP_DEBUG (printf ("EMF+\tuse color blend, points: %d\n", colorblendPoints)); + if( colorblendPoints<0 || sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(float) ) + colorblendPoints = SAL_MAX_INT32/sizeof(float); + if( sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(::Color) ) + colorblendPoints = SAL_MAX_INT32/sizeof(::Color); + colorblendPositions = new float [colorblendPoints]; + colorblendColors = new ::Color [colorblendPoints]; + for (int i=0; i < colorblendPoints; i ++) { + s >> colorblendPositions [i]; + EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, colorblendPositions [i])); + } + for (int i=0; i < colorblendPoints; i ++) { + s >> color; + colorblendColors [i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); + EMFP_DEBUG (printf ("EMF+\tcolor[%d]: 0x%08x\n", i, color)); + } + } + } else { + EMFP_DEBUG (dumpWords (s, 1024)); + } + break; + } + // linear gradient + case 4: + { + s >> additionalFlags >> wrapMode; + + EMFP_DEBUG (printf ("EMF+\tlinear gradient, additional flags: 0x%02x\n", additionalFlags)); + + s >> areaX >> areaY >> areaWidth >> areaHeight; + + EMFP_DEBUG (printf ("EMF+\tarea: %f,%f - %fx%f\n", areaX, areaY, areaWidth, areaHeight)); + + sal_uInt32 color; + + s >> color; + solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); + EMFP_DEBUG (printf ("EMF+\tfirst color: 0x%08x\n", color)); + + s >> color; + secondColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); + EMFP_DEBUG (printf ("EMF+\tsecond color: 0x%08x\n", color)); + + // repeated colors, unknown meaning, see http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/ObjectBrush.html + s >> color; + s >> color; + + if (additionalFlags & 0x02) { + EMFP_DEBUG (printf ("EMF+\tuse transformation\n", color)); + s >> transformation; + hasTransformation = true; + EMFP_DEBUG (printf ("EMF+\tm11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n", + transformation.eM11, transformation.eM12, + transformation.eM21, transformation.eM22, + transformation.eDx, transformation.eDy)); + } + if (additionalFlags & 0x08) { + s >> blendPoints; + EMFP_DEBUG (printf ("EMF+\tuse blend, points: %d\n", blendPoints)); + if( blendPoints<0 || sal_uInt32(blendPoints)>SAL_MAX_INT32/(2*sizeof(float)) ) + blendPoints = SAL_MAX_INT32/(2*sizeof(float)); + blendPositions = new float [2*blendPoints]; + blendFactors = blendPositions + blendPoints; + for (int i=0; i < blendPoints; i ++) { + s >> blendPositions [i]; + EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, blendPositions [i])); + } + for (int i=0; i < blendPoints; i ++) { + s >> blendFactors [i]; + EMFP_DEBUG (printf ("EMF+\tfactor[%d]: %f\n", i, blendFactors [i])); + } + } + + if (additionalFlags & 0x04) { + s >> colorblendPoints; + EMFP_DEBUG (printf ("EMF+\tuse color blend, points: %d\n", colorblendPoints)); + if( colorblendPoints<0 || sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(float) ) + colorblendPoints = SAL_MAX_INT32/sizeof(float); + if( sal_uInt32(colorblendPoints)>SAL_MAX_INT32/sizeof(::Color) ) + colorblendPoints = sal_uInt32(SAL_MAX_INT32)/sizeof(::Color); + colorblendPositions = new float [colorblendPoints]; + colorblendColors = new ::Color [colorblendPoints]; + for (int i=0; i < colorblendPoints; i ++) { + s >> colorblendPositions [i]; + EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, colorblendPositions [i])); + } + for (int i=0; i < colorblendPoints; i ++) { + s >> color; + colorblendColors [i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); + EMFP_DEBUG (printf ("EMF+\tcolor[%d]: 0x%08x\n", i, color)); + } + } + + break; + } + default: + EMFP_DEBUG (printf ("EMF+\tunhandled brush type: %d\n", type)); + } + } + }; + + struct EMFPPen : public EMFPBrush + { + XForm transformation; + float width; + sal_Int32 startCap; + sal_Int32 endCap; + sal_Int32 lineJoin; + float mitterLimit; + sal_Int32 dashStyle; + sal_Int32 dashCap; + float dashOffset; + sal_Int32 dashPatternLen; + float *dashPattern; + sal_Int32 alignment; + sal_Int32 compoundArrayLen; + float *compoundArray; + sal_Int32 customStartCapLen; + sal_uInt8 *customStartCap; + sal_Int32 customEndCapLen; + sal_uInt8 *customEndCap; + + public: + EMFPPen () : EMFPBrush () + { + } + + void SetStrokeAttributes (rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) + { + rStrokeAttributes.StrokeWidth = (rState.mapModeTransform * rR.MapSize (width, 0)).getX (); + } + + void Read (SvStream& s, ImplRenderer& rR, sal_Int32, sal_Int32 ) + { + sal_uInt32 header, unknown, penFlags, unknown2; + int i; + + s >> header >> unknown >> penFlags >> unknown2 >> width; + + EMFP_DEBUG (printf ("EMF+\tpen\nEMF+\theader: 0x%08x unknown: 0x%08x additional flags: 0x%08x unknown: 0x%08x width: %f\n", header, unknown, penFlags, unknown2, width)); + + if (penFlags & 1) + s >> transformation; + + if (penFlags & 2) + s >> startCap; + else + startCap = 0; + + if (penFlags & 4) + s >> endCap; + else + endCap = 0; + + if (penFlags & 8) + s >> lineJoin; + else + lineJoin = 0; + + if (penFlags & 16) + s >> mitterLimit; + else + mitterLimit = 0; + + if (penFlags & 32) + s >> dashStyle; + else + dashStyle = 0; + + if (penFlags & 64) + s >> dashCap; + else + dashCap = 0; + + if (penFlags & 128) + s >> dashOffset; + else + dashOffset = 0; + + if (penFlags & 256) { + s >> dashPatternLen; + if( dashPatternLen<0 || sal_uInt32(dashPatternLen)>SAL_MAX_INT32/sizeof(float) ) + dashPatternLen = SAL_MAX_INT32/sizeof(float); + dashPattern = new float [dashPatternLen]; + for (i = 0; i < dashPatternLen; i++) + s >> dashPattern [i]; + } else + dashPatternLen = 0; + + if (penFlags & 512) + s >> alignment; + else + alignment = 0; + + if (penFlags & 1024) { + s >> compoundArrayLen; + if( compoundArrayLen<0 || sal_uInt32(compoundArrayLen)>SAL_MAX_INT32/sizeof(float) ) + compoundArrayLen = SAL_MAX_INT32/sizeof(float); + compoundArray = new float [compoundArrayLen]; + for (i = 0; i < compoundArrayLen; i++) + s >> compoundArray [i]; + } else + compoundArrayLen = 0; + + if (penFlags & 2048) { + s >> customStartCapLen; + if( customStartCapLen<0 ) + customStartCapLen=0; + customStartCap = new sal_uInt8 [customStartCapLen]; + for (i = 0; i < customStartCapLen; i++) + s >> customStartCap [i]; + } else + customStartCapLen = 0; + + if (penFlags & 4096) { + s >> customEndCapLen; + if( customEndCapLen<0 ) + customEndCapLen=0; + customEndCap = new sal_uInt8 [customEndCapLen]; + for (i = 0; i < customEndCapLen; i++) + s >> customEndCap [i]; + } else + customEndCapLen = 0; + + EMFPBrush::Read (s, rR); + } + }; + + struct EMFPImage : public EMFPObject + { + sal_uInt32 type; + sal_Int32 width; + sal_Int32 height; + sal_Int32 stride; + sal_Int32 pixelFormat; + Graphic graphic; + + + void Read (SvMemoryStream &s) + { + sal_uInt32 header, unknown; + + s >> header >> type; + + EMFP_DEBUG (printf ("EMF+\timage\nEMF+\theader: 0x%08x type: 0x%08x\n", header, type)); + + if (type == 1) { // bitmap + s >> width >> height >> stride >> pixelFormat >> unknown; + EMFP_DEBUG (printf ("EMF+\tbitmap width: %d height: %d stride: %d pixelFormat: 0x%08x\n", width, height, stride, pixelFormat)); + if (width == 0) { // non native formats + GraphicFilter filter; + + filter.ImportGraphic (graphic, String (), s); + EMFP_DEBUG (printf ("EMF+\tbitmap width: %d height: %d\n", graphic.GetBitmap ().GetSizePixel ().Width (), graphic.GetBitmap ().GetSizePixel ().Height ())); + } + + } else if (type == 2) { + sal_Int32 mfType, mfSize; + + s >> mfType >> mfSize; + EMFP_DEBUG (printf ("EMF+\tmetafile type: %d dataSize: %d\n", mfType, mfSize)); + + GraphicFilter filter; + SvMemoryStream mfStream (((char *)s.GetData()) + s.Tell(), mfSize, STREAM_READ); + + filter.ImportGraphic (graphic, String (), mfStream); + + // debug code - write the stream to debug file /tmp/emf-stream.emf + EMFP_DEBUG(mfStream.Seek(0); + SvFileStream file( UniString::CreateFromAscii( "/tmp/emf-embedded-stream.emf" ), STREAM_WRITE | STREAM_TRUNC ); + + mfStream >> file; + file.Flush(); + file.Close()); + } + } + }; + + struct EMFPFont : public EMFPObject + { + sal_uInt32 version; + float emSize; + sal_uInt32 sizeUnit; + sal_Int32 fontFlags; + rtl::OUString family; + + void Read (SvMemoryStream &s) + { + sal_uInt32 header; + sal_uInt32 reserved; + sal_uInt32 length; + + s >> header >> emSize >> sizeUnit >> fontFlags >> reserved >> length; + + OSL_ASSERT( ( header >> 12 ) == 0xdbc01 ); + + EMFP_DEBUG (printf ("EMF+\tfont\nEMF+\theader: 0x%08x version: 0x%08x size: %f unit: 0x%08x\n", header >> 12, header & 0x1fff, emSize, sizeUnit)); + EMFP_DEBUG (printf ("EMF+\tflags: 0x%08x reserved: 0x%08x length: 0x%08x\n", fontFlags, reserved, length)); + + if( length > 0 && length < 0x4000 ) { + sal_Unicode *chars = (sal_Unicode *) alloca( sizeof( sal_Unicode ) * length ); + + for( sal_uInt32 i = 0; i < length; i++ ) + s >> chars[ i ]; + + family = ::rtl::OUString( chars, length ); + EMFP_DEBUG (printf ("EMF+\tfamily: %s\n", rtl::OUStringToOString( family, RTL_TEXTENCODING_UTF8).getStr())); + } + } + }; + + void ImplRenderer::ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, sal_uInt32 flags) + { + if (flags & 0x4000) { + sal_Int16 ix, iy, iw, ih; + + s >> ix >> iy >> iw >> ih; + + x = ix; + y = iy; + width = iw; + height = ih; + } else + s >> x >> y >> width >> height; + } + + void ImplRenderer::ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags) + { + if (flags & 0x4000) { + sal_Int16 ix, iy; + + s >> ix >> iy; + + x = ix; + y = iy; + } else + s >> x >> y; + } + + void ImplRenderer::MapToDevice (double& x, double& y) + { + // TODO: other untis + x = 100*nMmX*x/nPixX; + y = 100*nMmY*y/nPixY; + } + + ::basegfx::B2DPoint ImplRenderer::Map (::basegfx::B2DPoint& p) + { + return Map (p.getX (), p.getY ()); + } + + ::basegfx::B2DPoint ImplRenderer::Map (double ix, double iy) + { + double x, y; + + x = ix*aWorldTransform.eM11 + iy*aWorldTransform.eM21 + aWorldTransform.eDx; + y = ix*aWorldTransform.eM12 + iy*aWorldTransform.eM22 + aWorldTransform.eDy; + + MapToDevice (x, y); + + x -= nFrameLeft; + y -= nFrameTop; + + x *= aBaseTransform.eM11; + y *= aBaseTransform.eM22; + + return ::basegfx::B2DPoint (x, y); + } + + ::basegfx::B2DSize ImplRenderer::MapSize (double iwidth, double iheight) + { + double w, h; + + w = iwidth*aWorldTransform.eM11 + iheight*aWorldTransform.eM21; + h = iwidth*aWorldTransform.eM12 + iheight*aWorldTransform.eM22; + + MapToDevice (w, h); + + w *= aBaseTransform.eM11; + h *= aBaseTransform.eM22; + + return ::basegfx::B2DSize (w, h); + } + + ::basegfx::B2DRange ImplRenderer::MapRectangle (double ix, double iy, double iwidth, double iheight) + { + double x, y, w, h; + + x = ix*aWorldTransform.eM11 + iy*aWorldTransform.eM21 + aWorldTransform.eDx; + y = ix*aWorldTransform.eM12 + iy*aWorldTransform.eM22 + aWorldTransform.eDy; + w = iwidth*aWorldTransform.eM11 + iheight*aWorldTransform.eM21; + h = iwidth*aWorldTransform.eM12 + iheight*aWorldTransform.eM22; + + MapToDevice (x, y); + MapToDevice (w, h); + + x -= nFrameLeft; + y -= nFrameTop; + + x *= aBaseTransform.eM11; + y *= aBaseTransform.eM22; + w *= aBaseTransform.eM11; + h *= aBaseTransform.eM22; + + return ::basegfx::B2DRange (x, y, x + w, y + h); + } + +#define COLOR(x) \ + ::vcl::unotools::colorToDoubleSequence( ::Color (0xff - (x >> 24), \ + (x >> 16) & 0xff, \ + (x >> 8) & 0xff, \ + x & 0xff), \ + rCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace()); +#define SET_FILL_COLOR(x) \ + rState.fillColor = COLOR(x); +#define SET_LINE_COLOR(x) \ + rState.lineColor = COLOR(x); +#define SET_TEXT_COLOR(x) \ + rState.textColor = COLOR(x); + + void ImplRenderer::EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, + OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor) + { + ::basegfx::B2DPolyPolygon localPolygon (polygon); + + EMFP_DEBUG (printf ("EMF+\tfill polygon\n")); + + localPolygon.transform( rState.mapModeTransform ); + + ActionSharedPtr pPolyAction; + + if (isColor) { + EMFP_DEBUG (printf ("EMF+\t\tcolor fill\n")); + + rState.isFillColorSet = true; + rState.isLineColorSet = false; + SET_FILL_COLOR(brushIndexOrColor); + + pPolyAction = ActionSharedPtr ( internal::PolyPolyActionFactory::createPolyPolyAction( localPolygon, rParms.mrCanvas, rState ) ); + + } else { + rState.isFillColorSet = true; + // extract UseBrush + EMFPBrush* brush = (EMFPBrush*) aObjects [brushIndexOrColor]; + EMFP_DEBUG (printf ("EMF+\tbrush fill slot: %d (type: %d)\n", brushIndexOrColor, brush->GetType ())); + + // give up in case something wrong happened + if( !brush ) + return; + + rState.isFillColorSet = false; + rState.isLineColorSet = false; + + if (brush->type == 3 || brush->type == 4) { + + if (brush->type == 3 && !(brush->additionalFlags & 0x1)) + return; // we are unable to parse these brushes yet + + ::basegfx::B2DHomMatrix aTextureTransformation; + ::basegfx::B2DHomMatrix aWorldTransformation; + ::basegfx::B2DHomMatrix aBaseTransformation; + rendering::Texture aTexture; + + aWorldTransformation.set (0, 0, aWorldTransform.eM11); + aWorldTransformation.set (0, 1, aWorldTransform.eM21); + aWorldTransformation.set (0, 2, aWorldTransform.eDx); + aWorldTransformation.set (1, 0, aWorldTransform.eM12); + aWorldTransformation.set (1, 1, aWorldTransform.eM22); + aWorldTransformation.set (1, 2, aWorldTransform.eDy); + + aBaseTransformation.set (0, 0, aBaseTransform.eM11); + aBaseTransformation.set (0, 1, aBaseTransform.eM21); + aBaseTransformation.set (0, 2, aBaseTransform.eDx); + aBaseTransformation.set (1, 0, aBaseTransform.eM12); + aBaseTransformation.set (1, 1, aBaseTransform.eM22); + aBaseTransformation.set (1, 2, aBaseTransform.eDy); + + if (brush->type == 4) { + aTextureTransformation.scale (brush->areaWidth, brush->areaHeight); + aTextureTransformation.translate (brush->areaX, brush->areaY); + } else { + aTextureTransformation.translate (-0.5, -0.5); + aTextureTransformation.scale (brush->areaWidth, brush->areaHeight); + aTextureTransformation.translate (brush->areaX,brush->areaY); + } + + if (brush->hasTransformation) { + ::basegfx::B2DHomMatrix aTransformation; + + aTransformation.set (0, 0, brush->transformation.eM11); + aTransformation.set (0, 1, brush->transformation.eM21); + aTransformation.set (0, 2, brush->transformation.eDx); + aTransformation.set (1, 0, brush->transformation.eM12); + aTransformation.set (1, 1, brush->transformation.eM22); + aTransformation.set (1, 2, brush->transformation.eDy); + + aTextureTransformation *= aTransformation; + } + + aTextureTransformation *= aWorldTransformation; + aTextureTransformation.scale (100.0*nMmX/nPixX, 100.0*nMmY/nPixY); + aTextureTransformation.translate (-nFrameLeft, -nFrameTop); + aTextureTransformation *= rState.mapModeTransform; + aTextureTransformation *= aBaseTransformation; + + aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; + aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; + aTexture.Alpha = 1.0; + + basegfx::ODFGradientInfo aGradInfo; + rtl::OUString aGradientService; + + const uno::Sequence< double > aStartColor( + ::vcl::unotools::colorToDoubleSequence( brush->solidColor, + rParms.mrCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() ) ); + const uno::Sequence< double > aEndColor( + ::vcl::unotools::colorToDoubleSequence( brush->secondColor, + rParms.mrCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() ) ); + uno::Sequence< uno::Sequence < double > > aColors (2); + uno::Sequence< double > aStops (2); + + if (brush->blendPositions) { + EMFP_DEBUG (printf ("EMF+\t\tuse blend\n")); + aColors.realloc (brush->blendPoints); + aStops.realloc (brush->blendPoints); + int length = aStartColor.getLength (); + uno::Sequence< double > aColor (length); + + OSL_ASSERT (length == aEndColor.getLength()); + + for (int i = 0; i < brush->blendPoints; i++) { + aStops[i] = brush->blendPositions [i]; + + for (int j = 0; j < length; j++) { + if (brush->type == 4) { +// // gamma correction +// if (brush->additionalFlags & 0x80) +// aColor [j] = pow (aStartColor [j]*(1 - brush->blendFactors[i]) + aEndColor [j]*brush->blendFactors[i], 1/2.2); +// else + aColor [j] = aStartColor [j]*(1 - brush->blendFactors[i]) + aEndColor [j]*brush->blendFactors[i]; + } else + aColor [j] = aStartColor [j]*brush->blendFactors[i] + aEndColor [j]*(1 - brush->blendFactors[i]); + } + + aColors[i] = aColor; + } + } else if (brush->colorblendPositions) { + EMFP_DEBUG (printf ("EMF+\t\tuse color blend\n")); + aColors.realloc (brush->colorblendPoints); + aStops.realloc (brush->colorblendPoints); + + for (int i = 0; i < brush->colorblendPoints; i++) { + aStops[i] = brush->colorblendPositions [i]; + aColors[(brush->type == 4) ? i : brush->colorblendPoints - 1 - i] = ::vcl::unotools::colorToDoubleSequence( brush->colorblendColors [i], + rParms.mrCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() ); + } + } else { + aStops[0] = 0.0; + aStops[1] = 1.0; + + if (brush->type == 4) { + aColors[0] = aStartColor; + aColors[1] = aEndColor; + } else { + aColors[1] = aStartColor; + aColors[0] = aEndColor; + } + } + + EMFP_DEBUG (printf ("EMF+\t\tset gradient\n")); + basegfx::B2DRange aBoundsRectangle (0, 0, 1, 1); + if (brush->type == 4) { + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LinearGradient")); + basegfx::tools::createLinearODFGradientInfo( aGradInfo, + aBoundsRectangle, + aStops.getLength(), + 0, + 0 ); + + } else { + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EllipticalGradient")); + basegfx::tools::createEllipticalODFGradientInfo( aGradInfo, + aBoundsRectangle, + ::basegfx::B2DVector( 0, 0 ), + aStops.getLength(), + 0, + 0 ); + } + + uno::Reference< lang::XMultiServiceFactory > xFactory( + rParms.mrCanvas->getUNOCanvas()->getDevice()->getParametricPolyPolygonFactory() ); + + if( xFactory.is() ) { + uno::Sequence<uno::Any> args( 3 ); + beans::PropertyValue aProp; + aProp.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Colors")); + aProp.Value <<= aColors; + args[0] <<= aProp; + aProp.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Stops")); + aProp.Value <<= aStops; + args[1] <<= aProp; + aProp.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AspectRatio")); + aProp.Value <<= static_cast<sal_Int32>(1); + args[2] <<= aProp; + + aTexture.Gradient.set( + xFactory->createInstanceWithArguments( aGradientService, + args ), + uno::UNO_QUERY); + } + + ::basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform, + aTextureTransformation ); + + if( aTexture.Gradient.is() ) + pPolyAction = + ActionSharedPtr ( internal::PolyPolyActionFactory::createPolyPolyAction( localPolygon, + rParms.mrCanvas, + rState, + aTexture ) ); + } + } + + if( pPolyAction ) + { + EMFP_DEBUG (printf ("EMF+\t\tadd poly action\n")); + + maActions.push_back( + MtfAction( + pPolyAction, + rParms.mrCurrActionIndex ) ); + + rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; + } + } + + void ImplRenderer::processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags) + { + EMFP_DEBUG (sal_uInt32 objectLen); + sal_uInt32 index; + + EMFP_DEBUG (printf ("EMF+ Object slot: %hd flags: %hx\n", flags & 0xff, flags & 0xff00)); + + index = flags & 0xff; + if (aObjects [index] != NULL) { + delete aObjects [index]; + aObjects [index] = NULL; + } + + switch (flags & 0x7f00) { + case EmfPlusObjectTypeBrush: + { + EMFPBrush *brush; + aObjects [index] = brush = new EMFPBrush (); + brush->Read (rObjectStream, *this); + + break; + } + case EmfPlusObjectTypePen: + { + EMFPPen *pen; + aObjects [index] = pen = new EMFPPen (); + pen->Read (rObjectStream, *this, nHDPI, nVDPI); + + break; + } + case EmfPlusObjectTypePath: + sal_uInt32 header, pathFlags; + sal_Int32 points; + + rObjectStream >> header >> points >> pathFlags; + + EMFP_DEBUG (printf ("EMF+\tpath\n")); + EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", header, points, pathFlags)); + + EMFPPath *path; + aObjects [index] = path = new EMFPPath (points); + path->Read (rObjectStream, pathFlags, *this); + + break; + case EmfPlusObjectTypeRegion: { + EMFPRegion *region; + + aObjects [index] = region = new EMFPRegion (); + region->Read (rObjectStream); + + break; + } + case EmfPlusObjectTypeImage: + { + EMFPImage *image; + aObjects [index] = image = new EMFPImage (); + image->Read (rObjectStream); + + break; + } + case EmfPlusObjectTypeFont: + { + EMFPFont *font; + aObjects [index] = font = new EMFPFont (); + font->Read (rObjectStream); + + break; + } + default: + EMFP_DEBUG (printf ("EMF+\tObject unhandled flags: 0x%04x\n", flags & 0xff00)); + break; + } + } + + void ImplRenderer::processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, + OutDevState& rState, const CanvasSharedPtr& rCanvas ) + { + sal_uInt32 length = pAct->GetDataSize (); + SvMemoryStream rMF ((void*) pAct->GetData (), length, STREAM_READ); + + length -= 4; + + while (length > 0) { + sal_uInt16 type, flags; + sal_uInt32 size, dataSize; + sal_uInt32 next; + + rMF >> type >> flags >> size >> dataSize; + + next = rMF.Tell() + ( size - 12 ); + + EMFP_DEBUG (printf ("EMF+ record size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize)); + + if (type == EmfPlusRecordTypeObject && ((mbMultipart && (flags & 0x7fff) == (mMFlags & 0x7fff)) || (flags & 0x8000))) { + if (!mbMultipart) { + mbMultipart = true; + mMFlags = flags; + mMStream.Seek(0); + } + + // 1st 4 bytes are unknown + mMStream.Write (((const char *)rMF.GetData()) + rMF.Tell() + 4, dataSize - 4); + EMFP_DEBUG (printf ("EMF+ read next object part size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize)); + } else { + if (mbMultipart) { + EMFP_DEBUG (printf ("EMF+ multipart record flags: %04hx\n", mMFlags)); + mMStream.Seek (0); + processObjectRecord (mMStream, mMFlags); + } + mbMultipart = false; + } + + if (type != EmfPlusRecordTypeObject || !(flags & 0x8000)) + switch (type) { + case EmfPlusRecordTypeHeader: + sal_uInt32 header, version; + + rMF >> header >> version >> nHDPI >> nVDPI; + + EMFP_DEBUG (printf ("EMF+ Header\n")); + EMFP_DEBUG (printf ("EMF+\theader: 0x%08x version: %d horizontal DPI: %d vertical DPI: %d dual: %d\n", header, version, nHDPI, nVDPI, flags & 1)); + + break; + case EmfPlusRecordTypeEndOfFile: + EMFP_DEBUG (printf ("EMF+ EndOfFile\n")); + break; + case EmfPlusRecordTypeGetDC: + EMFP_DEBUG (printf ("EMF+ GetDC\n")); + EMFP_DEBUG (printf ("EMF+\talready used in svtools wmf/emf filter parser\n")); + break; + case EmfPlusRecordTypeObject: + processObjectRecord (rMF, flags); + break; + case EmfPlusRecordTypeFillPath: + { + sal_uInt32 index = flags & 0xff; + sal_uInt32 brushIndexOrColor; + + rMF >> brushIndexOrColor; + + EMFP_DEBUG (printf ("EMF+ FillPath slot: %d\n", index)); + + EMFPPlusFillPolygon (((EMFPPath*) aObjects [index])->GetPolygon (*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor); + } + break; + case EmfPlusRecordTypeFillRects: + { + EMFP_DEBUG (printf ("EMF+ FillRects\n")); + + sal_uInt32 brushIndexOrColor; + sal_Int32 rectangles; + ::basegfx::B2DPolygon polygon; + + rMF >> brushIndexOrColor >> rectangles; + + EMFP_DEBUG (printf ("EMF+\t%s: 0x%08x\n", (flags & 0x8000) ? "color" : "brush index", brushIndexOrColor)); + + for (int i=0; i < rectangles; i++) { + if (flags & 0x4000) { + /* 16bit integers */ + sal_Int16 x, y, width, height; + + rMF >> x >> y >> width >> height; + + polygon.append (Map (x, y)); + polygon.append (Map (x + width, y)); + polygon.append (Map (x + width, y + height)); + polygon.append (Map (x, y + height)); + + EMFP_DEBUG (printf ("EMF+\trectangle: %d,%d %dx%d\n", x, y, width, height)); + } else { + /* Single's */ + float x, y, width, height; + + rMF >> x >> y >> width >> height; + + polygon.append (Map (x, y)); + polygon.append (Map (x + width, y)); + polygon.append (Map (x + width, y + height)); + polygon.append (Map (x, y + height)); + + EMFP_DEBUG (printf ("EMF+\trectangle: %f,%f %fx%f\n", x, y, width, height)); + } + + ::basegfx::B2DPolyPolygon polyPolygon (polygon); + + EMFPPlusFillPolygon (polyPolygon, rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor); + } + break; + } + case EmfPlusRecordTypeFillPolygon: + { + EMFP_DEBUG (sal_uInt8 index = flags & 0xff); + sal_uInt32 brushIndexOrColor; + EMFP_DEBUG (sal_Int32 brushIndex); + sal_Int32 points; + EMFP_DEBUG (sal_uInt32 color); + EMFP_DEBUG (sal_uInt16 transparency = 0); + + rMF >> brushIndexOrColor; + rMF >> points; + + EMFP_DEBUG (printf ("EMF+ FillPolygon in slot: %d points: %d\n", index, points)); + EMFP_DEBUG (printf ("EMF+\twith solid color (ARGB): 0x%08X\n", color)); + + EMFPPath path (points, true); + path.Read (rMF, flags, *this); + + + EMFPPlusFillPolygon (path.GetPolygon (*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor); + + break; + } + case EmfPlusRecordTypeDrawLines: + { + sal_uInt32 index = flags & 0xff; + sal_uInt32 points; + + rMF >> points; + + EMFP_DEBUG (printf ("EMF+ DrawLines in slot: %d points: %d\n", index, points)); + + EMFPPath path (points, true); + path.Read (rMF, flags, *this); + + EMFPPen* pen = (EMFPPen*) aObjects [index]; + + rState.isFillColorSet = false; + rState.isLineColorSet = true; + rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (), + rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace() ); + ::basegfx::B2DPolyPolygon& polygon (path.GetPolygon (*this)); + + polygon.transform( rState.mapModeTransform ); + + rendering::StrokeAttributes aStrokeAttributes; + + pen->SetStrokeAttributes (aStrokeAttributes, *this, rState); + + ActionSharedPtr pPolyAction( + internal::PolyPolyActionFactory::createPolyPolyAction( + polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) ); + + if( pPolyAction ) + { + maActions.push_back( + MtfAction( + pPolyAction, + rFactoryParms.mrCurrActionIndex ) ); + + rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; + } + + break; + } + case EmfPlusRecordTypeDrawPath: + { + sal_uInt32 penIndex; + + rMF >> penIndex; + + EMFP_DEBUG (printf ("EMF+ DrawPath\n")); + EMFP_DEBUG (printf ("EMF+\tpen: %d\n", penIndex)); + + EMFPPath* path = (EMFPPath*) aObjects [flags & 0xff]; + EMFPPen* pen = (EMFPPen*) aObjects [penIndex]; + + rState.isFillColorSet = false; + rState.isLineColorSet = true; + rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (), + rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace()); + ::basegfx::B2DPolyPolygon& polygon (path->GetPolygon (*this)); + + polygon.transform( rState.mapModeTransform ); + rendering::StrokeAttributes aStrokeAttributes; + + pen->SetStrokeAttributes (aStrokeAttributes, *this, rState); + + ActionSharedPtr pPolyAction( + internal::PolyPolyActionFactory::createPolyPolyAction( + polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) ); + + if( pPolyAction ) + { + maActions.push_back( + MtfAction( + pPolyAction, + rFactoryParms.mrCurrActionIndex ) ); + + rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; + } + break; + } + case EmfPlusRecordTypeDrawImagePoints: + { + sal_uInt32 attrIndex; + sal_Int32 sourceUnit; + + rMF >> attrIndex >> sourceUnit; + + EMFP_DEBUG (printf ("EMF+ DrawImagePoints attributes index: %d source unit: %d\n", attrIndex, sourceUnit)); + EMFP_DEBUG (printf ("EMF+\tTODO: use image attributes\n")); + + if (sourceUnit == 2 && aObjects [flags & 0xff]) { // we handle only GraphicsUnit.Pixel now + EMFPImage& image = *(EMFPImage *) aObjects [flags & 0xff]; + float sx, sy, sw, sh; + sal_Int32 unknown; + + ReadRectangle (rMF, sx, sy, sw, sh); + + rMF >> unknown; + + EMFP_DEBUG (printf ("EMF+ DrawImagePoints source rectangle: %f,%f %fx%f unknown: 0x%08x\n", sx, sy, sw, sh, unknown)); + + if (unknown == 3) { // it probably means number of points defining destination rectangle + float x1, y1, x2, y2, x3, y3; + + ReadPoint (rMF, x1, y1); + ReadPoint (rMF, x2, y2); + ReadPoint (rMF, x3, y3); + + BitmapEx aBmp( image.graphic.GetBitmapEx () ); + const Rectangle aCropRect (::vcl::unotools::pointFromB2DPoint (Map (sx, sy)), + ::vcl::unotools::sizeFromB2DSize (MapSize(sw, sh))); + aBmp.Crop( aCropRect ); + + + ActionSharedPtr pBmpAction ( + internal::BitmapActionFactory::createBitmapAction ( + aBmp, + rState.mapModeTransform * Map (x1, y1), + rState.mapModeTransform * MapSize(x2 - x1, y3 - y1), + rCanvas, + rState)); + + if( pBmpAction ) { + maActions.push_back( MtfAction( pBmpAction, + rFactoryParms.mrCurrActionIndex ) ); + + rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount()-1; + } + } else { + EMFP_DEBUG (printf ("EMF+ DrawImagePoints TODO (fixme)\n")); + } + } + break; + } + case EmfPlusRecordTypeDrawString: + EMFP_DEBUG (printf ("EMF+ DrawString\n")); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSetPageTransform: + rMF >> fPageScale; + + EMFP_DEBUG (printf ("EMF+ SetPageTransform\n")); + EMFP_DEBUG (printf ("EMF+\tscale: %f unit: %d\n", fPageScale, flags)); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSetRenderingOrigin: + rMF >> nOriginX >> nOriginY; + EMFP_DEBUG (printf ("EMF+ SetRenderingOrigin\n")); + EMFP_DEBUG (printf ("EMF+\torigin [x,y]: %d,%d\n", nOriginX, nOriginY)); + break; + case EmfPlusRecordTypeSetTextRenderingHint: + EMFP_DEBUG (printf ("EMF+ SetTextRenderingHint\n")); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSetAntiAliasMode: + EMFP_DEBUG (printf ("EMF+ SetAntiAliasMode\n")); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSetInterpolationMode: + EMFP_DEBUG (printf ("EMF+ InterpolationMode\n")); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSetPixelOffsetMode: + EMFP_DEBUG (printf ("EMF+ SetPixelOffsetMode\n")); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSetCompositingQuality: + EMFP_DEBUG (printf ("EMF+ SetCompositingQuality\n")); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSave: + EMFP_DEBUG (printf ("EMF+ Save\n")); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + break; + case EmfPlusRecordTypeSetWorldTransform: { + EMFP_DEBUG (printf ("EMF+ SetWorldTransform\n")); + XForm transform; + rMF >> transform; + aWorldTransform.Set (transform); + EMFP_DEBUG (printf ("EMF+\tm11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n", + aWorldTransform.eM11, aWorldTransform.eM12, + aWorldTransform.eM21, aWorldTransform.eM22, + aWorldTransform.eDx, aWorldTransform.eDy)); + break; + } + case EmfPlusRecordTypeResetWorldTransform: + EMFP_DEBUG (printf ("EMF+ ResetWorldTransform\n")); + aWorldTransform.SetIdentity (); + break; + case EmfPlusRecordTypeSetClipPath: + { + EMFP_DEBUG (printf ("EMF+ SetClipPath\n")); + EMFP_DEBUG (printf ("EMF+\tpath in slot: %d\n", flags & 0xff)); + + EMFPPath& path = *(EMFPPath*) aObjects [flags & 0xff]; + ::basegfx::B2DPolyPolygon& clipPoly (path.GetPolygon (*this)); + + clipPoly.transform (rState.mapModeTransform); + updateClipping (clipPoly, rFactoryParms, false); + + break; + } + case EmfPlusRecordTypeSetClipRegion: { + EMFP_DEBUG (printf ("EMF+ SetClipRegion\n")); + EMFP_DEBUG (printf ("EMF+\tregion in slot: %d combine mode: %d\n", flags & 0xff, (flags & 0xff00) >> 8)); + EMFPRegion& region = *(EMFPRegion*) aObjects [flags & 0xff]; + + // reset clip + if (region.parts == 0 && region.initialState == EmfPlusRegionInitialStateInfinite) { + updateClipping (::basegfx::B2DPolyPolygon (), rFactoryParms, false); + } else { + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + } + break; + } + case EmfPlusRecordTypeDrawDriverString: { + EMFP_DEBUG (printf ("EMF+ DrawDriverString, flags: 0x%04x\n", flags)); + sal_uInt32 brushIndexOrColor; + sal_uInt32 optionFlags; + sal_uInt32 hasMatrix; + sal_uInt32 glyphsCount; + + rMF >> brushIndexOrColor >> optionFlags >> hasMatrix >> glyphsCount; + + EMFP_DEBUG (printf ("EMF+\t%s: 0x%08x\n", (flags & 0x8000) ? "color" : "brush index", brushIndexOrColor)); + EMFP_DEBUG (printf ("EMF+\toption flags: 0x%08x\n", optionFlags)); + EMFP_DEBUG (printf ("EMF+\thas matrix: %d\n", hasMatrix)); + EMFP_DEBUG (printf ("EMF+\tglyphs: %d\n", glyphsCount)); + + if( ( optionFlags & 1 ) && glyphsCount > 0 ) { + sal_uInt16 *chars = new sal_uInt16[glyphsCount]; + float *charsPosX = new float[glyphsCount]; + float *charsPosY = new float[glyphsCount]; + + for( sal_uInt32 i=0; i<glyphsCount; i++) { + rMF >> chars[i]; + EMFP_DEBUG (printf ("EMF+\tglyph[%d]: 0x%04x\n", + i, chars[i])); + } + for( sal_uInt32 i=0; i<glyphsCount; i++) { + rMF >> charsPosX[i] >> charsPosY[i]; + EMFP_DEBUG (printf ("EMF+\tglyphPosition[%d]: %f, %f\n", i, charsPosX[i], charsPosY[i])); + } + + XForm transform; + if( hasMatrix ) { + rMF >> transform; + EMFP_DEBUG (printf ("EMF+\tmatrix:: %f, %f, %f, %f, %f, %f\n", transform.eM11, transform.eM12, transform.eM21, transform.eM22, transform.eDx, transform.eDy)); + } + + // create and add the text action + XubString text( chars, glyphsCount ); + + EMFPFont *font = (EMFPFont*) aObjects[ flags & 0xff ]; + + rendering::FontRequest aFontRequest; + aFontRequest.FontDescription.FamilyName = font->family; + aFontRequest.CellSize = (rState.mapModeTransform*MapSize( font->emSize, 0 )).getX(); + rState.xFont = rFactoryParms.mrCanvas->getUNOCanvas()->createFont( aFontRequest, + uno::Sequence< beans::PropertyValue >(), + geometry::Matrix2D() ); + if( flags & 0x8000 ) + SET_TEXT_COLOR(brushIndexOrColor); + + ActionSharedPtr pTextAction( + TextActionFactory::createTextAction( + ::vcl::unotools::pointFromB2DPoint ( Map( charsPosX[0], charsPosY[0] ) ), + ::Size(), + ::Color(), + ::Size(), + ::Color(), + text, + 0, + glyphsCount, + NULL, + rFactoryParms.mrVDev, + rFactoryParms.mrCanvas, + rState, + rFactoryParms.mrParms, + false ) ); + + if( pTextAction ) + { + EMFP_DEBUG (printf ("EMF+\t\tadd text action\n")); + + maActions.push_back( + MtfAction( + pTextAction, + rFactoryParms.mrCurrActionIndex ) ); + + rFactoryParms.mrCurrActionIndex += pTextAction->getActionCount()-1; + } + + delete[] chars; + delete[] charsPosX; + delete[] charsPosY; + } else { + EMFP_DEBUG (printf ("EMF+\tTODO: fonts (non-unicode glyphs chars)\n")); + } + + break; + } + default: + EMFP_DEBUG (printf ("EMF+ unhandled record type: %d\n", type)); + EMFP_DEBUG (printf ("EMF+\tTODO\n")); + } + + rMF.Seek (next); + + length -= size; + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index d0382997a9db..2ef752b7024a 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,7 @@ #include <tools/diagnose_ex.h> #include <canvas/verbosetrace.hxx> #include <osl/mutex.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <rtl/logfile.hxx> #include <comphelper/sequence.hxx> @@ -94,6 +95,8 @@ #include "outdevstate.hxx" #include <basegfx/matrix/b2dhommatrixtools.hxx> +#define EMFP_DEBUG(x) +//#define EMFP_DEBUG(x) x using namespace ::com::sun::star; @@ -679,7 +682,7 @@ namespace cppcanvas // map odf to svg gradient orientation - x // instead of y direction aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aRot90; - aGradientService = rtl::OUString::createFromAscii("LinearGradient"); + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LinearGradient")); break; case GRADIENT_AXIAL: @@ -712,7 +715,7 @@ namespace cppcanvas aShift.translate(-0.5,0); aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aShift; - aGradientService = rtl::OUString::createFromAscii("LinearGradient"); + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LinearGradient")); break; } @@ -722,7 +725,7 @@ namespace cppcanvas aOffset, nSteps, fBorder); - aGradientService = rtl::OUString::createFromAscii("EllipticalGradient"); + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EllipticalGradient")); break; case GRADIENT_ELLIPTICAL: @@ -732,7 +735,7 @@ namespace cppcanvas nSteps, fBorder, fRotation); - aGradientService = rtl::OUString::createFromAscii("EllipticalGradient"); + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EllipticalGradient")); break; case GRADIENT_SQUARE: @@ -742,7 +745,7 @@ namespace cppcanvas nSteps, fBorder, fRotation); - aGradientService = rtl::OUString::createFromAscii("RectangularGradient"); + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RectangularGradient")); break; case GRADIENT_RECT: @@ -752,7 +755,7 @@ namespace cppcanvas nSteps, fBorder, fRotation); - aGradientService = rtl::OUString::createFromAscii("RectangularGradient"); + aGradientService = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RectangularGradient")); break; default: @@ -775,13 +778,13 @@ namespace cppcanvas uno::Sequence<uno::Any> args(3); beans::PropertyValue aProp; - aProp.Name = rtl::OUString::createFromAscii("Colors"); + aProp.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Colors")); aProp.Value <<= aColors; args[0] <<= aProp; - aProp.Name = rtl::OUString::createFromAscii("Stops"); + aProp.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Stops")); aProp.Value <<= aStops; args[1] <<= aProp; - aProp.Name = rtl::OUString::createFromAscii("AspectRatio"); + aProp.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AspectRatio")); aProp.Value <<= aGradInfo.mfAspectRatio; args[2] <<= aProp; @@ -1074,7 +1077,6 @@ namespace cppcanvas aStrikeoutText += pChars[0]; - sal_Int32 nStartPos = 0; xub_StrLen nLen = aStrikeoutText.Len(); if( nLen ) @@ -1093,6 +1095,8 @@ namespace cppcanvas pStrikeoutCharWidths[ i ] += pStrikeoutCharWidths[ i-1 ]; } + sal_Int32 nStartPos = 0; + pStrikeoutTextAction = TextActionFactory::createTextAction( rStartPoint, @@ -1829,6 +1833,33 @@ namespace cppcanvas } } } + // Handle drawing layer fills + else if( pAct->GetComment().Equals( "EMF_PLUS" ) ) { + static int count = -1, limit = 0x7fffffff; + if (count == -1) { + count = 0; + if (char *env = getenv ("EMF_PLUS_LIMIT")) { + limit = atoi (env); + EMFP_DEBUG (printf ("EMF+ records limit: %d\n", limit)); + } + } + EMFP_DEBUG (printf ("EMF+ passed to canvas mtf renderer, size: %d\n", pAct->GetDataSize ())); + if (count < limit) + processEMFPlus( pAct, rFactoryParms, getState( rStates ), rCanvas ); + count ++; + } else if( pAct->GetComment().Equals( "EMF_PLUS_HEADER_INFO" ) ) { + EMFP_DEBUG (printf ("EMF+ passed to canvas mtf renderer - header info, size: %d\n", pAct->GetDataSize ())); + + SvMemoryStream rMF ((void*) pAct->GetData (), pAct->GetDataSize (), STREAM_READ); + + rMF >> nFrameLeft >> nFrameTop >> nFrameRight >> nFrameBottom; + EMFP_DEBUG (printf ("EMF+ picture frame: %d,%d - %d,%d\n", nFrameLeft, nFrameTop, nFrameRight, nFrameBottom)); + rMF >> nPixX >> nPixY >> nMmX >> nMmY; + EMFP_DEBUG (printf ("EMF+ ref device pixel size: %dx%d mm size: %dx%d\n", nPixX, nPixY, nMmX, nMmY)); + + rMF >> aBaseTransform; + //aWorldTransform.Set (aBaseTransform); + } } break; @@ -2004,8 +2035,8 @@ namespace cppcanvas ::vcl::unotools::b2DPointFromPoint( rRect.TopLeft() ), ::vcl::unotools::b2DPointFromPoint( rRect.BottomRight() ) + ::basegfx::B2DPoint(1,1) ), - static_cast<MetaRoundRectAction*>(pCurrAct)->GetHorzRound(), - static_cast<MetaRoundRectAction*>(pCurrAct)->GetVertRound() )); + ( (double) static_cast<MetaRoundRectAction*>(pCurrAct)->GetHorzRound() ) / rRect.GetWidth(), + ( (double) static_cast<MetaRoundRectAction*>(pCurrAct)->GetVertRound() ) / rRect.GetHeight() ) ); aPoly.transform( getState( rStates ).mapModeTransform ); createFillAndStroke( aPoly, @@ -2681,8 +2712,7 @@ namespace cppcanvas break; default: - OSL_ENSURE( false, - "Unknown meta action type encountered" ); + OSL_FAIL( "Unknown meta action type encountered" ); break; } @@ -2709,7 +2739,7 @@ namespace cppcanvas { } - bool result() + bool result() const { return mbRet; } @@ -2744,7 +2774,7 @@ namespace cppcanvas { } - bool result() + bool result() const { return true; // nothing can fail here } @@ -3014,7 +3044,7 @@ namespace cppcanvas if( rParams.maFontName.is_initialized() || rParams.maFontWeight.is_initialized() || rParams.maFontLetterForm.is_initialized() || - rParams.maFontUnderline.is_initialized() || + rParams.maFontUnderline.is_initialized() || rParams.maFontProportion.is_initialized() ) { ::cppcanvas::internal::OutDevState& rState = getState( aStateStack ); @@ -3024,6 +3054,10 @@ namespace cppcanvas aParms ); } + /* EMF+ */ + memset (aObjects, 0, sizeof (aObjects)); + mbMultipart = false; + createActions( const_cast<GDIMetaFile&>(rMtf), // HACK(Q2): // we're // changing @@ -3129,8 +3163,7 @@ namespace cppcanvas } catch( uno::Exception& ) { - OSL_ENSURE( false, - rtl::OUStringToOString( + OSL_FAIL( rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -3191,8 +3224,7 @@ namespace cppcanvas } catch( uno::Exception& ) { - OSL_ENSURE( false, - rtl::OUStringToOString( + OSL_FAIL( rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -3201,3 +3233,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/lineaction.cxx b/cppcanvas/source/mtfrenderer/lineaction.cxx index a779e45ab64a..7639fe352511 100644 --- a/cppcanvas/source/mtfrenderer/lineaction.cxx +++ b/cppcanvas/source/mtfrenderer/lineaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -165,3 +166,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/lineaction.hxx b/cppcanvas/source/mtfrenderer/lineaction.hxx index 12d308557837..810c8cb4fe03 100644 --- a/cppcanvas/source/mtfrenderer/lineaction.hxx +++ b/cppcanvas/source/mtfrenderer/lineaction.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_LINEACTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index 9860f1d1cd7d..4810268b7ca7 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -691,3 +692,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/mtftools.hxx b/cppcanvas/source/mtfrenderer/mtftools.hxx index 3bf0fe31e344..8d466f1d9e7e 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.hxx +++ b/cppcanvas/source/mtfrenderer/mtftools.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -268,3 +269,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_RENDERER_MTFTOOLS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/outdevstate.hxx b/cppcanvas/source/mtfrenderer/outdevstate.hxx index 37930b2e78b4..b0e79d2684dc 100644 --- a/cppcanvas/source/mtfrenderer/outdevstate.hxx +++ b/cppcanvas/source/mtfrenderer/outdevstate.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,25 +32,13 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> -#ifndef _COM_SUN_STAR_RENDERING_STRINGCONTEXT_HPP__ #include <com/sun/star/rendering/StringContext.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__ #include <com/sun/star/rendering/RenderState.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP__ #include <com/sun/star/rendering/XPolyPolygon2D.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XCANVASFONT_HPP__ #include <com/sun/star/rendering/XCanvasFont.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_TEXTDIRECTION_HPP__ #include <com/sun/star/rendering/TextDirection.hpp> -#endif #include <basegfx/matrix/b2dhommatrix.hxx> -#ifndef _BGFX_POLYGON_B2DPOLYPOLGON_HXX #include <basegfx/polygon/b2dpolypolygon.hxx> -#endif #include <vcl/fntstyle.hxx> #include <vcl/vclenum.hxx> #include <vcl/outdev.hxx> @@ -143,3 +132,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_OUTDEVSTATE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/pointaction.cxx b/cppcanvas/source/mtfrenderer/pointaction.cxx index dbdc632af11c..8a2edbdf35ba 100644 --- a/cppcanvas/source/mtfrenderer/pointaction.cxx +++ b/cppcanvas/source/mtfrenderer/pointaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -185,3 +186,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/pointaction.hxx b/cppcanvas/source/mtfrenderer/pointaction.hxx index c45b71a7dee6..b17b1eea5a43 100644 --- a/cppcanvas/source/mtfrenderer/pointaction.hxx +++ b/cppcanvas/source/mtfrenderer/pointaction.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_POINTACTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.cxx b/cppcanvas/source/mtfrenderer/polypolyaction.cxx index 13be4652acd8..5b04576d46a8 100644 --- a/cppcanvas/source/mtfrenderer/polypolyaction.cxx +++ b/cppcanvas/source/mtfrenderer/polypolyaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -168,20 +169,6 @@ namespace cppcanvas rendering::RenderState aLocalState( maState ); ::canvas::tools::prependToRenderState(aLocalState, rTransformation); -#ifdef SPECIAL_DEBUG - aLocalState.Clip.clear(); - aLocalState.DeviceColor = - ::vcl::unotools::colorToDoubleSequence( mpCanvas->getUNOCanvas()->getDevice(), - ::Color( 0x80FF0000 ) ); - - if( maState.Clip.is() ) - mpCanvas->getUNOCanvas()->fillPolyPolygon( maState.Clip, - mpCanvas->getViewState(), - aLocalState ); - - aLocalState.DeviceColor = maState.DeviceColor; -#endif - if( maFillColor.getLength() ) { // TODO(E3): Use DBO's finalizer here, @@ -536,3 +523,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.hxx b/cppcanvas/source/mtfrenderer/polypolyaction.hxx index 4ae85a2c3d5d..a38ba92a8752 100644 --- a/cppcanvas/source/mtfrenderer/polypolyaction.hxx +++ b/cppcanvas/source/mtfrenderer/polypolyaction.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,3 +100,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_POLYPOLYACTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index 30aecef24206..a80306df3e05 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -727,8 +728,7 @@ namespace cppcanvas bool TextAction::render( const ::basegfx::B2DHomMatrix& rTransformation, const Subset& /*rSubset*/ ) const { - OSL_ENSURE( false, - "TextAction::render(): Subset not supported by this object" ); + OSL_FAIL( "TextAction::render(): Subset not supported by this object" ); // TODO(P1): Retrieve necessary font metric info for // TextAction from XCanvas. Currently, the @@ -759,8 +759,7 @@ namespace cppcanvas ::basegfx::B2DRange TextAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation, const Subset& /*rSubset*/ ) const { - OSL_ENSURE( false, - "TextAction::getBounds(): Subset not supported by this object" ); + OSL_FAIL( "TextAction::getBounds(): Subset not supported by this object" ); // TODO(P1): Retrieve necessary font metric info for // TextAction from XCanvas. Currently, the @@ -965,8 +964,7 @@ namespace cppcanvas bool EffectTextAction::render( const ::basegfx::B2DHomMatrix& rTransformation, const Subset& /*rSubset*/ ) const { - OSL_ENSURE( false, - "EffectTextAction::render(): Subset not supported by this object" ); + OSL_FAIL( "EffectTextAction::render(): Subset not supported by this object" ); // TODO(P1): Retrieve necessary font metric info for // TextAction from XCanvas. Currently, the @@ -1002,8 +1000,7 @@ namespace cppcanvas ::basegfx::B2DRange EffectTextAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation, const Subset& /*rSubset*/ ) const { - OSL_ENSURE( false, - "EffectTextAction::getBounds(): Subset not supported by this object" ); + OSL_FAIL( "EffectTextAction::getBounds(): Subset not supported by this object" ); // TODO(P1): Retrieve necessary font metric info for // TextAction from XCanvas. Currently, the @@ -1121,20 +1118,6 @@ namespace cppcanvas rendering::RenderState aLocalState( maState ); ::canvas::tools::prependToRenderState(aLocalState, rTransformation); -#ifdef SPECIAL_DEBUG - aLocalState.Clip.clear(); - aLocalState.DeviceColor = - ::vcl::unotools::colorToDoubleSequence( mpCanvas->getUNOCanvas()->getDevice(), - ::Color( 0x80FF0000 ) ); - - if( maState.Clip.is() ) - mpCanvas->getUNOCanvas()->drawPolyPolygon( maState.Clip, - mpCanvas->getViewState(), - aLocalState ); - - aLocalState.DeviceColor = maState.DeviceColor; -#endif - mpCanvas->getUNOCanvas()->drawTextLayout( mxTextLayout, mpCanvas->getViewState(), aLocalState ); @@ -1936,8 +1919,7 @@ namespace cppcanvas ::basegfx::B2DRange OutlineAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation, const Subset& /*rSubset*/ ) const { - OSL_ENSURE( false, - "OutlineAction::getBounds(): Subset not yet supported by this object" ); + OSL_FAIL( "OutlineAction::getBounds(): Subset not yet supported by this object" ); return getBounds( rTransformation ); } @@ -2313,3 +2295,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/textaction.hxx b/cppcanvas/source/mtfrenderer/textaction.hxx index 43aab762f635..390752d23ce1 100644 --- a/cppcanvas/source/mtfrenderer/textaction.hxx +++ b/cppcanvas/source/mtfrenderer/textaction.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -100,3 +101,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_TEXTACTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index 7255df14cd47..482b2a430dc1 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -298,8 +299,7 @@ namespace cppcanvas nRotate, nShearX ) ) { - OSL_ENSURE( false, - "TransparencyGroupAction::render(): non-decomposable transformation" ); + OSL_FAIL( "TransparencyGroupAction::render(): non-decomposable transformation" ); return false; } @@ -403,8 +403,7 @@ namespace cppcanvas break; default: - OSL_ENSURE( false, - "Unknown meta action type encountered" ); + OSL_FAIL( "Unknown meta action type encountered" ); break; } } @@ -462,21 +461,6 @@ namespace cppcanvas rendering::RenderState aLocalState( maState ); ::canvas::tools::setRenderStateTransform(aLocalState, aTransform); -#ifdef SPECIAL_DEBUG - aLocalState.Clip.clear(); - aLocalState.DeviceColor = - ::vcl::unotools::colorToDoubleSequence( - ::Color( 0x80FF0000 ), - mpCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() ); - - if( maState.Clip.is() ) - mpCanvas->getUNOCanvas()->fillPolyPolygon( maState.Clip, - mpCanvas->getViewState(), - aLocalState ); - - aLocalState.DeviceColor = maState.DeviceColor; -#endif - if( ::rtl::math::approxEqual(mnAlpha, 1.0) ) { // no further alpha changes necessary -> draw directly @@ -550,7 +534,7 @@ namespace cppcanvas sal_Int32 TransparencyGroupAction::getActionCount() const { - return mpGroupMtf.get() ? mpGroupMtf->GetActionCount() : 0; + return mpGroupMtf.get() ? mpGroupMtf->GetActionSize() : 0; } } @@ -591,3 +575,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx index 8384ea2818be..dd629011cfa2 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -138,3 +139,5 @@ namespace cppcanvas } #endif /*_CPPCANVAS_TRANSPARENCYGROUPACTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/tools/canvasgraphichelper.cxx b/cppcanvas/source/tools/canvasgraphichelper.cxx index 1e62b816e1d4..4888960c0d96 100644 --- a/cppcanvas/source/tools/canvasgraphichelper.cxx +++ b/cppcanvas/source/tools/canvasgraphichelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -149,3 +150,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/tools/tools.cxx b/cppcanvas/source/tools/tools.cxx index 04e6d7f07458..bea26d8e55e8 100644 --- a/cppcanvas/source/tools/tools.cxx +++ b/cppcanvas/source/tools/tools.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -60,3 +61,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/uno/exports.dxp b/cppcanvas/source/uno/exports.dxp new file mode 100644 index 000000000000..f0e1c69934bc --- /dev/null +++ b/cppcanvas/source/uno/exports.dxp @@ -0,0 +1,2 @@ +component_getImplementationEnvironment +component_getFactory diff --git a/cppcanvas/source/uno/exports.map b/cppcanvas/source/uno/exports.map new file mode 100644 index 000000000000..a488d5d06a43 --- /dev/null +++ b/cppcanvas/source/uno/exports.map @@ -0,0 +1,8 @@ +UDK_3_0_0 { + global: +_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions + component_getImplementationEnvironment; + component_getFactory; + local: + *; +}; diff --git a/cppcanvas/source/uno/makefile.mk b/cppcanvas/source/uno/makefile.mk new file mode 100644 index 000000000000..5e06f4f1c839 --- /dev/null +++ b/cppcanvas/source/uno/makefile.mk @@ -0,0 +1,70 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2010 Novell, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=cppcanvas +TARGET=mtfrenderer +ENABLE_EXCEPTIONS=TRUE + + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Common ---------------------------------------------------------- + +.IF "$(verbose)"!="" || "$(VERBOSE)"!="" +CDEFS+= -DVERBOSE +.ENDIF + +SLOFILES = $(SLO)$/uno_mtfrenderer.obj + +SHL1TARGET=$(TARGET).uno + +SHL1STDLIBS= $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) $(COMPHELPERLIB) $(CPPCANVASLIB) $(BASEGFXLIB) + +SHL1IMPLIB=i$(TARGET) +SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +SHL1VERSIONMAP=exports.map + +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +# ========================================================================== + +.INCLUDE : target.mk + +$(MISC)/mtfrenderer.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + mtfrenderer.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt mtfrenderer.component + +ALLTAR : $(MISC)/mtfrenderer.component diff --git a/cppcanvas/source/uno/mtfrenderer.component b/cppcanvas/source/uno/mtfrenderer.component new file mode 100644 index 000000000000..32284e46cd74 --- /dev/null +++ b/cppcanvas/source/uno/mtfrenderer.component @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.rendering.MtfRenderer"> + <service name="com.sun.star.rendering.MtfRenderer"/> + </implementation> +</component> diff --git a/cppcanvas/source/uno/uno_mtfrenderer.cxx b/cppcanvas/source/uno/uno_mtfrenderer.cxx new file mode 100644 index 000000000000..2c525140c1da --- /dev/null +++ b/cppcanvas/source/uno/uno_mtfrenderer.cxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "uno_mtfrenderer.hxx" +#include <cppcanvas/vclfactory.hxx> +#include <comphelper/servicedecl.hxx> +#include <cppuhelper/factory.hxx> + +using namespace ::com::sun::star; + +void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& /*rMtf*/) throw (uno::RuntimeException) +{ + // printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n"); +} + +void MtfRenderer::draw (double fScaleX, double fScaleY) throw (uno::RuntimeException) +{ + if (mpMetafile && mxCanvas.get()) { + cppcanvas::VCLFactory& factory = cppcanvas::VCLFactory::getInstance(); + cppcanvas::BitmapCanvasSharedPtr canvas = factory.createCanvas (mxCanvas); + cppcanvas::RendererSharedPtr renderer = factory.createRenderer (canvas, *mpMetafile, cppcanvas::Renderer::Parameters ()); + ::basegfx::B2DHomMatrix aMatrix; + aMatrix.scale( fScaleX, fScaleY ); + canvas->setTransformation( aMatrix ); + renderer->draw (); + } +} + +void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle, const uno::Any& aAny) throw (uno::RuntimeException) +{ + if (nHandle == 0) { + mpMetafile = (GDIMetaFile*) *reinterpret_cast<const sal_Int64*>(aAny.getValue()); + } +} + +MtfRenderer::MtfRenderer (uno::Sequence<uno::Any> const& aArgs, uno::Reference<uno::XComponentContext> const&) : MtfRendererBase (m_aMutex), mpMetafile (NULL) +{ + if( aArgs.getLength() == 1 ) { + aArgs[0] >>= mxCanvas; + } +} + +namespace sdecl = comphelper::service_decl; +#if defined (__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ <= 3) + sdecl::class_<MtfRenderer, sdecl::with_args<true> > serviceImpl; + const sdecl::ServiceDecl MtfRendererDecl( + serviceImpl, +#else + const sdecl::ServiceDecl MtfRendererDecl( + sdecl::class_<MtfRenderer, sdecl::with_args<true> >(), +#endif + "com.sun.star.comp.rendering.MtfRenderer", + "com.sun.star.rendering.MtfRenderer" ); + +// The C shared lib entry points +COMPHELPER_SERVICEDECL_EXPORTS1(MtfRendererDecl) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/uno/uno_mtfrenderer.hxx b/cppcanvas/source/uno/uno_mtfrenderer.hxx new file mode 100644 index 000000000000..e462c6732cc4 --- /dev/null +++ b/cppcanvas/source/uno/uno_mtfrenderer.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _UNO_MTF_RENDERER_HXX_ +#define _UNO_MTF_RENDERER_HXX_ +#include <com/sun/star/rendering/MtfRenderer.hpp> +#include <com/sun/star/rendering/XBitmapCanvas.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/basemutex.hxx> +#include <vcl/gdimtf.hxx> + +typedef cppu::WeakComponentImplHelper2<com::sun::star::rendering::XMtfRenderer, com::sun::star::beans::XFastPropertySet> MtfRendererBase; + +class MtfRenderer : private cppu::BaseMutex, public MtfRendererBase +{ +public: + MtfRenderer (com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args, + com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&); + + // XMtfRenderer iface + void SAL_CALL setMetafile (const ::com::sun::star::uno::Sequence< sal_Int8 >& rMtf) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL draw (double fScaleX, double fScaleY) throw (::com::sun::star::uno::RuntimeException); + + // XFastPropertySet + // setFastPropertyValue (0, GDIMetaFile*) is used to speedup the rendering + virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 /*nHandle*/) throw (::com::sun::star::uno::RuntimeException) { return ::com::sun::star::uno::Any(); } + virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any&) throw (::com::sun::star::uno::RuntimeException); + +private: + GDIMetaFile* mpMetafile; + com::sun::star::uno::Reference<com::sun::star::rendering::XBitmapCanvas> mxCanvas; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/basegfxfactory.cxx b/cppcanvas/source/wrapper/basegfxfactory.cxx index acf6001d0ca7..c65a4216b522 100644 --- a/cppcanvas/source/wrapper/basegfxfactory.cxx +++ b/cppcanvas/source/wrapper/basegfxfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -162,3 +163,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implbitmap.cxx b/cppcanvas/source/wrapper/implbitmap.cxx index 81d5a5d4e755..bf00e0f673c6 100644 --- a/cppcanvas/source/wrapper/implbitmap.cxx +++ b/cppcanvas/source/wrapper/implbitmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -124,3 +125,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implbitmap.hxx b/cppcanvas/source/wrapper/implbitmap.hxx index 974eb4176b5a..c27d095d1888 100644 --- a/cppcanvas/source/wrapper/implbitmap.hxx +++ b/cppcanvas/source/wrapper/implbitmap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,12 +30,8 @@ #define _CPPCANVAS_IMPLBITMAP_HXX #include <com/sun/star/uno/Reference.hxx> -#ifndef _COM_SUN_STAR_RENDERING_XBITMAP_HPP__ #include <com/sun/star/rendering/XBitmap.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP__ #include <com/sun/star/rendering/XGraphicDevice.hpp> -#endif #include <cppcanvas/bitmap.hxx> #include <canvasgraphichelper.hxx> @@ -80,3 +77,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLBITMAP_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implbitmapcanvas.cxx b/cppcanvas/source/wrapper/implbitmapcanvas.cxx index b9de616ebab1..6aa08a9334d0 100644 --- a/cppcanvas/source/wrapper/implbitmapcanvas.cxx +++ b/cppcanvas/source/wrapper/implbitmapcanvas.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implbitmapcanvas.hxx b/cppcanvas/source/wrapper/implbitmapcanvas.hxx index 7d70f226848e..5b1b625630a0 100644 --- a/cppcanvas/source/wrapper/implbitmapcanvas.hxx +++ b/cppcanvas/source/wrapper/implbitmapcanvas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,16 +29,10 @@ #ifndef _CPPCANVAS_IMPLBITMAPCANVAS_HXX #define _CPPCANVAS_IMPLBITMAPCANVAS_HXX -#ifndef _COM_SUN_STAR_RENDERING_XBITMAPCANVAS_HPP__ #include <com/sun/star/rendering/XBitmapCanvas.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XBITMAP_HPP__ #include <com/sun/star/rendering/XBitmap.hpp> -#endif -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif #include <basegfx/vector/b2dsize.hxx> #include <cppcanvas/bitmapcanvas.hxx> @@ -74,3 +69,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLBITMAPCANVAS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implcanvas.cxx b/cppcanvas/source/wrapper/implcanvas.cxx index e08f270d117b..2fb6debc0eae 100644 --- a/cppcanvas/source/wrapper/implcanvas.cxx +++ b/cppcanvas/source/wrapper/implcanvas.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -139,3 +140,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implcanvas.hxx b/cppcanvas/source/wrapper/implcanvas.hxx index 87cb8b8c85fc..481a5541441c 100644 --- a/cppcanvas/source/wrapper/implcanvas.hxx +++ b/cppcanvas/source/wrapper/implcanvas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -102,3 +103,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLCANVAS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implcolor.cxx b/cppcanvas/source/wrapper/implcolor.cxx index 9e591e3e98f0..c474deee2420 100644 --- a/cppcanvas/source/wrapper/implcolor.cxx +++ b/cppcanvas/source/wrapper/implcolor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,3 +67,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implcolor.hxx b/cppcanvas/source/wrapper/implcolor.hxx index 5140d905245c..3bc47da73d01 100644 --- a/cppcanvas/source/wrapper/implcolor.hxx +++ b/cppcanvas/source/wrapper/implcolor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,13 +31,9 @@ #include <com/sun/star/uno/Sequence.hxx> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP__ #include <com/sun/star/rendering/XGraphicDevice.hpp> -#endif #include <cppcanvas/color.hxx> @@ -64,3 +61,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLCOLOR_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implcustomsprite.cxx b/cppcanvas/source/wrapper/implcustomsprite.cxx index 786b3699af3b..e41e728e40ce 100644 --- a/cppcanvas/source/wrapper/implcustomsprite.cxx +++ b/cppcanvas/source/wrapper/implcustomsprite.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,3 +81,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implcustomsprite.hxx b/cppcanvas/source/wrapper/implcustomsprite.hxx index b02eab38df1e..fe40c017b83c 100644 --- a/cppcanvas/source/wrapper/implcustomsprite.hxx +++ b/cppcanvas/source/wrapper/implcustomsprite.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <sal/types.h> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif #include <cppcanvas/canvas.hxx> #include <cppcanvas/customsprite.hxx> @@ -69,3 +68,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLCUSTOMSPRITE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implfont.cxx b/cppcanvas/source/wrapper/implfont.cxx index 48decd6677da..b466cfabd068 100644 --- a/cppcanvas/source/wrapper/implfont.cxx +++ b/cppcanvas/source/wrapper/implfont.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,3 +90,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implfont.hxx b/cppcanvas/source/wrapper/implfont.hxx index c7b93b876e10..589bab707e84 100644 --- a/cppcanvas/source/wrapper/implfont.hxx +++ b/cppcanvas/source/wrapper/implfont.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,13 +31,9 @@ #include <com/sun/star/uno/Reference.hxx> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP__ #include <com/sun/star/rendering/XCanvas.hpp> -#endif #include <cppcanvas/font.hxx> namespace rtl @@ -81,3 +78,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLFONT_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implpolypolygon.cxx b/cppcanvas/source/wrapper/implpolypolygon.cxx index 5e7b8c8cf635..ac1fa728378c 100644 --- a/cppcanvas/source/wrapper/implpolypolygon.cxx +++ b/cppcanvas/source/wrapper/implpolypolygon.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -199,3 +200,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implpolypolygon.hxx b/cppcanvas/source/wrapper/implpolypolygon.hxx index bd5e02d6a3de..7d89039f29c7 100644 --- a/cppcanvas/source/wrapper/implpolypolygon.hxx +++ b/cppcanvas/source/wrapper/implpolypolygon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,15 +30,9 @@ #define _CANVAS_IMPLPOLYPOLYGON_HXX #include <com/sun/star/uno/Reference.hxx> -#ifndef _COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP__ #include <com/sun/star/rendering/XPolyPolygon2D.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP__ #include <com/sun/star/rendering/XGraphicDevice.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_STROKEATTRIBUTES_HPP__ #include <com/sun/star/rendering/StrokeAttributes.hpp> -#endif #include <cppcanvas/polypolygon.hxx> #include <canvasgraphichelper.hxx> @@ -97,3 +92,5 @@ namespace cppcanvas } #endif /* _CANVAS_IMPLPOLYPOLYGON_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implsprite.cxx b/cppcanvas/source/wrapper/implsprite.cxx index bf8a1a1a67d6..f2f5fba781bd 100644 --- a/cppcanvas/source/wrapper/implsprite.cxx +++ b/cppcanvas/source/wrapper/implsprite.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -234,3 +235,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implsprite.hxx b/cppcanvas/source/wrapper/implsprite.hxx index 4f8c5fdcaef6..1397791d1f82 100644 --- a/cppcanvas/source/wrapper/implsprite.hxx +++ b/cppcanvas/source/wrapper/implsprite.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <com/sun/star/rendering/XSpriteCanvas.hpp> #include <com/sun/star/rendering/XSprite.hpp> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif #include <cppcanvas/sprite.hxx> #include <implspritecanvas.hxx> @@ -93,3 +92,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLSPRITE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implspritecanvas.cxx b/cppcanvas/source/wrapper/implspritecanvas.cxx index 4cd555adfb28..cc8cf5bdefcc 100644 --- a/cppcanvas/source/wrapper/implspritecanvas.cxx +++ b/cppcanvas/source/wrapper/implspritecanvas.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -157,3 +158,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/implspritecanvas.hxx b/cppcanvas/source/wrapper/implspritecanvas.hxx index 655bce3c05a2..d308b313b7dd 100644 --- a/cppcanvas/source/wrapper/implspritecanvas.hxx +++ b/cppcanvas/source/wrapper/implspritecanvas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,15 +29,11 @@ #ifndef _CPPCANVAS_IMPLSPRITECANVAS_HXX #define _CPPCANVAS_IMPLSPRITECANVAS_HXX -#ifndef _COM_SUN_STAR_RENDERING_XSPRITECANVAS_HPP__ #include <com/sun/star/rendering/XSpriteCanvas.hpp> -#endif #include <basegfx/vector/b2dsize.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif #include <cppcanvas/spritecanvas.hxx> @@ -108,3 +105,5 @@ namespace cppcanvas } #endif /* _CPPCANVAS_IMPLSPRITECANVAS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/impltext.cxx b/cppcanvas/source/wrapper/impltext.cxx index 7ebb378ea401..68592105c14a 100644 --- a/cppcanvas/source/wrapper/impltext.cxx +++ b/cppcanvas/source/wrapper/impltext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,15 +32,9 @@ #include <impltext.hxx> #include <canvas/canvastools.hxx> -#ifndef _COM_SUN_STAR_RENDERING_TEXTDIRECTION_HPP__ #include <com/sun/star/rendering/TextDirection.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP__ #include <com/sun/star/rendering/XCanvas.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_STRINGCONTEXT_HPP__ #include <com/sun/star/rendering/StringContext.hpp> -#endif #include <rtl/ustring.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -99,3 +94,5 @@ namespace cppcanvas } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/impltext.hxx b/cppcanvas/source/wrapper/impltext.hxx index b2c8d9fd0e1f..a45e7dab2114 100644 --- a/cppcanvas/source/wrapper/impltext.hxx +++ b/cppcanvas/source/wrapper/impltext.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,18 +29,10 @@ #ifndef _CANVAS_IMPLTEXT_HXX #define _CANVAS_IMPLTEXT_HXX -#ifndef _COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__ #include <com/sun/star/rendering/RenderState.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_STRINGCONTEXT_HPP__ #include <com/sun/star/rendering/StringContext.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP__ #include <com/sun/star/rendering/XCanvas.hpp> -#endif -#ifndef _COM_SUN_STAR_RENDERING_XCANVASFONT_HPP__ #include <com/sun/star/rendering/XCanvasFont.hpp> -#endif #include <cppcanvas/text.hxx> #include <canvasgraphichelper.hxx> @@ -76,3 +69,5 @@ namespace cppcanvas } #endif /* _CANVAS_IMPLTEXT_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppcanvas/source/wrapper/vclfactory.cxx b/cppcanvas/source/wrapper/vclfactory.cxx index bc80afaa92cd..c0646d0fdba5 100644 --- a/cppcanvas/source/wrapper/vclfactory.cxx +++ b/cppcanvas/source/wrapper/vclfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -361,3 +362,5 @@ namespace cppcanvas } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |