Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/textprimitive2d.hxx>
35 : : #include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
36 : :
37 : : //////////////////////////////////////////////////////////////////////////////
38 : : // predeclarations
39 : :
40 : : namespace basegfx { namespace tools {
41 : : class B2DHomMatrixBufferedOnDemandDecompose;
42 : : }}
43 : :
44 : : namespace com { namespace sun { namespace star { namespace i18n {
45 : : struct Boundary;
46 : : }}}}
47 : :
48 : : //////////////////////////////////////////////////////////////////////////////
49 : :
50 : : namespace drawinglayer
51 : : {
52 : : namespace primitive2d
53 : : {
54 : : /** TextDecoratedPortionPrimitive2D class
55 : :
56 : : This primitive expands the TextSimplePortionPrimitive2D by common
57 : : decorations used in the office. It can be decomposed and will create
58 : : a TextSimplePortionPrimitive2D and all the contained decorations (if used)
59 : : as geometry.
60 : : */
61 [ - + ]: 4036 : class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
62 : : {
63 : : private:
64 : : /// decoration definitions
65 : : basegfx::BColor maOverlineColor;
66 : : basegfx::BColor maTextlineColor;
67 : : TextLine meFontOverline;
68 : : TextLine meFontUnderline;
69 : : TextStrikeout meTextStrikeout;
70 : : TextEmphasisMark meTextEmphasisMark;
71 : : TextRelief meTextRelief;
72 : :
73 : : /// bitfield
74 : : unsigned mbUnderlineAbove : 1;
75 : : unsigned mbWordLineMode : 1;
76 : : unsigned mbEmphasisMarkAbove : 1;
77 : : unsigned mbEmphasisMarkBelow : 1;
78 : : unsigned mbShadow : 1;
79 : :
80 : : /// helper methods
81 : : void impCreateGeometryContent(
82 : : std::vector< Primitive2DReference >& rTarget,
83 : : basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
84 : : const String& rText,
85 : : xub_StrLen aTextPosition,
86 : : xub_StrLen aTextLength,
87 : : const ::std::vector< double >& rDXArray,
88 : : const attribute::FontAttribute& rFontAttribute) const;
89 : :
90 : : void impCorrectTextBoundary(
91 : : ::com::sun::star::i18n::Boundary& rNextWordBoundary) const;
92 : :
93 : : void impSplitSingleWords(
94 : : std::vector< Primitive2DReference >& rTarget,
95 : : basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans) const;
96 : :
97 : : protected:
98 : : /// local decomposition.
99 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
100 : :
101 : : public:
102 : : /// constructor
103 : : TextDecoratedPortionPrimitive2D(
104 : :
105 : : /// TextSimplePortionPrimitive2D parameters
106 : : const basegfx::B2DHomMatrix& rNewTransform,
107 : : const String& rText,
108 : : xub_StrLen aTextPosition,
109 : : xub_StrLen aTextLength,
110 : : const ::std::vector< double >& rDXArray,
111 : : const attribute::FontAttribute& rFontAttribute,
112 : : const ::com::sun::star::lang::Locale& rLocale,
113 : : const basegfx::BColor& rFontColor,
114 : :
115 : : /// local parameters
116 : : const basegfx::BColor& rOverlineColor,
117 : : const basegfx::BColor& rTextlineColor,
118 : : TextLine eFontOverline = TEXT_LINE_NONE,
119 : : TextLine eFontUnderline = TEXT_LINE_NONE,
120 : : bool bUnderlineAbove = false,
121 : : TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
122 : : bool bWordLineMode = false,
123 : : TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE,
124 : : bool bEmphasisMarkAbove = true,
125 : : bool bEmphasisMarkBelow = false,
126 : : TextRelief eTextRelief = TEXT_RELIEF_NONE,
127 : : bool bShadow = false);
128 : :
129 : : /// data read access
130 : 20577 : TextLine getFontOverline() const { return meFontOverline; }
131 : 10526 : TextLine getFontUnderline() const { return meFontUnderline; }
132 : 8573 : TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
133 : 1839 : TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
134 : 5167 : TextRelief getTextRelief() const { return meTextRelief; }
135 : 3085 : const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
136 : 4205 : const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
137 : 0 : bool getUnderlineAbove() const { return mbUnderlineAbove; }
138 : 5047 : bool getWordLineMode() const { return mbWordLineMode; }
139 : 1677 : bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
140 : 0 : bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
141 : 2423 : bool getShadow() const { return mbShadow; }
142 : :
143 : : /// compare operator
144 : : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
145 : :
146 : : /// get range
147 : : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
148 : :
149 : : /// provide unique ID
150 : : DeclPrimitrive2DIDBlock()
151 : : };
152 : : } // end of namespace primitive2d
153 : : } // end of namespace drawinglayer
154 : :
155 : : //////////////////////////////////////////////////////////////////////////////
156 : :
157 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
158 : :
159 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|