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