summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@Sun.COM>2009-11-12 11:26:43 +0100
committerArmin Le Grand <Armin.Le.Grand@Sun.COM>2009-11-12 11:26:43 +0100
commit15dcfdd7c813c4158a18c52c7ba22c14c7dac996 (patch)
tree6d144b4da1dacfce5271bdeb76312e01841d5f10
parent95ccca996e41c0ff9fa70fb5007f06796a98bc1c (diff)
aw078 #i106541# commited in-between stable version with already advanced metafile decomposition for security reasons
-rw-r--r--drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx12
-rw-r--r--drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx116
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx93
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx5
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx29
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx5
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx83
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx82
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx110
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx21
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx99
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx80
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx167
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx102
-rw-r--r--drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx6
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx2
-rw-r--r--drawinglayer/prj/d.lst2
-rw-r--r--drawinglayer/source/attribute/fillbitmapattribute.cxx16
-rw-r--r--drawinglayer/source/attribute/fontattribute.cxx63
-rw-r--r--drawinglayer/source/attribute/makefile.mk1
-rw-r--r--drawinglayer/source/attribute/sdrfillbitmapattribute.cxx2
-rw-r--r--drawinglayer/source/primitive2d/bitmapprimitive2d.cxx4
-rw-r--r--drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx124
-rw-r--r--drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx6
-rw-r--r--drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx174
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx504
-rw-r--r--drawinglayer/source/primitive2d/makefile.mk4
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx2485
-rw-r--r--drawinglayer/source/primitive2d/primitivetools2d.cxx72
-rw-r--r--drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx403
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx48
-rw-r--r--drawinglayer/source/primitive2d/textlineprimitive2d.cxx317
-rw-r--r--drawinglayer/source/primitive2d/textprimitive2d.cxx41
-rw-r--r--drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx294
-rw-r--r--drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx276
-rw-r--r--drawinglayer/source/primitive3d/textureprimitive3d.cxx6
-rw-r--r--drawinglayer/source/processor2d/canvasprocessor.cxx18
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx52
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx25
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx61
-rw-r--r--drawinglayer/source/processor3d/defaultprocessor3d.cxx6
-rw-r--r--svx/source/sdr/overlay/overlayselection.cxx11
-rw-r--r--svx/source/svdraw/svdfmtf.cxx18
-rw-r--r--svx/source/svdraw/svdograf.cxx2
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx65
-rw-r--r--svx/source/svdraw/svdotextpathdecomposition.cxx8
47 files changed, 5363 insertions, 759 deletions
diff --git a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx
index 4e316232bd81..376e1d626927 100644
--- a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx
+++ b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx
@@ -36,7 +36,7 @@
#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
-#include <vcl/bitmap.hxx>
+#include <vcl/bitmapex.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dvector.hxx>
@@ -56,7 +56,7 @@ namespace drawinglayer
{
class FillBitmapAttribute
{
- Bitmap maBitmap;
+ BitmapEx maBitmapEx;
basegfx::B2DPoint maTopLeft;
basegfx::B2DVector maSize;
@@ -64,11 +64,15 @@ namespace drawinglayer
unsigned mbTiling : 1;
public:
- FillBitmapAttribute(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling);
+ FillBitmapAttribute(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft,
+ const basegfx::B2DVector& rSize,
+ bool bTiling);
bool operator==(const FillBitmapAttribute& rCandidate) const;
// data access
- const Bitmap& getBitmap() const { return maBitmap; }
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; }
const basegfx::B2DVector& getSize() const { return maSize; }
bool getTiling() const { return mbTiling; }
diff --git a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx
new file mode 100644
index 000000000000..f34ee913418f
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: strokeattribute.hxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11: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_ATTRIBUTE_FONTATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+#include <tools/string.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ /** FontAttribute class
+
+ This attribute class is able to hold all parameters needed/used
+ to completely define the parametrisation of a text portion.
+ */
+ class FontAttribute
+ {
+ private:
+ /// core data
+ String maFamilyName; // Font Family Name
+ String maStyleName; // Font Style Name
+ sal_uInt16 mnWeight; // Font weight
+
+ /// bitfield
+ unsigned mbSymbol : 1; // Symbol Font Flag
+ unsigned mbVertical : 1; // Vertical Text Flag
+ unsigned mbItalic : 1; // Italic Flag
+ unsigned mbOutline : 1; // Outline Flag
+ unsigned mbRTL : 1; // RTL Flag
+ unsigned mbBiDiStrong : 1; // BiDi Flag
+ // TODO: pair kerning and CJK kerning
+
+ public:
+ /// constructor
+ FontAttribute(
+ const String& rFamilyName,
+ const String& rStyleName,
+ sal_uInt16 nWeight,
+ bool bSymbol = false,
+ bool bVertical = false,
+ bool bItalic = false,
+ bool bOutline = false,
+ bool bRTL = false,
+ bool bBiDiStrong = false)
+ : maFamilyName(rFamilyName),
+ maStyleName(rStyleName),
+ mnWeight(nWeight),
+ mbSymbol(bSymbol),
+ mbVertical(bVertical),
+ mbItalic(bItalic),
+ mbOutline(bOutline),
+ mbRTL(bRTL),
+ mbBiDiStrong(bBiDiStrong)
+ {
+ }
+
+ /// compare operator
+ bool operator==(const FontAttribute& rCompare) const;
+
+ /// data read access
+ const String& getFamilyName() const { return maFamilyName; }
+ const String& getStyleName() const { return maStyleName; }
+ sal_uInt16 getWeight() const { return mnWeight; }
+ bool getSymbol() const { return mbSymbol; }
+ bool getVertical() const { return mbVertical; }
+ bool getItalic() const { return mbItalic; }
+ bool getOutline() const { return mbOutline; }
+ bool getRTL() const { return mbRTL; }
+ bool getBiDiStrong() const { return mbBiDiStrong; }
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
new file mode 100644
index 000000000000..04ddb73460fa
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bitmapprimitive2d.hxx,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11: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_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// DiscreteBitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteBitmapPrimitive2D class
+
+ This class defines a view-dependent BitmapPrimitive which has a
+ logic position for the top-left position and is always to be
+ painted in 1:1 pixel resolution. It will never be sheared, rotated
+ or scaled with the view.
+ */
+ class DiscreteBitmapPrimitive2D : public ObjectAndViewTransformationDependentPrimitive2D
+ {
+ private:
+ /// the RGBA Bitmap-data
+ BitmapEx maBitmapEx;
+
+ /** the top-left object position */
+ basegfx::B2DPoint maTopLeft;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ DiscreteBitmapPrimitive2D(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 8d5d089f5800..477c3a19042a 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -103,6 +103,11 @@
#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
+#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
+#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
+#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
+#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
+#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
index d6853e69b149..0fd084c6fad0 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
@@ -40,7 +40,12 @@
#include <drawinglayer/attribute/fillattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
-// FillbitmapPrimitive2D class
+// predefines
+
+namespace basegfx { class B2DPolygon; }
+
+//////////////////////////////////////////////////////////////////////////////
+// FillGradientPrimitive2D class
namespace drawinglayer
{
@@ -53,6 +58,12 @@ namespace drawinglayer
The decomposition will deliver the decomposed gradient, e.g. for an ellipse
gradient the various ellipses in various color steps will be created.
+
+ I have added functionality to create both versions of filled decompositions:
+ Those who overlap and non-overlapping ones. The overlapping version is the
+ default one since it works with and without AntiAliasing. The non-overlapping
+ version is used in the MetafilePrimitive2D decomposition when the old XOR
+ paint was recorded.
*/
class FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D
{
@@ -63,7 +74,23 @@ namespace drawinglayer
/// the gradient definition
attribute::FillGradientAttribute maFillGradient;
+ /// local helpers
+ void generateMatricesAndColors(
+ std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ std::vector< basegfx::BColor >& rColors) const;
+ Primitive2DSequence createOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+ Primitive2DSequence createNonOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+
protected:
+ /// local helper
+ Primitive2DSequence createFill(bool bOverlapping) const;
+
/// local decomposition.
virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx
index 9ba7e7796395..85f1c6510c5a 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx
@@ -44,7 +44,7 @@ namespace drawinglayer
{
namespace primitive2d
{
- /** HitTestPrimitive2D class
+ /** InvertPrimitive2D class
This is a helper class which encapsulates geometry that should be
painted XOR, e.g. old cursor visualisations. It decomposes to
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx
index 039db9387024..0cbd7e4628cb 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx
@@ -67,7 +67,7 @@ namespace drawinglayer
have many advantages; Metafile would no longer have to be rendered by
sub-systems and a standard way for converting Metafiles would exist.
*/
- class MetafilePrimitive2D : public BasePrimitive2D
+ class MetafilePrimitive2D : public BufferedDecompositionPrimitive2D
{
private:
/// the geometry definition
@@ -76,6 +76,9 @@ namespace drawinglayer
/// the content definition
GDIMetaFile maMetaFile;
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
public:
/// constructor
MetafilePrimitive2D(
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx
index 77d56ca8026f..a095c558ba12 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx
@@ -37,6 +37,7 @@
#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -118,6 +119,88 @@ namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ regarding the complete Viewtransformation. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ */
+ class ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation definition for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+
+ public:
+ /// constructor
+ ViewTransformationDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewTransformation()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ObjectAndViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ and Object-Transform dependent. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ and an object transformation via getObjectTransformation()
+ */
+ class ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation and the last ObjectTransformation
+ definition for decomposition. Since this is checked and updated from
+ get2DDecomposition() it will be current and usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ public:
+ /// constructor
+ ObjectAndViewTransformationDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewTransformation(),
+ maObjectTransformation()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
index 4f33c8a7d48b..6c7ea8bd24c5 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -37,6 +37,7 @@
#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
// predeclarations
@@ -55,61 +56,6 @@ namespace drawinglayer
{
namespace primitive2d
{
- /** FontUnderline definition
-
- This is used for both underline and overline
- */
- enum FontUnderline
- {
- FONT_UNDERLINE_NONE,
- FONT_UNDERLINE_SINGLE,
- FONT_UNDERLINE_DOUBLE,
- FONT_UNDERLINE_DOTTED,
- FONT_UNDERLINE_DASH,
- FONT_UNDERLINE_LONGDASH,
- FONT_UNDERLINE_DASHDOT,
- FONT_UNDERLINE_DASHDOTDOT,
- FONT_UNDERLINE_SMALLWAVE,
- FONT_UNDERLINE_WAVE,
- FONT_UNDERLINE_DOUBLEWAVE,
- FONT_UNDERLINE_BOLD,
- FONT_UNDERLINE_BOLDDOTTED,
- FONT_UNDERLINE_BOLDDASH,
- FONT_UNDERLINE_BOLDLONGDASH,
- FONT_UNDERLINE_BOLDDASHDOT,
- FONT_UNDERLINE_BOLDDASHDOTDOT,
- FONT_UNDERLINE_BOLDWAVE
- };
-
- /** FontStrikeout definition */
- enum FontStrikeout
- {
- FONT_STRIKEOUT_NONE,
- FONT_STRIKEOUT_SINGLE,
- FONT_STRIKEOUT_DOUBLE,
- FONT_STRIKEOUT_BOLD,
- FONT_STRIKEOUT_SLASH,
- FONT_STRIKEOUT_X
- };
-
- /** FontEmphasisMark definition */
- enum FontEmphasisMark
- {
- FONT_EMPHASISMARK_NONE,
- FONT_EMPHASISMARK_DOT,
- FONT_EMPHASISMARK_CIRCLE,
- FONT_EMPHASISMARK_DISC,
- FONT_EMPHASISMARK_ACCENT
- };
-
- /** FontRelief definition */
- enum FontRelief
- {
- FONT_RELIEF_NONE,
- FONT_RELIEF_EMBOSSED,
- FONT_RELIEF_ENGRAVED
- };
-
/** TextDecoratedPortionPrimitive2D class
This primitive expands the TextSimplePortionPrimitive2D by common
@@ -123,8 +69,8 @@ namespace drawinglayer
/// decoration definitions
basegfx::BColor maOverlineColor;
basegfx::BColor maTextlineColor;
- FontUnderline meFontOverline;
- FontUnderline meFontUnderline;
+ TextLine meFontOverline;
+ TextLine meFontUnderline;
FontStrikeout meFontStrikeout;
FontEmphasisMark meFontEmphasisMark;
FontRelief meFontRelief;
@@ -137,16 +83,6 @@ namespace drawinglayer
unsigned mbShadow : 1;
/// helper methods
- void impCreateTextLine(
- std::vector< Primitive2DReference >& rTarget,
- basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
- const basegfx::B2DHomMatrix &rUnscaledTransform,
- FontUnderline eLineStyle,
- double fLineOffset,
- double fLineHeight,
- double fLineWidth,
- const basegfx::BColor& rLineColor) const;
-
void impCreateGeometryContent(
std::vector< Primitive2DReference >& rTarget,
basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
@@ -154,7 +90,7 @@ namespace drawinglayer
xub_StrLen aTextPosition,
xub_StrLen aTextLength,
const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes) const;
+ const attribute::FontAttribute& rFontAttribute) const;
void impCorrectTextBoundary(
::com::sun::star::i18n::Boundary& rNextWordBoundary) const;
@@ -177,15 +113,15 @@ namespace drawinglayer
xub_StrLen aTextPosition,
xub_StrLen aTextLength,
const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes,
+ const attribute::FontAttribute& rFontAttribute,
const ::com::sun::star::lang::Locale& rLocale,
const basegfx::BColor& rFontColor,
/// local parameters
const basegfx::BColor& rOverlineColor,
const basegfx::BColor& rTextlineColor,
- FontUnderline eFontOverline = FONT_UNDERLINE_NONE,
- FontUnderline eFontUnderline = FONT_UNDERLINE_NONE,
+ TextLine eFontOverline = TEXT_LINE_NONE,
+ TextLine eFontUnderline = TEXT_LINE_NONE,
bool bUnderlineAbove = false,
FontStrikeout eFontStrikeout = FONT_STRIKEOUT_NONE,
bool bWordLineMode = false,
@@ -196,8 +132,8 @@ namespace drawinglayer
bool bShadow = false);
/// data read access
- FontUnderline getFontOverline() const { return meFontOverline; }
- FontUnderline getFontUnderline() const { return meFontUnderline; }
+ TextLine getFontOverline() const { return meFontOverline; }
+ TextLine getFontUnderline() const { return meFontUnderline; }
FontStrikeout getFontStrikeout() const { return meFontStrikeout; }
FontEmphasisMark getFontEmphasisMark() const { return meFontEmphasisMark; }
FontRelief getFontRelief() const { return meFontRelief; }
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx
new file mode 100644
index 000000000000..ec2f7e656b40
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: wrongspellprimitive2d.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11: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_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextLine definition
+
+ This is used for both underline and overline
+ */
+ enum TextLine
+ {
+ TEXT_LINE_NONE,
+ TEXT_LINE_SINGLE,
+ TEXT_LINE_DOUBLE,
+ TEXT_LINE_DOTTED,
+ TEXT_LINE_DASH,
+ TEXT_LINE_LONGDASH,
+ TEXT_LINE_DASHDOT,
+ TEXT_LINE_DASHDOTDOT,
+ TEXT_LINE_SMALLWAVE,
+ TEXT_LINE_WAVE,
+ TEXT_LINE_DOUBLEWAVE,
+ TEXT_LINE_BOLD,
+ TEXT_LINE_BOLDDOTTED,
+ TEXT_LINE_BOLDDASH,
+ TEXT_LINE_BOLDLONGDASH,
+ TEXT_LINE_BOLDDASHDOT,
+ TEXT_LINE_BOLDDASHDOTDOT,
+ TEXT_LINE_BOLDWAVE
+ };
+
+ /** FontStrikeout definition */
+ enum FontStrikeout
+ {
+ FONT_STRIKEOUT_NONE,
+ FONT_STRIKEOUT_SINGLE,
+ FONT_STRIKEOUT_DOUBLE,
+ FONT_STRIKEOUT_BOLD,
+ FONT_STRIKEOUT_SLASH,
+ FONT_STRIKEOUT_X
+ };
+
+ /** FontEmphasisMark definition */
+ enum FontEmphasisMark
+ {
+ FONT_EMPHASISMARK_NONE,
+ FONT_EMPHASISMARK_DOT,
+ FONT_EMPHASISMARK_CIRCLE,
+ FONT_EMPHASISMARK_DISC,
+ FONT_EMPHASISMARK_ACCENT
+ };
+
+ /** FontRelief definition */
+ enum FontRelief
+ {
+ FONT_RELIEF_NONE,
+ FONT_RELIEF_EMBOSSED,
+ FONT_RELIEF_ENGRAVED
+ };
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx
index e0e2b6bbc4cb..f454459211df 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx
@@ -50,8 +50,8 @@ class Font;
class String;
class OutputDevice;
-namespace drawinglayer { namespace primitive2d {
- class FontAttributes;
+namespace drawinglayer { namespace attribute {
+ class FontAttribute;
}}
namespace basegfx {
@@ -85,8 +85,8 @@ namespace drawinglayer
/// tooling methods
void setFont(const Font& rFont);
- void setFontAttributes(
- const FontAttributes& rFontAttributes,
+ void setFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
double fFontScaleX,
double fFontScaleY,
const ::com::sun::star::lang::Locale & rLocale);
@@ -114,6 +114,9 @@ namespace drawinglayer
const String& rText,
xub_StrLen nIndex,
xub_StrLen nLength) const;
+
+ double getFontAscent() const;
+ double getFontDescent() const;
};
} // end of namespace primitive2d
} // end of namespace drawinglayer
@@ -125,25 +128,25 @@ namespace drawinglayer
{
namespace primitive2d
{
- /** Create a VCL-Font based on the definitions in FontAttributes
+ /** Create a VCL-Font based on the definitions in FontAttribute
and the given FontScaling. The FontScaling defines the FontHeight
(fFontScaleY) and the FontWidth (fFontScaleX). The combination of
both defines FontStretching, where no stretching happens at
fFontScaleY == fFontScaleX
*/
- Font getVclFontFromFontAttributes(
- const FontAttributes& rFontAttributes,
+ Font getVclFontFromFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
double fFontScaleX,
double fFontScaleY,
double fFontRotation,
const ::com::sun::star::lang::Locale & rLocale);
- /** Generate FontAttributes DataSet derived from the given VCL-Font.
+ /** Generate FontAttribute DataSet derived from the given VCL-Font.
The FontScaling with fFontScaleY, fFontScaleX relationship (see
above) will be set in return parameter o_rSize to allow further
processing
*/
- FontAttributes getFontAttributesFromVclFont(
+ attribute::FontAttribute getFontAttributeFromVclFont(
basegfx::B2DVector& o_rSize,
const Font& rFont,
bool bRTL,
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx
new file mode 100644
index 000000000000..a103d607e85f
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textdecoratedprimitive2d.hxx,v $
+ *
+ * $Revision: 1.6 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11: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_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class TextLinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometric definitions
+ basegfx::B2DHomMatrix maObjectTransformation;
+ double mfWidth;
+ double mfOffset;
+ double mfHeight;
+
+ /// decoration definitions
+ TextLine meTextLine;
+ basegfx::BColor maLineColor;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextLinePrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ double fOffset,
+ double fHeight,
+ TextLine eTextLine,
+ const basegfx::BColor& rLineColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ double getWidth() const { return mfWidth; }
+ double getOffset() const { return mfOffset; }
+ double getHeight() const { return mfHeight; }
+ TextLine getTextLine() const { return meTextLine; }
+ const basegfx::BColor& getLineColor() const { return maLineColor; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx
index 43e06ecc3b53..bbcd8e335e23 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -43,6 +43,7 @@
#include <basegfx/color/bcolor.hxx>
#include <vector>
#include <com/sun/star/lang/Locale.hpp>
+#include <drawinglayer/attribute/fontattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -60,75 +61,6 @@ namespace drawinglayer
{
namespace primitive2d
{
- /** FontAttributes class
-
- This attribute class is able to hold all parameters needed/used
- to completely define the parametrisation of a text portion.
- */
- class FontAttributes
- {
- private:
- /// core data
- String maFamilyName; // Font Family Name
- String maStyleName; // Font Style Name
- sal_uInt16 mnWeight; // Font weight
-
- /// bitfield
- unsigned mbSymbol : 1; // Symbol Font Flag
- unsigned mbVertical : 1; // Vertical Text Flag
- unsigned mbItalic : 1; // Italic Flag
- unsigned mbOutline : 1; // Outline Flag
- unsigned mbRTL : 1; // RTL Flag
- unsigned mbBiDiStrong : 1; // BiDi Flag
- // TODO: pair kerning and CJK kerning
-
- public:
- /// constructor
- FontAttributes(
- const String& rFamilyName,
- const String& rStyleName,
- sal_uInt16 nWeight,
- bool bSymbol = false,
- bool bVertical = false,
- bool bItalic = false,
- bool bOutline = false,
- bool bRTL = false,
- bool bBiDiStrong = false)
- : maFamilyName(rFamilyName),
- maStyleName(rStyleName),
- mnWeight(nWeight),
- mbSymbol(bSymbol),
- mbVertical(bVertical),
- mbItalic(bItalic),
- mbOutline(bOutline),
- mbRTL(bRTL),
- mbBiDiStrong(bBiDiStrong)
- {
- }
-
- /// compare operator
- bool operator==(const FontAttributes& rCompare) const;
-
- /// data read access
- const String& getFamilyName() const { return maFamilyName; }
- const String& getStyleName() const { return maStyleName; }
- sal_uInt16 getWeight() const { return mnWeight; }
- bool getSymbol() const { return mbSymbol; }
- bool getVertical() const { return mbVertical; }
- bool getItalic() const { return mbItalic; }
- bool getOutline() const { return mbOutline; }
- bool getRTL() const { return mbRTL; }
- bool getBiDiStrong() const { return mbBiDiStrong; }
- };
- } // end of namespace primitive2d
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace primitive2d
- {
/** TextSimplePortionPrimitive2D class
This is the basic primitive for representing a text portion. It contains
@@ -158,7 +90,7 @@ namespace drawinglayer
::std::vector< double > maDXArray;
/// The font to use
- FontAttributes maFontAttributes;
+ attribute::FontAttribute maFontAttribute;
/// The Locale for the text
::com::sun::star::lang::Locale maLocale;
@@ -181,7 +113,7 @@ namespace drawinglayer
xub_StrLen aTextPosition,
xub_StrLen aTextLength,
const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes,
+ const attribute::FontAttribute& rFontAttribute,
const ::com::sun::star::lang::Locale& rLocale,
const basegfx::BColor& rFontColor);
@@ -197,7 +129,7 @@ namespace drawinglayer
xub_StrLen getTextPosition() const { return maTextPosition; }
xub_StrLen getTextLength() const { return maTextLength; }
const ::std::vector< double >& getDXArray() const { return maDXArray; }
- const FontAttributes& getFontAttributes() const { return maFontAttributes; }
+ const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
const basegfx::BColor& getFontColor() const { return maFontColor; }
@@ -210,6 +142,10 @@ namespace drawinglayer
/// provide unique ID
DeclPrimitrive2DIDBlock()
};
+
+ /// small helper to have a compare operator for Locale
+ bool LocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB);
+
} // end of namespace primitive2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx
new file mode 100644
index 000000000000..562eb681ddae
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textdecoratedprimitive2d.hxx,v $
+ *
+ * $Revision: 1.6 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11: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_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class BaseTextStrikeoutPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometric definitions
+ basegfx::B2DHomMatrix maObjectTransformation;
+ double mfWidth;
+
+ /// decoration definitions
+ basegfx::BColor maFontColor;
+
+ public:
+ /// constructor
+ BaseTextStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ double getWidth() const { return mfWidth; }
+ const basegfx::BColor& getFontColor() const { return maFontColor; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class TextCharacterStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D
+ {
+ private:
+ sal_Unicode maStrikeoutChar;
+ attribute::FontAttribute maFontAttribute;
+ ::com::sun::star::lang::Locale maLocale;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextCharacterStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ sal_Unicode aStrikeoutChar,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale);
+
+ /// data read access
+ sal_Unicode getStrikeoutChar() const { return maStrikeoutChar; }
+ const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class TextGeometryStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D
+ {
+ private:
+ double mfHeight;
+ double mfOffset;
+ FontStrikeout meFontStrikeout;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextGeometryStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ double fHeight,
+ double fOffset,
+ FontStrikeout eFontStrikeout);
+
+ /// data read access
+ double getHeight() const { return mfHeight; }
+ double getOffset() const { return mfOffset; }
+ FontStrikeout getFontStrikeout() const { return meFontStrikeout; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx
new file mode 100644
index 000000000000..ffe47cfe1b72
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bitmapprimitive2d.hxx,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11: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_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/wall.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** WallpaperBitmapPrimitive2D class
+
+ This is a specialized primtive for the Wallpaper definitions included in
+ VCL and Metafiles. The extraordinary about the bitmap definition part of
+ the Wallpaper is that it uses PIXEL size of the given Bitmap and not
+ the logic and/or discrete size derived by PrefMapMode/PrefSize methods.
+ To emulate this, a ViewTransformation dependent primitive is needed which
+ takes over the correct scaling(s).
+
+ Since a specialized primitive is needed anyways, i opted to also add the
+ layouting which is dependent from WallpaperStyle; thus it does not need
+ to be handled anywhere else in the future.
+ */
+ class WallpaperBitmapPrimitive2D : public ViewTransformationDependentPrimitive2D
+ {
+ private:
+ basegfx::B2DRange maObjectRange;
+ BitmapEx maBitmapEx;
+ WallpaperStyle meWallpaperStyle;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ WallpaperBitmapPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const BitmapEx& rBitmapEx,
+ WallpaperStyle eWallpaperStyle);
+
+ /// data read access
+ const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; }
+ const BitmapEx& getBitmapEx() const { return maBitmapEx ; }
+ WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get B2Drange
+ 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_WALLPAPERPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx
index 052d42f7290e..f8b81e357ea5 100644
--- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx
@@ -179,19 +179,19 @@ namespace drawinglayer
{
private:
/// bitmap fill attribute
- attribute::FillBitmapAttribute maBitmap;
+ attribute::FillBitmapAttribute maFillBitmapAttribute;
public:
/// constructor
BitmapTexturePrimitive3D(
- const attribute::FillBitmapAttribute& rBitmap,
+ const attribute::FillBitmapAttribute& rFillBitmapAttribute,
const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate,
bool bFilter);
/// data read access
- const attribute::FillBitmapAttribute& getBitmap() const { return maBitmap; }
+ const attribute::FillBitmapAttribute& getFillBitmapAttribute() const { return maFillBitmapAttribute; }
/// compare operator
virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
index f0d0ff881bc5..38e7e5143b8a 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
@@ -97,7 +97,7 @@ namespace drawinglayer
basegfx::B2DPolyPolygon maClipPolyPolygon;
// the target MetaFile
- GDIMetaFile& mrMetaFile;
+ GDIMetaFile* mpMetaFile;
// do not allow embedding SvtGraphicFills into each other,
// use a counter to prevent that
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index 1ba3c2e7b614..ee5b96d98a03 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -39,6 +39,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\sceneprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sceneprimitive2d.hxx
..\inc\drawinglayer\primitive2d\shadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\shadowprimitive2d.hxx
..\inc\drawinglayer\primitive2d\structuretagprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\structuretagprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\textenumsprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textenumsprimitive2d.hxx
..\inc\drawinglayer\primitive2d\texteffectprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\texteffectprimitive2d.hxx
..\inc\drawinglayer\primitive2d\textlayoutdevice.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textlayoutdevice.hxx
..\inc\drawinglayer\primitive2d\textprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textprimitive2d.hxx
@@ -98,6 +99,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d
mkdir: %_DEST%\inc%_EXT%\drawinglayer\attribute
..\inc\drawinglayer\attribute\fillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillattribute.hxx
..\inc\drawinglayer\attribute\fillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillbitmapattribute.hxx
+..\inc\drawinglayer\attribute\fontattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fontattribute.hxx
..\inc\drawinglayer\attribute\materialattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\materialattribute3d.hxx
..\inc\drawinglayer\attribute\sdrallattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrallattribute3d.hxx
..\inc\drawinglayer\attribute\sdrattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute.hxx
diff --git a/drawinglayer/source/attribute/fillbitmapattribute.cxx b/drawinglayer/source/attribute/fillbitmapattribute.cxx
index 539e85ab2733..99afb234bda5 100644
--- a/drawinglayer/source/attribute/fillbitmapattribute.cxx
+++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx
@@ -44,8 +44,12 @@ namespace drawinglayer
{
namespace attribute
{
- FillBitmapAttribute::FillBitmapAttribute(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling)
- : maBitmap(rBitmap),
+ FillBitmapAttribute::FillBitmapAttribute(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft,
+ const basegfx::B2DVector& rSize,
+ bool bTiling)
+ : maBitmapEx(rBitmapEx),
maTopLeft(rTopLeft),
maSize(rSize),
mbTiling(bTiling)
@@ -54,10 +58,10 @@ namespace drawinglayer
bool FillBitmapAttribute::operator==(const FillBitmapAttribute& rCandidate) const
{
- return (maBitmap == rCandidate.maBitmap
- && maTopLeft == rCandidate.maTopLeft
- && maSize == rCandidate.maSize
- && mbTiling == rCandidate.mbTiling);
+ return (getBitmapEx() == rCandidate.getBitmapEx()
+ && getTopLeft() == rCandidate.getTopLeft()
+ && getSize() == rCandidate.getSize()
+ && getTiling() == rCandidate.getTiling());
}
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx
new file mode 100644
index 000000000000..5163e2f6a59a
--- /dev/null
+++ b/drawinglayer/source/attribute/fontattribute.cxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: strokeattribute.cxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/fontattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ bool FontAttribute::operator==(const FontAttribute& rCompare) const
+ {
+ return (getFamilyName() == rCompare.getFamilyName()
+ && getStyleName() == rCompare.getStyleName()
+ && getWeight() == rCompare.getWeight()
+ && getSymbol() == rCompare.getSymbol()
+ && getVertical() == rCompare.getVertical()
+ && getItalic() == rCompare.getItalic()
+ && getOutline() == rCompare.getOutline()
+ && getRTL() == rCompare.getRTL()
+ && getBiDiStrong() == rCompare.getBiDiStrong());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk
index fa91224e64b6..65f899f67177 100644
--- a/drawinglayer/source/attribute/makefile.mk
+++ b/drawinglayer/source/attribute/makefile.mk
@@ -47,6 +47,7 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES= \
$(SLO)$/fillattribute.obj \
$(SLO)$/fillbitmapattribute.obj \
+ $(SLO)$/fontattribute.obj \
$(SLO)$/materialattribute3d.obj \
$(SLO)$/sdrallattribute3d.obj \
$(SLO)$/sdrattribute.obj \
diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
index c35d0ba5c15f..d7e9090b0f62 100644
--- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
@@ -228,7 +228,7 @@ namespace drawinglayer
aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight);
}
- return FillBitmapAttribute(aBitmap, aBitmapTopLeft, aBitmapSize, mbTiling);
+ return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, mbTiling);
}
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
index 5900900bcf06..43de0ef3b514 100644
--- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
@@ -65,8 +65,8 @@ namespace drawinglayer
{
const BitmapPrimitive2D& rCompare = (BitmapPrimitive2D&)rPrimitive;
- return (maBitmapEx == rCompare.maBitmapEx
- && maTransform == rCompare.maTransform);
+ return (getBitmapEx() == rCompare.getBitmapEx()
+ && getTransform() == rCompare.getTransform());
}
return false;
diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
new file mode 100644
index 000000000000..6e3a5b8e516e
--- /dev/null
+++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bitmapprimitive2d.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/primitive2d/discretebitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence DiscreteBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // use getViewTransformation() and getObjectTransformation() from
+ // ObjectAndViewTransformationDependentPrimitive2D to create a BitmapPrimitive2D
+ // with the correct mapping
+ Primitive2DSequence xRetval;
+
+ if(!getBitmapEx().IsEmpty())
+ {
+ // get discrete size
+ const Size& rSizePixel = getBitmapEx().GetSizePixel();
+ const basegfx::B2DVector aDiscreteSize(rSizePixel.Width(), rSizePixel.Height());
+
+ // get inverse ViewTransformation
+ basegfx::B2DHomMatrix aInverseViewTransformation(getViewTransformation());
+ aInverseViewTransformation.invert();
+
+ // get size and position in world coordinates
+ const basegfx::B2DVector aWorldSize(aInverseViewTransformation * aDiscreteSize);
+ const basegfx::B2DPoint aWorldTopLeft(getObjectTransformation() * getTopLeft());
+
+ // build object matrix in world coordinates so that the top-left
+ // position remains, but eventual transformations (e.g. rotations)
+ // in the ObjectToView stack remain and get correctly applied
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, aWorldSize.getX());
+ aObjectTransform.set(1, 1, aWorldSize.getY());
+ aObjectTransform.set(0, 2, aWorldTopLeft.getX());
+ aObjectTransform.set(1, 2, aWorldTopLeft.getY());
+
+ // get inverse ObjectTransformation
+ basegfx::B2DHomMatrix aInverseObjectTransformation(getObjectTransformation());
+ aInverseObjectTransformation.invert();
+
+ // transform to object coordinate system
+ aObjectTransform = aInverseObjectTransformation * aObjectTransform;
+
+ // create BitmapPrimitive2D with now object-local coordinate data
+ const Primitive2DReference xRef(new BitmapPrimitive2D(getBitmapEx(), aObjectTransform));
+ xRetval = Primitive2DSequence(&xRef, 1);
+ }
+
+ return xRetval;
+ }
+
+ DiscreteBitmapPrimitive2D::DiscreteBitmapPrimitive2D(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft)
+ : ObjectAndViewTransformationDependentPrimitive2D(),
+ maBitmapEx(rBitmapEx),
+ maTopLeft(rTopLeft)
+ {
+ }
+
+ bool DiscreteBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(ObjectAndViewTransformationDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const DiscreteBitmapPrimitive2D& rCompare = (DiscreteBitmapPrimitive2D&)rPrimitive;
+
+ return (getBitmapEx() == rCompare.getBitmapEx()
+ && getTopLeft() == rCompare.getTopLeft());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(DiscreteBitmapPrimitive2D, PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx
index 57d5d7c00c7c..ab9e9d19f6d2 100644
--- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx
@@ -56,7 +56,7 @@ namespace drawinglayer
{
Primitive2DSequence FillBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- const Size aTileSizePixel(getFillBitmap().getBitmap().GetSizePixel());
+ const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel());
Primitive2DSequence aRetval;
// is there a tile with some size at all?
@@ -79,7 +79,7 @@ namespace drawinglayer
aNewMatrix *= getTransformation();
// create bitmap primitive and add to result
- const Primitive2DReference xRef(new BitmapPrimitive2D(BitmapEx(getFillBitmap().getBitmap()), aNewMatrix));
+ const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix));
aRetval[a] = xRef;
}
}
@@ -94,7 +94,7 @@ namespace drawinglayer
aObjectTransform *= getTransformation();
// create bitmap primitive and add exclusive to decomposition (hand over ownership)
- const Primitive2DReference xRef(new BitmapPrimitive2D(BitmapEx(getFillBitmap().getBitmap()), aObjectTransform));
+ const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform));
aRetval = Primitive2DSequence(&xRef, 1L);
}
}
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index 2bc280b577fd..625dae6cb93a 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -54,37 +54,27 @@ namespace drawinglayer
{
namespace primitive2d
{
- Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void FillGradientPrimitive2D::generateMatricesAndColors(
+ std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ std::vector< basegfx::BColor >& rColors) const
{
- const attribute::GradientStyle aGradientStyle(maFillGradient.getStyle());
- ::std::vector< basegfx::B2DHomMatrix > aMatrices;
- ::std::vector< basegfx::BColor > aColors;
- basegfx::B2DPolygon aUnitPolygon;
- sal_uInt32 nSteps(maFillGradient.getSteps());
-
- if(attribute::GRADIENTSTYLE_RADIAL == aGradientStyle || attribute::GRADIENTSTYLE_ELLIPTICAL == aGradientStyle)
- {
- const basegfx::B2DPoint aCircleCenter(0.5, 0.5);
- aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5);
- }
- else
- {
- aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0));
- }
+ rMatrices.clear();
+ rColors.clear();
// make sure steps is not too high/low
const basegfx::BColor aStart(maFillGradient.getStartColor());
const basegfx::BColor aEnd(maFillGradient.getEndColor());
const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5));
+ sal_uInt32 nSteps(maFillGradient.getSteps());
- if(nSteps == 0L)
+ if(nSteps == 0)
{
nSteps = nMaxSteps;
}
- if(nSteps < 2L)
+ if(nSteps < 2)
{
- nSteps = 2L;
+ nSteps = 2;
}
if(nSteps > nMaxSteps)
@@ -92,78 +82,180 @@ namespace drawinglayer
nSteps = nMaxSteps;
}
- switch(aGradientStyle)
+ switch(maFillGradient.getStyle())
{
case attribute::GRADIENTSTYLE_LINEAR:
{
texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
+ aGradient.appendTransformations(rMatrices);
+ aGradient.appendColors(rColors);
break;
}
case attribute::GRADIENTSTYLE_AXIAL:
{
texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
+ aGradient.appendTransformations(rMatrices);
+ aGradient.appendColors(rColors);
break;
}
case attribute::GRADIENTSTYLE_RADIAL:
{
texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
+ aGradient.appendTransformations(rMatrices);
+ aGradient.appendColors(rColors);
break;
}
case attribute::GRADIENTSTYLE_ELLIPTICAL:
{
texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
+ aGradient.appendTransformations(rMatrices);
+ aGradient.appendColors(rColors);
break;
}
case attribute::GRADIENTSTYLE_SQUARE:
{
texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
+ aGradient.appendTransformations(rMatrices);
+ aGradient.appendColors(rColors);
break;
}
case attribute::GRADIENTSTYLE_RECT:
{
texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
+ aGradient.appendTransformations(rMatrices);
+ aGradient.appendColors(rColors);
break;
}
}
+ }
+ Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const
+ {
// prepare return value
- Primitive2DSequence aRetval(aColors.size() ? aMatrices.size() + 1L : aMatrices.size());
+ Primitive2DSequence aRetval(rColors.size() ? rMatrices.size() + 1 : rMatrices.size());
// create solid fill with start color
- if(aColors.size())
+ if(rColors.size())
{
// create primitive
- const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), aColors[0L]));
- aRetval[0L] = xRef;
+ const Primitive2DReference xRef(
+ new PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())),
+ rColors[0]));
+ aRetval[0] = xRef;
}
// create solid fill steps
- for(sal_uInt32 a(0L); a < aMatrices.size(); a++)
+ for(sal_uInt32 a(0); a < rMatrices.size(); a++)
{
// create part polygon
- basegfx::B2DPolygon aNewPoly(aUnitPolygon);
- aNewPoly.transform(aMatrices[a]);
+ basegfx::B2DPolygon aNewPoly(rUnitPolygon);
+ aNewPoly.transform(rMatrices[a]);
// create solid fill
- const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aNewPoly), aColors[a + 1L]));
- aRetval[a + 1L] = xRef;
+ const Primitive2DReference xRef(
+ new PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aNewPoly),
+ rColors[a + 1]));
+ aRetval[a + 1] = xRef;
+ }
+
+ return aRetval;
+ }
+
+ Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const
+ {
+ // prepare return value
+ Primitive2DSequence aRetval;
+ const sal_uInt32 nMatricesSize(rMatrices.size());
+
+ if(nMatricesSize)
+ {
+ basegfx::B2DPolygon aOuterPoly(rUnitPolygon);
+ aOuterPoly.transform(rMatrices[0]);
+ basegfx::B2DPolyPolygon aCombinedPolyPoly(aOuterPoly);
+ const sal_uInt32 nEntryCount(rColors.size() ? rMatrices.size() + 1 : rMatrices.size());
+ sal_uInt32 nIndex(0);
+
+ aRetval.realloc(nEntryCount);
+
+ if(rColors.size())
+ {
+ basegfx::B2DRange aOuterPolyRange(aOuterPoly.getB2DRange());
+ aOuterPolyRange.expand(getObjectRange());
+ aCombinedPolyPoly.append(basegfx::tools::createPolygonFromRect(aOuterPolyRange));
+ aRetval[nIndex++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(aCombinedPolyPoly, rColors[0]));
+ aCombinedPolyPoly = basegfx::B2DPolyPolygon(aOuterPoly);
+ }
+
+ for(sal_uInt32 a(1); a < nMatricesSize - 1; a++)
+ {
+ basegfx::B2DPolygon aInnerPoly(rUnitPolygon);
+ aInnerPoly.transform(rMatrices[a]);
+ aCombinedPolyPoly.append(aInnerPoly);
+ aRetval[nIndex++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(aCombinedPolyPoly, rColors[a]));
+ aCombinedPolyPoly = basegfx::B2DPolyPolygon(aInnerPoly);
+ }
+
+ if(rColors.size())
+ {
+ aRetval[nIndex] = Primitive2DReference(new PolyPolygonColorPrimitive2D(
+ aCombinedPolyPoly, rColors[rColors.size() - 1]));
+ }
}
return aRetval;
}
+ Primitive2DSequence FillGradientPrimitive2D::createFill(bool bOverlapping) const
+ {
+ // prepare shape of the Unit Polygon
+ basegfx::B2DPolygon aUnitPolygon;
+
+ if(attribute::GRADIENTSTYLE_RADIAL == maFillGradient.getStyle()
+ || attribute::GRADIENTSTYLE_ELLIPTICAL == maFillGradient.getStyle())
+ {
+ const basegfx::B2DPoint aCircleCenter(0.5, 0.5);
+ aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5);
+ }
+ else
+ {
+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0));
+ }
+
+ // get the transform matrices and colors (where colors
+ // will have one more entry that matrices)
+ std::vector< basegfx::B2DHomMatrix > aMatrices;
+ std::vector< basegfx::BColor > aColors;
+ generateMatricesAndColors(aMatrices, aColors);
+
+ if(bOverlapping)
+ {
+ return createOverlappingFill(aMatrices, aColors, aUnitPolygon);
+ }
+ else
+ {
+ return createNonOverlappingFill(aMatrices, aColors, aUnitPolygon);
+ }
+ }
+
+ Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // default creates overlapping fill which works with AntiAliasing and without.
+ // The non-overlapping version does not create single filled polygons, but
+ // PolyPolygons where each one describes a 'ring' for the gradient such
+ // that the rings will not overlap. This is useful fir the old XOR-paint
+ // 'trick' of VCL which is recorded in Metafiles; so this version may be
+ // used from the MetafilePrimitive2D in it's decomposition.
+ return createFill(true);
+ }
+
FillGradientPrimitive2D::FillGradientPrimitive2D(
const basegfx::B2DRange& rObjectRange,
const attribute::FillGradientAttribute& rFillGradient)
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index d5282116d46f..eca68858cbb5 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -207,23 +207,54 @@ namespace
//////////////////////////////////////////////////////////////////////////////
+#include <vcl/gradient.hxx>
+#include <vcl/pngread.hxx>
+#include <vcl/lineinfo.hxx>
+
namespace drawinglayer
{
namespace primitive2d
{
- Primitive2DSequence GraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DSequence GraphicPrimitive2D::create2DDecomposition(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)
+ Primitive2DReference xPrimitive;
+
+ // do not apply mirroring from GraphicAttr to the Metafile by calling
+ // GetTransformedGraphic, this will try to mirror the Metafile using Scale()
+ // at the Metafile. This again calls Scale at the single MetaFile actions,
+ // but this implementation never worked. I reworked that implementations,
+ // but for security reasons i will try not to use it.
+ basegfx::B2DHomMatrix aTransform(getTransform());
+
+ if(getGraphicAttr().IsMirrored())
+ {
+ // content needs mirroring
+ const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_HORZ);
+ const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_VERT);
+
+ // mirror by applying negative scale to the unit primitive and
+ // applying the object transformation on it.
+ aTransform = basegfx::tools::createScaleB2DHomMatrix(
+ bHMirr ? -1.0 : 1.0,
+ bVMirr ? -1.0 : 1.0);
+ aTransform.translate(
+ bHMirr ? 1.0 : 0.0,
+ bVMirr ? 1.0 : 0.0);
+ aTransform = getTransform() * aTransform;
+ }
+
+ // 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).
+ // Also need to suppress mirroring, it is part of the transformation now (see above).
GraphicAttr aSuppressGraphicAttr(getGraphicAttr());
- aSuppressGraphicAttr.SetCrop(0L, 0L, 0L, 0L);
+ aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
aSuppressGraphicAttr.SetRotation(0);
- Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr));
- Primitive2DReference xPrimitive;
+ aSuppressGraphicAttr.SetMirrorFlags(0);
+ const Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr));
switch(aTransformedGraphic.GetType())
{
@@ -244,7 +275,7 @@ namespace drawinglayer
{
animation::AnimationEntryFixed aTime((double)aData.stepTime(a), (double)a / (double)aData.count());
aAnimationLoop.append(aTime);
- const Primitive2DReference xRef(new BitmapPrimitive2D(aData.stepBitmapEx(a), getTransform()));
+ const Primitive2DReference xRef(new BitmapPrimitive2D(aData.stepBitmapEx(a), aTransform));
aBitmapPrimitives[a] = xRef;
}
@@ -258,7 +289,7 @@ namespace drawinglayer
}
else
{
- xPrimitive = Primitive2DReference(new BitmapPrimitive2D(aTransformedGraphic.GetBitmapEx(), getTransform()));
+ xPrimitive = Primitive2DReference(new BitmapPrimitive2D(aTransformedGraphic.GetBitmapEx(), aTransform));
}
break;
@@ -267,35 +298,440 @@ namespace drawinglayer
case GRAPHIC_GDIMETAFILE :
{
// create MetafilePrimitive2D
- const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile();
-
- xPrimitive = Primitive2DReference(
- new MetafilePrimitive2D(
- getTransform(),
- rMetafile));
-
- // #i100357# find out if clipping is needed for this primitive. Unfortunately,
- // there exist Metafiles who's content is bigger than the proposed PrefSize set
- // at them. This is an error, but we need to work around this
- const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
- const Size aMetaFileRealSize(
- const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
- *Application::GetDefaultDevice()).GetSize());
-
- if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
- || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
+ static bool bDoTest(false);
+
+ if(bDoTest)
+ {
+ GDIMetaFile aMtf;
+ VirtualDevice aOut;
+ const basegfx::B2DRange aRange(getB2DRange(rViewInformation));
+ const Rectangle aRectangle(
+ basegfx::fround(aRange.getMinX()), basegfx::fround(aRange.getMinY()),
+ basegfx::fround(aRange.getMaxX()), basegfx::fround(aRange.getMaxY()));
+ const Point aOrigin(aRectangle.TopLeft());
+ const Fraction aScaleX(aRectangle.getWidth());
+ const Fraction aScaleY(aRectangle.getHeight());
+ MapMode aMapMode(MAP_100TH_MM, aOrigin, aScaleX, aScaleY);
+
+ Size aDummySize(2, 2);
+ aOut.SetOutputSizePixel(aDummySize);
+ aOut.EnableOutput(FALSE);
+ aOut.SetMapMode(aMapMode);
+
+ aMtf.Clear();
+ aMtf.Record(&aOut);
+
+ const Fraction aNeutralFraction(1, 1);
+ const MapMode aRelativeMapMode(
+ MAP_RELATIVE,
+ Point(-aRectangle.Left(), -aRectangle.Top()),
+ aNeutralFraction, aNeutralFraction);
+ aOut.SetMapMode(aRelativeMapMode);
+
+ if(false)
+ {
+ const sal_Int32 nHor(aRectangle.getWidth() / 4);
+ const sal_Int32 nVer(aRectangle.getHeight() / 4);
+ const Rectangle aCenteredRectangle(
+ aRectangle.Left() + nHor, aRectangle.Top() + nVer,
+ aRectangle.Right() - nHor, aRectangle.Bottom() - nVer);
+ aOut.SetClipRegion(aCenteredRectangle);
+ }
+
+ if(false)
+ {
+ const Rectangle aRightRectangle(aRectangle.TopCenter(), aRectangle.BottomRight());
+ aOut.IntersectClipRegion(aRightRectangle);
+ }
+
+ if(false)
+ {
+ const Rectangle aRightRectangle(aRectangle.TopCenter(), aRectangle.BottomRight());
+ const Rectangle aBottomRectangle(aRectangle.LeftCenter(), aRectangle.BottomRight());
+ Region aRegion(aRightRectangle);
+ aRegion.Intersect(aBottomRectangle);
+ aOut.IntersectClipRegion(aRegion);
+ }
+
+ if(false)
+ {
+ const sal_Int32 nHor(aRectangle.getWidth() / 10);
+ const sal_Int32 nVer(aRectangle.getHeight() / 10);
+ aOut.MoveClipRegion(nHor, nVer);
+ }
+
+ if(false)
+ {
+ Wallpaper aWallpaper(Color(COL_BLACK));
+ aOut.DrawWallpaper(aRectangle, aWallpaper);
+ }
+
+ if(false)
+ {
+ Wallpaper aWallpaper(Gradient(GRADIENT_LINEAR, Color(COL_RED), Color(COL_GREEN)));
+ aOut.DrawWallpaper(aRectangle, aWallpaper);
+ }
+
+ if(false)
+ {
+ SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ);
+ vcl::PNGReader aPNGReader(aRead);
+ BitmapEx aBitmapEx(aPNGReader.Read());
+ Wallpaper aWallpaper(aBitmapEx);
+ aOut.DrawWallpaper(aRectangle, aWallpaper);
+ }
+
+ if(false)
+ {
+ const double fHor(aRectangle.getWidth());
+ const double fVer(aRectangle.getHeight());
+ Color aColor(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0));
+
+ for(sal_uInt32 a(0); a < 5000; a++)
+ {
+ const Point aPoint(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+
+ if(!(a % 3))
+ {
+ aColor = Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0));
+ }
+
+ aOut.DrawPixel(aPoint, aColor);
+ }
+ }
+
+ if(false)
+ {
+ const double fHor(aRectangle.getWidth());
+ const double fVer(aRectangle.getHeight());
+
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor();
+
+ for(sal_uInt32 a(0); a < 5000; a++)
+ {
+ const Point aPoint(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ aOut.DrawPixel(aPoint);
+ }
+ }
+
+ if(false)
+ {
+ const double fHor(aRectangle.getWidth());
+ const double fVer(aRectangle.getHeight());
+
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor();
+
+ Point aStart(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ Point aStop(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+
+ LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fHor / 50.0));
+ bool bUseLineInfo(false);
+
+ for(sal_uInt32 a(0); a < 20; a++)
+ {
+ if(!(a%6))
+ {
+ bUseLineInfo = !bUseLineInfo;
+ }
+
+ if(!(a%4))
+ {
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ }
+
+ if(a%3)
+ {
+ aStart = aStop;
+ aStop = Point(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ }
+ else
+ {
+ aStart = Point(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ aStop = Point(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ }
+
+ if(bUseLineInfo)
+ {
+ aOut.DrawLine(aStart, aStop, aLineInfo);
+ }
+ else
+ {
+ aOut.DrawLine(aStart, aStop);
+ }
+ }
+ }
+
+ if(false)
+ {
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.DrawRect(aRectangle);
+ }
+
+ if(false)
+ {
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ const sal_uInt32 nHor(aRectangle.getWidth() / 10);
+ const sal_uInt32 nVer(aRectangle.getHeight() / 10);
+ aOut.DrawRect(aRectangle, nHor, nVer);
+ }
+
+ if(false)
+ {
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.DrawEllipse(aRectangle);
+ }
+
+ if(false)
+ {
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.DrawArc(aRectangle, aRectangle.TopLeft(), aRectangle.BottomCenter());
+ }
+
+ if(false)
+ {
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.DrawPie(aRectangle, aRectangle.TopLeft(), aRectangle.BottomCenter());
+ }
+
+ if(false)
+ {
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.DrawChord(aRectangle, aRectangle.TopLeft(), aRectangle.BottomCenter());
+ }
+
+ if(false)
+ {
+ const double fHor(aRectangle.getWidth());
+ const double fVer(aRectangle.getHeight());
+
+ for(sal_uInt32 b(0); b < 5; b++)
+ {
+ const sal_uInt32 nCount(basegfx::fround(rand() * (20 / 32767.0)));
+ const bool bClose(basegfx::fround(rand() / 32767.0));
+ Polygon aPolygon(nCount + (bClose ? 1 : 0));
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const Point aPoint(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ aPolygon[a] = aPoint;
+ }
+
+ if(bClose)
+ {
+ aPolygon[aPolygon.GetSize() - 1] = aPolygon[0];
+ }
+
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+
+ if(!(b%2))
+ {
+ const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fHor / 50.0));
+ aOut.DrawPolyLine(aPolygon, aLineInfo);
+ }
+ else
+ {
+ aOut.DrawPolyLine(aPolygon);
+ }
+ }
+ }
+
+ if(false)
+ {
+ const double fHor(aRectangle.getWidth());
+ const double fVer(aRectangle.getHeight());
+
+ for(sal_uInt32 b(0); b < 5; b++)
+ {
+ const sal_uInt32 nCount(basegfx::fround(rand() * (20 / 32767.0)));
+ const bool bClose(basegfx::fround(rand() / 32767.0));
+ Polygon aPolygon(nCount + (bClose ? 1 : 0));
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const Point aPoint(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ aPolygon[a] = aPoint;
+ }
+
+ if(bClose)
+ {
+ aPolygon[aPolygon.GetSize() - 1] = aPolygon[0];
+ }
+
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.DrawPolygon(aPolygon);
+ }
+ }
+
+ if(false)
+ {
+ const double fHor(aRectangle.getWidth());
+ const double fVer(aRectangle.getHeight());
+ PolyPolygon aPolyPolygon;
+
+ for(sal_uInt32 b(0); b < 3; b++)
+ {
+ const sal_uInt32 nCount(basegfx::fround(rand() * (6 / 32767.0)));
+ const bool bClose(basegfx::fround(rand() / 32767.0));
+ Polygon aPolygon(nCount + (bClose ? 1 : 0));
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const Point aPoint(
+ aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)),
+ aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0)));
+ aPolygon[a] = aPoint;
+ }
+
+ if(bClose)
+ {
+ aPolygon[aPolygon.GetSize() - 1] = aPolygon[0];
+ }
+
+ aPolyPolygon.Insert(aPolygon);
+ }
+
+ aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)));
+ aOut.DrawPolyPolygon(aPolyPolygon);
+ }
+
+ if(false)
+ {
+ SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ);
+ vcl::PNGReader aPNGReader(aRead);
+ BitmapEx aBitmapEx(aPNGReader.Read());
+ aOut.DrawBitmapEx(aRectangle.TopLeft(), aBitmapEx);
+ }
+
+ if(false)
+ {
+ SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ);
+ vcl::PNGReader aPNGReader(aRead);
+ BitmapEx aBitmapEx(aPNGReader.Read());
+ aOut.DrawBitmapEx(aRectangle.TopLeft(), aRectangle.GetSize(), aBitmapEx);
+ }
+
+ if(false)
+ {
+ SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ);
+ vcl::PNGReader aPNGReader(aRead);
+ BitmapEx aBitmapEx(aPNGReader.Read());
+ const Size aSizePixel(aBitmapEx.GetSizePixel());
+ aOut.DrawBitmapEx(
+ aRectangle.TopLeft(),
+ aRectangle.GetSize(),
+ Point(0, 0),
+ Size(aSizePixel.Width() /2, aSizePixel.Height() / 2),
+ aBitmapEx);
+ }
+
+ if(false)
+ {
+ const double fHor(aRectangle.getWidth());
+ const double fVer(aRectangle.getHeight());
+ const Point aPointA(
+ aRectangle.Left() + basegfx::fround(fHor * 0.2),
+ aRectangle.Top() + basegfx::fround(fVer * 0.3));
+ const Point aPointB(
+ aRectangle.Left() + basegfx::fround(fHor * 0.2),
+ aRectangle.Top() + basegfx::fround(fVer * 0.5));
+ const Point aPointC(
+ aRectangle.Left() + basegfx::fround(fHor * 0.2),
+ aRectangle.Top() + basegfx::fround(fVer * 0.7));
+ const String aText(ByteString("Hello, World!"), RTL_TEXTENCODING_UTF8);
+
+ const String aFontName(ByteString("Comic Sans MS"), RTL_TEXTENCODING_UTF8);
+ Font aFont(aFontName, Size(0, 1000));
+ aFont.SetAlign(ALIGN_BASELINE);
+ aFont.SetColor(COL_RED);
+ //sal_Int32* pDXArray = new sal_Int32[aText.Len()];
+
+ aFont.SetOutline(true);
+ aOut.SetFont(aFont);
+ aOut.DrawText(aPointA, aText, 0, aText.Len());
+
+ aFont.SetShadow(true);
+ aOut.SetFont(aFont);
+ aOut.DrawText(aPointB, aText, 0, aText.Len());
+
+ aFont.SetRelief(RELIEF_EMBOSSED);
+ aOut.SetFont(aFont);
+ aOut.DrawText(aPointC, aText, 0, aText.Len());
+
+ //delete pDXArray;
+ }
+
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM));
+ aMtf.SetPrefSize(Size(aRectangle.getWidth(), aRectangle.getHeight()));
+
+ xPrimitive = Primitive2DReference(
+ new MetafilePrimitive2D(
+ aTransform,
+ aMtf));
+ }
+ else
{
- // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
- const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
- basegfx::B2DPolygon aMaskPolygon(
- basegfx::tools::createPolygonFromRect(
- basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
- aMaskPolygon.transform(getTransform());
+ const Graphic aGraphic(getGraphicObject().GetGraphic());
+ const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile();
xPrimitive = Primitive2DReference(
- new MaskPrimitive2D(
- basegfx::B2DPolyPolygon(aMaskPolygon),
- aChildContent));
+ new MetafilePrimitive2D(
+ aTransform,
+ rMetafile));
+
+ // #i100357# find out if clipping is needed for this primitive. Unfortunately,
+ // there exist Metafiles who's content is bigger than the proposed PrefSize set
+ // at them. This is an error, but we need to work around this
+ const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
+ const Size aMetaFileRealSize(
+ const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
+ *Application::GetDefaultDevice()).GetSize());
+
+ if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
+ || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
+ {
+ // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
+ const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
+ basegfx::B2DPolygon aMaskPolygon(
+ basegfx::tools::createPolygonFromRect(
+ basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ aMaskPolygon.transform(aTransform);
+
+ xPrimitive = Primitive2DReference(
+ new MaskPrimitive2D(
+ basegfx::B2DPolyPolygon(aMaskPolygon),
+ aChildContent));
+ }
}
break;
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index e10d1ddbcc71..5da4d9c35587 100644
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -53,6 +53,7 @@ SLOFILES= \
$(SLO)$/borderlineprimitive2d.obj \
$(SLO)$/chartprimitive2d.obj \
$(SLO)$/controlprimitive2d.obj \
+ $(SLO)$/discretebitmapprimitive2d.obj \
$(SLO)$/embedded3dprimitive2d.obj \
$(SLO)$/fillbitmapprimitive2d.obj \
$(SLO)$/fillgradientprimitive2d.obj \
@@ -78,11 +79,14 @@ SLOFILES= \
$(SLO)$/structuretagprimitive2d.obj \
$(SLO)$/texteffectprimitive2d.obj \
$(SLO)$/textlayoutdevice.obj \
+ $(SLO)$/textlineprimitive2d.obj \
$(SLO)$/textprimitive2d.obj \
+ $(SLO)$/textstrikeoutprimitive2d.obj \
$(SLO)$/textdecoratedprimitive2d.obj \
$(SLO)$/texthierarchyprimitive2d.obj \
$(SLO)$/transformprimitive2d.obj \
$(SLO)$/unifiedalphaprimitive2d.obj \
+ $(SLO)$/wallpaperprimitive2d.obj \
$(SLO)$/wrongspellprimitive2d.obj
# --- Targets ----------------------------------
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 2d1c0428a6a3..a12172939e99 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -39,6 +39,36 @@
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
+#include <vcl/lineinfo.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <vcl/metaact.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/discretebitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <vcl/salbtype.hxx>
+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <vcl/svapp.hxx>
+#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
+#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/wallpaperprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
+#include <i18npool/mslangid.hxx>
+#include <numeric>
//////////////////////////////////////////////////////////////////////////////
@@ -46,14 +76,2465 @@ using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
+namespace
+{
+ class PropertyHolder
+ {
+ private:
+ basegfx::B2DHomMatrix maTransformation;
+ MapUnit maMapUnit;
+
+ basegfx::BColor maLineColor;
+ basegfx::BColor maFillColor;
+ basegfx::BColor maTextColor;
+ basegfx::BColor maTextFillColor;
+ basegfx::BColor maTextLineColor;
+ basegfx::BColor maOverlineColor;
+
+ Region maRegion;
+ Font maFont;
+ RasterOp maRasterOp;
+ sal_uInt32 mnLayoutMode;
+ LanguageType maLanguageType;
+
+ /// bitfield
+ bool mbLineColor : 1;
+ bool mbFillColor : 1;
+ bool mbTextColor : 1;
+ bool mbTextFillColor : 1;
+ bool mbTextLineColor : 1;
+ bool mbOverlineColor : 1;
+ bool mbRegion : 1;
+
+ public:
+ PropertyHolder()
+ : maTransformation(),
+ maMapUnit(MAP_100TH_MM),
+ maLineColor(),
+ maFillColor(),
+ maTextColor(COL_BLACK),
+ maTextFillColor(),
+ maTextLineColor(),
+ maOverlineColor(),
+ maRegion(),
+ maFont(),
+ maRasterOp(ROP_OVERPAINT),
+ mnLayoutMode(0),
+ maLanguageType(0),
+ mbLineColor(false),
+ mbFillColor(false),
+ mbTextColor(true),
+ mbTextFillColor(false),
+ mbTextLineColor(false),
+ mbOverlineColor(false),
+ mbRegion(false)
+ {
+ }
+
+ ~PropertyHolder()
+ {
+ }
+
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ void setTransformation(const basegfx::B2DHomMatrix& rNew) { if(rNew != maTransformation) maTransformation = rNew; }
+
+ MapUnit getMapUnit() const { return maMapUnit; }
+ void setMapUnit(MapUnit eNew) { if(eNew != maMapUnit) maMapUnit = eNew; }
+
+ const basegfx::BColor& getLineColor() const { return maLineColor; }
+ void setLineColor(const basegfx::BColor& rNew) { if(rNew != maLineColor) maLineColor = rNew; }
+ bool getLineColorActive() const { return mbLineColor; }
+ void setLineColorActive(bool bNew) { if(bNew != mbLineColor) mbLineColor = bNew; }
+
+ const basegfx::BColor& getFillColor() const { return maFillColor; }
+ void setFillColor(const basegfx::BColor& rNew) { if(rNew != maFillColor) maFillColor = rNew; }
+ bool getFillColorActive() const { return mbFillColor; }
+ void setFillColorActive(bool bNew) { if(bNew != mbFillColor) mbFillColor = bNew; }
+
+ const basegfx::BColor& getTextColor() const { return maTextColor; }
+ void setTextColor(const basegfx::BColor& rNew) { if(rNew != maTextColor) maTextColor = rNew; }
+ bool getTextColorActive() const { return mbTextColor; }
+ void setTextColorActive(bool bNew) { if(bNew != mbTextColor) mbTextColor = bNew; }
+
+ const basegfx::BColor& getTextFillColor() const { return maTextFillColor; }
+ void setTextFillColor(const basegfx::BColor& rNew) { if(rNew != maTextFillColor) maTextFillColor = rNew; }
+ bool getTextFillColorActive() const { return mbTextFillColor; }
+ void setTextFillColorActive(bool bNew) { if(bNew != mbTextFillColor) mbTextFillColor = bNew; }
+
+ const basegfx::BColor& getTextLineColor() const { return maTextLineColor; }
+ void setTextLineColor(const basegfx::BColor& rNew) { if(rNew != maTextLineColor) maTextLineColor = rNew; }
+ bool getTextLineColorActive() const { return mbTextLineColor; }
+ void setTextLineColorActive(bool bNew) { if(bNew != mbTextLineColor) mbTextLineColor = bNew; }
+
+ const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
+ void setOverlineColor(const basegfx::BColor& rNew) { if(rNew != maOverlineColor) maOverlineColor = rNew; }
+ bool getOverlineColorActive() const { return mbOverlineColor; }
+ void setOverlineColorActive(bool bNew) { if(bNew != mbOverlineColor) mbOverlineColor = bNew; }
+
+ const Region& getRegion() const { return maRegion; }
+ void setRegion(const Region& rRegion) { if(rRegion != maRegion) maRegion = rRegion; }
+ bool getRegionActive() const { return mbRegion; }
+ void setRegionActive(bool bNew) { if(bNew != mbRegion) mbRegion = bNew; }
+
+ const Font& getFont() const { return maFont; }
+ void setFont(const Font& rFont) { if(rFont != maFont) maFont = rFont; }
+
+ const RasterOp& getRasterOp() const { return maRasterOp; }
+ void setRasterOp(const RasterOp& rRasterOp) { if(rRasterOp != maRasterOp) maRasterOp = rRasterOp; }
+ bool isRasterOpInvert() const { return (ROP_XOR == maRasterOp || ROP_INVERT == maRasterOp); }
+ bool isRasterOpForceBlack() const { return ROP_0 == maRasterOp; }
+ bool isRasterOpActive() const { return isRasterOpInvert() || isRasterOpForceBlack(); }
+
+ sal_uInt32 getLayoutMode() const { return mnLayoutMode; }
+ void setLayoutMode(sal_uInt32 nNew) { if(nNew != mnLayoutMode) mnLayoutMode = nNew; }
+
+ LanguageType getLanguageType() const { return maLanguageType; }
+ void setLanguageType(LanguageType aNew) { if(aNew != maLanguageType) maLanguageType = aNew; }
+
+ bool getLineOrFillActive() const { return (mbLineColor || mbFillColor); }
+ };
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ class PropertyHolders
+ {
+ private:
+ std::vector< PropertyHolder* > maPropertyHolders;
+
+ public:
+ PropertyHolders()
+ {
+ maPropertyHolders.push_back(new PropertyHolder());
+ }
+
+ sal_uInt32 size()
+ {
+ return maPropertyHolders.size();
+ }
+
+ void Push()
+ {
+ OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)");
+ maPropertyHolders.push_back(new PropertyHolder(*maPropertyHolders[maPropertyHolders.size() - 1]));
+ }
+
+ void Pop()
+ {
+ OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: POP with no property holders (!)");
+ if(maPropertyHolders.size())
+ {
+ delete maPropertyHolders[maPropertyHolders.size() - 1];
+ maPropertyHolders.pop_back();
+ }
+ }
+
+ PropertyHolder& Current()
+ {
+ OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: CURRENT with no property holders (!)");
+ return *maPropertyHolders[maPropertyHolders.size() - 1];
+ }
+
+ ~PropertyHolders()
+ {
+ while(maPropertyHolders.size())
+ {
+ Pop();
+ }
+ }
+ };
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ basegfx::B2DPolyPolygon getB2DPolyPolygonFromRegion(const Region& rRegion)
+ {
+ basegfx::B2DPolyPolygon aRetval;
+
+ if(!rRegion.IsEmpty())
+ {
+ Region aRegion(rRegion);
+ aRetval = aRegion.GetB2DPolyPolygon();
+
+ if(!aRetval.count())
+ {
+ RegionHandle aRegionHandle(aRegion.BeginEnumRects());
+ Rectangle aRegionRectangle;
+
+ while(aRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
+ {
+ if(!aRegionRectangle.IsEmpty())
+ {
+ const basegfx::B2DRange aRegionRange(
+ aRegionRectangle.Left(), aRegionRectangle.Top(),
+ aRegionRectangle.Right(), aRegionRectangle.Bottom());
+ aRetval.append(basegfx::tools::createPolygonFromRect(aRegionRange));
+ }
+ }
+
+ aRegion.EndEnumRects(aRegionHandle);
+ }
+ }
+
+ return aRetval;
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ class TargetHolder
+ {
+ private:
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aTargets;
+
+ public:
+ TargetHolder()
+ : aTargets()
+ {
+ }
+
+ ~TargetHolder()
+ {
+ const sal_uInt32 nCount(aTargets.size());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ delete aTargets[a];
+ }
+ }
+
+ sal_uInt32 size()
+ {
+ return aTargets.size();
+ }
+
+ void append(drawinglayer::primitive2d::BasePrimitive2D* pCandidate)
+ {
+ if(pCandidate)
+ {
+ aTargets.push_back(pCandidate);
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence(const PropertyHolder& rPropertyHolder)
+ {
+ const sal_uInt32 nCount(aTargets.size());
+ drawinglayer::primitive2d::Primitive2DSequence xRetval(nCount);
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ xRetval[a] = aTargets[a];
+ }
+
+ // All Targets were pointers, but do not need to be deleted since they
+ // were converted to UNO API references now, so they stay as long as
+ // referenced. Do NOT delete the C++ implementation classes here, but clear
+ // the buffer to not delete them in the destructor.
+ aTargets.clear();
+
+ if(xRetval.hasElements() && rPropertyHolder.getRegionActive())
+ {
+ const Region& rRegion = rPropertyHolder.getRegion();
+
+ if(!rRegion.IsEmpty())
+ {
+ basegfx::B2DPolyPolygon aClipPolyPolygon(getB2DPolyPolygonFromRegion(rRegion));
+
+ if(aClipPolyPolygon.count())
+ {
+ aClipPolyPolygon.transform(rPropertyHolder.getTransformation());
+
+ const drawinglayer::primitive2d::Primitive2DReference xMask(
+ new drawinglayer::primitive2d::MaskPrimitive2D(
+ aClipPolyPolygon,
+ xRetval));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xMask, 1);
+ }
+ }
+ }
+
+ return xRetval;
+ }
+ };
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ class TargetHolders
+ {
+ private:
+ std::vector< TargetHolder* > maTargetHolders;
+
+ public:
+ TargetHolders()
+ {
+ maTargetHolders.push_back(new TargetHolder());
+ }
+
+ sal_uInt32 size()
+ {
+ return maTargetHolders.size();
+ }
+
+ void Push()
+ {
+ maTargetHolders.push_back(new TargetHolder());
+ }
+
+ void Pop()
+ {
+ OSL_ENSURE(maTargetHolders.size(), "TargetHolders: POP with no property holders (!)");
+ if(maTargetHolders.size())
+ {
+ delete maTargetHolders[maTargetHolders.size() - 1];
+ maTargetHolders.pop_back();
+ }
+ }
+
+ TargetHolder& Current()
+ {
+ OSL_ENSURE(maTargetHolders.size(), "TargetHolders: CURRENT with no property holders (!)");
+ return *maTargetHolders[maTargetHolders.size() - 1];
+ }
+
+ ~TargetHolders()
+ {
+ while(maTargetHolders.size())
+ {
+ Pop();
+ }
+ }
+ };
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** NonOverlappingFillGradientPrimitive2D class
+
+ This is a special version of the FillGradientPrimitive2D which decomposes
+ to a non-overlapping geometry version of the gradient. This needs to be
+ used to support the old XOR paint-'trick'.
+
+ It does not need an own identifier since a renderer who wants to interpret
+ it itself may do so. It just overloads the decomposition of the C++
+ implementation class to do an alternative decomposition.
+ */
+ class NonOverlappingFillGradientPrimitive2D : public FillGradientPrimitive2D
+ {
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ NonOverlappingFillGradientPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const attribute::FillGradientAttribute& rFillGradient)
+ : FillGradientPrimitive2D(rObjectRange, rFillGradient)
+ {
+ }
+ };
+
+ Primitive2DSequence NonOverlappingFillGradientPrimitive2D::create2DDecomposition(
+ const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ return createFill(false);
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ basegfx::B2DHomMatrix getTransformFromMapMode(const MapMode& rMapMode)
+ {
+ basegfx::B2DHomMatrix aMapping;
+ const Fraction aNoScale(1, 1);
+ const Point& rOrigin(rMapMode.GetOrigin());
+
+ if(0 != rOrigin.X() || 0 != rOrigin.Y())
+ {
+ aMapping.translate(rOrigin.X(), rOrigin.Y());
+ }
+
+ if(rMapMode.GetScaleX() != aNoScale || rMapMode.GetScaleY() != aNoScale)
+ {
+ aMapping.scale(
+ double(rMapMode.GetScaleX()),
+ double(rMapMode.GetScaleY()));
+ }
+
+ return aMapping;
+ }
+
+ void createPointArrayPrimitive(
+ const std::vector< basegfx::B2DPoint >& rPositions,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties,
+ basegfx::BColor aBColor)
+ {
+ if(rPositions.size())
+ {
+ if(rProperties.getTransformation().isIdentity())
+ {
+ rTarget.append(
+ new drawinglayer::primitive2d::PointArrayPrimitive2D(
+ rPositions,
+ aBColor));
+ }
+ else
+ {
+ std::vector< basegfx::B2DPoint > aPositions(rPositions);
+
+ for(sal_uInt32 a(0); a < aPositions.size(); a++)
+ {
+ aPositions[a] = rProperties.getTransformation() * aPositions[a];
+ }
+
+ rTarget.append(
+ new drawinglayer::primitive2d::PointArrayPrimitive2D(
+ aPositions,
+ aBColor));
+ }
+ }
+ }
+
+ void createHairlinePrimitive(
+ const basegfx::B2DPolygon& rLinePolygon,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties)
+ {
+ if(rLinePolygon.count())
+ {
+ basegfx::B2DPolygon aLinePolygon(rLinePolygon);
+ aLinePolygon.transform(rProperties.getTransformation());
+ rTarget.append(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ aLinePolygon,
+ rProperties.getLineColor()));
+ }
+ }
+
+ void createFillPrimitive(
+ const basegfx::B2DPolyPolygon& rFillPolyPolygon,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties)
+ {
+ if(rFillPolyPolygon.count())
+ {
+ basegfx::B2DPolyPolygon aFillPolyPolygon(rFillPolyPolygon);
+ aFillPolyPolygon.transform(rProperties.getTransformation());
+ rTarget.append(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ aFillPolyPolygon,
+ rProperties.getFillColor()));
+ }
+ }
+
+ void createLinePrimitive(
+ const basegfx::B2DPolygon& rLinePolygon,
+ const LineInfo& rLineInfo,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties)
+ {
+ if(rLinePolygon.count())
+ {
+ const bool bDashDotUsed(LINE_DASH == rLineInfo.GetStyle());
+ const bool bWidthUsed(rLineInfo.GetWidth() > 1);
+
+ if(bDashDotUsed || bWidthUsed)
+ {
+ basegfx::B2DPolygon aLinePolygon(rLinePolygon);
+ aLinePolygon.transform(rProperties.getTransformation());
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ rProperties.getLineColor(),
+ bWidthUsed ? rLineInfo.GetWidth() : 0.0,
+ rLineInfo.GetLineJoin());
+
+ if(bDashDotUsed)
+ {
+ ::std::vector< double > fDotDashArray;
+ const double fDashLen(rLineInfo.GetDashLen());
+ const double fDotLen(rLineInfo.GetDotLen());
+ const double fDistance(rLineInfo.GetDistance());
+
+ for(sal_uInt16 a(0); a < rLineInfo.GetDashCount(); a++)
+ {
+ fDotDashArray.push_back(fDashLen);
+ fDotDashArray.push_back(fDistance);
+ }
+
+ for(sal_uInt16 b(0); b < rLineInfo.GetDotCount(); b++)
+ {
+ fDotDashArray.push_back(fDotLen);
+ fDotDashArray.push_back(fDistance);
+ }
+
+ const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0));
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
+ fDotDashArray,
+ fAccumulated);
+
+ rTarget.append(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ aLinePolygon,
+ aLineAttribute,
+ aStrokeAttribute));
+ }
+ else
+ {
+ rTarget.append(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ aLinePolygon,
+ aLineAttribute));
+ }
+ }
+ else
+ {
+ createHairlinePrimitive(rLinePolygon, rTarget, rProperties);
+ }
+ }
+ }
+
+ void createHairlineAndFillPrimitive(
+ const basegfx::B2DPolygon& rPolygon,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties)
+ {
+ if(rProperties.getFillColorActive())
+ {
+ createFillPrimitive(basegfx::B2DPolyPolygon(rPolygon), rTarget, rProperties);
+ }
+
+ if(rProperties.getLineColorActive())
+ {
+ createHairlinePrimitive(rPolygon, rTarget, rProperties);
+ }
+ }
+
+ void createHairlineAndFillPrimitive(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties)
+ {
+ if(rProperties.getFillColorActive())
+ {
+ createFillPrimitive(rPolyPolygon, rTarget, rProperties);
+ }
+
+ if(rProperties.getLineColorActive())
+ {
+ for(sal_uInt32 a(0); a < rPolyPolygon.count(); a++)
+ {
+ createHairlinePrimitive(rPolyPolygon.getB2DPolygon(a), rTarget, rProperties);
+ }
+ }
+ }
+
+ void createBitmapExPrimitive(
+ const BitmapEx& rBitmapEx,
+ const Point& rPoint,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties)
+ {
+ if(!rBitmapEx.IsEmpty())
+ {
+ basegfx::B2DPoint aPoint(rPoint.X(), rPoint.Y());
+ aPoint = rProperties.getTransformation() * aPoint;
+
+ rTarget.append(
+ new drawinglayer::primitive2d::DiscreteBitmapPrimitive2D(
+ rBitmapEx,
+ aPoint));
+ }
+ }
+
+ void createBitmapExPrimitive(
+ const BitmapEx& rBitmapEx,
+ const Point& rPoint,
+ const Size& rSize,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperties)
+ {
+ if(!rBitmapEx.IsEmpty())
+ {
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, rSize.Width());
+ aObjectTransform.set(1, 1, rSize.Height());
+ aObjectTransform.set(0, 2, rPoint.X());
+ aObjectTransform.set(1, 2, rPoint.Y());
+
+ aObjectTransform = rProperties.getTransformation() * aObjectTransform;
+
+ rTarget.append(
+ new drawinglayer::primitive2d::BitmapPrimitive2D(
+ rBitmapEx,
+ aObjectTransform));
+ }
+ }
+
+ BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor)
+ {
+ const Color aWhite(COL_WHITE);
+ BitmapPalette aBiLevelPalette(2);
+
+ aBiLevelPalette[0] = aWhite;
+ aBiLevelPalette[1] = rMaskColor;
+
+ Bitmap aMask(rBitmap.CreateMask(aWhite));
+ Bitmap aSolid(rBitmap.GetSizePixel(), 1, &aBiLevelPalette);
+
+ aSolid.Erase(rMaskColor);
+
+ return BitmapEx(aSolid, aMask);
+ }
+
+ drawinglayer::attribute::FillGradientAttribute createFillGradientAttribute(const Gradient& rGradient)
+ {
+ const Color aStartColor(rGradient.GetStartColor());
+ const sal_uInt16 nStartIntens(rGradient.GetStartIntensity());
+ basegfx::BColor aStart(aStartColor.getBColor());
+
+ if(nStartIntens != 100)
+ {
+ const basegfx::BColor aBlack;
+ aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01);
+ }
+
+ const Color aEndColor(rGradient.GetEndColor());
+ const sal_uInt16 nEndIntens(rGradient.GetEndIntensity());
+ basegfx::BColor aEnd(aEndColor.getBColor());
+
+ if(nEndIntens != 100)
+ {
+ const basegfx::BColor aBlack;
+ aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
+ }
+
+ drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GRADIENTSTYLE_RECT);
+
+ switch(rGradient.GetStyle())
+ {
+ case GRADIENT_LINEAR :
+ {
+ aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_LINEAR;
+ break;
+ }
+ case GRADIENT_AXIAL :
+ {
+ aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_AXIAL;
+ break;
+ }
+ case GRADIENT_RADIAL :
+ {
+ aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RADIAL;
+ break;
+ }
+ case GRADIENT_ELLIPTICAL :
+ {
+ aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_ELLIPTICAL;
+ break;
+ }
+ case GRADIENT_SQUARE :
+ {
+ aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_SQUARE;
+ break;
+ }
+ default : // GRADIENT_RECT
+ {
+ aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RECT;
+ break;
+ }
+ }
+
+ return drawinglayer::attribute::FillGradientAttribute(
+ aGradientStyle,
+ (double)rGradient.GetBorder() * 0.01,
+ (double)rGradient.GetOfsX() * 0.01,
+ (double)rGradient.GetOfsY() * 0.01,
+ (double)rGradient.GetAngle() * F_PI1800,
+ aStart,
+ aEnd,
+ rGradient.GetSteps());
+ }
+
+ drawinglayer::attribute::FillHatchAttribute createFillHatchAttribute(const Hatch& rHatch)
+ {
+ drawinglayer::attribute::HatchStyle aHatchStyle(drawinglayer::attribute::HATCHSTYLE_SINGLE);
+
+ switch(rHatch.GetStyle())
+ {
+ default : // case HATCH_SINGLE :
+ {
+ aHatchStyle = drawinglayer::attribute::HATCHSTYLE_SINGLE;
+ }
+ case HATCH_DOUBLE :
+ {
+ aHatchStyle = drawinglayer::attribute::HATCHSTYLE_DOUBLE;
+ }
+ case HATCH_TRIPLE :
+ {
+ aHatchStyle = drawinglayer::attribute::HATCHSTYLE_TRIPLE;
+ }
+ }
+
+ return drawinglayer::attribute::FillHatchAttribute(
+ aHatchStyle,
+ (double)rHatch.GetDistance(),
+ (double)rHatch.GetAngle() * F_PI1800,
+ rHatch.GetColor().getBColor(),
+ false);
+ }
+
+ void HandleNewClipRegion(
+ const Region* pRegion,
+ TargetHolders& rTargetHolders,
+ PropertyHolders& rPropertyHolders)
+ {
+ // process evtl. created primitives which belong to the current region settings
+ if(rPropertyHolders.Current().getRegionActive() && rTargetHolders.size() > 1)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aSubContent;
+
+ if(!rPropertyHolders.Current().getRegion().IsEmpty() && rTargetHolders.Current().size())
+ {
+ aSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current());
+ }
+
+ rTargetHolders.Pop();
+
+ if(aSubContent.hasElements())
+ {
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::GroupPrimitive2D(
+ aSubContent));
+ }
+ }
+
+ // apply new settings
+ const bool bNewActive(pRegion);
+ rPropertyHolders.Current().setRegionActive(bNewActive);
+
+ if(bNewActive)
+ {
+ rPropertyHolders.Current().setRegion(*pRegion);
+
+ // prepare new content holder for new active region
+ rTargetHolders.Push();
+ }
+ }
+
+ void HandleNewRasterOp(
+ RasterOp aRasterOp,
+ TargetHolders& rTargetHolders,
+ PropertyHolders& rPropertyHolders)
+ {
+ // check if currently active
+ if(rPropertyHolders.Current().isRasterOpActive() && rTargetHolders.size() > 1)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aSubContent;
+
+ if(rTargetHolders.Current().size())
+ {
+ aSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current());
+ }
+
+ rTargetHolders.Pop();
+
+ if(aSubContent.hasElements())
+ {
+ if(rPropertyHolders.Current().isRasterOpForceBlack())
+ {
+ // force content to black
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::ModifiedColorPrimitive2D(
+ aSubContent,
+ basegfx::BColorModifier(basegfx::BColor(0.0, 0.0, 0.0))));
+ }
+ else // if(rPropertyHolders.Current().isRasterOpInvert())
+ {
+ // invert content
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aSubContent));
+ }
+ }
+ }
+
+ // apply new settings
+ rPropertyHolders.Current().setRasterOp(aRasterOp);
+
+ // check if now active
+ if(rPropertyHolders.Current().isRasterOpActive())
+ {
+ // prepare new content holder for new invert
+ rTargetHolders.Push();
+ }
+ }
+
+ drawinglayer::primitive2d::BasePrimitive2D* CreateColorWallpaper(
+ const basegfx::B2DRange& rRange,
+ const basegfx::BColor& rColor,
+ PropertyHolder& rPropertyHolder)
+ {
+ basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange));
+ aOutline.transform(rPropertyHolder.getTransformation());
+
+ return new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aOutline),
+ rColor);
+ }
+
+ drawinglayer::primitive2d::BasePrimitive2D* CreateGradientWallpaper(
+ const basegfx::B2DRange& rRange,
+ const Gradient& rGradient,
+ PropertyHolder& rPropertyHolder)
+ {
+ const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient));
+
+ if(aAttribute.getStartColor() == aAttribute.getEndColor())
+ {
+ // not really a gradient. Create filled rectangle
+ return CreateColorWallpaper(rRange, aAttribute.getStartColor(), rPropertyHolder);
+ }
+ else
+ {
+ // really a gradient
+ drawinglayer::primitive2d::BasePrimitive2D* pRetval =
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ rRange,
+ aAttribute);
+
+ if(!rPropertyHolder.getTransformation().isIdentity())
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xPrim(pRetval);
+ const drawinglayer::primitive2d::Primitive2DSequence xSeq(&xPrim, 1);
+
+ pRetval = new drawinglayer::primitive2d::TransformPrimitive2D(
+ rPropertyHolder.getTransformation(),
+ xSeq);
+ }
+
+ return pRetval;
+ }
+ }
+
+ void CreateAndAppendBitmapWallpaper(
+ basegfx::B2DRange aWallpaperRange,
+ const Wallpaper& rWallpaper,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperty)
+ {
+ const BitmapEx aBitmapEx(rWallpaper.GetBitmap());
+ const WallpaperStyle eWallpaperStyle(rWallpaper.GetStyle());
+
+ // if bitmap visualisation is transparent, maybe background
+ // needs to be filled. Create background
+ if(aBitmapEx.IsTransparent()
+ || (WALLPAPER_TILE != eWallpaperStyle && WALLPAPER_SCALE != eWallpaperStyle))
+ {
+ if(rWallpaper.IsGradient())
+ {
+ rTarget.append(
+ CreateGradientWallpaper(
+ aWallpaperRange,
+ rWallpaper.GetGradient(),
+ rProperty));
+ }
+ else if(!rWallpaper.GetColor().GetTransparency())
+ {
+ rTarget.append(
+ CreateColorWallpaper(
+ aWallpaperRange,
+ rWallpaper.GetColor().getBColor(),
+ rProperty));
+ }
+ }
+
+ // use wallpaper rect if set
+ if(rWallpaper.IsRect() && !rWallpaper.GetRect().IsEmpty())
+ {
+ aWallpaperRange = basegfx::B2DRange(
+ rWallpaper.GetRect().Left(), rWallpaper.GetRect().Top(),
+ rWallpaper.GetRect().Right(), rWallpaper.GetRect().Bottom());
+ }
+
+ drawinglayer::primitive2d::BasePrimitive2D* pBitmapWallpaperFill =
+ new drawinglayer::primitive2d::WallpaperBitmapPrimitive2D(
+ aWallpaperRange,
+ aBitmapEx,
+ eWallpaperStyle);
+
+ if(rProperty.getTransformation().isIdentity())
+ {
+ // add directly
+ rTarget.append(pBitmapWallpaperFill);
+ }
+ else
+ {
+ // when a transformation is set, embed to it
+ const drawinglayer::primitive2d::Primitive2DReference xPrim(pBitmapWallpaperFill);
+
+ rTarget.append(
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ rProperty.getTransformation(),
+ drawinglayer::primitive2d::Primitive2DSequence(&xPrim, 1)));
+ }
+ }
+
+ drawinglayer::primitive2d::TextLine mapTextLineStyle(FontUnderline eLineStyle)
+ {
+ switch(eLineStyle)
+ {
+ case UNDERLINE_SINGLE: return drawinglayer::primitive2d::TEXT_LINE_SINGLE;
+ case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLE;
+ case UNDERLINE_DOTTED: return drawinglayer::primitive2d::TEXT_LINE_DOTTED;
+ case UNDERLINE_DASH: return drawinglayer::primitive2d::TEXT_LINE_DASH;
+ case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::TEXT_LINE_LONGDASH;
+ case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOT;
+ case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOTDOT;
+ case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::TEXT_LINE_SMALLWAVE;
+ case UNDERLINE_WAVE: return drawinglayer::primitive2d::TEXT_LINE_WAVE;
+ case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLEWAVE;
+ case UNDERLINE_BOLD: return drawinglayer::primitive2d::TEXT_LINE_BOLD;
+ case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::TEXT_LINE_BOLDDOTTED;
+ case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASH;
+ case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDLONGDASH;
+ case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOT;
+ case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOTDOT;
+ case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::TEXT_LINE_BOLDWAVE;
+ // FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE
+ default: return drawinglayer::primitive2d::TEXT_LINE_NONE;
+ }
+ }
+
+ bool isUnderlineAbove(const Font& rFont)
+ {
+ if(!rFont.IsVertical())
+ {
+ return false;
+ }
+
+ if((LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()))
+ {
+ // the underline is right for Japanese only
+ return true;
+ }
+
+ return false;
+ }
+
+ void proccessMetaTextAction(
+ const Point& rTextStartPosition,
+ const XubString& rText,
+ sal_uInt16 nTextStart,
+ sal_uInt16 nTextLength,
+ sal_Int32* pDXArray,
+ TargetHolder& rTarget,
+ PropertyHolder& rProperty)
+ {
+ drawinglayer::primitive2d::BasePrimitive2D* pResult = 0;
+ const Font& rFont = rProperty.getFont();
+ std::vector< double > aDXArray;
+
+ if(nTextLength)
+ {
+ // get current font and create FontScaling and FontAttribute
+ basegfx::B2DVector aFontScaling;
+ const drawinglayer::attribute::FontAttribute aFontAttribute(
+ drawinglayer::primitive2d::getFontAttributeFromVclFont(
+ aFontScaling,
+ rFont,
+ 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_RTL),
+ 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_STRONG)));
+
+ // create TextTransform
+ basegfx::B2DHomMatrix aTextTransform;
+
+ // add FontScaling
+ aTextTransform.scale(aFontScaling.getX(), aFontScaling.getY());
+
+ // take text align into account
+ if(ALIGN_BASELINE != rFont.GetAlign())
+ {
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
+ aTextLayouterDevice.setFont(rFont);
+
+ if(ALIGN_TOP == rFont.GetAlign())
+ {
+ aTextTransform.translate(
+ 0.0,
+ aTextLayouterDevice.getFontAscent());
+ }
+ else // ALIGN_BOTTOM
+ {
+ aTextTransform.translate(
+ 0.0,
+ -aTextLayouterDevice.getFontDescent());
+ }
+ }
+
+ // add FontRotation (if used)
+ if(rFont.GetOrientation())
+ {
+ aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800);
+ }
+
+ // add TextStartPosition
+ aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y());
+
+ // preapare DXArray (if used)
+ if(pDXArray && nTextLength)
+ {
+ aDXArray.reserve(nTextLength);
+
+ for(xub_StrLen a(0); a < nTextLength; a++)
+ {
+ aDXArray.push_back((double)(*(pDXArray + a)));
+ }
+ }
+
+ // prepare FontColor and Locale
+ const basegfx::BColor aFontColor(rProperty.getTextColor());
+ const com::sun::star::lang::Locale aLocale(MsLangId::convertLanguageToLocale(rProperty.getLanguageType()));
+ const bool bWordLineMode(rFont.IsWordLineMode());
+
+ const bool bDecoratedIsNeeded(
+ UNDERLINE_NONE != rFont.GetOverline()
+ || UNDERLINE_NONE != rFont.GetUnderline()
+ || STRIKEOUT_NONE != rFont.GetStrikeout()
+ || EMPHASISMARK_NONE != (rFont.GetEmphasisMark() & EMPHASISMARK_STYLE)
+ || RELIEF_NONE != rFont.GetRelief()
+ || rFont.IsShadow()
+ || bWordLineMode);
+
+ if(bDecoratedIsNeeded)
+ {
+ // prepare overline and underline data
+ const drawinglayer::primitive2d::TextLine eFontOverline(mapTextLineStyle(rFont.GetOverline()));
+ const drawinglayer::primitive2d::TextLine eFontUnderline(mapTextLineStyle(rFont.GetUnderline()));
+
+ // check UndelineAbove
+ const bool bUnderlineAbove(drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && isUnderlineAbove(rFont));
+
+ // prepare strikeout data
+ drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE);
+
+ switch(rFont.GetStrikeout())
+ {
+ case STRIKEOUT_SINGLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SINGLE; break;
+ case STRIKEOUT_DOUBLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_DOUBLE; break;
+ case STRIKEOUT_BOLD: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_BOLD; break;
+ case STRIKEOUT_SLASH: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SLASH; break;
+ case STRIKEOUT_X: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_X; break;
+ default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW
+ }
+
+ // prepare emphasis mark data
+ drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE);
+
+ switch(rFont.GetEmphasisMark() & EMPHASISMARK_STYLE)
+ {
+ case EMPHASISMARK_DOT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DOT; break;
+ case EMPHASISMARK_CIRCLE : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_CIRCLE; break;
+ case EMPHASISMARK_DISC : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DISC; break;
+ case EMPHASISMARK_ACCENT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_ACCENT; break;
+ }
+
+ const bool bEmphasisMarkAbove(rFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE);
+ const bool bEmphasisMarkBelow(rFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW);
+
+ // prepare font relief data
+ drawinglayer::primitive2d::FontRelief eFontRelief(drawinglayer::primitive2d::FONT_RELIEF_NONE);
+
+ switch(rFont.GetRelief())
+ {
+ case RELIEF_EMBOSSED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_EMBOSSED; break;
+ case RELIEF_ENGRAVED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_ENGRAVED; break;
+ default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE
+ }
+
+ // prepare shadow/outline data
+ const bool bShadow(rFont.IsShadow());
+
+ // TextDecoratedPortionPrimitive2D is needed, create one
+ pResult = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D(
+
+ // attributes for TextSimplePortionPrimitive2D
+ aTextTransform,
+ rText,
+ nTextStart,
+ nTextLength,
+ aDXArray,
+ aFontAttribute,
+ aLocale,
+ aFontColor,
+
+ // attributes for TextDecoratedPortionPrimitive2D
+ rProperty.getOverlineColorActive() ? rProperty.getOverlineColor() : aFontColor,
+ rProperty.getTextLineColorActive() ? rProperty.getTextLineColor() : aFontColor,
+ eFontOverline,
+ eFontUnderline,
+ bUnderlineAbove,
+ eFontStrikeout,
+ bWordLineMode,
+ eFontEmphasisMark,
+ bEmphasisMarkAbove,
+ bEmphasisMarkBelow,
+ eFontRelief,
+ bShadow);
+ }
+ else
+ {
+ // TextSimplePortionPrimitive2D is enough
+ pResult = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aTextTransform,
+ rText,
+ nTextStart,
+ nTextLength,
+ aDXArray,
+ aFontAttribute,
+ aLocale,
+ aFontColor);
+ }
+ }
+
+ if(pResult && rProperty.getTextFillColorActive())
+ {
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
+ const bool bRotated(rFont.GetOrientation());
+
+ if(bRotated)
+ {
+ // use unrotated font
+ Font aUnrotatedFont(rFont);
+ aUnrotatedFont.SetOrientation(0);
+ aTextLayouterDevice.setFont(aUnrotatedFont);
+ }
+ else
+ {
+ aTextLayouterDevice.setFont(rFont);
+ }
+
+ // get base range
+ basegfx::B2DRange aTextRange(
+ aTextLayouterDevice.getTextBoundRect(
+ rText, nTextStart, nTextLength));
+
+ if(aDXArray.size())
+ {
+ // use the last entry in DXArray to correct the width
+ aTextRange = basegfx::B2DRange(
+ aTextRange.getMinX(),
+ aTextRange.getMinY(),
+ aTextRange.getMinX() + aDXArray[aDXArray.size() - 1],
+ aTextRange.getMaxY());
+ }
+
+ // create Transform. Scale and Alignment are already applied.
+ basegfx::B2DHomMatrix aTextTransform;
+
+ if(bRotated)
+ {
+ aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800);
+ }
+
+ aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y());
+
+ // prepare Primitive2DSequence, put text in foreground
+ drawinglayer::primitive2d::Primitive2DSequence aSequence(2);
+ aSequence[1] = drawinglayer::primitive2d::Primitive2DReference(pResult);
+
+ // prepare filled polygon
+ basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aTextRange));
+ aOutline.transform(aTextTransform);
+
+ aSequence[0] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aOutline),
+ rProperty.getTextFillColor()));
+
+ // set as group at pResult
+ pResult = new drawinglayer::primitive2d::GroupPrimitive2D(aSequence);
+ }
+
+ if(pResult)
+ {
+ // add created text primitive to target
+ if(rProperty.getTransformation().isIdentity())
+ {
+ rTarget.append(pResult);
+ }
+ else
+ {
+ // when a transformation is set, embed to it
+ const drawinglayer::primitive2d::Primitive2DReference aReference(pResult);
+
+ rTarget.append(
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ rProperty.getTransformation(),
+ drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1)));
+ }
+ }
+ }
+
+ void interpretMetafile(
+ const GDIMetaFile& rMetaFile,
+ TargetHolders& rTargetHolders,
+ PropertyHolders& rPropertyHolders,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation)
+ {
+ const sal_uInt32 nCount(rMetaFile.GetActionCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ MetaAction* pAction = rMetaFile.GetAction(a);
+
+ switch(pAction->GetType())
+ {
+ case META_NULL_ACTION :
+ {
+ /** SIMPLE, DONE */
+ break;
+ }
+ case META_PIXEL_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ std::vector< basegfx::B2DPoint > aPositions;
+ Color aLastColor(COL_BLACK);
+
+ while(META_PIXEL_ACTION == pAction->GetType() && a < nCount)
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*)pAction;
+
+ if(pA->GetColor() != aLastColor)
+ {
+ if(aPositions.size())
+ {
+ createPointArrayPrimitive(aPositions, rTargetHolders.Current(), rPropertyHolders.Current(), aLastColor.getBColor());
+ aPositions.clear();
+ }
+
+ aLastColor = pA->GetColor();
+ }
+
+ const Point& rPoint = pA->GetPoint();
+ aPositions.push_back(basegfx::B2DPoint(rPoint.X(), rPoint.Y()));
+ a++; if(a < nCount) pAction = rMetaFile.GetAction(a);
+ }
+
+ a--;
+
+ if(aPositions.size())
+ {
+ createPointArrayPrimitive(aPositions, rTargetHolders.Current(), rPropertyHolders.Current(), aLastColor.getBColor());
+ }
+
+ break;
+ }
+ case META_POINT_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineColorActive())
+ {
+ std::vector< basegfx::B2DPoint > aPositions;
+
+ while(META_POINT_ACTION == pAction->GetType() && a < nCount)
+ {
+ const MetaPointAction* pA = (const MetaPointAction*)pAction;
+ const Point& rPoint = pA->GetPoint();
+ aPositions.push_back(basegfx::B2DPoint(rPoint.X(), rPoint.Y()));
+ a++; if(a < nCount) pAction = rMetaFile.GetAction(a);
+ }
+
+ a--;
+
+ if(aPositions.size())
+ {
+ createPointArrayPrimitive(aPositions, rTargetHolders.Current(), rPropertyHolders.Current(), rPropertyHolders.Current().getLineColor());
+ }
+ }
+
+ break;
+ }
+ case META_LINE_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineColorActive())
+ {
+ basegfx::B2DPolygon aLinePolygon;
+ LineInfo aLineInfo;
+
+ while(META_LINE_ACTION == pAction->GetType() && a < nCount)
+ {
+ const MetaLineAction* pA = (const MetaLineAction*)pAction;
+ const Point& rStartPoint = pA->GetStartPoint();
+ const Point& rEndPoint = pA->GetEndPoint();
+ const basegfx::B2DPoint aStart(rStartPoint.X(), rStartPoint.Y());
+ const basegfx::B2DPoint aEnd(rEndPoint.X(), rEndPoint.Y());
+
+ if(aLinePolygon.count())
+ {
+ if(pA->GetLineInfo() == aLineInfo
+ && aStart == aLinePolygon.getB2DPoint(aLinePolygon.count() - 1))
+ {
+ aLinePolygon.append(aEnd);
+ }
+ else
+ {
+ aLineInfo.SetLineJoin(basegfx::B2DLINEJOIN_NONE); // It were lines; force to NONE
+ createLinePrimitive(aLinePolygon, aLineInfo, rTargetHolders.Current(), rPropertyHolders.Current());
+ aLinePolygon.clear();
+ aLineInfo = pA->GetLineInfo();
+ aLinePolygon.append(aStart);
+ aLinePolygon.append(aEnd);
+ }
+ }
+ else
+ {
+ aLineInfo = pA->GetLineInfo();
+ aLinePolygon.append(aStart);
+ aLinePolygon.append(aEnd);
+ }
+
+ a++; if(a < nCount) pAction = rMetaFile.GetAction(a);
+ }
+
+ a--;
+
+ if(aLinePolygon.count())
+ {
+ aLineInfo.SetLineJoin(basegfx::B2DLINEJOIN_NONE); // It were lines; force to NONE
+ createLinePrimitive(aLinePolygon, aLineInfo, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+ }
+
+ break;
+ }
+ case META_RECT_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineOrFillActive())
+ {
+ const MetaRectAction* pA = (const MetaRectAction*)pAction;
+ const Rectangle& rRectangle = pA->GetRect();
+
+ if(!rRectangle.IsEmpty())
+ {
+ const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ if(!aRange.isEmpty())
+ {
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+ }
+ }
+
+ break;
+ }
+ case META_ROUNDRECT_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ /** The original OutputDevice::DrawRect paints nothing when nHor or nVer is zero; but just
+ because the tools::Polygon operator creating the rounding does produce nonsense. I assume
+ this an error and create an unrounded rectangle in that case (implicit in
+ createPolygonFromRect)
+ */
+ if(rPropertyHolders.Current().getLineOrFillActive())
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*)pAction;
+ const Rectangle& rRectangle = pA->GetRect();
+
+ if(!rRectangle.IsEmpty())
+ {
+ const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ if(!aRange.isEmpty())
+ {
+ const sal_uInt32 nHor(pA->GetHorzRound());
+ const sal_uInt32 nVer(pA->GetVertRound());
+ basegfx::B2DPolygon aOutline;
+
+ if(nHor || nVer)
+ {
+ double fRadiusX((nHor * 2.0) / (aRange.getWidth() > 0.0 ? aRange.getWidth() : 1.0));
+ double fRadiusY((nVer * 2.0) / (aRange.getHeight() > 0.0 ? aRange.getHeight() : 1.0));
+ fRadiusX = std::max(0.0, std::min(1.0, fRadiusX));
+ fRadiusY = std::max(0.0, std::min(1.0, fRadiusY));
+
+ aOutline = basegfx::tools::createPolygonFromRect(aRange, fRadiusX, fRadiusY);
+ }
+ else
+ {
+ aOutline = basegfx::tools::createPolygonFromRect(aRange);
+ }
+
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+ }
+ }
+
+ break;
+ }
+ case META_ELLIPSE_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineOrFillActive())
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*)pAction;
+ const Rectangle& rRectangle = pA->GetRect();
+
+ if(!rRectangle.IsEmpty())
+ {
+ const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ if(!aRange.isEmpty())
+ {
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromEllipse(
+ aRange.getCenter(), aRange.getWidth() * 0.5, aRange.getHeight() * 0.5));
+
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+ }
+ }
+
+ break;
+ }
+ case META_ARC_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineColorActive())
+ {
+ const MetaArcAction* pA = (const MetaArcAction*)pAction;
+ const Polygon aToolsPoly(pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC);
+ const basegfx::B2DPolygon aOutline(aToolsPoly.getB2DPolygon());
+
+ createHairlinePrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_PIE_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineOrFillActive())
+ {
+ const MetaPieAction* pA = (const MetaPieAction*)pAction;
+ const Polygon aToolsPoly(pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE);
+ const basegfx::B2DPolygon aOutline(aToolsPoly.getB2DPolygon());
+
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_CHORD_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineOrFillActive())
+ {
+ const MetaChordAction* pA = (const MetaChordAction*)pAction;
+ const Polygon aToolsPoly(pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD);
+ const basegfx::B2DPolygon aOutline(aToolsPoly.getB2DPolygon());
+
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_POLYLINE_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineColorActive())
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*)pAction;
+ createLinePrimitive(pA->GetPolygon().getB2DPolygon(), pA->GetLineInfo(), rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_POLYGON_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineOrFillActive())
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*)pAction;
+ basegfx::B2DPolygon aOutline(pA->GetPolygon().getB2DPolygon());
+
+ // the metafile play interprets the polygons from MetaPolygonAction
+ // always as closed and always paints an edge from last to first point,
+ // so force to closed here to emulate that
+ if(aOutline.count() > 1 && !aOutline.isClosed())
+ {
+ aOutline.setClosed(true);
+ }
+
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_POLYPOLYGON_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getLineOrFillActive())
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*)pAction;
+ basegfx::B2DPolyPolygon aPolyPolygonOutline(pA->GetPolyPolygon().getB2DPolyPolygon());
+
+ // the metafile play interprets the single polygons from MetaPolyPolygonAction
+ // always as closed and always paints an edge from last to first point,
+ // so force to closed here to emulate that
+ for(sal_uInt32 a(0); a < aPolyPolygonOutline.count(); a++)
+ {
+ basegfx::B2DPolygon aPolygonOutline(aPolyPolygonOutline.getB2DPolygon(a));
+
+ if(aPolygonOutline.count() > 1 && !aPolygonOutline.isClosed())
+ {
+ aPolygonOutline.setClosed(true);
+ aPolyPolygonOutline.setB2DPolygon(a, aPolygonOutline);
+ }
+ }
+
+ createHairlineAndFillPrimitive(aPolyPolygonOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_TEXT_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaTextAction* pA = (const MetaTextAction*)pAction;
+
+ if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive())
+ {
+ proccessMetaTextAction(
+ pA->GetPoint(),
+ pA->GetText(),
+ pA->GetIndex(),
+ pA->GetLen(),
+ 0,
+ rTargetHolders.Current(),
+ rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_TEXTARRAY_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pAction;
+
+ if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive())
+ {
+ proccessMetaTextAction(
+ pA->GetPoint(),
+ pA->GetText(),
+ pA->GetIndex(),
+ pA->GetLen(),
+ pA->GetDXArray(),
+ rTargetHolders.Current(),
+ rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_STRETCHTEXT_ACTION :
+ {
+ /** NEEDS IMPLEMENTATION */
+ OSL_ENSURE(false, "META_STRETCHTEXT_ACTION requested (!)");
+ // use OutputDevice::GetTextArray() to map the...
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction;
+ break;
+ }
+ case META_TEXTRECT_ACTION :
+ {
+ /** NEEDS IMPLEMENTATION */
+ OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)");
+ const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction;
+ break;
+ }
+ case META_BMP_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaBmpAction* pA = (const MetaBmpAction*)pAction;
+ const BitmapEx aBitmapEx(pA->GetBitmap());
+
+ createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current());
+
+ break;
+ }
+ case META_BMPSCALE_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*)pAction;
+ const Bitmap aBitmapEx(pA->GetBitmap());
+
+ createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), pA->GetSize(), rTargetHolders.Current(), rPropertyHolders.Current());
+
+ break;
+ }
+ case META_BMPSCALEPART_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*)pAction;
+ const Bitmap& rBitmap = pA->GetBitmap();
+
+ if(!rBitmap.IsEmpty())
+ {
+ Bitmap aCroppedBitmap(rBitmap);
+ const Rectangle aCropRectangle(pA->GetSrcPoint(), pA->GetSrcSize());
+
+ if(!aCropRectangle.IsEmpty())
+ {
+ aCroppedBitmap.Crop(aCropRectangle);
+ }
+
+ const BitmapEx aCroppedBitmapEx(aCroppedBitmap);
+ createBitmapExPrimitive(aCroppedBitmapEx, pA->GetDestPoint(), pA->GetDestSize(), rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_BMPEX_ACTION :
+ {
+ /** CHECKED, WORKS WELL: Simply same as META_BMP_ACTION */
+ const MetaBmpExAction* pA = (const MetaBmpExAction*)pAction;
+ const BitmapEx& rBitmapEx = pA->GetBitmapEx();
+
+ createBitmapExPrimitive(rBitmapEx, pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current());
+
+ break;
+ }
+ case META_BMPEXSCALE_ACTION :
+ {
+ /** CHECKED, WORKS WELL: Simply same as META_BMPSCALE_ACTION */
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*)pAction;
+ const BitmapEx& rBitmapEx = pA->GetBitmapEx();
+
+ createBitmapExPrimitive(rBitmapEx, pA->GetPoint(), pA->GetSize(), rTargetHolders.Current(), rPropertyHolders.Current());
+
+ break;
+ }
+ case META_BMPEXSCALEPART_ACTION :
+ {
+ /** CHECKED, WORKS WELL: Simply same as META_BMPSCALEPART_ACTION */
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*)pAction;
+ const BitmapEx& rBitmapEx = pA->GetBitmapEx();
+
+ if(!rBitmapEx.IsEmpty())
+ {
+ BitmapEx aCroppedBitmapEx(rBitmapEx);
+ const Rectangle aCropRectangle(pA->GetSrcPoint(), pA->GetSrcSize());
+
+ if(!aCropRectangle.IsEmpty())
+ {
+ aCroppedBitmapEx.Crop(aCropRectangle);
+ }
+
+ createBitmapExPrimitive(aCroppedBitmapEx, pA->GetDestPoint(), pA->GetDestSize(), rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_MASK_ACTION :
+ {
+ /** CHECKED, WORKS WELL: Simply same as META_BMP_ACTION */
+ const MetaMaskAction* pA = (const MetaMaskAction*)pAction;
+ const BitmapEx aBitmapEx(createMaskBmpEx(pA->GetBitmap(), pA->GetColor()));
+
+ createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current());
+
+ break;
+ }
+ case META_MASKSCALE_ACTION :
+ {
+ /** CHECKED, WORKS WELL: Simply same as META_BMPSCALE_ACTION */
+ const MetaMaskScaleAction* pA = (const MetaMaskScaleAction*)pAction;
+ const BitmapEx aBitmapEx(createMaskBmpEx(pA->GetBitmap(), pA->GetColor()));
+
+ createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), pA->GetSize(), rTargetHolders.Current(), rPropertyHolders.Current());
+
+ break;
+ }
+ case META_MASKSCALEPART_ACTION :
+ {
+ /** CHECKED, WORKS WELL: Simply same as META_BMPSCALEPART_ACTION */
+ const MetaMaskScalePartAction* pA = (const MetaMaskScalePartAction*)pAction;
+ const Bitmap& rBitmap = pA->GetBitmap();
+
+ if(!rBitmap.IsEmpty())
+ {
+ Bitmap aCroppedBitmap(rBitmap);
+ const Rectangle aCropRectangle(pA->GetSrcPoint(), pA->GetSrcSize());
+
+ if(!aCropRectangle.IsEmpty())
+ {
+ aCroppedBitmap.Crop(aCropRectangle);
+ }
+
+ const BitmapEx aCroppedBitmapEx(createMaskBmpEx(aCroppedBitmap, pA->GetColor()));
+ createBitmapExPrimitive(aCroppedBitmapEx, pA->GetDestPoint(), pA->GetDestSize(), rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+
+ break;
+ }
+ case META_GRADIENT_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaGradientAction* pA = (const MetaGradientAction*)pAction;
+ const Rectangle& rRectangle = pA->GetRect();
+
+ if(!rRectangle.IsEmpty())
+ {
+ basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ if(!aRange.isEmpty())
+ {
+ const Gradient& rGradient = pA->GetGradient();
+ const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient));
+
+ if(aAttribute.getStartColor() == aAttribute.getEndColor())
+ {
+ // not really a gradient. Create filled rectangle
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
+ createFillPrimitive(basegfx::B2DPolyPolygon(aOutline), rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+ else
+ {
+ // really a gradient
+ aRange.transform(rPropertyHolders.Current().getTransformation());
+
+ if(rPropertyHolders.Current().isRasterOpInvert())
+ {
+ // use a special version of FillGradientPrimitive2D which creates
+ // non-overlapping geometry on decomposition to makethe old XOR
+ // paint 'trick' work.
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::NonOverlappingFillGradientPrimitive2D(
+ aRange,
+ aAttribute));
+ }
+ else
+ {
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aAttribute));
+ }
+ }
+ }
+ }
+
+ break;
+ }
+ case META_HATCH_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaHatchAction* pA = (const MetaHatchAction*)pAction;
+ basegfx::B2DPolyPolygon aOutline(pA->GetPolyPolygon().getB2DPolyPolygon());
+
+ if(aOutline.count())
+ {
+ const Hatch& rHatch = pA->GetHatch();
+ const drawinglayer::attribute::FillHatchAttribute aAttribute(createFillHatchAttribute(rHatch));
+
+ aOutline.transform(rPropertyHolders.Current().getTransformation());
+
+ const basegfx::B2DRange aObjectRange(aOutline.getB2DRange());
+ const drawinglayer::primitive2d::Primitive2DReference aFillHatch(
+ new drawinglayer::primitive2d::FillHatchPrimitive2D(
+ aObjectRange,
+ basegfx::BColor(),
+ aAttribute));
+
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::MaskPrimitive2D(
+ aOutline,
+ drawinglayer::primitive2d::Primitive2DSequence(&aFillHatch, 1)));
+ }
+
+ break;
+ }
+ case META_WALLPAPER_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*)pAction;
+ Rectangle aWallpaperRectangle(pA->GetRect());
+
+ if(!aWallpaperRectangle.IsEmpty())
+ {
+ const Wallpaper& rWallpaper = pA->GetWallpaper();
+ const WallpaperStyle eWallpaperStyle(rWallpaper.GetStyle());
+ basegfx::B2DRange aWallpaperRange(
+ aWallpaperRectangle.Left(), aWallpaperRectangle.Top(),
+ aWallpaperRectangle.Right(), aWallpaperRectangle.Bottom());
+
+ if(WALLPAPER_NULL != eWallpaperStyle)
+ {
+ if(rWallpaper.IsBitmap())
+ {
+ // create bitmap background
+ CreateAndAppendBitmapWallpaper(
+ aWallpaperRange,
+ rWallpaper,
+ rTargetHolders.Current(),
+ rPropertyHolders.Current());
+ }
+ else if(rWallpaper.IsGradient())
+ {
+ // create gradient background
+ rTargetHolders.Current().append(
+ CreateGradientWallpaper(
+ aWallpaperRange,
+ rWallpaper.GetGradient(),
+ rPropertyHolders.Current()));
+ }
+ else if(!rWallpaper.GetColor().GetTransparency())
+ {
+ // create color background
+ rTargetHolders.Current().append(
+ CreateColorWallpaper(
+ aWallpaperRange,
+ rWallpaper.GetColor().getBColor(),
+ rPropertyHolders.Current()));
+ }
+ }
+ }
+
+ break;
+ }
+ case META_CLIPREGION_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaClipRegionAction* pA = (const MetaClipRegionAction*)pAction;
+
+ if(pA->IsClipping())
+ {
+ // new clipping
+ HandleNewClipRegion(&pA->GetRegion(), rTargetHolders, rPropertyHolders);
+ }
+ else
+ {
+ // end clipping
+ HandleNewClipRegion(0, rTargetHolders, rPropertyHolders);
+ }
+
+ break;
+ }
+ case META_ISECTRECTCLIPREGION_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*)pAction;
+ const Rectangle& rRectangle = pA->GetRect();
+
+ if(rRectangle.IsEmpty())
+ {
+ // intersect with empty rectangle will always give empty
+ // region; start new clipping with empty region
+ const Region aNewRegion;
+ HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders);
+ }
+ else
+ {
+ if(rPropertyHolders.Current().getRegionActive())
+ {
+ if(rPropertyHolders.Current().getRegion().IsEmpty())
+ {
+ // nothing to do, empty active clip region will stay
+ // empty when intersecting
+ }
+ else
+ {
+ // AND existing region and new rectangle
+ const basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ getB2DPolyPolygonFromRegion(rPropertyHolders.Current().getRegion()));
+ basegfx::B2DPolyPolygon aClippedPolyPolygon;
+
+ if(aOriginalPolyPolygon.count())
+ {
+ const basegfx::B2DRange aIntersectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+
+ aClippedPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(
+ aOriginalPolyPolygon, aIntersectRange, true, false);
+ }
+
+ if(aClippedPolyPolygon != aOriginalPolyPolygon)
+ {
+ // start new clipping with intersected region
+ const Region aNewRegion(aClippedPolyPolygon);
+ HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders);
+ }
+ }
+ }
+ else
+ {
+ // start new clipping with rectangle
+ const Region aNewRegion(rRectangle);
+ HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders);
+ }
+ }
+
+ break;
+ }
+ case META_ISECTREGIONCLIPREGION_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*)pAction;
+ const Region& rNewRegion = pA->GetRegion();
+
+ if(rNewRegion.IsEmpty())
+ {
+ // intersect with empty region will always give empty
+ // region; start new clipping with empty region
+ const Region aNewRegion;
+ HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders);
+ }
+ else
+ {
+ if(rPropertyHolders.Current().getRegionActive())
+ {
+ if(rPropertyHolders.Current().getRegion().IsEmpty())
+ {
+ // nothing to do, empty active clip region will stay empty
+ // when intersecting with any region
+ }
+ else
+ {
+ // AND existing and new region
+ const basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ getB2DPolyPolygonFromRegion(rPropertyHolders.Current().getRegion()));
+ basegfx::B2DPolyPolygon aClippedPolyPolygon;
+
+ if(aOriginalPolyPolygon.count())
+ {
+ const basegfx::B2DPolyPolygon aClipPolyPolygon(
+ getB2DPolyPolygonFromRegion(rNewRegion));
+
+ if(aClipPolyPolygon.count())
+ {
+ aClippedPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
+ aOriginalPolyPolygon, aClipPolyPolygon, true, false);
+ }
+ }
+
+ if(aClippedPolyPolygon != aOriginalPolyPolygon)
+ {
+ // start new clipping with intersected region
+ const Region aNewRegion(aClippedPolyPolygon);
+ HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders);
+ }
+ }
+ }
+ else
+ {
+ // start new clipping with new region
+ HandleNewClipRegion(&rNewRegion, rTargetHolders, rPropertyHolders);
+ }
+ }
+
+ break;
+ }
+ case META_MOVECLIPREGION_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*)pAction;
+
+ if(rPropertyHolders.Current().getRegionActive())
+ {
+ if(rPropertyHolders.Current().getRegion().IsEmpty())
+ {
+ // nothing to do
+ }
+ else
+ {
+ // move using old interface
+ Region aRegion(rPropertyHolders.Current().getRegion());
+
+ const sal_Int32 nHor(pA->GetHorzMove());
+ const sal_Int32 nVer(pA->GetVertMove());
+
+ if(0 != nHor || 0 != nVer)
+ {
+ aRegion.Move(nHor, nVer);
+ HandleNewClipRegion(&aRegion, rTargetHolders, rPropertyHolders);
+ }
+ }
+ }
+
+ break;
+ }
+ case META_LINECOLOR_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaLineColorAction* pA = (const MetaLineColorAction*)pAction;
+ const bool bActive(pA->IsSetting());
+
+ rPropertyHolders.Current().setLineColorActive(bActive);
+ if(bActive)
+ rPropertyHolders.Current().setLineColor(pA->GetColor().getBColor());
+
+ break;
+ }
+ case META_FILLCOLOR_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaFillColorAction* pA = (const MetaFillColorAction*)pAction;
+ const bool bActive(pA->IsSetting());
+
+ rPropertyHolders.Current().setFillColorActive(bActive);
+ if(bActive)
+ rPropertyHolders.Current().setFillColor(pA->GetColor().getBColor());
+
+ break;
+ }
+ case META_TEXTCOLOR_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaTextColorAction* pA = (const MetaTextColorAction*)pAction;
+ const bool bActivate(COL_TRANSPARENT != pA->GetColor().GetColor());
+
+ rPropertyHolders.Current().setTextColorActive(bActivate);
+ rPropertyHolders.Current().setTextColor(pA->GetColor().getBColor());
+
+ break;
+ }
+ case META_TEXTFILLCOLOR_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*)pAction;
+ const bool bWithColorArgument(pA->IsSetting());
+
+ if(bWithColorArgument)
+ {
+ // emulate OutputDevice::SetTextFillColor(...) WITH argument
+ const Color& rFontFillColor = pA->GetColor();
+ rPropertyHolders.Current().setTextFillColor(rFontFillColor.getBColor());
+ rPropertyHolders.Current().setTextFillColorActive(COL_TRANSPARENT != rFontFillColor.GetColor());
+ }
+ else
+ {
+ // emulate SetFillColor() <- NO argument (!)
+ rPropertyHolders.Current().setTextFillColorActive(false);
+ }
+
+ break;
+ }
+ case META_TEXTALIGN_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaTextAlignAction* pA = (const MetaTextAlignAction*)pAction;
+ const TextAlign aNewTextAlign = pA->GetTextAlign();
+
+ // TextAlign is applied to the current font (as in
+ // OutputDevice::SetTextAlign which would be used when
+ // playing the Metafile)
+ if(rPropertyHolders.Current().getFont().GetAlign() != aNewTextAlign)
+ {
+ Font aNewFont(rPropertyHolders.Current().getFont());
+ aNewFont.SetAlign(aNewTextAlign);
+ rPropertyHolders.Current().setFont(aNewFont);
+ }
+
+ break;
+ }
+ case META_MAPMODE_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaMapModeAction* pA = (const MetaMapModeAction*)pAction;
+ const MapMode& rMapMode = pA->GetMapMode();
+ basegfx::B2DHomMatrix aMapping;
+
+ if(MAP_RELATIVE == rMapMode.GetMapUnit())
+ {
+ aMapping = getTransformFromMapMode(rMapMode);
+ }
+ else
+ {
+ switch(rMapMode.GetMapUnit())
+ {
+ case MAP_100TH_MM :
+ {
+ if(MAP_TWIP == rPropertyHolders.Current().getMapUnit())
+ {
+ // MAP_TWIP -> MAP_100TH_MM
+ const double fTwipTo100thMm(127.0 / 72.0);
+ aMapping.scale(fTwipTo100thMm, fTwipTo100thMm);
+ }
+ break;
+ }
+ case MAP_TWIP :
+ {
+ if(MAP_100TH_MM == rPropertyHolders.Current().getMapUnit())
+ {
+ // MAP_100TH_MM -> MAP_TWIP
+ const double f100thMmToTwip(72.0 / 127.0);
+ aMapping.scale(f100thMmToTwip, f100thMmToTwip);
+ }
+ break;
+ }
+ default :
+ {
+ OSL_ENSURE(false, "interpretMetafile: META_MAPMODE_ACTION with unsupported MapUnit (!)");
+ break;
+ }
+ }
+
+ aMapping = getTransformFromMapMode(rMapMode) * aMapping;
+ rPropertyHolders.Current().setMapUnit(rMapMode.GetMapUnit());
+ }
+
+ if(!aMapping.isIdentity())
+ {
+ aMapping = aMapping * rPropertyHolders.Current().getTransformation();
+ rPropertyHolders.Current().setTransformation(aMapping);
+ }
+
+ break;
+ }
+ case META_FONT_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaFontAction* pA = (const MetaFontAction*)pAction;
+ rPropertyHolders.Current().setFont(pA->GetFont());
+
+ // older Metafiles have no META_TEXTCOLOR_ACTION which defines
+ // the FontColor now, so use the Font's color when not transparent
+ const Color& rFontColor = pA->GetFont().GetColor();
+ const bool bActivate(COL_TRANSPARENT != rFontColor.GetColor());
+
+ if(bActivate)
+ {
+ rPropertyHolders.Current().setTextColor(rFontColor.getBColor());
+ }
+
+ // caution: do NOT decativate here on transparet, see
+ // OutputDevice::SetFont(..) for more info
+ // rPropertyHolders.Current().setTextColorActive(bActivate);
+
+ // for fill color emulate a MetaTextFillColorAction with !transparent as bool,
+ // see OutputDevice::SetFont(..) the if(mpMetaFile) case
+ if(bActivate)
+ {
+ const Color& rFontFillColor = pA->GetFont().GetFillColor();
+ rPropertyHolders.Current().setTextFillColor(rFontFillColor.getBColor());
+ rPropertyHolders.Current().setTextFillColorActive(COL_TRANSPARENT != rFontFillColor.GetColor());
+ }
+ else
+ {
+ rPropertyHolders.Current().setTextFillColorActive(false);
+ }
+
+ break;
+ }
+ case META_PUSH_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ rPropertyHolders.Push();
+
+ break;
+ }
+ case META_POP_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ if(rPropertyHolders.Current().getRegionActive())
+ {
+ // end clipping
+ HandleNewClipRegion(0, rTargetHolders, rPropertyHolders);
+ }
+
+ if(rPropertyHolders.Current().isRasterOpActive())
+ {
+ // end RasterOp
+ HandleNewRasterOp(ROP_OVERPAINT, rTargetHolders, rPropertyHolders);
+ }
+
+ rPropertyHolders.Pop();
+
+ if(rPropertyHolders.Current().isRasterOpActive())
+ {
+ // start RasterOp
+ HandleNewRasterOp(rPropertyHolders.Current().getRasterOp(), rTargetHolders, rPropertyHolders);
+ }
+
+ if(rPropertyHolders.Current().getRegionActive())
+ {
+ // start clipping
+ HandleNewClipRegion(&rPropertyHolders.Current().getRegion(), rTargetHolders, rPropertyHolders);
+ }
+
+ break;
+ }
+ case META_RASTEROP_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaRasterOpAction* pA = (const MetaRasterOpAction*)pAction;
+ const RasterOp aRasterOp = pA->GetRasterOp();
+
+ HandleNewRasterOp(pA->GetRasterOp(), rTargetHolders, rPropertyHolders);
+
+ break;
+ }
+ case META_TRANSPARENT_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaTransparentAction* pA = (const MetaTransparentAction*)pAction;
+ const basegfx::B2DPolyPolygon aOutline(pA->GetPolyPolygon().getB2DPolyPolygon());
+
+ if(aOutline.count())
+ {
+ const sal_uInt16 nTransparence(pA->GetTransparence());
+
+ if(0 == nTransparence)
+ {
+ // not transparent
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ }
+ else if(nTransparence >= 100)
+ {
+ // fully or more than transparent
+ }
+ else
+ {
+ // transparent. Create new target
+ rTargetHolders.Push();
+
+ // create primitives there and get them
+ createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current());
+ const drawinglayer::primitive2d::Primitive2DSequence aSubContent(
+ rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current()));
+
+ // back to old target
+ rTargetHolders.Pop();
+
+ if(aSubContent.hasElements())
+ {
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ aSubContent,
+ nTransparence * 0.01));
+ }
+ }
+ }
+
+ break;
+ }
+ case META_EPS_ACTION :
+ {
+ /** NEEDS IMPLEMENTATION */
+ OSL_ENSURE(false, "META_EPS_ACTION requested (!)");
+ const MetaEPSAction* pA = (const MetaEPSAction*)pAction;
+ break;
+ }
+ case META_REFPOINT_ACTION :
+ {
+ /** SIMPLE, DONE */
+ // only used for hatch and line pattern offsets
+ // const MetaRefPointAction* pA = (const MetaRefPointAction*)pAction;
+ break;
+ }
+ case META_TEXTLINECOLOR_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaTextLineColorAction* pA = (const MetaTextLineColorAction*)pAction;
+ const bool bActive(pA->IsSetting());
+
+ rPropertyHolders.Current().setTextLineColorActive(bActive);
+ if(bActive)
+ rPropertyHolders.Current().setTextLineColor(pA->GetColor().getBColor());
+
+ break;
+ }
+ case META_TEXTLINE_ACTION :
+ {
+ /** NEEDS IMPLEMENTATION */
+ OSL_ENSURE(false, "META_TEXTLINE_ACTION requested (!)");
+ // actually creates overline, underline and strikeouts, so
+ // these should be isolated from TextDecoratedPortionPrimitive2D
+ // to own primitives...
+ const MetaTextLineAction* pA = (const MetaTextLineAction*)pAction;
+ break;
+ }
+ case META_FLOATTRANSPARENT_ACTION :
+ {
+ /** CHECKED, WORKS WELL */
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*)pAction;
+ const Rectangle aTargetRectangle(pA->GetPoint(), pA->GetSize());
+
+ if(!aTargetRectangle.IsEmpty())
+ {
+ const GDIMetaFile& rContent = pA->GetGDIMetaFile();
+
+ if(rContent.GetActionCount())
+ {
+ // create the sub-content
+ drawinglayer::primitive2d::Primitive2DSequence xSubContent;
+ {
+ rTargetHolders.Push();
+ interpretMetafile(rContent, rTargetHolders, rPropertyHolders, rViewInformation);
+ xSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current());
+ rTargetHolders.Pop();
+ }
+
+ if(xSubContent.hasElements())
+ {
+ // check if gradient is a real gradient
+ const Gradient& rGradient = pA->GetGradient();
+ const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient));
+
+ if(aAttribute.getStartColor() == aAttribute.getEndColor())
+ {
+ // not really a gradient; create UnifiedAlphaPrimitive2D
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ xSubContent,
+ aAttribute.getStartColor().luminance()));
+ }
+ else
+ {
+ // really a gradient. Create gradient sub-content (with correct scaling)
+ basegfx::B2DRange aRange(
+ aTargetRectangle.Left(), aTargetRectangle.Top(),
+ aTargetRectangle.Right(), aTargetRectangle.Bottom());
+ aRange.transform(rPropertyHolders.Current().getTransformation());
+
+ // prepare gradient for alpha content
+ const drawinglayer::primitive2d::Primitive2DReference xAlpha(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aAttribute));
+
+ // create alpha primitive
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::AlphaPrimitive2D(
+ xSubContent,
+ drawinglayer::primitive2d::Primitive2DSequence(&xAlpha, 1)));
+ }
+ }
+ }
+ }
+
+ break;
+ }
+ case META_GRADIENTEX_ACTION :
+ {
+ /** SIMPLE, DONE */
+ // This is only a data holder which is interpreted inside comment actions
+ // const MetaGradientExAction* pA = (const MetaGradientExAction*)pAction;
+ break;
+ }
+ case META_LAYOUTMODE_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaLayoutModeAction* pA = (const MetaLayoutModeAction*)pAction;
+ rPropertyHolders.Current().setLayoutMode(pA->GetLayoutMode());
+ break;
+ }
+ case META_TEXTLANGUAGE_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaTextLanguageAction* pA = (const MetaTextLanguageAction*)pAction;
+ rPropertyHolders.Current().setLanguageType(pA->GetTextLanguage());
+ break;
+ }
+ case META_OVERLINECOLOR_ACTION :
+ {
+ /** SIMPLE, DONE */
+ const MetaOverlineColorAction* pA = (const MetaOverlineColorAction*)pAction;
+ const bool bActive(pA->IsSetting());
+
+ rPropertyHolders.Current().setOverlineColorActive(bActive);
+ if(bActive)
+ rPropertyHolders.Current().setOverlineColor(pA->GetColor().getBColor());
+
+ break;
+ }
+ case META_COMMENT_ACTION :
+ {
+ /** NEEDS IMPLEMENTATION */
+ OSL_ENSURE(false, "META_COMMENT_ACTION requested (!)");
+ const MetaCommentAction* pA = (const MetaCommentAction*)pAction;
+ break;
+ }
+ default:
+ {
+ OSL_ENSURE(false, "Unknown MetaFile Action (!)");
+ break;
+ }
+ }
+ }
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive2d
{
+ Primitive2DSequence MetafilePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ TargetHolders aTargetHolders;
+ PropertyHolders aPropertyHolders;
+
+ interpretMetafile(getMetaFile(), aTargetHolders, aPropertyHolders, rViewInformation);
+ Primitive2DSequence xRetval = aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current());
+
+ if(xRetval.hasElements())
+ {
+ Rectangle aMtfTarget(getMetaFile().GetPrefMapMode().GetOrigin(), getMetaFile().GetPrefSize());
+
+ if(MAP_PIXEL == getMetaFile().GetPrefMapMode().GetMapUnit())
+ {
+ aMtfTarget = Application::GetDefaultDevice()->PixelToLogic(aMtfTarget, MAP_100TH_MM);
+ }
+ else
+ {
+ aMtfTarget = Application::GetDefaultDevice()->LogicToLogic(aMtfTarget, getMetaFile().GetPrefMapMode(), MAP_100TH_MM);
+ }
+
+ basegfx::B2DHomMatrix aAdaptedTransform;
+
+ aAdaptedTransform.translate(-aMtfTarget.Left(), -aMtfTarget.Top());
+ aAdaptedTransform.scale(
+ aMtfTarget.getWidth() ? 1.0 / aMtfTarget.getWidth() : 1.0,
+ aMtfTarget.getHeight() ? 1.0 / aMtfTarget.getHeight() : 1.0);
+ aAdaptedTransform = getTransform() * aAdaptedTransform;
+
+ const Primitive2DReference aEmbeddedTransform(
+ new TransformPrimitive2D(
+ aAdaptedTransform,
+ xRetval));
+
+ xRetval = Primitive2DSequence(&aEmbeddedTransform, 1);
+ }
+
+ return xRetval;
+ }
+
MetafilePrimitive2D::MetafilePrimitive2D(
const basegfx::B2DHomMatrix& rMetaFileTransform,
const GDIMetaFile& rMetaFile)
- : BasePrimitive2D(),
+ : BufferedDecompositionPrimitive2D(),
maMetaFileTransform(rMetaFileTransform),
maMetaFile(rMetaFile)
{
@@ -61,7 +2542,7 @@ namespace drawinglayer
bool MetafilePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
- if(BasePrimitive2D::operator==(rPrimitive))
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
{
const MetafilePrimitive2D& rCompare = (MetafilePrimitive2D&)rPrimitive;
diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx
index 30af3a998daf..2b25590bf1f4 100644
--- a/drawinglayer/source/primitive2d/primitivetools2d.cxx
+++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx
@@ -103,4 +103,76 @@ namespace drawinglayer
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence ViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // get the current ViewTransformation
+ const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation();
+
+ if(getBuffered2DDecomposition().hasElements() && rViewTransformation != getViewTransformation())
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast< ViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence());
+ }
+
+ if(!getBuffered2DDecomposition().hasElements())
+ {
+ // remember new valid ViewTransformation
+ const_cast< ViewTransformationDependentPrimitive2D* >(this)->maViewTransformation = rViewTransformation;
+ }
+
+ // call base implementation
+ return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // get the current ViewTransfromation
+ const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation();
+
+ if(getBuffered2DDecomposition().hasElements() && rViewTransformation != getViewTransformation())
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence());
+ }
+
+ // get the current ObjectTransformation
+ const basegfx::B2DHomMatrix& rObjectTransformation = rViewInformation.getObjectTransformation();
+
+ if(getBuffered2DDecomposition().hasElements() && rObjectTransformation != getObjectTransformation())
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence());
+ }
+
+ if(!getBuffered2DDecomposition().hasElements())
+ {
+ // remember new valid ViewTransformation, and ObjectTransformation
+ const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->maViewTransformation = rViewTransformation;
+ const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->maObjectTransformation = rObjectTransformation;
+ }
+
+ // call base implementation
+ return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index 49ffab60778a..9403df5376aa 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -48,6 +48,8 @@
#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlineprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -55,217 +57,6 @@ namespace drawinglayer
{
namespace primitive2d
{
- void TextDecoratedPortionPrimitive2D::impCreateTextLine(
- std::vector< Primitive2DReference >& rTarget,
- basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
- const basegfx::B2DHomMatrix &rUnscaledTransform,
- FontUnderline eLineStyle,
- double fLineOffset,
- double fLineHeight,
- double fLineWidth,
- const basegfx::BColor& rLineColor) const
- {
- bool bDoubleLine(false);
- bool bWaveLine(false);
- bool bBoldLine(false);
- const int* pDotDashArray(0);
- basegfx::B2DLineJoin eLineJoin(basegfx::B2DLINEJOIN_NONE);
-
- static const int aDottedArray[] = { 1, 1, 0}; // DOTTED LINE
- static const int aDotDashArray[] = { 1, 1, 4, 1, 0}; // DASHDOT
- static const int aDashDotDotArray[] = { 1, 1, 1, 1, 4, 1, 0}; // DASHDOTDOT
- static const int aDashedArray[] = { 5, 2, 0}; // DASHED LINE
- static const int aLongDashArray[] = { 7, 2, 0}; // LONGDASH
-
- switch(eLineStyle)
- {
- default: // case FONT_UNDERLINE_SINGLE:
- {
- break;
- }
- case FONT_UNDERLINE_DOUBLE:
- {
- bDoubleLine = true;
- break;
- }
- case FONT_UNDERLINE_DOTTED:
- {
- pDotDashArray = aDottedArray;
- break;
- }
- case FONT_UNDERLINE_DASH:
- {
- pDotDashArray = aDashedArray;
- break;
- }
- case FONT_UNDERLINE_LONGDASH:
- {
- pDotDashArray = aLongDashArray;
- break;
- }
- case FONT_UNDERLINE_DASHDOT:
- {
- pDotDashArray = aDotDashArray;
- break;
- }
- case FONT_UNDERLINE_DASHDOTDOT:
- {
- pDotDashArray = aDashDotDotArray;
- break;
- }
- case FONT_UNDERLINE_SMALLWAVE:
- {
- bWaveLine = true;
- break;
- }
- case FONT_UNDERLINE_WAVE:
- {
- bWaveLine = true;
- break;
- }
- case FONT_UNDERLINE_DOUBLEWAVE:
- {
- bDoubleLine = true;
- bWaveLine = true;
- break;
- }
- case FONT_UNDERLINE_BOLD:
- {
- bBoldLine = true;
- break;
- }
- case FONT_UNDERLINE_BOLDDOTTED:
- {
- bBoldLine = true;
- pDotDashArray = aDottedArray;
- break;
- }
- case FONT_UNDERLINE_BOLDDASH:
- {
- bBoldLine = true;
- pDotDashArray = aDashedArray;
- break;
- }
- case FONT_UNDERLINE_BOLDLONGDASH:
- {
- bBoldLine = true;
- pDotDashArray = aLongDashArray;
- break;
- }
- case FONT_UNDERLINE_BOLDDASHDOT:
- {
- bBoldLine = true;
- pDotDashArray = aDotDashArray;
- break;
- }
- case FONT_UNDERLINE_BOLDDASHDOTDOT:
- {
- bBoldLine = true;
- pDotDashArray = aDashDotDotArray;
- break;
- }
- case FONT_UNDERLINE_BOLDWAVE:
- {
- bWaveLine = true;
- bBoldLine = true;
- break;
- }
- }
-
- if(bBoldLine)
- {
- fLineHeight *= 2.0;
- }
-
- if(bDoubleLine)
- {
- fLineOffset -= 0.50 * fLineHeight;
- fLineHeight *= 0.64;
- }
-
- if(bWaveLine)
- {
- eLineJoin = basegfx::B2DLINEJOIN_ROUND;
- fLineHeight *= 0.25;
- }
-
- // prepare Line and Stroke Attributes
- const attribute::LineAttribute aLineAttribute(rLineColor, fLineHeight, eLineJoin);
- attribute::StrokeAttribute aStrokeAttribute;
-
- if(pDotDashArray)
- {
- ::std::vector< double > aDoubleArray;
-
- for(const int* p = pDotDashArray; *p; ++p)
- {
- aDoubleArray.push_back((double)(*p) * fLineHeight);
- }
-
- aStrokeAttribute = attribute::StrokeAttribute(aDoubleArray);
- }
-
- // create base polygon and new primitive
- basegfx::B2DPolygon aLine;
- Primitive2DReference aNewPrimitive;
-
- aLine.append(basegfx::B2DPoint(0.0, fLineOffset));
- aLine.append(basegfx::B2DPoint(fLineWidth, fLineOffset));
- aLine.transform(rUnscaledTransform);
-
- if(bWaveLine)
- {
- double fWaveWidth(10.6 * fLineHeight);
-
- if(FONT_UNDERLINE_SMALLWAVE == eLineStyle)
- {
- fWaveWidth *= 0.7;
- }
- else if(FONT_UNDERLINE_WAVE == eLineStyle)
- {
- // extra multiply to get the same WaveWidth as with the bold version
- fWaveWidth *= 2.0;
- }
-
- aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, fWaveWidth * 0.5));
- }
- else
- {
- aNewPrimitive = Primitive2DReference(new PolygonStrokePrimitive2D(aLine, aLineAttribute, aStrokeAttribute));
- }
-
- // add primitive
- rTarget.push_back(aNewPrimitive);
-
- if(bDoubleLine)
- {
- // double line, create 2nd primitive with offset using TransformPrimitive based on
- // already created NewPrimitive
- double fLineDist(2.3 * fLineHeight);
-
- if(bWaveLine)
- {
- fLineDist = 6.3 * fLineHeight;
- }
-
- // move base point of text to 0.0 and de-rotate
- basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(
- -rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY()));
- aTransform.rotate(-rDecTrans.getRotate());
-
- // translate in Y by offset
- aTransform.translate(0.0, fLineDist);
-
- // move back and rotate
- aTransform.rotate(rDecTrans.getRotate());
- aTransform.translate(rDecTrans.getTranslate().getX(), rDecTrans.getTranslate().getY());
-
- // add transform primitive
- const Primitive2DSequence aContent(&aNewPrimitive, 1);
- rTarget.push_back(Primitive2DReference(new TransformPrimitive2D(aTransform, aContent)));
- }
- }
-
void TextDecoratedPortionPrimitive2D::impCreateGeometryContent(
std::vector< Primitive2DReference >& rTarget,
basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
@@ -273,7 +64,7 @@ namespace drawinglayer
xub_StrLen aTextPosition,
xub_StrLen aTextLength,
const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes) const
+ const attribute::FontAttribute& rFontAttribute) const
{
// create the SimpleTextPrimitive needed in any case
rTarget.push_back(Primitive2DReference(
@@ -283,13 +74,13 @@ namespace drawinglayer
aTextPosition,
aTextLength,
rDXArray,
- rFontAttributes,
+ rFontAttribute,
getLocale(),
getFontColor())));
// see if something else needs to be done
- const bool bOverlineUsed(FONT_UNDERLINE_NONE != getFontOverline());
- const bool bUnderlineUsed(FONT_UNDERLINE_NONE != getFontUnderline());
+ const bool bOverlineUsed(TEXT_LINE_NONE != getFontOverline());
+ const bool bUnderlineUsed(TEXT_LINE_NONE != getFontUnderline());
const bool bStrikeoutUsed(FONT_STRIKEOUT_NONE != getFontStrikeout());
if(bUnderlineUsed || bStrikeoutUsed || bOverlineUsed)
@@ -303,8 +94,8 @@ namespace drawinglayer
// TextLayouterDevice is needed to get metrics for text decorations like
// underline/strikeout/emphasis marks from it. For setup, the font size is needed
- aTextLayouter.setFontAttributes(
- getFontAttributes(),
+ aTextLayouter.setFontAttribute(
+ getFontAttribute(),
rDecTrans.getScale().getX(),
rDecTrans.getScale().getY(),
getLocale());
@@ -332,15 +123,27 @@ namespace drawinglayer
if(bOverlineUsed)
{
// create primitive geometry for overline
- impCreateTextLine(rTarget, rDecTrans, aUnscaledTransform, getFontOverline(), aTextLayouter.getOverlineOffset(),
- aTextLayouter.getOverlineHeight(), fTextWidth, getOverlineColor());
+ rTarget.push_back(Primitive2DReference(
+ new TextLinePrimitive2D(
+ rDecTrans.getB2DHomMatrix(),
+ fTextWidth,
+ aTextLayouter.getOverlineOffset(),
+ aTextLayouter.getOverlineHeight(),
+ getFontOverline(),
+ getOverlineColor())));
}
if(bUnderlineUsed)
{
// create primitive geometry for underline
- impCreateTextLine(rTarget, rDecTrans, aUnscaledTransform, getFontUnderline(), aTextLayouter.getUnderlineOffset(),
- aTextLayouter.getUnderlineHeight(), fTextWidth, getTextlineColor());
+ rTarget.push_back(Primitive2DReference(
+ new TextLinePrimitive2D(
+ rDecTrans.getB2DHomMatrix(),
+ fTextWidth,
+ aTextLayouter.getUnderlineOffset(),
+ aTextLayouter.getUnderlineHeight(),
+ getFontUnderline(),
+ getTextlineColor())));
}
if(bStrikeoutUsed)
@@ -350,97 +153,27 @@ namespace drawinglayer
{
// strikeout with character
const sal_Unicode aStrikeoutChar(FONT_STRIKEOUT_SLASH == getFontStrikeout() ? '/' : 'X');
- const String aSingleCharString(aStrikeoutChar);
- const double fStrikeCharWidth(aTextLayouter.getTextWidth(aSingleCharString, 0, 1));
- const double fStrikeCharCount(fabs(fTextWidth/fStrikeCharWidth));
- const sal_uInt32 nStrikeCharCount(static_cast< sal_uInt32 >(fStrikeCharCount + 0.5));
- std::vector<double> aDXArray(nStrikeCharCount);
- String aStrikeoutString;
-
- for(sal_uInt32 a(0); a < nStrikeCharCount; a++)
- {
- aStrikeoutString += aSingleCharString;
- aDXArray[a] = (a + 1) * fStrikeCharWidth;
- }
rTarget.push_back(Primitive2DReference(
- new TextSimplePortionPrimitive2D(
+ new TextCharacterStrikeoutPrimitive2D(
rDecTrans.getB2DHomMatrix(),
- aStrikeoutString,
- 0,
- aStrikeoutString.Len(),
- aDXArray,
- rFontAttributes,
- getLocale(),
- getFontColor())));
+ fTextWidth,
+ getFontColor(),
+ aStrikeoutChar,
+ getFontAttribute(),
+ getLocale())));
}
else
{
// strikeout with geometry
- double fStrikeoutHeight(aTextLayouter.getUnderlineHeight());
- double fStrikeoutOffset(aTextLayouter.getStrikeoutOffset());
- bool bDoubleLine(false);
-
- // set line attribute
- switch(getFontStrikeout())
- {
- default : // case primitive2d::FONT_STRIKEOUT_SINGLE:
- {
- break;
- }
- case primitive2d::FONT_STRIKEOUT_DOUBLE:
- {
- bDoubleLine = true;
- break;
- }
- case primitive2d::FONT_STRIKEOUT_BOLD:
- {
- fStrikeoutHeight *= 2.0;
- break;
- }
- }
-
- if(bDoubleLine)
- {
- fStrikeoutOffset -= 0.50 * fStrikeoutHeight;
- fStrikeoutHeight *= 0.64;
- }
-
- // create base polygon and new primitive
- basegfx::B2DPolygon aStrikeoutLine;
-
- aStrikeoutLine.append(basegfx::B2DPoint(0.0, -fStrikeoutOffset));
- aStrikeoutLine.append(basegfx::B2DPoint(fTextWidth, -fStrikeoutOffset));
- aStrikeoutLine.transform(aUnscaledTransform);
-
- const attribute::LineAttribute aLineAttribute(getFontColor(), fStrikeoutHeight, basegfx::B2DLINEJOIN_NONE);
- Primitive2DReference aNewPrimitive(new PolygonStrokePrimitive2D(aStrikeoutLine, aLineAttribute));
-
- // add primitive
- rTarget.push_back(aNewPrimitive);
-
- if(bDoubleLine)
- {
- // double line, create 2nd primitive with offset using TransformPrimitive based on
- // already created NewPrimitive
- const double fLineDist(2.0 * fStrikeoutHeight);
-
- // move base point of text to 0.0 and de-rotate
- basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(
- -rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY()));
- aTransform.rotate(-rDecTrans.getRotate());
-
- // translate in Y by offset
- aTransform.translate(0.0, -fLineDist);
-
- // move back and rotate
- aTransform.rotate(rDecTrans.getRotate());
- aTransform.translate(rDecTrans.getTranslate().getX(), rDecTrans.getTranslate().getY());
-
- // add transform primitive
- const Primitive2DSequence aContent(&aNewPrimitive, 1);
- rTarget.push_back(Primitive2DReference(new TransformPrimitive2D(aTransform, aContent)));
- }
+ rTarget.push_back(Primitive2DReference(
+ new TextGeometryStrikeoutPrimitive2D(
+ rDecTrans.getB2DHomMatrix(),
+ fTextWidth,
+ getFontColor(),
+ aTextLayouter.getUnderlineHeight(),
+ aTextLayouter.getStrikeoutOffset(),
+ getFontStrikeout())));
}
}
}
@@ -507,21 +240,21 @@ namespace drawinglayer
impCorrectTextBoundary(aNextWordBoundary);
// prepare new font attributes WITHOUT outline
- const FontAttributes aNewFontAttributes(
- getFontAttributes().getFamilyName(),
- getFontAttributes().getStyleName(),
- getFontAttributes().getWeight(),
- getFontAttributes().getSymbol(),
- getFontAttributes().getVertical(),
- getFontAttributes().getItalic(),
+ const attribute::FontAttribute aNewFontAttribute(
+ getFontAttribute().getFamilyName(),
+ getFontAttribute().getStyleName(),
+ getFontAttribute().getWeight(),
+ getFontAttribute().getSymbol(),
+ getFontAttribute().getVertical(),
+ getFontAttribute().getItalic(),
false, // no outline anymore, handled locally
- getFontAttributes().getRTL(),
- getFontAttributes().getBiDiStrong());
+ getFontAttribute().getRTL(),
+ getFontAttribute().getBiDiStrong());
if(aNextWordBoundary.startPos == getTextPosition() && aNextWordBoundary.endPos == getTextLength())
{
// it IS only a single word, handle as one word
- impCreateGeometryContent(rTarget, rDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttributes);
+ impCreateGeometryContent(rTarget, rDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute);
}
else
{
@@ -532,8 +265,8 @@ namespace drawinglayer
if(bNoDXArray)
{
// ..but only completely when no DXArray
- aTextLayouter.setFontAttributes(
- getFontAttributes(),
+ aTextLayouter.setFontAttribute(
+ getFontAttribute(),
rDecTrans.getScale().getX(),
rDecTrans.getScale().getY(),
getLocale());
@@ -612,7 +345,7 @@ namespace drawinglayer
basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose aDecTrans(aNewTransform);
impCreateGeometryContent(rTarget, aDecTrans, getText(), nNewTextStart,
- nNewTextEnd - nNewTextStart, aNewDXArray, aNewFontAttributes);
+ nNewTextEnd - nNewTextStart, aNewDXArray, aNewFontAttribute);
if(aNextWordBoundary.endPos >= getTextPosition() + getTextLength())
{
@@ -659,19 +392,19 @@ namespace drawinglayer
else
{
// prepare new font attributes WITHOUT outline
- const FontAttributes aNewFontAttributes(
- getFontAttributes().getFamilyName(),
- getFontAttributes().getStyleName(),
- getFontAttributes().getWeight(),
- getFontAttributes().getSymbol(),
- getFontAttributes().getVertical(),
- getFontAttributes().getItalic(),
+ const attribute::FontAttribute aNewFontAttribute(
+ getFontAttribute().getFamilyName(),
+ getFontAttribute().getStyleName(),
+ getFontAttribute().getWeight(),
+ getFontAttribute().getSymbol(),
+ getFontAttribute().getVertical(),
+ getFontAttribute().getItalic(),
false, // no outline anymore, handled locally
- getFontAttributes().getRTL(),
- getFontAttributes().getBiDiStrong());
+ getFontAttribute().getRTL(),
+ getFontAttribute().getBiDiStrong());
// handle as one word
- impCreateGeometryContent(aNewPrimitives, aDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttributes);
+ impCreateGeometryContent(aNewPrimitives, aDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute);
}
// convert to Primitive2DSequence
@@ -693,7 +426,7 @@ namespace drawinglayer
// outline AND shadow depend on NO FontRelief (see dialog)
const bool bHasFontRelief(FONT_RELIEF_NONE != getFontRelief());
const bool bHasShadow(!bHasFontRelief && getShadow());
- const bool bHasOutline(!bHasFontRelief && getFontAttributes().getOutline());
+ const bool bHasOutline(!bHasFontRelief && getFontAttribute().getOutline());
if(bHasShadow || bHasFontRelief || bHasOutline)
{
@@ -792,15 +525,15 @@ namespace drawinglayer
xub_StrLen aTextPosition,
xub_StrLen aTextLength,
const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes,
+ const attribute::FontAttribute& rFontAttribute,
const ::com::sun::star::lang::Locale& rLocale,
const basegfx::BColor& rFontColor,
// local parameters
const basegfx::BColor& rOverlineColor,
const basegfx::BColor& rTextlineColor,
- FontUnderline eFontOverline,
- FontUnderline eFontUnderline,
+ TextLine eFontOverline,
+ TextLine eFontUnderline,
bool bUnderlineAbove,
FontStrikeout eFontStrikeout,
bool bWordLineMode,
@@ -809,7 +542,7 @@ namespace drawinglayer
bool bEmphasisMarkBelow,
FontRelief eFontRelief,
bool bShadow)
- : TextSimplePortionPrimitive2D(rNewTransform, rText, aTextPosition, aTextLength, rDXArray, rFontAttributes, rLocale, rFontColor),
+ : TextSimplePortionPrimitive2D(rNewTransform, rText, aTextPosition, aTextLength, rDXArray, rFontAttribute, rLocale, rFontColor),
maOverlineColor(rOverlineColor),
maTextlineColor(rTextlineColor),
meFontOverline(eFontOverline),
@@ -854,8 +587,8 @@ namespace drawinglayer
basegfx::B2DRange TextDecoratedPortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
{
const bool bDecoratedIsNeeded(
- FONT_UNDERLINE_NONE != getFontOverline()
- || FONT_UNDERLINE_NONE != getFontUnderline()
+ TEXT_LINE_NONE != getFontOverline()
+ || TEXT_LINE_NONE != getFontUnderline()
|| FONT_STRIKEOUT_NONE != getFontStrikeout()
|| FONT_EMPHASISMARK_NONE != getFontEmphasisMark()
|| FONT_RELIEF_NONE != getFontRelief()
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index e321783c8406..f24398a1a6ac 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -167,14 +167,14 @@ namespace drawinglayer
mrDevice.SetFont( rFont );
}
- void TextLayouterDevice::setFontAttributes(
- const FontAttributes& rFontAttributes,
+ void TextLayouterDevice::setFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
double fFontScaleX,
double fFontScaleY,
const ::com::sun::star::lang::Locale& rLocale)
{
- setFont(getVclFontFromFontAttributes(
- rFontAttributes,
+ setFont(getVclFontFromFontAttribute(
+ rFontAttribute,
fFontScaleX,
fFontScaleY,
0.0,
@@ -297,6 +297,18 @@ namespace drawinglayer
return basegfx::B2DRange();
}
+
+ double TextLayouterDevice::getFontAscent() const
+ {
+ const ::FontMetric& rMetric = mrDevice.GetFontMetric();
+ return rMetric.GetAscent();
+ }
+
+ double TextLayouterDevice::getFontDescent() const
+ {
+ const ::FontMetric& rMetric = mrDevice.GetFontMetric();
+ return rMetric.GetDescent();
+ }
} // end of namespace primitive2d
} // end of namespace drawinglayer
@@ -307,8 +319,8 @@ namespace drawinglayer
{
namespace primitive2d
{
- Font getVclFontFromFontAttributes(
- const FontAttributes& rFontAttributes,
+ Font getVclFontFromFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
double fFontScaleX,
double fFontScaleY,
double fFontRotation,
@@ -324,8 +336,8 @@ namespace drawinglayer
// is wanted, that width needs to be adapted using FontMetric again to get a
// width of the unscaled font
Font aRetval(
- rFontAttributes.getFamilyName(),
- rFontAttributes.getStyleName(),
+ rFontAttribute.getFamilyName(),
+ rFontAttribute.getStyleName(),
Size(0, nHeight));
#else
// for non-WIN32 systems things are easier since these accept a Font creation
@@ -334,17 +346,17 @@ namespace drawinglayer
// Font would be recorded in a MetaFile (The MetaFile FontAction WILL record a
// set FontWidth; import that in a WIN32 system, and trouble is there)
Font aRetval(
- rFontAttributes.getFamilyName(),
- rFontAttributes.getStyleName(),
+ rFontAttribute.getFamilyName(),
+ rFontAttribute.getStyleName(),
Size(bFontIsScaled ? nWidth : 0, nHeight));
#endif
- // define various other FontAttributes
+ // define various other FontAttribute
aRetval.SetAlign(ALIGN_BASELINE);
- aRetval.SetCharSet(rFontAttributes.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE);
- aRetval.SetVertical(rFontAttributes.getVertical() ? TRUE : FALSE);
- aRetval.SetWeight(static_cast<FontWeight>(rFontAttributes.getWeight()));
- aRetval.SetItalic(rFontAttributes.getItalic() ? ITALIC_NORMAL : ITALIC_NONE);
- aRetval.SetOutline(rFontAttributes.getOutline());
+ aRetval.SetCharSet(rFontAttribute.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE);
+ aRetval.SetVertical(rFontAttribute.getVertical() ? TRUE : FALSE);
+ aRetval.SetWeight(static_cast<FontWeight>(rFontAttribute.getWeight()));
+ aRetval.SetItalic(rFontAttribute.getItalic() ? ITALIC_NORMAL : ITALIC_NONE);
+ aRetval.SetOutline(rFontAttribute.getOutline());
aRetval.SetLanguage(MsLangId::convertLocaleToLanguage(rLocale));
#ifdef WIN32
@@ -371,13 +383,13 @@ namespace drawinglayer
return aRetval;
}
- FontAttributes getFontAttributesFromVclFont(
+ attribute::FontAttribute getFontAttributeFromVclFont(
basegfx::B2DVector& o_rSize,
const Font& rFont,
bool bRTL,
bool bBiDiStrong)
{
- const FontAttributes aRetval(
+ const attribute::FontAttribute aRetval(
rFont.GetName(),
rFont.GetStyleName(),
static_cast<sal_uInt16>(rFont.GetWeight()),
diff --git a/drawinglayer/source/primitive2d/textlineprimitive2d.cxx b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx
new file mode 100644
index 000000000000..45b2809be2ce
--- /dev/null
+++ b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textdecoratedprimitive2d.cxx,v $
+ *
+ * $Revision: 1.12 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/primitive2d/textlineprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence TextLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence xRetval;
+
+ if(TEXT_LINE_NONE != getTextLine())
+ {
+ bool bDoubleLine(false);
+ bool bWaveLine(false);
+ bool bBoldLine(false);
+ const int* pDotDashArray(0);
+ basegfx::B2DLineJoin eLineJoin(basegfx::B2DLINEJOIN_NONE);
+ double fOffset(getOffset());
+ double fHeight(getHeight());
+
+ static const int aDottedArray[] = { 1, 1, 0}; // DOTTED LINE
+ static const int aDotDashArray[] = { 1, 1, 4, 1, 0}; // DASHDOT
+ static const int aDashDotDotArray[] = { 1, 1, 1, 1, 4, 1, 0}; // DASHDOTDOT
+ static const int aDashedArray[] = { 5, 2, 0}; // DASHED LINE
+ static const int aLongDashArray[] = { 7, 2, 0}; // LONGDASH
+
+ // get decomposition
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ switch(getTextLine())
+ {
+ default: // case TEXT_LINE_SINGLE:
+ {
+ break;
+ }
+ case TEXT_LINE_DOUBLE:
+ {
+ bDoubleLine = true;
+ break;
+ }
+ case TEXT_LINE_DOTTED:
+ {
+ pDotDashArray = aDottedArray;
+ break;
+ }
+ case TEXT_LINE_DASH:
+ {
+ pDotDashArray = aDashedArray;
+ break;
+ }
+ case TEXT_LINE_LONGDASH:
+ {
+ pDotDashArray = aLongDashArray;
+ break;
+ }
+ case TEXT_LINE_DASHDOT:
+ {
+ pDotDashArray = aDotDashArray;
+ break;
+ }
+ case TEXT_LINE_DASHDOTDOT:
+ {
+ pDotDashArray = aDashDotDotArray;
+ break;
+ }
+ case TEXT_LINE_SMALLWAVE:
+ {
+ bWaveLine = true;
+ break;
+ }
+ case TEXT_LINE_WAVE:
+ {
+ bWaveLine = true;
+ break;
+ }
+ case TEXT_LINE_DOUBLEWAVE:
+ {
+ bDoubleLine = true;
+ bWaveLine = true;
+ break;
+ }
+ case TEXT_LINE_BOLD:
+ {
+ bBoldLine = true;
+ break;
+ }
+ case TEXT_LINE_BOLDDOTTED:
+ {
+ bBoldLine = true;
+ pDotDashArray = aDottedArray;
+ break;
+ }
+ case TEXT_LINE_BOLDDASH:
+ {
+ bBoldLine = true;
+ pDotDashArray = aDashedArray;
+ break;
+ }
+ case TEXT_LINE_BOLDLONGDASH:
+ {
+ bBoldLine = true;
+ pDotDashArray = aLongDashArray;
+ break;
+ }
+ case TEXT_LINE_BOLDDASHDOT:
+ {
+ bBoldLine = true;
+ pDotDashArray = aDotDashArray;
+ break;
+ }
+ case TEXT_LINE_BOLDDASHDOTDOT:
+ {
+ bBoldLine = true;
+ pDotDashArray = aDashDotDotArray;
+ break;
+ }
+ case TEXT_LINE_BOLDWAVE:
+ {
+ bWaveLine = true;
+ bBoldLine = true;
+ break;
+ }
+ }
+
+ if(bBoldLine)
+ {
+ fHeight *= 2.0;
+ }
+
+ if(bDoubleLine)
+ {
+ fOffset -= 0.50 * fHeight;
+ fHeight *= 0.64;
+ }
+
+ if(bWaveLine)
+ {
+ eLineJoin = basegfx::B2DLINEJOIN_ROUND;
+ fHeight *= 0.25;
+ }
+
+ // prepare Line and Stroke Attributes
+ const attribute::LineAttribute aLineAttribute(getLineColor(), fHeight, eLineJoin);
+ attribute::StrokeAttribute aStrokeAttribute;
+
+ if(pDotDashArray)
+ {
+ ::std::vector< double > aDoubleArray;
+
+ for(const int* p = pDotDashArray; *p; ++p)
+ {
+ aDoubleArray.push_back((double)(*p) * fHeight);
+ }
+
+ aStrokeAttribute = attribute::StrokeAttribute(aDoubleArray);
+ }
+
+ // create base polygon and new primitive
+ basegfx::B2DPolygon aLine;
+ Primitive2DReference aNewPrimitive;
+
+ aLine.append(basegfx::B2DPoint(0.0, fOffset));
+ aLine.append(basegfx::B2DPoint(getWidth(), fOffset));
+
+ const basegfx::B2DHomMatrix aUnscaledTransform(
+ basegfx::tools::createShearXRotateTranslateB2DHomMatrix(
+ fShearX, fRotate, aTranslate));
+
+ aLine.transform(aUnscaledTransform);
+
+ if(bWaveLine)
+ {
+ double fWaveWidth(10.6 * fHeight);
+
+ if(TEXT_LINE_SMALLWAVE == getTextLine())
+ {
+ fWaveWidth *= 0.7;
+ }
+ else if(TEXT_LINE_WAVE == getTextLine())
+ {
+ // extra multiply to get the same WaveWidth as with the bold version
+ fWaveWidth *= 2.0;
+ }
+
+ aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, fWaveWidth * 0.5));
+ }
+ else
+ {
+ aNewPrimitive = Primitive2DReference(new PolygonStrokePrimitive2D(aLine, aLineAttribute, aStrokeAttribute));
+ }
+
+ // add primitive
+ appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, aNewPrimitive);
+
+ if(bDoubleLine)
+ {
+ // double line, create 2nd primitive with offset using TransformPrimitive based on
+ // already created NewPrimitive
+ double fLineDist(2.3 * fHeight);
+
+ if(bWaveLine)
+ {
+ fLineDist = 6.3 * fHeight;
+ }
+
+ // move base point of text to 0.0 and de-rotate
+ basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ -aTranslate.getX(), -aTranslate.getY()));
+ aTransform.rotate(-fRotate);
+
+ // translate in Y by offset
+ aTransform.translate(0.0, fLineDist);
+
+ // move back and rotate
+ aTransform.rotate(fRotate);
+ aTransform.translate(aTranslate.getX(), aTranslate.getY());
+
+ // add transform primitive
+ const Primitive2DSequence aContent(&aNewPrimitive, 1);
+ appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ Primitive2DReference(new TransformPrimitive2D(aTransform, aContent)));
+ }
+ }
+
+ return xRetval;
+ }
+
+ TextLinePrimitive2D::TextLinePrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ double fOffset,
+ double fHeight,
+ TextLine eTextLine,
+ const basegfx::BColor& rLineColor)
+ : BufferedDecompositionPrimitive2D(),
+ maObjectTransformation(rObjectTransformation),
+ mfWidth(fWidth),
+ mfOffset(fOffset),
+ mfHeight(fHeight),
+ meTextLine(eTextLine),
+ maLineColor(rLineColor)
+ {
+ }
+
+ bool TextLinePrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const TextLinePrimitive2D& rCompare = (TextLinePrimitive2D&)rPrimitive;
+
+ return (getObjectTransformation() == rCompare.getObjectTransformation()
+ && getWidth() == rCompare.getWidth()
+ && getOffset() == rCompare.getOffset()
+ && getHeight() == rCompare.getHeight()
+ && getTextLine() == rCompare.getTextLine()
+ && getLineColor() == rCompare.getLineColor());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(TextLinePrimitive2D, PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index 6caafd1911ce..61a0c6d15897 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -50,27 +50,6 @@ using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
-namespace drawinglayer
-{
- namespace primitive2d
- {
- bool FontAttributes::operator==(const FontAttributes& rCompare) const
- {
- return (getFamilyName() == rCompare.getFamilyName()
- && getStyleName() == rCompare.getStyleName()
- && getWeight() == rCompare.getWeight()
- && getSymbol() == rCompare.getSymbol()
- && getVertical() == rCompare.getVertical()
- && getItalic() == rCompare.getItalic()
- && getOutline() == rCompare.getOutline()
- && getRTL() == rCompare.getRTL()
- && getBiDiStrong() == rCompare.getBiDiStrong());
- }
- } // end of namespace primitive2d
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
namespace
{
// adapts fontScale for usage with TextLayouter. Input is rScale which is the extracted
@@ -156,8 +135,8 @@ namespace drawinglayer
// prepare textlayoutdevice
TextLayouterDevice aTextLayouter;
- aTextLayouter.setFontAttributes(
- getFontAttributes(),
+ aTextLayouter.setFontAttribute(
+ getFontAttribute(),
aFontScale.getX(),
aFontScale.getY(),
getLocale());
@@ -236,7 +215,7 @@ namespace drawinglayer
aRetval[a] = new PolyPolygonColorPrimitive2D(rPolyPolygon, getFontColor());
}
- if(getFontAttributes().getOutline())
+ if(getFontAttribute().getOutline())
{
// decompose polygon transformation to single values
basegfx::B2DVector aScale, aTranslate;
@@ -264,7 +243,7 @@ namespace drawinglayer
xub_StrLen aTextPosition,
xub_StrLen aTextLength,
const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes,
+ const attribute::FontAttribute& rFontAttribute,
const ::com::sun::star::lang::Locale& rLocale,
const basegfx::BColor& rFontColor)
: BufferedDecompositionPrimitive2D(),
@@ -273,7 +252,7 @@ namespace drawinglayer
maTextPosition(aTextPosition),
maTextLength(aTextLength),
maDXArray(rDXArray),
- maFontAttributes(rFontAttributes),
+ maFontAttribute(rFontAttribute),
maLocale(rLocale),
maFontColor(rFontColor),
maB2DRange()
@@ -285,7 +264,7 @@ namespace drawinglayer
#endif
}
- bool impLocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB)
+ bool LocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB)
{
return (rA.Language == rB.Language
&& rA.Country == rB.Country
@@ -303,8 +282,8 @@ namespace drawinglayer
&& getTextPosition() == rCompare.getTextPosition()
&& getTextLength() == rCompare.getTextLength()
&& getDXArray() == rCompare.getDXArray()
- && getFontAttributes() == rCompare.getFontAttributes()
- && impLocalesAreEqual(getLocale(), rCompare.getLocale())
+ && getFontAttribute() == rCompare.getFontAttribute()
+ && LocalesAreEqual(getLocale(), rCompare.getLocale())
&& getFontColor() == rCompare.getFontColor());
}
@@ -330,8 +309,8 @@ namespace drawinglayer
// prepare textlayoutdevice
TextLayouterDevice aTextLayouter;
- aTextLayouter.setFontAttributes(
- getFontAttributes(),
+ aTextLayouter.setFontAttribute(
+ getFontAttribute(),
aFontScale.getX(),
aFontScale.getY(),
getLocale());
diff --git a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx
new file mode 100644
index 000000000000..8b7d664dd62a
--- /dev/null
+++ b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx
@@ -0,0 +1,294 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textdecoratedprimitive2d.cxx,v $
+ *
+ * $Revision: 1.12 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ BaseTextStrikeoutPrimitive2D::BaseTextStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor)
+ : BufferedDecompositionPrimitive2D(),
+ maObjectTransformation(rObjectTransformation),
+ mfWidth(fWidth),
+ maFontColor(rFontColor)
+ {
+ }
+
+ bool BaseTextStrikeoutPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const BaseTextStrikeoutPrimitive2D& rCompare = (BaseTextStrikeoutPrimitive2D&)rPrimitive;
+
+ return (getObjectTransformation() == rCompare.getObjectTransformation()
+ && getWidth() == rCompare.getWidth()
+ && getFontColor() == rCompare.getFontColor());
+ }
+
+ return false;
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence TextCharacterStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // strikeout with character
+ const String aSingleCharString(getStrikeoutChar());
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+
+ // get decomposition
+ getObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // prepare TextLayouter
+ TextLayouterDevice aTextLayouter;
+
+ aTextLayouter.setFontAttribute(
+ getFontAttribute(),
+ aScale.getX(),
+ aScale.getY(),
+ getLocale());
+
+ const double fStrikeCharWidth(aTextLayouter.getTextWidth(aSingleCharString, 0, 1));
+ const double fStrikeCharCount(fabs(getWidth()/fStrikeCharWidth));
+ const sal_uInt32 nStrikeCharCount(static_cast< sal_uInt32 >(fStrikeCharCount + 0.5));
+ std::vector<double> aDXArray(nStrikeCharCount);
+ String aStrikeoutString;
+
+ for(sal_uInt32 a(0); a < nStrikeCharCount; a++)
+ {
+ aStrikeoutString += aSingleCharString;
+ aDXArray[a] = (a + 1) * fStrikeCharWidth;
+ }
+
+ Primitive2DReference xReference(
+ new TextSimplePortionPrimitive2D(
+ getObjectTransformation(),
+ aStrikeoutString,
+ 0,
+ aStrikeoutString.Len(),
+ aDXArray,
+ getFontAttribute(),
+ getLocale(),
+ getFontColor()));
+
+ return Primitive2DSequence(&xReference, 1);
+ }
+
+ TextCharacterStrikeoutPrimitive2D::TextCharacterStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ sal_Unicode aStrikeoutChar,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale)
+ : BaseTextStrikeoutPrimitive2D(rObjectTransformation, fWidth, rFontColor),
+ maStrikeoutChar(aStrikeoutChar),
+ maFontAttribute(rFontAttribute),
+ maLocale(rLocale)
+ {
+ }
+
+ bool TextCharacterStrikeoutPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(BaseTextStrikeoutPrimitive2D::operator==(rPrimitive))
+ {
+ const TextCharacterStrikeoutPrimitive2D& rCompare = (TextCharacterStrikeoutPrimitive2D&)rPrimitive;
+
+ return (getStrikeoutChar() == rCompare.getStrikeoutChar()
+ && getFontAttribute() == rCompare.getFontAttribute()
+ && LocalesAreEqual(getLocale(), rCompare.getLocale()));
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(TextCharacterStrikeoutPrimitive2D, PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence TextGeometryStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ OSL_ENSURE(FONT_STRIKEOUT_SLASH != getFontStrikeout() && FONT_STRIKEOUT_X != getFontStrikeout(),
+ "Wrong FONT_STRIKEOUT type; a TextCharacterStrikeoutPrimitive2D should be used (!)");
+
+ // strikeout with geometry
+ double fStrikeoutHeight(getHeight());
+ double fStrikeoutOffset(getOffset());
+ bool bDoubleLine(false);
+
+ // get decomposition
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // set line attribute
+ switch(getFontStrikeout())
+ {
+ default : // case primitive2d::FONT_STRIKEOUT_SINGLE:
+ {
+ break;
+ }
+ case primitive2d::FONT_STRIKEOUT_DOUBLE:
+ {
+ bDoubleLine = true;
+ break;
+ }
+ case primitive2d::FONT_STRIKEOUT_BOLD:
+ {
+ fStrikeoutHeight *= 2.0;
+ break;
+ }
+ }
+
+ if(bDoubleLine)
+ {
+ fStrikeoutOffset -= 0.50 * fStrikeoutHeight;
+ fStrikeoutHeight *= 0.64;
+ }
+
+ // create base polygon and new primitive
+ basegfx::B2DPolygon aStrikeoutLine;
+
+ aStrikeoutLine.append(basegfx::B2DPoint(0.0, -fStrikeoutOffset));
+ aStrikeoutLine.append(basegfx::B2DPoint(getWidth(), -fStrikeoutOffset));
+
+ const basegfx::B2DHomMatrix aUnscaledTransform(
+ basegfx::tools::createShearXRotateTranslateB2DHomMatrix(
+ fShearX, fRotate, aTranslate));
+
+ aStrikeoutLine.transform(aUnscaledTransform);
+
+ // add primitive
+ const attribute::LineAttribute aLineAttribute(getFontColor(), fStrikeoutHeight, basegfx::B2DLINEJOIN_NONE);
+ Primitive2DSequence xRetval(1);
+ xRetval[0] = Primitive2DReference(new PolygonStrokePrimitive2D(aStrikeoutLine, aLineAttribute));
+
+ if(bDoubleLine)
+ {
+ // double line, create 2nd primitive with offset using TransformPrimitive based on
+ // already created NewPrimitive
+ const double fLineDist(2.0 * fStrikeoutHeight);
+
+ // move base point of text to 0.0 and de-rotate
+ basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ -aTranslate.getX(), -aTranslate.getY()));
+ aTransform.rotate(-fRotate);
+
+ // translate in Y by offset
+ aTransform.translate(0.0, -fLineDist);
+
+ // move back and rotate
+ aTransform.rotate(fRotate);
+ aTransform.translate(aTranslate.getX(), aTranslate.getY());
+
+ // add transform primitive
+ appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ Primitive2DReference(
+ new TransformPrimitive2D(
+ aTransform,
+ xRetval)));
+ }
+
+ return xRetval;
+ }
+
+ TextGeometryStrikeoutPrimitive2D::TextGeometryStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ double fHeight,
+ double fOffset,
+ FontStrikeout eFontStrikeout)
+ : BaseTextStrikeoutPrimitive2D(rObjectTransformation, fWidth, rFontColor),
+ mfHeight(fHeight),
+ mfOffset(fOffset),
+ meFontStrikeout(eFontStrikeout)
+ {
+ }
+
+ bool TextGeometryStrikeoutPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(BaseTextStrikeoutPrimitive2D::operator==(rPrimitive))
+ {
+ const TextGeometryStrikeoutPrimitive2D& rCompare = (TextGeometryStrikeoutPrimitive2D&)rPrimitive;
+
+ return (getHeight() == rCompare.getHeight()
+ && getOffset() == rCompare.getOffset()
+ && getFontStrikeout() == rCompare.getFontStrikeout());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(TextGeometryStrikeoutPrimitive2D, PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx
new file mode 100644
index 000000000000..621b0b25ad98
--- /dev/null
+++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bitmapprimitive2d.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/primitive2d/wallpaperprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence WallpaperBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ if(!getLocalObjectRange().isEmpty() && !getBitmapEx().IsEmpty())
+ {
+ // get bitmap PIXEL size
+ const Size& rPixelSize = getBitmapEx().GetSizePixel();
+
+ if(rPixelSize.Width() > 0 && rPixelSize.Height() > 0)
+ {
+ if(WALLPAPER_SCALE == getWallpaperStyle())
+ {
+ // shortcut for scale; use simple BitmapPrimitive2D
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, getLocalObjectRange().getWidth());
+ aObjectTransform.set(1, 1, getLocalObjectRange().getHeight());
+ aObjectTransform.set(0, 2, getLocalObjectRange().getMinX());
+ aObjectTransform.set(1, 2, getLocalObjectRange().getMinY());
+
+ Primitive2DReference xReference(
+ new BitmapPrimitive2D(
+ getBitmapEx(),
+ aObjectTransform));
+
+ aRetval = Primitive2DSequence(&xReference, 1);
+ }
+ else
+ {
+ // transform to logic size
+ basegfx::B2DHomMatrix aInverseViewTransformation(getViewTransformation());
+ aInverseViewTransformation.invert();
+ basegfx::B2DVector aLogicSize(rPixelSize.Width(), rPixelSize.Height());
+ aLogicSize = aInverseViewTransformation * aLogicSize;
+
+ // apply laout
+ basegfx::B2DPoint aTargetTopLeft(getLocalObjectRange().getMinimum());
+ bool bUseTargetTopLeft(true);
+ bool bNeedsClipping(false);
+
+ switch(getWallpaperStyle())
+ {
+ default: //case WALLPAPER_TILE :, also WALLPAPER_NULL and WALLPAPER_APPLICATIONGRADIENT
+ {
+ bUseTargetTopLeft = false;
+ break;
+ }
+ case WALLPAPER_SCALE :
+ {
+ // handled by shortcut above
+ break;
+ }
+ case WALLPAPER_TOPLEFT :
+ {
+ // nothing to do
+ break;
+ }
+ case WALLPAPER_TOP :
+ {
+ const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
+ aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5));
+ break;
+ }
+ case WALLPAPER_TOPRIGHT :
+ {
+ aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX());
+ break;
+ }
+ case WALLPAPER_LEFT :
+ {
+ const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
+ aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5));
+ break;
+ }
+ case WALLPAPER_CENTER :
+ {
+ const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
+ aTargetTopLeft = aCenter - (aLogicSize * 0.5);
+ break;
+ }
+ case WALLPAPER_RIGHT :
+ {
+ const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
+ aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX());
+ aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5));
+ break;
+ }
+ case WALLPAPER_BOTTOMLEFT :
+ {
+ aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY());
+ break;
+ }
+ case WALLPAPER_BOTTOM :
+ {
+ const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter());
+ aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5));
+ aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY());
+ break;
+ }
+ case WALLPAPER_BOTTOMRIGHT :
+ {
+ aTargetTopLeft = getLocalObjectRange().getMaximum() - aLogicSize;
+ break;
+ }
+ }
+
+ if(bUseTargetTopLeft)
+ {
+ // fill target range
+ const basegfx::B2DRange aTargetRange(aTargetTopLeft, aTargetTopLeft + aLogicSize);
+
+ // create aligned, single BitmapPrimitive2D
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, aTargetRange.getWidth());
+ aObjectTransform.set(1, 1, aTargetRange.getHeight());
+ aObjectTransform.set(0, 2, aTargetRange.getMinX());
+ aObjectTransform.set(1, 2, aTargetRange.getMinY());
+
+ Primitive2DReference xReference(
+ new BitmapPrimitive2D(
+ getBitmapEx(),
+ aObjectTransform));
+ aRetval = Primitive2DSequence(&xReference, 1);
+
+ // clip when not completely inside object range
+ bNeedsClipping = !getLocalObjectRange().isInside(aTargetRange);
+ }
+ else
+ {
+ // WALLPAPER_TILE, WALLPAPER_NULL, WALLPAPER_APPLICATIONGRADIENT
+ // convert to relative positions
+ const basegfx::B2DVector aRelativeSize(
+ aLogicSize.getX() / (getLocalObjectRange().getWidth() ? getLocalObjectRange().getWidth() : 1.0),
+ aLogicSize.getY() / (getLocalObjectRange().getHeight() ? getLocalObjectRange().getHeight() : 1.0));
+ basegfx::B2DPoint aRelativeTopLeft(0.0, 0.0);
+
+ if(WALLPAPER_TILE != getWallpaperStyle())
+ {
+ aRelativeTopLeft.setX(0.5 - aRelativeSize.getX());
+ aRelativeTopLeft.setY(0.5 - aRelativeSize.getY());
+ }
+
+ // prepare FillBitmapAttribute
+ const attribute::FillBitmapAttribute aFillBitmapAttribute(
+ getBitmapEx(),
+ aRelativeTopLeft,
+ aRelativeSize,
+ true);
+
+ // create ObjectTransform
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, getLocalObjectRange().getWidth());
+ aObjectTransform.set(1, 1, getLocalObjectRange().getHeight());
+ aObjectTransform.set(0, 2, getLocalObjectRange().getMinX());
+ aObjectTransform.set(1, 2, getLocalObjectRange().getMinY());
+
+ // create FillBitmapPrimitive
+ const drawinglayer::primitive2d::Primitive2DReference xFillBitmap(
+ new drawinglayer::primitive2d::FillBitmapPrimitive2D(
+ aObjectTransform,
+ aFillBitmapAttribute));
+ aRetval = Primitive2DSequence(&xFillBitmap, 1);
+
+ // always embed tiled fill to clipping
+ bNeedsClipping = true;
+ }
+
+ if(bNeedsClipping)
+ {
+ // embed to clipping; this is necessary for tiled fills
+ const basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createPolygonFromRect(getLocalObjectRange()));
+ const drawinglayer::primitive2d::Primitive2DReference xClippedFill(
+ new drawinglayer::primitive2d::MaskPrimitive2D(
+ aPolyPolygon,
+ aRetval));
+ aRetval = Primitive2DSequence(&xClippedFill, 1);
+ }
+ }
+ }
+ }
+
+ return aRetval;
+ }
+
+ WallpaperBitmapPrimitive2D::WallpaperBitmapPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const BitmapEx& rBitmapEx,
+ WallpaperStyle eWallpaperStyle)
+ : ViewTransformationDependentPrimitive2D(),
+ maObjectRange(rObjectRange),
+ maBitmapEx(rBitmapEx),
+ meWallpaperStyle(eWallpaperStyle)
+ {
+ }
+
+ bool WallpaperBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(ViewTransformationDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const WallpaperBitmapPrimitive2D& rCompare = (WallpaperBitmapPrimitive2D&)rPrimitive;
+
+ return (getLocalObjectRange() == rCompare.getLocalObjectRange()
+ && getBitmapEx() == rCompare.getBitmapEx()
+ && getWallpaperStyle() == rCompare.getWallpaperStyle());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange WallpaperBitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ return getLocalObjectRange();
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(WallpaperBitmapPrimitive2D, PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D)
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
index 16f33435a38b..deeed95a71fd 100644
--- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
@@ -171,12 +171,12 @@ namespace drawinglayer
namespace primitive3d
{
BitmapTexturePrimitive3D::BitmapTexturePrimitive3D(
- const attribute::FillBitmapAttribute& rBitmap,
+ const attribute::FillBitmapAttribute& rFillBitmapAttribute,
const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate, bool bFilter)
: TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
- maBitmap(rBitmap)
+ maFillBitmapAttribute(rFillBitmapAttribute)
{
}
@@ -186,7 +186,7 @@ namespace drawinglayer
{
const BitmapTexturePrimitive3D& rCompare = (BitmapTexturePrimitive3D&)rPrimitive;
- return (getBitmap() == rCompare.getBitmap());
+ return (getFillBitmapAttribute() == rCompare.getFillBitmapAttribute());
}
return false;
diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx
index 20d07add629c..649c208a6db5 100644
--- a/drawinglayer/source/processor2d/canvasprocessor.cxx
+++ b/drawinglayer/source/processor2d/canvasprocessor.cxx
@@ -676,7 +676,7 @@ using namespace com::sun::star;
// directdraw of text simple portion
void canvasProcessor::impRender_STXP(const textSimplePortionPrimitive& rTextCandidate)
{
- const fontAttributes& rFontAttrs( rTextCandidate.getFontAttributes() );
+ const fontAttributes& rFontAttrs( rTextCandidate.getFontAttribute() );
rendering::FontRequest aFontRequest;
aFontRequest.FontDescription.FamilyName = rFontAttrs.maFamilyName;
@@ -1517,16 +1517,16 @@ namespace drawinglayer
}
else
{
- const primitive2d::FontAttributes& rFontAttrs(rTextCandidate.getFontAttributes());
+ const attribute::FontAttribute& rFontAttr(rTextCandidate.getFontAttribute());
rendering::FontRequest aFontRequest;
- aFontRequest.FontDescription.FamilyName = rFontAttrs.getFamilyName();
- aFontRequest.FontDescription.StyleName = rFontAttrs.getStyleName();
- aFontRequest.FontDescription.IsSymbolFont = rFontAttrs.getSymbol() ? util::TriState_YES : util::TriState_NO;
- aFontRequest.FontDescription.IsVertical = rFontAttrs.getVertical() ? util::TriState_YES : util::TriState_NO;
+ aFontRequest.FontDescription.FamilyName = rFontAttr.getFamilyName();
+ aFontRequest.FontDescription.StyleName = rFontAttr.getStyleName();
+ aFontRequest.FontDescription.IsSymbolFont = rFontAttr.getSymbol() ? util::TriState_YES : util::TriState_NO;
+ aFontRequest.FontDescription.IsVertical = rFontAttr.getVertical() ? util::TriState_YES : util::TriState_NO;
// TODO(F2): improve vclenum->panose conversion
- aFontRequest.FontDescription.FontDescription.Weight = static_cast< sal_uInt8 >(rFontAttrs.getWeight());
- aFontRequest.FontDescription.FontDescription.Letterform = rFontAttrs.getItalic() ? 9 : 0;
+ aFontRequest.FontDescription.FontDescription.Weight = static_cast< sal_uInt8 >(rFontAttr.getWeight());
+ aFontRequest.FontDescription.FontDescription.Letterform = rFontAttr.getItalic() ? 9 : 0;
// init CellSize to 1.0, else a default font height will be used
aFontRequest.CellSize = 1.0;
@@ -1795,7 +1795,7 @@ namespace drawinglayer
if(rFillBitmapAttribute.getTiling())
{
// apply possible color modification to Bitmap
- const BitmapEx aChangedBitmapEx(impModifyBitmapEx(maBColorModifierStack, BitmapEx(rFillBitmapAttribute.getBitmap())));
+ const BitmapEx aChangedBitmapEx(impModifyBitmapEx(maBColorModifierStack, rFillBitmapAttribute.getBitmapEx()));
if(aChangedBitmapEx.IsEmpty())
{
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 8b47368a58b9..062af73f5f0a 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -113,6 +113,7 @@ namespace drawinglayer
{
// Prepare VDev, MetaFile and connections
OutputDevice* pLastOutputDevice = mpOutputDevice;
+ GDIMetaFile* pLastMetafile = mpMetaFile;
basegfx::B2DRange aPrimitiveRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D()));
// transform primitive range with current transformation (e.g shadow offset)
@@ -125,6 +126,7 @@ namespace drawinglayer
MapMode aNewMapMode(pLastOutputDevice->GetMapMode());
mpOutputDevice = &aContentVDev;
+ mpMetaFile = &o_rContentMetafile;
aContentVDev.EnableOutput(false);
aContentVDev.SetMapMode(pLastOutputDevice->GetMapMode());
o_rContentMetafile.Record(&aContentVDev);
@@ -145,6 +147,7 @@ namespace drawinglayer
o_rContentMetafile.SetPrefMapMode(aNewMapMode);
o_rContentMetafile.SetPrefSize(aPrimitiveRectangle.GetSize());
mpOutputDevice = pLastOutputDevice;
+ mpMetaFile = pLastMetafile;
return aPrimitiveRectangle;
}
@@ -219,7 +222,7 @@ namespace drawinglayer
SvMemoryStream aMemStm;
aMemStm << *pSvtGraphicFill;
- mrMetaFile.AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END)));
+ mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END)));
mnSvtGraphicFillCount++;
}
}
@@ -229,7 +232,7 @@ namespace drawinglayer
if(pSvtGraphicFill && mnSvtGraphicFillCount)
{
mnSvtGraphicFillCount--;
- mrMetaFile.AddAction(new MetaCommentAction("XPATHFILL_SEQ_END"));
+ mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_END"));
delete pSvtGraphicFill;
}
}
@@ -372,7 +375,7 @@ namespace drawinglayer
SvMemoryStream aMemStm;
aMemStm << *pSvtGraphicStroke;
- mrMetaFile.AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END)));
+ mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END)));
mnSvtGraphicStrokeCount++;
}
}
@@ -382,7 +385,7 @@ namespace drawinglayer
if(pSvtGraphicStroke && mnSvtGraphicStrokeCount)
{
mnSvtGraphicStrokeCount--;
- mrMetaFile.AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_END"));
+ mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_END"));
delete pSvtGraphicStroke;
}
}
@@ -392,7 +395,7 @@ namespace drawinglayer
VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev)
: VclProcessor2D(rViewInformation, rOutDev),
- mrMetaFile(*rOutDev.GetConnectMetaFile()),
+ mpMetaFile(rOutDev.GetConnectMetaFile()),
mnSvtGraphicFillCount(0),
mnSvtGraphicStrokeCount(0),
mfCurrentUnifiedTransparence(0.0),
@@ -816,19 +819,19 @@ namespace drawinglayer
{
default : // case drawinglayer::primitive2d::FIELD_TYPE_COMMON :
{
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringCommon));
break;
}
case drawinglayer::primitive2d::FIELD_TYPE_PAGE :
{
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringPage));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringPage));
break;
}
case drawinglayer::primitive2d::FIELD_TYPE_URL :
{
const rtl::OUString& rURL = rFieldPrimitive.getString();
const String aOldString(rURL);
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon, 0, reinterpret_cast< const BYTE* >(aOldString.GetBuffer()), 2 * aOldString.Len()));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringCommon, 0, reinterpret_cast< const BYTE* >(aOldString.GetBuffer()), 2 * aOldString.Len()));
break;
}
}
@@ -838,7 +841,7 @@ namespace drawinglayer
process(rContent);
// for the end comment the type is not relevant yet, they are all the same. Just add.
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringEnd));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringEnd));
if(mpPDFExtOutDevData && drawinglayer::primitive2d::FIELD_TYPE_URL == rFieldPrimitive.getType())
{
@@ -863,7 +866,7 @@ namespace drawinglayer
// process recursively and add MetaFile comment
process(rLinePrimitive.get2DDecomposition(getViewInformation2D()));
- mrMetaFile.AddAction(new MetaCommentAction(aCommentString));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentString));
break;
}
@@ -876,7 +879,7 @@ namespace drawinglayer
// process recursively and add MetaFile comment
process(rBulletPrimitive.get2DDecomposition(getViewInformation2D()));
- mrMetaFile.AddAction(new MetaCommentAction(aCommentString));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentString));
break;
}
@@ -893,7 +896,7 @@ namespace drawinglayer
// process recursively and add MetaFile comment
process(rParagraphPrimitive.get2DDecomposition(getViewInformation2D()));
- mrMetaFile.AddAction(new MetaCommentAction(aCommentString));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentString));
if(mpPDFExtOutDevData)
{
@@ -910,9 +913,9 @@ namespace drawinglayer
static const ByteString aCommentStringB("XTEXT_PAINTSHAPE_END");
// add MetaFile comment, process recursively and add MetaFile comment
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA));
process(rBlockPrimitive.get2DDecomposition(getViewInformation2D()));
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB));
break;
}
@@ -965,17 +968,17 @@ namespace drawinglayer
// create the entries for the respective break positions
if(i == nNextCellBreak)
{
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA, i - nTextPosition));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA, i - nTextPosition));
nNextCellBreak = mxBreakIterator->nextCharacters(rTxt, i, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
}
if(i == nNextWordBoundary.endPos)
{
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB, i - nTextPosition));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB, i - nTextPosition));
nNextWordBoundary = mxBreakIterator->getWordBoundary(rTxt, i + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True);
}
if(i == nNextSentenceBreak)
{
- mrMetaFile.AddAction(new MetaCommentAction(aCommentStringC, i - nTextPosition));
+ mpMetaFile->AddAction(new MetaCommentAction(aCommentStringC, i - nTextPosition));
nNextSentenceBreak = mxBreakIterator->endOfSentence(rTxt, i + 1, rLocale);
}
}
@@ -1042,7 +1045,7 @@ namespace drawinglayer
{
const Polygon aToolsPolygon(aCandidate);
- mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo));
+ mpMetaFile->AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo));
}
}
}
@@ -1107,7 +1110,7 @@ namespace drawinglayer
{
const Polygon aToolsPolygon(aCandidate);
- mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo));
+ mpMetaFile->AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo));
}
}
@@ -1172,8 +1175,8 @@ namespace drawinglayer
const basegfx::B2DPoint aFillBitmapTopLeft(rFillBitmapAttribute.getTopLeft() * aOutlineSize);
// the scaling needs scale from pixel to logic coordinate system
- const Bitmap& rBitmap = rFillBitmapAttribute.getBitmap();
- Size aBmpSizePixel(rBitmap.GetSizePixel());
+ const BitmapEx& rBitmapEx = rFillBitmapAttribute.getBitmapEx();
+ Size aBmpSizePixel(rBitmapEx.GetSizePixel());
if(!aBmpSizePixel.Width())
{
@@ -1197,7 +1200,7 @@ namespace drawinglayer
aTransform.matrix[5] = aFillBitmapTopLeft.getY();
// setup fill graphic like in impgrfll
- Graphic aFillGraphic = Graphic(rBitmap);
+ Graphic aFillGraphic = Graphic(rBitmapEx);
aFillGraphic.SetPrefMapMode(MapMode(MAP_PIXEL));
aFillGraphic.SetPrefSize(aBmpSizePixel);
@@ -1551,7 +1554,10 @@ namespace drawinglayer
// svae old mfCurrentUnifiedTransparence and set new one
// so that contained SvtGraphicStroke may use the current one
const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence);
- mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha();
+ // #i105377# paint the content metafile opaque as the transparency gets
+ // split of into the gradient below
+ // mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha();
+ mfCurrentUnifiedTransparence = 0;
// various content, create content-metafile
GDIMetaFile aContentMetafile;
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index b1d91ebc86fc..51192f2dc72f 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -232,8 +232,16 @@ namespace drawinglayer
mpOutputDevice->SetAntialiasing(nOldAntiAliase | ANTIALIASING_PIXELSNAPHAIRLINE);
}
- // direct draw of MetaFile
- RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate));
+ static bool bTestMetaFilePrimitiveDecomposition(true);
+ if(bTestMetaFilePrimitiveDecomposition)
+ {
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ }
+ else
+ {
+ // direct draw of MetaFile
+ RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate));
+ }
if(bForceLineSnap)
{
@@ -535,23 +543,18 @@ namespace drawinglayer
case PRIMITIVE2D_ID_INVERTPRIMITIVE2D :
{
// invert primitive (currently only used for HighContrast fallback for selection in SW and SC).
- // Set OutDev to XOR
+ // Set OutDev to XOR and switch AA off (XOR does not work with AA)
mpOutputDevice->Push();
mpOutputDevice->SetRasterOp( ROP_XOR );
-
- // force paint color to white by using ColorModifierStack
- const basegfx::BColor aColWhite(1.0, 1.0, 1.0);
- const basegfx::BColorModifier aColorModifier(aColWhite, 0.0, basegfx::BCOLORMODIFYMODE_REPLACE);
- maBColorModifierStack.push(aColorModifier);
+ const sal_uInt16 nAntiAliasing(mpOutputDevice->GetAntialiasing());
+ mpOutputDevice->SetAntialiasing(nAntiAliasing & ~ANTIALIASING_ENABLE_B2DDRAW);
// process content recursively
process(rCandidate.get2DDecomposition(getViewInformation2D()));
- // restore ColorModifierStack
- maBColorModifierStack.pop();
-
// restore OutDev
mpOutputDevice->Pop();
+ mpOutputDevice->SetAntialiasing(nAntiAliasing);
break;
}
default :
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index eb5b4b0fbd30..127d4845e672 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -63,6 +63,7 @@
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/metric.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
// control support
@@ -99,31 +100,31 @@ namespace drawinglayer
using ::com::sun::star::awt::XWindow;
using ::com::sun::star::awt::PosSize::POSSIZE;
- static FontUnderline mapTextLineStyle(primitive2d::FontUnderline eLineStyle)
+ static FontUnderline mapTextLineStyle(drawinglayer::primitive2d::TextLine eLineStyle)
{
switch(eLineStyle)
{
default:
DBG_WARNING1( "DrawingLayer: Unknown text line style attribute (%d)!", eLineStyle );
// fall through
- case primitive2d::FONT_UNDERLINE_NONE: return UNDERLINE_NONE;
- case primitive2d::FONT_UNDERLINE_SINGLE: return UNDERLINE_SINGLE;
- case primitive2d::FONT_UNDERLINE_DOUBLE: return UNDERLINE_DOUBLE;
- case primitive2d::FONT_UNDERLINE_DOTTED: return UNDERLINE_DOTTED;
- case primitive2d::FONT_UNDERLINE_DASH: return UNDERLINE_DASH;
- case primitive2d::FONT_UNDERLINE_LONGDASH: return UNDERLINE_LONGDASH;
- case primitive2d::FONT_UNDERLINE_DASHDOT: return UNDERLINE_DASHDOT;
- case primitive2d::FONT_UNDERLINE_DASHDOTDOT: return UNDERLINE_DASHDOTDOT;
- case primitive2d::FONT_UNDERLINE_SMALLWAVE: return UNDERLINE_SMALLWAVE;
- case primitive2d::FONT_UNDERLINE_WAVE: return UNDERLINE_WAVE;
- case primitive2d::FONT_UNDERLINE_DOUBLEWAVE: return UNDERLINE_DOUBLEWAVE;
- case primitive2d::FONT_UNDERLINE_BOLD: return UNDERLINE_BOLD;
- case primitive2d::FONT_UNDERLINE_BOLDDOTTED: return UNDERLINE_BOLDDOTTED;
- case primitive2d::FONT_UNDERLINE_BOLDDASH: return UNDERLINE_BOLDDASH;
- case primitive2d::FONT_UNDERLINE_BOLDLONGDASH: return UNDERLINE_LONGDASH;
- case primitive2d::FONT_UNDERLINE_BOLDDASHDOT: return UNDERLINE_BOLDDASHDOT;
- case primitive2d::FONT_UNDERLINE_BOLDDASHDOTDOT:return UNDERLINE_BOLDDASHDOT;
- case primitive2d::FONT_UNDERLINE_BOLDWAVE: return UNDERLINE_BOLDWAVE;
+ case primitive2d::TEXT_LINE_NONE: return UNDERLINE_NONE;
+ case primitive2d::TEXT_LINE_SINGLE: return UNDERLINE_SINGLE;
+ case primitive2d::TEXT_LINE_DOUBLE: return UNDERLINE_DOUBLE;
+ case primitive2d::TEXT_LINE_DOTTED: return UNDERLINE_DOTTED;
+ case primitive2d::TEXT_LINE_DASH: return UNDERLINE_DASH;
+ case primitive2d::TEXT_LINE_LONGDASH: return UNDERLINE_LONGDASH;
+ case primitive2d::TEXT_LINE_DASHDOT: return UNDERLINE_DASHDOT;
+ case primitive2d::TEXT_LINE_DASHDOTDOT: return UNDERLINE_DASHDOTDOT;
+ case primitive2d::TEXT_LINE_SMALLWAVE: return UNDERLINE_SMALLWAVE;
+ case primitive2d::TEXT_LINE_WAVE: return UNDERLINE_WAVE;
+ case primitive2d::TEXT_LINE_DOUBLEWAVE: return UNDERLINE_DOUBLEWAVE;
+ case primitive2d::TEXT_LINE_BOLD: return UNDERLINE_BOLD;
+ case primitive2d::TEXT_LINE_BOLDDOTTED: return UNDERLINE_BOLDDOTTED;
+ case primitive2d::TEXT_LINE_BOLDDASH: return UNDERLINE_BOLDDASH;
+ case primitive2d::TEXT_LINE_BOLDLONGDASH: return UNDERLINE_LONGDASH;
+ case primitive2d::TEXT_LINE_BOLDDASHDOT: return UNDERLINE_BOLDDASHDOT;
+ case primitive2d::TEXT_LINE_BOLDDASHDOTDOT:return UNDERLINE_BOLDDASHDOT;
+ case primitive2d::TEXT_LINE_BOLDWAVE: return UNDERLINE_BOLDWAVE;
}
}
@@ -157,8 +158,8 @@ namespace drawinglayer
if(basegfx::fTools::more(aFontScaling.getX(), 0.0) && basegfx::fTools::more(aFontScaling.getY(), 0.0))
{
// Get the VCL font (use FontHeight as FontWidth)
- Font aFont(primitive2d::getVclFontFromFontAttributes(
- rTextCandidate.getFontAttributes(),
+ Font aFont(primitive2d::getVclFontFromFontAttribute(
+ rTextCandidate.getFontAttribute(),
aFontScaling.getX(),
aFontScaling.getY(),
fRotate,
@@ -176,7 +177,7 @@ namespace drawinglayer
mpOutputDevice->SetTextLineColor( Color(aTextlineColor) );
// set Overline attribute
- FontUnderline eFontOverline = mapTextLineStyle( pTCPP->getFontOverline() );
+ const FontUnderline eFontOverline(mapTextLineStyle( pTCPP->getFontOverline() ));
if( eFontOverline != UNDERLINE_NONE )
{
aFont.SetOverline( eFontOverline );
@@ -187,7 +188,7 @@ namespace drawinglayer
}
// set Underline attribute
- FontUnderline eFontUnderline = mapTextLineStyle( pTCPP->getFontUnderline() );
+ const FontUnderline eFontUnderline(mapTextLineStyle( pTCPP->getFontUnderline() ));
if( eFontUnderline != UNDERLINE_NONE )
{
aFont.SetUnderline( eFontUnderline );
@@ -282,7 +283,7 @@ namespace drawinglayer
const Point aStartPoint(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()));
const sal_uInt32 nOldLayoutMode(mpOutputDevice->GetLayoutMode());
- if(rTextCandidate.getFontAttributes().getRTL())
+ if(rTextCandidate.getFontAttribute().getRTL())
{
sal_uInt32 nRTLLayoutMode(nOldLayoutMode & ~(TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG));
nRTLLayoutMode |= TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_TEXTORIGIN_LEFT;
@@ -310,7 +311,7 @@ namespace drawinglayer
rTextCandidate.getTextLength());
}
- if(rTextCandidate.getFontAttributes().getRTL())
+ if(rTextCandidate.getFontAttribute().getRTL())
{
mpOutputDevice->SetLayoutMode(nOldLayoutMode);
}
@@ -428,7 +429,7 @@ namespace drawinglayer
{
// no shear or rotate, draw direct in pixel coordinates
bPrimitiveAccepted = true;
- BitmapEx aBitmapEx(rFillBitmapAttribute.getBitmap());
+ BitmapEx aBitmapEx(rFillBitmapAttribute.getBitmapEx());
bool bPainted(false);
if(maBColorModifierStack.count())
@@ -585,9 +586,9 @@ namespace drawinglayer
if(rPolyPolygon.count())
{
const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPolygonCandidate.getFillBitmap();
- const Bitmap& rBitmap = rFillBitmapAttribute.getBitmap();
+ const BitmapEx& rBitmapEx = rFillBitmapAttribute.getBitmapEx();
- if(rBitmap.IsEmpty())
+ if(rBitmapEx.IsEmpty())
{
// empty bitmap, done
bDone = true;
@@ -679,7 +680,9 @@ namespace drawinglayer
aLocalPolyPolygon.transform(maCurrentTransformation);
mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
- if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing())
+ if(mnPolygonStrokePrimitive2D
+ && getOptionsDrawinglayer().IsAntiAliasing()
+ && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW))
{
// when AA is on and this filled polygons are the result of stroked line geometry,
// draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
index 5f35960323fe..1be93d83b9a9 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -234,19 +234,19 @@ namespace drawinglayer
texture::GeoTexSvx* pOldTex = mpGeoTexSvx;
// create texture
- const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getBitmap();
+ const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getFillBitmapAttribute();
if(rFillBitmapAttribute.getTiling())
{
mpGeoTexSvx = new texture::GeoTexSvxBitmapTiled(
- rFillBitmapAttribute.getBitmap(),
+ rFillBitmapAttribute.getBitmapEx().GetBitmap(),
rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(),
rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize());
}
else
{
mpGeoTexSvx = new texture::GeoTexSvxBitmap(
- rFillBitmapAttribute.getBitmap(),
+ rFillBitmapAttribute.getBitmapEx().GetBitmap(),
rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(),
rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize());
}
diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx
index 2411ca3c31b4..b788de195903 100644
--- a/svx/source/sdr/overlay/overlayselection.cxx
+++ b/svx/source/sdr/overlay/overlayselection.cxx
@@ -113,9 +113,16 @@ namespace sdr
if(nCount)
{
// create range primitives
- const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ const bool bInvert(OVERLAY_INVERT == maLastOverlayType);
+ basegfx::BColor aRGBColor(getBaseColor().getBColor());
aRetval.realloc(nCount);
+ if(bInvert)
+ {
+ // force color to white for invert to get a full invert
+ aRGBColor = basegfx::BColor(1.0, 1.0, 1.0);
+ }
+
for(sal_uInt32 a(0);a < nCount; a++)
{
const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(maRanges[a]));
@@ -125,7 +132,7 @@ namespace sdr
aRGBColor));
}
- if(OVERLAY_INVERT == maLastOverlayType)
+ if(bInvert)
{
// embed all in invert primitive
const drawinglayer::primitive2d::Primitive2DReference aInvert(
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 94d62794a397..43fb95f31d40 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -920,9 +920,6 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM
if(aSource.count())
{
- const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
- aSource.transform(aTransform);
-
if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
{
const Gradient& rGrad = pAct->GetGradient();
@@ -943,7 +940,20 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM
aXGradient.SetEndIntens(rGrad.GetEndIntensity());
aXGradient.SetSteps(rGrad.GetSteps());
- SetAttributes(pPath);
+ if(aVD.IsLineColor())
+ {
+ // switch line off; when there was one there will be a
+ // META_POLYLINE_ACTION following creating another object
+ const Color aLineColor(aVD.GetLineColor());
+ aVD.SetLineColor();
+ SetAttributes(pPath);
+ aVD.SetLineColor(aLineColor);
+ }
+ else
+ {
+ SetAttributes(pPath);
+ }
+
aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT));
aGradAttr.Put(XFillGradientItem(&pModel->GetItemPool(), aXGradient));
pPath->SetMergedItemSet(aGradAttr);
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 3f5da01e101b..38f9907e04d5 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -682,7 +682,7 @@ void SdrGrafObj::operator=( const SdrObject& rObj )
const SdrGrafObj& rGraf = (SdrGrafObj&) rObj;
- pGraphic->SetGraphic( rGraf.GetGraphic() );
+ pGraphic->SetGraphic( rGraf.GetGraphic(), &rGraf.GetGraphicObject() );
aCropRect = rGraf.aCropRect;
aFileName = rGraf.aFileName;
aFilterName = rGraf.aFilterName;
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 3f9cb0bd0d73..d45eb70f2f3f 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -80,29 +80,29 @@ namespace
return aRetval;
}
- static drawinglayer::primitive2d::FontUnderline mapTextLineStyle(FontUnderline eLineStyle)
+ static drawinglayer::primitive2d::TextLine mapTextLineStyle(FontUnderline eLineStyle)
{
switch(eLineStyle)
{
- case UNDERLINE_SINGLE: return drawinglayer::primitive2d::FONT_UNDERLINE_SINGLE;
- case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::FONT_UNDERLINE_DOUBLE;
- case UNDERLINE_DOTTED: return drawinglayer::primitive2d::FONT_UNDERLINE_DOTTED;
- case UNDERLINE_DASH: return drawinglayer::primitive2d::FONT_UNDERLINE_DASH;
- case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_LONGDASH;
- case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_DASHDOT;
- case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_DASHDOTDOT;
- case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_SMALLWAVE;
- case UNDERLINE_WAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_WAVE;
- case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_DOUBLEWAVE;
- case UNDERLINE_BOLD: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLD;
- case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDOTTED;
- case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASH;
- case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDLONGDASH;
- case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASHDOT;
- case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASHDOTDOT;
- case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDWAVE;
+ case UNDERLINE_SINGLE: return drawinglayer::primitive2d::TEXT_LINE_SINGLE;
+ case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLE;
+ case UNDERLINE_DOTTED: return drawinglayer::primitive2d::TEXT_LINE_DOTTED;
+ case UNDERLINE_DASH: return drawinglayer::primitive2d::TEXT_LINE_DASH;
+ case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::TEXT_LINE_LONGDASH;
+ case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOT;
+ case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOTDOT;
+ case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::TEXT_LINE_SMALLWAVE;
+ case UNDERLINE_WAVE: return drawinglayer::primitive2d::TEXT_LINE_WAVE;
+ case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLEWAVE;
+ case UNDERLINE_BOLD: return drawinglayer::primitive2d::TEXT_LINE_BOLD;
+ case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::TEXT_LINE_BOLDDOTTED;
+ case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASH;
+ case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDLONGDASH;
+ case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOT;
+ case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOTDOT;
+ case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::TEXT_LINE_BOLDWAVE;
// FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE
- default: return drawinglayer::primitive2d::FONT_UNDERLINE_NONE;
+ default: return drawinglayer::primitive2d::TEXT_LINE_NONE;
}
}
@@ -217,8 +217,8 @@ namespace
if(rInfo.mrText.Len() && rInfo.mnTextLen)
{
basegfx::B2DVector aFontScaling;
- drawinglayer::primitive2d::FontAttributes aFontAttributes(
- drawinglayer::primitive2d::getFontAttributesFromVclFont(
+ drawinglayer::attribute::FontAttribute aFontAttribute(
+ drawinglayer::primitive2d::getFontAttributeFromVclFont(
aFontScaling,
rInfo.mrFont,
rInfo.IsRTL(),
@@ -296,6 +296,11 @@ namespace
const Color aFontColor(rInfo.mrFont.GetColor());
const basegfx::BColor aBFontColor(aFontColor.getBColor());
+ // prepare wordLineMode (for underline and strikeout)
+ // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)'
+ // to be splitted which would not look like the original
+ const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet);
+
// prepare new primitive
drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = 0;
const bool bDecoratedIsNeeded(
@@ -304,7 +309,8 @@ namespace
|| STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout()
|| EMPHASISMARK_NONE != (rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE)
|| RELIEF_NONE != rInfo.mrFont.GetRelief()
- || rInfo.mrFont.IsShadow());
+ || rInfo.mrFont.IsShadow()
+ || bWordLineMode);
if(bDecoratedIsNeeded)
{
@@ -316,11 +322,11 @@ namespace
const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor());
// prepare overline and underline data
- const drawinglayer::primitive2d::FontUnderline eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline()));
- const drawinglayer::primitive2d::FontUnderline eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline()));
+ const drawinglayer::primitive2d::TextLine eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline()));
+ const drawinglayer::primitive2d::TextLine eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline()));
// check UndelineAbove
- const bool bUnderlineAbove(drawinglayer::primitive2d::FONT_UNDERLINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont));
+ const bool bUnderlineAbove(drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont));
// prepare strikeout data
drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE);
@@ -335,11 +341,6 @@ namespace
default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW
}
- // prepare wordLineMode (for underline and strikeout)
- // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)'
- // to be splitted which would not look like the original
- const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet);
-
// prepare emphasis mark data
drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE);
@@ -376,7 +377,7 @@ namespace
rInfo.mnTextStart,
rInfo.mnTextLen,
aDXArray,
- aFontAttributes,
+ aFontAttribute,
rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(),
aBFontColor,
@@ -403,7 +404,7 @@ namespace
rInfo.mnTextStart,
rInfo.mnTextLen,
aDXArray,
- aFontAttributes,
+ aFontAttribute,
rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(),
aBFontColor);
}
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
index f6a30d40b3d5..42215d35bad8 100644
--- a/svx/source/svdraw/svdotextpathdecomposition.cxx
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -366,8 +366,8 @@ namespace
{
const impPathTextPortion* pCandidate = rTextPortions[a];
basegfx::B2DVector aFontScaling;
- const drawinglayer::primitive2d::FontAttributes aCandidateFontAttributes(
- drawinglayer::primitive2d::getFontAttributesFromVclFont(
+ const drawinglayer::attribute::FontAttribute aCandidateFontAttribute(
+ drawinglayer::primitive2d::getFontAttributeFromVclFont(
aFontScaling,
pCandidate->getFont(),
pCandidate->isRTL(),
@@ -520,7 +520,7 @@ namespace
nPortionIndex,
nNextGlyphLen,
aNewDXArray,
- aCandidateFontAttributes,
+ aCandidateFontAttribute,
pCandidate->getLocale(),
aRGBShadowColor);
@@ -545,7 +545,7 @@ namespace
nPortionIndex,
nNextGlyphLen,
aNewDXArray,
- aCandidateFontAttributes,
+ aCandidateFontAttribute,
pCandidate->getLocale(),
aRGBColor);