Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/textprimitive2d.hxx>
26 : #include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
27 :
28 :
29 : // predeclarations
30 :
31 : namespace basegfx { namespace tools {
32 : class B2DHomMatrixBufferedOnDemandDecompose;
33 : }}
34 :
35 : namespace com { namespace sun { namespace star { namespace i18n {
36 : struct Boundary;
37 : }}}}
38 :
39 :
40 :
41 : namespace drawinglayer
42 : {
43 : namespace primitive2d
44 : {
45 : /** TextDecoratedPortionPrimitive2D class
46 :
47 : This primitive expands the TextSimplePortionPrimitive2D by common
48 : decorations used in the office. It can be decomposed and will create
49 : a TextSimplePortionPrimitive2D and all the contained decorations (if used)
50 : as geometry.
51 : */
52 5138 : class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
53 : {
54 : private:
55 : /// decoration definitions
56 : basegfx::BColor maOverlineColor;
57 : basegfx::BColor maTextlineColor;
58 : TextLine meFontOverline;
59 : TextLine meFontUnderline;
60 : TextStrikeout meTextStrikeout;
61 : TextEmphasisMark meTextEmphasisMark;
62 : TextRelief meTextRelief;
63 :
64 : /// bitfield
65 : bool mbUnderlineAbove : 1;
66 : bool mbWordLineMode : 1;
67 : bool mbEmphasisMarkAbove : 1;
68 : bool mbEmphasisMarkBelow : 1;
69 : bool mbShadow : 1;
70 :
71 : /// helper methods
72 : void impCreateGeometryContent(
73 : std::vector< Primitive2DReference >& rTarget,
74 : basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
75 : const OUString& rText,
76 : sal_Int32 nTextPosition,
77 : sal_Int32 nTextLength,
78 : const ::std::vector< double >& rDXArray,
79 : const attribute::FontAttribute& rFontAttribute) const;
80 :
81 : protected:
82 : /// local decomposition.
83 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
84 :
85 : public:
86 : /// constructor
87 : TextDecoratedPortionPrimitive2D(
88 : /// TextSimplePortionPrimitive2D parameters
89 : const basegfx::B2DHomMatrix& rNewTransform,
90 : const OUString& rText,
91 : sal_Int32 nTextPosition,
92 : sal_Int32 nTextLength,
93 : const ::std::vector< double >& rDXArray,
94 : const attribute::FontAttribute& rFontAttribute,
95 : const ::com::sun::star::lang::Locale& rLocale,
96 : const basegfx::BColor& rFontColor,
97 : const Color& rFillColor,
98 :
99 : /// local parameters
100 : const basegfx::BColor& rOverlineColor,
101 : const basegfx::BColor& rTextlineColor,
102 : TextLine eFontOverline = TEXT_LINE_NONE,
103 : TextLine eFontUnderline = TEXT_LINE_NONE,
104 : bool bUnderlineAbove = false,
105 : TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
106 : bool bWordLineMode = false,
107 : TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE,
108 : bool bEmphasisMarkAbove = true,
109 : bool bEmphasisMarkBelow = false,
110 : TextRelief eTextRelief = TEXT_RELIEF_NONE,
111 : bool bShadow = false);
112 :
113 : /// data read access
114 15441 : TextLine getFontOverline() const { return meFontOverline; }
115 9662 : TextLine getFontUnderline() const { return meFontUnderline; }
116 7764 : TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
117 1405 : TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
118 5091 : TextRelief getTextRelief() const { return meTextRelief; }
119 2347 : const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
120 3541 : const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
121 514 : bool getUnderlineAbove() const { return mbUnderlineAbove; }
122 3999 : bool getWordLineMode() const { return mbWordLineMode; }
123 1297 : bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
124 514 : bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
125 2101 : bool getShadow() const { return mbShadow; }
126 :
127 : /// check if this needs to be a TextDecoratedPortionPrimitive2D or
128 : /// if a TextSimplePortionPrimitive2D would be suficcient
129 : bool decoratedIsNeeded() const;
130 :
131 : /// compare operator
132 : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
133 :
134 : /// get range
135 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
136 :
137 : /// provide unique ID
138 : DeclPrimitive2DIDBlock()
139 : };
140 : } // end of namespace primitive2d
141 : } // end of namespace drawinglayer
142 :
143 :
144 :
145 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|