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 0 : 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 :
98 : /// local parameters
99 : const basegfx::BColor& rOverlineColor,
100 : const basegfx::BColor& rTextlineColor,
101 : TextLine eFontOverline = TEXT_LINE_NONE,
102 : TextLine eFontUnderline = TEXT_LINE_NONE,
103 : bool bUnderlineAbove = false,
104 : TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
105 : bool bWordLineMode = false,
106 : TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE,
107 : bool bEmphasisMarkAbove = true,
108 : bool bEmphasisMarkBelow = false,
109 : TextRelief eTextRelief = TEXT_RELIEF_NONE,
110 : bool bShadow = false);
111 :
112 : /// data read access
113 0 : TextLine getFontOverline() const { return meFontOverline; }
114 0 : TextLine getFontUnderline() const { return meFontUnderline; }
115 0 : TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
116 0 : TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
117 0 : TextRelief getTextRelief() const { return meTextRelief; }
118 0 : const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
119 0 : const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
120 0 : bool getUnderlineAbove() const { return mbUnderlineAbove; }
121 0 : bool getWordLineMode() const { return mbWordLineMode; }
122 0 : bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
123 0 : bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
124 0 : bool getShadow() const { return mbShadow; }
125 :
126 : /// check if this needs to be a TextDecoratedPortionPrimitive2D or
127 : /// if a TextSimplePortionPrimitive2D would be suficcient
128 : bool decoratedIsNeeded() const;
129 :
130 : /// compare operator
131 : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
132 :
133 : /// get range
134 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
135 :
136 : /// provide unique ID
137 : DeclPrimitive2DIDBlock()
138 : };
139 : } // end of namespace primitive2d
140 : } // end of namespace drawinglayer
141 :
142 :
143 :
144 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
145 :
146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|