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_TEXTLAYOUTDEVICE_HXX
21 #define INCLUDED_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <tools/solar.h>
26 #include <tools/poly.hxx>
27 #include <basegfx/range/b2drange.hxx>
29 #include <com/sun/star/lang/Locale.hpp>
30 #include <basegfx/polygon/b2dpolypolygon.hxx>
32 //////////////////////////////////////////////////////////////////////////////
40 namespace drawinglayer
{ namespace attribute
{
44 //////////////////////////////////////////////////////////////////////////////
45 // access to one global impTimedRefDev incarnation in namespace drawinglayer::primitive
47 namespace drawinglayer
51 /** TextLayouterDevice class
53 This helper class exists to isolate all accesses to VCL
54 text formatting/handling functionality for primitive implementations.
55 When in the future FontHandling may move to an own library independent
56 from VCL, primitives will be prepared.
58 class DRAWINGLAYER_DLLPUBLIC TextLayouterDevice
60 /// internally used VirtualDevice
61 VirtualDevice
& mrDevice
;
64 /// constructor/destructor
66 ~TextLayouterDevice();
69 void setFont(const Font
& rFont
);
70 void setFontAttribute(
71 const attribute::FontAttribute
& rFontAttribute
,
74 const ::com::sun::star::lang::Locale
& rLocale
);
76 double getTextHeight() const;
77 double getOverlineHeight() const;
78 double getOverlineOffset() const;
79 double getUnderlineHeight() const;
80 double getUnderlineOffset() const;
81 double getStrikeoutOffset() const;
86 sal_uInt32 nLength
) const;
89 basegfx::B2DPolyPolygonVector
&,
93 const ::std::vector
< double >& rDXArray
) const;
95 basegfx::B2DRange
getTextBoundRect(
98 sal_uInt32 nLength
) const;
100 double getFontAscent() const;
101 double getFontDescent() const;
103 void addTextRectActions(
104 const Rectangle
& rRectangle
,
107 GDIMetaFile
& rGDIMetaFile
) const;
109 ::std::vector
< double > getTextArray(
112 sal_uInt32 nLength
) const;
114 } // end of namespace primitive2d
115 } // end of namespace drawinglayer
117 //////////////////////////////////////////////////////////////////////////////
118 // helper methods for vcl font handling
120 namespace drawinglayer
122 namespace primitive2d
124 /** Create a VCL-Font based on the definitions in FontAttribute
125 and the given FontScaling. The FontScaling defines the FontHeight
126 (fFontScaleY) and the FontWidth (fFontScaleX). The combination of
127 both defines FontStretching, where no stretching happens at
128 fFontScaleY == fFontScaleX
130 Font DRAWINGLAYER_DLLPUBLIC
getVclFontFromFontAttribute(
131 const attribute::FontAttribute
& rFontAttribute
,
134 double fFontRotation
,
135 const ::com::sun::star::lang::Locale
& rLocale
);
137 /** Generate FontAttribute DataSet derived from the given VCL-Font.
138 The FontScaling with fFontScaleY, fFontScaleX relationship (see
139 above) will be set in return parameter o_rSize to allow further
142 attribute::FontAttribute DRAWINGLAYER_DLLPUBLIC
getFontAttributeFromVclFont(
143 basegfx::B2DVector
& o_rSize
,
148 } // end of namespace primitive2d
149 } // end of namespace drawinglayer
151 //////////////////////////////////////////////////////////////////////////////
153 #endif //_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */