Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * Jan Holesovsky <kendy@suse.cz>
17 : * Fridrich Strba <fridrich.strba@bluewin.ch>
18 : * Thorsten Behrens <tbehrens@novell.com>
19 : *
20 : * Contributor(s):
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 : #ifndef INCLUDED_UNITS_HXX
29 : #define INCLUDED_UNITS_HXX
30 :
31 : #include <sal/config.h>
32 :
33 : namespace rtl{ class OUString; }
34 : namespace svgi
35 : {
36 : struct State;
37 : enum SvgUnit
38 : {
39 : SVG_LENGTH_UNIT_CM,
40 : SVG_LENGTH_UNIT_EM,
41 : SVG_LENGTH_UNIT_EX,
42 : SVG_LENGTH_UNIT_IN,
43 : SVG_LENGTH_UNIT_MM,
44 : SVG_LENGTH_UNIT_PC,
45 : SVG_LENGTH_UNIT_PT,
46 : SVG_LENGTH_UNIT_PX,
47 : SVG_LENGTH_UNIT_PERCENTAGE,
48 : SVG_LENGTH_UNIT_USER
49 : };
50 :
51 : /** return svg_length_t in 100th's of mm
52 : @param fVal value to convert
53 : @param unit unit the value is in
54 : @param rState current state (needed for viewport dimensions etc.)
55 : @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
56 : */
57 : double convLength( double fVal, SvgUnit unit, const State& rState, char dir );
58 :
59 : /** return svg_length_t in 100th's of mm
60 : @param sValue value to convert
61 : @param rState current state (needed for viewport dimensions etc.)
62 : @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
63 : */
64 : double convLength( const rtl::OUString& sValue, const State& rState, char dir );
65 :
66 0 : inline double pt2mm(double fVal) { return fVal*25.4/72.0; }
67 0 : inline double pt100thmm(double fVal) { return fVal*2540.0/72.0; }
68 :
69 : } // namespace svgi
70 :
71 : #endif
72 :
73 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|