1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
26 #include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
28 namespace basegfx
{ namespace tools
{
29 class B2DHomMatrixBufferedOnDemandDecompose
;
32 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
36 namespace drawinglayer
40 /** TextDecoratedPortionPrimitive2D class
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)
47 class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D
: public TextSimplePortionPrimitive2D
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
;
60 bool mbUnderlineAbove
: 1;
61 bool mbWordLineMode
: 1;
62 bool mbEmphasisMarkAbove
: 1;
63 bool mbEmphasisMarkBelow
: 1;
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;
77 /// local decomposition.
78 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
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
,
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);
109 TextLine
getFontOverline() const { return meFontOverline
; }
110 TextLine
getFontUnderline() const { return meFontUnderline
; }
111 TextStrikeout
getTextStrikeout() const { return meTextStrikeout
; }
112 TextEmphasisMark
getTextEmphasisMark() const { return meTextEmphasisMark
; }
113 TextRelief
getTextRelief() const { return meTextRelief
; }
114 const basegfx::BColor
& getOverlineColor() const { return maOverlineColor
; }
115 const basegfx::BColor
& getTextlineColor() const { return maTextlineColor
; }
116 bool getUnderlineAbove() const { return mbUnderlineAbove
; }
117 bool getWordLineMode() const { return mbWordLineMode
; }
118 bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove
; }
119 bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow
; }
120 bool getShadow() const { return mbShadow
; }
122 /// check if this needs to be a TextDecoratedPortionPrimitive2D or
123 /// if a TextSimplePortionPrimitive2D would be suficcient
124 bool decoratedIsNeeded() const;
127 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
130 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
132 /// provide unique ID
133 DeclPrimitive2DIDBlock()
135 } // end of namespace primitive2d
136 } // end of namespace drawinglayer
138 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */