| /* |
| Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> |
| 2004, 2005 Rob Buis <buis@kde.org> |
| |
| This file is part of the KDE project |
| |
| This library is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Library General Public |
| License as published by the Free Software Foundation; either |
| version 2 of the License, or (at your option) any later version. |
| |
| This library is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Library General Public License for more details. |
| |
| You should have received a copy of the GNU Library General Public License |
| along with this library; see the file COPYING.LIB. If not, write to |
| the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| Boston, MA 02111-1307, USA. |
| */ |
| |
| #ifndef KSVG_SVGLengthImpl_H |
| #define KSVG_SVGLengthImpl_H |
| #ifdef SVG_SUPPORT |
| |
| #include "PlatformString.h" |
| #include <ksvg2/svg/SVGHelper.h> |
| |
| namespace WebCore { |
| |
| class RenderPath; |
| class SVGElement; |
| class SVGStyledElement; |
| |
| class SVGLength : public Shared<SVGLength> { |
| public: |
| SVGLength(const SVGStyledElement* context, LengthMode mode = LM_UNKNOWN, const SVGElement* viewport = 0); |
| virtual ~SVGLength(); |
| |
| enum SVGLengthType { |
| SVG_LENGTHTYPE_UNKNOWN = 0, |
| SVG_LENGTHTYPE_NUMBER = 1, |
| SVG_LENGTHTYPE_PERCENTAGE = 2, |
| SVG_LENGTHTYPE_EMS = 3, |
| SVG_LENGTHTYPE_EXS = 4, |
| SVG_LENGTHTYPE_PX = 5, |
| SVG_LENGTHTYPE_CM = 6, |
| SVG_LENGTHTYPE_MM = 7, |
| SVG_LENGTHTYPE_IN = 8, |
| SVG_LENGTHTYPE_PT = 9, |
| SVG_LENGTHTYPE_PC = 10 |
| }; |
| |
| // 'SVGLength' functions |
| unsigned short unitType() const; |
| |
| float value() const; |
| void setValue(float value); |
| |
| float valueInSpecifiedUnits() const; |
| void setValueInSpecifiedUnits(float valueInSpecifiedUnits); |
| |
| String valueAsString() const; |
| void setValueAsString(const String&); |
| |
| void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); |
| void convertToSpecifiedUnits(unsigned short unitType); |
| |
| // Helpers |
| bool bboxRelative() const; |
| void setBboxRelative(bool); |
| |
| const SVGStyledElement* context() const; |
| void setContext(const SVGStyledElement *context); |
| |
| private: |
| bool updateValueInSpecifiedUnits(bool notify = true); |
| void updateValue(bool notify = true); |
| |
| double dpi() const; |
| |
| float m_value; |
| float m_valueInSpecifiedUnits; |
| |
| unsigned m_mode : 2; // LengthMode |
| bool m_bboxRelative : 1; |
| unsigned m_unitType : 4; |
| bool m_requiresLayout : 1; |
| |
| const SVGStyledElement *m_context; |
| const SVGElement *m_viewportElement; |
| }; |
| |
| } // namespace WebCore |
| |
| #endif // SVG_SUPPORT |
| #endif // KSVG_SVGLengthImpl_H |
| |
| // vim:ts=4:noet |