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 .
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
25 #include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
27 namespace basegfx::utils
{
28 class B2DHomMatrixBufferedOnDemandDecompose
;
31 namespace drawinglayer::primitive2d
33 /** TextDecoratedPortionPrimitive2D class
35 This primitive expands the TextSimplePortionPrimitive2D by common
36 decorations used in the office. It can be decomposed and will create
37 a TextSimplePortionPrimitive2D and all the contained decorations (if used)
40 class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D final
: public TextSimplePortionPrimitive2D
43 /// decoration definitions
44 basegfx::BColor maOverlineColor
;
45 basegfx::BColor maTextlineColor
;
46 TextLine meFontOverline
;
47 TextLine meFontUnderline
;
48 TextStrikeout meTextStrikeout
;
49 TextEmphasisMark meTextEmphasisMark
;
50 TextRelief meTextRelief
;
52 bool mbUnderlineAbove
: 1;
53 bool mbWordLineMode
: 1;
54 bool mbEmphasisMarkAbove
: 1;
55 bool mbEmphasisMarkBelow
: 1;
59 void impCreateGeometryContent(
60 std::vector
< Primitive2DReference
>& rTarget
,
61 basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose
const & rDecTrans
,
62 const OUString
& rText
,
63 sal_Int32 nTextPosition
,
64 sal_Int32 nTextLength
,
65 const ::std::vector
< double >& rDXArray
,
66 const attribute::FontAttribute
& rFontAttribute
) const;
68 /// local decomposition.
69 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
73 TextDecoratedPortionPrimitive2D(
74 /// TextSimplePortionPrimitive2D parameters
75 const basegfx::B2DHomMatrix
& rNewTransform
,
76 const OUString
& rText
,
77 sal_Int32 nTextPosition
,
78 sal_Int32 nTextLength
,
79 const ::std::vector
< double >& rDXArray
,
80 const attribute::FontAttribute
& rFontAttribute
,
81 const css::lang::Locale
& rLocale
,
82 const basegfx::BColor
& rFontColor
,
83 const Color
& rFillColor
,
86 const basegfx::BColor
& rOverlineColor
,
87 const basegfx::BColor
& rTextlineColor
,
88 TextLine eFontOverline
= TEXT_LINE_NONE
,
89 TextLine eFontUnderline
= TEXT_LINE_NONE
,
90 bool bUnderlineAbove
= false,
91 TextStrikeout eTextStrikeout
= TEXT_STRIKEOUT_NONE
,
92 bool bWordLineMode
= false,
93 TextEmphasisMark eTextEmphasisMark
= TEXT_FONT_EMPHASIS_MARK_NONE
,
94 bool bEmphasisMarkAbove
= true,
95 bool bEmphasisMarkBelow
= false,
96 TextRelief eTextRelief
= TEXT_RELIEF_NONE
,
97 bool bShadow
= false);
100 TextLine
getFontOverline() const { return meFontOverline
; }
101 TextLine
getFontUnderline() const { return meFontUnderline
; }
102 TextStrikeout
getTextStrikeout() const { return meTextStrikeout
; }
103 TextEmphasisMark
getTextEmphasisMark() const { return meTextEmphasisMark
; }
104 TextRelief
getTextRelief() const { return meTextRelief
; }
105 const basegfx::BColor
& getOverlineColor() const { return maOverlineColor
; }
106 const basegfx::BColor
& getTextlineColor() const { return maTextlineColor
; }
107 bool getUnderlineAbove() const { return mbUnderlineAbove
; }
108 bool getWordLineMode() const { return mbWordLineMode
; }
109 bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove
; }
110 bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow
; }
111 bool getShadow() const { return mbShadow
; }
114 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const override
;
117 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
119 /// provide unique ID
120 virtual sal_uInt32
getPrimitive2DID() const override
;
122 } // end of namespace drawinglayer::primitive2d
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */