2 Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2006 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
28 //#include "PlatformString.h"
33 class SVGStyledElement
;
36 LengthTypeUnknown
= 0,
38 LengthTypePercentage
= 2,
57 // Forward declare these enums in the w3c naming scheme, for IDL generation
59 SVG_LENGTHTYPE_UNKNOWN
= LengthTypeUnknown
,
60 SVG_LENGTHTYPE_NUMBER
= LengthTypeNumber
,
61 SVG_LENGTHTYPE_PERCENTAGE
= LengthTypePercentage
,
62 SVG_LENGTHTYPE_EMS
= LengthTypeEMS
,
63 SVG_LENGTHTYPE_EXS
= LengthTypeEXS
,
64 SVG_LENGTHTYPE_PX
= LengthTypePX
,
65 SVG_LENGTHTYPE_CM
= LengthTypeCM
,
66 SVG_LENGTHTYPE_MM
= LengthTypeMM
,
67 SVG_LENGTHTYPE_IN
= LengthTypeIN
,
68 SVG_LENGTHTYPE_PT
= LengthTypePT
,
69 SVG_LENGTHTYPE_PC
= LengthTypePC
72 SVGLength(const SVGStyledElement
* context
= 0, SVGLengthMode mode
= LengthModeOther
, const String
& valueAsString
= String());
74 // 'SVGLength' functions
75 SVGLengthType
unitType() const;
80 float valueInSpecifiedUnits() const;
81 void setValueInSpecifiedUnits(float);
83 float valueAsPercentage() const;
85 String
valueAsString() const;
86 bool setValueAsString(const String
&);
88 void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits
);
89 void convertToSpecifiedUnits(unsigned short);
92 static float PercentageOfViewport(float value
, const SVGStyledElement
*, SVGLengthMode
);
94 inline bool isRelative() const
96 SVGLengthType type
= unitType();
97 return (type
== LengthTypePercentage
|| type
== LengthTypeEMS
|| type
== LengthTypeEXS
);
101 float m_valueInSpecifiedUnits
;
104 const SVGStyledElement
* m_context
;
107 } // namespace WebCore
109 #endif // ENABLE(SVG)
110 #endif // SVGLength_h