summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2007-08-02 10:43:45 +0000
committerArmin Weiss <aw@openoffice.org>2007-08-02 10:43:45 +0000
commit393cc8060dce29376fbd2b6b3e410fe4572e78d1 (patch)
treed2a7a5ee03ea3c6e3c8e3451db7835a506559daa /drawinglayer
parenta81b5347d1e8f49732392bb14b05b6c71a556030 (diff)
#i39532# added support for diverse MetaFile comment hacks
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx5
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx199
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx126
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx24
-rw-r--r--drawinglayer/prj/d.lst2
-rw-r--r--drawinglayer/source/primitive2d/makefile.mk6
-rw-r--r--drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx431
-rw-r--r--drawinglayer/source/primitive2d/textprimitive2d.cxx444
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx206
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx8
10 files changed, 894 insertions, 557 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 4911204fdcb8..dc74ec7ebc80 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: drawinglayer_primitivetypes2d.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2007-07-27 09:03:17 $
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:43 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -84,6 +84,7 @@
#define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35)
#define PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36)
#define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37)
+#define PRIMITIVE2D_ID_TEXTFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
new file mode 100644
index 000000000000..941c1d62df26
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textdecoratedprimitive2d.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:43 $
+ *
+ * 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_TEXTDECORATEDPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE_TEXTPRIMITIVE2D_HXX
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ 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
+ };
+
+ enum FontStrikeout
+ {
+ FONT_STRIKEOUT_NONE,
+ FONT_STRIKEOUT_SINGLE,
+ FONT_STRIKEOUT_DOUBLE,
+ FONT_STRIKEOUT_BOLD,
+ FONT_STRIKEOUT_SLASH,
+ FONT_STRIKEOUT_X
+ };
+
+ enum FontEmphasisMark
+ {
+ FONT_EMPHASISMARK_NONE,
+ FONT_EMPHASISMARK_DOT,
+ FONT_EMPHASISMARK_CIRCLE,
+ FONT_EMPHASISMARK_DISC,
+ FONT_EMPHASISMARK_ACCENT
+ };
+
+ enum FontRelief
+ {
+ FONT_RELIEF_NONE,
+ FONT_RELIEF_EMBOSSED,
+ FONT_RELIEF_ENGRAVED
+ };
+
+ class WrongSpellEntry
+ {
+ sal_uInt32 mnStart;
+ sal_uInt32 mnEnd;
+
+ public:
+ WrongSpellEntry(sal_uInt32 nS, sal_uInt32 nE)
+ : mnStart(nS),
+ mnEnd(nE)
+ {}
+
+ // compare operator
+ bool operator==(const WrongSpellEntry& rEntry) const
+ {
+ return (mnStart == rEntry.mnStart && mnEnd == rEntry.mnEnd);
+ }
+
+ sal_uInt32 getStart() const { return mnStart; }
+ sal_uInt32 getEnd() const { return mnEnd; }
+ };
+
+ typedef std::vector< WrongSpellEntry > WrongSpellVector;
+
+ class TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
+ {
+ private:
+ basegfx::BColor maTextlineColor;
+ FontUnderline meFontUnderline;
+ FontStrikeout meFontStrikeout;
+ FontEmphasisMark meFontEmphasisMark;
+ FontRelief meFontRelief;
+ WrongSpellVector maWrongSpellVector;
+
+ // bitfield
+ unsigned mbUnderlineAbove : 1;
+ unsigned mbWordLineMode : 1;
+ unsigned mbEmphasisMarkAbove : 1;
+ unsigned mbEmphasisMarkBelow : 1;
+ unsigned mbShadow : 1;
+ unsigned mbEndOfLine: 1;
+ unsigned mbEndOfParagraph : 1;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ TextDecoratedPortionPrimitive2D(
+
+ // TextSimplePortionPrimitive2D parameters
+ const basegfx::B2DHomMatrix& rNewTransform,
+ const String& rText,
+ const ::std::vector< double >& rDXArray,
+ const FontAttributes& rFontAttributes,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor,
+
+ // local parameters
+ const basegfx::BColor& rTextlineColor,
+ FontUnderline eFontUnderline = FONT_UNDERLINE_NONE,
+ bool bUnderlineAbove = false,
+ FontStrikeout eFontStrikeout = FONT_STRIKEOUT_NONE,
+ bool bWordLineMode = false,
+ FontEmphasisMark eFontEmphasisMark = FONT_EMPHASISMARK_NONE,
+ bool bEmphasisMarkAbove = true,
+ bool bEmphasisMarkBelow = false,
+ FontRelief eFontRelief = FONT_RELIEF_NONE,
+ bool bShadow = false,
+ bool bEndOfLine = false,
+ bool bEndOfParagraph = false,
+ const WrongSpellVector& rWrongSpellVector = WrongSpellVector());
+
+ // get data
+ FontUnderline getFontUnderline() const { return meFontUnderline; }
+ FontStrikeout getFontStrikeout() const { return meFontStrikeout; }
+ FontEmphasisMark getFontEmphasisMark() const { return meFontEmphasisMark; }
+ FontRelief getFontRelief() const { return meFontRelief; }
+ basegfx::BColor getTextlineColor() const { return maTextlineColor; }
+ const WrongSpellVector& getWrongSpellVector() const { return maWrongSpellVector; }
+
+ bool getUnderlineAbove() const { return mbUnderlineAbove; }
+ bool getWordLineMode() const { return mbWordLineMode; }
+ bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
+ bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
+ bool getShadow() const { return mbShadow; }
+ bool getEndOfLine() const { return mbEndOfLine; }
+ bool getEndOfParagraph() const { return mbEndOfParagraph; }
+
+ // 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_TEXTDECORATEDPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx
index bced49e7e032..75669cf53a55 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: textprimitive2d.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: hdu $ $Date: 2007-04-20 08:09:43 $
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:43 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -58,6 +58,10 @@
#include <vector>
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
@@ -109,9 +113,9 @@ namespace drawinglayer
private:
basegfx::B2DHomMatrix maTextTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
String maText; // the text
- // TODO: int mnSubstringStartIndex, mnSubstringEndIndex;
::std::vector< double > maDXArray; // the DX array scale-independent in unit coordinates
FontAttributes maFontAttributes; // the font to use
+ ::com::sun::star::lang::Locale maLocale; // the Locale for the text
basegfx::BColor maFontColor; // font color
protected:
@@ -124,6 +128,7 @@ namespace drawinglayer
const String& rText,
const ::std::vector< double >& rDXArray,
const FontAttributes& rFontAttributes,
+ const ::com::sun::star::lang::Locale& rLocale,
const basegfx::BColor& rFontColor);
// get data
@@ -131,6 +136,7 @@ namespace drawinglayer
const String& getText() const { return maText; }
const ::std::vector< double >& getDXArray() const { return maDXArray; }
const FontAttributes& getFontAttributes() const { return maFontAttributes; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
const basegfx::BColor& getFontColor() const { return maFontColor; }
// helper to have a central conversion to font-size-scaled integer DXArray
@@ -150,119 +156,7 @@ namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
-namespace drawinglayer
-{
- namespace primitive2d
- {
- 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
- };
-
- enum FontStrikeout
- {
- FONT_STRIKEOUT_NONE,
- FONT_STRIKEOUT_SINGLE,
- FONT_STRIKEOUT_DOUBLE,
- FONT_STRIKEOUT_BOLD,
- FONT_STRIKEOUT_SLASH,
- FONT_STRIKEOUT_X
- };
-
- enum FontEmphasisMark
- {
- FONT_EMPHASISMARK_NONE,
- FONT_EMPHASISMARK_DOT,
- FONT_EMPHASISMARK_CIRCLE,
- FONT_EMPHASISMARK_DISC,
- FONT_EMPHASISMARK_ACCENT
- };
-
- enum FontRelief
- {
- FONT_RELIEF_NONE,
- FONT_RELIEF_EMBOSSED,
- FONT_RELIEF_ENGRAVED
- };
-
- class TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
- {
- private:
- basegfx::BColor maTextlineColor;
- FontUnderline meFontUnderline;
- FontStrikeout meFontStrikeout;
- FontEmphasisMark meFontEmphasisMark;
- FontRelief meFontRelief;
-
- // bitfield
- unsigned mbUnderlineAbove : 1;
- unsigned mbWordLineMode : 1;
- unsigned mbEmphasisMarkAbove : 1;
- unsigned mbEmphasisMarkBelow : 1;
- unsigned mbShadow : 1;
-
- protected:
- // local decomposition.
- virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
-
- public:
- TextDecoratedPortionPrimitive2D(
- const basegfx::B2DHomMatrix& rNewTransform,
- const String& rText,
- const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes,
- const basegfx::BColor& rFontColor,
- const basegfx::BColor& rTextlineColor,
- FontUnderline eFontUnderline = FONT_UNDERLINE_NONE,
- bool bUnderlineAbove = false,
- FontStrikeout eFontStrikeout = FONT_STRIKEOUT_NONE,
- bool bWordLineMode = false,
- FontEmphasisMark eFontEmphasisMark = FONT_EMPHASISMARK_NONE,
- bool bEmphasisMarkAbove = true,
- bool bEmphasisMarkBelow = false,
- FontRelief eFontRelief = FONT_RELIEF_NONE,
- bool bShadow = false);
-
- // get data
- FontUnderline getFontUnderline() const { return meFontUnderline; }
- FontStrikeout getFontStrikeout() const { return meFontStrikeout; }
- FontEmphasisMark getFontEmphasisMark() const { return meFontEmphasisMark; }
- FontRelief getFontRelief() const { return meFontRelief; }
- basegfx::BColor getTextlineColor() const { return maTextlineColor; }
- bool getUnderlineAbove() const { return mbUnderlineAbove; }
- bool getWordLineMode() const { return mbWordLineMode; }
- bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
- bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
- bool getShadow() const { return mbShadow; }
-
- // 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_TEXTPRIMITIVE2D_HXX
//////////////////////////////////////////////////////////////////////////////
-
-#endif //_DRAWINGLAYER_PRIMITIVE_TEXTPRIMITIVE_HXX
-
// eof
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
index bc66696beee1..757ccd3517c9 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclmetafileprocessor2d.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2007-07-27 09:03:17 $
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:44 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -40,6 +40,10 @@
#include <drawinglayer/processor2d/vclprocessor2d.hxx>
#endif
+#ifndef _COM_SUN_STAR_I18N_XBREAKITERATOR_HPP_
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#endif
+
//////////////////////////////////////////////////////////////////////////////
// predefines
class GDIMetaFile;
@@ -82,21 +86,27 @@ namespace drawinglayer
void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
// the current clipping PolyPolygon from MaskPrimitive2D
- basegfx::B2DPolyPolygon maClipPolyPolygon;
+ basegfx::B2DPolyPolygon maClipPolyPolygon;
// the target MetaFile
- GDIMetaFile& mrMetaFile;
+ GDIMetaFile& mrMetaFile;
// do not allow embedding SvtGraphicFills into each other,
// use a counter to prevent that
- sal_uInt32 mnSvtGraphicFillCount;
+ sal_uInt32 mnSvtGraphicFillCount;
// same for SvtGraphicStroke
- sal_uInt32 mnSvtGraphicStrokeCount;
+ sal_uInt32 mnSvtGraphicStrokeCount;
// hold the last unified transparence value to have ot handy
// on SvtGraphicStroke creation
- double mfCurrentUnifiedTransparence;
+ double mfCurrentUnifiedTransparence;
+
+ // break iterator support
+ // made static so it only needs to be fetched once, even with many single
+ // constructed VclMetafileProcessor2D. It's still incarnated on demand,
+ // but exists for OOo runtime now by purpose.
+ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator;
protected:
// the local processor for BasePrinitive2D-Implementation based primitives,
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index cb8ca00777dd..3805b28b7e5b 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -35,6 +35,8 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\shadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\shadowprimitive2d.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
+..\inc\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\textfieldprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textfieldprimitive2d.hxx
..\inc\drawinglayer\primitive2d\transformprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transformprimitive2d.hxx
..\inc\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index a898eeba1d09..3d3173bcef98 100644
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -4,9 +4,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: aw $ $Date: 2007-07-27 09:03:33 $
+# last change: $Author: aw $ $Date: 2007-08-02 11:43:44 $
#
# The Contents of this file are made available subject to
# the terms of GNU Lesser General Public License Version 2.1.
@@ -72,6 +72,8 @@ SLOFILES= \
$(SLO)$/shadowprimitive2d.obj \
$(SLO)$/textlayoutdevice.obj \
$(SLO)$/textprimitive2d.obj \
+ $(SLO)$/textdecoratedprimitive2d.obj \
+ $(SLO)$/textfieldprimitive2d.obj \
$(SLO)$/transformprimitive2d.obj \
$(SLO)$/unifiedalphaprimitive2d.obj
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
new file mode 100644
index 000000000000..3a21465c9e4f
--- /dev/null
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -0,0 +1,431 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textdecoratedprimitive2d.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:44 $
+ *
+ * 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_PRIMITIVE_TEXTDECORATEDPRIMITIVE2D_HXX
+#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
+#endif
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#endif
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#endif
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#endif
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#endif
+
+#include <numeric>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence TextDecoratedPortionPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ std::vector< BasePrimitive2D* > aNewPrimitives;
+
+ // First create a simple text primitive and ignore other attributes
+ aNewPrimitives.push_back(new TextSimplePortionPrimitive2D(getTextTransform(), getText(), getDXArray(), getFontAttributes(), getLocale(), getFontColor()));
+
+ // more to be done?
+ const bool bNeedFontUnderline(getFontUnderline() != FONT_UNDERLINE_NONE);
+ const bool bNeedFontStrikeout(getFontStrikeout() != FONT_STRIKEOUT_NONE);
+ const bool bNeedEmphasisMarkAbove(getEmphasisMarkAbove() != FONT_EMPHASISMARK_NONE);
+ const bool bNeedEmphasisMarkBelow(getEmphasisMarkBelow() != FONT_EMPHASISMARK_NONE);
+
+ if(bNeedFontUnderline || bNeedFontStrikeout || bNeedEmphasisMarkAbove || bNeedEmphasisMarkBelow)
+ {
+ // prepare transformation
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+ basegfx::B2DHomMatrix aUnscaledTransform;
+ aUnscaledTransform.rotate( fRotate );
+ aUnscaledTransform.shearX( fShearX );
+ aUnscaledTransform.translate( aTranslate.getX(), aTranslate.getY() );
+
+ basegfx::B2DHomMatrix aUnrotatedTransform = getTextTransform();
+ aUnrotatedTransform.rotate( -fRotate );
+
+ // get metrics for text decorations like underline/strikeout/emphasis marks
+ TextLayouterDevice aTextLayouter;
+ aTextLayouter.setFontAttributes(getFontAttributes(), aUnrotatedTransform );
+
+// const double fLineHeight = aTextLayouter.getTextHeight();
+ double fUnderlineOffset = aTextLayouter.getUnderlineOffset();
+ double fUnderlineHeight = aTextLayouter.getUnderlineHeight();
+ basegfx::tools::B2DLineJoin eLineJoin = basegfx::tools::B2DLINEJOIN_NONE;
+ bool bDoubleLine = false;
+ bool bWaveLine = false;
+
+ double fTextWidth = 0.0;
+ if( getDXArray().empty() )
+ fTextWidth = aTextLayouter.getTextWidth( getText(), 0/*TODO*/, getText().Len()/*TODO*/ );
+ else
+ fTextWidth = getDXArray().back() * aScale.getX();
+
+ // prepare line styles for text decoration lines
+ const int* pDashDotArray = NULL;
+ static const int aDottedArray[] = { 1, 1, 0}; // DOTTED LINE
+ static const int aDashDotArray[] = { 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
+
+ // set Underline attribute
+ switch( getFontUnderline() )
+ {
+ default:
+ DBG_WARNING1( "DrawingLayer: Unknown underline attribute (%d)!", getFontUnderline() );
+ // fall through
+ case primitive2d::FONT_UNDERLINE_NONE:
+ fUnderlineHeight = 0;
+ break;
+ case primitive2d::FONT_UNDERLINE_BOLD:
+ fUnderlineHeight *= 2;
+ // fall through
+ case primitive2d::FONT_UNDERLINE_SINGLE:
+ break;
+ case primitive2d::FONT_UNDERLINE_DOUBLE:
+ bDoubleLine = true;
+ break;
+ case primitive2d::FONT_UNDERLINE_BOLDDOTTED:
+ fUnderlineHeight *= 2;
+ // fall through
+ case primitive2d::FONT_UNDERLINE_DOTTED:
+ eLineJoin = basegfx::tools::B2DLINEJOIN_ROUND;
+ pDashDotArray = aDottedArray;
+ break;
+ case primitive2d::FONT_UNDERLINE_BOLDDASH:
+ fUnderlineHeight *= 2;
+ // fall through
+ case primitive2d::FONT_UNDERLINE_DASH:
+ pDashDotArray = aDashedArray;
+ break;
+ case primitive2d::FONT_UNDERLINE_BOLDLONGDASH:
+ fUnderlineHeight *= 2;
+ // fall through
+ case primitive2d::FONT_UNDERLINE_LONGDASH:
+ pDashDotArray = aLongDashArray;
+ break;
+ case primitive2d::FONT_UNDERLINE_BOLDDASHDOT:
+ fUnderlineHeight *= 2;
+ // fall through
+ case primitive2d::FONT_UNDERLINE_DASHDOT:
+ pDashDotArray = aDashDotArray;
+ break;
+ case primitive2d::FONT_UNDERLINE_BOLDDASHDOTDOT:
+ fUnderlineHeight *= 2;
+ // fall through
+ case primitive2d::FONT_UNDERLINE_DASHDOTDOT:
+ eLineJoin = basegfx::tools::B2DLINEJOIN_ROUND;
+ pDashDotArray = aDashDotDotArray;
+ break;
+ case primitive2d::FONT_UNDERLINE_SMALLWAVE:
+ // TODO
+ bWaveLine = true;
+ break;
+ case primitive2d::FONT_UNDERLINE_BOLDWAVE:
+ fUnderlineHeight *= 2;
+ // fall through
+ case primitive2d::FONT_UNDERLINE_WAVE:
+ // TODO
+ bWaveLine = true;
+ break;
+ case primitive2d::FONT_UNDERLINE_DOUBLEWAVE:
+ bWaveLine = true;
+ bDoubleLine = true;
+ break;
+ }
+
+ if( fUnderlineHeight > 0 )
+ {
+ if( bDoubleLine )
+ {
+ fUnderlineOffset -= 0.50 * fUnderlineHeight;
+ fUnderlineHeight *= 0.64;
+ }
+
+ basegfx::B2DPolygon aUnderline;
+ ::basegfx::B2DPoint aPoint( 0.0, fUnderlineOffset );
+ aUnderline.append( aPoint );
+ if( !bWaveLine )
+ {
+ // straight underline
+ aUnderline.append( aPoint + ::basegfx::B2DPoint( fTextWidth, 0.0 ) );
+ }
+ else
+ {
+ // wavy underline
+ basegfx::B2DPolygon& aWavePoly = aUnderline;
+ double fWaveWidth = 4 * fUnderlineHeight;
+ if( getFontUnderline() == primitive2d::FONT_UNDERLINE_SMALLWAVE )
+ fWaveWidth *= 0.7;
+ const double fWaveHeight = 0.5 * fWaveWidth;
+ const ::basegfx::B2DPoint aCtrlOffset( fWaveWidth * 0.467308, fWaveHeight );
+ for( double fPos = fWaveWidth; fPos < fTextWidth; fPos += fWaveWidth ) {
+ // create a symmetrical wave using one cubic bezier curve
+ // with y==0 for {x==0, x==0.5*fW or x==1.0*fW}
+ // and ymin/ymax at {x=0.25*fW or 0.75*fW}
+ const int n = aWavePoly.count();
+ aWavePoly.setControlPointA( n-1, aPoint + aCtrlOffset );
+ aWavePoly.append( aPoint += ::basegfx::B2DPoint( fWaveWidth, 0.0 ) );
+ aWavePoly.setControlPointB( n-1, aPoint - aCtrlOffset );
+ }
+ // adjust stroke style
+ eLineJoin = basegfx::tools::B2DLINEJOIN_ROUND;
+ fUnderlineHeight *= 0.5;
+ }
+
+ const basegfx::BColor& rLineColor = getTextlineColor();
+ attribute::StrokeAttribute aStrokeAttr( rLineColor, fUnderlineHeight, eLineJoin );
+ if( pDashDotArray != NULL )
+ {
+ ::std::vector< double > aDoubleArray;
+ for( const int* p = pDashDotArray; *p; ++p )
+ aDoubleArray.push_back( *p * fUnderlineHeight);
+ const double fFullDashDotLen = ::std::accumulate(aDoubleArray.begin(), aDoubleArray.end(), 0.0);
+ aStrokeAttr = attribute::StrokeAttribute( rLineColor,
+ fUnderlineHeight, eLineJoin, aDoubleArray, fFullDashDotLen );
+ }
+ aUnderline.transform( aUnscaledTransform );
+ aNewPrimitives.push_back(new PolygonStrokePrimitive2D( aUnderline, aStrokeAttr ));
+
+ if( bDoubleLine )
+ {
+ // add another underline below the first underline
+ const double fLineDist = (bWaveLine ? 3 : 2) * fUnderlineHeight;
+ ::basegfx::B2DVector aOffsetVector( 0.0, fLineDist );
+ aOffsetVector = aUnscaledTransform * aOffsetVector;
+ basegfx::B2DHomMatrix aOffsetTransform;
+ aOffsetTransform.translate( aOffsetVector.getX(), aOffsetVector.getY() );
+ aUnderline.transform( aOffsetTransform );
+ aNewPrimitives.push_back(new PolygonStrokePrimitive2D( aUnderline, aStrokeAttr ));
+ }
+ }
+
+ double fStrikeoutHeight = aTextLayouter.getUnderlineHeight();
+ double fStrikeoutOffset = aTextLayouter.getStrikeoutOffset();
+ eLineJoin = basegfx::tools::B2DLINEJOIN_NONE;
+ bDoubleLine = false;
+ sal_Unicode aStrikeoutChar = '\0';
+
+ // set Underline attribute
+ switch( getFontStrikeout() )
+ {
+ default:
+ DBG_WARNING1( "DrawingLayer: Unknown underline attribute (%d)!", getFontUnderline() );
+ // fall through
+ case primitive2d::FONT_STRIKEOUT_NONE:
+ fStrikeoutHeight = 0;
+ break;
+ case primitive2d::FONT_STRIKEOUT_SINGLE:
+ break;
+ case primitive2d::FONT_STRIKEOUT_DOUBLE:
+ bDoubleLine = true;
+ break;
+ case primitive2d::FONT_STRIKEOUT_BOLD:
+ fStrikeoutHeight *= 2;
+ break;
+ case primitive2d::FONT_STRIKEOUT_SLASH:
+ aStrikeoutChar = '/';
+ fStrikeoutHeight = 0;
+ break;
+ case primitive2d::FONT_STRIKEOUT_X:
+ aStrikeoutChar = 'X';
+ fStrikeoutHeight = 0;
+ break;
+ };
+
+ if( fStrikeoutHeight > 0 )
+ {
+ if( bDoubleLine )
+ {
+ fStrikeoutOffset -= 0.50 * fStrikeoutHeight;
+ fStrikeoutHeight *= 0.64;
+ }
+
+ basegfx::B2DPolygon aStrikeoutLine;
+ basegfx::B2DPoint aPoint( 0.0, -fStrikeoutOffset );
+ aStrikeoutLine.append( aPoint );
+ if( 1/*####*/ )
+ {
+ // straight underline
+ aStrikeoutLine.append( aPoint + ::basegfx::B2DPoint( fTextWidth, 0.0 ) );
+ }
+
+ const basegfx::BColor& rStrikeoutColor = getTextlineColor();
+ attribute::StrokeAttribute aStrokeAttr( rStrikeoutColor, fStrikeoutHeight, eLineJoin );
+ aStrikeoutLine.transform( aUnscaledTransform );
+ aNewPrimitives.push_back(new PolygonStrokePrimitive2D( aStrikeoutLine, aStrokeAttr ));
+
+ if( bDoubleLine )
+ {
+ // add another strikeout below the first strikeout
+ const double fLineDist = 2 * fStrikeoutHeight;
+ ::basegfx::B2DVector aOffsetVector( 0.0, -fLineDist );
+ aOffsetVector = aUnscaledTransform * aOffsetVector;
+ basegfx::B2DHomMatrix aOffsetTransform;
+ aOffsetTransform.translate( aOffsetVector.getX(), aOffsetVector.getY() );
+ aStrikeoutLine.transform( aOffsetTransform );
+ aNewPrimitives.push_back(new PolygonStrokePrimitive2D( aStrikeoutLine, aStrokeAttr ));
+ }
+ }
+
+ if( aStrikeoutChar != '\0' )
+ {
+ String aString( &aStrikeoutChar, 1 );
+ double fStrikeCharWidth = aTextLayouter.getTextWidth( aString, 0, 1 );
+ double fStrikeCharCount = fTextWidth / fStrikeCharWidth;
+ int nStrikeCharCount = static_cast<int>(fStrikeCharCount + 0.9);
+ for( int i = 1; i < nStrikeCharCount; ++i )
+ aString += aStrikeoutChar;
+ std::vector<double> aDXArray( nStrikeCharCount );
+ fStrikeCharWidth /= aScale.getX();
+ for( int i = 0; i < nStrikeCharCount; ++i )
+ aDXArray[i] = (i+1) * fStrikeCharWidth;
+ const basegfx::BColor& rStrikeoutColor = getFontColor();
+ aNewPrimitives.push_back(new TextSimplePortionPrimitive2D(getTextTransform(), aString, aDXArray, getFontAttributes(), getLocale(), rStrikeoutColor ));
+ }
+
+ // TODO: need to take care of
+ // -emphasis mark
+ // -relief (embosses/engraved)
+ // -shadow
+ // if( getWordLineMode() )
+ // if( getUnderlineAbove() )
+ }
+
+ if(maWrongSpellVector.size())
+ {
+ // TODO: take care of WrongSpellVector; create redlining (red wavelines) accordingly
+
+
+
+ }
+
+ // prepare return sequence
+ Primitive2DSequence aRetval(aNewPrimitives.size());
+
+ for(sal_uInt32 a(0); a < aNewPrimitives.size(); a++)
+ {
+ aRetval[a] = Primitive2DReference(aNewPrimitives[a]);
+ }
+
+ return aRetval;
+ }
+
+ TextDecoratedPortionPrimitive2D::TextDecoratedPortionPrimitive2D(
+
+ // TextSimplePortionPrimitive2D parameters
+ const basegfx::B2DHomMatrix& rNewTransform,
+ const String& rText,
+ const ::std::vector< double >& rDXArray,
+ const FontAttributes& rFontAttributes,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor,
+
+ // local parameters
+ const basegfx::BColor& rTextlineColor,
+ FontUnderline eFontUnderline,
+ bool bUnderlineAbove,
+ FontStrikeout eFontStrikeout,
+ bool bWordLineMode,
+ FontEmphasisMark eFontEmphasisMark,
+ bool bEmphasisMarkAbove,
+ bool bEmphasisMarkBelow,
+ FontRelief eFontRelief,
+ bool bShadow,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const WrongSpellVector& rWrongSpellVector)
+ : TextSimplePortionPrimitive2D(rNewTransform, rText, rDXArray, rFontAttributes, rLocale, rFontColor),
+ maTextlineColor(rTextlineColor),
+ meFontUnderline(eFontUnderline),
+ meFontStrikeout(eFontStrikeout),
+ meFontEmphasisMark(eFontEmphasisMark),
+ meFontRelief(eFontRelief),
+ maWrongSpellVector(rWrongSpellVector),
+ mbUnderlineAbove(bUnderlineAbove),
+ mbWordLineMode(bWordLineMode),
+ mbEmphasisMarkAbove(bEmphasisMarkAbove),
+ mbEmphasisMarkBelow(bEmphasisMarkBelow),
+ mbShadow(bShadow),
+ mbEndOfLine(bEndOfLine),
+ mbEndOfParagraph(bEndOfParagraph)
+ {
+ }
+
+ bool TextDecoratedPortionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(TextSimplePortionPrimitive2D::operator==(rPrimitive))
+ {
+ const TextDecoratedPortionPrimitive2D& rCompare = (TextDecoratedPortionPrimitive2D&)rPrimitive;
+
+ return (getTextlineColor() == rCompare.getTextlineColor()
+ && getFontUnderline() == rCompare.getFontUnderline()
+ && getFontStrikeout() == rCompare.getFontStrikeout()
+ && getFontEmphasisMark() == rCompare.getFontEmphasisMark()
+ && getFontRelief() == rCompare.getFontRelief()
+ && getWrongSpellVector() == rCompare.getWrongSpellVector()
+ && getUnderlineAbove() == rCompare.getUnderlineAbove()
+ && getWordLineMode() == rCompare.getWordLineMode()
+ && getEmphasisMarkAbove() == rCompare.getEmphasisMarkAbove()
+ && getEmphasisMarkBelow() == rCompare.getEmphasisMarkBelow()
+ && getShadow() == rCompare.getShadow()
+ && getEndOfLine() == rCompare.getEndOfLine()
+ && getEndOfParagraph() == rCompare.getEndOfParagraph());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(TextDecoratedPortionPrimitive2D, PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index e93b47289414..520439e54ada 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: textprimitive2d.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: hdu $ $Date: 2007-04-20 08:09:44 $
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:44 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -41,52 +41,18 @@
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#endif
-#ifndef _SV_VIRDEV_HXX
-#include <vcl/virdev.hxx>
-#endif
-
-#ifndef _BGFX_COLOR_BCOLOR_HXX
-#include <basegfx/color/bcolor.hxx>
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
+#include <basegfx/polygon/b2dpolypolygon.hxx>
#endif
#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#endif
-#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
-#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-#endif
-
-#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
-#include <drawinglayer/attribute/strokeattribute.hxx>
-#endif
-
-#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#endif
-
-#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
-#include <basegfx/polygon/b2dpolygon.hxx>
-#endif
-
-#ifndef _BGFX_POLYGON_B2DLINEGEOMETRY_HXX
-#include <basegfx/polygon/b2dlinegeometry.hxx>
-#endif
-
-#ifndef _BGFX_NUMERIC_FTOOLS_HXX
-#include <basegfx/numeric/ftools.hxx>
-#endif
-
-#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
-#include <basegfx/tools/canvastools.hxx>
-#endif
-
#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#endif
-#include <numeric>
-
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
@@ -196,37 +162,36 @@ namespace drawinglayer
const sal_uInt32 nCount = aB2DPolyPolyVector.size();
Primitive2DSequence aRetval( nCount );
- if( !nCount )
+ if(nCount)
{
- // for invisible glyphs
- return aRetval;
- }
- else if( !getFontAttributes().mbOutline )
- {
- // for the glyph shapes as color-filled polypolygons
- for(sal_uInt32 a(0L); a < nCount; a++)
+ if( !getFontAttributes().mbOutline )
{
- // prepare polypolygon
- basegfx::B2DPolyPolygon& rPolyPolygon = aB2DPolyPolyVector[a];
- rPolyPolygon.transform(aUnscaledTransform);
- aRetval[a] = new PolyPolygonColorPrimitive2D(rPolyPolygon, getFontColor());
+ // for the glyph shapes as color-filled polypolygons
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ // prepare polypolygon
+ basegfx::B2DPolyPolygon& rPolyPolygon = aB2DPolyPolyVector[a];
+ rPolyPolygon.transform(aUnscaledTransform);
+ aRetval[a] = new PolyPolygonColorPrimitive2D(rPolyPolygon, getFontColor());
+ }
}
- }
- else
- {
- // for the glyph shapes as outline-only polypolygons
- double fStrokeWidth = 1.0 + aScale.getY() * 0.02;
- if( getFontAttributes().mnWeight > WEIGHT_SEMIBOLD )
- fStrokeWidth *= 1.4;
- else if( getFontAttributes().mnWeight < WEIGHT_SEMILIGHT )
- fStrokeWidth *= 0.7;
- const drawinglayer::attribute::StrokeAttribute aStrokeAttr( getFontColor(),
- fStrokeWidth, basegfx::tools::B2DLINEJOIN_NONE );
- for(sal_uInt32 a(0L); a < nCount; a++)
+ else
{
- basegfx::B2DPolyPolygon& rPolyPolygon = aB2DPolyPolyVector[a];
- rPolyPolygon.transform(aUnscaledTransform);
- aRetval[a] = new PolyPolygonStrokePrimitive2D(rPolyPolygon, aStrokeAttr);
+ // for the glyph shapes as outline-only polypolygons
+ double fStrokeWidth = 1.0 + aScale.getY() * 0.02;
+ if( getFontAttributes().mnWeight > WEIGHT_SEMIBOLD )
+ fStrokeWidth *= 1.4;
+ else if( getFontAttributes().mnWeight < WEIGHT_SEMILIGHT )
+ fStrokeWidth *= 0.7;
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttr( getFontColor(),
+ fStrokeWidth, basegfx::tools::B2DLINEJOIN_NONE );
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ basegfx::B2DPolyPolygon& rPolyPolygon = aB2DPolyPolyVector[a];
+ rPolyPolygon.transform(aUnscaledTransform);
+ aRetval[a] = new PolyPolygonStrokePrimitive2D(rPolyPolygon, aStrokeAttr);
+ }
}
}
@@ -238,12 +203,14 @@ namespace drawinglayer
const String& rText,
const ::std::vector< double >& rDXArray,
const FontAttributes& rFontAttributes,
+ const ::com::sun::star::lang::Locale& rLocale,
const basegfx::BColor& rFontColor)
: BasePrimitive2D(),
maTextTransform(rNewTransform),
maText(rText),
maDXArray(rDXArray),
maFontAttributes(rFontAttributes),
+ maLocale(rLocale),
maFontColor(rFontColor)
{
}
@@ -265,6 +232,13 @@ namespace drawinglayer
}
}
+ bool impLocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB)
+ {
+ return (rA.Language == rB.Language
+ && rA.Country == rB.Country
+ && rA.Variant == rB.Variant);
+ }
+
bool TextSimplePortionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
if(BasePrimitive2D::operator==(rPrimitive))
@@ -275,6 +249,7 @@ namespace drawinglayer
&& getText() == rCompare.getText()
&& getDXArray() == rCompare.getDXArray()
&& getFontAttributes() == rCompare.getFontAttributes()
+ && impLocalesAreEqual(getLocale(), rCompare.getLocale())
&& getFontColor() == rCompare.getFontColor());
}
@@ -316,343 +291,4 @@ namespace drawinglayer
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace primitive2d
- {
- Primitive2DSequence TextDecoratedPortionPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- Primitive2DSequence aRetval(6);
-
- // First create a simple text primitive and ignore other attributes
- aRetval[0] = new TextSimplePortionPrimitive2D(getTextTransform(), getText(), getDXArray(), getFontAttributes(), getFontColor());
-
- if( getFontUnderline() == FONT_UNDERLINE_NONE
- && getFontStrikeout() == FONT_STRIKEOUT_NONE
- && getEmphasisMarkAbove() == FONT_EMPHASISMARK_NONE
- && getEmphasisMarkBelow() == FONT_EMPHASISMARK_NONE )
- return aRetval;
-
- // prepare transformation
- basegfx::B2DVector aScale, aTranslate;
- double fRotate, fShearX;
- getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX);
- basegfx::B2DHomMatrix aUnscaledTransform;
- aUnscaledTransform.rotate( fRotate );
- aUnscaledTransform.shearX( fShearX );
- aUnscaledTransform.translate( aTranslate.getX(), aTranslate.getY() );
-
- basegfx::B2DHomMatrix aUnrotatedTransform = getTextTransform();
- aUnrotatedTransform.rotate( -fRotate );
-
- // get metrics for text decorations like underline/strikeout/emphasis marks
- TextLayouterDevice aTextLayouter;
- aTextLayouter.setFontAttributes(getFontAttributes(), aUnrotatedTransform );
-
-// const double fLineHeight = aTextLayouter.getTextHeight();
- double fUnderlineOffset = aTextLayouter.getUnderlineOffset();
- double fUnderlineHeight = aTextLayouter.getUnderlineHeight();
- basegfx::tools::B2DLineJoin eLineJoin = basegfx::tools::B2DLINEJOIN_NONE;
- bool bDoubleLine = false;
- bool bWaveLine = false;
-
- double fTextWidth = 0.0;
- if( getDXArray().empty() )
- fTextWidth = aTextLayouter.getTextWidth( getText(), 0/*TODO*/, getText().Len()/*TODO*/ );
- else
- fTextWidth = getDXArray().back() * aScale.getX();
-
- // prepare line styles for text decoration lines
- const int* pDashDotArray = NULL;
- static const int aDottedArray[] = { 1, 1, 0}; // DOTTED LINE
- static const int aDashDotArray[] = { 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
-
- // set Underline attribute
- switch( getFontUnderline() )
- {
- default:
- DBG_WARNING1( "DrawingLayer: Unknown underline attribute (%d)!", getFontUnderline() );
- // fall through
- case primitive2d::FONT_UNDERLINE_NONE:
- fUnderlineHeight = 0;
- break;
- case primitive2d::FONT_UNDERLINE_BOLD:
- fUnderlineHeight *= 2;
- // fall through
- case primitive2d::FONT_UNDERLINE_SINGLE:
- break;
- case primitive2d::FONT_UNDERLINE_DOUBLE:
- bDoubleLine = true;
- break;
- case primitive2d::FONT_UNDERLINE_BOLDDOTTED:
- fUnderlineHeight *= 2;
- // fall through
- case primitive2d::FONT_UNDERLINE_DOTTED:
- eLineJoin = basegfx::tools::B2DLINEJOIN_ROUND;
- pDashDotArray = aDottedArray;
- break;
- case primitive2d::FONT_UNDERLINE_BOLDDASH:
- fUnderlineHeight *= 2;
- // fall through
- case primitive2d::FONT_UNDERLINE_DASH:
- pDashDotArray = aDashedArray;
- break;
- case primitive2d::FONT_UNDERLINE_BOLDLONGDASH:
- fUnderlineHeight *= 2;
- // fall through
- case primitive2d::FONT_UNDERLINE_LONGDASH:
- pDashDotArray = aLongDashArray;
- break;
- case primitive2d::FONT_UNDERLINE_BOLDDASHDOT:
- fUnderlineHeight *= 2;
- // fall through
- case primitive2d::FONT_UNDERLINE_DASHDOT:
- pDashDotArray = aDashDotArray;
- break;
- case primitive2d::FONT_UNDERLINE_BOLDDASHDOTDOT:
- fUnderlineHeight *= 2;
- // fall through
- case primitive2d::FONT_UNDERLINE_DASHDOTDOT:
- eLineJoin = basegfx::tools::B2DLINEJOIN_ROUND;
- pDashDotArray = aDashDotDotArray;
- break;
- case primitive2d::FONT_UNDERLINE_SMALLWAVE:
- // TODO
- bWaveLine = true;
- break;
- case primitive2d::FONT_UNDERLINE_BOLDWAVE:
- fUnderlineHeight *= 2;
- // fall through
- case primitive2d::FONT_UNDERLINE_WAVE:
- // TODO
- bWaveLine = true;
- break;
- case primitive2d::FONT_UNDERLINE_DOUBLEWAVE:
- bWaveLine = true;
- bDoubleLine = true;
- break;
- }
-
- if( fUnderlineHeight > 0 )
- {
- if( bDoubleLine )
- {
- fUnderlineOffset -= 0.50 * fUnderlineHeight;
- fUnderlineHeight *= 0.64;
- }
-
- basegfx::B2DPolygon aUnderline;
- ::basegfx::B2DPoint aPoint( 0.0, fUnderlineOffset );
- aUnderline.append( aPoint );
- if( !bWaveLine )
- {
- // straight underline
- aUnderline.append( aPoint + ::basegfx::B2DPoint( fTextWidth, 0.0 ) );
- }
- else
- {
- // wavy underline
- basegfx::B2DPolygon& aWavePoly = aUnderline;
- double fWaveWidth = 4 * fUnderlineHeight;
- if( getFontUnderline() == primitive2d::FONT_UNDERLINE_SMALLWAVE )
- fWaveWidth *= 0.7;
- const double fWaveHeight = 0.5 * fWaveWidth;
- const ::basegfx::B2DPoint aCtrlOffset( fWaveWidth * 0.467308, fWaveHeight );
- for( double fPos = fWaveWidth; fPos < fTextWidth; fPos += fWaveWidth ) {
- // create a symmetrical wave using one cubic bezier curve
- // with y==0 for {x==0, x==0.5*fW or x==1.0*fW}
- // and ymin/ymax at {x=0.25*fW or 0.75*fW}
- const int n = aWavePoly.count();
- aWavePoly.setControlPointA( n-1, aPoint + aCtrlOffset );
- aWavePoly.append( aPoint += ::basegfx::B2DPoint( fWaveWidth, 0.0 ) );
- aWavePoly.setControlPointB( n-1, aPoint - aCtrlOffset );
- }
- // adjust stroke style
- eLineJoin = basegfx::tools::B2DLINEJOIN_ROUND;
- fUnderlineHeight *= 0.5;
- }
-
- const basegfx::BColor& rLineColor = getTextlineColor();
- attribute::StrokeAttribute aStrokeAttr( rLineColor, fUnderlineHeight, eLineJoin );
- if( pDashDotArray != NULL )
- {
- ::std::vector< double > aDoubleArray;
- for( const int* p = pDashDotArray; *p; ++p )
- aDoubleArray.push_back( *p * fUnderlineHeight);
- const double fFullDashDotLen = ::std::accumulate(aDoubleArray.begin(), aDoubleArray.end(), 0.0);
- aStrokeAttr = attribute::StrokeAttribute( rLineColor,
- fUnderlineHeight, eLineJoin, aDoubleArray, fFullDashDotLen );
- }
- aUnderline.transform( aUnscaledTransform );
- aRetval[1] = new PolygonStrokePrimitive2D( aUnderline, aStrokeAttr );
-
- if( bDoubleLine )
- {
- // add another underline below the first underline
- const double fLineDist = (bWaveLine ? 3 : 2) * fUnderlineHeight;
- ::basegfx::B2DVector aOffsetVector( 0.0, fLineDist );
- aOffsetVector = aUnscaledTransform * aOffsetVector;
- basegfx::B2DHomMatrix aOffsetTransform;
- aOffsetTransform.translate( aOffsetVector.getX(), aOffsetVector.getY() );
- aUnderline.transform( aOffsetTransform );
- aRetval[2] = new PolygonStrokePrimitive2D( aUnderline, aStrokeAttr );
- }
- }
-
- double fStrikeoutHeight = aTextLayouter.getUnderlineHeight();
- double fStrikeoutOffset = aTextLayouter.getStrikeoutOffset();
- eLineJoin = basegfx::tools::B2DLINEJOIN_NONE;
- bDoubleLine = false;
- sal_Unicode aStrikeoutChar = '\0';
-
- // set Underline attribute
- switch( getFontStrikeout() )
- {
- default:
- DBG_WARNING1( "DrawingLayer: Unknown underline attribute (%d)!", getFontUnderline() );
- // fall through
- case primitive2d::FONT_STRIKEOUT_NONE:
- fStrikeoutHeight = 0;
- break;
- case primitive2d::FONT_STRIKEOUT_SINGLE:
- break;
- case primitive2d::FONT_STRIKEOUT_DOUBLE:
- bDoubleLine = true;
- break;
- case primitive2d::FONT_STRIKEOUT_BOLD:
- fStrikeoutHeight *= 2;
- break;
- case primitive2d::FONT_STRIKEOUT_SLASH:
- aStrikeoutChar = '/';
- fStrikeoutHeight = 0;
- break;
- case primitive2d::FONT_STRIKEOUT_X:
- aStrikeoutChar = 'X';
- fStrikeoutHeight = 0;
- break;
- };
-
- if( fStrikeoutHeight > 0 )
- {
- if( bDoubleLine )
- {
- fStrikeoutOffset -= 0.50 * fStrikeoutHeight;
- fStrikeoutHeight *= 0.64;
- }
-
- basegfx::B2DPolygon aStrikeoutLine;
- basegfx::B2DPoint aPoint( 0.0, -fStrikeoutOffset );
- aStrikeoutLine.append( aPoint );
- if( 1/*####*/ )
- {
- // straight underline
- aStrikeoutLine.append( aPoint + ::basegfx::B2DPoint( fTextWidth, 0.0 ) );
- }
-
- const basegfx::BColor& rStrikeoutColor = getTextlineColor();
- attribute::StrokeAttribute aStrokeAttr( rStrikeoutColor, fStrikeoutHeight, eLineJoin );
- aStrikeoutLine.transform( aUnscaledTransform );
- aRetval[3] = new PolygonStrokePrimitive2D( aStrikeoutLine, aStrokeAttr );
-
- if( bDoubleLine )
- {
- // add another strikeout below the first strikeout
- const double fLineDist = 2 * fStrikeoutHeight;
- ::basegfx::B2DVector aOffsetVector( 0.0, -fLineDist );
- aOffsetVector = aUnscaledTransform * aOffsetVector;
- basegfx::B2DHomMatrix aOffsetTransform;
- aOffsetTransform.translate( aOffsetVector.getX(), aOffsetVector.getY() );
- aStrikeoutLine.transform( aOffsetTransform );
- aRetval[4] = new PolygonStrokePrimitive2D( aStrikeoutLine, aStrokeAttr );
- }
- }
-
- if( aStrikeoutChar != '\0' )
- {
- String aString( &aStrikeoutChar, 1 );
- double fStrikeCharWidth = aTextLayouter.getTextWidth( aString, 0, 1 );
- double fStrikeCharCount = fTextWidth / fStrikeCharWidth;
- int nStrikeCharCount = static_cast<int>(fStrikeCharCount + 0.9);
- for( int i = 1; i < nStrikeCharCount; ++i )
- aString += aStrikeoutChar;
- std::vector<double> aDXArray( nStrikeCharCount );
- fStrikeCharWidth /= aScale.getX();
- for( int i = 0; i < nStrikeCharCount; ++i )
- aDXArray[i] = (i+1) * fStrikeCharWidth;
- const basegfx::BColor& rStrikeoutColor = getFontColor();
- aRetval[5] = new TextSimplePortionPrimitive2D(getTextTransform(), aString, aDXArray, getFontAttributes(), rStrikeoutColor );
- }
-
- // TODO: need to take care of
- // -emphasis mark
- // -relief (embosses/engraved)
- // -shadow
- // if( getWordLineMode() )
- // if( getUnderlineAbove() )
-
- return aRetval;
- }
-
- TextDecoratedPortionPrimitive2D::TextDecoratedPortionPrimitive2D(
- const basegfx::B2DHomMatrix& rNewTransform,
- const String& rText,
- const ::std::vector< double >& rDXArray,
- const FontAttributes& rFontAttributes,
- const basegfx::BColor& rFontColor,
- const basegfx::BColor& rTextlineColor,
- FontUnderline eFontUnderline,
- bool bUnderlineAbove,
- FontStrikeout eFontStrikeout,
- bool bWordLineMode,
- FontEmphasisMark eFontEmphasisMark,
- bool bEmphasisMarkAbove,
- bool bEmphasisMarkBelow,
- FontRelief eFontRelief,
- bool bShadow)
- : TextSimplePortionPrimitive2D(rNewTransform, rText, rDXArray, rFontAttributes, rFontColor),
- maTextlineColor(rTextlineColor),
- meFontUnderline(eFontUnderline),
- meFontStrikeout(eFontStrikeout),
- meFontEmphasisMark(eFontEmphasisMark),
- meFontRelief(eFontRelief),
- mbUnderlineAbove(bUnderlineAbove),
- mbWordLineMode(bWordLineMode),
- mbEmphasisMarkAbove(bEmphasisMarkAbove),
- mbEmphasisMarkBelow(bEmphasisMarkBelow),
- mbShadow(bShadow)
- {
- }
-
- bool TextDecoratedPortionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(TextSimplePortionPrimitive2D::operator==(rPrimitive))
- {
- const TextDecoratedPortionPrimitive2D& rCompare = (TextDecoratedPortionPrimitive2D&)rPrimitive;
-
- return (getTextlineColor() == rCompare.getTextlineColor()
- && getFontUnderline() == rCompare.getFontUnderline()
- && getFontStrikeout() == rCompare.getFontStrikeout()
- && getUnderlineAbove() == rCompare.getUnderlineAbove()
- && getWordLineMode() == rCompare.getWordLineMode()
- && getFontEmphasisMark() == rCompare.getFontEmphasisMark()
- && getEmphasisMarkAbove() == rCompare.getEmphasisMarkAbove()
- && getEmphasisMarkBelow() == rCompare.getEmphasisMarkBelow()
- && getFontRelief() == rCompare.getFontRelief()
- && getShadow() == rCompare.getShadow());
- }
-
- return false;
- }
-
- // provide unique ID
- ImplPrimitrive2DIDBlock(TextDecoratedPortionPrimitive2D, PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D)
-
- } // end of namespace primitive2d
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 806cb5a82eab..fc019dfa4a13 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclmetafileprocessor2d.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2007-07-27 09:03:34 $
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:45 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -137,6 +137,30 @@
#include <vcl/metaact.hxx>
#endif
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTFIELDPRIMITIVE2D_HXX
+#include <drawinglayer/primitive2d/textfieldprimitive2d.hxx>
+#endif
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE_TEXTDECORATEDPRIMITIVE2D_HXX
+#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
+#endif
+
+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+#include <comphelper/processfactory.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_I18N_CHARACTERITERATORMODE_HDL_
+#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
+#endif
+
+#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HPP_
+#include <com/sun/star/i18n/WordType.hpp>
+#endif
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
@@ -378,6 +402,9 @@ namespace drawinglayer
}
}
+ // init static break iterator
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > VclMetafileProcessor2D::mxBreakIterator;
+
VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev)
: VclProcessor2D(rViewInformation, rOutDev),
mrMetaFile(*rOutDev.GetConnectMetaFile()),
@@ -433,13 +460,8 @@ namespace drawinglayer
PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D,
and for PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D when detected unified alpha
-
-
-
- To be done:
-
-
XPATHSTROKE_SEQ_BEGIN, XPATHSTROKE_SEQ_END:
+
Similar to pathfill, but using SvtGraphicStroke instead. It also has two producers where one
is also the GDIMetaFile::Rotate. Another user is MetaCommentAction::Move which modifies the
contained path accordingly.
@@ -457,21 +479,52 @@ namespace drawinglayer
+ To be done:
+
+
- FIELD_SEQ_BEGIN
+
+
+ FIELD_SEQ_BEGIN, FIELD_SEQ_END
+ Used from slideshow for URLs, created from diverse SvxField implementations inside
+ createBeginComment()/createEndComment(). createBeginComment() is used from editeng\impedit3.cxx
+ inside ImpEditEngine::Paint.
+ Created TextFieldPrimitive2D and added needed infos there; it is an group primitive and wraps
+ text primitives (but is not limited to that). It contains the Prolog string (normally FIELD_SEQ_BEGIN,
+ but there are others), the Epilog string and the URL if it was an URL field.
FIELD_SEQ_BEGIN;PageField
FIELD_SEQ_END
+
+
+
+
+
EPSReplacementGraphic
+
+
XTEXT
- XTEXT_EOC
- XTEXT_EOS
- XTEXT_EOL
- XTEXT_EOP
+
+ XTEXT_EOC(i) end of character
+ XTEXT_EOW(i) end of word
+ XTEXT_EOS(i) end of sentence
+ this three are with index and are created with the help of a i18n::XBreakIterator in
+ ImplDrawWithComments. Simplifying, moving out text painting, reworking to create some
+ data structure for holding those TEXT infos.
+
+ XTEXT_EOL() end of line
+ XTEXT_EOP() end of paragraph
+ this two are boolean marks, created by the loop in ImpEditEngine::Paint
+
+
+
+
+
+
XTEXT_PAINTSHAPE_BEGIN
XTEXT_PAINTSHAPE_END
@@ -479,20 +532,121 @@ namespace drawinglayer
XTEXT_SCROLLRECT
XTEXT_PAINTRECT
+
+
PRNSPOOL_TRANSPARENTBITMAP_BEGIN
PRNSPOOL_TRANSPARENTBITMAP_END
+
+
+
+
+ Evtl. support for vcl::PDFExtOutDevData ?!?!
*/
void VclMetafileProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
{
switch(rCandidate.getPrimitiveID())
{
+ case PRIMITIVE2D_ID_TEXTFIELDPRIMITIVE2D :
+ {
+ // support for FIELD_SEQ_BEGIN, FIELD_SEQ_END and URL. It wraps text primitives (but is not limited to)
+ // thus do the extra stuff but handle recursively.
+ const primitive2d::TextFieldPrimitive2D& rTextFieldPrimitive = static_cast< const primitive2d::TextFieldPrimitive2D& >(rCandidate);
+ const bool bUsePrologEpilog(0 != rTextFieldPrimitive.getProlog().Len() || 0 != rTextFieldPrimitive.getEpilog().Len());
+ const bool bIsURL(0 != rTextFieldPrimitive.getURL().Len());
+
+ if(bUsePrologEpilog)
+ {
+ if(bIsURL)
+ {
+ const String& rURL = rTextFieldPrimitive.getURL();
+ mrMetaFile.AddAction(new MetaCommentAction(rTextFieldPrimitive.getProlog(),
+ 0, reinterpret_cast<const BYTE*>(rURL.GetBuffer()),
+ 2 * rURL.Len()));
+ }
+ else
+ {
+ mrMetaFile.AddAction(new MetaCommentAction(rTextFieldPrimitive.getProlog()));
+ }
+ }
+
+ // process recursively
+ process(rTextFieldPrimitive.get2DDecomposition(getViewInformation2D()));
+
+ if(bUsePrologEpilog)
+ {
+ mrMetaFile.AddAction(new MetaCommentAction(rTextFieldPrimitive.getEpilog()));
+ }
+
+ break;
+ }
case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D :
case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D :
{
+ // for supporting TEXT_ MetaFile actions there is more to do here; get the candidate
+ const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate = static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate);
+ const primitive2d::TextDecoratedPortionPrimitive2D* pTextDecoratedCandidate = dynamic_cast< const primitive2d::TextDecoratedPortionPrimitive2D* >(&rCandidate);
+
// directdraw of text simple portion; use default processing
- RenderTextSimpleOrDecoratedPortionPrimitive2D(static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate));
+ RenderTextSimpleOrDecoratedPortionPrimitive2D(rTextCandidate);
+
+ if(pTextDecoratedCandidate)
+ {
+ // support for TEXT_ MetaFile actions only for decorated texts
+ if(!mxBreakIterator.is())
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF(::comphelper::getProcessServiceFactory());
+ mxBreakIterator.set(xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator")), ::com::sun::star::uno::UNO_QUERY);
+ }
+
+ if(mxBreakIterator.is())
+ {
+ const String& rTxt = rTextCandidate.getText();
+ const sal_uInt16 nLen(rTxt.Len());
+
+ if(nLen)
+ {
+ const ::com::sun::star::lang::Locale& rLocale = rTextCandidate.getLocale();
+
+ sal_Int32 nDone;
+ sal_Int32 nNextCellBreak(mxBreakIterator->nextCharacters(rTxt, 0, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 0, nDone));
+ ::com::sun::star::i18n::Boundary nNextWordBoundary(mxBreakIterator->getWordBoundary(rTxt, 0, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True));
+ sal_Int32 nNextSentenceBreak(mxBreakIterator->endOfSentence(rTxt, 0, rLocale));
+
+ for(sal_Int32 i(0); i < nLen; i++)
+ {
+ // create the entries for the respective break positions
+ if(i == nNextCellBreak)
+ {
+ mrMetaFile.AddAction(new MetaCommentAction("XTEXT_EOC", i));
+ nNextCellBreak = mxBreakIterator->nextCharacters(rTxt, i, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
+ }
+ if(i == nNextWordBoundary.endPos)
+ {
+ mrMetaFile.AddAction(new MetaCommentAction("XTEXT_EOW", i));
+ nNextWordBoundary = mxBreakIterator->getWordBoundary(rTxt, i + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True);
+ }
+ if(i == nNextSentenceBreak)
+ {
+ mrMetaFile.AddAction(new MetaCommentAction("XTEXT_EOS", i));
+ nNextSentenceBreak = mxBreakIterator->endOfSentence(rTxt, i + 1, rLocale);
+ }
+ }
+ }
+ }
+
+ if(pTextDecoratedCandidate->getEndOfLine())
+ {
+ mrMetaFile.AddAction( new MetaCommentAction( "XTEXT_EOL" ) );
+ }
+
+ if(pTextDecoratedCandidate->getEndOfParagraph())
+ {
+ mrMetaFile.AddAction( new MetaCommentAction( "XTEXT_EOP" ) );
+ }
+ }
+
break;
}
case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
@@ -550,11 +704,15 @@ namespace drawinglayer
if(aLocalPolyPolygon.count())
{
- // calculate transformation. To get the needed start offset, get the range from the
- // outline and compare top left with top left of FillBitmapAttribute
+ // calculate transformation. Get real object size, all values in FillBitmapAttribute
+ // are relative to the unified object
const attribute::FillBitmapAttribute& rFillBitmapAttribute = rBitmapCandidate .getFillBitmap();
const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(basegfx::tools::adaptiveSubdivideByAngle(aLocalPolyPolygon)));
- const basegfx::B2DVector aStartOffset(rFillBitmapAttribute.getTopLeft() - aOutlineRange.getMinimum());
+ const basegfx::B2DVector aOutlineSize(aOutlineRange.getRange());
+
+ // get absolute values
+ const basegfx::B2DVector aFillBitmapSize(rFillBitmapAttribute.getSize() * aOutlineSize);
+ const basegfx::B2DPoint aFillBitmapTopLeft(rFillBitmapAttribute.getTopLeft() * aOutlineSize);
// the scaling needs scale from pixel to logic coordinate system
const Bitmap& rBitmap = rFillBitmapAttribute.getBitmap();
@@ -570,16 +728,16 @@ namespace drawinglayer
aBmpSizePixel.Height() = 1;
}
- const double fScaleX(rFillBitmapAttribute.getSize().getX() / aBmpSizePixel.Width());
- const double fScaleY(rFillBitmapAttribute.getSize().getY() / aBmpSizePixel.Height());
-
// setup transformation like in impgrfll
SvtGraphicFill::Transform aTransform;
- aTransform.matrix[0] *= fScaleX;
- aTransform.matrix[4] *= fScaleY;
- aTransform.matrix[2] += aStartOffset.getX();
- aTransform.matrix[5] += aStartOffset.getY();
+ // scale values are divided by bitmap pixel sizes
+ aTransform.matrix[0] = aFillBitmapSize.getX() / aBmpSizePixel.Width();
+ aTransform.matrix[4] = aFillBitmapSize.getY() / aBmpSizePixel.Height();
+
+ // translates are absolute
+ aTransform.matrix[2] = aFillBitmapTopLeft.getX();
+ aTransform.matrix[5] = aFillBitmapTopLeft.getY();
// setup fill graphic like in impgrfll
Graphic aFillGraphic = Graphic(rBitmap);
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 8a146f923654..a66d2ecebcdd 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclprocessor2d.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: aw $ $Date: 2007-07-27 09:03:34 $
+ * last change: $Author: aw $ $Date: 2007-08-02 11:43:45 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -41,6 +41,10 @@
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#endif
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE_TEXTDECORATEDPRIMITIVE2D_HXX
+#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
+#endif
+
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif