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 : namespace basegfx { namespace tools {
29 : class B2DHomMatrixBufferedOnDemandDecompose;
30 : }}
31 :
32 : namespace com { namespace sun { namespace star { namespace i18n {
33 : struct Boundary;
34 : }}}}
35 :
36 : namespace drawinglayer
37 : {
38 : namespace primitive2d
39 : {
40 : /** TextDecoratedPortionPrimitive2D class
41 :
42 : This primitive expands the TextSimplePortionPrimitive2D by common
43 : decorations used in the office. It can be decomposed and will create
44 : a TextSimplePortionPrimitive2D and all the contained decorations (if used)
45 : as geometry.
46 : */
47 5490 : class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
48 : {
49 : private:
50 : /// decoration definitions
51 : basegfx::BColor maOverlineColor;
52 : basegfx::BColor maTextlineColor;
53 : TextLine meFontOverline;
54 : TextLine meFontUnderline;
55 : TextStrikeout meTextStrikeout;
56 : TextEmphasisMark meTextEmphasisMark;
57 : TextRelief meTextRelief;
58 :
59 : /// bitfield
60 : bool mbUnderlineAbove : 1;
61 : bool mbWordLineMode : 1;
62 : bool mbEmphasisMarkAbove : 1;
63 : bool mbEmphasisMarkBelow : 1;
64 : bool mbShadow : 1;
65 :
66 : /// helper methods
67 : void impCreateGeometryContent(
68 : std::vector< Primitive2DReference >& rTarget,
69 : basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
70 : const OUString& rText,
71 : sal_Int32 nTextPosition,
72 : sal_Int32 nTextLength,
73 : const ::std::vector< double >& rDXArray,
74 : const attribute::FontAttribute& rFontAttribute) const;
75 :
76 : protected:
77 : /// local decomposition.
78 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
79 :
80 : public:
81 : /// constructor
82 : TextDecoratedPortionPrimitive2D(
83 : /// TextSimplePortionPrimitive2D parameters
84 : const basegfx::B2DHomMatrix& rNewTransform,
85 : const OUString& rText,
86 : sal_Int32 nTextPosition,
87 : sal_Int32 nTextLength,
88 : const ::std::vector< double >& rDXArray,
89 : const attribute::FontAttribute& rFontAttribute,
90 : const ::com::sun::star::lang::Locale& rLocale,
91 : const basegfx::BColor& rFontColor,
92 : const Color& rFillColor,
93 :
94 : /// local parameters
95 : const basegfx::BColor& rOverlineColor,
96 : const basegfx::BColor& rTextlineColor,
97 : TextLine eFontOverline = TEXT_LINE_NONE,
98 : TextLine eFontUnderline = TEXT_LINE_NONE,
99 : bool bUnderlineAbove = false,
100 : TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
101 : bool bWordLineMode = false,
102 : TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE,
103 : bool bEmphasisMarkAbove = true,
104 : bool bEmphasisMarkBelow = false,
105 : TextRelief eTextRelief = TEXT_RELIEF_NONE,
106 : bool bShadow = false);
107 :
108 : /// data read access
109 30273 : TextLine getFontOverline() const { return meFontOverline; }
110 12468 : TextLine getFontUnderline() const { return meFontUnderline; }
111 8894 : TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
112 2973 : TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
113 7157 : TextRelief getTextRelief() const { return meTextRelief; }
114 4460 : const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
115 5160 : const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
116 636 : bool getUnderlineAbove() const { return mbUnderlineAbove; }
117 7013 : bool getWordLineMode() const { return mbWordLineMode; }
118 2721 : bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
119 636 : bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
120 3685 : bool getShadow() const { return mbShadow; }
121 :
122 : /// check if this needs to be a TextDecoratedPortionPrimitive2D or
123 : /// if a TextSimplePortionPrimitive2D would be suficcient
124 : bool decoratedIsNeeded() const;
125 :
126 : /// compare operator
127 : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
128 :
129 : /// get range
130 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
131 :
132 : /// provide unique ID
133 : DeclPrimitive2DIDBlock()
134 : };
135 : } // end of namespace primitive2d
136 : } // end of namespace drawinglayer
137 :
138 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
139 :
140 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|