diff options
author | Armin Weiss <aw@openoffice.org> | 2007-09-26 10:36:58 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2007-09-26 10:36:58 +0000 |
commit | 9260ca65470b0e7e8310772865023addaa393ca8 (patch) | |
tree | 17931f5b22df163d8cf1dec2ac4a28c195995c53 /drawinglayer/inc | |
parent | 553365ad85673d3d3f42bc32d817a387fba1a85e (diff) |
#i73860# text decomposition extended
Diffstat (limited to 'drawinglayer/inc')
7 files changed, 189 insertions, 48 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index fdd625966bfb..c56ddd68b67a 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.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2007-09-20 09:51:21 $ + * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -90,6 +90,7 @@ #define PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41) #define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42) #define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43) +#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index ef3ad8117670..12b4306dc6a0 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive2d.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2007-09-20 09:51:21 $ + * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -163,7 +163,7 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -// PolygonStrokePrimitive2D class +// PolygonWavePrimitive2D class namespace drawinglayer { @@ -173,7 +173,7 @@ namespace drawinglayer { private: basegfx::B2DPolygon maPolygon; - basegfx::BColor maBColor; + attribute::StrokeAttribute maStrokeAttribute; double mfWaveWidth; double mfWaveHeight; @@ -184,13 +184,13 @@ namespace drawinglayer public: PolygonWavePrimitive2D( const basegfx::B2DPolygon& rPolygon, - const basegfx::BColor& rBColor, + const attribute::StrokeAttribute& rStrokeAttribute, double fWaveWidth, double fWaveHeight); // get data basegfx::B2DPolygon getB2DPolygon() const { return maPolygon; } - const basegfx::BColor& getBColor() const { return maBColor; } + const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } double getWaveWidth() const { return mfWaveWidth; } double getWaveHeight() const { return mfWaveHeight; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 5a505129e6f9..755c1f1a9de9 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: textdecoratedprimitive2d.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2007-09-20 09:51:21 $ + * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,9 +40,12 @@ #include <drawinglayer/primitive2d/textprimitive2d.hxx> #endif -#ifndef _COM_SUN_STAR_I18N_XBREAKITERATOR_HPP_ -#include <com/sun/star/i18n/XBreakIterator.hpp> -#endif +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +namespace basegfx { + class DecomposedB2DHomMatrixContainer; +} // end of namespace basegfx ////////////////////////////////////////////////////////////////////////////// @@ -114,11 +117,16 @@ namespace drawinglayer unsigned mbEmphasisMarkBelow : 1; unsigned mbShadow : 1; - // 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; + // helper methods + void impCreateGeometryContent( + std::vector< Primitive2DReference >& rTarget, + basegfx::DecomposedB2DHomMatrixContainer& rDecTrans, + const rtl::OUString& rText, + const ::std::vector< double >& rDXArray, + const FontAttributes& rFontAttributes) const; + void impSplitSingleWords( + std::vector< Primitive2DReference >& rTarget, + basegfx::DecomposedB2DHomMatrixContainer& rDecTrans) const; protected: // local decomposition. @@ -129,7 +137,7 @@ namespace drawinglayer // TextSimplePortionPrimitive2D parameters const basegfx::B2DHomMatrix& rNewTransform, - const String& rText, + const rtl::OUString& rText, const ::std::vector< double >& rDXArray, const FontAttributes& rFontAttributes, const ::com::sun::star::lang::Locale& rLocale, diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx new file mode 100644 index 000000000000..67e2ab4afd34 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: texteffectprimitive2d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX +#include <drawinglayer/primitive2d/groupprimitive2d.hxx> +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include <basegfx/matrix/b2dhommatrix.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + enum TextEffectStyle2D + { + TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED_DEFAULT, + TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT, + TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED, + TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED, + TEXTEFFECTSTYLE2D_OUTLINE + }; + + class TextEffectPrimitive2D : public GroupPrimitive2D + { + private: + // the style to apply, the direction and the rotation center + const basegfx::B2DPoint maRotationCenter; + double mfDirection; + TextEffectStyle2D meTextEffectStyle2D; + + // the last used viewTransformation, used from getDecomposition for buffering + basegfx::B2DHomMatrix maLastViewTransformation; + + protected: + // create local decomposition + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + TextEffectPrimitive2D( + const Primitive2DSequence& rChildren, + const basegfx::B2DPoint& rRotationCenter, + double fDirection, + TextEffectStyle2D eTextEffectStyle2D); + + // get data + const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; } + double getDirection() const { return mfDirection; } + TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // own get range implementation to solve more effective. Content is by definition displaced + // by a fixed discrete unit, thus the contained geometry needs only once be asked for it's + // own basegfx::B2DRange + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + + // Overload standard getDecomposition call to be view-dependent here + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx index 39bd7f1a1615..459ad26a5e90 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: texthierarchyprimitive2d.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2007-08-03 10:43:04 $ + * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -127,17 +127,17 @@ namespace drawinglayer { private: FieldType meType; - String maString; + rtl::OUString maString; public: TextHierarchyFieldPrimitive2D( const Primitive2DSequence& rChildren, const FieldType& rFieldType, - const String& rString); + const rtl::OUString& rString); // get data FieldType getType() const { return meType; } - const String& getString() const { return maString; } + const rtl::OUString& getString() const { return maString; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index e80dfe199a98..e3d014cdae82 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -4,9 +4,9 @@ * * $RCSfile: textlayoutdevice.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hdu $ $Date: 2007-02-14 14:53:01 $ + * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -58,10 +58,10 @@ // predefines class VirtualDevice; class Font; -class String; +class rtl::OUString; namespace drawinglayer { namespace primitive2d { - struct FontAttributes; + class FontAttributes; }} namespace basegfx { @@ -93,11 +93,11 @@ namespace drawinglayer double getUnderlineOffset() const; double getStrikeoutOffset() const; - double getTextWidth(const String& rText, xub_StrLen nIndex, xub_StrLen nLength) const; + double getTextWidth(const rtl::OUString& rText, sal_Int32 nIndex, sal_Int32 nLength) const; bool getTextOutlines( basegfx::B2DPolyPolygonVector&, - const String&, xub_StrLen nIndex, xub_StrLen nLength, + const rtl::OUString&, sal_Int32 nIndex, sal_Int32 nLength, const ::std::vector< sal_Int32 >& rDXArray ); - basegfx::B2DRange getTextBoundRect(const String& rText, xub_StrLen nIndex, xub_StrLen nLength) const; + basegfx::B2DRange getTextBoundRect(const rtl::OUString& rText, sal_Int32 nIndex, sal_Int32 nLength) const; }; } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 75669cf53a55..dba663395e84 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.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2007-08-02 11:43:43 $ + * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -68,10 +68,12 @@ namespace drawinglayer { namespace primitive2d { - struct FontAttributes + class FontAttributes { - String maFamilyName; - String maStyleName; + private: + // core data + rtl::OUString maFamilyName; + rtl::OUString maStyleName; sal_uInt16 mnWeight; // bitfield @@ -81,17 +83,36 @@ namespace drawinglayer unsigned mbOutline : 1; // TODO: pair kerning and CJK kerning - // compare operator - bool operator==(const FontAttributes& rCompare) const + public: + FontAttributes( + const rtl::OUString& rFamilyName, + const rtl::OUString& rStyleName, + sal_uInt16 nWeight, + bool bSymbol = false, + bool bVertical = false, + bool bItalic = false, + bool bOutline = false) + : maFamilyName(rFamilyName), + maStyleName(rStyleName), + mnWeight(nWeight), + mbSymbol(bSymbol), + mbVertical(bVertical), + mbItalic(bItalic), + mbOutline(bOutline) { - return (maFamilyName == rCompare.maFamilyName - && maStyleName == rCompare.maStyleName - && mnWeight == rCompare.mnWeight - && mbSymbol == rCompare.mbSymbol - && mbVertical == rCompare.mbVertical - && mbItalic == rCompare.mbItalic - && mbOutline == rCompare.mbOutline); } + + // compare operator + bool operator==(const FontAttributes& rCompare) const; + + // data access + const rtl::OUString& getFamilyName() const { return maFamilyName; } + const rtl::OUString& 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; } }; // helper methods for vcl font @@ -112,7 +133,7 @@ namespace drawinglayer { private: basegfx::B2DHomMatrix maTextTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range - String maText; // the text + rtl::OUString maText; // the text ::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 @@ -125,7 +146,7 @@ namespace drawinglayer public: TextSimplePortionPrimitive2D( const basegfx::B2DHomMatrix& rNewTransform, - const String& rText, + const rtl::OUString& rText, const ::std::vector< double >& rDXArray, const FontAttributes& rFontAttributes, const ::com::sun::star::lang::Locale& rLocale, @@ -133,7 +154,7 @@ namespace drawinglayer // get data const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; } - const String& getText() const { return maText; } + const rtl::OUString& 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; } |