nss: upgrade to release 3.73
[LibreOffice.git] / include / drawinglayer / primitive2d / textlayoutdevice.hxx
blob10f0fc0b23c1002aea486b40264112fad5f3ff35
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <basegfx/range/b2drange.hxx>
25 #include <vector>
26 #include <basegfx/polygon/b2dpolypolygon.hxx>
27 #include <vcl/svapp.hxx>
29 // predefines
30 class VirtualDevice;
31 namespace vcl { class Font; }
32 class GDIMetaFile;
33 namespace tools { class Rectangle; }
34 enum class DrawTextFlags;
35 namespace drawinglayer::attribute {
36 class FontAttribute;
39 namespace com::sun::star::lang { struct Locale; }
41 // access to one global impTimedRefDev incarnation in namespace drawinglayer::primitive
43 namespace drawinglayer::primitive2d
45 /** TextLayouterDevice class
47 This helper class exists to isolate all accesses to VCL
48 text formatting/handling functionality for primitive implementations.
49 When in the future FontHandling may move to an own library independent
50 from VCL, primitives will be prepared.
52 class DRAWINGLAYER_DLLPUBLIC TextLayouterDevice
54 /// internally used VirtualDevice
55 SolarMutexGuard maSolarGuard;
56 VirtualDevice& mrDevice;
58 public:
59 /// constructor/destructor
60 TextLayouterDevice();
61 ~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE;
63 /// tooling methods
64 void setFont(const vcl::Font& rFont);
65 void setFontAttribute(
66 const attribute::FontAttribute& rFontAttribute,
67 double fFontScaleX,
68 double fFontScaleY,
69 const css::lang::Locale & rLocale);
71 double getTextHeight() const;
72 double getOverlineHeight() const;
73 double getOverlineOffset() const;
74 double getUnderlineHeight() const;
75 double getUnderlineOffset() const;
76 double getStrikeoutOffset() const;
78 double getTextWidth(
79 const OUString& rText,
80 sal_uInt32 nIndex,
81 sal_uInt32 nLength) const;
83 void getTextOutlines(
84 basegfx::B2DPolyPolygonVector&,
85 const OUString& rText,
86 sal_uInt32 nIndex,
87 sal_uInt32 nLength,
88 const ::std::vector< double >& rDXArray) const;
90 basegfx::B2DRange getTextBoundRect(
91 const OUString& rText,
92 sal_uInt32 nIndex,
93 sal_uInt32 nLength) const;
95 double getFontAscent() const;
96 double getFontDescent() const;
98 void addTextRectActions(
99 const tools::Rectangle& rRectangle,
100 const OUString& rText,
101 DrawTextFlags nStyle,
102 GDIMetaFile& rGDIMetaFile) const;
104 ::std::vector< double > getTextArray(
105 const OUString& rText,
106 sal_uInt32 nIndex,
107 sal_uInt32 nLength) const;
109 ::std::vector< double > getCaretPositions(
110 const OUString& rText,
111 sal_uInt32 nIndex,
112 sal_uInt32 nLength) const;
115 // helper methods for vcl font handling
117 /** Create a VCL-Font based on the definitions in FontAttribute
118 and the given FontScaling. The FontScaling defines the FontHeight
119 (fFontScaleY) and the FontWidth (fFontScaleX). The combination of
120 both defines FontStretching, where no stretching happens at
121 fFontScaleY == fFontScaleX
123 vcl::Font DRAWINGLAYER_DLLPUBLIC getVclFontFromFontAttribute(
124 const attribute::FontAttribute& rFontAttribute,
125 double fFontScaleX,
126 double fFontScaleY,
127 double fFontRotation,
128 const css::lang::Locale & rLocale);
130 /** Generate FontAttribute DataSet derived from the given VCL-Font.
131 The FontScaling with fFontScaleY, fFontScaleX relationship (see
132 above) will be set in return parameter o_rSize to allow further
133 processing
135 attribute::FontAttribute DRAWINGLAYER_DLLPUBLIC getFontAttributeFromVclFont(
136 basegfx::B2DVector& o_rSize,
137 const vcl::Font& rFont,
138 bool bRTL,
139 bool bBiDiStrong);
141 } // end of namespace drawinglayer::primitive2d
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */