ImportHelpers.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2004 Nicolas GOUTTE <goutte@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef _IMPORT_HELPERS_H
21#define _IMPORT_HELPERS_H
22
23#include <tqstring.h>
24#include <tqmap.h>
25
34class AbiProps
35{
36public:
37 AbiProps() {};
38 AbiProps(TQString newValue) : m_value(newValue) {};
39 virtual ~AbiProps() {};
40public:
41 inline TQString getValue(void) const { return m_value; }
42private:
43 TQString m_value;
44};
45
46class AbiPropsMap : public TQMap<TQString,AbiProps>
47{
48public:
49 AbiPropsMap() {};
50 virtual ~AbiPropsMap() {};
51public:
52 bool setProperty(const TQString& newName, const TQString& newValue);
53 void splitAndAddAbiProps(const TQString& strProps);
54};
55
56inline double CentimetresToPoints(const double d)
57{
58 return d * 72.0 / 2.54;
59}
60
61inline double MillimetresToPoints(const double d)
62{
63 return d * 72.0 / 25.4;
64}
65
66inline double InchesToPoints(const double d)
67{
68 return d * 72.0;
69}
70
71inline double PicaToPoints(const double d)
72{
73 // 1 pica = 12 pt
74 return d * 12.0;
75}
76
83double ValueWithLengthUnit( const TQString& _str, bool* atleast = NULL );
84
85#endif // _IMPORT_HELPERS_H
double ValueWithLengthUnit(const TQString &_str, bool *atleast=NULL)
Transform a value with unit (for example "12cm") into a double.