LibreOffice Module drawinglayer (master) 1
textprimitive2d.hxx
Go to the documentation of this file.
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#pragma once
21
23
28#include <rtl/ustring.hxx>
29#include <tools/color.hxx>
30#include <tools/long.hxx>
32#include <com/sun/star/lang/Locale.hpp>
33#include <vector>
34
36{
96{
97private:
100
102 OUString maText;
103
105 sal_Int32 mnTextPosition;
106
108 sal_Int32 mnTextLength;
109
111 std::vector<double> maDXArray;
112
114 std::vector<sal_Bool> maKashidaArray;
115
118
120 css::lang::Locale maLocale;
121
124
125 // Whether to fill a given width with the text
127
128 // the width to fill
130
133
136
137protected:
139 virtual void
140 create2DDecomposition(Primitive2DContainer& rContainer,
141 const geometry::ViewInformation2D& rViewInformation) const override;
142
143public:
145 TextSimplePortionPrimitive2D(basegfx::B2DHomMatrix aNewTransform, OUString aText,
146 sal_Int32 nTextPosition, sal_Int32 nTextLength,
147 std::vector<double>&& rDXArray,
148 std::vector<sal_Bool>&& rKashidaArray,
149 attribute::FontAttribute aFontAttribute, css::lang::Locale aLocale,
150 const basegfx::BColor& rFontColor, bool bFilled = false,
151 tools::Long nWidthToFill = 0,
152 const Color& rTextFillColor = COL_TRANSPARENT);
153
157 void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget,
158 basegfx::B2DHomMatrix& rTransformation) const;
159
161 const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; }
162 const OUString& getText() const { return maText; }
163 sal_Int32 getTextPosition() const { return mnTextPosition; }
164 sal_Int32 getTextLength() const { return mnTextLength; }
165 const ::std::vector<double>& getDXArray() const { return maDXArray; }
166 const ::std::vector<sal_Bool>& getKashidaArray() const { return maKashidaArray; }
167 const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
168 const css::lang::Locale& getLocale() const { return maLocale; }
169 const basegfx::BColor& getFontColor() const { return maFontColor; }
170 const Color& getTextFillColor() const { return maTextFillColor; }
171 bool isFilled() const { return mbFilled; }
172 tools::Long getWidthToFill() const { return mnWidthToFill; }
173
175 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
176
178 virtual basegfx::B2DRange
179 getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
180
182 virtual sal_uInt32 getPrimitive2DID() const override;
183};
184
186bool DRAWINGLAYER_DLLPUBLIC LocalesAreEqual(const css::lang::Locale& rA,
187 const css::lang::Locale& rB);
188
189} // end of namespace drawinglayer::primitive2d
190
191/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Text maText
basegfx::B2DRange maB2DRange
#i96669# internal: add simple range buffering for this primitive
std::vector< sal_Bool > maKashidaArray
The Kashida array.
std::vector< double > maDXArray
The DX array in logic units.
OUString maText
The text, used from maTextPosition up to maTextPosition + maTextLength.
sal_Int32 mnTextLength
The length for maText usage, starting from maTextPosition.
css::lang::Locale maLocale
The Locale for the text.
basegfx::B2DHomMatrix maTextTransform
text transformation (FontCoordinateSystem)
const ::std::vector< sal_Bool > & getKashidaArray() const
attribute::FontAttribute maFontAttribute
The font definition.
sal_Int32 mnTextPosition
The index from where on maText is used.
const ::std::vector< double > & getDXArray() const
const attribute::FontAttribute & getFontAttribute() const
const basegfx::B2DHomMatrix & getTextTransform() const
data read access
#define DRAWINGLAYER_DLLPUBLIC
::std::vector< B2DPolyPolygon > B2DPolyPolygonVector
bool LocalesAreEqual(const css::lang::Locale &rA, const css::lang::Locale &rB)
small helper to have a compare operator for Locale
long Long
const ::Color maTextFillColor
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)