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 utils
{
29 class B2DHomMatrixBufferedOnDemandDecompose
;
32 namespace drawinglayer
36 /** TextDecoratedPortionPrimitive2D class
38 This primitive expands the TextSimplePortionPrimitive2D by common
39 decorations used in the office. It can be decomposed and will create
40 a TextSimplePortionPrimitive2D and all the contained decorations (if used)
43 class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D
: public TextSimplePortionPrimitive2D
46 /// decoration definitions
47 basegfx::BColor maOverlineColor
;
48 basegfx::BColor maTextlineColor
;
49 TextLine meFontOverline
;
50 TextLine meFontUnderline
;
51 TextStrikeout meTextStrikeout
;
52 TextEmphasisMark meTextEmphasisMark
;
53 TextRelief meTextRelief
;
55 bool mbUnderlineAbove
: 1;
56 bool mbWordLineMode
: 1;
57 bool mbEmphasisMarkAbove
: 1;
58 bool mbEmphasisMarkBelow
: 1;
62 void impCreateGeometryContent(
63 std::vector
< Primitive2DReference
>& rTarget
,
64 basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose
const & rDecTrans
,
65 const OUString
& rText
,
66 sal_Int32 nTextPosition
,
67 sal_Int32 nTextLength
,
68 const ::std::vector
< double >& rDXArray
,
69 const attribute::FontAttribute
& rFontAttribute
) const;
72 /// local decomposition.
73 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
77 TextDecoratedPortionPrimitive2D(
78 /// TextSimplePortionPrimitive2D parameters
79 const basegfx::B2DHomMatrix
& rNewTransform
,
80 const OUString
& rText
,
81 sal_Int32 nTextPosition
,
82 sal_Int32 nTextLength
,
83 const ::std::vector
< double >& rDXArray
,
84 const attribute::FontAttribute
& rFontAttribute
,
85 const css::lang::Locale
& rLocale
,
86 const basegfx::BColor
& rFontColor
,
87 const Color
& rFillColor
,
90 const basegfx::BColor
& rOverlineColor
,
91 const basegfx::BColor
& rTextlineColor
,
92 TextLine eFontOverline
= TEXT_LINE_NONE
,
93 TextLine eFontUnderline
= TEXT_LINE_NONE
,
94 bool bUnderlineAbove
= false,
95 TextStrikeout eTextStrikeout
= TEXT_STRIKEOUT_NONE
,
96 bool bWordLineMode
= false,
97 TextEmphasisMark eTextEmphasisMark
= TEXT_FONT_EMPHASIS_MARK_NONE
,
98 bool bEmphasisMarkAbove
= true,
99 bool bEmphasisMarkBelow
= false,
100 TextRelief eTextRelief
= TEXT_RELIEF_NONE
,
101 bool bShadow
= false);
104 TextLine
getFontOverline() const { return meFontOverline
; }
105 TextLine
getFontUnderline() const { return meFontUnderline
; }
106 TextStrikeout
getTextStrikeout() const { return meTextStrikeout
; }
107 TextEmphasisMark
getTextEmphasisMark() const { return meTextEmphasisMark
; }
108 TextRelief
getTextRelief() const { return meTextRelief
; }
109 const basegfx::BColor
& getOverlineColor() const { return maOverlineColor
; }
110 const basegfx::BColor
& getTextlineColor() const { return maTextlineColor
; }
111 bool getUnderlineAbove() const { return mbUnderlineAbove
; }
112 bool getWordLineMode() const { return mbWordLineMode
; }
113 bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove
; }
114 bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow
; }
115 bool getShadow() const { return mbShadow
; }
118 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const override
;
121 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
123 /// provide unique ID
124 DeclPrimitive2DIDBlock()
126 } // end of namespace primitive2d
127 } // end of namespace drawinglayer
129 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */