build fix
[LibreOffice.git] / filter / source / svg / units.hxx
blob06b7217c1b6c8020c125eee109ea4948a1aeed00
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/.
8 */
9 #ifndef INCLUDED_FILTER_SOURCE_SVG_UNITS_HXX
10 #define INCLUDED_FILTER_SOURCE_SVG_UNITS_HXX
12 #include <sal/config.h>
13 #include <rtl/ustring.hxx>
15 namespace svgi
17 // recommended value for this device dependent unit, see CSS2 section 4.3.2 Lengths
18 // Same as in svgio
19 #define F_SVG_PIXEL_PER_INCH 90.0
21 struct State;
22 enum SvgUnit
24 SVG_LENGTH_UNIT_CM,
25 SVG_LENGTH_UNIT_EM,
26 SVG_LENGTH_UNIT_EX,
27 SVG_LENGTH_UNIT_IN,
28 SVG_LENGTH_UNIT_MM,
29 SVG_LENGTH_UNIT_PC,
30 SVG_LENGTH_UNIT_PT,
31 SVG_LENGTH_UNIT_PX,
32 SVG_LENGTH_UNIT_PERCENTAGE,
33 SVG_LENGTH_UNIT_USER,
34 SVG_LENGTH_FONT_SIZE
37 /** return svg_length_t in 100th's of mm
38 @param fVal value to convert
39 @param unit unit the value is in
40 @param rState current state (needed for viewport dimensions etc.)
41 @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
43 double convLength( const OUString& sVal, SvgUnit unit, const State& rState, char dir );
45 /** return svg_length_t in 100th's of mm
46 @param sValue value to convert
47 @param rState current state (needed for viewport dimensions etc.)
48 @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
50 double convLength( const OUString& sValue, const State& rState, char dir );
52 inline double pt2mm(double fVal) { return fVal*25.4/72.0; }
53 inline double pt100thmm(double fVal) { return fVal*2540.0/72.0; }
55 } // namespace svgi
57 #endif
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */