From c6df405c6c5e41212d69282d4f632893f108fda2 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 6 Mar 2007 11:36:13 +0000 Subject: #i39532# --- .../primitive2d/animatedprimitive2d.hxx | 65 +- .../drawinglayer/primitive2d/baseprimitive2d.hxx | 16 +- .../drawinglayer/primitive2d/bitmapprimitive2d.hxx | 6 +- .../primitive2d/controlprimitive2d.hxx | 118 ++ .../primitive2d/drawinglayer_primitivetypes2d.hxx | 92 ++ .../primitive2d/graphicprimitive2d.hxx | 100 ++ .../primitive2d/markerarrayprimitive2d.hxx | 13 +- .../drawinglayer/primitive2d/mediaprimitive2d.hxx | 99 ++ .../drawinglayer/primitive3d/baseprimitive3d.hxx | 16 +- .../primitive3d/drawinglayer_primitivetypes3d.hxx | 73 ++ .../drawinglayer/processor2d/vclprocessor2d.hxx | 29 +- drawinglayer/prj/build.lst | 2 +- drawinglayer/prj/d.lst | 6 + .../source/primitive2d/alphaprimitive2d.cxx | 10 +- .../source/primitive2d/animatedprimitive2d.cxx | 145 ++- .../primitive2d/backgroundcolorprimitive2d.cxx | 10 +- .../source/primitive2d/bitmapprimitive2d.cxx | 10 +- .../source/primitive2d/controlprimitive2d.cxx | 340 ++++++ .../source/primitive2d/embedded3dprimitive2d.cxx | 11 +- .../source/primitive2d/fillbitmapprimitive2d.cxx | 10 +- .../source/primitive2d/fillgradientprimitive2d.cxx | 10 +- .../source/primitive2d/fillhatchprimitive2d.cxx | 10 +- .../source/primitive2d/graphicprimitive2d.cxx | 453 ++++++++ .../source/primitive2d/gridprimitive2d.cxx | 10 +- .../source/primitive2d/groupprimitive2d.cxx | 10 +- .../source/primitive2d/helplineprimitive2d.cxx | 10 +- drawinglayer/source/primitive2d/makefile.mk | 8 +- .../source/primitive2d/markerarrayprimitive2d.cxx | 71 +- .../source/primitive2d/maskprimitive2d.cxx | 10 +- .../source/primitive2d/mediaprimitive2d.cxx | 188 ++++ .../source/primitive2d/metafileprimitive2d.cxx | 10 +- .../primitive2d/modifiedcolorprimitive2d.cxx | 10 +- .../source/primitive2d/polygonprimitive2d.cxx | 16 +- .../source/primitive2d/polypolygonprimitive2d.cxx | 20 +- .../source/primitive2d/sceneprimitive2d.cxx | 15 +- .../source/primitive2d/shadowprimitive2d.cxx | 10 +- .../source/primitive2d/textprimitive2d.cxx | 12 +- .../source/primitive2d/transformprimitive2d.cxx | 10 +- .../source/primitive2d/unifiedalphaprimitive2d.cxx | 10 +- .../source/primitive3d/groupprimitive3d.cxx | 10 +- .../source/primitive3d/hatchtextureprimitive3d.cxx | 12 +- .../primitive3d/modifiedcolorprimitive3d.cxx | 10 +- .../source/primitive3d/polygonprimitive3d.cxx | 12 +- .../source/primitive3d/polygontubeprimitive3d.cxx | 10 +- .../source/primitive3d/polypolygonprimitive3d.cxx | 10 +- .../source/primitive3d/sdrcubeprimitive3d.cxx | 10 +- .../source/primitive3d/sdrextrudeprimitive3d.cxx | 10 +- .../source/primitive3d/sdrlatheprimitive3d.cxx | 10 +- .../primitive3d/sdrpolypolygonprimitive3d.cxx | 10 +- .../source/primitive3d/sdrsphereprimitive3d.cxx | 10 +- .../source/primitive3d/shadowprimitive3d.cxx | 10 +- .../source/primitive3d/textureprimitive3d.cxx | 16 +- .../source/primitive3d/transformprimitive3d.cxx | 10 +- drawinglayer/source/processor2d/makefile.mk | 10 +- .../source/processor2d/vclhelperbitmaprender.cxx | 216 ++++ .../source/processor2d/vclhelperbitmaprender.hxx | 76 ++ .../processor2d/vclhelperbitmaptransform.cxx | 425 +++++++ .../processor2d/vclhelperbitmaptransform.hxx | 70 ++ .../source/processor2d/vclhelperbufferdevice.cxx | 154 +++ .../source/processor2d/vclhelperbufferdevice.hxx | 79 ++ .../source/processor2d/vclhelpergradient.cxx | 315 ++++++ .../source/processor2d/vclhelpergradient.hxx | 71 ++ drawinglayer/source/processor2d/vclprocessor2d.cxx | 1175 ++++---------------- .../source/processor3d/defaultprocessor3d.cxx | 26 +- .../source/processor3d/shadow3dextractor.cxx | 18 +- drawinglayer/util/makefile.mk | 9 +- 66 files changed, 3578 insertions(+), 1280 deletions(-) create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx create mode 100644 drawinglayer/source/primitive2d/controlprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/graphicprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/mediaprimitive2d.cxx create mode 100644 drawinglayer/source/processor2d/vclhelperbitmaprender.cxx create mode 100644 drawinglayer/source/processor2d/vclhelperbitmaprender.hxx create mode 100644 drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx create mode 100644 drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx create mode 100644 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx create mode 100644 drawinglayer/source/processor2d/vclhelperbufferdevice.hxx create mode 100644 drawinglayer/source/processor2d/vclhelpergradient.cxx create mode 100644 drawinglayer/source/processor2d/vclhelpergradient.hxx (limited to 'drawinglayer') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx index e6fc4bac782d..cc44ec4a5cbd 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: animatedprimitive2d.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:03 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:30:46 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -130,34 +130,52 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +// helper class for AnimatedInterpolatePrimitive2D namespace drawinglayer { - namespace primitive2d + namespace { - class AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D + class BufferedMatrixDecompose { private: - // the start and stop transformations - basegfx::B2DHomMatrix maStart; - basegfx::B2DHomMatrix maStop; - - // locally buffered decompose of the matrices - basegfx::B2DVector maScaleA; - basegfx::B2DVector maTranslateA; - basegfx::B2DVector maScaleB; - basegfx::B2DVector maTranslateB; - double mfRotateA; - double mfShearXA; - double mfRotateB; - double mfShearXB; + // the matrix itself + basegfx::B2DHomMatrix maB2DHomMatrix; - // bitfield - // flag to track if the matrices decomposition was already done - unsigned mbDecomposed : 1; + // the decomposition + basegfx::B2DVector maScale; + basegfx::B2DVector maTranslate; + double mfRotate; + double mfShearX; - // helpers - void implDecompose(); + // flag if already decomposed, used by ensureDecompose() + bool mbDecomposed; + + public: + BufferedMatrixDecompose(const basegfx::B2DHomMatrix& rMatrix); + void ensureDecompose() const; + + // data access + const basegfx::B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; } + const basegfx::B2DVector& getScale() const { return maScale; } + const basegfx::B2DVector& getTranslate() const { return maTranslate; } + double getRotate() const { return mfRotate; } + double getShearX() const { return mfShearX; } + }; + } // end of anonymous namespace +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D + { + private: + // the transformations + std::vector< BufferedMatrixDecompose > maMatrixStack; protected: // create local decomposition @@ -165,10 +183,9 @@ namespace drawinglayer public: AnimatedInterpolatePrimitive2D( + const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack, const animation::AnimationEntry& rAnimationEntry, const Primitive2DSequence& rChildren, - const basegfx::B2DHomMatrix& rStart, - const basegfx::B2DHomMatrix& rStop, bool bIsTextAnimation); // provide unique ID diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index 1c0cc84fed3b..ffb8d156e786 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: baseprimitive2d.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2007-01-25 12:56:40 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:30:46 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,11 +54,6 @@ #include #endif -////////////////////////////////////////////////////////////////////////////// -// defines for Create2DPrimitiveID - -#define Create2DPrimitiveID(a, b, c, d) ((((((a << 8L)|b)<<8L)|c)<<8L)|d) - ////////////////////////////////////////////////////////////////////////////// // defines for DeclPrimitrive2DIDBlock and ImplPrimitrive2DIDBlock // Added to be able to simply change identification stuff later, e.g. add @@ -68,8 +63,8 @@ #define DeclPrimitrive2DIDBlock() \ virtual sal_uInt32 getPrimitiveID() const; -#define ImplPrimitrive2DIDBlock(TheClass, a, b, c, d) \ - sal_uInt32 TheClass::getPrimitiveID() const { return Create2DPrimitiveID(a, b, c, d); } +#define ImplPrimitrive2DIDBlock(TheClass, TheID) \ + sal_uInt32 TheClass::getPrimitiveID() const { return TheID; } ////////////////////////////////////////////////////////////////////////////// // predefines @@ -130,8 +125,7 @@ namespace drawinglayer virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; // provide unique ID for fast identifying of known primitive implementations in renderers. These use - // the Create2DPrimitiveID macro to define unique IDs. The same macro is used from the renderers - // in their typical switch/case loop + // the the defines from primitivetypes2d.hxx to define unique IDs. // This method is normally defined using DeclPrimitrive2DIDBlock() virtual sal_uInt32 getPrimitiveID() const = 0; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx index 0dab1ab0963f..c83262307588 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: bitmapprimitive2d.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:03 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:30:46 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -84,7 +84,7 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX ////////////////////////////////////////////////////////////////////////////// // eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx new file mode 100644 index 000000000000..985a69e7a791 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: controlprimitive2d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:30:46 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include +#endif + +#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_ +#include +#endif + +#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class ControlPrimitive2D : public BasePrimitive2D + { + private: + // object's base data + basegfx::B2DHomMatrix maTransform; + com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel; + + // the created an cached awt::XControl + com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxXControl; + + // the last used scaling, used from getDecomposition for buffering + basegfx::B2DVector maLastViewScaling; + + // used from getXControl() to create a local awt::XControl which is remembered in mxXControl + // and from thereon always used and returned by getXControl() + void createXControl(); + + // single local decompositions, used from createLocalDecomposition() + Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + protected: + // local decomposition + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + ControlPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel); + + // get data + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& getControlModel() const { return mxControlModel; } + + // mxControl access. This will on demand create the awt::XControl using createXControl() + const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& getXControl() const; + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + + // Overload standard getDecomposition call to be view-dependent here + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx new file mode 100644 index 000000000000..617bb3950da8 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: drawinglayer_primitivetypes2d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:30:46 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// define ranges for other libraries + +#define PRIMITIVE2D_ID_RANGE_DRAWINGLAYER (0 << 16) +#define PRIMITIVE2D_ID_RANGE_SVX (1 << 16) +#define PRIMITIVE2D_ID_RANGE_SD (2 << 16) + +////////////////////////////////////////////////////////////////////////////// +// local primitives + +#define PRIMITIVE2D_ID_ALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 1) +#define PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 2) +#define PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 3) +#define PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 4) +#define PRIMITIVE2D_ID_BITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 5) +#define PRIMITIVE2D_ID_CONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 6) +#define PRIMITIVE2D_ID_EMBEDDED3DPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 7) +#define PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 8) +#define PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 9) +#define PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 10) +#define PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 11) +#define PRIMITIVE2D_ID_GRIDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 12) +#define PRIMITIVE2D_ID_GROUPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 13) +#define PRIMITIVE2D_ID_HELPLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 14) +#define PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 15) +#define PRIMITIVE2D_ID_MASKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 16) +#define PRIMITIVE2D_ID_MEDIAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 17) +#define PRIMITIVE2D_ID_METAFILEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 18) +#define PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 19) +#define PRIMITIVE2D_ID_OLEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 20) +#define PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 21) +#define PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 22) +#define PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 23) +#define PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 24) +#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 25) +#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 26) +#define PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 27) +#define PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 28) +#define PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 29) +#define PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 30) +#define PRIMITIVE2D_ID_SCENEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 31) +#define PRIMITIVE2D_ID_SHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32) +#define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 33) +#define PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 34) +#define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) +#define PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36) + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx new file mode 100644 index 000000000000..2421ba102289 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphicprimitive2d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:30:46 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include +#endif + +#ifndef _GRFMGR_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class GraphicPrimitive2D : public BasePrimitive2D + { + private: + basegfx::B2DHomMatrix maTransform; + GraphicObject maGraphicObject; + GraphicAttr maGraphicAttr; + + protected: + // local decomposition + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + GraphicPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const GraphicObject& rGraphicObject, + const GraphicAttr& rGraphicAttr); + GraphicPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const GraphicObject& rGraphicObject); + + // get data + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const GraphicObject& getGraphicObject() const { return maGraphicObject; } + const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; } + bool isTransparent() const; + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index 2794a4d0df0a..d0326bbff09e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: markerarrayprimitive2d.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2007-01-25 18:19:00 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:30:47 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -53,8 +53,14 @@ namespace drawinglayer { enum MarkerStyle2D { + /// Point: Uses RGBColor, 1x1 pixel MARKERSTYLE2D_POINT, + + /// Cross: Uses RGBColor, 3x3 pixel, centered, form of a plus sign MARKERSTYLE2D_CROSS, + + /// Gluepoint: Uses RGBColor as outline and hardcoded COL_LIGHTBLUE as inner + /// line pen, 7x7 pixel, centered, looks like a x with thee pixel lines MARKERSTYLE2D_GLUEPOINT }; @@ -71,9 +77,6 @@ namespace drawinglayer MarkerStyle2D eStyle, const basegfx::BColor& rRGBColor); - // helpers - basegfx::B2DVector getDiscreteSize() const; - // get data const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; } const basegfx::BColor& getRGBColor() const { return maRGBColor; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx new file mode 100644 index 000000000000..d10163a6d942 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: mediaprimitive2d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:30:47 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include +#endif + +#ifndef _BGFX_COLOR_BCOLOR_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class MediaPrimitive2D : public BasePrimitive2D + { + private: + basegfx::B2DHomMatrix maTransform; + rtl::OUString maURL; + basegfx::BColor maBackgroundColor; + sal_uInt32 mnDiscreteBorder; + + protected: + // local decomposition + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + MediaPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const rtl::OUString& rURL, + const basegfx::BColor& rBackgroundColor, + sal_uInt32 nDiscreteBorder); + + // get data + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const rtl::OUString& getURL() const { return maURL; } + const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; } + sal_uInt32 getDiscreteBorder() const { return mnDiscreteBorder; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx index c10580ab8979..bfc46815e074 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: baseprimitive3d.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-12-13 16:57:07 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:31:19 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,11 +54,6 @@ #include #endif -////////////////////////////////////////////////////////////////////////////// -// defines for Create3DPrimitiveID - -#define Create3DPrimitiveID(a, b, c, d) ((((((a << 8L)|b)<<8L)|c)<<8L)|d) - ////////////////////////////////////////////////////////////////////////////// // defines for DeclPrimitrive3DIDBlock and ImplPrimitrive3DIDBlock // Added to be able to simply change identification stuff later, e.g. add @@ -68,8 +63,8 @@ #define DeclPrimitrive3DIDBlock() \ virtual sal_uInt32 getPrimitiveID() const; -#define ImplPrimitrive3DIDBlock(TheClass, a, b, c, d) \ - sal_uInt32 TheClass::getPrimitiveID() const { return Create3DPrimitiveID(a, b, c, d); } +#define ImplPrimitrive3DIDBlock(TheClass, TheID) \ + sal_uInt32 TheClass::getPrimitiveID() const { return TheID; } ////////////////////////////////////////////////////////////////////////////// // basePrimitive3D class @@ -122,8 +117,7 @@ namespace drawinglayer virtual basegfx::B3DRange getB3DRange(double fTime) const; // provide unique ID for fast identifying of known primitive implementations in renderers. These use - // the Create3DPrimitiveID macro to define unique IDs. The same macro is used from the renderers - // in their typical switch/case loop + // the the defines from primitivetypes3d.hxx to define unique IDs. virtual sal_uInt32 getPrimitiveID() const = 0; // The getDecomposition default implementation will on demand use createLocalDecomposition() if maLocalDecomposition is empty. diff --git a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx new file mode 100644 index 000000000000..c46c75396262 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: drawinglayer_primitivetypes3d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:31:47 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX + +////////////////////////////////////////////////////////////////////////////// +// define ranges for other libraries + +#define PRIMITIVE3D_ID_RANGE_DRAWINGLAYER (0 << 16) +// #define PRIMITIVE3D_ID_RANGE_SVX (1 << 16) + +////////////////////////////////////////////////////////////////////////////// +// local primitives + +#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1) +#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2) +#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3) +#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4) +#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5) +#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6) +#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7) +#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8) +#define PRIMITIVE3D_ID_SDRLABELPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9) +#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10) +#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11) +#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12) +#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13) +#define PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14) +#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15) +#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16) +#define PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17) +#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18) + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index 29e2b2b23e2d..271c8e7441da 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: vclprocessor2d.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2007-01-25 18:21:13 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:32:20 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,14 +40,18 @@ #include #endif -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX -#include -#endif - #ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX #include #endif +#ifndef _BGFX_COLOR_BCOLORMODIFIER_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// // predefines class OutputDevice; @@ -68,6 +72,7 @@ namespace drawinglayer { namespace primitive2d { class AlphaPrimitive2D; class TransformPrimitive2D; class MarkerArrayPrimitive2D; + class ModifiedColorPrimitive2D; }} ////////////////////////////////////////////////////////////////////////////// @@ -88,10 +93,16 @@ namespace drawinglayer // the current transformation basegfx::B2DHomMatrix maCurrentTransformation; + // the current clip polyPolygon (for print and metafile) + basegfx::B2DPolyPolygon maCurrentClipPolyPolygon; + // bitfield - // flag to hold info if output of given OutDev goes to metafile + // flag to hold info if output of initial OutDev goes to metafile unsigned mbOutputToRecordingMetaFile : 1; + // flag to hold info if output of initial OutDev goes to printer + unsigned mbOutputToPrinter : 1; + ////////////////////////////////////////////////////////////////////////////// // rendering support void RenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); @@ -116,6 +127,10 @@ namespace drawinglayer // the central processing method virtual void process(const primitive2d::Primitive2DSequence& rSource); + + // data access + bool isOutputToRecordingMetaFile() const { return mbOutputToRecordingMetaFile; } + bool isOutputToPrinter() const { return mbOutputToPrinter; } }; } // end of namespace processor2d } // end of namespace drawinglayer diff --git a/drawinglayer/prj/build.lst b/drawinglayer/prj/build.lst index 90ba87fc8d36..caf7ac2c3add 100644 --- a/drawinglayer/prj/build.lst +++ b/drawinglayer/prj/build.lst @@ -1,4 +1,4 @@ -fx drawinglayer : goodies sal vcl basegfx offuh cppuhelper cppu NULL +fx drawinglayer : goodies sal vcl basegfx offuh cppuhelper cppu svtools avmedia NULL fx drawinglayer usr1 - all fx_mkout NULL fx drawinglayer\inc get - all fx_inc NULL fx drawinglayer\prj get - all fx_prj NULL diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index 42bdb942dad0..de639fbc6634 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -7,22 +7,27 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d +..\inc\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx ..\inc\drawinglayer\primitive2d\alphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\alphaprimitive2d.hxx ..\inc\drawinglayer\primitive2d\animatedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\animatedprimitive2d.hxx ..\inc\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx ..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx ..\inc\drawinglayer\primitive2d\bitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\bitmapprimitive2d.hxx +..\inc\drawinglayer\primitive2d\controlprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\controlprimitive2d.hxx ..\inc\drawinglayer\primitive2d\embedded3dprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\embedded3dprimitive2d.hxx ..\inc\drawinglayer\primitive2d\fillbitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\fillbitmapprimitive2d.hxx ..\inc\drawinglayer\primitive2d\fillgradientprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\fillgradientprimitive2d.hxx ..\inc\drawinglayer\primitive2d\fillhatchprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\fillhatchprimitive2d.hxx +..\inc\drawinglayer\primitive2d\graphicprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\graphicprimitive2d.hxx ..\inc\drawinglayer\primitive2d\gridprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\gridprimitive2d.hxx ..\inc\drawinglayer\primitive2d\groupprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\groupprimitive2d.hxx ..\inc\drawinglayer\primitive2d\helplineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\helplineprimitive2d.hxx ..\inc\drawinglayer\primitive2d\markerarrayprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\markerarrayprimitive2d.hxx ..\inc\drawinglayer\primitive2d\maskprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\maskprimitive2d.hxx +..\inc\drawinglayer\primitive2d\mediaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\mediaprimitive2d.hxx ..\inc\drawinglayer\primitive2d\metafileprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\metafileprimitive2d.hxx ..\inc\drawinglayer\primitive2d\modifiedcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\modifiedcolorprimitive2d.hxx +..\inc\drawinglayer\primitive2d\oleprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\oleprimitive2d.hxx ..\inc\drawinglayer\primitive2d\polygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\polypolygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polypolygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\sceneprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sceneprimitive2d.hxx @@ -33,6 +38,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d +..\inc\drawinglayer\primitive3d\drawinglayer_primitivetypes3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\drawinglayer_primitivetypes3d.hxx ..\inc\drawinglayer\primitive3d\baseprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\baseprimitive3d.hxx ..\inc\drawinglayer\primitive3d\groupprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\groupprimitive3d.hxx ..\inc\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx diff --git a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx b/drawinglayer/source/primitive2d/alphaprimitive2d.cxx index 6c534065f69d..0fa906d8a916 100644 --- a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/alphaprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: alphaprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:07 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -68,7 +72,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(AlphaPrimitive2D, '2','A','l','p') + ImplPrimitrive2DIDBlock(AlphaPrimitive2D, PRIMITIVE2D_ID_ALPHAPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx index 4b8efe160de5..d3f55a6ba707 100644 --- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: animatedprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:07 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -49,6 +49,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -64,8 +68,8 @@ namespace drawinglayer if(getChildren().hasElements()) { const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); - const sal_Int32 nLen(getChildren().getLength()); - sal_Int32 nIndex(basegfx::fround(fState * (double)nLen)); + const sal_uInt32 nLen(getChildren().getLength()); + sal_uInt32 nIndex(basegfx::fround(fState * (double)nLen)); if(nIndex >= nLen) { @@ -138,7 +142,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(AnimatedSwitchPrimitive2D, '2','A','S','w') + ImplPrimitrive2DIDBlock(AnimatedSwitchPrimitive2D, PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -173,78 +177,125 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(AnimatedBlinkPrimitive2D, '2','A','B','l') + ImplPrimitrive2DIDBlock(AnimatedBlinkPrimitive2D, PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +// helper class for AnimatedInterpolatePrimitive2D namespace drawinglayer { - namespace primitive2d + namespace { - Primitive2DSequence AnimatedInterpolatePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + BufferedMatrixDecompose::BufferedMatrixDecompose(const basegfx::B2DHomMatrix& rMatrix) + : maB2DHomMatrix(rMatrix), + maScale(0.0, 0.0), + maTranslate(0.0, 0.0), + mfRotate(0.0), + mfShearX(0.0), + mbDecomposed(false) + { + } + + void BufferedMatrixDecompose::ensureDecompose() const { - // ensure matrices are decomposed if(!mbDecomposed) { - const_cast< AnimatedInterpolatePrimitive2D* >(this)->implDecompose(); + BufferedMatrixDecompose* pThis = const_cast< BufferedMatrixDecompose* >(this); + maB2DHomMatrix.decompose(pThis->maScale, pThis->maTranslate, pThis->mfRotate, pThis->mfShearX); + pThis->mbDecomposed = true; } + } + } // end of anonymous namespace +} // end of namespace drawinglayer - // create state at time - double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); +////////////////////////////////////////////////////////////////////////////// - if(fState < 0.0) - { - fState = 0.0; - } +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence AnimatedInterpolatePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + const sal_uInt32 nSize(maMatrixStack.size()); - if(fState > 1.0) + if(nSize) { - fState = 1.0; - } + double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); - // interpolate for state - basegfx::B2DVector aScale(basegfx::interpolate(maScaleA, maScaleB, fState)); - basegfx::B2DVector aTranslate(basegfx::interpolate(maTranslateA, maTranslateB, fState)); - const double fRotate(((mfRotateB - mfRotateA) * fState) + mfRotateA); - const double fShearX(((mfShearXB - mfShearXA) * fState) + mfShearXA); - - // build matrix for state - basegfx::B2DHomMatrix aMergedTransform; - aMergedTransform.scale(aScale.getX(), aScale.getY()); - aMergedTransform.shearX(fShearX); - aMergedTransform.rotate(fRotate); - aMergedTransform.translate(aTranslate.getX(), aTranslate.getY()); - - // create new transform primitive reference, return new sequence - const Primitive2DReference xRef(new TransformPrimitive2D(aMergedTransform, getChildren())); - return Primitive2DSequence(&xRef, 1L); - } + if(fState < 0.0) + { + fState = 0.0; + } + else if(fState > 1.0) + { + fState = 1.0; + } - void AnimatedInterpolatePrimitive2D::implDecompose() - { - maStart.decompose(maScaleA, maTranslateA, mfRotateA, mfShearXA); - maStop.decompose(maScaleB, maTranslateB, mfRotateB, mfShearXB); - mbDecomposed = true; + const double fIndex(fState * (double)(nSize - 1L)); + const sal_uInt32 nIndA(sal_uInt32(floor(fIndex))); + const double fOffset(fIndex - (double)nIndA); + basegfx::B2DHomMatrix aTargetTransform; + + if(basegfx::fTools::equalZero(fOffset)) + { + // use matrix from nIndA directly + aTargetTransform = maMatrixStack[nIndA].getB2DHomMatrix(); + } + else + { + // interpolate. Get involved matrices and ensure they are decomposed + const sal_uInt32 nIndB((nIndA + 1L) % nSize); + std::vector< BufferedMatrixDecompose >::const_iterator aMatA(maMatrixStack.begin() + nIndA); + std::vector< BufferedMatrixDecompose >::const_iterator aMatB(maMatrixStack.begin() + nIndB); + + aMatA->ensureDecompose(); + aMatB->ensureDecompose(); + + // interpolate for fOffset [0.0 .. 1.0[ + const basegfx::B2DVector aScale(basegfx::interpolate(aMatA->getScale(), aMatB->getScale(), fOffset)); + const basegfx::B2DVector aTranslate(basegfx::interpolate(aMatA->getTranslate(), aMatB->getTranslate(), fOffset)); + const double fRotate(((aMatB->getRotate() - aMatA->getRotate()) * fOffset) + aMatA->getRotate()); + const double fShearX(((aMatB->getShearX() - aMatA->getShearX()) * fOffset) + aMatA->getShearX()); + + // build matrix for state + aTargetTransform.scale(aScale.getX(), aScale.getY()); + aTargetTransform.shearX(fShearX); + aTargetTransform.rotate(fRotate); + aTargetTransform.translate(aTranslate.getX(), aTranslate.getY()); + } + + // create new transform primitive reference, return new sequence + const Primitive2DReference xRef(new TransformPrimitive2D(aTargetTransform, getChildren())); + return Primitive2DSequence(&xRef, 1L); + } + else + { + return getChildren(); + } } AnimatedInterpolatePrimitive2D::AnimatedInterpolatePrimitive2D( + const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack, const animation::AnimationEntry& rAnimationEntry, const Primitive2DSequence& rChildren, - const basegfx::B2DHomMatrix& rStart, - const basegfx::B2DHomMatrix& rStop, bool bIsTextAnimation) : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation), - maStart(rStart), - maStop(rStop), - mbDecomposed(false) + maMatrixStack() { + // copy matrices + const sal_uInt32 nCount(rmMatrixStack.size()); + + for(sal_uInt32 a(0L); a < nCount; a++) + { + maMatrixStack.push_back(BufferedMatrixDecompose(rmMatrixStack[a])); + } } // provide unique ID - ImplPrimitrive2DIDBlock(AnimatedInterpolatePrimitive2D, '2','A','I','n') + ImplPrimitrive2DIDBlock(AnimatedInterpolatePrimitive2D, PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx index 2ea415a15624..ba1a04bb30dd 100644 --- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: backgroundcolorprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -128,7 +132,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(BackgroundColorPrimitive2D, '2','B','C','o') + ImplPrimitrive2DIDBlock(BackgroundColorPrimitive2D, PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx index 199923a0768f..f6571a140e11 100644 --- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: bitmapprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,6 +41,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -81,7 +85,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(BitmapPrimitive2D, '2','B','i','t') + ImplPrimitrive2DIDBlock(BitmapPrimitive2D, PRIMITIVE2D_ID_BITMAPPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx new file mode 100644 index 000000000000..76a8e9a4daaf --- /dev/null +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -0,0 +1,340 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: controlprimitive2d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:28 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX +#include +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include +#endif + +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOW2_HPP_ +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX +#include +#endif + +#ifndef _SV_VIRDEV_HXX +#include +#endif + +#ifndef _SV_SVAPP_HXX +#include +#endif + +#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_ +#include +#endif + +#ifndef _SV_BITMAPEX_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX +#include +#endif + +#ifndef TOOLS_DIAGNOSE_EX_H +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + void ControlPrimitive2D::createXControl() + { + if(!mxXControl.is() && getControlModel().is()) + { + uno::Reference< beans::XPropertySet > xSet(getControlModel(), uno::UNO_QUERY); + + if(xSet.is()) + { + uno::Any aValue(xSet->getPropertyValue(rtl::OUString::createFromAscii("DefaultControl"))); + rtl::OUString aUnoControlTypeName; + + if(aValue >>= aUnoControlTypeName) + { + if(aUnoControlTypeName.getLength()) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); + + if(xFactory.is()) + { + uno::Reference< awt::XControl > xXControl(xFactory->createInstance(aUnoControlTypeName), uno::UNO_QUERY); + + if(xXControl.is()) + { + xXControl->setModel(getControlModel()); + + // remember XControl + mxXControl = xXControl; + } + } + } + } + } + } + } + + Primitive2DReference ControlPrimitive2D::createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + Primitive2DReference xRetval; + const uno::Reference< awt::XControl >& rXControl(getXControl()); + + if(rXControl.is()) + { + uno::Reference< awt::XWindow > xControlWindow(rXControl, uno::UNO_QUERY); + + if(xControlWindow.is()) + { + // get decomposition to get size + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getTransform().decompose(aScale, aTranslate, fRotate, fShearX); + + // get absolute discrete size (no mirror or rotate here) + aScale = basegfx::absolute(aScale); + basegfx::B2DVector aDiscreteSize(rViewInformation.getViewTransformation() * aScale); + + // calc screen zoom for text display + basegfx::B2DVector aScreenZoom( + basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : aDiscreteSize.getX() / aScale.getX(), + basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : aDiscreteSize.getY() / aScale.getY()); + static double fZoomScale(26.0); // do not ask for this constant factor, but it gets the zoom right + aScreenZoom *= fZoomScale; + + // limit to a maximum square size, e.g. 500x250 pixels (125000) + const double fDiscreteQuadratic(aDiscreteSize.getX() * aDiscreteSize.getY()); + static double fDiscreteMax(125000.0); + + if(fDiscreteQuadratic > fDiscreteMax) + { + const double fFactor(sqrt(fDiscreteMax / fDiscreteQuadratic)); + aDiscreteSize *= fFactor; + aScreenZoom *= fFactor; + } + + // go to integer + const sal_Int32 nSizeX(basegfx::fround(aDiscreteSize.getX())); + const sal_Int32 nSizeY(basegfx::fround(aDiscreteSize.getY())); + + if(nSizeX && nSizeY) + { + // prepare VirtualDevice + VirtualDevice aVirtualDevice(*Application::GetDefaultDevice()); + const Size aSizePixel(nSizeX, nSizeY); + aVirtualDevice.SetOutputSizePixel(aSizePixel); + + // set size at control + xControlWindow->setPosSize(0, 0, nSizeX, nSizeY, awt::PosSize::POSSIZE); + + // get graphics and view + uno::Reference< awt::XGraphics > xGraphics(aVirtualDevice.CreateUnoGraphics()); + uno::Reference< awt::XView > xControlView(rXControl, uno::UNO_QUERY); + + if(xGraphics.is() && xControlView.is()) + { + // link graphics and view + xControlView->setGraphics(xGraphics); + + // set zoom at control view for text scaling + xControlView->setZoom((float)aScreenZoom.getX(), (float)aScreenZoom.getY()); + + try + { + // try to paint it to VirtualDevice + xControlView->draw(0, 0); + + // get bitmap + const Bitmap aContent(aVirtualDevice.GetBitmap(Point(), aSizePixel)); + + // create primitive + xRetval = new BitmapPrimitive2D(BitmapEx(aContent), getTransform()); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } + } + + return xRetval; + } + + Primitive2DReference ControlPrimitive2D::createPlaceholderDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // create a gray placeholder hairline polygon in object size + basegfx::B2DRange aObjectRange(0.0, 0.0, 1.0, 1.0); + aObjectRange.transform(getTransform()); + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aObjectRange)); + const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); + + // The replacement object may also get a text like 'empty group' here later + Primitive2DReference xRetval(new PolygonHairlinePrimitive2D(aOutline, aGrayTone)); + + return xRetval; + } + + Primitive2DSequence ControlPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + Primitive2DReference xReference(createBitmapDecomposition(rViewInformation)); + + if(!xReference.is()) + { + xReference = createPlaceholderDecomposition(rViewInformation); + } + + return Primitive2DSequence(&xReference, 1L); + } + + ControlPrimitive2D::ControlPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const uno::Reference< awt::XControlModel >& rxControlModel) + : BasePrimitive2D(), + maTransform(rTransform), + mxControlModel(rxControlModel), + mxXControl(), + maLastViewScaling() + { + } + + const uno::Reference< awt::XControl >& ControlPrimitive2D::getXControl() const + { + if(!mxXControl.is()) + { + const_cast< ControlPrimitive2D* >(this)->createXControl(); + } + + return mxXControl; + } + + bool ControlPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const ControlPrimitive2D& rCompare = (ControlPrimitive2D&)rPrimitive; + + if(getTransform() == rCompare.getTransform()) + { + if(getControlModel().is() == rCompare.getControlModel().is()) + { + if(getControlModel().is()) + { + // both exist, check for equality + return (getControlModel() == rCompare.getControlModel()); + } + else + { + // none exists -> same + return true; + } + } + } + } + + return false; + } + + basegfx::B2DRange ControlPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); + aRetval.transform(getTransform()); + return aRetval; + } + + Primitive2DSequence ControlPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + ::osl::MutexGuard aGuard( m_aMutex ); + const basegfx::B2DVector aNewScaling(rViewInformation.getViewTransformation() * basegfx::B2DVector(1.0, 1.0)); + + if(getLocalDecomposition().hasElements()) + { + if(!maLastViewScaling.equal(aNewScaling)) + { + // conditions of last local decomposition have changed, delete + const_cast< ControlPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence()); + } + } + + if(!getLocalDecomposition().hasElements()) + { + // remember ViewTransformation + const_cast< ControlPrimitive2D* >(this)->maLastViewScaling = aNewScaling; + } + + // use parent implementation + return BasePrimitive2D::get2DDecomposition(rViewInformation); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(ControlPrimitive2D, PRIMITIVE2D_ID_CONTROLPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index afaae572bf71..9e1c21681879 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: embedded3dprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-11-28 11:03:57 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,6 +61,11 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -130,7 +135,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(Embedded3DPrimitive2D, '2','E','m','b') + ImplPrimitrive2DIDBlock(Embedded3DPrimitive2D, PRIMITIVE2D_ID_EMBEDDED3DPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx index f350f9fb52ea..2be2b8414a31 100644 --- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: fillbitmapprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -146,7 +150,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(FillBitmapPrimitive2D, '2','F','B','i') + ImplPrimitrive2DIDBlock(FillBitmapPrimitive2D, PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 8cf3c100d609..5c4f9df8ceae 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: fillgradientprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -207,7 +211,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(FillGradientPrimitive2D, '2','F','G','r') + ImplPrimitrive2DIDBlock(FillGradientPrimitive2D, PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index ae65fc1791a8..2487919b2f94 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: fillhatchprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,6 +61,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -165,7 +169,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(FillHatchPrimitive2D, '2','F','H','a') + ImplPrimitrive2DIDBlock(FillHatchPrimitive2D, PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx new file mode 100644 index 000000000000..5933ede3f448 --- /dev/null +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -0,0 +1,453 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphicprimitive2d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// helper class for animated graphics + +#ifndef _SV_ANIMATE_HXX +#include +#endif + +#ifndef _SV_GRAPH_HXX +#include +#endif + +#ifndef _SV_VIRDEV_HXX +#include +#endif + +#ifndef _SV_SVAPP_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace +{ + struct animationStep + { + BitmapEx maBitmapEx; + sal_uInt32 mnTime; + }; + + class animatedBitmapExPreparator + { + ::Animation maAnimation; + ::std::vector< animationStep > maSteps; + + sal_uInt32 generateStepTime(sal_uInt32 nIndex) const; + + public: + animatedBitmapExPreparator(const Graphic& rGraphic); + + sal_uInt32 count() const { return maSteps.size(); } + sal_uInt32 loopCount() const { return (sal_uInt32)maAnimation.GetLoopCount(); } + sal_uInt32 stepTime(sal_uInt32 a) const { return maSteps[a].mnTime; } + const BitmapEx& stepBitmapEx(sal_uInt32 a) const { return maSteps[a].maBitmapEx; } + }; + + sal_uInt32 animatedBitmapExPreparator::generateStepTime(sal_uInt32 nIndex) const + { + const AnimationBitmap& rAnimBitmap = maAnimation.Get(sal_uInt16(nIndex)); + sal_uInt32 nWaitTime(rAnimBitmap.nWait * 10); + + // #115934# + // Take care of special value for MultiPage TIFFs. ATM these shall just + // show their first page. Later we will offer some switching when object + // is selected. + if(ANIMATION_TIMEOUT_ON_CLICK == rAnimBitmap.nWait) + { + // ATM the huge value would block the timer, so + // use a long time to show first page (whole day) + nWaitTime = 100 * 60 * 60 * 24; + } + + // Bad trap: There are animated gifs with no set WaitTime (!). + // In that case use a default value. + if(0L == nWaitTime) + { + nWaitTime = 100L; + } + + return nWaitTime; + } + + animatedBitmapExPreparator::animatedBitmapExPreparator(const Graphic& rGraphic) + : maAnimation(rGraphic.GetAnimation()) + { + OSL_ENSURE(GRAPHIC_BITMAP == rGraphic.GetType() && rGraphic.IsAnimated(), "animatedBitmapExPreparator: graphic is not animated (!)"); + + // #128539# secure access to Animation, looks like there exist animated GIFs out there + // with a step count of zero + if(maAnimation.Count()) + { + VirtualDevice aVirtualDevice(*Application::GetDefaultDevice()); + VirtualDevice aVirtualDeviceMask(*Application::GetDefaultDevice(), 1L); + + // Prepare VirtualDevices and their states + aVirtualDevice.EnableMapMode(sal_False); + aVirtualDeviceMask.EnableMapMode(sal_False); + aVirtualDevice.SetOutputSizePixel(maAnimation.GetDisplaySizePixel()); + aVirtualDeviceMask.SetOutputSizePixel(maAnimation.GetDisplaySizePixel()); + aVirtualDevice.Erase(); + aVirtualDeviceMask.Erase(); + + for(sal_uInt16 a(0L); a < maAnimation.Count(); a++) + { + animationStep aNextStep; + aNextStep.mnTime = generateStepTime(a); + + // prepare step + const AnimationBitmap& rAnimBitmap = maAnimation.Get(sal_uInt16(a)); + + switch(rAnimBitmap.eDisposal) + { + case DISPOSE_NOT: + { + aVirtualDevice.DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx); + Bitmap aMask = rAnimBitmap.aBmpEx.GetMask(); + + if(aMask.IsEmpty()) + { + const Point aEmpty; + const Rectangle aRect(aEmpty, aVirtualDeviceMask.GetOutputSizePixel()); + const Wallpaper aWallpaper(COL_BLACK); + aVirtualDeviceMask.DrawWallpaper(aRect, aWallpaper); + } + else + { + BitmapEx aExpandVisibilityMask = BitmapEx(aMask, aMask); + aVirtualDeviceMask.DrawBitmapEx(rAnimBitmap.aPosPix, aExpandVisibilityMask); + } + + break; + } + case DISPOSE_BACK: + { + // #i70772# react on no mask, for primitives, too. + const Bitmap aMask(rAnimBitmap.aBmpEx.GetMask()); + const Bitmap aContent(rAnimBitmap.aBmpEx.GetBitmap()); + + aVirtualDeviceMask.Erase(); + aVirtualDevice.DrawBitmap(rAnimBitmap.aPosPix, aContent); + + if(aMask.IsEmpty()) + { + const Rectangle aRect(rAnimBitmap.aPosPix, aContent.GetSizePixel()); + aVirtualDeviceMask.SetFillColor(COL_BLACK); + aVirtualDeviceMask.SetLineColor(); + aVirtualDeviceMask.DrawRect(aRect); + } + else + { + aVirtualDeviceMask.DrawBitmap(rAnimBitmap.aPosPix, aMask); + } + + break; + } + case DISPOSE_FULL: + { + aVirtualDevice.DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx); + break; + } + case DISPOSE_PREVIOUS : + { + aVirtualDevice.DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx); + aVirtualDeviceMask.DrawBitmap(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx.GetMask()); + break; + } + } + + // create BitmapEx + Bitmap aMainBitmap = aVirtualDevice.GetBitmap(Point(), aVirtualDevice.GetOutputSizePixel()); + Bitmap aMaskBitmap = aVirtualDeviceMask.GetBitmap(Point(), aVirtualDeviceMask.GetOutputSizePixel()); + aNextStep.maBitmapEx = BitmapEx(aMainBitmap, aMaskBitmap); + + // add to vector + maSteps.push_back(aNextStep); + } + } + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence GraphicPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence aRetval; + + if(255L != getGraphicAttr().GetTransparency()) + { + // get transformed graphic. Suppress rotation and cropping, only filtering is needed + // here (and may be replaced later on). Cropping is handled below as mask primitive (if set) + GraphicAttr aSuppressGraphicAttr(getGraphicAttr()); + aSuppressGraphicAttr.SetCrop(0L, 0L, 0L, 0L); + aSuppressGraphicAttr.SetRotation(0); + Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr)); + Primitive2DReference xPrimitive; + + switch(aTransformedGraphic.GetType()) + { + case GRAPHIC_BITMAP : + { + if(aTransformedGraphic.IsAnimated()) + { + // prepare animation data + animatedBitmapExPreparator aData(aTransformedGraphic); + + if(aData.count()) + { + // create sub-primitives for animated bitmap and the needed animation loop + animation::AnimationEntryLoop aAnimationLoop(aData.loopCount() ? aData.loopCount() : 0xffff); + Primitive2DSequence aBitmapPrimitives(aData.count()); + + for(sal_uInt32 a(0L); a < aData.count(); a++) + { + animation::AnimationEntryFixed aTime((double)aData.stepTime(a), (double)a / (double)aData.count()); + aAnimationLoop.append(aTime); + const Primitive2DReference xRef(new BitmapPrimitive2D(aData.stepBitmapEx(a), getTransform())); + aBitmapPrimitives[a] = xRef; + } + + // prepare animation list + animation::AnimationEntryList aAnimationList; + aAnimationList.append(aAnimationLoop); + + // create and add animated switch primitive + xPrimitive = Primitive2DReference(new AnimatedSwitchPrimitive2D(aAnimationList, aBitmapPrimitives, false)); + } + } + else + { + xPrimitive = Primitive2DReference(new BitmapPrimitive2D(aTransformedGraphic.GetBitmapEx(), getTransform())); + } + + break; + } + + case GRAPHIC_GDIMETAFILE : + { + xPrimitive = Primitive2DReference(new MetafilePrimitive2D(getTransform(), aTransformedGraphic.GetGDIMetaFile())); + break; + } + + default: + { + // nothing to create + break; + } + } + + if(xPrimitive.is()) + { + // check for cropping + if(getGraphicAttr().IsCropped()) + { + // decompose to get current pos and size + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getTransform().decompose(aScale, aTranslate, fRotate, fShearX); + + // create ranges. The current object range is just scale and translate + const basegfx::B2DRange aCurrent(aTranslate.getX(), aTranslate.getY(), aTranslate.getX() + aScale.getX(), aTranslate.getY() + aScale.getY()); + + // calculate scalings between real image size and logic object size. This + // is necessary since the crop values are relative to original bitmap size + double fFactorX(1.0); + double fFactorY(1.0); + + { + const MapMode aMapMode100thmm(MAP_100TH_MM); + const Size aBitmapSize(Application::GetDefaultDevice()->LogicToLogic(getGraphicObject().GetPrefSize(), getGraphicObject().GetPrefMapMode(), aMapMode100thmm)); + const double fDivX(aBitmapSize.Width() - getGraphicAttr().GetLeftCrop() - getGraphicAttr().GetRightCrop()); + const double fDivY(aBitmapSize.Height() - getGraphicAttr().GetTopCrop() - getGraphicAttr().GetBottomCrop()); + + if(!basegfx::fTools::equalZero(fDivX)) + { + fFactorX = aScale.getX() / fDivX; + } + + if(!basegfx::fTools::equalZero(fDivY)) + { + fFactorY = aScale.getY() / fDivY; + } + } + + // Create cropped range, describes the bounds of the original graphic + basegfx::B2DRange aCropped; + aCropped.expand(aCurrent.getMinimum() - basegfx::B2DPoint(getGraphicAttr().GetLeftCrop() * fFactorX, getGraphicAttr().GetTopCrop() * fFactorY)); + aCropped.expand(aCurrent.getMaximum() + basegfx::B2DPoint(getGraphicAttr().GetRightCrop() * fFactorX, getGraphicAttr().GetBottomCrop() * fFactorY)); + + if(aCropped.isEmpty()) + { + // nothing to add since cropped bitmap is completely empty + // xPrimitive will not be used + } + else + { + // build new object transformation for transform primitive which contains xPrimitive + basegfx::B2DHomMatrix aNewObjectTransform(getTransform()); + aNewObjectTransform.invert(); + aNewObjectTransform.scale(aCropped.getWidth(), aCropped.getHeight()); + aNewObjectTransform.translate(aCropped.getMinX() - aCurrent.getMinX(), aCropped.getMinY() - aCurrent.getMinY()); + aNewObjectTransform.shearX(fShearX); + aNewObjectTransform.rotate(fRotate); + aNewObjectTransform.translate(aTranslate.getX(), aTranslate.getY()); + + // prepare TransformPrimitive2D with xPrimitive + const Primitive2DReference xTransformPrimitive(new TransformPrimitive2D(aNewObjectTransform, Primitive2DSequence(&xPrimitive, 1L))); + + if(aCurrent.isInside(aCropped)) + { + // cropped just got smaller, no need to really use a mask. Add to destination directly + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xTransformPrimitive); + } + else + { + // cropped got bigger, mask it with original object's bounds + basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aMaskPolyPolygon.transform(getTransform()); + + // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector + const Primitive2DReference xRefB(new MaskPrimitive2D(aMaskPolyPolygon, Primitive2DSequence(&xTransformPrimitive, 1L))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRefB); + } + } + } + else + { + // add to decomposition + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xPrimitive); + } + } + } + + return aRetval; + } + + GraphicPrimitive2D::GraphicPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const GraphicObject& rGraphicObject, + const GraphicAttr& rGraphicAttr) + : BasePrimitive2D(), + maTransform(rTransform), + maGraphicObject(rGraphicObject), + maGraphicAttr(rGraphicAttr) + { + } + + GraphicPrimitive2D::GraphicPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const GraphicObject& rGraphicObject) + : BasePrimitive2D(), + maTransform(rTransform), + maGraphicObject(rGraphicObject), + maGraphicAttr() + { + } + + bool GraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const GraphicPrimitive2D& rCompare = (GraphicPrimitive2D&)rPrimitive; + + return (getTransform() == rCompare.getTransform() + && getGraphicObject() == rCompare.getGraphicObject() + && getGraphicAttr() == rCompare.getGraphicAttr()); + } + + return false; + } + + basegfx::B2DRange GraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); + aRetval.transform(getTransform()); + return aRetval; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(GraphicPrimitive2D, PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index c5dce7766a4e..e175963daef6 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: gridprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2007-01-25 18:20:23 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -49,6 +49,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -304,7 +308,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(GridPrimitive2D, '2','G','r','i') + ImplPrimitrive2DIDBlock(GridPrimitive2D, PRIMITIVE2D_ID_GRIDPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx b/drawinglayer/source/primitive2d/groupprimitive2d.cxx index 100679e95b4a..375f97d01156 100644 --- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: groupprimitive2d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2007-01-25 12:57:55 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -76,7 +80,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(GroupPrimitive2D, '2','G','r','o') + ImplPrimitrive2DIDBlock(GroupPrimitive2D, PRIMITIVE2D_ID_GROUPPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx index 2d44825bf1af..968581c3376f 100644 --- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: helplineprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-12-13 16:57:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -235,7 +239,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(HelplinePrimitive2D, '2','H','e','l') + ImplPrimitrive2DIDBlock(HelplinePrimitive2D, PRIMITIVE2D_ID_HELPLINEPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index 4d884600e9c7..bee09ef8d561 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: aw $ $Date: 2007-01-25 18:20:23 $ +# last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -50,17 +50,21 @@ SLOFILES= \ $(SLO)$/baseprimitive2d.obj \ $(SLO)$/backgroundcolorprimitive2d.obj \ $(SLO)$/bitmapprimitive2d.obj \ + $(SLO)$/controlprimitive2d.obj \ $(SLO)$/embedded3dprimitive2d.obj \ $(SLO)$/fillbitmapprimitive2d.obj \ $(SLO)$/fillgradientprimitive2d.obj \ $(SLO)$/fillhatchprimitive2d.obj \ + $(SLO)$/graphicprimitive2d.obj \ $(SLO)$/gridprimitive2d.obj \ $(SLO)$/groupprimitive2d.obj \ $(SLO)$/helplineprimitive2d.obj \ $(SLO)$/markerarrayprimitive2d.obj \ $(SLO)$/maskprimitive2d.obj \ + $(SLO)$/mediaprimitive2d.obj \ $(SLO)$/metafileprimitive2d.obj \ $(SLO)$/modifiedcolorprimitive2d.obj \ + $(SLO)$/oleprimitive2d.obj \ $(SLO)$/polypolygonprimitive2d.obj \ $(SLO)$/polygonprimitive2d.obj \ $(SLO)$/sceneprimitive2d.obj \ diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index 45301ddc288b..dbf97c6884de 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: markerarrayprimitive2d.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2007-01-25 18:20:23 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -49,6 +49,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -59,27 +63,6 @@ namespace drawinglayer { namespace primitive2d { - basegfx::B2DVector MarkerArrayPrimitive2D::getDiscreteSize() const - { - switch(getStyle()) - { - case MARKERSTYLE2D_CROSS : - { - return basegfx::B2DVector(3.0, 3.0); - break; - } - case MARKERSTYLE2D_GLUEPOINT : - { - return basegfx::B2DVector(7.0, 7.0); - break; - } - default : // MARKERSTYLE2D_POINT - { - return basegfx::B2DVector(1.0, 1.0); - } - } - } - MarkerArrayPrimitive2D::MarkerArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, MarkerStyle2D eStyle, @@ -109,26 +92,34 @@ namespace drawinglayer { basegfx::B2DRange aRetval; - if(MARKERSTYLE2D_POINT == getStyle()) + // get the basic range from the position vector + for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()); aIter != getPositions().end(); aIter++) { - for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()); aIter != getPositions().end(); aIter++) - { - aRetval.expand(*aIter); - } + aRetval.expand(*aIter); } - else - { - const basegfx::B2DVector fHalfDiscreteSize(getDiscreteSize() / 2.0); - basegfx::B2DRange aRealtiveLogicRange(-fHalfDiscreteSize.getX(), -fHalfDiscreteSize.getY(), fHalfDiscreteSize.getX(), fHalfDiscreteSize.getY()); - aRealtiveLogicRange.transform(rViewInformation.getInverseViewTransformation()); - - const basegfx::B2DPoint aLogicRelativeTopLeft(aRealtiveLogicRange.getMinimum()); - const basegfx::B2DPoint aLogicRelativeBottomRight(aRealtiveLogicRange.getMaximum()); - for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()); aIter != getPositions().end(); aIter++) + switch(getStyle()) + { + default : // MARKERSTYLE2D_POINT { - aRetval.expand(aLogicRelativeTopLeft + *aIter); - aRetval.expand(aLogicRelativeBottomRight + *aIter); + // nothing to do; aRetval is already valid + break; + } + case MARKERSTYLE2D_CROSS : + { + // size is 3x3 centered, expand + const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector(1.5, 1.5)); + aRetval.expand(aRetval.getMinimum() - aDiscreteVector); + aRetval.expand(aRetval.getMinimum() + aDiscreteVector); + break; + } + case MARKERSTYLE2D_GLUEPOINT : + { + // size is 7x7 centered, expand + const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector(3.5, 3.5)); + aRetval.expand(aRetval.getMinimum() - aDiscreteVector); + aRetval.expand(aRetval.getMinimum() + aDiscreteVector); + break; } } @@ -136,7 +127,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(MarkerArrayPrimitive2D, '2','M','a','r') + ImplPrimitrive2DIDBlock(MarkerArrayPrimitive2D, PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/maskprimitive2d.cxx b/drawinglayer/source/primitive2d/maskprimitive2d.cxx index 171ef5fe3d26..67e6eedd0539 100644 --- a/drawinglayer/source/primitive2d/maskprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/maskprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: maskprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:09 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -68,7 +72,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(MaskPrimitive2D, '2','M','a','s') + ImplPrimitrive2DIDBlock(MaskPrimitive2D, PRIMITIVE2D_ID_MASKPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx new file mode 100644 index 000000000000..44fa15c25123 --- /dev/null +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: mediaprimitive2d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX +#include +#endif + +#ifndef _AVMEDIA_MEDIAWINDOW_HXX +#include +#endif + +#ifndef _GRFMGR_HXX //autogen +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence MediaPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + Primitive2DSequence xRetval(1); + + // create background object + basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aBackgroundPolygon.transform(getTransform()); + const Primitive2DReference xRefBackground(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aBackgroundPolygon), getBackgroundColor())); + xRetval[0] = xRefBackground; + + // try to get graphic snapshot + const Graphic aGraphic(avmedia::MediaWindow::grabFrame(getURL(), true)); + + if(GRAPHIC_BITMAP == aGraphic.GetType() || GRAPHIC_GDIMETAFILE == aGraphic.GetType()) + { + const GraphicObject aGraphicObject(aGraphic); + const GraphicAttr aGraphicAttr; + xRetval.realloc(2); + xRetval[0] = xRefBackground; + xRetval[1] = Primitive2DReference(new GraphicPrimitive2D(getTransform(), aGraphicObject, aGraphicAttr)); + } + + if(getDiscreteBorder()) + { + const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector((double)getDiscreteBorder(), (double)getDiscreteBorder())); + const double fDiscreteSize(aDiscreteInLogic.getX() + aDiscreteInLogic.getY()); + + basegfx::B2DRange aSourceRange(0.0, 0.0, 1.0, 1.0); + aSourceRange.transform(getTransform()); + + basegfx::B2DRange aDestRange(aSourceRange); + aDestRange.grow(-0.5 * fDiscreteSize); + + if(::basegfx::fTools::equalZero(aDestRange.getWidth()) || ::basegfx::fTools::equalZero(aDestRange.getHeight())) + { + // shrunk primitive has no content (zero size in X or Y), nothing to display, nothing to return + xRetval = Primitive2DSequence(); + } + else + { + // create transformation matrix from original range to shrunk range + basegfx::B2DHomMatrix aTransform; + aTransform.translate(-aSourceRange.getMinX(), -aSourceRange.getMinY()); + aTransform.scale(aDestRange.getWidth() / aSourceRange.getWidth(), aDestRange.getHeight() / aSourceRange.getHeight()); + aTransform.translate(aDestRange.getMinX(), aDestRange.getMinY()); + + // add transform primitive + const Primitive2DReference aScaled(new TransformPrimitive2D(aTransform, xRetval)); + xRetval = Primitive2DSequence(&aScaled, 1L); + } + } + + return xRetval; + } + + MediaPrimitive2D::MediaPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const rtl::OUString& rURL, + const basegfx::BColor& rBackgroundColor, + sal_uInt32 nDiscreteBorder) + : BasePrimitive2D(), + maTransform(rTransform), + maURL(rURL), + maBackgroundColor(rBackgroundColor), + mnDiscreteBorder(nDiscreteBorder) + { + } + + bool MediaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const MediaPrimitive2D& rCompare = (MediaPrimitive2D&)rPrimitive; + + return (getTransform() == rCompare.getTransform() + && getURL() == rCompare.getURL() + && getBackgroundColor() == rCompare.getBackgroundColor() + && getDiscreteBorder() == rCompare.getDiscreteBorder()); + } + + return false; + } + + basegfx::B2DRange MediaPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); + aRetval.transform(getTransform()); + + if(getDiscreteBorder()) + { + const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector((double)getDiscreteBorder(), (double)getDiscreteBorder())); + const double fDiscreteSize(aDiscreteInLogic.getX() + aDiscreteInLogic.getY()); + + aRetval.grow(-0.5 * fDiscreteSize); + } + + return aRetval; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(MediaPrimitive2D, PRIMITIVE2D_ID_MEDIAPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 122c467a35af..533386a6caeb 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: metafileprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-12-13 16:31:24 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,6 +41,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -81,7 +85,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(MetafilePrimitive2D, '2','M','e','t') + ImplPrimitrive2DIDBlock(MetafilePrimitive2D, PRIMITIVE2D_ID_METAFILEPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx index 366a1f5be03e..d8d233d26314 100644 --- a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: modifiedcolorprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:09 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -68,7 +72,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(ModifiedColorPrimitive2D, '2','M','C','o') + ImplPrimitrive2DIDBlock(ModifiedColorPrimitive2D, PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index c20b0f164936..9c5957d30d14 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:09 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -53,6 +53,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -92,7 +96,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolygonHairlinePrimitive2D, '2','P','H','a') + ImplPrimitrive2DIDBlock(PolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -181,7 +185,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolygonMarkerPrimitive2D, '2','P','M','a') + ImplPrimitrive2DIDBlock(PolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -304,7 +308,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolygonStrokePrimitive2D, '2','P','S','t') + ImplPrimitrive2DIDBlock(PolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -421,7 +425,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolygonStrokeArrowPrimitive2D, '2','P','S','A') + ImplPrimitrive2DIDBlock(PolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 1a9f1ab5cee4..e885e24c0091 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polypolygonprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2007-02-22 12:11:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -69,6 +69,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -138,7 +142,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolyPolygonStrokePrimitive2D, '2','P','P','s') + ImplPrimitrive2DIDBlock(PolyPolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -222,7 +226,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolyPolygonStrokeArrowPrimitive2D, '2','P','P','A') + ImplPrimitrive2DIDBlock(PolyPolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -262,7 +266,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolyPolygonColorPrimitive2D, '2','P','P','C') + ImplPrimitrive2DIDBlock(PolyPolygonColorPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -308,7 +312,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, '2','P','P','G') + ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -354,7 +358,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, '2','P','P','H') + ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -406,7 +410,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(PolyPolygonBitmapPrimitive2D, '2','P','P','B') + ImplPrimitrive2DIDBlock(PolyPolygonBitmapPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index ce9e91d2958c..0053d15c74e8 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sceneprimitive2d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2006-12-13 16:57:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -81,6 +81,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -139,11 +143,12 @@ namespace drawinglayer const double fViewSizeX(fLogicSizeX * (rViewInformation.getViewTransformation() * basegfx::B2DVector(aUnitVisiblePart.getWidth(), 0.0)).getLength()); const double fViewSizeY(fLogicSizeY * (rViewInformation.getViewTransformation() * basegfx::B2DVector(0.0, aUnitVisiblePart.getHeight())).getLength()); const double fViewVisibleArea(fViewSizeX * fViewSizeY); + const double fMaximumVisibleArea(1000000.0); double fReduceFactor(1.0); - if(fViewVisibleArea > 1000000.0) + if(fViewVisibleArea > fMaximumVisibleArea) { - fReduceFactor = sqrt(1000000.0 / fViewVisibleArea); + fReduceFactor = sqrt(fMaximumVisibleArea / fViewVisibleArea); fLogicSizeX *= fReduceFactor; fLogicSizeY *= fReduceFactor; } @@ -426,7 +431,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(ScenePrimitive2D, '2','S','c','e') + ImplPrimitrive2DIDBlock(ScenePrimitive2D, PRIMITIVE2D_ID_SCENEPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index 5a631fa5f20b..8c81ac92939c 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: shadowprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:09 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,6 +61,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -121,7 +125,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(ShadowPrimitive2D, '2','S','h','a') + ImplPrimitrive2DIDBlock(ShadowPrimitive2D, PRIMITIVE2D_ID_SHADOWPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 31daa351cc24..8573a74639ae 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textprimitive2d.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: hdu $ $Date: 2007-02-22 15:11:38 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -81,6 +81,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + #include ////////////////////////////////////////////////////////////////////////////// @@ -306,7 +310,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(TextSimplePortionPrimitive2D, '2','T','S','i') + ImplPrimitrive2DIDBlock(TextSimplePortionPrimitive2D, PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer @@ -642,7 +646,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(TextDecoratedPortionPrimitive2D, '2','T','D','o') + ImplPrimitrive2DIDBlock(TextDecoratedPortionPrimitive2D, PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/transformprimitive2d.cxx b/drawinglayer/source/primitive2d/transformprimitive2d.cxx index 14145594871a..9b3fc008c60d 100644 --- a/drawinglayer/source/primitive2d/transformprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/transformprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: transformprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:09 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,6 +41,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -79,7 +83,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(TransformPrimitive2D, '2','T','r','a') + ImplPrimitrive2DIDBlock(TransformPrimitive2D, PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx index c901f1d7c125..7a7ea840a2ef 100644 --- a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: unifiedalphaprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -114,7 +118,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(UnifiedAlphaPrimitive2D, '2','U','A','l') + ImplPrimitrive2DIDBlock(UnifiedAlphaPrimitive2D, PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/groupprimitive3d.cxx b/drawinglayer/source/primitive3d/groupprimitive3d.cxx index 33f24fd277a5..4d39817254ba 100644 --- a/drawinglayer/source/primitive3d/groupprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/groupprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: groupprimitive3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -76,7 +80,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(GroupPrimitive3D, '3','G','r','o') + ImplPrimitrive3DIDBlock(GroupPrimitive3D, PRIMITIVE3D_ID_GROUPPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index 107c689ab36c..ce3e948f72c8 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: hatchtextureprimitive3d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2006-12-13 16:57:08 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -77,6 +77,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -114,7 +118,7 @@ namespace drawinglayer // not all content is needed, remove transparencies and ModifiedColorPrimitives switch(pBasePrimitive->getPrimitiveID()) { - case Create3DPrimitiveID('3','P','P','M') : + case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : { // polyPolygonMaterialPrimitive3D, check texturing and hatching const PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive); @@ -333,7 +337,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(HatchTexturePrimitive3D, '3','H','T','e') + ImplPrimitrive3DIDBlock(HatchTexturePrimitive3D, PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx index 8f5bae143cf2..2874a9cf4441 100644 --- a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: modifiedcolorprimitive3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -68,7 +72,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(ModifiedColorPrimitive3D, '3','M','C','o') + ImplPrimitrive3DIDBlock(ModifiedColorPrimitive3D, PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx index 829730b66835..a5bec933d0b7 100644 --- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive3d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -53,6 +53,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -91,7 +95,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(PolygonHairlinePrimitive3D, '3','P','H','a') + ImplPrimitrive3DIDBlock(PolygonHairlinePrimitive3D, PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer @@ -173,7 +177,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(PolygonStrokePrimitive3D, '3','P','S','t') + ImplPrimitrive3DIDBlock(PolygonStrokePrimitive3D, PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index ecbd606bdff2..a134b9ccedee 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygontubeprimitive3d.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,6 +61,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -580,7 +584,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(PolygonTubePrimitive3D, '3','P','T','u') + ImplPrimitrive3DIDBlock(PolygonTubePrimitive3D, PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx index 9ce65d35e002..1a4a36eea1cd 100644 --- a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polypolygonprimitive3d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -45,6 +45,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -86,7 +90,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(PolyPolygonMaterialPrimitive3D, '3','P','P','M') + ImplPrimitrive3DIDBlock(PolyPolygonMaterialPrimitive3D, PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx index 6e3bc414739f..0efe401feca2 100644 --- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrcubeprimitive3d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:10 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -217,7 +221,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(SdrCubePrimitive3D, '3','C','u','b') + ImplPrimitrive3DIDBlock(SdrCubePrimitive3D, PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index cc96aece4781..0da175aa5752 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrextrudeprimitive3d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:11 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -331,7 +335,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(SdrExtrudePrimitive3D, '3','E','x','t') + ImplPrimitrive3DIDBlock(SdrExtrudePrimitive3D, PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index 38626d27e851..8e951a6c4784 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrlatheprimitive3d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:11 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -342,7 +346,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(SdrLathePrimitive3D, '3','L','a','t') + ImplPrimitrive3DIDBlock(SdrLathePrimitive3D, PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index 837336923a1e..4c78d4d741a3 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrpolypolygonprimitive3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:11 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,6 +41,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -115,7 +119,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(SdrPolyPolygonPrimitive3D, '3','P','P','o') + ImplPrimitrive3DIDBlock(SdrPolyPolygonPrimitive3D, PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index 9b4161b6efe7..236934baec4e 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrsphereprimitive3d.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:11 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -216,7 +220,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(SdrSpherePrimitive3D, '3','S','p','h') + ImplPrimitrive3DIDBlock(SdrSpherePrimitive3D, PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx index a29a4e7312f6..f3fac8f252c7 100644 --- a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: shadowprimitive3d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:11 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -77,7 +81,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(ShadowPrimitive3D, '3','S','h','a') + ImplPrimitrive3DIDBlock(ShadowPrimitive3D, PRIMITIVE3D_ID_SHADOWPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index aafd28df998f..586128b54a9e 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textureprimitive3d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:11 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -122,7 +126,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(UnifiedAlphaTexturePrimitive3D, '3','U','A','T') + ImplPrimitrive3DIDBlock(UnifiedAlphaTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer @@ -162,7 +166,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(GradientTexturePrimitive3D, '3','G','T','e') + ImplPrimitrive3DIDBlock(GradientTexturePrimitive3D, PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer @@ -201,7 +205,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(BitmapTexturePrimitive3D, '3','B','T','e') + ImplPrimitrive3DIDBlock(BitmapTexturePrimitive3D, PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer @@ -226,7 +230,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(AlphaTexturePrimitive3D, '3','A','T','e') + ImplPrimitrive3DIDBlock(AlphaTexturePrimitive3D, PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/transformprimitive3d.cxx b/drawinglayer/source/primitive3d/transformprimitive3d.cxx index 765d6b96387f..66fdca9d2dc2 100644 --- a/drawinglayer/source/primitive3d/transformprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/transformprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: transformprimitive3d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:11 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,6 +41,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -79,7 +83,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(TransformPrimitive3D, '3','T','r','a') + ImplPrimitrive3DIDBlock(TransformPrimitive3D, PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/makefile.mk b/drawinglayer/source/processor2d/makefile.mk index 1bff99ed7e65..f3bb345571bc 100644 --- a/drawinglayer/source/processor2d/makefile.mk +++ b/drawinglayer/source/processor2d/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: aw $ $Date: 2007-01-25 12:57:14 $ +# last change: $Author: aw $ $Date: 2007-03-06 12:34:15 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -45,7 +45,11 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/baseprocessor2d.obj \ + $(SLO)$/baseprocessor2d.obj \ + $(SLO)$/vclhelpergradient.obj \ + $(SLO)$/vclhelperbitmaptransform.obj \ + $(SLO)$/vclhelperbitmaprender.obj \ + $(SLO)$/vclhelperbufferdevice.obj \ $(SLO)$/vclprocessor2d.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx new file mode 100644 index 000000000000..3f225c52478e --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelperbitmaprender.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:15 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX +#include +#endif + +#ifndef _GRFMGR_HXX +#include +#endif + +#ifndef _BGFX_VECTOR_B2DVECTOR_HXX +#include +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include +#endif + +#ifndef _BGFX_RANGE_B2DRANGE_HXX +#include +#endif + +#ifndef _SV_OUTDEV_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// support for different kinds of bitmap rendering using vcl + +namespace drawinglayer +{ + void RenderBitmapPrimitive2D_GraphicManager( + OutputDevice& rOutDev, + const BitmapEx& rBitmapEx, + const basegfx::B2DHomMatrix& rTransform) + { + // prepare attributes + GraphicAttr aAttributes; + + // decompose matrix to check for shear, rotate and mirroring + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + rTransform.decompose(aScale, aTranslate, fRotate, fShearX); + + // mirror flags + aAttributes.SetMirrorFlags( + (basegfx::fTools::less(aScale.getX(), 0.0) ? BMP_MIRROR_HORZ : 0)| + (basegfx::fTools::less(aScale.getY(), 0.0) ? BMP_MIRROR_VERT : 0)); + + // rotation + if(!basegfx::fTools::equalZero(fRotate)) + { + double fRotation(fmod(3600.0 - (fRotate * (10.0 / F_PI180)), 3600.0)); + aAttributes.SetRotation((sal_uInt16)(fRotation)); + } + + // prepare Bitmap + basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); + + if(basegfx::fTools::equalZero(fRotate)) + { + aOutlineRange.transform(rTransform); + } + else + { + // if rotated, create the unrotated output rectangle for the GraphicManager paint + basegfx::B2DHomMatrix aSimpleObjectMatrix; + + aSimpleObjectMatrix.scale(fabs(aScale.getX()), fabs(aScale.getY())); + aSimpleObjectMatrix.translate(aTranslate.getX(), aTranslate.getY()); + + aOutlineRange.transform(aSimpleObjectMatrix); + } + + // prepare dest coor + const Rectangle aDestRectPixel( + basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()), + basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY())); + + // paint it using GraphicManager + Graphic aGraphic(rBitmapEx); + GraphicObject aGraphicObject(aGraphic); + aGraphicObject.Draw(&rOutDev, aDestRectPixel.TopLeft(), aDestRectPixel.GetSize(), &aAttributes); + } + + void RenderBitmapPrimitive2D_BitmapEx( + OutputDevice& rOutDev, + const BitmapEx& rBitmapEx, + const basegfx::B2DHomMatrix& rTransform) + { + // only translate and scale, use vcl's DrawBitmapEx(). + BitmapEx aContent(rBitmapEx); + + // prepare dest coor. Necessary to expand since vcl's DrawBitmapEx draws one pix less + basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); + aOutlineRange.transform(rTransform); + const Rectangle aDestRectPixel( + basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()), + basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY())); + + // decompose matrix to check for shear, rotate and mirroring + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + rTransform.decompose(aScale, aTranslate, fRotate, fShearX); + + // Check mirroring. + sal_uInt32 nMirrorFlags(BMP_MIRROR_NONE); + + if(basegfx::fTools::less(aScale.getX(), 0.0)) + { + nMirrorFlags |= BMP_MIRROR_HORZ; + } + + if(basegfx::fTools::less(aScale.getY(), 0.0)) + { + nMirrorFlags |= BMP_MIRROR_VERT; + } + + if(BMP_MIRROR_NONE != nMirrorFlags) + { + aContent.Mirror(nMirrorFlags); + } + + // draw bitmap + rOutDev.DrawBitmapEx(aDestRectPixel.TopLeft(), aDestRectPixel.GetSize(), aContent); + } + + void RenderBitmapPrimitive2D_self( + OutputDevice& rOutDev, + const BitmapEx& rBitmapEx, + const basegfx::B2DHomMatrix& rTransform) + { + // process self with free transformation (containing shear and rotate). Get dest rect in pixels. + basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); + aOutlineRange.transform(rTransform); + const Rectangle aDestRectLogic( + basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()), + basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY())); + const Rectangle aDestRectPixel(rOutDev.LogicToPixel(aDestRectLogic)); + + // intersect with output pixel size + const Rectangle aOutputRectPixel(Point(), rOutDev.GetOutputSizePixel()); + const Rectangle aCroppedRectPixel(aDestRectPixel.GetIntersection(aOutputRectPixel)); + + if(!aCroppedRectPixel.IsEmpty()) + { + // build transform from pixel in aDestination to pixel in rBitmapEx + basegfx::B2DHomMatrix aTransform; + + // from relative in aCroppedRectPixel to relative in aDestRectPixel + aTransform.translate(aCroppedRectPixel.Left() - aDestRectPixel.Left(), aCroppedRectPixel.Top() - aDestRectPixel.Top()); + + // from relative in aDestRectPixel to absolute Logic + aTransform.scale((double)aDestRectLogic.getWidth() / (double)aDestRectPixel.getWidth(), (double)aDestRectLogic.getHeight() / (double)aDestRectPixel.getHeight()); + aTransform.translate(aDestRectLogic.Left(), aDestRectLogic.Top()); + + // from absolute in Logic to unified object coordinates (0.0 .. 1.0 in x and y) + basegfx::B2DHomMatrix aInvBitmapTransform(rTransform); + aInvBitmapTransform.invert(); + aTransform = aInvBitmapTransform * aTransform; + + // from unit object coordinates to rBitmapEx pixel coordintes + const Size aSourceSizePixel(rBitmapEx.GetSizePixel()); + aTransform.scale(aSourceSizePixel.getWidth() - 1L, aSourceSizePixel.getHeight() - 1L); + + // create bitmap using source, destination and linear back-transformation + BitmapEx aDestination = impTransformBitmapEx(rBitmapEx, aCroppedRectPixel, aTransform); + + // paint + const bool bWasEnabled(rOutDev.IsMapModeEnabled()); + rOutDev.EnableMapMode(false); + rOutDev.DrawBitmapEx(aCroppedRectPixel.TopLeft(), aDestination); + rOutDev.EnableMapMode(bWasEnabled); + } + } +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx new file mode 100644 index 000000000000..1dc18a421184 --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelperbitmaprender.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX + +#ifndef _SAL_TYPES_H_ +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class OutputDevice; +class BitmapEx; +namespace basegfx { class B2DHomMatrix; } + +////////////////////////////////////////////////////////////////////////////// +// support methods for vcl direct gradient renderering + +namespace drawinglayer +{ + void RenderBitmapPrimitive2D_GraphicManager( + OutputDevice& rOutDev, + const BitmapEx& rBitmapEx, + const basegfx::B2DHomMatrix& rTransform); + + void RenderBitmapPrimitive2D_BitmapEx( + OutputDevice& rOutDev, + const BitmapEx& rBitmapEx, + const basegfx::B2DHomMatrix& rTransform); + + void RenderBitmapPrimitive2D_self( + OutputDevice& rOutDev, + const BitmapEx& rBitmapEx, + const basegfx::B2DHomMatrix& rTransform); + +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX + +// eof diff --git a/drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx b/drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx new file mode 100644 index 000000000000..4a1dede1e183 --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx @@ -0,0 +1,425 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelperbitmaptransform.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX +#include +#endif + +#ifndef _SV_BMPACC_HXX +#include +#endif + +#ifndef _BGFX_POINT_B2DPOINT_HXX +#include +#endif + +#ifndef _BGFX_COLOR_BCOLORMODIFIER_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// support for rendering Bitmap and BitmapEx contents + +namespace drawinglayer +{ + namespace + { + void impSmoothPoint(BitmapColor& rValue, const basegfx::B2DPoint& rSource, sal_Int32 nIntX, sal_Int32 nIntY, BitmapReadAccess& rRead) + { + double fDeltaX(rSource.getX() - nIntX); + double fDeltaY(rSource.getY() - nIntY); + sal_Int32 nIndX(0L); + sal_Int32 nIndY(0L); + + if(fDeltaX > 0.0 && nIntX + 1L < rRead.Width()) + { + nIndX++; + } + else if(fDeltaX < 0.0 && nIntX >= 1L) + { + fDeltaX = -fDeltaX; + nIndX--; + } + + if(fDeltaY > 0.0 && nIntY + 1L < rRead.Height()) + { + nIndY++; + } + else if(fDeltaY < 0.0 && nIntY >= 1L) + { + fDeltaY = -fDeltaY; + nIndY--; + } + + if(nIndX || nIndY) + { + const double fColorToReal(1.0 / 255.0); + double fR(rValue.GetRed() * fColorToReal); + double fG(rValue.GetGreen() * fColorToReal); + double fB(rValue.GetBlue() * fColorToReal); + double fRBottom(0.0), fGBottom(0.0), fBBottom(0.0); + + if(nIndX) + { + const double fMulA(fDeltaX * fColorToReal); + double fMulB(1.0 - fDeltaX); + const BitmapColor aTopPartner(rRead.GetColor(nIntY, nIntX + nIndX)); + + fR = (fR * fMulB) + (aTopPartner.GetRed() * fMulA); + fG = (fG * fMulB) + (aTopPartner.GetGreen() * fMulA); + fB = (fB * fMulB) + (aTopPartner.GetBlue() * fMulA); + + if(nIndY) + { + fMulB *= fColorToReal; + const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); + const BitmapColor aBottomPartner(rRead.GetColor(nIntY + nIndY, nIntX + nIndX)); + + fRBottom = (aBottom.GetRed() * fMulB) + (aBottomPartner.GetRed() * fMulA); + fGBottom = (aBottom.GetGreen() * fMulB) + (aBottomPartner.GetGreen() * fMulA); + fBBottom = (aBottom.GetBlue() * fMulB) + (aBottomPartner.GetBlue() * fMulA); + } + } + + if(nIndY) + { + if(!nIndX) + { + const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); + + fRBottom = aBottom.GetRed() * fColorToReal; + fGBottom = aBottom.GetGreen() * fColorToReal; + fBBottom = aBottom.GetBlue() * fColorToReal; + } + + const double fMulB(1.0 - fDeltaY); + + fR = (fR * fMulB) + (fRBottom * fDeltaY); + fG = (fG * fMulB) + (fGBottom * fDeltaY); + fB = (fB * fMulB) + (fBBottom * fDeltaY); + } + + rValue.SetRed((sal_uInt8)(fR * 255.0)); + rValue.SetGreen((sal_uInt8)(fG * 255.0)); + rValue.SetBlue((sal_uInt8)(fB * 255.0)); + } + } + + void impSmoothIndex(BitmapColor& rValue, const basegfx::B2DPoint& rSource, sal_Int32 nIntX, sal_Int32 nIntY, BitmapReadAccess& rRead) + { + double fDeltaX(rSource.getX() - nIntX); + double fDeltaY(rSource.getY() - nIntY); + sal_Int32 nIndX(0L); + sal_Int32 nIndY(0L); + + if(fDeltaX > 0.0 && nIntX + 1L < rRead.Width()) + { + nIndX++; + } + else if(fDeltaX < 0.0 && nIntX >= 1L) + { + fDeltaX = -fDeltaX; + nIndX--; + } + + if(fDeltaY > 0.0 && nIntY + 1L < rRead.Height()) + { + nIndY++; + } + else if(fDeltaY < 0.0 && nIntY >= 1L) + { + fDeltaY = -fDeltaY; + nIndY--; + } + + if(nIndX || nIndY) + { + const double fColorToReal(1.0 / 255.0); + double fVal(rValue.GetIndex() * fColorToReal); + double fValBottom(0.0); + + if(nIndX) + { + const double fMulA(fDeltaX * fColorToReal); + double fMulB(1.0 - fDeltaX); + const BitmapColor aTopPartner(rRead.GetPixel(nIntY, nIntX + nIndX)); + + fVal = (fVal * fMulB) + (aTopPartner.GetIndex() * fMulA); + + if(nIndY) + { + fMulB *= fColorToReal; + const BitmapColor aBottom(rRead.GetPixel(nIntY + nIndY, nIntX)); + const BitmapColor aBottomPartner(rRead.GetPixel(nIntY + nIndY, nIntX + nIndX)); + + fValBottom = (aBottom.GetIndex() * fMulB) + (aBottomPartner.GetIndex() * fMulA); + } + } + + if(nIndY) + { + if(!nIndX) + { + const BitmapColor aBottom(rRead.GetPixel(nIntY + nIndY, nIntX)); + + fValBottom = aBottom.GetIndex() * fColorToReal; + } + + const double fMulB(1.0 - fDeltaY); + + fVal = (fVal * fMulB) + (fValBottom * fDeltaY); + } + + rValue.SetIndex((sal_uInt8)(fVal * 255.0)); + } + } + + void impTransformBitmap(const Bitmap& rSource, Bitmap& rDestination, const basegfx::B2DHomMatrix& rTransform, bool bSmooth) + { + BitmapWriteAccess* pWrite = rDestination.AcquireWriteAccess(); + + if(pWrite) + { + const Size aContentSizePixel(rSource.GetSizePixel()); + BitmapReadAccess* pRead = (const_cast< Bitmap& >(rSource)).AcquireReadAccess(); + + if(pRead) + { + const Size aDestinationSizePixel(rDestination.GetSizePixel()); + bool bWorkWithIndex(rDestination.GetBitCount() <= 8); + BitmapColor aOutside(pRead->GetBestMatchingColor(BitmapColor(0xff, 0xff, 0xff))); + + for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++) + { + for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++) + { + const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y)); + const sal_Int32 nIntX(basegfx::fround(aSourceCoor.getX())); + + if(nIntX >= 0L && nIntX < aContentSizePixel.getWidth()) + { + const sal_Int32 nIntY(basegfx::fround(aSourceCoor.getY())); + + if(nIntY >= 0L && nIntY < aContentSizePixel.getHeight()) + { + if(bWorkWithIndex) + { + BitmapColor aValue(pRead->GetPixel(nIntY, nIntX)); + + if(bSmooth) + { + impSmoothIndex(aValue, aSourceCoor, nIntX, nIntY, *pRead); + } + + pWrite->SetPixel(y, x, aValue); + } + else + { + BitmapColor aValue(pRead->GetColor(nIntY, nIntX)); + + if(bSmooth) + { + impSmoothPoint(aValue, aSourceCoor, nIntX, nIntY, *pRead); + } + + pWrite->SetPixel(y, x, aValue.IsIndex() ? aValue : pWrite->GetBestMatchingColor(aValue)); + } + + continue; + } + } + + // here are outside pixels. Complete mask + if(bWorkWithIndex) + { + pWrite->SetPixel(y, x, aOutside); + } + } + } + + delete pRead; + } + + delete pWrite; + } + } + + Bitmap impCreateEmptyBitmapWithPattern(const Bitmap& rSource, const Size& aTargetSizePixel) + { + Bitmap aRetval; + BitmapReadAccess* pReadAccess = (const_cast< Bitmap& >(rSource)).AcquireReadAccess(); + + if(pReadAccess) + { + if(rSource.GetBitCount() <= 8) + { + BitmapPalette aPalette(pReadAccess->GetPalette()); + aRetval = Bitmap(aTargetSizePixel, rSource.GetBitCount(), &aPalette); + } + else + { + aRetval = Bitmap(aTargetSizePixel, rSource.GetBitCount()); + } + + delete pReadAccess; + } + + return aRetval; + } + } // end of anonymous namespace +} // end of namespace drawinglayer + +namespace drawinglayer +{ + BitmapEx impTransformBitmapEx( + const BitmapEx& rSource, + const Rectangle& rCroppedRectPixel, + const basegfx::B2DHomMatrix& rTransform) + { + // force destination to 24 bit, we want to smooth output + const Size aDestinationSize(rCroppedRectPixel.GetSize()); + Bitmap aDestination(impCreateEmptyBitmapWithPattern(rSource.GetBitmap(), aDestinationSize)); + static bool bDoSmoothAtAll(true); + impTransformBitmap(rSource.GetBitmap(), aDestination, rTransform, bDoSmoothAtAll); + + // create mask + if(rSource.IsTransparent()) + { + if(rSource.IsAlpha()) + { + Bitmap aAlpha(impCreateEmptyBitmapWithPattern(rSource.GetAlpha().GetBitmap(), aDestinationSize)); + impTransformBitmap(rSource.GetAlpha().GetBitmap(), aAlpha, rTransform, bDoSmoothAtAll); + return BitmapEx(aDestination, AlphaMask(aAlpha)); + } + else + { + Bitmap aMask(impCreateEmptyBitmapWithPattern(rSource.GetMask(), aDestinationSize)); + impTransformBitmap(rSource.GetMask(), aMask, rTransform, false); + return BitmapEx(aDestination, aMask); + } + } + + return BitmapEx(aDestination); + } + + BitmapEx impModifyBitmapEx( + const basegfx::BColorModifierStack& rBColorModifierStack, + const BitmapEx& rSource) + { + Bitmap aChangedBitmap(rSource.GetBitmap()); + bool bDone(false); + + for(sal_uInt32 a(rBColorModifierStack.count()); a && !bDone; ) + { + const basegfx::BColorModifier& rModifier = rBColorModifierStack.getBColorModifier(--a); + + switch(rModifier.getMode()) + { + case basegfx::BCOLORMODIFYMODE_REPLACE : + { + // complete replace + if(rSource.IsTransparent()) + { + // clear bitmap with dest color + aChangedBitmap.Erase(Color(rModifier.getBColor())); + } + else + { + // erase bitmap, caller will know to paint direct + aChangedBitmap.SetEmpty(); + } + + bDone = true; + break; + } + + default : // BCOLORMODIFYMODE_INTERPOLATE, BCOLORMODIFYMODE_GRAY, BCOLORMODIFYMODE_BLACKANDWHITE + { + BitmapWriteAccess* pContent = aChangedBitmap.AcquireWriteAccess(); + + if(pContent) + { + const double fConvertColor(1.0 / 255.0); + + for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); y++) + { + for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++) + { + const BitmapColor aBMCol(pContent->GetColor(y, x)); + const basegfx::BColor aBSource( + (double)aBMCol.GetRed() * fConvertColor, + (double)aBMCol.GetGreen() * fConvertColor, + (double)aBMCol.GetBlue() * fConvertColor); + const basegfx::BColor aBDest(rModifier.getModifiedColor(aBSource)); + + pContent->SetPixel(y, x, BitmapColor(Color(aBDest))); + } + } + + delete pContent; + } + + break; + } + } + } + + if(aChangedBitmap.IsEmpty()) + { + return BitmapEx(); + } + else + { + if(rSource.IsTransparent()) + { + if(rSource.IsAlpha()) + { + return BitmapEx(aChangedBitmap, rSource.GetAlpha()); + } + else + { + return BitmapEx(aChangedBitmap, rSource.GetMask()); + } + } + else + { + return BitmapEx(aChangedBitmap); + } + } + } +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx b/drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx new file mode 100644 index 000000000000..e7b916a98a5d --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelperbitmaptransform.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX + +#ifndef _SV_BITMAPEX_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class B2DHomMatrix; + class BColorModifierStack; +} + +////////////////////////////////////////////////////////////////////////////// +// support methods for vcl direct gradient renderering + +namespace drawinglayer +{ + BitmapEx impTransformBitmapEx( + const BitmapEx& rSource, + const Rectangle& rCroppedRectPixel, + const basegfx::B2DHomMatrix& rTransform); + + BitmapEx impModifyBitmapEx( + const basegfx::BColorModifierStack& rBColorModifierStack, + const BitmapEx& rSource); +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX + +// eof diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx new file mode 100644 index 000000000000..c1b813a1e522 --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -0,0 +1,154 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelperbufferdevice.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBUFFERDEVICE_HXX +#include +#endif + +#ifndef _BGFX_RANGE_B2DRANGE_HXX +#include +#endif + +#ifndef _SV_BITMAPEX_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// support for rendering Bitmap and BitmapEx contents + +namespace drawinglayer +{ + impBufferDevice::impBufferDevice( + OutputDevice& rOutDev, + const basegfx::B2DRange& rRange) + : mrOutDev(rOutDev), + maContent(rOutDev), + mpMask(0L), + mpAlpha(0L) + { + const Rectangle aRectLogic( + (sal_Int32)floor(rRange.getMinX()), (sal_Int32)floor(rRange.getMinY()), + (sal_Int32)floor(rRange.getMaxX()) + 1L, (sal_Int32)floor(rRange.getMaxY()) + 1L); + const Rectangle aRectPixel(rOutDev.LogicToPixel(aRectLogic)); + const Point aEmptyPoint; + maDestPixel = Rectangle(aEmptyPoint, rOutDev.GetOutputSizePixel()); + maDestPixel.Intersection(aRectPixel); + + if(isVisible()) + { + maContent.SetOutputSizePixel(maDestPixel.GetSize(), false); + + const bool bWasEnabledSrc(rOutDev.IsMapModeEnabled()); + rOutDev.EnableMapMode(false); + maContent.DrawOutDev(aEmptyPoint, maDestPixel.GetSize(), maDestPixel.TopLeft(), maDestPixel.GetSize(), rOutDev); + rOutDev.EnableMapMode(bWasEnabledSrc); + + MapMode aNewMapMode(rOutDev.GetMapMode()); + const Point aLogicTopLeft(rOutDev.PixelToLogic(maDestPixel.TopLeft())); + aNewMapMode.SetOrigin(Point(-aLogicTopLeft.X(), -aLogicTopLeft.Y())); + + maContent.SetMapMode(aNewMapMode); + } + } + + impBufferDevice::~impBufferDevice() + { + delete mpMask; + delete mpAlpha; + } + + void impBufferDevice::paint(double fTrans) + { + const Point aEmptyPoint; + const Size aSizePixel(maContent.GetOutputSizePixel()); + const bool bWasEnabledDst(mrOutDev.IsMapModeEnabled()); + + mrOutDev.EnableMapMode(false); + maContent.EnableMapMode(false); + Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); + + if(mpAlpha) + { + mpAlpha->EnableMapMode(false); + AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel)); + mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); + } + else if(mpMask) + { + mpMask->EnableMapMode(false); + Bitmap aMask(mpMask->GetBitmap(aEmptyPoint, aSizePixel)); + mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aMask)); + } + else if(0.0 != fTrans) + { + sal_uInt8 nMaskValue((sal_uInt8)basegfx::fround(fTrans * 255.0)); + AlphaMask aAlphaMask(aSizePixel, &nMaskValue); + mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); + } + else + { + mrOutDev.DrawBitmap(maDestPixel.TopLeft(), aContent); + } + + mrOutDev.EnableMapMode(bWasEnabledDst); + } + + VirtualDevice& impBufferDevice::getMask() + { + if(!mpMask) + { + mpMask = new VirtualDevice(mrOutDev, 1); + mpMask->SetOutputSizePixel(maDestPixel.GetSize(), true); + mpMask->SetMapMode(maContent.GetMapMode()); + } + + return *mpMask; + } + + VirtualDevice& impBufferDevice::getAlpha() + { + if(!mpAlpha) + { + mpAlpha = new VirtualDevice(); + mpAlpha->SetOutputSizePixel(maDestPixel.GetSize(), true); + mpAlpha->SetMapMode(maContent.GetMapMode()); + } + + return *mpAlpha; + } +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx new file mode 100644 index 000000000000..d661a25311d4 --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelperbufferdevice.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBUFFERDEVICE_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBUFFERDEVICE_HXX + +#ifndef _SV_VIRDEV_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { class B2DRange; } + +////////////////////////////////////////////////////////////////////////////// +// support methods for vcl direct gradient renderering + +namespace drawinglayer +{ + class impBufferDevice + { + OutputDevice& mrOutDev; + VirtualDevice maContent; + VirtualDevice* mpMask; + VirtualDevice* mpAlpha; + Rectangle maDestPixel; + + public: + impBufferDevice( + OutputDevice& rOutDev, + const basegfx::B2DRange& rRange); + ~impBufferDevice(); + + void paint(double fTrans = 0.0); + bool isVisible() const { return !maDestPixel.IsEmpty(); } + VirtualDevice& getContent() { return maContent; } + VirtualDevice& getMask(); + VirtualDevice& getAlpha(); + }; +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBUFFERDEVICE_HXX + +// eof diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx new file mode 100644 index 000000000000..fd2136208139 --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx @@ -0,0 +1,315 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelpergradient.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:17 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX +#include +#endif + +#ifndef _BGFX_RANGE_B2DRANGE_HXX +#include +#endif + +#ifndef _SV_OUTDEV_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX +#include +#endif + +#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX +#include +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// support methods for vcl direct gradient renderering + +namespace drawinglayer +{ + namespace + { + sal_uInt32 impCalcGradientSteps(OutputDevice& rOutDev, sal_uInt32 nSteps, const basegfx::B2DRange& rRange, sal_uInt32 nMaxDist) + { + if(nSteps == 0L) + { + const Size aSize(rOutDev.LogicToPixel(Size(basegfx::fround(rRange.getWidth()), basegfx::fround(rRange.getHeight())))); + nSteps = (aSize.getWidth() + aSize.getHeight()) >> 3L; + } + + if(nSteps < 2L) + { + nSteps = 2L; + } + + if(nSteps > nMaxDist) + { + nSteps = nMaxDist; + } + + return nSteps; + } + + void impDrawGradientToOutDevSimple( + OutputDevice& rOutDev, + const basegfx::B2DPolyPolygon& rTargetForm, + const ::std::vector< basegfx::B2DHomMatrix >& rMatrices, + const ::std::vector< basegfx::BColor >& rColors, + const basegfx::B2DPolygon& rUnitPolygon) + { + rOutDev.SetLineColor(); + + for(sal_uInt32 a(0L); a < rColors.size(); a++) + { + // set correct color + const basegfx::BColor aFillColor(rColors[a]); + rOutDev.SetFillColor(Color(aFillColor)); + + if(a) + { + if(a - 1L < rMatrices.size()) + { + basegfx::B2DPolygon aNewPoly(rUnitPolygon); + aNewPoly.transform(rMatrices[a - 1L]); + rOutDev.DrawPolygon(Polygon(aNewPoly)); + } + } + else + { + rOutDev.DrawPolyPolygon(PolyPolygon(rTargetForm)); + } + } + } + + void impDrawGradientToOutDevComplex( + OutputDevice& rOutDev, + const basegfx::B2DPolyPolygon& rTargetForm, + const ::std::vector< basegfx::B2DHomMatrix >& rMatrices, + const ::std::vector< basegfx::BColor >& rColors, + const basegfx::B2DPolygon& rUnitPolygon) + { + PolyPolygon aVclTargetForm(rTargetForm); + ::std::vector< Polygon > aVclPolygons; + sal_uInt32 a; + + // remember and set to XOR + rOutDev.SetLineColor(); + rOutDev.Push(PUSH_RASTEROP); + rOutDev.SetRasterOp(ROP_XOR); + + // draw gradient PolyPolygons + for(a = 0L; a < rMatrices.size(); a++) + { + // create polygon and remember + basegfx::B2DPolygon aNewPoly(rUnitPolygon); + aNewPoly.transform(rMatrices[a]); + aVclPolygons.push_back(Polygon(aNewPoly)); + + // set correct color + if(rColors.size() > a) + { + const basegfx::BColor aFillColor(rColors[a]); + rOutDev.SetFillColor(Color(aFillColor)); + } + + // create vcl PolyPolygon and draw it + if(a) + { + PolyPolygon aVclPolyPoly(aVclPolygons[a - 1L]); + aVclPolyPoly.Insert(aVclPolygons[a]); + rOutDev.DrawPolyPolygon(aVclPolyPoly); + } + else + { + PolyPolygon aVclPolyPoly(aVclTargetForm); + aVclPolyPoly.Insert(aVclPolygons[0L]); + rOutDev.DrawPolyPolygon(aVclPolyPoly); + } + } + + // draw last poly in last color + if(rColors.size()) + { + const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); + rOutDev.SetFillColor(Color(aFillColor)); + rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1L]); + } + + // draw object form in black and go back to XOR + rOutDev.SetFillColor(COL_BLACK); + rOutDev.SetRasterOp(ROP_0); + rOutDev.DrawPolyPolygon(aVclTargetForm); + rOutDev.SetRasterOp(ROP_XOR); + + // draw gradient PolyPolygons again + for(a = 0L; a < rMatrices.size(); a++) + { + // set correct color + if(rColors.size() > a) + { + const basegfx::BColor aFillColor(rColors[a]); + rOutDev.SetFillColor(Color(aFillColor)); + } + + // create vcl PolyPolygon and draw it + if(a) + { + PolyPolygon aVclPolyPoly(aVclPolygons[a - 1L]); + aVclPolyPoly.Insert(aVclPolygons[a]); + rOutDev.DrawPolyPolygon(aVclPolyPoly); + } + else + { + PolyPolygon aVclPolyPoly(aVclTargetForm); + aVclPolyPoly.Insert(aVclPolygons[0L]); + rOutDev.DrawPolyPolygon(aVclPolyPoly); + } + } + + // draw last poly in last color + if(rColors.size()) + { + const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); + rOutDev.SetFillColor(Color(aFillColor)); + rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1L]); + } + + // reset drawmode + rOutDev.Pop(); + } + } // end of anonymous namespace +} // end of namespace drawinglayer + +namespace drawinglayer +{ + void impDrawGradientToOutDev( + OutputDevice& rOutDev, + const basegfx::B2DPolyPolygon& rTargetForm, + attribute::GradientStyle eGradientStyle, + sal_uInt32 nSteps, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple) + { + const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(rTargetForm)); + ::std::vector< basegfx::B2DHomMatrix > aMatrices; + ::std::vector< basegfx::BColor > aColors; + basegfx::B2DPolygon aUnitPolygon; + + if(attribute::GRADIENTSTYLE_RADIAL == eGradientStyle || attribute::GRADIENTSTYLE_ELLIPTICAL == eGradientStyle) + { + const basegfx::B2DPoint aCircleCenter(0.5, 0.5); + aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); + // aUnitPolygon = basegfx::tools::adaptiveSubdivideByAngle(aUnitPolygon); + } + else + { + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + } + + // make sure steps is not too high/low + nSteps = impCalcGradientSteps(rOutDev, nSteps, aOutlineRange, sal_uInt32((rStart.getMaximumDistance(rEnd) * 127.5) + 0.5)); + + // create geometries + switch(eGradientStyle) + { + case attribute::GRADIENTSTYLE_LINEAR: + { + texture::GeoTexSvxGradientLinear aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); + aGradient.appendTransformations(aMatrices); + aGradient.appendColors(aColors); + break; + } + case attribute::GRADIENTSTYLE_AXIAL: + { + texture::GeoTexSvxGradientAxial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); + aGradient.appendTransformations(aMatrices); + aGradient.appendColors(aColors); + break; + } + case attribute::GRADIENTSTYLE_RADIAL: + { + texture::GeoTexSvxGradientRadial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetY); + aGradient.appendTransformations(aMatrices); + aGradient.appendColors(aColors); + break; + } + case attribute::GRADIENTSTYLE_ELLIPTICAL: + { + texture::GeoTexSvxGradientElliptical aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); + aGradient.appendTransformations(aMatrices); + aGradient.appendColors(aColors); + break; + } + case attribute::GRADIENTSTYLE_SQUARE: + { + texture::GeoTexSvxGradientSquare aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); + aGradient.appendTransformations(aMatrices); + aGradient.appendColors(aColors); + break; + } + case attribute::GRADIENTSTYLE_RECT: + { + texture::GeoTexSvxGradientRect aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); + aGradient.appendTransformations(aMatrices); + aGradient.appendColors(aColors); + break; + } + } + + // paint them with mask using the XOR method + if(aMatrices.size()) + { + if(bSimple) + { + impDrawGradientToOutDevSimple(rOutDev, rTargetForm, aMatrices, aColors, aUnitPolygon); + } + else + { + impDrawGradientToOutDevComplex(rOutDev, rTargetForm, aMatrices, aColors, aUnitPolygon); + } + } + } +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/processor2d/vclhelpergradient.hxx b/drawinglayer/source/processor2d/vclhelpergradient.hxx new file mode 100644 index 000000000000..0b1932b88e93 --- /dev/null +++ b/drawinglayer/source/processor2d/vclhelpergradient.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclhelpergradient.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-03-06 12:34:17 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class OutputDevice; +namespace basegfx { + class B2DPolyPolygon; + class BColor; +} + +////////////////////////////////////////////////////////////////////////////// +// support methods for vcl direct gradient renderering + +namespace drawinglayer +{ + void impDrawGradientToOutDev( + OutputDevice& rOutDev, + const basegfx::B2DPolyPolygon& rTargetForm, + attribute::GradientStyle eGradientStyle, + sal_uInt32 nSteps, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple); +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX + +// eof diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 82eca6c26f26..122e53204785 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclprocessor2d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: hdu $ $Date: 2007-02-21 09:00:34 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:34:17 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,56 +37,32 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE_TEXTPRIMITIVE2D_HXX +#include +#endif + #ifndef _SV_OUTDEV_HXX #include #endif -#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX -#include +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX +#include #endif -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX -#include +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX +#include #endif -#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX -#include +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX +#include #endif #ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX #include #endif -#ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX -#include -#endif - -#ifndef _SV_BMPACC_HXX -#include -#endif - -#ifndef _SV_BITMAPEX_HXX -#include -#endif - -#ifndef _SV_VIRDEV_HXX -#include -#endif - -#ifndef _GRFMGR_HXX -#include -#endif - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE_TEXTPRIMITIVE2D_HXX -#include -#endif - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX -#include -#endif - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX -#include +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX +#include #endif #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX @@ -97,22 +73,38 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX +#include +#endif + #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX #include #endif -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX -#include +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX +#include #endif -#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX -#include +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX +#include #endif #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX #include #endif +#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBUFFERDEVICE_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX +#include +#endif + #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX #include #endif @@ -125,891 +117,21 @@ #include #endif -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// -// support methods for vcl direct gradeint renderering - -namespace drawinglayer -{ - namespace - { - sal_uInt32 impCalcGradientSteps(OutputDevice& rOutDev, sal_uInt32 nSteps, const basegfx::B2DRange& rRange, sal_uInt32 nMaxDist) - { - if(nSteps == 0L) - { - const Size aSize(rOutDev.LogicToPixel(Size(basegfx::fround(rRange.getWidth()), basegfx::fround(rRange.getHeight())))); - nSteps = (aSize.getWidth() + aSize.getHeight()) >> 3L; - } - - if(nSteps < 2L) - { - nSteps = 2L; - } - - if(nSteps > nMaxDist) - { - nSteps = nMaxDist; - } - - return nSteps; - } - - void impDrawGradientToOutDevSimple( - OutputDevice& rOutDev, - const basegfx::B2DPolyPolygon& rTargetForm, - const ::std::vector< basegfx::B2DHomMatrix >& rMatrices, - const ::std::vector< basegfx::BColor >& rColors, - const basegfx::B2DPolygon& rUnitPolygon) - { - rOutDev.SetLineColor(); - - for(sal_uInt32 a(0L); a < rColors.size(); a++) - { - // set correct color - const basegfx::BColor aFillColor(rColors[a]); - rOutDev.SetFillColor(Color(aFillColor)); - - if(a) - { - if(a - 1L < rMatrices.size()) - { - basegfx::B2DPolygon aNewPoly(rUnitPolygon); - aNewPoly.transform(rMatrices[a - 1L]); - rOutDev.DrawPolygon(Polygon(aNewPoly)); - } - } - else - { - rOutDev.DrawPolyPolygon(PolyPolygon(rTargetForm)); - } - } - } - - void impDrawGradientToOutDevComplex( - OutputDevice& rOutDev, - const basegfx::B2DPolyPolygon& rTargetForm, - const ::std::vector< basegfx::B2DHomMatrix >& rMatrices, - const ::std::vector< basegfx::BColor >& rColors, - const basegfx::B2DPolygon& rUnitPolygon) - { - PolyPolygon aVclTargetForm(rTargetForm); - ::std::vector< Polygon > aVclPolygons; - sal_uInt32 a; - - // remember and set to XOR - rOutDev.SetLineColor(); - rOutDev.Push(PUSH_RASTEROP); - rOutDev.SetRasterOp(ROP_XOR); - - // draw gradient PolyPolygons - for(a = 0L; a < rMatrices.size(); a++) - { - // create polygon and remember - basegfx::B2DPolygon aNewPoly(rUnitPolygon); - aNewPoly.transform(rMatrices[a]); - aVclPolygons.push_back(Polygon(aNewPoly)); - - // set correct color - if(rColors.size() > a) - { - const basegfx::BColor aFillColor(rColors[a]); - rOutDev.SetFillColor(Color(aFillColor)); - } - - // create vcl PolyPolygon and draw it - if(a) - { - PolyPolygon aVclPolyPoly(aVclPolygons[a - 1L]); - aVclPolyPoly.Insert(aVclPolygons[a]); - rOutDev.DrawPolyPolygon(aVclPolyPoly); - } - else - { - PolyPolygon aVclPolyPoly(aVclTargetForm); - aVclPolyPoly.Insert(aVclPolygons[0L]); - rOutDev.DrawPolyPolygon(aVclPolyPoly); - } - } - - // draw last poly in last color - if(rColors.size()) - { - const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); - rOutDev.SetFillColor(Color(aFillColor)); - rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1L]); - } - - // draw object form in black and go back to XOR - rOutDev.SetFillColor(COL_BLACK); - rOutDev.SetRasterOp(ROP_0); - rOutDev.DrawPolyPolygon(aVclTargetForm); - rOutDev.SetRasterOp(ROP_XOR); - - // draw gradient PolyPolygons again - for(a = 0L; a < rMatrices.size(); a++) - { - // set correct color - if(rColors.size() > a) - { - const basegfx::BColor aFillColor(rColors[a]); - rOutDev.SetFillColor(Color(aFillColor)); - } - - // create vcl PolyPolygon and draw it - if(a) - { - PolyPolygon aVclPolyPoly(aVclPolygons[a - 1L]); - aVclPolyPoly.Insert(aVclPolygons[a]); - rOutDev.DrawPolyPolygon(aVclPolyPoly); - } - else - { - PolyPolygon aVclPolyPoly(aVclTargetForm); - aVclPolyPoly.Insert(aVclPolygons[0L]); - rOutDev.DrawPolyPolygon(aVclPolyPoly); - } - } - - // draw last poly in last color - if(rColors.size()) - { - const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); - rOutDev.SetFillColor(Color(aFillColor)); - rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1L]); - } - - // reset drawmode - rOutDev.Pop(); - } - - void impDrawGradientToOutDev( - OutputDevice& rOutDev, - const basegfx::B2DPolyPolygon& rTargetForm, - attribute::GradientStyle eGradientStyle, - sal_uInt32 nSteps, - const basegfx::BColor& rStart, - const basegfx::BColor& rEnd, - double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple) - { - const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(rTargetForm)); - ::std::vector< basegfx::B2DHomMatrix > aMatrices; - ::std::vector< basegfx::BColor > aColors; - basegfx::B2DPolygon aUnitPolygon; - - if(attribute::GRADIENTSTYLE_RADIAL == eGradientStyle || attribute::GRADIENTSTYLE_ELLIPTICAL == eGradientStyle) - { - const basegfx::B2DPoint aCircleCenter(0.5, 0.5); - aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); - // aUnitPolygon = basegfx::tools::adaptiveSubdivideByAngle(aUnitPolygon); - } - else - { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); - } - - // make sure steps is not too high/low - nSteps = impCalcGradientSteps(rOutDev, nSteps, aOutlineRange, sal_uInt32((rStart.getMaximumDistance(rEnd) * 127.5) + 0.5)); - - // create geometries - switch(eGradientStyle) - { - case attribute::GRADIENTSTYLE_LINEAR: - { - texture::GeoTexSvxGradientLinear aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); - break; - } - case attribute::GRADIENTSTYLE_AXIAL: - { - texture::GeoTexSvxGradientAxial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); - break; - } - case attribute::GRADIENTSTYLE_RADIAL: - { - texture::GeoTexSvxGradientRadial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetY); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); - break; - } - case attribute::GRADIENTSTYLE_ELLIPTICAL: - { - texture::GeoTexSvxGradientElliptical aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); - break; - } - case attribute::GRADIENTSTYLE_SQUARE: - { - texture::GeoTexSvxGradientSquare aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); - break; - } - case attribute::GRADIENTSTYLE_RECT: - { - texture::GeoTexSvxGradientRect aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); - break; - } - } - - // paint them with mask using the XOR method - if(aMatrices.size()) - { - if(bSimple) - { - impDrawGradientToOutDevSimple(rOutDev, rTargetForm, aMatrices, aColors, aUnitPolygon); - } - else - { - impDrawGradientToOutDevComplex(rOutDev, rTargetForm, aMatrices, aColors, aUnitPolygon); - } - } - } - } // end of anonymous namespace -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// support for rendering Bitmap and BitmapEx contents - -namespace drawinglayer -{ - namespace - { - void impSmoothPoint(BitmapColor& rValue, const basegfx::B2DPoint& rSource, sal_Int32 nIntX, sal_Int32 nIntY, BitmapReadAccess& rRead) - { - double fDeltaX(rSource.getX() - nIntX); - double fDeltaY(rSource.getY() - nIntY); - sal_Int32 nIndX(0L); - sal_Int32 nIndY(0L); - - if(fDeltaX > 0.0 && nIntX + 1L < rRead.Width()) - { - nIndX++; - } - else if(fDeltaX < 0.0 && nIntX >= 1L) - { - fDeltaX = -fDeltaX; - nIndX--; - } - - if(fDeltaY > 0.0 && nIntY + 1L < rRead.Height()) - { - nIndY++; - } - else if(fDeltaY < 0.0 && nIntY >= 1L) - { - fDeltaY = -fDeltaY; - nIndY--; - } - - if(nIndX || nIndY) - { - const double fColorToReal(1.0 / 255.0); - double fR(rValue.GetRed() * fColorToReal); - double fG(rValue.GetGreen() * fColorToReal); - double fB(rValue.GetBlue() * fColorToReal); - double fRBottom(0.0), fGBottom(0.0), fBBottom(0.0); - - if(nIndX) - { - const double fMulA(fDeltaX * fColorToReal); - double fMulB(1.0 - fDeltaX); - const BitmapColor aTopPartner(rRead.GetColor(nIntY, nIntX + nIndX)); - - fR = (fR * fMulB) + (aTopPartner.GetRed() * fMulA); - fG = (fG * fMulB) + (aTopPartner.GetGreen() * fMulA); - fB = (fB * fMulB) + (aTopPartner.GetBlue() * fMulA); - - if(nIndY) - { - fMulB *= fColorToReal; - const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); - const BitmapColor aBottomPartner(rRead.GetColor(nIntY + nIndY, nIntX + nIndX)); - - fRBottom = (aBottom.GetRed() * fMulB) + (aBottomPartner.GetRed() * fMulA); - fGBottom = (aBottom.GetGreen() * fMulB) + (aBottomPartner.GetGreen() * fMulA); - fBBottom = (aBottom.GetBlue() * fMulB) + (aBottomPartner.GetBlue() * fMulA); - } - } - - if(nIndY) - { - if(!nIndX) - { - const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); - - fRBottom = aBottom.GetRed() * fColorToReal; - fGBottom = aBottom.GetGreen() * fColorToReal; - fBBottom = aBottom.GetBlue() * fColorToReal; - } - - const double fMulB(1.0 - fDeltaY); - - fR = (fR * fMulB) + (fRBottom * fDeltaY); - fG = (fG * fMulB) + (fGBottom * fDeltaY); - fB = (fB * fMulB) + (fBBottom * fDeltaY); - } - - rValue.SetRed((sal_uInt8)(fR * 255.0)); - rValue.SetGreen((sal_uInt8)(fG * 255.0)); - rValue.SetBlue((sal_uInt8)(fB * 255.0)); - } - } - - void impSmoothIndex(BitmapColor& rValue, const basegfx::B2DPoint& rSource, sal_Int32 nIntX, sal_Int32 nIntY, BitmapReadAccess& rRead) - { - double fDeltaX(rSource.getX() - nIntX); - double fDeltaY(rSource.getY() - nIntY); - sal_Int32 nIndX(0L); - sal_Int32 nIndY(0L); - - if(fDeltaX > 0.0 && nIntX + 1L < rRead.Width()) - { - nIndX++; - } - else if(fDeltaX < 0.0 && nIntX >= 1L) - { - fDeltaX = -fDeltaX; - nIndX--; - } - - if(fDeltaY > 0.0 && nIntY + 1L < rRead.Height()) - { - nIndY++; - } - else if(fDeltaY < 0.0 && nIntY >= 1L) - { - fDeltaY = -fDeltaY; - nIndY--; - } - - if(nIndX || nIndY) - { - const double fColorToReal(1.0 / 255.0); - double fVal(rValue.GetIndex() * fColorToReal); - double fValBottom(0.0); - - if(nIndX) - { - const double fMulA(fDeltaX * fColorToReal); - double fMulB(1.0 - fDeltaX); - const BitmapColor aTopPartner(rRead.GetPixel(nIntY, nIntX + nIndX)); - - fVal = (fVal * fMulB) + (aTopPartner.GetIndex() * fMulA); - - if(nIndY) - { - fMulB *= fColorToReal; - const BitmapColor aBottom(rRead.GetPixel(nIntY + nIndY, nIntX)); - const BitmapColor aBottomPartner(rRead.GetPixel(nIntY + nIndY, nIntX + nIndX)); - - fValBottom = (aBottom.GetIndex() * fMulB) + (aBottomPartner.GetIndex() * fMulA); - } - } - - if(nIndY) - { - if(!nIndX) - { - const BitmapColor aBottom(rRead.GetPixel(nIntY + nIndY, nIntX)); - - fValBottom = aBottom.GetIndex() * fColorToReal; - } - - const double fMulB(1.0 - fDeltaY); - - fVal = (fVal * fMulB) + (fValBottom * fDeltaY); - } - - rValue.SetIndex((sal_uInt8)(fVal * 255.0)); - } - } - - void impTransformBitmap(const Bitmap& rSource, Bitmap& rDestination, const basegfx::B2DHomMatrix& rTransform, bool bSmooth) - { - BitmapWriteAccess* pWrite = rDestination.AcquireWriteAccess(); - - if(pWrite) - { - const Size aContentSizePixel(rSource.GetSizePixel()); - BitmapReadAccess* pRead = (const_cast< Bitmap& >(rSource)).AcquireReadAccess(); - - if(pRead) - { - const Size aDestinationSizePixel(rDestination.GetSizePixel()); - bool bWorkWithIndex(rDestination.GetBitCount() <= 8); - BitmapColor aOutside(pRead->GetBestMatchingColor(BitmapColor(0xff, 0xff, 0xff))); - - for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++) - { - for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++) - { - const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y)); - const sal_Int32 nIntX(basegfx::fround(aSourceCoor.getX())); - - if(nIntX >= 0L && nIntX < aContentSizePixel.getWidth()) - { - const sal_Int32 nIntY(basegfx::fround(aSourceCoor.getY())); - - if(nIntY >= 0L && nIntY < aContentSizePixel.getHeight()) - { - if(bWorkWithIndex) - { - BitmapColor aValue(pRead->GetPixel(nIntY, nIntX)); - - if(bSmooth) - { - impSmoothIndex(aValue, aSourceCoor, nIntX, nIntY, *pRead); - } - - pWrite->SetPixel(y, x, aValue); - } - else - { - BitmapColor aValue(pRead->GetColor(nIntY, nIntX)); - - if(bSmooth) - { - impSmoothPoint(aValue, aSourceCoor, nIntX, nIntY, *pRead); - } - - pWrite->SetPixel(y, x, aValue.IsIndex() ? aValue : pWrite->GetBestMatchingColor(aValue)); - } - - continue; - } - } - - // here are outside pixels. Complete mask - if(bWorkWithIndex) - { - pWrite->SetPixel(y, x, aOutside); - } - } - } - - delete pRead; - } - - delete pWrite; - } - } - - Bitmap impCreateEmptyBitmapWithPattern(const Bitmap& rSource, const Size& aTargetSizePixel) - { - Bitmap aRetval; - BitmapReadAccess* pReadAccess = (const_cast< Bitmap& >(rSource)).AcquireReadAccess(); - - if(pReadAccess) - { - if(rSource.GetBitCount() <= 8) - { - BitmapPalette aPalette(pReadAccess->GetPalette()); - aRetval = Bitmap(aTargetSizePixel, rSource.GetBitCount(), &aPalette); - } - else - { - aRetval = Bitmap(aTargetSizePixel, rSource.GetBitCount()); - } - - delete pReadAccess; - } - - return aRetval; - } - - BitmapEx impTransformBitmapEx(const BitmapEx& rSource, const Rectangle &rCroppedRectPixel, const basegfx::B2DHomMatrix& rTransform) - { - // force destination to 24 bit, we want to smooth output - const Size aDestinationSize(rCroppedRectPixel.GetSize()); - Bitmap aDestination(impCreateEmptyBitmapWithPattern(rSource.GetBitmap(), aDestinationSize)); - static bool bDoSmoothAtAll(true); - impTransformBitmap(rSource.GetBitmap(), aDestination, rTransform, bDoSmoothAtAll); - - // create mask - if(rSource.IsTransparent()) - { - if(rSource.IsAlpha()) - { - Bitmap aAlpha(impCreateEmptyBitmapWithPattern(rSource.GetAlpha().GetBitmap(), aDestinationSize)); - impTransformBitmap(rSource.GetAlpha().GetBitmap(), aAlpha, rTransform, bDoSmoothAtAll); - return BitmapEx(aDestination, AlphaMask(aAlpha)); - } - else - { - Bitmap aMask(impCreateEmptyBitmapWithPattern(rSource.GetMask(), aDestinationSize)); - impTransformBitmap(rSource.GetMask(), aMask, rTransform, false); - return BitmapEx(aDestination, aMask); - } - } - - return BitmapEx(aDestination); - } - - } // end of anonymous namespace -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// support class for OutputDevice output with mask - -namespace drawinglayer -{ - namespace - { - class impBufferDevice - { - OutputDevice& mrOutDev; - VirtualDevice maContent; - VirtualDevice* mpMask; - VirtualDevice* mpAlpha; - Rectangle maDestPixel; - - public: - impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& rRange); - ~impBufferDevice(); - - void paint(double fTrans = 0.0); - bool isVisible() const { return !maDestPixel.IsEmpty(); } - VirtualDevice& getContent() { return maContent; } - VirtualDevice& getMask(); - VirtualDevice& getAlpha(); - }; - - impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& rRange) - : mrOutDev(rOutDev), - maContent(rOutDev), - mpMask(0L), - mpAlpha(0L) - { - const Rectangle aRectLogic( - (sal_Int32)floor(rRange.getMinX()), (sal_Int32)floor(rRange.getMinY()), - (sal_Int32)floor(rRange.getMaxX()) + 1L, (sal_Int32)floor(rRange.getMaxY()) + 1L); - const Rectangle aRectPixel(rOutDev.LogicToPixel(aRectLogic)); - const Point aEmptyPoint; - maDestPixel = Rectangle(aEmptyPoint, rOutDev.GetOutputSizePixel()); - maDestPixel.Intersection(aRectPixel); - - if(isVisible()) - { - maContent.SetOutputSizePixel(maDestPixel.GetSize(), false); - - const bool bWasEnabledSrc(rOutDev.IsMapModeEnabled()); - rOutDev.EnableMapMode(false); - maContent.DrawOutDev(aEmptyPoint, maDestPixel.GetSize(), maDestPixel.TopLeft(), maDestPixel.GetSize(), rOutDev); - rOutDev.EnableMapMode(bWasEnabledSrc); - - MapMode aNewMapMode(rOutDev.GetMapMode()); - const Point aLogicTopLeft(rOutDev.PixelToLogic(maDestPixel.TopLeft())); - aNewMapMode.SetOrigin(Point(-aLogicTopLeft.X(), -aLogicTopLeft.Y())); - - maContent.SetMapMode(aNewMapMode); - } - } - - impBufferDevice::~impBufferDevice() - { - delete mpMask; - delete mpAlpha; - } - - void impBufferDevice::paint(double fTrans) - { - const Point aEmptyPoint; - const Size aSizePixel(maContent.GetOutputSizePixel()); - const bool bWasEnabledDst(mrOutDev.IsMapModeEnabled()); - - mrOutDev.EnableMapMode(false); - maContent.EnableMapMode(false); - Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); - - if(mpAlpha) - { - mpAlpha->EnableMapMode(false); - AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel)); - mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); - } - else if(mpMask) - { - mpMask->EnableMapMode(false); - Bitmap aMask(mpMask->GetBitmap(aEmptyPoint, aSizePixel)); - mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aMask)); - } - else if(0.0 != fTrans) - { - sal_uInt8 nMaskValue((sal_uInt8)basegfx::fround(fTrans * 255.0)); - AlphaMask aAlphaMask(aSizePixel, &nMaskValue); - mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); - } - else - { - mrOutDev.DrawBitmap(maDestPixel.TopLeft(), aContent); - } - - mrOutDev.EnableMapMode(bWasEnabledDst); - } - - VirtualDevice& impBufferDevice::getMask() - { - if(!mpMask) - { - mpMask = new VirtualDevice(mrOutDev, 1); - mpMask->SetOutputSizePixel(maDestPixel.GetSize(), true); - mpMask->SetMapMode(maContent.GetMapMode()); - } - - return *mpMask; - } +#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX +#include +#endif - VirtualDevice& impBufferDevice::getAlpha() - { - if(!mpAlpha) - { - mpAlpha = new VirtualDevice(); - mpAlpha->SetOutputSizePixel(maDestPixel.GetSize(), true); - mpAlpha->SetMapMode(maContent.GetMapMode()); - } +#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX +#include +#endif - return *mpAlpha; - } - } // end of anonymous namespace -} // end of namespace drawinglayer +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif ////////////////////////////////////////////////////////////////////////////// -// support for different kinds of bitmap rendering using vcl - -namespace drawinglayer -{ - namespace - { - void RenderBitmapPrimitive2D_GraphicManager(OutputDevice& rOutDev, const BitmapEx& rBitmapEx, const basegfx::B2DHomMatrix& rTransform) - { - // prepare attributes - GraphicAttr aAttributes; - - // decompose matrix to check for shear, rotate and mirroring - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - rTransform.decompose(aScale, aTranslate, fRotate, fShearX); - - // mirror flags - aAttributes.SetMirrorFlags( - (basegfx::fTools::less(aScale.getX(), 0.0) ? BMP_MIRROR_HORZ : 0)| - (basegfx::fTools::less(aScale.getY(), 0.0) ? BMP_MIRROR_VERT : 0)); - - // rotation - if(!basegfx::fTools::equalZero(fRotate)) - { - double fRotation(fmod(3600.0 - (fRotate * (10.0 / F_PI180)), 3600.0)); - aAttributes.SetRotation((sal_uInt16)(fRotation)); - } - - // prepare Bitmap - basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); - - if(basegfx::fTools::equalZero(fRotate)) - { - aOutlineRange.transform(rTransform); - } - else - { - // if rotated, create the unrotated output rectangle for the GraphicManager paint - basegfx::B2DHomMatrix aSimpleObjectMatrix; - - aSimpleObjectMatrix.scale(fabs(aScale.getX()), fabs(aScale.getY())); - aSimpleObjectMatrix.translate(aTranslate.getX(), aTranslate.getY()); - - aOutlineRange.transform(aSimpleObjectMatrix); - } - - // prepare dest coor - const Rectangle aDestRectPixel( - basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()), - basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY())); - - // paint it using GraphicManager - Graphic aGraphic(rBitmapEx); - GraphicObject aGraphicObject(aGraphic); - aGraphicObject.Draw(&rOutDev, aDestRectPixel.TopLeft(), aDestRectPixel.GetSize(), &aAttributes); - } - - void RenderBitmapPrimitive2D_BitmapEx(OutputDevice& rOutDev, const BitmapEx& rBitmapEx, const basegfx::B2DHomMatrix& rTransform) - { - // only translate and scale, use vcl's DrawBitmapEx(). - BitmapEx aContent(rBitmapEx); - - // prepare dest coor. Necessary to expand since vcl's DrawBitmapEx draws one pix less - basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); - aOutlineRange.transform(rTransform); - const Rectangle aDestRectPixel( - basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()), - basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY())); - - // decompose matrix to check for shear, rotate and mirroring - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - rTransform.decompose(aScale, aTranslate, fRotate, fShearX); - - // Check mirroring. - sal_uInt32 nMirrorFlags(BMP_MIRROR_NONE); - - if(basegfx::fTools::less(aScale.getX(), 0.0)) - { - nMirrorFlags |= BMP_MIRROR_HORZ; - } - - if(basegfx::fTools::less(aScale.getY(), 0.0)) - { - nMirrorFlags |= BMP_MIRROR_VERT; - } - - if(BMP_MIRROR_NONE != nMirrorFlags) - { - aContent.Mirror(nMirrorFlags); - } - // draw bitmap - rOutDev.DrawBitmapEx(aDestRectPixel.TopLeft(), aDestRectPixel.GetSize(), aContent); - } - - void RenderBitmapPrimitive2D_self(OutputDevice& rOutDev, const BitmapEx& rBitmapEx, const basegfx::B2DHomMatrix& rTransform) - { - // process self with free transformation (containing shear and rotate). Get dest rect in pixels. - basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); - aOutlineRange.transform(rTransform); - const Rectangle aDestRectLogic( - basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()), - basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY())); - const Rectangle aDestRectPixel(rOutDev.LogicToPixel(aDestRectLogic)); - - // intersect with output pixel size - const Rectangle aOutputRectPixel(Point(), rOutDev.GetOutputSizePixel()); - const Rectangle aCroppedRectPixel(aDestRectPixel.GetIntersection(aOutputRectPixel)); - - if(!aCroppedRectPixel.IsEmpty()) - { - // build transform from pixel in aDestination to pixel in rBitmapEx - basegfx::B2DHomMatrix aTransform; - - // from relative in aCroppedRectPixel to relative in aDestRectPixel - aTransform.translate(aCroppedRectPixel.Left() - aDestRectPixel.Left(), aCroppedRectPixel.Top() - aDestRectPixel.Top()); - - // from relative in aDestRectPixel to absolute Logic - aTransform.scale((double)aDestRectLogic.getWidth() / (double)aDestRectPixel.getWidth(), (double)aDestRectLogic.getHeight() / (double)aDestRectPixel.getHeight()); - aTransform.translate(aDestRectLogic.Left(), aDestRectLogic.Top()); - - // from absolute in Logic to unified object coordinates (0.0 .. 1.0 in x and y) - basegfx::B2DHomMatrix aInvBitmapTransform(rTransform); - aInvBitmapTransform.invert(); - aTransform = aInvBitmapTransform * aTransform; - - // from unit object coordinates to rBitmapEx pixel coordintes - const Size aSourceSizePixel(rBitmapEx.GetSizePixel()); - aTransform.scale(aSourceSizePixel.getWidth() - 1L, aSourceSizePixel.getHeight() - 1L); - - // create bitmap using source, destination and linear back-transformation - BitmapEx aDestination = impTransformBitmapEx(rBitmapEx, aCroppedRectPixel, aTransform); - - // paint - const bool bWasEnabled(rOutDev.IsMapModeEnabled()); - rOutDev.EnableMapMode(false); - rOutDev.DrawBitmapEx(aCroppedRectPixel.TopLeft(), aDestination); - rOutDev.EnableMapMode(bWasEnabled); - } - } - - BitmapEx impModifyBitmapEx(const basegfx::BColorModifierStack& rBColorModifierStack, const BitmapEx& rSource) - { - Bitmap aChangedBitmap(rSource.GetBitmap()); - bool bDone(false); - - for(sal_uInt32 a(rBColorModifierStack.count()); a && !bDone; ) - { - const basegfx::BColorModifier& rModifier = rBColorModifierStack.getBColorModifier(--a); - - switch(rModifier.getMode()) - { - case basegfx::BCOLORMODIFYMODE_REPLACE : - { - // complete replace - if(rSource.IsTransparent()) - { - // clear bitmap with dest color - aChangedBitmap.Erase(Color(rModifier.getBColor())); - } - else - { - // erase bitmap, caller will know to paint direct - aChangedBitmap.SetEmpty(); - } - - bDone = true; - break; - } - - default : // BCOLORMODIFYMODE_INTERPOLATE, BCOLORMODIFYMODE_GRAY, BCOLORMODIFYMODE_BLACKANDWHITE - { - BitmapWriteAccess* pContent = aChangedBitmap.AcquireWriteAccess(); - - if(pContent) - { - const double fConvertColor(1.0 / 255.0); - - for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); y++) - { - for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++) - { - const BitmapColor aBMCol(pContent->GetColor(y, x)); - const basegfx::BColor aBSource( - (double)aBMCol.GetRed() * fConvertColor, - (double)aBMCol.GetGreen() * fConvertColor, - (double)aBMCol.GetBlue() * fConvertColor); - const basegfx::BColor aBDest(rModifier.getModifiedColor(aBSource)); - - pContent->SetPixel(y, x, BitmapColor(Color(aBDest))); - } - } - - delete pContent; - } - - break; - } - } - } - - if(aChangedBitmap.IsEmpty()) - { - return BitmapEx(); - } - else - { - if(rSource.IsTransparent()) - { - if(rSource.IsAlpha()) - { - return BitmapEx(aChangedBitmap, rSource.GetAlpha()); - } - else - { - return BitmapEx(aChangedBitmap, rSource.GetMask()); - } - } - else - { - return BitmapEx(aChangedBitmap); - } - } - } - } // end of anonymous namespace -} // end of namespace drawinglayer +using namespace com::sun::star; ////////////////////////////////////////////////////////////////////////////// @@ -1147,10 +269,6 @@ namespace drawinglayer // set Shadow attribute if( pTCPP->getShadow() ) aFont.SetShadow( true ); - - // set Outline attribute - if( pTCPP->getOutline() ) - aFont.SetOutline( true ); } mpOutputDevice->SetFont(aFont); @@ -1197,7 +315,20 @@ namespace drawinglayer basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(maCurrentTransformation); - mpOutputDevice->DrawPolyLine(Polygon(aLocalPolygon)); + if(maCurrentClipPolyPolygon.count()) + { + const basegfx::B2DPolyPolygon aClippedPolyPolygon(basegfx::tools::clipPolygonOnPolyPolygon(aLocalPolygon, maCurrentClipPolyPolygon, true, false)); + + for(sal_uInt32 a(0L); a < aClippedPolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aClippedPolygon(aClippedPolyPolygon.getB2DPolygon(a)); + mpOutputDevice->DrawPolyLine(Polygon(aClippedPolygon)); + } + } + else + { + mpOutputDevice->DrawPolyLine(Polygon(aLocalPolygon)); + } } // direct draw of transformed BitmapEx primitive @@ -1438,6 +569,11 @@ namespace drawinglayer basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon()); aLocalPolyPolygon.transform(maCurrentTransformation); + if(maCurrentClipPolyPolygon.count()) + { + aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(aLocalPolyPolygon, maCurrentClipPolyPolygon, false, false); + } + mpOutputDevice->DrawPolyPolygon(PolyPolygon(aLocalPolyPolygon)); } @@ -1489,30 +625,67 @@ namespace drawinglayer if(rMaskCandidate.getChildren().hasElements()) { basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask()); - aMask.transform(maCurrentTransformation); - const basegfx::B2DRange aRange(basegfx::tools::getRange(aMask)); - impBufferDevice aBufferDevice(*mpOutputDevice, aRange); - if(aBufferDevice.isVisible()) + if(aMask.count()) { - // remember last OutDev and set to content - OutputDevice* pLastOutputDevice = mpOutputDevice; - mpOutputDevice = &aBufferDevice.getContent(); + aMask.transform(maCurrentTransformation); - // paint to it - process(rMaskCandidate.getChildren()); + if(isOutputToRecordingMetaFile() || isOutputToPrinter()) + { + // vector output; use ClipPolyPolygon + if(maCurrentClipPolyPolygon.count()) + { + // rescue current + const basegfx::B2DPolyPolygon aOldClipPolyPolygon(maCurrentClipPolyPolygon); - // back to old OutDev - mpOutputDevice = pLastOutputDevice; + // create and set new + maCurrentClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(aMask, maCurrentClipPolyPolygon, false, false); - // draw mask - VirtualDevice& rMask = aBufferDevice.getMask(); - rMask.SetLineColor(); - rMask.SetFillColor(COL_BLACK); - rMask.DrawPolyPolygon(PolyPolygon(aMask)); + // process with new ClipPolyPoygon + process(rMaskCandidate.getChildren()); - // dump buffer to outdev - aBufferDevice.paint(); + // restore old + maCurrentClipPolyPolygon = aOldClipPolyPolygon; + } + else + { + // set new + maCurrentClipPolyPolygon = aMask; + + // process with new ClipPolyPoygon + process(rMaskCandidate.getChildren()); + + // restore old + maCurrentClipPolyPolygon.clear(); + } + } + else + { + const basegfx::B2DRange aRange(basegfx::tools::getRange(aMask)); + impBufferDevice aBufferDevice(*mpOutputDevice, aRange); + + if(aBufferDevice.isVisible()) + { + // remember last OutDev and set to content + OutputDevice* pLastOutputDevice = mpOutputDevice; + mpOutputDevice = &aBufferDevice.getContent(); + + // paint to it + process(rMaskCandidate.getChildren()); + + // back to old OutDev + mpOutputDevice = pLastOutputDevice; + + // draw mask + VirtualDevice& rMask = aBufferDevice.getMask(); + rMask.SetLineColor(); + rMask.SetFillColor(COL_BLACK); + rMask.DrawPolyPolygon(PolyPolygon(aMask)); + + // dump buffer to outdev + aBufferDevice.paint(); + } + } } } } @@ -1589,7 +762,7 @@ namespace drawinglayer { const std::vector< basegfx::B2DPoint >& rPositions = rMarkArrayCandidate.getPositions(); const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rMarkArrayCandidate.getRGBColor())); - const Color aColor(aRGBColor); + const Color aVCLColor(aRGBColor); if(primitive2d::MARKERSTYLE2D_POINT == rMarkArrayCandidate.getStyle()) { @@ -1598,7 +771,7 @@ namespace drawinglayer const basegfx::B2DPoint aViewPosition(maCurrentTransformation * (*aIter)); const Point aPos(basegfx::fround(aViewPosition.getX()), basegfx::fround(aViewPosition.getY())); - mpOutputDevice->DrawPixel(aPos, aColor); + mpOutputDevice->DrawPixel(aPos, aVCLColor); } } else @@ -1609,46 +782,43 @@ namespace drawinglayer { const basegfx::B2DPoint aViewPosition(maCurrentTransformation * (*aIter)); Point aPos(basegfx::fround(aViewPosition.getX()), basegfx::fround(aViewPosition.getY())); - aPos = mpOutputDevice->LogicToPixel(aPos); + aPos = mpOutputDevice->LogicToPixel(aPos); mpOutputDevice->EnableMapMode(false); switch(rMarkArrayCandidate.getStyle()) { + default : // not implemented types; MARKERSTYLE2D_POINT is already handled above + { + break; + } case primitive2d::MARKERSTYLE2D_CROSS : { - mpOutputDevice->DrawPixel(aPos, aColor); - mpOutputDevice->DrawPixel(Point(aPos.X() - 1L, aPos.Y()), aColor); - mpOutputDevice->DrawPixel(Point(aPos.X() + 1L, aPos.Y()), aColor); - mpOutputDevice->DrawPixel(Point(aPos.X(), aPos.Y() - 1L), aColor); - mpOutputDevice->DrawPixel(Point(aPos.X(), aPos.Y() + 1L), aColor); + mpOutputDevice->DrawPixel(aPos, aVCLColor); + mpOutputDevice->DrawPixel(Point(aPos.X() - 1L, aPos.Y()), aVCLColor); + mpOutputDevice->DrawPixel(Point(aPos.X() + 1L, aPos.Y()), aVCLColor); + mpOutputDevice->DrawPixel(Point(aPos.X(), aPos.Y() - 1L), aVCLColor); + mpOutputDevice->DrawPixel(Point(aPos.X(), aPos.Y() + 1L), aVCLColor); break; } case primitive2d::MARKERSTYLE2D_GLUEPOINT : { // backpen - mpOutputDevice->SetLineColor(aColor); + mpOutputDevice->SetLineColor(aVCLColor); mpOutputDevice->DrawLine(aPos + Point(-2, -3), aPos + Point(+3, +2)); mpOutputDevice->DrawLine(aPos + Point(-3, -2), aPos + Point(+2, +3)); mpOutputDevice->DrawLine(aPos + Point(-3, +2), aPos + Point(+2, -3)); mpOutputDevice->DrawLine(aPos + Point(-2, +3), aPos + Point(+3, -2)); // frontpen (hard coded) - Color aFrontColor(COL_LIGHTBLUE); - const basegfx::BColor aRGBFrontColor(maBColorModifierStack.getModifiedColor(aFrontColor.getBColor())); - aFrontColor = Color(aRGBFrontColor); - - mpOutputDevice->SetLineColor(aFrontColor); + const basegfx::BColor aRGBFrontColor(maBColorModifierStack.getModifiedColor(Color(COL_LIGHTBLUE).getBColor())); + mpOutputDevice->SetLineColor(Color(aRGBFrontColor)); mpOutputDevice->DrawLine(aPos + Point(-2, -2), aPos + Point(+2, +2)); mpOutputDevice->DrawLine(aPos + Point(-2, +2), aPos + Point(+2, -2)); break; } - default : // primitive2d::MARKERSTYLE2D_POINT - { - break; - } } mpOutputDevice->EnableMapMode(bWasEnabled); @@ -1680,74 +850,99 @@ namespace drawinglayer // it is a BasePrimitive2D implementation, use getPrimitiveID() call for switch switch(pBasePrimitive->getPrimitiveID()) { - case Create2DPrimitiveID('2','T','S','i') : - case Create2DPrimitiveID('2','T','D','o') : + case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D : + case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D : { // directdraw of text simple portion RenderTextSimplePortionPrimitive2D(static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','P','H','a') : + case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D : { // direct draw of hairline RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','B','i','t') : + case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D : { // direct draw of transformed BitmapEx primitive RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','F','B','i') : + case PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D : { - // direct draw of fillBitmapPrimitive - RenderFillBitmapPrimitive2D(static_cast< const primitive2d::FillBitmapPrimitive2D& >(*pBasePrimitive)); + const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate(static_cast< const primitive2d::FillBitmapPrimitive2D& >(*pBasePrimitive)); + + if(isOutputToRecordingMetaFile() || isOutputToPrinter()) + { + // vector device or printer + // do not use VDev but use decompose which creates BitmapPrimitive2D's + process(pBasePrimitive->get2DDecomposition(getViewInformation2D())); + } + else + { + // pixel device + // direct draw of fillBitmapPrimitive + RenderFillBitmapPrimitive2D(rFillBitmapCandidate); + } break; } - case Create2DPrimitiveID('2','P','P','G') : + case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D : { - // direct draw of gradient - RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(*pBasePrimitive)); + const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(*pBasePrimitive)); + + if(isOutputToRecordingMetaFile() || isOutputToPrinter()) + { + // vector device or printer + // do not use VDev but use decompose which creates a mask primitive which then + // is used for clipping + process(pBasePrimitive->get2DDecomposition(getViewInformation2D())); + } + else + { + // pixel device + // direct draw of gradient + RenderPolyPolygonGradientPrimitive2D(rPolygonCandidate); + } break; } - case Create2DPrimitiveID('2','P','P','C') : + case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D : { // direct draw of PolyPolygon with color RenderPolyPolygonColorPrimitive2D(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','M','e','t') : + case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D : { // direct draw of MetaFile RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','M','a','s') : + case PRIMITIVE2D_ID_MASKPRIMITIVE2D : { - // mask group. Force output to VDev and create mask from given mask + // mask group. RenderMaskPrimitive2D(static_cast< const primitive2d::MaskPrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','M','C','o') : + case PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D : { // modified color group. Force output to unified color. RenderModifiedColorPrimitive2D(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','A','l','p') : + case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : { // sub-transparence group. Draw to VDev first. RenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','T','r','a') : + case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D : { // transform group. RenderTransformPrimitive2D(static_cast< const primitive2d::TransformPrimitive2D& >(*pBasePrimitive)); break; } - case Create2DPrimitiveID('2','M','a','r') : + case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D : { // marker array RenderMarkerArrayPrimitive2D(static_cast< const primitive2d::MarkerArrayPrimitive2D& >(*pBasePrimitive)); @@ -1781,19 +976,24 @@ namespace drawinglayer const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev) : BaseProcessor2D(rViewInformation), - mbOutputToRecordingMetaFile(false) + mpOutputDevice(&rOutDev), + maBColorModifierStack(), + maCurrentTransformation(), + maCurrentClipPolyPolygon(), + mbOutputToRecordingMetaFile(false), + mbOutputToPrinter(false) { - // initialize destination OutDev - mpOutputDevice = &rOutDev; - // check if output is recorded to metafile const GDIMetaFile* pMetaFile = mpOutputDevice->GetConnectMetaFile(); mbOutputToRecordingMetaFile = (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); - if(mbOutputToRecordingMetaFile) + if(isOutputToRecordingMetaFile()) { // draw to logic coordinates, do not initialize maCurrentTransformation to viewTransformation, // do not change MapMode of destination + + // look for printer output, too + mbOutputToPrinter = (OUTDEV_PRINTER == mpOutputDevice->GetOutDevType()); } else { @@ -1808,8 +1008,9 @@ namespace drawinglayer VclProcessor2D::~VclProcessor2D() { - if(mbOutputToRecordingMetaFile) + if(isOutputToRecordingMetaFile()) { + // MapMode was not changed, no restore necessary } else { diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 5e3d821fbb8e..301867f1b467 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: defaultprocessor3d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2006-12-13 16:57:09 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:35:55 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -111,6 +111,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// namespace basegfx @@ -1716,14 +1720,14 @@ namespace drawinglayer // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch switch(pBasePrimitive->getPrimitiveID()) { - case Create3DPrimitiveID('3','G','T','e') : + case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D : { // GradientTexturePrimitive3D const primitive3d::GradientTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::GradientTexturePrimitive3D& >(*pBasePrimitive); impRender_GRX3(rPrimitive, false); break; } - case Create3DPrimitiveID('3','H','T','e') : + case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : { // HatchTexturePrimitive3D static bool bDoHatchDecomposition(true); @@ -1741,14 +1745,14 @@ namespace drawinglayer } break; } - case Create3DPrimitiveID('3','B','T','e') : + case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D : { // BitmapTexturePrimitive3D const primitive3d::BitmapTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::BitmapTexturePrimitive3D& >(*pBasePrimitive); impRender_BMX3(rPrimitive); break; } - case Create3DPrimitiveID('3','A','T','e') : + case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : { // AlphaTexturePrimitive3D const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(*pBasePrimitive); @@ -1763,7 +1767,7 @@ namespace drawinglayer } break; } - case Create3DPrimitiveID('3','M','C','o') : + case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D : { // ModifiedColorPrimitive3D // Force output to unified color. @@ -1771,7 +1775,7 @@ namespace drawinglayer impRender_MCOL(rPrimitive); break; } - case Create3DPrimitiveID('3','P','H','a') : + case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : { // directdraw of PolygonHairlinePrimitive3D const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(*pBasePrimitive); @@ -1782,7 +1786,7 @@ namespace drawinglayer } break; } - case Create3DPrimitiveID('3','P','P','M') : + case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : { // directdraw of PolyPolygonMaterialPrimitive3D const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive); @@ -1793,13 +1797,13 @@ namespace drawinglayer } break; } - case Create3DPrimitiveID('3','T','r','a') : + case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : { // transform group (TransformPrimitive3D) impRender_TRN3(static_cast< const primitive3d::TransformPrimitive3D& >(*pBasePrimitive)); break; } - case Create3DPrimitiveID('3','L','a','b') : + case PRIMITIVE3D_ID_SDRLABELPRIMITIVE3D : { // SdrLabelPrimitive3D. Accept, but ignore. Is handled by the scenePrimitive decompose // method which creates 2d text objects at the 3d-projection-dependent positions. diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 3b409628a951..109e4cb40faa 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -4,9 +4,9 @@ * * $RCSfile: shadow3dextractor.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-11-28 11:03:58 $ + * last change: $Author: aw $ $Date: 2007-03-06 12:35:55 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -81,6 +81,10 @@ #include #endif +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -169,7 +173,7 @@ namespace drawinglayer // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch switch(pBasePrimitive->getPrimitiveID()) { - case Create3DPrimitiveID('3','S','h','a') : + case PRIMITIVE3D_ID_SHADOWPRIMITIVE3D : { // shadow3d object. Call recursive with content and start conversion const primitive3d::ShadowPrimitive3D& rPrimitive = static_cast< const primitive3d::ShadowPrimitive3D& >(*pBasePrimitive); @@ -212,7 +216,7 @@ namespace drawinglayer } break; } - case Create3DPrimitiveID('3','T','r','a') : + case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : { // transform group. Remember current transformations const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(*pBasePrimitive); @@ -231,7 +235,7 @@ namespace drawinglayer maWorldToEye = aLastWorldToEye; break; } - case Create3DPrimitiveID('3','P','H','a') : + case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : { // PolygonHairlinePrimitive3D if(mbConvert) @@ -260,7 +264,7 @@ namespace drawinglayer } break; } - case Create3DPrimitiveID('3','P','P','M') : + case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : { // PolyPolygonMaterialPrimitive3D if(mbConvert) @@ -289,7 +293,7 @@ namespace drawinglayer } break; } - case Create3DPrimitiveID('3','L','a','b') : + case PRIMITIVE3D_ID_SDRLABELPRIMITIVE3D : { // SdrLabelPrimitive3D // has no 3d shadow, accept and ignore diff --git a/drawinglayer/util/makefile.mk b/drawinglayer/util/makefile.mk index 9cd9206e8ca7..3bcbf24ed44e 100644 --- a/drawinglayer/util/makefile.mk +++ b/drawinglayer/util/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.6 $ +# $Revision: 1.7 $ # -# last change: $Author: aw $ $Date: 2006-10-19 10:26:01 $ +# last change: $Author: aw $ $Date: 2007-03-06 12:36:13 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -63,9 +63,12 @@ SHL1STDLIBS=\ $(VCLLIB) \ $(BASEGFXLIB) \ $(TOOLSLIB) \ + $(SVTOOLLIB) \ $(SALLIB) \ $(CPPUHELPERLIB) \ - $(CPPULIB) + $(CPPULIB) \ + $(AVMEDIALIB) \ + $(COMPHELPERLIB) SHL1DEF= $(MISC)$/$(SHL1TARGET).def SHL1LIBS= $(SLB)$/drawinglayer.lib -- cgit