Line data Source code
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 : */
12 : #ifndef INCLUDED_UNITS_HXX
13 : #define INCLUDED_UNITS_HXX
14 :
15 : #include <sal/config.h>
16 : #include <rtl/ustring.hxx>
17 :
18 : namespace svgi
19 : {
20 : struct State;
21 : enum SvgUnit
22 : {
23 : SVG_LENGTH_UNIT_CM,
24 : SVG_LENGTH_UNIT_EM,
25 : SVG_LENGTH_UNIT_EX,
26 : SVG_LENGTH_UNIT_IN,
27 : SVG_LENGTH_UNIT_MM,
28 : SVG_LENGTH_UNIT_PC,
29 : SVG_LENGTH_UNIT_PT,
30 : SVG_LENGTH_UNIT_PX,
31 : SVG_LENGTH_UNIT_PERCENTAGE,
32 : SVG_LENGTH_UNIT_USER
33 : };
34 :
35 : /** return svg_length_t in 100th's of mm
36 : @param fVal value to convert
37 : @param unit unit the value is in
38 : @param rState current state (needed for viewport dimensions etc.)
39 : @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
40 : */
41 : double convLength( double fVal, SvgUnit unit, const State& rState, char dir );
42 :
43 : /** return svg_length_t in 100th's of mm
44 : @param sValue value to convert
45 : @param rState current state (needed for viewport dimensions etc.)
46 : @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
47 : */
48 : double convLength( const OUString& sValue, const State& rState, char dir );
49 :
50 0 : inline double pt2mm(double fVal) { return fVal*25.4/72.0; }
51 0 : inline double pt100thmm(double fVal) { return fVal*2540.0/72.0; }
52 :
53 : } // namespace svgi
54 :
55 : #endif
56 :
57 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|