From 14d0fbe96c6abdb9da80e99953aec672f999948c Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 13 Dec 2020 19:22:19 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro --- ksvg/Makefile.am | 180 +-- ksvg/core/CMakeLists.txt | 2 +- ksvg/core/KSVGReader.cc | 504 -------- ksvg/core/KSVGReader.cpp | 504 ++++++++ ksvg/core/Makefile.am | 2 +- ksvg/data/SVGAElementImpl.lut.h | 2 +- ksvg/data/SVGAngleImpl.lut.h | 2 +- ksvg/data/SVGAnimatedAngleImpl.lut.h | 2 +- ksvg/data/SVGAnimatedBooleanImpl.lut.h | 2 +- ksvg/data/SVGAnimatedEnumerationImpl.lut.h | 2 +- ksvg/data/SVGAnimatedIntegerImpl.lut.h | 2 +- ksvg/data/SVGAnimatedLengthImpl.lut.h | 2 +- ksvg/data/SVGAnimatedLengthListImpl.lut.h | 2 +- ksvg/data/SVGAnimatedNumberImpl.lut.h | 2 +- ksvg/data/SVGAnimatedNumberListImpl.lut.h | 2 +- ksvg/data/SVGAnimatedPathDataImpl.lut.h | 2 +- ksvg/data/SVGAnimatedPointsImpl.lut.h | 2 +- ksvg/data/SVGAnimatedPreserveAspectRatioImpl.lut.h | 2 +- ksvg/data/SVGAnimatedRectImpl.lut.h | 2 +- ksvg/data/SVGAnimatedStringImpl.lut.h | 2 +- ksvg/data/SVGAnimatedTransformListImpl.lut.h | 2 +- ksvg/data/SVGAnimationElementImpl.lut.h | 2 +- ksvg/data/SVGCircleElementImpl.lut.h | 2 +- ksvg/data/SVGClipPathElementImpl.lut.h | 2 +- ksvg/data/SVGColorImpl.lut.h | 2 +- ksvg/data/SVGColorProfileElementImpl.lut.h | 2 +- ksvg/data/SVGCursorElementImpl.lut.h | 2 +- ksvg/data/SVGDocumentImpl.lut.h | 2 +- ksvg/data/SVGEcma.lut.h | 2 +- ksvg/data/SVGElementImpl.lut.h | 2 +- ksvg/data/SVGEllipseElementImpl.lut.h | 2 +- ksvg/data/SVGEventImpl.lut.h | 2 +- ksvg/data/SVGExternalResourcesRequiredImpl.lut.h | 2 +- ksvg/data/SVGFitToViewBoxImpl.lut.h | 2 +- ksvg/data/SVGForeignObjectElementImpl.lut.h | 2 +- ksvg/data/SVGGlyphElementImpl.lut.h | 2 +- ksvg/data/SVGGlyphRefElementImpl.lut.h | 2 +- ksvg/data/SVGGradientElementImpl.lut.h | 2 +- ksvg/data/SVGICCColorImpl.lut.h | 2 +- ksvg/data/SVGImageElementImpl.lut.h | 2 +- ksvg/data/SVGLangSpaceImpl.lut.h | 2 +- ksvg/data/SVGLengthImpl.lut.h | 2 +- ksvg/data/SVGLengthListImpl.lut.h | 2 +- ksvg/data/SVGLineElementImpl.lut.h | 2 +- ksvg/data/SVGLinearGradientElementImpl.lut.h | 2 +- ksvg/data/SVGLocatableImpl.lut.h | 2 +- ksvg/data/SVGMarkerElementImpl.lut.h | 2 +- ksvg/data/SVGMaskElementImpl.lut.h | 2 +- ksvg/data/SVGMatrixImpl.lut.h | 2 +- ksvg/data/SVGNumberImpl.lut.h | 2 +- ksvg/data/SVGNumberListImpl.lut.h | 2 +- ksvg/data/SVGPaintImpl.lut.h | 2 +- ksvg/data/SVGPathElementImpl.lut.h | 2 +- ksvg/data/SVGPathSegArcImpl.lut.h | 2 +- ksvg/data/SVGPathSegCurvetoCubicImpl.lut.h | 2 +- ksvg/data/SVGPathSegCurvetoCubicSmoothImpl.lut.h | 2 +- ksvg/data/SVGPathSegCurvetoQuadraticImpl.lut.h | 2 +- .../SVGPathSegCurvetoQuadraticSmoothImpl.lut.h | 2 +- ksvg/data/SVGPathSegImpl.lut.h | 2 +- ksvg/data/SVGPathSegLinetoHorizontalImpl.lut.h | 2 +- ksvg/data/SVGPathSegLinetoImpl.lut.h | 2 +- ksvg/data/SVGPathSegLinetoVerticalImpl.lut.h | 2 +- ksvg/data/SVGPathSegListImpl.lut.h | 2 +- ksvg/data/SVGPathSegMovetoImpl.lut.h | 2 +- ksvg/data/SVGPatternElementImpl.lut.h | 2 +- ksvg/data/SVGPointImpl.lut.h | 2 +- ksvg/data/SVGPointListImpl.lut.h | 2 +- ksvg/data/SVGPreserveAspectRatioImpl.lut.h | 2 +- ksvg/data/SVGRadialGradientElementImpl.lut.h | 2 +- ksvg/data/SVGRectElementImpl.lut.h | 2 +- ksvg/data/SVGRectImpl.lut.h | 2 +- ksvg/data/SVGSVGElementImpl.lut.h | 2 +- ksvg/data/SVGScriptElementImpl.lut.h | 2 +- ksvg/data/SVGStopElementImpl.lut.h | 2 +- ksvg/data/SVGStringListImpl.lut.h | 2 +- ksvg/data/SVGStylableImpl.lut.h | 2 +- ksvg/data/SVGStyleElementImpl.lut.h | 2 +- ksvg/data/SVGSymbolElementImpl.lut.h | 2 +- ksvg/data/SVGTestsImpl.lut.h | 2 +- ksvg/data/SVGTextContentElementImpl.lut.h | 2 +- ksvg/data/SVGTextPathElementImpl.lut.h | 2 +- ksvg/data/SVGTextPositioningElementImpl.lut.h | 2 +- ksvg/data/SVGTransformImpl.lut.h | 2 +- ksvg/data/SVGTransformListImpl.lut.h | 2 +- ksvg/data/SVGTransformableImpl.lut.h | 2 +- ksvg/data/SVGURIReferenceImpl.lut.h | 2 +- ksvg/data/SVGUseElementImpl.lut.h | 2 +- ksvg/data/SVGViewElementImpl.lut.h | 2 +- ksvg/data/SVGZoomAndPanImpl.lut.h | 2 +- ksvg/data/SVGZoomEventImpl.lut.h | 2 +- ksvg/dom/CMakeLists.txt | 92 +- ksvg/dom/Makefile.am | 42 +- ksvg/dom/SVGAElement.cc | 78 -- ksvg/dom/SVGAElement.cpp | 78 ++ ksvg/dom/SVGAltGlyphDefElement.cc | 65 - ksvg/dom/SVGAltGlyphDefElement.cpp | 65 + ksvg/dom/SVGAltGlyphElement.cc | 78 -- ksvg/dom/SVGAltGlyphElement.cpp | 78 ++ ksvg/dom/SVGAngle.cc | 118 -- ksvg/dom/SVGAngle.cpp | 118 ++ ksvg/dom/SVGAnimateColorElement.cc | 65 - ksvg/dom/SVGAnimateColorElement.cpp | 65 + ksvg/dom/SVGAnimateElement.cc | 65 - ksvg/dom/SVGAnimateElement.cpp | 65 + ksvg/dom/SVGAnimateMotionElement.cc | 63 - ksvg/dom/SVGAnimateMotionElement.cpp | 63 + ksvg/dom/SVGAnimateTransformElement.cc | 65 - ksvg/dom/SVGAnimateTransformElement.cpp | 65 + ksvg/dom/SVGAnimatedAngle.cc | 77 -- ksvg/dom/SVGAnimatedAngle.cpp | 77 ++ ksvg/dom/SVGAnimatedBoolean.cc | 82 -- ksvg/dom/SVGAnimatedBoolean.cpp | 82 ++ ksvg/dom/SVGAnimatedEnumeration.cc | 82 -- ksvg/dom/SVGAnimatedEnumeration.cpp | 82 ++ ksvg/dom/SVGAnimatedInteger.cc | 82 -- ksvg/dom/SVGAnimatedInteger.cpp | 82 ++ ksvg/dom/SVGAnimatedLength.cc | 77 -- ksvg/dom/SVGAnimatedLength.cpp | 77 ++ ksvg/dom/SVGAnimatedLengthList.cc | 76 -- ksvg/dom/SVGAnimatedLengthList.cpp | 76 ++ ksvg/dom/SVGAnimatedNumber.cc | 82 -- ksvg/dom/SVGAnimatedNumber.cpp | 82 ++ ksvg/dom/SVGAnimatedNumberList.cc | 76 -- ksvg/dom/SVGAnimatedNumberList.cpp | 76 ++ ksvg/dom/SVGAnimatedPathData.cc | 89 -- ksvg/dom/SVGAnimatedPathData.cpp | 89 ++ ksvg/dom/SVGAnimatedPoints.cc | 77 -- ksvg/dom/SVGAnimatedPoints.cpp | 77 ++ ksvg/dom/SVGAnimatedPreserveAspectRatio.cc | 77 -- ksvg/dom/SVGAnimatedPreserveAspectRatio.cpp | 77 ++ ksvg/dom/SVGAnimatedRect.cc | 77 -- ksvg/dom/SVGAnimatedRect.cpp | 77 ++ ksvg/dom/SVGAnimatedString.cc | 82 -- ksvg/dom/SVGAnimatedString.cpp | 82 ++ ksvg/dom/SVGAnimatedTransformList.cc | 77 -- ksvg/dom/SVGAnimatedTransformList.cpp | 77 ++ ksvg/dom/SVGAnimationElement.cc | 91 -- ksvg/dom/SVGAnimationElement.cpp | 91 ++ ksvg/dom/SVGCSSRule.cc | 64 - ksvg/dom/SVGCSSRule.cpp | 64 + ksvg/dom/SVGCircleElement.cc | 90 -- ksvg/dom/SVGCircleElement.cpp | 90 ++ ksvg/dom/SVGClipPathElement.cc | 77 -- ksvg/dom/SVGClipPathElement.cpp | 77 ++ ksvg/dom/SVGColor.cc | 103 -- ksvg/dom/SVGColor.cpp | 103 ++ ksvg/dom/SVGColorProfileElement.cc | 103 -- ksvg/dom/SVGColorProfileElement.cpp | 103 ++ ksvg/dom/SVGColorProfileRule.cc | 101 -- ksvg/dom/SVGColorProfileRule.cpp | 101 ++ ksvg/dom/SVGComponentTransferFunctionElement.cc | 110 -- ksvg/dom/SVGComponentTransferFunctionElement.cpp | 110 ++ ksvg/dom/SVGCursorElement.cc | 81 -- ksvg/dom/SVGCursorElement.cpp | 81 ++ ksvg/dom/SVGDefinitionSrcElement.cc | 65 - ksvg/dom/SVGDefinitionSrcElement.cpp | 65 + ksvg/dom/SVGDefsElement.cc | 70 -- ksvg/dom/SVGDefsElement.cpp | 70 ++ ksvg/dom/SVGDescElement.cc | 67 - ksvg/dom/SVGDescElement.cpp | 67 + ksvg/dom/SVGDocument.cc | 136 -- ksvg/dom/SVGDocument.cpp | 136 ++ ksvg/dom/SVGElement.cc | 122 -- ksvg/dom/SVGElement.cpp | 122 ++ ksvg/dom/SVGElementInstance.cc | 115 -- ksvg/dom/SVGElementInstance.cpp | 115 ++ ksvg/dom/SVGElementInstanceList.cc | 77 -- ksvg/dom/SVGElementInstanceList.cpp | 77 ++ ksvg/dom/SVGEllipseElement.cc | 96 -- ksvg/dom/SVGEllipseElement.cpp | 96 ++ ksvg/dom/SVGEvent.cc | 185 --- ksvg/dom/SVGEvent.cpp | 185 +++ ksvg/dom/SVGExternalResourcesRequired.cc | 63 - ksvg/dom/SVGExternalResourcesRequired.cpp | 63 + ksvg/dom/SVGFEBlendElement.cc | 86 -- ksvg/dom/SVGFEBlendElement.cpp | 86 ++ ksvg/dom/SVGFEColorMatrixElement.cc | 87 -- ksvg/dom/SVGFEColorMatrixElement.cpp | 87 ++ ksvg/dom/SVGFEComponentTransferElement.cc | 73 -- ksvg/dom/SVGFEComponentTransferElement.cpp | 73 ++ ksvg/dom/SVGFECompositeElement.cc | 111 -- ksvg/dom/SVGFECompositeElement.cpp | 111 ++ ksvg/dom/SVGFEConvolveMatrixElement.cc | 138 --- ksvg/dom/SVGFEConvolveMatrixElement.cpp | 138 +++ ksvg/dom/SVGFEDiffuseLightingElement.cc | 86 -- ksvg/dom/SVGFEDiffuseLightingElement.cpp | 86 ++ ksvg/dom/SVGFEDisplacementMapElement.cc | 99 -- ksvg/dom/SVGFEDisplacementMapElement.cpp | 99 ++ ksvg/dom/SVGFEDistantLightElement.cc | 78 -- ksvg/dom/SVGFEDistantLightElement.cpp | 78 ++ ksvg/dom/SVGFEFloodElement.cc | 74 -- ksvg/dom/SVGFEFloodElement.cpp | 74 ++ ksvg/dom/SVGFEFuncAElement.cc | 65 - ksvg/dom/SVGFEFuncAElement.cpp | 65 + ksvg/dom/SVGFEFuncBElement.cc | 65 - ksvg/dom/SVGFEFuncBElement.cpp | 65 + ksvg/dom/SVGFEFuncGElement.cc | 65 - ksvg/dom/SVGFEFuncGElement.cpp | 65 + ksvg/dom/SVGFEFuncRElement.cc | 65 - ksvg/dom/SVGFEFuncRElement.cpp | 65 + ksvg/dom/SVGFEGaussianBlurElement.cc | 92 -- ksvg/dom/SVGFEGaussianBlurElement.cpp | 92 ++ ksvg/dom/SVGFEImageElement.cc | 70 -- ksvg/dom/SVGFEImageElement.cpp | 70 ++ ksvg/dom/SVGFEMergeElement.cc | 66 - ksvg/dom/SVGFEMergeElement.cpp | 66 + ksvg/dom/SVGFEMergeNodeElement.cc | 72 -- ksvg/dom/SVGFEMergeNodeElement.cpp | 72 ++ ksvg/dom/SVGFEMorphologyElement.cc | 93 -- ksvg/dom/SVGFEMorphologyElement.cpp | 93 ++ ksvg/dom/SVGFEOffsetElement.cc | 86 -- ksvg/dom/SVGFEOffsetElement.cpp | 86 ++ ksvg/dom/SVGFEPointLightElement.cc | 84 -- ksvg/dom/SVGFEPointLightElement.cpp | 84 ++ ksvg/dom/SVGFESpecularLightingElement.cc | 92 -- ksvg/dom/SVGFESpecularLightingElement.cpp | 92 ++ ksvg/dom/SVGFESpotLightElement.cc | 114 -- ksvg/dom/SVGFESpotLightElement.cpp | 114 ++ ksvg/dom/SVGFETileElement.cc | 73 -- ksvg/dom/SVGFETileElement.cpp | 73 ++ ksvg/dom/SVGFETurbulenceElement.cc | 105 -- ksvg/dom/SVGFETurbulenceElement.cpp | 105 ++ ksvg/dom/SVGFilterElement.cc | 126 -- ksvg/dom/SVGFilterElement.cpp | 126 ++ ksvg/dom/SVGFilterPrimitiveStandardAttributes.cc | 86 -- ksvg/dom/SVGFilterPrimitiveStandardAttributes.cpp | 86 ++ ksvg/dom/SVGFitToViewBox.cc | 70 -- ksvg/dom/SVGFitToViewBox.cpp | 70 ++ ksvg/dom/SVGFontElement.cc | 67 - ksvg/dom/SVGFontElement.cpp | 67 + ksvg/dom/SVGFontFaceElement.cc | 65 - ksvg/dom/SVGFontFaceElement.cpp | 65 + ksvg/dom/SVGFontFaceFormatElement.cc | 65 - ksvg/dom/SVGFontFaceFormatElement.cpp | 65 + ksvg/dom/SVGFontFaceNameElement.cc | 65 - ksvg/dom/SVGFontFaceNameElement.cpp | 65 + ksvg/dom/SVGFontFaceSrcElement.cc | 65 - ksvg/dom/SVGFontFaceSrcElement.cpp | 65 + ksvg/dom/SVGFontFaceUriElement.cc | 65 - ksvg/dom/SVGFontFaceUriElement.cpp | 65 + ksvg/dom/SVGForeignObjectElement.cc | 95 -- ksvg/dom/SVGForeignObjectElement.cpp | 95 ++ ksvg/dom/SVGGElement.cc | 70 -- ksvg/dom/SVGGElement.cpp | 70 ++ ksvg/dom/SVGGlyphElement.cc | 66 - ksvg/dom/SVGGlyphElement.cpp | 66 + ksvg/dom/SVGGlyphRefElement.cc | 79 -- ksvg/dom/SVGGlyphRefElement.cpp | 79 ++ ksvg/dom/SVGGradientElement.cc | 78 -- ksvg/dom/SVGGradientElement.cpp | 78 ++ ksvg/dom/SVGHKernElement.cc | 65 - ksvg/dom/SVGHKernElement.cpp | 65 + ksvg/dom/SVGICCColor.cc | 83 -- ksvg/dom/SVGICCColor.cpp | 83 ++ ksvg/dom/SVGImageElement.cc | 104 -- ksvg/dom/SVGImageElement.cpp | 104 ++ ksvg/dom/SVGLangSpace.cc | 80 -- ksvg/dom/SVGLangSpace.cpp | 80 ++ ksvg/dom/SVGLength.cc | 133 -- ksvg/dom/SVGLength.cpp | 133 ++ ksvg/dom/SVGLengthList.cc | 113 -- ksvg/dom/SVGLengthList.cpp | 113 ++ ksvg/dom/SVGLineElement.cc | 96 -- ksvg/dom/SVGLineElement.cpp | 96 ++ ksvg/dom/SVGLinearGradientElement.cc | 90 -- ksvg/dom/SVGLinearGradientElement.cpp | 90 ++ ksvg/dom/SVGLocatable.cc | 95 -- ksvg/dom/SVGLocatable.cpp | 95 ++ ksvg/dom/SVGMPathElement.cc | 67 - ksvg/dom/SVGMPathElement.cpp | 67 + ksvg/dom/SVGMarkerElement.cc | 127 -- ksvg/dom/SVGMarkerElement.cpp | 127 ++ ksvg/dom/SVGMaskElement.cc | 107 -- ksvg/dom/SVGMaskElement.cpp | 107 ++ ksvg/dom/SVGMatrix.cc | 208 ---- ksvg/dom/SVGMatrix.cpp | 208 ++++ ksvg/dom/SVGMetadataElement.cc | 65 - ksvg/dom/SVGMetadataElement.cpp | 65 + ksvg/dom/SVGMissingGlyphElement.cc | 66 - ksvg/dom/SVGMissingGlyphElement.cpp | 66 + ksvg/dom/SVGNumber.cc | 76 -- ksvg/dom/SVGNumber.cpp | 76 ++ ksvg/dom/SVGNumberList.cc | 113 -- ksvg/dom/SVGNumberList.cpp | 113 ++ ksvg/dom/SVGPaint.cc | 91 -- ksvg/dom/SVGPaint.cpp | 91 ++ ksvg/dom/SVGPathElement.cc | 198 --- ksvg/dom/SVGPathElement.cpp | 198 +++ ksvg/dom/SVGPathSeg.cc | 67 - ksvg/dom/SVGPathSeg.cpp | 67 + ksvg/dom/SVGPathSegArc.cc | 236 ---- ksvg/dom/SVGPathSegArc.cpp | 236 ++++ ksvg/dom/SVGPathSegClosePath.cc | 44 - ksvg/dom/SVGPathSegClosePath.cpp | 44 + ksvg/dom/SVGPathSegCurvetoCubic.cc | 212 ---- ksvg/dom/SVGPathSegCurvetoCubic.cpp | 212 ++++ ksvg/dom/SVGPathSegCurvetoCubicSmooth.cc | 164 --- ksvg/dom/SVGPathSegCurvetoCubicSmooth.cpp | 164 +++ ksvg/dom/SVGPathSegCurvetoQuadratic.cc | 164 --- ksvg/dom/SVGPathSegCurvetoQuadratic.cpp | 164 +++ ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cc | 116 -- ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cpp | 116 ++ ksvg/dom/SVGPathSegLineto.cc | 116 -- ksvg/dom/SVGPathSegLineto.cpp | 116 ++ ksvg/dom/SVGPathSegLinetoHorizontal.cc | 92 -- ksvg/dom/SVGPathSegLinetoHorizontal.cpp | 92 ++ ksvg/dom/SVGPathSegLinetoVertical.cc | 92 -- ksvg/dom/SVGPathSegLinetoVertical.cpp | 92 ++ ksvg/dom/SVGPathSegList.cc | 112 -- ksvg/dom/SVGPathSegList.cpp | 112 ++ ksvg/dom/SVGPathSegMoveto.cc | 116 -- ksvg/dom/SVGPathSegMoveto.cpp | 116 ++ ksvg/dom/SVGPatternElement.cc | 115 -- ksvg/dom/SVGPatternElement.cpp | 115 ++ ksvg/dom/SVGPoint.cc | 95 -- ksvg/dom/SVGPoint.cpp | 95 ++ ksvg/dom/SVGPointList.cc | 114 -- ksvg/dom/SVGPointList.cpp | 114 ++ ksvg/dom/SVGPolygonElement.cc | 84 -- ksvg/dom/SVGPolygonElement.cpp | 84 ++ ksvg/dom/SVGPolylineElement.cc | 85 -- ksvg/dom/SVGPolylineElement.cpp | 85 ++ ksvg/dom/SVGPreserveAspectRatio.cc | 79 -- ksvg/dom/SVGPreserveAspectRatio.cpp | 79 ++ ksvg/dom/SVGRadialGradientElement.cc | 96 -- ksvg/dom/SVGRadialGradientElement.cpp | 96 ++ ksvg/dom/SVGRect.cc | 112 -- ksvg/dom/SVGRect.cpp | 112 ++ ksvg/dom/SVGRectElement.cc | 107 -- ksvg/dom/SVGRectElement.cpp | 107 ++ ksvg/dom/SVGSVGElement.cc | 335 ----- ksvg/dom/SVGSVGElement.cpp | 335 +++++ ksvg/dom/SVGScriptElement.cc | 79 -- ksvg/dom/SVGScriptElement.cpp | 79 ++ ksvg/dom/SVGSetElement.cc | 65 - ksvg/dom/SVGSetElement.cpp | 65 + ksvg/dom/SVGStopElement.cc | 73 -- ksvg/dom/SVGStopElement.cpp | 73 ++ ksvg/dom/SVGStringList.cc | 113 -- ksvg/dom/SVGStringList.cpp | 113 ++ ksvg/dom/SVGStylable.cc | 74 -- ksvg/dom/SVGStylable.cpp | 74 ++ ksvg/dom/SVGStyleElement.cc | 113 -- ksvg/dom/SVGStyleElement.cpp | 113 ++ ksvg/dom/SVGSwitchElement.cc | 70 -- ksvg/dom/SVGSwitchElement.cpp | 70 ++ ksvg/dom/SVGSymbolElement.cc | 69 -- ksvg/dom/SVGSymbolElement.cpp | 69 ++ ksvg/dom/SVGTRefElement.cc | 66 - ksvg/dom/SVGTRefElement.cpp | 66 + ksvg/dom/SVGTSpanElement.cc | 65 - ksvg/dom/SVGTSpanElement.cpp | 65 + ksvg/dom/SVGTests.cc | 81 -- ksvg/dom/SVGTests.cpp | 81 ++ ksvg/dom/SVGTextContentElement.cc | 120 -- ksvg/dom/SVGTextContentElement.cpp | 120 ++ ksvg/dom/SVGTextElement.cc | 68 - ksvg/dom/SVGTextElement.cpp | 68 + ksvg/dom/SVGTextPathElement.cc | 87 -- ksvg/dom/SVGTextPathElement.cpp | 87 ++ ksvg/dom/SVGTextPositioningElement.cc | 85 -- ksvg/dom/SVGTextPositioningElement.cpp | 85 ++ ksvg/dom/SVGTitleElement.cc | 67 - ksvg/dom/SVGTitleElement.cpp | 67 + ksvg/dom/SVGTransform.cc | 117 -- ksvg/dom/SVGTransform.cpp | 117 ++ ksvg/dom/SVGTransformList.cc | 127 -- ksvg/dom/SVGTransformList.cpp | 127 ++ ksvg/dom/SVGTransformable.cc | 65 - ksvg/dom/SVGTransformable.cpp | 65 + ksvg/dom/SVGURIReference.cc | 61 - ksvg/dom/SVGURIReference.cpp | 61 + ksvg/dom/SVGUseElement.cc | 109 -- ksvg/dom/SVGUseElement.cpp | 109 ++ ksvg/dom/SVGVKernElement.cc | 65 - ksvg/dom/SVGVKernElement.cpp | 65 + ksvg/dom/SVGViewElement.cc | 75 -- ksvg/dom/SVGViewElement.cpp | 75 ++ ksvg/dom/SVGViewSpec.cc | 105 -- ksvg/dom/SVGViewSpec.cpp | 105 ++ ksvg/dom/SVGWindow.cc | 173 --- ksvg/dom/SVGWindow.cpp | 173 +++ ksvg/dom/SVGZoomAndPan.cc | 68 - ksvg/dom/SVGZoomAndPan.cpp | 68 + ksvg/dom/SVGZoomEvent.cc | 97 -- ksvg/dom/SVGZoomEvent.cpp | 97 ++ ksvg/impl/CMakeLists.txt | 118 +- ksvg/impl/Makefile.am | 118 +- ksvg/impl/SVGAElementImpl.cc | 115 -- ksvg/impl/SVGAElementImpl.cpp | 115 ++ ksvg/impl/SVGAltGlyphDefElementImpl.cc | 31 - ksvg/impl/SVGAltGlyphDefElementImpl.cpp | 31 + ksvg/impl/SVGAltGlyphElementImpl.cc | 47 - ksvg/impl/SVGAltGlyphElementImpl.cpp | 47 + ksvg/impl/SVGAngleImpl.cc | 275 ---- ksvg/impl/SVGAngleImpl.cpp | 275 ++++ ksvg/impl/SVGAnimateColorElementImpl.cc | 96 -- ksvg/impl/SVGAnimateColorElementImpl.cpp | 96 ++ ksvg/impl/SVGAnimateElementImpl.cc | 189 --- ksvg/impl/SVGAnimateElementImpl.cpp | 189 +++ ksvg/impl/SVGAnimateMotionElementImpl.cc | 100 -- ksvg/impl/SVGAnimateMotionElementImpl.cpp | 100 ++ ksvg/impl/SVGAnimateTransformElementImpl.cc | 255 ---- ksvg/impl/SVGAnimateTransformElementImpl.cpp | 255 ++++ ksvg/impl/SVGAnimatedAngleImpl.cc | 81 -- ksvg/impl/SVGAnimatedAngleImpl.cpp | 81 ++ ksvg/impl/SVGAnimatedBooleanImpl.cc | 91 -- ksvg/impl/SVGAnimatedBooleanImpl.cpp | 91 ++ ksvg/impl/SVGAnimatedEnumerationImpl.cc | 91 -- ksvg/impl/SVGAnimatedEnumerationImpl.cpp | 91 ++ ksvg/impl/SVGAnimatedIntegerImpl.cc | 89 -- ksvg/impl/SVGAnimatedIntegerImpl.cpp | 89 ++ ksvg/impl/SVGAnimatedLengthImpl.cc | 94 -- ksvg/impl/SVGAnimatedLengthImpl.cpp | 94 ++ ksvg/impl/SVGAnimatedLengthListImpl.cc | 93 -- ksvg/impl/SVGAnimatedLengthListImpl.cpp | 93 ++ ksvg/impl/SVGAnimatedNumberImpl.cc | 92 -- ksvg/impl/SVGAnimatedNumberImpl.cpp | 92 ++ ksvg/impl/SVGAnimatedNumberListImpl.cc | 80 -- ksvg/impl/SVGAnimatedNumberListImpl.cpp | 80 ++ ksvg/impl/SVGAnimatedPathDataImpl.cc | 106 -- ksvg/impl/SVGAnimatedPathDataImpl.cpp | 106 ++ ksvg/impl/SVGAnimatedPointsImpl.cc | 137 -- ksvg/impl/SVGAnimatedPointsImpl.cpp | 137 ++ ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cc | 81 -- ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cpp | 81 ++ ksvg/impl/SVGAnimatedRectImpl.cc | 79 -- ksvg/impl/SVGAnimatedRectImpl.cpp | 79 ++ ksvg/impl/SVGAnimatedStringImpl.cc | 88 -- ksvg/impl/SVGAnimatedStringImpl.cpp | 88 ++ ksvg/impl/SVGAnimatedTransformListImpl.cc | 81 -- ksvg/impl/SVGAnimatedTransformListImpl.cpp | 81 ++ ksvg/impl/SVGAnimationElementImpl.cc | 463 ------- ksvg/impl/SVGAnimationElementImpl.cpp | 463 +++++++ ksvg/impl/SVGBBoxTarget.cc | 53 - ksvg/impl/SVGBBoxTarget.cpp | 53 + ksvg/impl/SVGCSSRuleImpl.cc | 31 - ksvg/impl/SVGCSSRuleImpl.cpp | 31 + ksvg/impl/SVGCircleElementImpl.cc | 176 --- ksvg/impl/SVGCircleElementImpl.cpp | 176 +++ ksvg/impl/SVGClipPathElementImpl.cc | 102 -- ksvg/impl/SVGClipPathElementImpl.cpp | 102 ++ ksvg/impl/SVGColorImpl.cc | 538 -------- ksvg/impl/SVGColorImpl.cpp | 538 ++++++++ ksvg/impl/SVGColorProfileElementImpl.cc | 269 ---- ksvg/impl/SVGColorProfileElementImpl.cpp | 269 ++++ ksvg/impl/SVGColorProfileRuleImpl.cc | 61 - ksvg/impl/SVGColorProfileRuleImpl.cpp | 61 + .../SVGComponentTransferFunctionElementImpl.cc | 103 -- .../SVGComponentTransferFunctionElementImpl.cpp | 103 ++ ksvg/impl/SVGContainerImpl.cc | 133 -- ksvg/impl/SVGContainerImpl.cpp | 133 ++ ksvg/impl/SVGCursorElementImpl.cc | 102 -- ksvg/impl/SVGCursorElementImpl.cpp | 102 ++ ksvg/impl/SVGDefinitionSrcElementImpl.cc | 31 - ksvg/impl/SVGDefinitionSrcElementImpl.cpp | 31 + ksvg/impl/SVGDefsElementImpl.cc | 32 - ksvg/impl/SVGDefsElementImpl.cpp | 32 + ksvg/impl/SVGDescElementImpl.cc | 37 - ksvg/impl/SVGDescElementImpl.cpp | 37 + ksvg/impl/SVGDocumentImpl.cc | 703 ----------- ksvg/impl/SVGDocumentImpl.cpp | 703 +++++++++++ ksvg/impl/SVGEcma.cc | 842 ------------- ksvg/impl/SVGEcma.cpp | 842 +++++++++++++ ksvg/impl/SVGElementImpl.cc | 711 ----------- ksvg/impl/SVGElementImpl.cpp | 711 +++++++++++ ksvg/impl/SVGElementInstanceImpl.cc | 106 -- ksvg/impl/SVGElementInstanceImpl.cpp | 106 ++ ksvg/impl/SVGElementInstanceListImpl.cc | 42 - ksvg/impl/SVGElementInstanceListImpl.cpp | 42 + ksvg/impl/SVGEllipseElementImpl.cc | 198 --- ksvg/impl/SVGEllipseElementImpl.cpp | 198 +++ ksvg/impl/SVGEventImpl.cc | 990 --------------- ksvg/impl/SVGEventImpl.cpp | 990 +++++++++++++++ ksvg/impl/SVGExternalResourcesRequiredImpl.cc | 86 -- ksvg/impl/SVGExternalResourcesRequiredImpl.cpp | 86 ++ ksvg/impl/SVGFEBlendElementImpl.cc | 62 - ksvg/impl/SVGFEBlendElementImpl.cpp | 62 + ksvg/impl/SVGFEColorMatrixElementImpl.cc | 63 - ksvg/impl/SVGFEColorMatrixElementImpl.cpp | 63 + ksvg/impl/SVGFEComponentTransferElementImpl.cc | 41 - ksvg/impl/SVGFEComponentTransferElementImpl.cpp | 41 + ksvg/impl/SVGFECompositeElementImpl.cc | 103 -- ksvg/impl/SVGFECompositeElementImpl.cpp | 103 ++ ksvg/impl/SVGFEConvolveMatrixElementImpl.cc | 147 --- ksvg/impl/SVGFEConvolveMatrixElementImpl.cpp | 147 +++ ksvg/impl/SVGFEDiffuseLightingElementImpl.cc | 62 - ksvg/impl/SVGFEDiffuseLightingElementImpl.cpp | 62 + ksvg/impl/SVGFEDisplacementMapElementImpl.cc | 83 -- ksvg/impl/SVGFEDisplacementMapElementImpl.cpp | 83 ++ ksvg/impl/SVGFEDistantLightElementImpl.cc | 51 - ksvg/impl/SVGFEDistantLightElementImpl.cpp | 51 + ksvg/impl/SVGFEFloodElementImpl.cc | 41 - ksvg/impl/SVGFEFloodElementImpl.cpp | 41 + ksvg/impl/SVGFEFuncAElementImpl.cc | 31 - ksvg/impl/SVGFEFuncAElementImpl.cpp | 31 + ksvg/impl/SVGFEFuncBElementImpl.cc | 31 - ksvg/impl/SVGFEFuncBElementImpl.cpp | 31 + ksvg/impl/SVGFEFuncGElementImpl.cc | 31 - ksvg/impl/SVGFEFuncGElementImpl.cpp | 31 + ksvg/impl/SVGFEFuncRElementImpl.cc | 31 - ksvg/impl/SVGFEFuncRElementImpl.cpp | 31 + ksvg/impl/SVGFEGaussianBlurElementImpl.cc | 66 - ksvg/impl/SVGFEGaussianBlurElementImpl.cpp | 66 + ksvg/impl/SVGFEImageElementImpl.cc | 31 - ksvg/impl/SVGFEImageElementImpl.cpp | 31 + ksvg/impl/SVGFEMergeElementImpl.cc | 31 - ksvg/impl/SVGFEMergeElementImpl.cpp | 31 + ksvg/impl/SVGFEMergeNodeElementImpl.cc | 41 - ksvg/impl/SVGFEMergeNodeElementImpl.cpp | 41 + ksvg/impl/SVGFEMorphologyElementImpl.cc | 73 -- ksvg/impl/SVGFEMorphologyElementImpl.cpp | 73 ++ ksvg/impl/SVGFEOffsetElementImpl.cc | 62 - ksvg/impl/SVGFEOffsetElementImpl.cpp | 62 + ksvg/impl/SVGFEPointLightElementImpl.cc | 61 - ksvg/impl/SVGFEPointLightElementImpl.cpp | 61 + ksvg/impl/SVGFESpecularLightingElementImpl.cc | 72 -- ksvg/impl/SVGFESpecularLightingElementImpl.cpp | 72 ++ ksvg/impl/SVGFESpotLightElementImpl.cc | 111 -- ksvg/impl/SVGFESpotLightElementImpl.cpp | 111 ++ ksvg/impl/SVGFETileElementImpl.cc | 41 - ksvg/impl/SVGFETileElementImpl.cpp | 41 + ksvg/impl/SVGFETurbulenceElementImpl.cc | 98 -- ksvg/impl/SVGFETurbulenceElementImpl.cpp | 98 ++ ksvg/impl/SVGFilterElementImpl.cc | 117 -- ksvg/impl/SVGFilterElementImpl.cpp | 117 ++ .../SVGFilterPrimitiveStandardAttributesImpl.cc | 82 -- .../SVGFilterPrimitiveStandardAttributesImpl.cpp | 82 ++ ksvg/impl/SVGFitToViewBoxImpl.cc | 139 --- ksvg/impl/SVGFitToViewBoxImpl.cpp | 139 +++ ksvg/impl/SVGFontElementImpl.cc | 31 - ksvg/impl/SVGFontElementImpl.cpp | 31 + ksvg/impl/SVGFontFaceElementImpl.cc | 31 - ksvg/impl/SVGFontFaceElementImpl.cpp | 31 + ksvg/impl/SVGFontFaceFormatElementImpl.cc | 31 - ksvg/impl/SVGFontFaceFormatElementImpl.cpp | 31 + ksvg/impl/SVGFontFaceNameElementImpl.cc | 31 - ksvg/impl/SVGFontFaceNameElementImpl.cpp | 31 + ksvg/impl/SVGFontFaceSrcElementImpl.cc | 31 - ksvg/impl/SVGFontFaceSrcElementImpl.cpp | 31 + ksvg/impl/SVGFontFaceUriElementImpl.cc | 31 - ksvg/impl/SVGFontFaceUriElementImpl.cpp | 31 + ksvg/impl/SVGForeignObjectElementImpl.cc | 119 -- ksvg/impl/SVGForeignObjectElementImpl.cpp | 119 ++ ksvg/impl/SVGGElementImpl.cc | 34 - ksvg/impl/SVGGElementImpl.cpp | 34 + ksvg/impl/SVGGlyphElementImpl.cc | 96 -- ksvg/impl/SVGGlyphElementImpl.cpp | 96 ++ ksvg/impl/SVGGlyphRefElementImpl.cc | 132 -- ksvg/impl/SVGGlyphRefElementImpl.cpp | 132 ++ ksvg/impl/SVGGradientElementImpl.cc | 262 ---- ksvg/impl/SVGGradientElementImpl.cpp | 262 ++++ ksvg/impl/SVGHKernElementImpl.cc | 31 - ksvg/impl/SVGHKernElementImpl.cpp | 31 + ksvg/impl/SVGHelperImpl.cc | 228 ---- ksvg/impl/SVGHelperImpl.cpp | 228 ++++ ksvg/impl/SVGICCColorImpl.cc | 105 -- ksvg/impl/SVGICCColorImpl.cpp | 105 ++ ksvg/impl/SVGImageElementImpl.cc | 520 -------- ksvg/impl/SVGImageElementImpl.cpp | 520 ++++++++ ksvg/impl/SVGLangSpaceImpl.cc | 128 -- ksvg/impl/SVGLangSpaceImpl.cpp | 128 ++ ksvg/impl/SVGLengthImpl.cc | 508 -------- ksvg/impl/SVGLengthImpl.cpp | 508 ++++++++ ksvg/impl/SVGLengthListImpl.cc | 62 - ksvg/impl/SVGLengthListImpl.cpp | 62 + ksvg/impl/SVGLineElementImpl.cc | 211 ---- ksvg/impl/SVGLineElementImpl.cpp | 211 ++++ ksvg/impl/SVGLinearGradientElementImpl.cc | 199 --- ksvg/impl/SVGLinearGradientElementImpl.cpp | 199 +++ ksvg/impl/SVGLocatableImpl.cc | 206 --- ksvg/impl/SVGLocatableImpl.cpp | 206 +++ ksvg/impl/SVGMPathElementImpl.cc | 31 - ksvg/impl/SVGMPathElementImpl.cpp | 31 + ksvg/impl/SVGMarkerElementImpl.cc | 422 ------- ksvg/impl/SVGMarkerElementImpl.cpp | 422 +++++++ ksvg/impl/SVGMaskElementImpl.cc | 540 -------- ksvg/impl/SVGMaskElementImpl.cpp | 540 ++++++++ ksvg/impl/SVGMatrixImpl.cc | 458 ------- ksvg/impl/SVGMatrixImpl.cpp | 458 +++++++ ksvg/impl/SVGMetadataElementImpl.cc | 31 - ksvg/impl/SVGMetadataElementImpl.cpp | 31 + ksvg/impl/SVGMissingGlyphElementImpl.cc | 31 - ksvg/impl/SVGMissingGlyphElementImpl.cpp | 31 + ksvg/impl/SVGNumberImpl.cc | 81 -- ksvg/impl/SVGNumberImpl.cpp | 81 ++ ksvg/impl/SVGNumberListImpl.cc | 62 - ksvg/impl/SVGNumberListImpl.cpp | 62 + ksvg/impl/SVGPaintImpl.cc | 173 --- ksvg/impl/SVGPaintImpl.cpp | 173 +++ ksvg/impl/SVGPaintServerImpl.cc | 52 - ksvg/impl/SVGPaintServerImpl.cpp | 52 + ksvg/impl/SVGPathElementImpl.cc | 866 ------------- ksvg/impl/SVGPathElementImpl.cpp | 866 +++++++++++++ ksvg/impl/SVGPathSegArcImpl.cc | 493 -------- ksvg/impl/SVGPathSegArcImpl.cpp | 493 ++++++++ ksvg/impl/SVGPathSegClosePathImpl.cc | 44 - ksvg/impl/SVGPathSegClosePathImpl.cpp | 44 + ksvg/impl/SVGPathSegCurvetoCubicImpl.cc | 323 ----- ksvg/impl/SVGPathSegCurvetoCubicImpl.cpp | 323 +++++ ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cc | 296 ----- ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cpp | 296 +++++ ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cc | 258 ---- ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cpp | 258 ++++ ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cc | 233 ---- ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cpp | 233 ++++ ksvg/impl/SVGPathSegImpl.cc | 105 -- ksvg/impl/SVGPathSegImpl.cpp | 105 ++ ksvg/impl/SVGPathSegLinetoHorizontalImpl.cc | 165 --- ksvg/impl/SVGPathSegLinetoHorizontalImpl.cpp | 165 +++ ksvg/impl/SVGPathSegLinetoImpl.cc | 194 --- ksvg/impl/SVGPathSegLinetoImpl.cpp | 194 +++ ksvg/impl/SVGPathSegLinetoVerticalImpl.cc | 163 --- ksvg/impl/SVGPathSegLinetoVerticalImpl.cpp | 163 +++ ksvg/impl/SVGPathSegListImpl.cc | 62 - ksvg/impl/SVGPathSegListImpl.cpp | 62 + ksvg/impl/SVGPathSegMovetoImpl.cc | 194 --- ksvg/impl/SVGPathSegMovetoImpl.cpp | 194 +++ ksvg/impl/SVGPatternElementImpl.cc | 509 -------- ksvg/impl/SVGPatternElementImpl.cpp | 509 ++++++++ ksvg/impl/SVGPointImpl.cc | 106 -- ksvg/impl/SVGPointImpl.cpp | 106 ++ ksvg/impl/SVGPointListImpl.cc | 62 - ksvg/impl/SVGPointListImpl.cpp | 62 + ksvg/impl/SVGPolyElementImpl.cc | 139 --- ksvg/impl/SVGPolyElementImpl.cpp | 139 +++ ksvg/impl/SVGPolygonElementImpl.cc | 86 -- ksvg/impl/SVGPolygonElementImpl.cpp | 86 ++ ksvg/impl/SVGPolylineElementImpl.cc | 98 -- ksvg/impl/SVGPolylineElementImpl.cpp | 98 ++ ksvg/impl/SVGPreserveAspectRatioImpl.cc | 215 ---- ksvg/impl/SVGPreserveAspectRatioImpl.cpp | 215 ++++ ksvg/impl/SVGRadialGradientElementImpl.cc | 214 ---- ksvg/impl/SVGRadialGradientElementImpl.cpp | 214 ++++ ksvg/impl/SVGRectElementImpl.cc | 242 ---- ksvg/impl/SVGRectElementImpl.cpp | 242 ++++ ksvg/impl/SVGRectImpl.cc | 155 --- ksvg/impl/SVGRectImpl.cpp | 155 +++ ksvg/impl/SVGSVGElementImpl.cc | 980 --------------- ksvg/impl/SVGSVGElementImpl.cpp | 980 +++++++++++++++ ksvg/impl/SVGScriptElementImpl.cc | 183 --- ksvg/impl/SVGScriptElementImpl.cpp | 183 +++ ksvg/impl/SVGSetElementImpl.cc | 46 - ksvg/impl/SVGSetElementImpl.cpp | 46 + ksvg/impl/SVGShapeImpl.cc | 160 --- ksvg/impl/SVGShapeImpl.cpp | 160 +++ ksvg/impl/SVGStopElementImpl.cc | 123 -- ksvg/impl/SVGStopElementImpl.cpp | 123 ++ ksvg/impl/SVGStringListImpl.cc | 91 -- ksvg/impl/SVGStringListImpl.cpp | 91 ++ ksvg/impl/SVGStylableImpl.cc | 1307 -------------------- ksvg/impl/SVGStylableImpl.cpp | 1307 ++++++++++++++++++++ ksvg/impl/SVGStyleElementImpl.cc | 133 -- ksvg/impl/SVGStyleElementImpl.cpp | 133 ++ ksvg/impl/SVGSwitchElementImpl.cc | 56 - ksvg/impl/SVGSwitchElementImpl.cpp | 56 + ksvg/impl/SVGSymbolElementImpl.cc | 104 -- ksvg/impl/SVGSymbolElementImpl.cpp | 104 ++ ksvg/impl/SVGTRefElementImpl.cc | 74 -- ksvg/impl/SVGTRefElementImpl.cpp | 74 ++ ksvg/impl/SVGTSpanElementImpl.cc | 62 - ksvg/impl/SVGTSpanElementImpl.cpp | 62 + ksvg/impl/SVGTestsImpl.cc | 176 --- ksvg/impl/SVGTestsImpl.cpp | 176 +++ ksvg/impl/SVGTextContentElementImpl.cc | 283 ----- ksvg/impl/SVGTextContentElementImpl.cpp | 283 +++++ ksvg/impl/SVGTextElementImpl.cc | 122 -- ksvg/impl/SVGTextElementImpl.cpp | 122 ++ ksvg/impl/SVGTextPathElementImpl.cc | 238 ---- ksvg/impl/SVGTextPathElementImpl.cpp | 238 ++++ ksvg/impl/SVGTextPositioningElementImpl.cc | 196 --- ksvg/impl/SVGTextPositioningElementImpl.cpp | 196 +++ ksvg/impl/SVGTimeScheduler.cc | 232 ---- ksvg/impl/SVGTimeScheduler.cpp | 232 ++++ ksvg/impl/SVGTitleElementImpl.cc | 37 - ksvg/impl/SVGTitleElementImpl.cpp | 37 + ksvg/impl/SVGTransformImpl.cc | 238 ---- ksvg/impl/SVGTransformImpl.cpp | 238 ++++ ksvg/impl/SVGTransformListImpl.cc | 101 -- ksvg/impl/SVGTransformListImpl.cpp | 101 ++ ksvg/impl/SVGTransformableImpl.cc | 167 --- ksvg/impl/SVGTransformableImpl.cpp | 167 +++ ksvg/impl/SVGURIReferenceImpl.cc | 133 -- ksvg/impl/SVGURIReferenceImpl.cpp | 133 ++ ksvg/impl/SVGUseElementImpl.cc | 407 ------ ksvg/impl/SVGUseElementImpl.cpp | 407 ++++++ ksvg/impl/SVGVKernElementImpl.cc | 31 - ksvg/impl/SVGVKernElementImpl.cpp | 31 + ksvg/impl/SVGViewElementImpl.cc | 92 -- ksvg/impl/SVGViewElementImpl.cpp | 92 ++ ksvg/impl/SVGViewSpecImpl.cc | 96 -- ksvg/impl/SVGViewSpecImpl.cpp | 96 ++ ksvg/impl/SVGWindowImpl.cc | 185 --- ksvg/impl/SVGWindowImpl.cpp | 185 +++ ksvg/impl/SVGZoomAndPanImpl.cc | 110 -- ksvg/impl/SVGZoomAndPanImpl.cpp | 110 ++ ksvg/impl/SVGZoomEventImpl.cc | 109 -- ksvg/impl/SVGZoomEventImpl.cpp | 109 ++ ksvg/impl/libs/libtext2path/src/Cache.h | 2 +- ksvg/impl/libs/libtext2path/src/Converter.cpp | 2 +- ksvg/impl/libs/libtext2path/src/myboost/assert.h | 24 + ksvg/impl/libs/libtext2path/src/myboost/assert.hpp | 24 - .../libs/libtext2path/src/myboost/checked_delete.h | 61 + .../libtext2path/src/myboost/checked_delete.hpp | 61 - .../libtext2path/src/myboost/lightweight_mutex.h | 74 ++ .../libtext2path/src/myboost/lightweight_mutex.hpp | 74 -- .../libs/libtext2path/src/myboost/shared_count.h | 367 ++++++ .../libs/libtext2path/src/myboost/shared_count.hpp | 367 ------ .../libs/libtext2path/src/myboost/shared_ptr.h | 395 ++++++ .../libs/libtext2path/src/myboost/shared_ptr.hpp | 395 ------ .../libtext2path/src/myboost/throw_exception.h | 30 + .../libtext2path/src/myboost/throw_exception.hpp | 30 - ksvg/impl/svgpathparser.cc | 564 --------- ksvg/impl/svgpathparser.cpp | 564 +++++++++ ksvg/scripts/check_hashtablesize.pl | 4 +- ksvg/scripts/gen.sh | 18 +- ksvg/scripts/genimpl.sh | 16 +- ksvg/scripts/getjs.php | 2 +- ksvg/scripts/makecc | 2 +- ksvg/scripts/makeimpl | 8 +- ksvg/test/external/CMakeLists.txt | 2 +- ksvg/test/external/Makefile.am | 2 +- ksvg/test/external/SVGTestWidget.cc | 204 --- ksvg/test/external/SVGTestWidget.cpp | 204 +++ ksvg/test/external/svgdisplay.cc | 32 - ksvg/test/external/svgdisplay.cpp | 32 + 726 files changed, 42764 insertions(+), 42764 deletions(-) delete mode 100644 ksvg/core/KSVGReader.cc create mode 100644 ksvg/core/KSVGReader.cpp delete mode 100644 ksvg/dom/SVGAElement.cc create mode 100644 ksvg/dom/SVGAElement.cpp delete mode 100644 ksvg/dom/SVGAltGlyphDefElement.cc create mode 100644 ksvg/dom/SVGAltGlyphDefElement.cpp delete mode 100644 ksvg/dom/SVGAltGlyphElement.cc create mode 100644 ksvg/dom/SVGAltGlyphElement.cpp delete mode 100644 ksvg/dom/SVGAngle.cc create mode 100644 ksvg/dom/SVGAngle.cpp delete mode 100644 ksvg/dom/SVGAnimateColorElement.cc create mode 100644 ksvg/dom/SVGAnimateColorElement.cpp delete mode 100644 ksvg/dom/SVGAnimateElement.cc create mode 100644 ksvg/dom/SVGAnimateElement.cpp delete mode 100644 ksvg/dom/SVGAnimateMotionElement.cc create mode 100644 ksvg/dom/SVGAnimateMotionElement.cpp delete mode 100644 ksvg/dom/SVGAnimateTransformElement.cc create mode 100644 ksvg/dom/SVGAnimateTransformElement.cpp delete mode 100644 ksvg/dom/SVGAnimatedAngle.cc create mode 100644 ksvg/dom/SVGAnimatedAngle.cpp delete mode 100644 ksvg/dom/SVGAnimatedBoolean.cc create mode 100644 ksvg/dom/SVGAnimatedBoolean.cpp delete mode 100644 ksvg/dom/SVGAnimatedEnumeration.cc create mode 100644 ksvg/dom/SVGAnimatedEnumeration.cpp delete mode 100644 ksvg/dom/SVGAnimatedInteger.cc create mode 100644 ksvg/dom/SVGAnimatedInteger.cpp delete mode 100644 ksvg/dom/SVGAnimatedLength.cc create mode 100644 ksvg/dom/SVGAnimatedLength.cpp delete mode 100644 ksvg/dom/SVGAnimatedLengthList.cc create mode 100644 ksvg/dom/SVGAnimatedLengthList.cpp delete mode 100644 ksvg/dom/SVGAnimatedNumber.cc create mode 100644 ksvg/dom/SVGAnimatedNumber.cpp delete mode 100644 ksvg/dom/SVGAnimatedNumberList.cc create mode 100644 ksvg/dom/SVGAnimatedNumberList.cpp delete mode 100644 ksvg/dom/SVGAnimatedPathData.cc create mode 100644 ksvg/dom/SVGAnimatedPathData.cpp delete mode 100644 ksvg/dom/SVGAnimatedPoints.cc create mode 100644 ksvg/dom/SVGAnimatedPoints.cpp delete mode 100644 ksvg/dom/SVGAnimatedPreserveAspectRatio.cc create mode 100644 ksvg/dom/SVGAnimatedPreserveAspectRatio.cpp delete mode 100644 ksvg/dom/SVGAnimatedRect.cc create mode 100644 ksvg/dom/SVGAnimatedRect.cpp delete mode 100644 ksvg/dom/SVGAnimatedString.cc create mode 100644 ksvg/dom/SVGAnimatedString.cpp delete mode 100644 ksvg/dom/SVGAnimatedTransformList.cc create mode 100644 ksvg/dom/SVGAnimatedTransformList.cpp delete mode 100644 ksvg/dom/SVGAnimationElement.cc create mode 100644 ksvg/dom/SVGAnimationElement.cpp delete mode 100644 ksvg/dom/SVGCSSRule.cc create mode 100644 ksvg/dom/SVGCSSRule.cpp delete mode 100644 ksvg/dom/SVGCircleElement.cc create mode 100644 ksvg/dom/SVGCircleElement.cpp delete mode 100644 ksvg/dom/SVGClipPathElement.cc create mode 100644 ksvg/dom/SVGClipPathElement.cpp delete mode 100644 ksvg/dom/SVGColor.cc create mode 100644 ksvg/dom/SVGColor.cpp delete mode 100644 ksvg/dom/SVGColorProfileElement.cc create mode 100644 ksvg/dom/SVGColorProfileElement.cpp delete mode 100644 ksvg/dom/SVGColorProfileRule.cc create mode 100644 ksvg/dom/SVGColorProfileRule.cpp delete mode 100644 ksvg/dom/SVGComponentTransferFunctionElement.cc create mode 100644 ksvg/dom/SVGComponentTransferFunctionElement.cpp delete mode 100644 ksvg/dom/SVGCursorElement.cc create mode 100644 ksvg/dom/SVGCursorElement.cpp delete mode 100644 ksvg/dom/SVGDefinitionSrcElement.cc create mode 100644 ksvg/dom/SVGDefinitionSrcElement.cpp delete mode 100644 ksvg/dom/SVGDefsElement.cc create mode 100644 ksvg/dom/SVGDefsElement.cpp delete mode 100644 ksvg/dom/SVGDescElement.cc create mode 100644 ksvg/dom/SVGDescElement.cpp delete mode 100644 ksvg/dom/SVGDocument.cc create mode 100644 ksvg/dom/SVGDocument.cpp delete mode 100644 ksvg/dom/SVGElement.cc create mode 100644 ksvg/dom/SVGElement.cpp delete mode 100644 ksvg/dom/SVGElementInstance.cc create mode 100644 ksvg/dom/SVGElementInstance.cpp delete mode 100644 ksvg/dom/SVGElementInstanceList.cc create mode 100644 ksvg/dom/SVGElementInstanceList.cpp delete mode 100644 ksvg/dom/SVGEllipseElement.cc create mode 100644 ksvg/dom/SVGEllipseElement.cpp delete mode 100644 ksvg/dom/SVGEvent.cc create mode 100644 ksvg/dom/SVGEvent.cpp delete mode 100644 ksvg/dom/SVGExternalResourcesRequired.cc create mode 100644 ksvg/dom/SVGExternalResourcesRequired.cpp delete mode 100644 ksvg/dom/SVGFEBlendElement.cc create mode 100644 ksvg/dom/SVGFEBlendElement.cpp delete mode 100644 ksvg/dom/SVGFEColorMatrixElement.cc create mode 100644 ksvg/dom/SVGFEColorMatrixElement.cpp delete mode 100644 ksvg/dom/SVGFEComponentTransferElement.cc create mode 100644 ksvg/dom/SVGFEComponentTransferElement.cpp delete mode 100644 ksvg/dom/SVGFECompositeElement.cc create mode 100644 ksvg/dom/SVGFECompositeElement.cpp delete mode 100644 ksvg/dom/SVGFEConvolveMatrixElement.cc create mode 100644 ksvg/dom/SVGFEConvolveMatrixElement.cpp delete mode 100644 ksvg/dom/SVGFEDiffuseLightingElement.cc create mode 100644 ksvg/dom/SVGFEDiffuseLightingElement.cpp delete mode 100644 ksvg/dom/SVGFEDisplacementMapElement.cc create mode 100644 ksvg/dom/SVGFEDisplacementMapElement.cpp delete mode 100644 ksvg/dom/SVGFEDistantLightElement.cc create mode 100644 ksvg/dom/SVGFEDistantLightElement.cpp delete mode 100644 ksvg/dom/SVGFEFloodElement.cc create mode 100644 ksvg/dom/SVGFEFloodElement.cpp delete mode 100644 ksvg/dom/SVGFEFuncAElement.cc create mode 100644 ksvg/dom/SVGFEFuncAElement.cpp delete mode 100644 ksvg/dom/SVGFEFuncBElement.cc create mode 100644 ksvg/dom/SVGFEFuncBElement.cpp delete mode 100644 ksvg/dom/SVGFEFuncGElement.cc create mode 100644 ksvg/dom/SVGFEFuncGElement.cpp delete mode 100644 ksvg/dom/SVGFEFuncRElement.cc create mode 100644 ksvg/dom/SVGFEFuncRElement.cpp delete mode 100644 ksvg/dom/SVGFEGaussianBlurElement.cc create mode 100644 ksvg/dom/SVGFEGaussianBlurElement.cpp delete mode 100644 ksvg/dom/SVGFEImageElement.cc create mode 100644 ksvg/dom/SVGFEImageElement.cpp delete mode 100644 ksvg/dom/SVGFEMergeElement.cc create mode 100644 ksvg/dom/SVGFEMergeElement.cpp delete mode 100644 ksvg/dom/SVGFEMergeNodeElement.cc create mode 100644 ksvg/dom/SVGFEMergeNodeElement.cpp delete mode 100644 ksvg/dom/SVGFEMorphologyElement.cc create mode 100644 ksvg/dom/SVGFEMorphologyElement.cpp delete mode 100644 ksvg/dom/SVGFEOffsetElement.cc create mode 100644 ksvg/dom/SVGFEOffsetElement.cpp delete mode 100644 ksvg/dom/SVGFEPointLightElement.cc create mode 100644 ksvg/dom/SVGFEPointLightElement.cpp delete mode 100644 ksvg/dom/SVGFESpecularLightingElement.cc create mode 100644 ksvg/dom/SVGFESpecularLightingElement.cpp delete mode 100644 ksvg/dom/SVGFESpotLightElement.cc create mode 100644 ksvg/dom/SVGFESpotLightElement.cpp delete mode 100644 ksvg/dom/SVGFETileElement.cc create mode 100644 ksvg/dom/SVGFETileElement.cpp delete mode 100644 ksvg/dom/SVGFETurbulenceElement.cc create mode 100644 ksvg/dom/SVGFETurbulenceElement.cpp delete mode 100644 ksvg/dom/SVGFilterElement.cc create mode 100644 ksvg/dom/SVGFilterElement.cpp delete mode 100644 ksvg/dom/SVGFilterPrimitiveStandardAttributes.cc create mode 100644 ksvg/dom/SVGFilterPrimitiveStandardAttributes.cpp delete mode 100644 ksvg/dom/SVGFitToViewBox.cc create mode 100644 ksvg/dom/SVGFitToViewBox.cpp delete mode 100644 ksvg/dom/SVGFontElement.cc create mode 100644 ksvg/dom/SVGFontElement.cpp delete mode 100644 ksvg/dom/SVGFontFaceElement.cc create mode 100644 ksvg/dom/SVGFontFaceElement.cpp delete mode 100644 ksvg/dom/SVGFontFaceFormatElement.cc create mode 100644 ksvg/dom/SVGFontFaceFormatElement.cpp delete mode 100644 ksvg/dom/SVGFontFaceNameElement.cc create mode 100644 ksvg/dom/SVGFontFaceNameElement.cpp delete mode 100644 ksvg/dom/SVGFontFaceSrcElement.cc create mode 100644 ksvg/dom/SVGFontFaceSrcElement.cpp delete mode 100644 ksvg/dom/SVGFontFaceUriElement.cc create mode 100644 ksvg/dom/SVGFontFaceUriElement.cpp delete mode 100644 ksvg/dom/SVGForeignObjectElement.cc create mode 100644 ksvg/dom/SVGForeignObjectElement.cpp delete mode 100644 ksvg/dom/SVGGElement.cc create mode 100644 ksvg/dom/SVGGElement.cpp delete mode 100644 ksvg/dom/SVGGlyphElement.cc create mode 100644 ksvg/dom/SVGGlyphElement.cpp delete mode 100644 ksvg/dom/SVGGlyphRefElement.cc create mode 100644 ksvg/dom/SVGGlyphRefElement.cpp delete mode 100644 ksvg/dom/SVGGradientElement.cc create mode 100644 ksvg/dom/SVGGradientElement.cpp delete mode 100644 ksvg/dom/SVGHKernElement.cc create mode 100644 ksvg/dom/SVGHKernElement.cpp delete mode 100644 ksvg/dom/SVGICCColor.cc create mode 100644 ksvg/dom/SVGICCColor.cpp delete mode 100644 ksvg/dom/SVGImageElement.cc create mode 100644 ksvg/dom/SVGImageElement.cpp delete mode 100644 ksvg/dom/SVGLangSpace.cc create mode 100644 ksvg/dom/SVGLangSpace.cpp delete mode 100644 ksvg/dom/SVGLength.cc create mode 100644 ksvg/dom/SVGLength.cpp delete mode 100644 ksvg/dom/SVGLengthList.cc create mode 100644 ksvg/dom/SVGLengthList.cpp delete mode 100644 ksvg/dom/SVGLineElement.cc create mode 100644 ksvg/dom/SVGLineElement.cpp delete mode 100644 ksvg/dom/SVGLinearGradientElement.cc create mode 100644 ksvg/dom/SVGLinearGradientElement.cpp delete mode 100644 ksvg/dom/SVGLocatable.cc create mode 100644 ksvg/dom/SVGLocatable.cpp delete mode 100644 ksvg/dom/SVGMPathElement.cc create mode 100644 ksvg/dom/SVGMPathElement.cpp delete mode 100644 ksvg/dom/SVGMarkerElement.cc create mode 100644 ksvg/dom/SVGMarkerElement.cpp delete mode 100644 ksvg/dom/SVGMaskElement.cc create mode 100644 ksvg/dom/SVGMaskElement.cpp delete mode 100644 ksvg/dom/SVGMatrix.cc create mode 100644 ksvg/dom/SVGMatrix.cpp delete mode 100644 ksvg/dom/SVGMetadataElement.cc create mode 100644 ksvg/dom/SVGMetadataElement.cpp delete mode 100644 ksvg/dom/SVGMissingGlyphElement.cc create mode 100644 ksvg/dom/SVGMissingGlyphElement.cpp delete mode 100644 ksvg/dom/SVGNumber.cc create mode 100644 ksvg/dom/SVGNumber.cpp delete mode 100644 ksvg/dom/SVGNumberList.cc create mode 100644 ksvg/dom/SVGNumberList.cpp delete mode 100644 ksvg/dom/SVGPaint.cc create mode 100644 ksvg/dom/SVGPaint.cpp delete mode 100644 ksvg/dom/SVGPathElement.cc create mode 100644 ksvg/dom/SVGPathElement.cpp delete mode 100644 ksvg/dom/SVGPathSeg.cc create mode 100644 ksvg/dom/SVGPathSeg.cpp delete mode 100644 ksvg/dom/SVGPathSegArc.cc create mode 100644 ksvg/dom/SVGPathSegArc.cpp delete mode 100644 ksvg/dom/SVGPathSegClosePath.cc create mode 100644 ksvg/dom/SVGPathSegClosePath.cpp delete mode 100644 ksvg/dom/SVGPathSegCurvetoCubic.cc create mode 100644 ksvg/dom/SVGPathSegCurvetoCubic.cpp delete mode 100644 ksvg/dom/SVGPathSegCurvetoCubicSmooth.cc create mode 100644 ksvg/dom/SVGPathSegCurvetoCubicSmooth.cpp delete mode 100644 ksvg/dom/SVGPathSegCurvetoQuadratic.cc create mode 100644 ksvg/dom/SVGPathSegCurvetoQuadratic.cpp delete mode 100644 ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cc create mode 100644 ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cpp delete mode 100644 ksvg/dom/SVGPathSegLineto.cc create mode 100644 ksvg/dom/SVGPathSegLineto.cpp delete mode 100644 ksvg/dom/SVGPathSegLinetoHorizontal.cc create mode 100644 ksvg/dom/SVGPathSegLinetoHorizontal.cpp delete mode 100644 ksvg/dom/SVGPathSegLinetoVertical.cc create mode 100644 ksvg/dom/SVGPathSegLinetoVertical.cpp delete mode 100644 ksvg/dom/SVGPathSegList.cc create mode 100644 ksvg/dom/SVGPathSegList.cpp delete mode 100644 ksvg/dom/SVGPathSegMoveto.cc create mode 100644 ksvg/dom/SVGPathSegMoveto.cpp delete mode 100644 ksvg/dom/SVGPatternElement.cc create mode 100644 ksvg/dom/SVGPatternElement.cpp delete mode 100644 ksvg/dom/SVGPoint.cc create mode 100644 ksvg/dom/SVGPoint.cpp delete mode 100644 ksvg/dom/SVGPointList.cc create mode 100644 ksvg/dom/SVGPointList.cpp delete mode 100644 ksvg/dom/SVGPolygonElement.cc create mode 100644 ksvg/dom/SVGPolygonElement.cpp delete mode 100644 ksvg/dom/SVGPolylineElement.cc create mode 100644 ksvg/dom/SVGPolylineElement.cpp delete mode 100644 ksvg/dom/SVGPreserveAspectRatio.cc create mode 100644 ksvg/dom/SVGPreserveAspectRatio.cpp delete mode 100644 ksvg/dom/SVGRadialGradientElement.cc create mode 100644 ksvg/dom/SVGRadialGradientElement.cpp delete mode 100644 ksvg/dom/SVGRect.cc create mode 100644 ksvg/dom/SVGRect.cpp delete mode 100644 ksvg/dom/SVGRectElement.cc create mode 100644 ksvg/dom/SVGRectElement.cpp delete mode 100644 ksvg/dom/SVGSVGElement.cc create mode 100644 ksvg/dom/SVGSVGElement.cpp delete mode 100644 ksvg/dom/SVGScriptElement.cc create mode 100644 ksvg/dom/SVGScriptElement.cpp delete mode 100644 ksvg/dom/SVGSetElement.cc create mode 100644 ksvg/dom/SVGSetElement.cpp delete mode 100644 ksvg/dom/SVGStopElement.cc create mode 100644 ksvg/dom/SVGStopElement.cpp delete mode 100644 ksvg/dom/SVGStringList.cc create mode 100644 ksvg/dom/SVGStringList.cpp delete mode 100644 ksvg/dom/SVGStylable.cc create mode 100644 ksvg/dom/SVGStylable.cpp delete mode 100644 ksvg/dom/SVGStyleElement.cc create mode 100644 ksvg/dom/SVGStyleElement.cpp delete mode 100644 ksvg/dom/SVGSwitchElement.cc create mode 100644 ksvg/dom/SVGSwitchElement.cpp delete mode 100644 ksvg/dom/SVGSymbolElement.cc create mode 100644 ksvg/dom/SVGSymbolElement.cpp delete mode 100644 ksvg/dom/SVGTRefElement.cc create mode 100644 ksvg/dom/SVGTRefElement.cpp delete mode 100644 ksvg/dom/SVGTSpanElement.cc create mode 100644 ksvg/dom/SVGTSpanElement.cpp delete mode 100644 ksvg/dom/SVGTests.cc create mode 100644 ksvg/dom/SVGTests.cpp delete mode 100644 ksvg/dom/SVGTextContentElement.cc create mode 100644 ksvg/dom/SVGTextContentElement.cpp delete mode 100644 ksvg/dom/SVGTextElement.cc create mode 100644 ksvg/dom/SVGTextElement.cpp delete mode 100644 ksvg/dom/SVGTextPathElement.cc create mode 100644 ksvg/dom/SVGTextPathElement.cpp delete mode 100644 ksvg/dom/SVGTextPositioningElement.cc create mode 100644 ksvg/dom/SVGTextPositioningElement.cpp delete mode 100644 ksvg/dom/SVGTitleElement.cc create mode 100644 ksvg/dom/SVGTitleElement.cpp delete mode 100644 ksvg/dom/SVGTransform.cc create mode 100644 ksvg/dom/SVGTransform.cpp delete mode 100644 ksvg/dom/SVGTransformList.cc create mode 100644 ksvg/dom/SVGTransformList.cpp delete mode 100644 ksvg/dom/SVGTransformable.cc create mode 100644 ksvg/dom/SVGTransformable.cpp delete mode 100644 ksvg/dom/SVGURIReference.cc create mode 100644 ksvg/dom/SVGURIReference.cpp delete mode 100644 ksvg/dom/SVGUseElement.cc create mode 100644 ksvg/dom/SVGUseElement.cpp delete mode 100644 ksvg/dom/SVGVKernElement.cc create mode 100644 ksvg/dom/SVGVKernElement.cpp delete mode 100644 ksvg/dom/SVGViewElement.cc create mode 100644 ksvg/dom/SVGViewElement.cpp delete mode 100644 ksvg/dom/SVGViewSpec.cc create mode 100644 ksvg/dom/SVGViewSpec.cpp delete mode 100644 ksvg/dom/SVGWindow.cc create mode 100644 ksvg/dom/SVGWindow.cpp delete mode 100644 ksvg/dom/SVGZoomAndPan.cc create mode 100644 ksvg/dom/SVGZoomAndPan.cpp delete mode 100644 ksvg/dom/SVGZoomEvent.cc create mode 100644 ksvg/dom/SVGZoomEvent.cpp delete mode 100644 ksvg/impl/SVGAElementImpl.cc create mode 100644 ksvg/impl/SVGAElementImpl.cpp delete mode 100644 ksvg/impl/SVGAltGlyphDefElementImpl.cc create mode 100644 ksvg/impl/SVGAltGlyphDefElementImpl.cpp delete mode 100644 ksvg/impl/SVGAltGlyphElementImpl.cc create mode 100644 ksvg/impl/SVGAltGlyphElementImpl.cpp delete mode 100644 ksvg/impl/SVGAngleImpl.cc create mode 100644 ksvg/impl/SVGAngleImpl.cpp delete mode 100644 ksvg/impl/SVGAnimateColorElementImpl.cc create mode 100644 ksvg/impl/SVGAnimateColorElementImpl.cpp delete mode 100644 ksvg/impl/SVGAnimateElementImpl.cc create mode 100644 ksvg/impl/SVGAnimateElementImpl.cpp delete mode 100644 ksvg/impl/SVGAnimateMotionElementImpl.cc create mode 100644 ksvg/impl/SVGAnimateMotionElementImpl.cpp delete mode 100644 ksvg/impl/SVGAnimateTransformElementImpl.cc create mode 100644 ksvg/impl/SVGAnimateTransformElementImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedAngleImpl.cc create mode 100644 ksvg/impl/SVGAnimatedAngleImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedBooleanImpl.cc create mode 100644 ksvg/impl/SVGAnimatedBooleanImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedEnumerationImpl.cc create mode 100644 ksvg/impl/SVGAnimatedEnumerationImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedIntegerImpl.cc create mode 100644 ksvg/impl/SVGAnimatedIntegerImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedLengthImpl.cc create mode 100644 ksvg/impl/SVGAnimatedLengthImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedLengthListImpl.cc create mode 100644 ksvg/impl/SVGAnimatedLengthListImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedNumberImpl.cc create mode 100644 ksvg/impl/SVGAnimatedNumberImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedNumberListImpl.cc create mode 100644 ksvg/impl/SVGAnimatedNumberListImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedPathDataImpl.cc create mode 100644 ksvg/impl/SVGAnimatedPathDataImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedPointsImpl.cc create mode 100644 ksvg/impl/SVGAnimatedPointsImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cc create mode 100644 ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedRectImpl.cc create mode 100644 ksvg/impl/SVGAnimatedRectImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedStringImpl.cc create mode 100644 ksvg/impl/SVGAnimatedStringImpl.cpp delete mode 100644 ksvg/impl/SVGAnimatedTransformListImpl.cc create mode 100644 ksvg/impl/SVGAnimatedTransformListImpl.cpp delete mode 100644 ksvg/impl/SVGAnimationElementImpl.cc create mode 100644 ksvg/impl/SVGAnimationElementImpl.cpp delete mode 100644 ksvg/impl/SVGBBoxTarget.cc create mode 100644 ksvg/impl/SVGBBoxTarget.cpp delete mode 100644 ksvg/impl/SVGCSSRuleImpl.cc create mode 100644 ksvg/impl/SVGCSSRuleImpl.cpp delete mode 100644 ksvg/impl/SVGCircleElementImpl.cc create mode 100644 ksvg/impl/SVGCircleElementImpl.cpp delete mode 100644 ksvg/impl/SVGClipPathElementImpl.cc create mode 100644 ksvg/impl/SVGClipPathElementImpl.cpp delete mode 100644 ksvg/impl/SVGColorImpl.cc create mode 100644 ksvg/impl/SVGColorImpl.cpp delete mode 100644 ksvg/impl/SVGColorProfileElementImpl.cc create mode 100644 ksvg/impl/SVGColorProfileElementImpl.cpp delete mode 100644 ksvg/impl/SVGColorProfileRuleImpl.cc create mode 100644 ksvg/impl/SVGColorProfileRuleImpl.cpp delete mode 100644 ksvg/impl/SVGComponentTransferFunctionElementImpl.cc create mode 100644 ksvg/impl/SVGComponentTransferFunctionElementImpl.cpp delete mode 100644 ksvg/impl/SVGContainerImpl.cc create mode 100644 ksvg/impl/SVGContainerImpl.cpp delete mode 100644 ksvg/impl/SVGCursorElementImpl.cc create mode 100644 ksvg/impl/SVGCursorElementImpl.cpp delete mode 100644 ksvg/impl/SVGDefinitionSrcElementImpl.cc create mode 100644 ksvg/impl/SVGDefinitionSrcElementImpl.cpp delete mode 100644 ksvg/impl/SVGDefsElementImpl.cc create mode 100644 ksvg/impl/SVGDefsElementImpl.cpp delete mode 100644 ksvg/impl/SVGDescElementImpl.cc create mode 100644 ksvg/impl/SVGDescElementImpl.cpp delete mode 100644 ksvg/impl/SVGDocumentImpl.cc create mode 100644 ksvg/impl/SVGDocumentImpl.cpp delete mode 100644 ksvg/impl/SVGEcma.cc create mode 100644 ksvg/impl/SVGEcma.cpp delete mode 100644 ksvg/impl/SVGElementImpl.cc create mode 100644 ksvg/impl/SVGElementImpl.cpp delete mode 100644 ksvg/impl/SVGElementInstanceImpl.cc create mode 100644 ksvg/impl/SVGElementInstanceImpl.cpp delete mode 100644 ksvg/impl/SVGElementInstanceListImpl.cc create mode 100644 ksvg/impl/SVGElementInstanceListImpl.cpp delete mode 100644 ksvg/impl/SVGEllipseElementImpl.cc create mode 100644 ksvg/impl/SVGEllipseElementImpl.cpp delete mode 100644 ksvg/impl/SVGEventImpl.cc create mode 100644 ksvg/impl/SVGEventImpl.cpp delete mode 100644 ksvg/impl/SVGExternalResourcesRequiredImpl.cc create mode 100644 ksvg/impl/SVGExternalResourcesRequiredImpl.cpp delete mode 100644 ksvg/impl/SVGFEBlendElementImpl.cc create mode 100644 ksvg/impl/SVGFEBlendElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEColorMatrixElementImpl.cc create mode 100644 ksvg/impl/SVGFEColorMatrixElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEComponentTransferElementImpl.cc create mode 100644 ksvg/impl/SVGFEComponentTransferElementImpl.cpp delete mode 100644 ksvg/impl/SVGFECompositeElementImpl.cc create mode 100644 ksvg/impl/SVGFECompositeElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEConvolveMatrixElementImpl.cc create mode 100644 ksvg/impl/SVGFEConvolveMatrixElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEDiffuseLightingElementImpl.cc create mode 100644 ksvg/impl/SVGFEDiffuseLightingElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEDisplacementMapElementImpl.cc create mode 100644 ksvg/impl/SVGFEDisplacementMapElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEDistantLightElementImpl.cc create mode 100644 ksvg/impl/SVGFEDistantLightElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEFloodElementImpl.cc create mode 100644 ksvg/impl/SVGFEFloodElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEFuncAElementImpl.cc create mode 100644 ksvg/impl/SVGFEFuncAElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEFuncBElementImpl.cc create mode 100644 ksvg/impl/SVGFEFuncBElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEFuncGElementImpl.cc create mode 100644 ksvg/impl/SVGFEFuncGElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEFuncRElementImpl.cc create mode 100644 ksvg/impl/SVGFEFuncRElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEGaussianBlurElementImpl.cc create mode 100644 ksvg/impl/SVGFEGaussianBlurElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEImageElementImpl.cc create mode 100644 ksvg/impl/SVGFEImageElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEMergeElementImpl.cc create mode 100644 ksvg/impl/SVGFEMergeElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEMergeNodeElementImpl.cc create mode 100644 ksvg/impl/SVGFEMergeNodeElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEMorphologyElementImpl.cc create mode 100644 ksvg/impl/SVGFEMorphologyElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEOffsetElementImpl.cc create mode 100644 ksvg/impl/SVGFEOffsetElementImpl.cpp delete mode 100644 ksvg/impl/SVGFEPointLightElementImpl.cc create mode 100644 ksvg/impl/SVGFEPointLightElementImpl.cpp delete mode 100644 ksvg/impl/SVGFESpecularLightingElementImpl.cc create mode 100644 ksvg/impl/SVGFESpecularLightingElementImpl.cpp delete mode 100644 ksvg/impl/SVGFESpotLightElementImpl.cc create mode 100644 ksvg/impl/SVGFESpotLightElementImpl.cpp delete mode 100644 ksvg/impl/SVGFETileElementImpl.cc create mode 100644 ksvg/impl/SVGFETileElementImpl.cpp delete mode 100644 ksvg/impl/SVGFETurbulenceElementImpl.cc create mode 100644 ksvg/impl/SVGFETurbulenceElementImpl.cpp delete mode 100644 ksvg/impl/SVGFilterElementImpl.cc create mode 100644 ksvg/impl/SVGFilterElementImpl.cpp delete mode 100644 ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cc create mode 100644 ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cpp delete mode 100644 ksvg/impl/SVGFitToViewBoxImpl.cc create mode 100644 ksvg/impl/SVGFitToViewBoxImpl.cpp delete mode 100644 ksvg/impl/SVGFontElementImpl.cc create mode 100644 ksvg/impl/SVGFontElementImpl.cpp delete mode 100644 ksvg/impl/SVGFontFaceElementImpl.cc create mode 100644 ksvg/impl/SVGFontFaceElementImpl.cpp delete mode 100644 ksvg/impl/SVGFontFaceFormatElementImpl.cc create mode 100644 ksvg/impl/SVGFontFaceFormatElementImpl.cpp delete mode 100644 ksvg/impl/SVGFontFaceNameElementImpl.cc create mode 100644 ksvg/impl/SVGFontFaceNameElementImpl.cpp delete mode 100644 ksvg/impl/SVGFontFaceSrcElementImpl.cc create mode 100644 ksvg/impl/SVGFontFaceSrcElementImpl.cpp delete mode 100644 ksvg/impl/SVGFontFaceUriElementImpl.cc create mode 100644 ksvg/impl/SVGFontFaceUriElementImpl.cpp delete mode 100644 ksvg/impl/SVGForeignObjectElementImpl.cc create mode 100644 ksvg/impl/SVGForeignObjectElementImpl.cpp delete mode 100644 ksvg/impl/SVGGElementImpl.cc create mode 100644 ksvg/impl/SVGGElementImpl.cpp delete mode 100644 ksvg/impl/SVGGlyphElementImpl.cc create mode 100644 ksvg/impl/SVGGlyphElementImpl.cpp delete mode 100644 ksvg/impl/SVGGlyphRefElementImpl.cc create mode 100644 ksvg/impl/SVGGlyphRefElementImpl.cpp delete mode 100644 ksvg/impl/SVGGradientElementImpl.cc create mode 100644 ksvg/impl/SVGGradientElementImpl.cpp delete mode 100644 ksvg/impl/SVGHKernElementImpl.cc create mode 100644 ksvg/impl/SVGHKernElementImpl.cpp delete mode 100644 ksvg/impl/SVGHelperImpl.cc create mode 100644 ksvg/impl/SVGHelperImpl.cpp delete mode 100644 ksvg/impl/SVGICCColorImpl.cc create mode 100644 ksvg/impl/SVGICCColorImpl.cpp delete mode 100644 ksvg/impl/SVGImageElementImpl.cc create mode 100644 ksvg/impl/SVGImageElementImpl.cpp delete mode 100644 ksvg/impl/SVGLangSpaceImpl.cc create mode 100644 ksvg/impl/SVGLangSpaceImpl.cpp delete mode 100644 ksvg/impl/SVGLengthImpl.cc create mode 100644 ksvg/impl/SVGLengthImpl.cpp delete mode 100644 ksvg/impl/SVGLengthListImpl.cc create mode 100644 ksvg/impl/SVGLengthListImpl.cpp delete mode 100644 ksvg/impl/SVGLineElementImpl.cc create mode 100644 ksvg/impl/SVGLineElementImpl.cpp delete mode 100644 ksvg/impl/SVGLinearGradientElementImpl.cc create mode 100644 ksvg/impl/SVGLinearGradientElementImpl.cpp delete mode 100644 ksvg/impl/SVGLocatableImpl.cc create mode 100644 ksvg/impl/SVGLocatableImpl.cpp delete mode 100644 ksvg/impl/SVGMPathElementImpl.cc create mode 100644 ksvg/impl/SVGMPathElementImpl.cpp delete mode 100644 ksvg/impl/SVGMarkerElementImpl.cc create mode 100644 ksvg/impl/SVGMarkerElementImpl.cpp delete mode 100644 ksvg/impl/SVGMaskElementImpl.cc create mode 100644 ksvg/impl/SVGMaskElementImpl.cpp delete mode 100644 ksvg/impl/SVGMatrixImpl.cc create mode 100644 ksvg/impl/SVGMatrixImpl.cpp delete mode 100644 ksvg/impl/SVGMetadataElementImpl.cc create mode 100644 ksvg/impl/SVGMetadataElementImpl.cpp delete mode 100644 ksvg/impl/SVGMissingGlyphElementImpl.cc create mode 100644 ksvg/impl/SVGMissingGlyphElementImpl.cpp delete mode 100644 ksvg/impl/SVGNumberImpl.cc create mode 100644 ksvg/impl/SVGNumberImpl.cpp delete mode 100644 ksvg/impl/SVGNumberListImpl.cc create mode 100644 ksvg/impl/SVGNumberListImpl.cpp delete mode 100644 ksvg/impl/SVGPaintImpl.cc create mode 100644 ksvg/impl/SVGPaintImpl.cpp delete mode 100644 ksvg/impl/SVGPaintServerImpl.cc create mode 100644 ksvg/impl/SVGPaintServerImpl.cpp delete mode 100644 ksvg/impl/SVGPathElementImpl.cc create mode 100644 ksvg/impl/SVGPathElementImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegArcImpl.cc create mode 100644 ksvg/impl/SVGPathSegArcImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegClosePathImpl.cc create mode 100644 ksvg/impl/SVGPathSegClosePathImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegCurvetoCubicImpl.cc create mode 100644 ksvg/impl/SVGPathSegCurvetoCubicImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cc create mode 100644 ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cc create mode 100644 ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cc create mode 100644 ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegImpl.cc create mode 100644 ksvg/impl/SVGPathSegImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegLinetoHorizontalImpl.cc create mode 100644 ksvg/impl/SVGPathSegLinetoHorizontalImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegLinetoImpl.cc create mode 100644 ksvg/impl/SVGPathSegLinetoImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegLinetoVerticalImpl.cc create mode 100644 ksvg/impl/SVGPathSegLinetoVerticalImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegListImpl.cc create mode 100644 ksvg/impl/SVGPathSegListImpl.cpp delete mode 100644 ksvg/impl/SVGPathSegMovetoImpl.cc create mode 100644 ksvg/impl/SVGPathSegMovetoImpl.cpp delete mode 100644 ksvg/impl/SVGPatternElementImpl.cc create mode 100644 ksvg/impl/SVGPatternElementImpl.cpp delete mode 100644 ksvg/impl/SVGPointImpl.cc create mode 100644 ksvg/impl/SVGPointImpl.cpp delete mode 100644 ksvg/impl/SVGPointListImpl.cc create mode 100644 ksvg/impl/SVGPointListImpl.cpp delete mode 100644 ksvg/impl/SVGPolyElementImpl.cc create mode 100644 ksvg/impl/SVGPolyElementImpl.cpp delete mode 100644 ksvg/impl/SVGPolygonElementImpl.cc create mode 100644 ksvg/impl/SVGPolygonElementImpl.cpp delete mode 100644 ksvg/impl/SVGPolylineElementImpl.cc create mode 100644 ksvg/impl/SVGPolylineElementImpl.cpp delete mode 100644 ksvg/impl/SVGPreserveAspectRatioImpl.cc create mode 100644 ksvg/impl/SVGPreserveAspectRatioImpl.cpp delete mode 100644 ksvg/impl/SVGRadialGradientElementImpl.cc create mode 100644 ksvg/impl/SVGRadialGradientElementImpl.cpp delete mode 100644 ksvg/impl/SVGRectElementImpl.cc create mode 100644 ksvg/impl/SVGRectElementImpl.cpp delete mode 100644 ksvg/impl/SVGRectImpl.cc create mode 100644 ksvg/impl/SVGRectImpl.cpp delete mode 100644 ksvg/impl/SVGSVGElementImpl.cc create mode 100644 ksvg/impl/SVGSVGElementImpl.cpp delete mode 100644 ksvg/impl/SVGScriptElementImpl.cc create mode 100644 ksvg/impl/SVGScriptElementImpl.cpp delete mode 100644 ksvg/impl/SVGSetElementImpl.cc create mode 100644 ksvg/impl/SVGSetElementImpl.cpp delete mode 100644 ksvg/impl/SVGShapeImpl.cc create mode 100644 ksvg/impl/SVGShapeImpl.cpp delete mode 100644 ksvg/impl/SVGStopElementImpl.cc create mode 100644 ksvg/impl/SVGStopElementImpl.cpp delete mode 100644 ksvg/impl/SVGStringListImpl.cc create mode 100644 ksvg/impl/SVGStringListImpl.cpp delete mode 100644 ksvg/impl/SVGStylableImpl.cc create mode 100644 ksvg/impl/SVGStylableImpl.cpp delete mode 100644 ksvg/impl/SVGStyleElementImpl.cc create mode 100644 ksvg/impl/SVGStyleElementImpl.cpp delete mode 100644 ksvg/impl/SVGSwitchElementImpl.cc create mode 100644 ksvg/impl/SVGSwitchElementImpl.cpp delete mode 100644 ksvg/impl/SVGSymbolElementImpl.cc create mode 100644 ksvg/impl/SVGSymbolElementImpl.cpp delete mode 100644 ksvg/impl/SVGTRefElementImpl.cc create mode 100644 ksvg/impl/SVGTRefElementImpl.cpp delete mode 100644 ksvg/impl/SVGTSpanElementImpl.cc create mode 100644 ksvg/impl/SVGTSpanElementImpl.cpp delete mode 100644 ksvg/impl/SVGTestsImpl.cc create mode 100644 ksvg/impl/SVGTestsImpl.cpp delete mode 100644 ksvg/impl/SVGTextContentElementImpl.cc create mode 100644 ksvg/impl/SVGTextContentElementImpl.cpp delete mode 100644 ksvg/impl/SVGTextElementImpl.cc create mode 100644 ksvg/impl/SVGTextElementImpl.cpp delete mode 100644 ksvg/impl/SVGTextPathElementImpl.cc create mode 100644 ksvg/impl/SVGTextPathElementImpl.cpp delete mode 100644 ksvg/impl/SVGTextPositioningElementImpl.cc create mode 100644 ksvg/impl/SVGTextPositioningElementImpl.cpp delete mode 100644 ksvg/impl/SVGTimeScheduler.cc create mode 100644 ksvg/impl/SVGTimeScheduler.cpp delete mode 100644 ksvg/impl/SVGTitleElementImpl.cc create mode 100644 ksvg/impl/SVGTitleElementImpl.cpp delete mode 100644 ksvg/impl/SVGTransformImpl.cc create mode 100644 ksvg/impl/SVGTransformImpl.cpp delete mode 100644 ksvg/impl/SVGTransformListImpl.cc create mode 100644 ksvg/impl/SVGTransformListImpl.cpp delete mode 100644 ksvg/impl/SVGTransformableImpl.cc create mode 100644 ksvg/impl/SVGTransformableImpl.cpp delete mode 100644 ksvg/impl/SVGURIReferenceImpl.cc create mode 100644 ksvg/impl/SVGURIReferenceImpl.cpp delete mode 100644 ksvg/impl/SVGUseElementImpl.cc create mode 100644 ksvg/impl/SVGUseElementImpl.cpp delete mode 100644 ksvg/impl/SVGVKernElementImpl.cc create mode 100644 ksvg/impl/SVGVKernElementImpl.cpp delete mode 100644 ksvg/impl/SVGViewElementImpl.cc create mode 100644 ksvg/impl/SVGViewElementImpl.cpp delete mode 100644 ksvg/impl/SVGViewSpecImpl.cc create mode 100644 ksvg/impl/SVGViewSpecImpl.cpp delete mode 100644 ksvg/impl/SVGWindowImpl.cc create mode 100644 ksvg/impl/SVGWindowImpl.cpp delete mode 100644 ksvg/impl/SVGZoomAndPanImpl.cc create mode 100644 ksvg/impl/SVGZoomAndPanImpl.cpp delete mode 100644 ksvg/impl/SVGZoomEventImpl.cc create mode 100644 ksvg/impl/SVGZoomEventImpl.cpp create mode 100644 ksvg/impl/libs/libtext2path/src/myboost/assert.h delete mode 100644 ksvg/impl/libs/libtext2path/src/myboost/assert.hpp create mode 100644 ksvg/impl/libs/libtext2path/src/myboost/checked_delete.h delete mode 100644 ksvg/impl/libs/libtext2path/src/myboost/checked_delete.hpp create mode 100644 ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.h delete mode 100644 ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.hpp create mode 100644 ksvg/impl/libs/libtext2path/src/myboost/shared_count.h delete mode 100644 ksvg/impl/libs/libtext2path/src/myboost/shared_count.hpp create mode 100644 ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.h delete mode 100644 ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.hpp create mode 100644 ksvg/impl/libs/libtext2path/src/myboost/throw_exception.h delete mode 100644 ksvg/impl/libs/libtext2path/src/myboost/throw_exception.hpp delete mode 100644 ksvg/impl/svgpathparser.cc create mode 100644 ksvg/impl/svgpathparser.cpp delete mode 100644 ksvg/test/external/SVGTestWidget.cc create mode 100644 ksvg/test/external/SVGTestWidget.cpp delete mode 100644 ksvg/test/external/svgdisplay.cc create mode 100644 ksvg/test/external/svgdisplay.cpp (limited to 'ksvg') diff --git a/ksvg/Makefile.am b/ksvg/Makefile.am index 8dec4221..86429f96 100644 --- a/ksvg/Makefile.am +++ b/ksvg/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = dom impl core ecma . plugin test lib_LTLIBRARIES = libksvg.la -libksvg_la_SOURCES = dummy.cc +libksvg_la_SOURCES = dummy.cpp libksvg_la_METASOURCES = AUTO libksvg_la_LDFLAGS = -version-info 0:1:0 -no-undefined $(all_libraries) libksvg_la_LIBADD = dom/libksvgdom.la impl/libksvgdomimpl.la core/libksvgcore.la ecma/libksvgecma.la \ @@ -10,100 +10,100 @@ libksvg_la_LIBADD = dom/libksvgdom.la impl/libksvgdomimpl.la core/libksvgcore.l INCLUDES = -I$(top_srcdir)/ksvg/dom -I$(top_srcdir)/ksvg/impl $(all_includes) -dummy.cc: - echo "" > dummy.cc +dummy.cpp: + echo "" > dummy.cpp # Make it easy for developers :) hashtables: cd $(srcdir); \ rm -f data/*lut* ; \ - ../../tdelibs/kjs/create_hash_table impl/SVGElementImpl.cc > data/SVGElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGSVGElementImpl.cc > data/SVGSVGElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGRectElementImpl.cc > data/SVGRectElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGLineElementImpl.cc > data/SVGLineElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGCircleElementImpl.cc > data/SVGCircleElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGImageElementImpl.cc > data/SVGImageElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGEllipseElementImpl.cc > data/SVGEllipseElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedPointsImpl.cc > data/SVGAnimatedPointsImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPointImpl.cc > data/SVGPointImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGRectImpl.cc > data/SVGRectImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGNumberImpl.cc > data/SVGNumberImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedAngleImpl.cc > data/SVGAnimatedAngleImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedRectImpl.cc > data/SVGAnimatedRectImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedNumberImpl.cc > data/SVGAnimatedNumberImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedNumberListImpl.cc > data/SVGAnimatedNumberListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedIntegerImpl.cc > data/SVGAnimatedIntegerImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedBooleanImpl.cc > data/SVGAnimatedBooleanImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedEnumerationImpl.cc > data/SVGAnimatedEnumerationImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedStringImpl.cc > data/SVGAnimatedStringImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedLengthImpl.cc > data/SVGAnimatedLengthImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedLengthListImpl.cc > data/SVGAnimatedLengthListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedPreserveAspectRatioImpl.cc > data/SVGAnimatedPreserveAspectRatioImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPreserveAspectRatioImpl.cc > data/SVGPreserveAspectRatioImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGLengthImpl.cc > data/SVGLengthImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGMatrixImpl.cc > data/SVGMatrixImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAngleImpl.cc > data/SVGAngleImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGLocatableImpl.cc > data/SVGLocatableImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTestsImpl.cc > data/SVGTestsImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGLangSpaceImpl.cc > data/SVGLangSpaceImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGExternalResourcesRequiredImpl.cc > data/SVGExternalResourcesRequiredImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGURIReferenceImpl.cc > data/SVGURIReferenceImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPaintImpl.cc > data/SVGPaintImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGColorImpl.cc > data/SVGColorImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGICCColorImpl.cc > data/SVGICCColorImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTextPositioningElementImpl.cc > data/SVGTextPositioningElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTextContentElementImpl.cc > data/SVGTextContentElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTransformImpl.cc > data/SVGTransformImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTransformableImpl.cc > data/SVGTransformableImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPointListImpl.cc > data/SVGPointListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGNumberListImpl.cc > data/SVGNumberListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGLengthListImpl.cc > data/SVGLengthListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGStringListImpl.cc > data/SVGStringListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedPathDataImpl.cc > data/SVGAnimatedPathDataImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegImpl.cc > data/SVGPathSegImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegArcImpl.cc > data/SVGPathSegArcImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegMovetoImpl.cc > data/SVGPathSegMovetoImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegLinetoImpl.cc > data/SVGPathSegLinetoImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegLinetoHorizontalImpl.cc > data/SVGPathSegLinetoHorizontalImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegLinetoVerticalImpl.cc > data/SVGPathSegLinetoVerticalImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoCubicImpl.cc > data/SVGPathSegCurvetoCubicImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoCubicSmoothImpl.cc > data/SVGPathSegCurvetoCubicSmoothImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoQuadraticImpl.cc > data/SVGPathSegCurvetoQuadraticImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoQuadraticSmoothImpl.cc > data/SVGPathSegCurvetoQuadraticSmoothImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathElementImpl.cc > data/SVGPathElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPathSegListImpl.cc > data/SVGPathSegListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTransformListImpl.cc > data/SVGTransformListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedTransformListImpl.cc > data/SVGAnimatedTransformListImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAElementImpl.cc > data/SVGAElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGUseElementImpl.cc > data/SVGUseElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGDocumentImpl.cc > data/SVGDocumentImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGForeignObjectElementImpl.cc > data/SVGForeignObjectElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGScriptElementImpl.cc > data/SVGScriptElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGStyleElementImpl.cc > data/SVGStyleElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGZoomAndPanImpl.cc > data/SVGZoomAndPanImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGFitToViewBoxImpl.cc > data/SVGFitToViewBoxImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGStylableImpl.cc > data/SVGStylableImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGEventImpl.cc > data/SVGEventImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGEcma.cc > data/SVGEcma.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGMarkerElementImpl.cc > data/SVGMarkerElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGViewElementImpl.cc > data/SVGViewElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTextContentElementImpl.cc > data/SVGTextContentElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGClipPathElementImpl.cc > data/SVGClipPathElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGColorProfileElementImpl.cc > data/SVGColorProfileElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGPatternElementImpl.cc > data/SVGPatternElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGGradientElementImpl.cc > data/SVGGradientElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGLinearGradientElementImpl.cc > data/SVGLinearGradientElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGRadialGradientElementImpl.cc > data/SVGRadialGradientElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGStopElementImpl.cc > data/SVGStopElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGAnimationElementImpl.cc > data/SVGAnimationElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGCursorElementImpl.cc > data/SVGCursorElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGSymbolElementImpl.cc > data/SVGSymbolElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGMaskElementImpl.cc > data/SVGMaskElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGGlyphElementImpl.cc > data/SVGGlyphElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGMissingGlyphElementImpl.cc > data/SVGMissingGlyphElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGGlyphRefElementImpl.cc > data/SVGGlyphRefElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGTextPathElementImpl.cc > data/SVGTextPathElementImpl.lut.h; \ - ../../tdelibs/kjs/create_hash_table impl/SVGZoomEventImpl.cc > data/SVGZoomEventImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGElementImpl.cpp > data/SVGElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGSVGElementImpl.cpp > data/SVGSVGElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGRectElementImpl.cpp > data/SVGRectElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGLineElementImpl.cpp > data/SVGLineElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGCircleElementImpl.cpp > data/SVGCircleElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGImageElementImpl.cpp > data/SVGImageElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGEllipseElementImpl.cpp > data/SVGEllipseElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedPointsImpl.cpp > data/SVGAnimatedPointsImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPointImpl.cpp > data/SVGPointImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGRectImpl.cpp > data/SVGRectImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGNumberImpl.cpp > data/SVGNumberImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedAngleImpl.cpp > data/SVGAnimatedAngleImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedRectImpl.cpp > data/SVGAnimatedRectImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedNumberImpl.cpp > data/SVGAnimatedNumberImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedNumberListImpl.cpp > data/SVGAnimatedNumberListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedIntegerImpl.cpp > data/SVGAnimatedIntegerImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedBooleanImpl.cpp > data/SVGAnimatedBooleanImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedEnumerationImpl.cpp > data/SVGAnimatedEnumerationImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedStringImpl.cpp > data/SVGAnimatedStringImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedLengthImpl.cpp > data/SVGAnimatedLengthImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedLengthListImpl.cpp > data/SVGAnimatedLengthListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedPreserveAspectRatioImpl.cpp > data/SVGAnimatedPreserveAspectRatioImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPreserveAspectRatioImpl.cpp > data/SVGPreserveAspectRatioImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGLengthImpl.cpp > data/SVGLengthImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGMatrixImpl.cpp > data/SVGMatrixImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAngleImpl.cpp > data/SVGAngleImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGLocatableImpl.cpp > data/SVGLocatableImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTestsImpl.cpp > data/SVGTestsImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGLangSpaceImpl.cpp > data/SVGLangSpaceImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGExternalResourcesRequiredImpl.cpp > data/SVGExternalResourcesRequiredImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGURIReferenceImpl.cpp > data/SVGURIReferenceImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPaintImpl.cpp > data/SVGPaintImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGColorImpl.cpp > data/SVGColorImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGICCColorImpl.cpp > data/SVGICCColorImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTextPositioningElementImpl.cpp > data/SVGTextPositioningElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTextContentElementImpl.cpp > data/SVGTextContentElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTransformImpl.cpp > data/SVGTransformImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTransformableImpl.cpp > data/SVGTransformableImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPointListImpl.cpp > data/SVGPointListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGNumberListImpl.cpp > data/SVGNumberListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGLengthListImpl.cpp > data/SVGLengthListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGStringListImpl.cpp > data/SVGStringListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedPathDataImpl.cpp > data/SVGAnimatedPathDataImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegImpl.cpp > data/SVGPathSegImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegArcImpl.cpp > data/SVGPathSegArcImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegMovetoImpl.cpp > data/SVGPathSegMovetoImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegLinetoImpl.cpp > data/SVGPathSegLinetoImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegLinetoHorizontalImpl.cpp > data/SVGPathSegLinetoHorizontalImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegLinetoVerticalImpl.cpp > data/SVGPathSegLinetoVerticalImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoCubicImpl.cpp > data/SVGPathSegCurvetoCubicImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoCubicSmoothImpl.cpp > data/SVGPathSegCurvetoCubicSmoothImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoQuadraticImpl.cpp > data/SVGPathSegCurvetoQuadraticImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegCurvetoQuadraticSmoothImpl.cpp > data/SVGPathSegCurvetoQuadraticSmoothImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathElementImpl.cpp > data/SVGPathElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPathSegListImpl.cpp > data/SVGPathSegListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTransformListImpl.cpp > data/SVGTransformListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimatedTransformListImpl.cpp > data/SVGAnimatedTransformListImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAElementImpl.cpp > data/SVGAElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGUseElementImpl.cpp > data/SVGUseElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGDocumentImpl.cpp > data/SVGDocumentImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGForeignObjectElementImpl.cpp > data/SVGForeignObjectElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGScriptElementImpl.cpp > data/SVGScriptElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGStyleElementImpl.cpp > data/SVGStyleElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGZoomAndPanImpl.cpp > data/SVGZoomAndPanImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGFitToViewBoxImpl.cpp > data/SVGFitToViewBoxImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGStylableImpl.cpp > data/SVGStylableImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGEventImpl.cpp > data/SVGEventImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGEcma.cpp > data/SVGEcma.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGMarkerElementImpl.cpp > data/SVGMarkerElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGViewElementImpl.cpp > data/SVGViewElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTextContentElementImpl.cpp > data/SVGTextContentElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGClipPathElementImpl.cpp > data/SVGClipPathElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGColorProfileElementImpl.cpp > data/SVGColorProfileElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGPatternElementImpl.cpp > data/SVGPatternElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGGradientElementImpl.cpp > data/SVGGradientElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGLinearGradientElementImpl.cpp > data/SVGLinearGradientElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGRadialGradientElementImpl.cpp > data/SVGRadialGradientElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGStopElementImpl.cpp > data/SVGStopElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGAnimationElementImpl.cpp > data/SVGAnimationElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGCursorElementImpl.cpp > data/SVGCursorElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGSymbolElementImpl.cpp > data/SVGSymbolElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGMaskElementImpl.cpp > data/SVGMaskElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGGlyphElementImpl.cpp > data/SVGGlyphElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGMissingGlyphElementImpl.cpp > data/SVGMissingGlyphElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGGlyphRefElementImpl.cpp > data/SVGGlyphRefElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGTextPathElementImpl.cpp > data/SVGTextPathElementImpl.lut.h; \ + ../../tdelibs/kjs/create_hash_table impl/SVGZoomEventImpl.cpp > data/SVGZoomEventImpl.lut.h; \ ../../tdelibs/kjs/create_hash_table ecma/ksvg_window.cpp > data/ksvg_window.lut.h; generatedata: diff --git a/ksvg/core/CMakeLists.txt b/ksvg/core/CMakeLists.txt index 8506cf76..3818acaf 100644 --- a/ksvg/core/CMakeLists.txt +++ b/ksvg/core/CMakeLists.txt @@ -46,6 +46,6 @@ tde_create_translated_desktop( tde_add_library( ksvgcore STATIC_PIC AUTOMOC SOURCES - KSVGLoader.cpp KSVGCanvas.cpp KSVGReader.cc KSVGTextChunk.cpp + KSVGLoader.cpp KSVGCanvas.cpp KSVGReader.cpp KSVGTextChunk.cpp CanvasFactory.cpp CanvasItems.cpp KSVGHelper.cpp DocumentFactory.cpp ) diff --git a/ksvg/core/KSVGReader.cc b/ksvg/core/KSVGReader.cc deleted file mode 100644 index 3fbbefd3..00000000 --- a/ksvg/core/KSVGReader.cc +++ /dev/null @@ -1,504 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include "KSVGReader.moc" -#include "SVGSVGElementImpl.h" -#include "SVGViewSpecImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGShapeImpl.h" -#include "SVGLengthImpl.h" -#include "SVGImageElementImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGUseElementImpl.h" - -namespace KSVG -{ - -class Helper -{ -public: - static Helper *self(KSVGReader *reader = 0); - - void destroy(); - - void setFit(bool bFit = true) { m_bFit = bFit; } - bool fit() { return m_bFit; } - - SVGDocumentImpl *doc() const { return m_reader->doc(); } - KSVGCanvas *canvas() const { return m_reader->canvas(); } - - void addSVGElement(SVGSVGElementImpl *one, DOM::NodeImpl *two) { m_svgMap.insert(two, one); } - SVGSVGElementImpl *nextSVGElement(SVGElementImpl *elem); - SVGSVGElementImpl *nextSVGElement(DOM::Node elem); - void setFinished(bool error, const TQString &errorDesc = "") { m_reader->setFinished(error, errorDesc); } - - // Error handling - void setErrorDescription(const TQString &err) { m_errorDesc = err; } - TQString errorDescription() { return m_errorDesc; } - bool hasError() const { return !m_errorDesc.isEmpty(); } - - bool getURLMode() const { return m_getURLMode; } - void setGetURLMode(bool mode) { m_getURLMode = mode; } - - TQString SVGFragmentId() const { return m_SVGFragmentId; } - void setSVGFragmentId(const TQString &SVGFragmentId) { m_SVGFragmentId = SVGFragmentId; } - -protected: - Helper(KSVGReader *reader); - -private: - Helper(); - Helper(const Helper &rhs); - Helper &operator=(const Helper &rhs); - - static Helper *m_instance; - TQMap m_svgMap; - KSVGReader *m_reader; - bool m_bFit; - bool m_getURLMode; - TQString m_errorDesc; - TQString m_SVGFragmentId; -}; - -class InputHandler : public TQXmlDefaultHandler -{ -public: - virtual bool startDocument(); - virtual bool endDocument(); - virtual bool startElement(const TQString &namespaceURI, - const TQString &localName, - const TQString &qName, - const TQXmlAttributes &atts); - virtual bool endElement(const TQString &namespaceURI, - const TQString &localName, - const TQString &qName); - virtual bool characters(const TQString &ch); - virtual bool warning(const TQXmlParseException &e); - virtual bool error(const TQXmlParseException &e); - virtual bool fatalError(const TQXmlParseException &e); - -private: - DOM::Node *m_rootNode; - DOM::Node *m_currentNode; - DOM::Node m_parentNode; - - bool m_noRendering, m_progressive; -}; - -} - -using namespace KSVG; - -Helper *Helper::m_instance = 0; - -Helper::Helper(KSVGReader *reader) -{ - m_reader = reader; -} - -Helper *Helper::self(KSVGReader *reader) -{ - if(m_instance && reader != 0) - m_instance->m_reader = reader; - if(!m_instance) - { - Q_ASSERT(reader != 0); - m_instance = new Helper(reader); - } - - return m_instance; -} - -void Helper::destroy() -{ - m_svgMap.clear(); -} - -SVGSVGElementImpl *Helper::nextSVGElement(SVGElementImpl *elem) -{ - return nextSVGElement(*elem); -} - -SVGSVGElementImpl *Helper::nextSVGElement(DOM::Node elem) -{ - DOM::Node foundSVG; - DOM::Node shape = elem.parentNode(); - - for(; !shape.isNull(); shape = shape.parentNode()) - { - if(reinterpret_cast(shape).nodeName() == "svg") - { - foundSVG = shape; - break; - } - } - - SVGSVGElementImpl *svg = m_svgMap[foundSVG.handle()]; - return svg; -} - -bool InputHandler::startDocument() -{ - m_rootNode = 0; - m_currentNode = 0; - m_noRendering = false; - - KSimpleConfig config("ksvgpluginrc"); - config.setGroup("Rendering"); - m_progressive = config.readBoolEntry("ProgressiveRendering", true); - - if(Helper::self()->canvas()) - Helper::self()->canvas()->setImmediateUpdate(m_progressive); - - return true; -} - -bool InputHandler::endDocument() -{ - Helper::self()->setFinished(false); - if (Helper::self()->canvas()) - Helper::self()->canvas()->setImmediateUpdate(false); - - return true; -} - -bool InputHandler::characters(const TQString &ch) -{ - kdDebug(26001) << "InputHandler::characters, read " << ch << endl; - - if(ch.simplifyWhiteSpace().isEmpty()) - return true; - - TQString t = ch; - - SVGSVGElementImpl *root = Helper::self()->nextSVGElement(*m_currentNode); - if(root) - { - SVGElementImpl *element = root->ownerDoc()->getElementFromHandle(m_currentNode->handle()); - SVGLangSpaceImpl *langSpace = dynamic_cast(element); - - if(langSpace) - t = langSpace->handleText(ch); - } - - if(!t.isEmpty()) - { - DOM::Text impl = static_cast(Helper::self()->doc())->createTextNode(t); - m_currentNode->appendChild(impl); - } - - return true; -} - -bool InputHandler::startElement(const TQString &namespaceURI, const TQString &, const TQString &qName, const TQXmlAttributes &attrs) -{ - kdDebug(26001) << "InputHandler::startElement, namespaceURI " << namespaceURI << " qName " << qName << endl; - - SVGElementImpl *newElement = 0; - SVGSVGElementImpl *svg = 0; - - if(qName == "svg") - { - DOM::Element impl = static_cast(Helper::self()->doc())->createElementNS(namespaceURI, qName); - newElement = SVGDocumentImpl::createElement(qName, impl, Helper::self()->doc()); - svg = dynamic_cast(newElement); - - Helper::self()->addSVGElement(svg, impl.handle()); - - // Need this before we can find our ownerSVGElement (AP) - if(m_currentNode != 0) - { - m_currentNode->appendChild(*svg); - } - else - { - if(Helper::self()->fit()) - { // handle fitting of svg into small drawing area(thumb) - // TODO : aspectratio? and what about svgs that dont provide width and height? - if(attrs.value("viewBox").isEmpty()) - { - SVGLengthImpl *width = SVGSVGElementImpl::createSVGLength(); - SVGLengthImpl *height = SVGSVGElementImpl::createSVGLength(); - width->setValueAsString(attrs.value("width")); - height->setValueAsString(attrs.value("height")); - TQString viewbox = TQString("0 0 %1 %2").arg(width->value()).arg(height->value()); - //kdDebug(26001) << "VIEWBOX : " << viewbox.latin1() << endl; - // HACK - // Does the existing attribute need to be deleted before appending the new attribute? - const_cast(attrs).append("viewBox", TQString::null, "viewBox", viewbox); - width->deref(); - height->deref(); - } - // HACK - // Does the existing attribute need to be deleted before appending the new attribute? - const_cast(attrs).append("width", TQString::null, "width", TQString::number(Helper::self()->canvas()->width())); - const_cast(attrs).append("height", TQString::null, "height", TQString::number(Helper::self()->canvas()->height())); - } - - if(!Helper::self()->SVGFragmentId().isEmpty()) - { - if(svg->currentView()->parseViewSpec(Helper::self()->SVGFragmentId())) - { - svg->setUseCurrentView(true); - } - } - } - - if(m_rootNode == 0) - { - Helper::self()->doc()->appendChild(*svg); - Helper::self()->doc()->setRootElement(svg); - - m_rootNode = svg; - } - } - else - { - if(!m_rootNode && !Helper::self()->getURLMode()) - { - Helper::self()->setErrorDescription(i18n("A legal svg document requires a root element")); - return false; - } - - DOM::Element impl = static_cast(Helper::self()->doc())->createElementNS(namespaceURI, qName); - newElement = SVGDocumentImpl::createElement(qName, impl, Helper::self()->doc()); - - // m_currentNode == 0 if we are dynamically extending the dom (parsexml...) - // and the file doesn't have a root element - if(m_currentNode != 0) - m_currentNode->appendChild(*newElement); - else - Helper::self()->doc()->appendChild(*newElement); - - // Special logics: - if(qName == "switch" || qName == "pattern" || qName == "mask") - m_noRendering = true; - } - - newElement->setOwnerSVGElement(Helper::self()->nextSVGElement(newElement)); - newElement->setViewportElement(newElement->ownerSVGElement()); - - newElement->setAttributes(attrs); - - if(svg && svg->ownerSVGElement() == 0) - { - SVGImageElementImpl *parentImage = Helper::self()->doc()->parentImage(); - - if(parentImage) - { - // We're being displayed in a document via an 'image' element. Set - // us up to fit into it's rectangle. - parentImage->setupSVGElement(svg); - } - } - - SVGLocatableImpl *locatable = dynamic_cast(newElement); - - if(locatable) - { - // Set up the cached screenCTM - SVGLocatableImpl *locatableParent = 0; - DOM::Node parentNode = newElement->parentNode(); - - if(!parentNode.isNull()) - { - SVGElementImpl *parent = Helper::self()->doc()->getElementFromHandle(parentNode.handle()); - - if(parent) - locatableParent = dynamic_cast(parent); - } - - SVGMatrixImpl *parentMatrix = 0; - - if(locatableParent) - parentMatrix = locatableParent->getScreenCTM(); - else - parentMatrix = SVGSVGElementImpl::createSVGMatrix(); - - locatable->updateCachedScreenCTM(parentMatrix); - parentMatrix->deref(); - } - - m_currentNode = newElement; - return !Helper::self()->hasError(); -} - -bool InputHandler::endElement(const TQString &, const TQString &, const TQString &qName) -{ - kdDebug(26001) << "InputHandler::endElement, qName " << qName << endl; - - bool haveCanvas = Helper::self()->canvas(); - - SVGSVGElementImpl *root = Helper::self()->nextSVGElement(*m_currentNode); - SVGElementImpl *element = root ? root->ownerDoc()->getElementFromHandle(m_currentNode->handle()) : Helper::self()->doc()->getElementFromHandle(m_currentNode->handle()); - SVGShapeImpl *shape = dynamic_cast(element); - SVGTestsImpl *tests = dynamic_cast(element); - SVGStylableImpl *style = dynamic_cast(element); - - if(qName != "script" && !m_noRendering && !Helper::self()->getURLMode()) - { - if(!root) - { - if(haveCanvas) - { - if(!m_progressive) - Helper::self()->canvas()->update(); - - Helper::self()->canvas()->blit(); - - TQValueList forwardReferencingUseElements = Helper::self()->doc()->forwardReferencingUseElements(); - - if(!forwardReferencingUseElements.isEmpty()) - { - // Create the elements again now that we have parsed the whole document. - TQValueList::iterator it; - - Helper::self()->canvas()->setImmediateUpdate(false); - - for(it = forwardReferencingUseElements.begin(); it != forwardReferencingUseElements.end(); it++) - (*it)->createItem(Helper::self()->canvas()); - - // The newly created items will need to be moved into their correct z-order positions. - Helper::self()->doc()->resortZIndicesOnFinishedLoading(); - } - } - - return true; // we have reached the bottom - } - - if(haveCanvas && (tests ? tests->ok() : true)) - { - if((shape && !shape->isContainer()) || (!shape && element)) - element->createItem(); - } - } - - // Special logics: - if(qName == "switch" || qName == "pattern" || qName == "mask") - { - m_noRendering = false; - bool ok = tests ? tests->ok() : true; - - if((haveCanvas && element && style && ok && style->getDisplay() && style->getVisible() && (qName == "pattern")) || (shape && shape->directRender())) - element->createItem(); - } - - m_parentNode = m_currentNode->parentNode(); // this is needed since otherwise we get temporary vars - m_currentNode = &m_parentNode; - - return true; -} - -bool InputHandler::warning(const TQXmlParseException &e) -{ - kdDebug(26001) << "[" << e.lineNumber() << ":" << e.columnNumber() << "]: WARNING: " << e.message() << endl; - return true; -} - -bool InputHandler::error(const TQXmlParseException &e) -{ - kdDebug(26001) << "[" << e.lineNumber() << ":" << e.columnNumber() << "]: ERROR: " << e.message() << endl; - return true; -} - -bool InputHandler::fatalError(const TQXmlParseException &e) -{ - TQString error; - - if(Helper::self()->hasError()) - { - error = Helper::self()->errorDescription(); - Helper::self()->setErrorDescription(TQString()); - } - else - error = TQString("[%1:%2]: FATAL ERROR: %3").arg(e.lineNumber()).arg(e.columnNumber()).arg(e.message()); - - kdDebug(26001) << "InputHandler::fatalError, " << error << endl; - - Helper::self()->setFinished(true, error); - return true; -} - -struct KSVGReader::Private -{ - TQXmlSimpleReader *reader; - InputHandler *inputHandler; - SVGDocumentImpl *doc; - KSVGCanvas *canvas; -}; - -KSVGReader::KSVGReader(SVGDocumentImpl *doc, KSVGCanvas *canvas, ParsingArgs args) : TQObject(), d(new Private) -{ - d->doc = doc; - d->canvas = canvas; - - d->reader = new TQXmlSimpleReader(); - d->inputHandler = new InputHandler(); - - Helper::self(this); - Helper::self()->setFit(args.fit); - Helper::self()->setGetURLMode(args.getURLMode); - Helper::self()->setSVGFragmentId(args.SVGFragmentId); - - d->reader->setContentHandler(d->inputHandler); - d->reader->setErrorHandler(d->inputHandler); -} - -KSVGReader::~KSVGReader() -{ - Helper::self()->destroy(); - - delete d->reader; - delete d->inputHandler; - delete d; -} - -void KSVGReader::parse(TQXmlInputSource *source) -{ - d->reader->parse(source); -} - -void KSVGReader::finishParsing(bool, const TQString &errorDesc) -{ - Helper::self()->setErrorDescription(errorDesc); -} - -void KSVGReader::setFinished(bool error, const TQString &errorDesc) -{ - kdDebug(26001) << "KSVGReader::setFinished" << endl; - emit finished(error, errorDesc); -} - -SVGDocumentImpl *KSVGReader::doc() -{ - return d->doc; -} - -KSVG::KSVGCanvas *KSVGReader::canvas() -{ - return d->canvas; -} diff --git a/ksvg/core/KSVGReader.cpp b/ksvg/core/KSVGReader.cpp new file mode 100644 index 00000000..3fbbefd3 --- /dev/null +++ b/ksvg/core/KSVGReader.cpp @@ -0,0 +1,504 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include "KSVGReader.moc" +#include "SVGSVGElementImpl.h" +#include "SVGViewSpecImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGShapeImpl.h" +#include "SVGLengthImpl.h" +#include "SVGImageElementImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGUseElementImpl.h" + +namespace KSVG +{ + +class Helper +{ +public: + static Helper *self(KSVGReader *reader = 0); + + void destroy(); + + void setFit(bool bFit = true) { m_bFit = bFit; } + bool fit() { return m_bFit; } + + SVGDocumentImpl *doc() const { return m_reader->doc(); } + KSVGCanvas *canvas() const { return m_reader->canvas(); } + + void addSVGElement(SVGSVGElementImpl *one, DOM::NodeImpl *two) { m_svgMap.insert(two, one); } + SVGSVGElementImpl *nextSVGElement(SVGElementImpl *elem); + SVGSVGElementImpl *nextSVGElement(DOM::Node elem); + void setFinished(bool error, const TQString &errorDesc = "") { m_reader->setFinished(error, errorDesc); } + + // Error handling + void setErrorDescription(const TQString &err) { m_errorDesc = err; } + TQString errorDescription() { return m_errorDesc; } + bool hasError() const { return !m_errorDesc.isEmpty(); } + + bool getURLMode() const { return m_getURLMode; } + void setGetURLMode(bool mode) { m_getURLMode = mode; } + + TQString SVGFragmentId() const { return m_SVGFragmentId; } + void setSVGFragmentId(const TQString &SVGFragmentId) { m_SVGFragmentId = SVGFragmentId; } + +protected: + Helper(KSVGReader *reader); + +private: + Helper(); + Helper(const Helper &rhs); + Helper &operator=(const Helper &rhs); + + static Helper *m_instance; + TQMap m_svgMap; + KSVGReader *m_reader; + bool m_bFit; + bool m_getURLMode; + TQString m_errorDesc; + TQString m_SVGFragmentId; +}; + +class InputHandler : public TQXmlDefaultHandler +{ +public: + virtual bool startDocument(); + virtual bool endDocument(); + virtual bool startElement(const TQString &namespaceURI, + const TQString &localName, + const TQString &qName, + const TQXmlAttributes &atts); + virtual bool endElement(const TQString &namespaceURI, + const TQString &localName, + const TQString &qName); + virtual bool characters(const TQString &ch); + virtual bool warning(const TQXmlParseException &e); + virtual bool error(const TQXmlParseException &e); + virtual bool fatalError(const TQXmlParseException &e); + +private: + DOM::Node *m_rootNode; + DOM::Node *m_currentNode; + DOM::Node m_parentNode; + + bool m_noRendering, m_progressive; +}; + +} + +using namespace KSVG; + +Helper *Helper::m_instance = 0; + +Helper::Helper(KSVGReader *reader) +{ + m_reader = reader; +} + +Helper *Helper::self(KSVGReader *reader) +{ + if(m_instance && reader != 0) + m_instance->m_reader = reader; + if(!m_instance) + { + Q_ASSERT(reader != 0); + m_instance = new Helper(reader); + } + + return m_instance; +} + +void Helper::destroy() +{ + m_svgMap.clear(); +} + +SVGSVGElementImpl *Helper::nextSVGElement(SVGElementImpl *elem) +{ + return nextSVGElement(*elem); +} + +SVGSVGElementImpl *Helper::nextSVGElement(DOM::Node elem) +{ + DOM::Node foundSVG; + DOM::Node shape = elem.parentNode(); + + for(; !shape.isNull(); shape = shape.parentNode()) + { + if(reinterpret_cast(shape).nodeName() == "svg") + { + foundSVG = shape; + break; + } + } + + SVGSVGElementImpl *svg = m_svgMap[foundSVG.handle()]; + return svg; +} + +bool InputHandler::startDocument() +{ + m_rootNode = 0; + m_currentNode = 0; + m_noRendering = false; + + KSimpleConfig config("ksvgpluginrc"); + config.setGroup("Rendering"); + m_progressive = config.readBoolEntry("ProgressiveRendering", true); + + if(Helper::self()->canvas()) + Helper::self()->canvas()->setImmediateUpdate(m_progressive); + + return true; +} + +bool InputHandler::endDocument() +{ + Helper::self()->setFinished(false); + if (Helper::self()->canvas()) + Helper::self()->canvas()->setImmediateUpdate(false); + + return true; +} + +bool InputHandler::characters(const TQString &ch) +{ + kdDebug(26001) << "InputHandler::characters, read " << ch << endl; + + if(ch.simplifyWhiteSpace().isEmpty()) + return true; + + TQString t = ch; + + SVGSVGElementImpl *root = Helper::self()->nextSVGElement(*m_currentNode); + if(root) + { + SVGElementImpl *element = root->ownerDoc()->getElementFromHandle(m_currentNode->handle()); + SVGLangSpaceImpl *langSpace = dynamic_cast(element); + + if(langSpace) + t = langSpace->handleText(ch); + } + + if(!t.isEmpty()) + { + DOM::Text impl = static_cast(Helper::self()->doc())->createTextNode(t); + m_currentNode->appendChild(impl); + } + + return true; +} + +bool InputHandler::startElement(const TQString &namespaceURI, const TQString &, const TQString &qName, const TQXmlAttributes &attrs) +{ + kdDebug(26001) << "InputHandler::startElement, namespaceURI " << namespaceURI << " qName " << qName << endl; + + SVGElementImpl *newElement = 0; + SVGSVGElementImpl *svg = 0; + + if(qName == "svg") + { + DOM::Element impl = static_cast(Helper::self()->doc())->createElementNS(namespaceURI, qName); + newElement = SVGDocumentImpl::createElement(qName, impl, Helper::self()->doc()); + svg = dynamic_cast(newElement); + + Helper::self()->addSVGElement(svg, impl.handle()); + + // Need this before we can find our ownerSVGElement (AP) + if(m_currentNode != 0) + { + m_currentNode->appendChild(*svg); + } + else + { + if(Helper::self()->fit()) + { // handle fitting of svg into small drawing area(thumb) + // TODO : aspectratio? and what about svgs that dont provide width and height? + if(attrs.value("viewBox").isEmpty()) + { + SVGLengthImpl *width = SVGSVGElementImpl::createSVGLength(); + SVGLengthImpl *height = SVGSVGElementImpl::createSVGLength(); + width->setValueAsString(attrs.value("width")); + height->setValueAsString(attrs.value("height")); + TQString viewbox = TQString("0 0 %1 %2").arg(width->value()).arg(height->value()); + //kdDebug(26001) << "VIEWBOX : " << viewbox.latin1() << endl; + // HACK + // Does the existing attribute need to be deleted before appending the new attribute? + const_cast(attrs).append("viewBox", TQString::null, "viewBox", viewbox); + width->deref(); + height->deref(); + } + // HACK + // Does the existing attribute need to be deleted before appending the new attribute? + const_cast(attrs).append("width", TQString::null, "width", TQString::number(Helper::self()->canvas()->width())); + const_cast(attrs).append("height", TQString::null, "height", TQString::number(Helper::self()->canvas()->height())); + } + + if(!Helper::self()->SVGFragmentId().isEmpty()) + { + if(svg->currentView()->parseViewSpec(Helper::self()->SVGFragmentId())) + { + svg->setUseCurrentView(true); + } + } + } + + if(m_rootNode == 0) + { + Helper::self()->doc()->appendChild(*svg); + Helper::self()->doc()->setRootElement(svg); + + m_rootNode = svg; + } + } + else + { + if(!m_rootNode && !Helper::self()->getURLMode()) + { + Helper::self()->setErrorDescription(i18n("A legal svg document requires a root element")); + return false; + } + + DOM::Element impl = static_cast(Helper::self()->doc())->createElementNS(namespaceURI, qName); + newElement = SVGDocumentImpl::createElement(qName, impl, Helper::self()->doc()); + + // m_currentNode == 0 if we are dynamically extending the dom (parsexml...) + // and the file doesn't have a root element + if(m_currentNode != 0) + m_currentNode->appendChild(*newElement); + else + Helper::self()->doc()->appendChild(*newElement); + + // Special logics: + if(qName == "switch" || qName == "pattern" || qName == "mask") + m_noRendering = true; + } + + newElement->setOwnerSVGElement(Helper::self()->nextSVGElement(newElement)); + newElement->setViewportElement(newElement->ownerSVGElement()); + + newElement->setAttributes(attrs); + + if(svg && svg->ownerSVGElement() == 0) + { + SVGImageElementImpl *parentImage = Helper::self()->doc()->parentImage(); + + if(parentImage) + { + // We're being displayed in a document via an 'image' element. Set + // us up to fit into it's rectangle. + parentImage->setupSVGElement(svg); + } + } + + SVGLocatableImpl *locatable = dynamic_cast(newElement); + + if(locatable) + { + // Set up the cached screenCTM + SVGLocatableImpl *locatableParent = 0; + DOM::Node parentNode = newElement->parentNode(); + + if(!parentNode.isNull()) + { + SVGElementImpl *parent = Helper::self()->doc()->getElementFromHandle(parentNode.handle()); + + if(parent) + locatableParent = dynamic_cast(parent); + } + + SVGMatrixImpl *parentMatrix = 0; + + if(locatableParent) + parentMatrix = locatableParent->getScreenCTM(); + else + parentMatrix = SVGSVGElementImpl::createSVGMatrix(); + + locatable->updateCachedScreenCTM(parentMatrix); + parentMatrix->deref(); + } + + m_currentNode = newElement; + return !Helper::self()->hasError(); +} + +bool InputHandler::endElement(const TQString &, const TQString &, const TQString &qName) +{ + kdDebug(26001) << "InputHandler::endElement, qName " << qName << endl; + + bool haveCanvas = Helper::self()->canvas(); + + SVGSVGElementImpl *root = Helper::self()->nextSVGElement(*m_currentNode); + SVGElementImpl *element = root ? root->ownerDoc()->getElementFromHandle(m_currentNode->handle()) : Helper::self()->doc()->getElementFromHandle(m_currentNode->handle()); + SVGShapeImpl *shape = dynamic_cast(element); + SVGTestsImpl *tests = dynamic_cast(element); + SVGStylableImpl *style = dynamic_cast(element); + + if(qName != "script" && !m_noRendering && !Helper::self()->getURLMode()) + { + if(!root) + { + if(haveCanvas) + { + if(!m_progressive) + Helper::self()->canvas()->update(); + + Helper::self()->canvas()->blit(); + + TQValueList forwardReferencingUseElements = Helper::self()->doc()->forwardReferencingUseElements(); + + if(!forwardReferencingUseElements.isEmpty()) + { + // Create the elements again now that we have parsed the whole document. + TQValueList::iterator it; + + Helper::self()->canvas()->setImmediateUpdate(false); + + for(it = forwardReferencingUseElements.begin(); it != forwardReferencingUseElements.end(); it++) + (*it)->createItem(Helper::self()->canvas()); + + // The newly created items will need to be moved into their correct z-order positions. + Helper::self()->doc()->resortZIndicesOnFinishedLoading(); + } + } + + return true; // we have reached the bottom + } + + if(haveCanvas && (tests ? tests->ok() : true)) + { + if((shape && !shape->isContainer()) || (!shape && element)) + element->createItem(); + } + } + + // Special logics: + if(qName == "switch" || qName == "pattern" || qName == "mask") + { + m_noRendering = false; + bool ok = tests ? tests->ok() : true; + + if((haveCanvas && element && style && ok && style->getDisplay() && style->getVisible() && (qName == "pattern")) || (shape && shape->directRender())) + element->createItem(); + } + + m_parentNode = m_currentNode->parentNode(); // this is needed since otherwise we get temporary vars + m_currentNode = &m_parentNode; + + return true; +} + +bool InputHandler::warning(const TQXmlParseException &e) +{ + kdDebug(26001) << "[" << e.lineNumber() << ":" << e.columnNumber() << "]: WARNING: " << e.message() << endl; + return true; +} + +bool InputHandler::error(const TQXmlParseException &e) +{ + kdDebug(26001) << "[" << e.lineNumber() << ":" << e.columnNumber() << "]: ERROR: " << e.message() << endl; + return true; +} + +bool InputHandler::fatalError(const TQXmlParseException &e) +{ + TQString error; + + if(Helper::self()->hasError()) + { + error = Helper::self()->errorDescription(); + Helper::self()->setErrorDescription(TQString()); + } + else + error = TQString("[%1:%2]: FATAL ERROR: %3").arg(e.lineNumber()).arg(e.columnNumber()).arg(e.message()); + + kdDebug(26001) << "InputHandler::fatalError, " << error << endl; + + Helper::self()->setFinished(true, error); + return true; +} + +struct KSVGReader::Private +{ + TQXmlSimpleReader *reader; + InputHandler *inputHandler; + SVGDocumentImpl *doc; + KSVGCanvas *canvas; +}; + +KSVGReader::KSVGReader(SVGDocumentImpl *doc, KSVGCanvas *canvas, ParsingArgs args) : TQObject(), d(new Private) +{ + d->doc = doc; + d->canvas = canvas; + + d->reader = new TQXmlSimpleReader(); + d->inputHandler = new InputHandler(); + + Helper::self(this); + Helper::self()->setFit(args.fit); + Helper::self()->setGetURLMode(args.getURLMode); + Helper::self()->setSVGFragmentId(args.SVGFragmentId); + + d->reader->setContentHandler(d->inputHandler); + d->reader->setErrorHandler(d->inputHandler); +} + +KSVGReader::~KSVGReader() +{ + Helper::self()->destroy(); + + delete d->reader; + delete d->inputHandler; + delete d; +} + +void KSVGReader::parse(TQXmlInputSource *source) +{ + d->reader->parse(source); +} + +void KSVGReader::finishParsing(bool, const TQString &errorDesc) +{ + Helper::self()->setErrorDescription(errorDesc); +} + +void KSVGReader::setFinished(bool error, const TQString &errorDesc) +{ + kdDebug(26001) << "KSVGReader::setFinished" << endl; + emit finished(error, errorDesc); +} + +SVGDocumentImpl *KSVGReader::doc() +{ + return d->doc; +} + +KSVG::KSVGCanvas *KSVGReader::canvas() +{ + return d->canvas; +} diff --git a/ksvg/core/Makefile.am b/ksvg/core/Makefile.am index e1867428..c511c165 100644 --- a/ksvg/core/Makefile.am +++ b/ksvg/core/Makefile.am @@ -1,6 +1,6 @@ noinst_LTLIBRARIES = libksvgcore.la -libksvgcore_la_SOURCES = KSVGLoader.cpp KSVGCanvas.cpp KSVGReader.cc KSVGTextChunk.cpp CanvasFactory.cpp CanvasItems.cpp KSVGHelper.cpp DocumentFactory.cpp +libksvgcore_la_SOURCES = KSVGLoader.cpp KSVGCanvas.cpp KSVGReader.cpp KSVGTextChunk.cpp CanvasFactory.cpp CanvasItems.cpp KSVGHelper.cpp DocumentFactory.cpp libksvgcore_la_METASOURCES = AUTO servicetypedir = $(kde_servicetypesdir) diff --git a/ksvg/data/SVGAElementImpl.lut.h b/ksvg/data/SVGAElementImpl.lut.h index 2d303e23..b99a5c31 100644 --- a/ksvg/data/SVGAElementImpl.lut.h +++ b/ksvg/data/SVGAElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAngleImpl.lut.h b/ksvg/data/SVGAngleImpl.lut.h index ac8ea8ba..6e1b45d4 100644 --- a/ksvg/data/SVGAngleImpl.lut.h +++ b/ksvg/data/SVGAngleImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAngleImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAngleImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedAngleImpl.lut.h b/ksvg/data/SVGAnimatedAngleImpl.lut.h index 27d37f10..d98dd01e 100644 --- a/ksvg/data/SVGAnimatedAngleImpl.lut.h +++ b/ksvg/data/SVGAnimatedAngleImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedAngleImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedAngleImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedBooleanImpl.lut.h b/ksvg/data/SVGAnimatedBooleanImpl.lut.h index e0b612a9..67cd8a37 100644 --- a/ksvg/data/SVGAnimatedBooleanImpl.lut.h +++ b/ksvg/data/SVGAnimatedBooleanImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedBooleanImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedBooleanImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedEnumerationImpl.lut.h b/ksvg/data/SVGAnimatedEnumerationImpl.lut.h index 2c9c5bbb..227666e8 100644 --- a/ksvg/data/SVGAnimatedEnumerationImpl.lut.h +++ b/ksvg/data/SVGAnimatedEnumerationImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedEnumerationImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedEnumerationImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedIntegerImpl.lut.h b/ksvg/data/SVGAnimatedIntegerImpl.lut.h index 53f318f0..e769d35c 100644 --- a/ksvg/data/SVGAnimatedIntegerImpl.lut.h +++ b/ksvg/data/SVGAnimatedIntegerImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedIntegerImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedIntegerImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedLengthImpl.lut.h b/ksvg/data/SVGAnimatedLengthImpl.lut.h index 3de40716..28bbb642 100644 --- a/ksvg/data/SVGAnimatedLengthImpl.lut.h +++ b/ksvg/data/SVGAnimatedLengthImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedLengthImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedLengthImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedLengthListImpl.lut.h b/ksvg/data/SVGAnimatedLengthListImpl.lut.h index 25f317a1..dd28fc61 100644 --- a/ksvg/data/SVGAnimatedLengthListImpl.lut.h +++ b/ksvg/data/SVGAnimatedLengthListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedLengthListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedLengthListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedNumberImpl.lut.h b/ksvg/data/SVGAnimatedNumberImpl.lut.h index 68c935e0..15800017 100644 --- a/ksvg/data/SVGAnimatedNumberImpl.lut.h +++ b/ksvg/data/SVGAnimatedNumberImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedNumberImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedNumberImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedNumberListImpl.lut.h b/ksvg/data/SVGAnimatedNumberListImpl.lut.h index d10cdb39..77b1183a 100644 --- a/ksvg/data/SVGAnimatedNumberListImpl.lut.h +++ b/ksvg/data/SVGAnimatedNumberListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedNumberListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedNumberListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedPathDataImpl.lut.h b/ksvg/data/SVGAnimatedPathDataImpl.lut.h index 3bf7f4b3..76238d7a 100644 --- a/ksvg/data/SVGAnimatedPathDataImpl.lut.h +++ b/ksvg/data/SVGAnimatedPathDataImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedPathDataImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedPathDataImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedPointsImpl.lut.h b/ksvg/data/SVGAnimatedPointsImpl.lut.h index aa5c49c6..832ce16c 100644 --- a/ksvg/data/SVGAnimatedPointsImpl.lut.h +++ b/ksvg/data/SVGAnimatedPointsImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedPointsImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedPointsImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedPreserveAspectRatioImpl.lut.h b/ksvg/data/SVGAnimatedPreserveAspectRatioImpl.lut.h index e93eb180..6903faee 100644 --- a/ksvg/data/SVGAnimatedPreserveAspectRatioImpl.lut.h +++ b/ksvg/data/SVGAnimatedPreserveAspectRatioImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedPreserveAspectRatioImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedPreserveAspectRatioImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedRectImpl.lut.h b/ksvg/data/SVGAnimatedRectImpl.lut.h index 1f7c994c..30023f69 100644 --- a/ksvg/data/SVGAnimatedRectImpl.lut.h +++ b/ksvg/data/SVGAnimatedRectImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedRectImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedRectImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedStringImpl.lut.h b/ksvg/data/SVGAnimatedStringImpl.lut.h index 264a1681..9be92fca 100644 --- a/ksvg/data/SVGAnimatedStringImpl.lut.h +++ b/ksvg/data/SVGAnimatedStringImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedStringImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedStringImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimatedTransformListImpl.lut.h b/ksvg/data/SVGAnimatedTransformListImpl.lut.h index 29a9116c..50f01362 100644 --- a/ksvg/data/SVGAnimatedTransformListImpl.lut.h +++ b/ksvg/data/SVGAnimatedTransformListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimatedTransformListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimatedTransformListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGAnimationElementImpl.lut.h b/ksvg/data/SVGAnimationElementImpl.lut.h index 39504503..3f76ee3c 100644 --- a/ksvg/data/SVGAnimationElementImpl.lut.h +++ b/ksvg/data/SVGAnimationElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGAnimationElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGAnimationElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGCircleElementImpl.lut.h b/ksvg/data/SVGCircleElementImpl.lut.h index cd58c0ba..bd58769b 100644 --- a/ksvg/data/SVGCircleElementImpl.lut.h +++ b/ksvg/data/SVGCircleElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGCircleElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGCircleElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGClipPathElementImpl.lut.h b/ksvg/data/SVGClipPathElementImpl.lut.h index ffaf7566..35fab5da 100644 --- a/ksvg/data/SVGClipPathElementImpl.lut.h +++ b/ksvg/data/SVGClipPathElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGClipPathElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGClipPathElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGColorImpl.lut.h b/ksvg/data/SVGColorImpl.lut.h index c1f0ca4b..d32c4998 100644 --- a/ksvg/data/SVGColorImpl.lut.h +++ b/ksvg/data/SVGColorImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGColorImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGColorImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGColorProfileElementImpl.lut.h b/ksvg/data/SVGColorProfileElementImpl.lut.h index f686f347..552e8c51 100644 --- a/ksvg/data/SVGColorProfileElementImpl.lut.h +++ b/ksvg/data/SVGColorProfileElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGColorProfileElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGColorProfileElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGCursorElementImpl.lut.h b/ksvg/data/SVGCursorElementImpl.lut.h index 26df2ec6..dc5bad0b 100644 --- a/ksvg/data/SVGCursorElementImpl.lut.h +++ b/ksvg/data/SVGCursorElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGCursorElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGCursorElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGDocumentImpl.lut.h b/ksvg/data/SVGDocumentImpl.lut.h index 5cd3a1d8..43b03ec4 100644 --- a/ksvg/data/SVGDocumentImpl.lut.h +++ b/ksvg/data/SVGDocumentImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGDocumentImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGDocumentImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGEcma.lut.h b/ksvg/data/SVGEcma.lut.h index c4aad5da..cd7d75ef 100644 --- a/ksvg/data/SVGEcma.lut.h +++ b/ksvg/data/SVGEcma.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGEcma.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGEcma.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGElementImpl.lut.h b/ksvg/data/SVGElementImpl.lut.h index da976ae0..941c0040 100644 --- a/ksvg/data/SVGElementImpl.lut.h +++ b/ksvg/data/SVGElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGEllipseElementImpl.lut.h b/ksvg/data/SVGEllipseElementImpl.lut.h index d39018d9..9db9d2e5 100644 --- a/ksvg/data/SVGEllipseElementImpl.lut.h +++ b/ksvg/data/SVGEllipseElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGEllipseElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGEllipseElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGEventImpl.lut.h b/ksvg/data/SVGEventImpl.lut.h index e7192b72..63795ede 100644 --- a/ksvg/data/SVGEventImpl.lut.h +++ b/ksvg/data/SVGEventImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGEventImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGEventImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGExternalResourcesRequiredImpl.lut.h b/ksvg/data/SVGExternalResourcesRequiredImpl.lut.h index e952c4a1..12b53aa8 100644 --- a/ksvg/data/SVGExternalResourcesRequiredImpl.lut.h +++ b/ksvg/data/SVGExternalResourcesRequiredImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGExternalResourcesRequiredImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGExternalResourcesRequiredImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGFitToViewBoxImpl.lut.h b/ksvg/data/SVGFitToViewBoxImpl.lut.h index 04b34c2e..3e04ba29 100644 --- a/ksvg/data/SVGFitToViewBoxImpl.lut.h +++ b/ksvg/data/SVGFitToViewBoxImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGFitToViewBoxImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGFitToViewBoxImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGForeignObjectElementImpl.lut.h b/ksvg/data/SVGForeignObjectElementImpl.lut.h index 16273af9..8bc35092 100644 --- a/ksvg/data/SVGForeignObjectElementImpl.lut.h +++ b/ksvg/data/SVGForeignObjectElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGForeignObjectElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGForeignObjectElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGGlyphElementImpl.lut.h b/ksvg/data/SVGGlyphElementImpl.lut.h index 8300e1c8..742d426e 100644 --- a/ksvg/data/SVGGlyphElementImpl.lut.h +++ b/ksvg/data/SVGGlyphElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGGlyphElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGGlyphElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGGlyphRefElementImpl.lut.h b/ksvg/data/SVGGlyphRefElementImpl.lut.h index f5d55bf1..0d432e0b 100644 --- a/ksvg/data/SVGGlyphRefElementImpl.lut.h +++ b/ksvg/data/SVGGlyphRefElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGGlyphRefElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGGlyphRefElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGGradientElementImpl.lut.h b/ksvg/data/SVGGradientElementImpl.lut.h index 7b779406..7efbfa8b 100644 --- a/ksvg/data/SVGGradientElementImpl.lut.h +++ b/ksvg/data/SVGGradientElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGGradientElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGGradientElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGICCColorImpl.lut.h b/ksvg/data/SVGICCColorImpl.lut.h index 1a7064ad..3f4897fc 100644 --- a/ksvg/data/SVGICCColorImpl.lut.h +++ b/ksvg/data/SVGICCColorImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGICCColorImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGICCColorImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGImageElementImpl.lut.h b/ksvg/data/SVGImageElementImpl.lut.h index 25641ee9..76906102 100644 --- a/ksvg/data/SVGImageElementImpl.lut.h +++ b/ksvg/data/SVGImageElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGImageElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGImageElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGLangSpaceImpl.lut.h b/ksvg/data/SVGLangSpaceImpl.lut.h index 3f00372e..2d838dd3 100644 --- a/ksvg/data/SVGLangSpaceImpl.lut.h +++ b/ksvg/data/SVGLangSpaceImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGLangSpaceImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGLangSpaceImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGLengthImpl.lut.h b/ksvg/data/SVGLengthImpl.lut.h index a9f3bbc2..e097fdf8 100644 --- a/ksvg/data/SVGLengthImpl.lut.h +++ b/ksvg/data/SVGLengthImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGLengthImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGLengthImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGLengthListImpl.lut.h b/ksvg/data/SVGLengthListImpl.lut.h index fc7249d0..f55fb042 100644 --- a/ksvg/data/SVGLengthListImpl.lut.h +++ b/ksvg/data/SVGLengthListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGLengthListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGLengthListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGLineElementImpl.lut.h b/ksvg/data/SVGLineElementImpl.lut.h index 92dfd1a4..41ee7ef7 100644 --- a/ksvg/data/SVGLineElementImpl.lut.h +++ b/ksvg/data/SVGLineElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGLineElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGLineElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGLinearGradientElementImpl.lut.h b/ksvg/data/SVGLinearGradientElementImpl.lut.h index 65e4efba..16096835 100644 --- a/ksvg/data/SVGLinearGradientElementImpl.lut.h +++ b/ksvg/data/SVGLinearGradientElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGLinearGradientElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGLinearGradientElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGLocatableImpl.lut.h b/ksvg/data/SVGLocatableImpl.lut.h index ff489e1c..2c1a36fc 100644 --- a/ksvg/data/SVGLocatableImpl.lut.h +++ b/ksvg/data/SVGLocatableImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGLocatableImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGLocatableImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGMarkerElementImpl.lut.h b/ksvg/data/SVGMarkerElementImpl.lut.h index bc08f91d..2e679bab 100644 --- a/ksvg/data/SVGMarkerElementImpl.lut.h +++ b/ksvg/data/SVGMarkerElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGMarkerElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGMarkerElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGMaskElementImpl.lut.h b/ksvg/data/SVGMaskElementImpl.lut.h index 9957c71e..60aaa045 100644 --- a/ksvg/data/SVGMaskElementImpl.lut.h +++ b/ksvg/data/SVGMaskElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGMaskElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGMaskElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGMatrixImpl.lut.h b/ksvg/data/SVGMatrixImpl.lut.h index c4845b37..66588e56 100644 --- a/ksvg/data/SVGMatrixImpl.lut.h +++ b/ksvg/data/SVGMatrixImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGMatrixImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGMatrixImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGNumberImpl.lut.h b/ksvg/data/SVGNumberImpl.lut.h index 789150fe..9a7935c4 100644 --- a/ksvg/data/SVGNumberImpl.lut.h +++ b/ksvg/data/SVGNumberImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGNumberImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGNumberImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGNumberListImpl.lut.h b/ksvg/data/SVGNumberListImpl.lut.h index 4a9b715b..ca12b5f0 100644 --- a/ksvg/data/SVGNumberListImpl.lut.h +++ b/ksvg/data/SVGNumberListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGNumberListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGNumberListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPaintImpl.lut.h b/ksvg/data/SVGPaintImpl.lut.h index 0b2721e8..3b9b10fc 100644 --- a/ksvg/data/SVGPaintImpl.lut.h +++ b/ksvg/data/SVGPaintImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPaintImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPaintImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathElementImpl.lut.h b/ksvg/data/SVGPathElementImpl.lut.h index acb1300e..3a337893 100644 --- a/ksvg/data/SVGPathElementImpl.lut.h +++ b/ksvg/data/SVGPathElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegArcImpl.lut.h b/ksvg/data/SVGPathSegArcImpl.lut.h index 589b53e2..a4955d08 100644 --- a/ksvg/data/SVGPathSegArcImpl.lut.h +++ b/ksvg/data/SVGPathSegArcImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegArcImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegArcImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegCurvetoCubicImpl.lut.h b/ksvg/data/SVGPathSegCurvetoCubicImpl.lut.h index bf65567a..e61d4d1d 100644 --- a/ksvg/data/SVGPathSegCurvetoCubicImpl.lut.h +++ b/ksvg/data/SVGPathSegCurvetoCubicImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegCurvetoCubicImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegCurvetoCubicImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegCurvetoCubicSmoothImpl.lut.h b/ksvg/data/SVGPathSegCurvetoCubicSmoothImpl.lut.h index e7a6e880..3f3342df 100644 --- a/ksvg/data/SVGPathSegCurvetoCubicSmoothImpl.lut.h +++ b/ksvg/data/SVGPathSegCurvetoCubicSmoothImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegCurvetoCubicSmoothImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegCurvetoCubicSmoothImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegCurvetoQuadraticImpl.lut.h b/ksvg/data/SVGPathSegCurvetoQuadraticImpl.lut.h index ed6b4903..555a5307 100644 --- a/ksvg/data/SVGPathSegCurvetoQuadraticImpl.lut.h +++ b/ksvg/data/SVGPathSegCurvetoQuadraticImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegCurvetoQuadraticImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegCurvetoQuadraticImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegCurvetoQuadraticSmoothImpl.lut.h b/ksvg/data/SVGPathSegCurvetoQuadraticSmoothImpl.lut.h index 700ef0a0..33a53595 100644 --- a/ksvg/data/SVGPathSegCurvetoQuadraticSmoothImpl.lut.h +++ b/ksvg/data/SVGPathSegCurvetoQuadraticSmoothImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegCurvetoQuadraticSmoothImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegCurvetoQuadraticSmoothImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegImpl.lut.h b/ksvg/data/SVGPathSegImpl.lut.h index 237e1cb6..fceba663 100644 --- a/ksvg/data/SVGPathSegImpl.lut.h +++ b/ksvg/data/SVGPathSegImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegLinetoHorizontalImpl.lut.h b/ksvg/data/SVGPathSegLinetoHorizontalImpl.lut.h index 471f1b8f..2296650c 100644 --- a/ksvg/data/SVGPathSegLinetoHorizontalImpl.lut.h +++ b/ksvg/data/SVGPathSegLinetoHorizontalImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegLinetoHorizontalImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegLinetoHorizontalImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegLinetoImpl.lut.h b/ksvg/data/SVGPathSegLinetoImpl.lut.h index 482e1cd6..ab7616ae 100644 --- a/ksvg/data/SVGPathSegLinetoImpl.lut.h +++ b/ksvg/data/SVGPathSegLinetoImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegLinetoImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegLinetoImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegLinetoVerticalImpl.lut.h b/ksvg/data/SVGPathSegLinetoVerticalImpl.lut.h index 73c92d48..fa266b85 100644 --- a/ksvg/data/SVGPathSegLinetoVerticalImpl.lut.h +++ b/ksvg/data/SVGPathSegLinetoVerticalImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegLinetoVerticalImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegLinetoVerticalImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegListImpl.lut.h b/ksvg/data/SVGPathSegListImpl.lut.h index c0a16ee2..7ad127f3 100644 --- a/ksvg/data/SVGPathSegListImpl.lut.h +++ b/ksvg/data/SVGPathSegListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPathSegMovetoImpl.lut.h b/ksvg/data/SVGPathSegMovetoImpl.lut.h index bdefa143..74c86427 100644 --- a/ksvg/data/SVGPathSegMovetoImpl.lut.h +++ b/ksvg/data/SVGPathSegMovetoImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPathSegMovetoImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPathSegMovetoImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPatternElementImpl.lut.h b/ksvg/data/SVGPatternElementImpl.lut.h index c4a5958a..9413e41e 100644 --- a/ksvg/data/SVGPatternElementImpl.lut.h +++ b/ksvg/data/SVGPatternElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPatternElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPatternElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPointImpl.lut.h b/ksvg/data/SVGPointImpl.lut.h index c4b3c31d..98683b4a 100644 --- a/ksvg/data/SVGPointImpl.lut.h +++ b/ksvg/data/SVGPointImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPointImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPointImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPointListImpl.lut.h b/ksvg/data/SVGPointListImpl.lut.h index d693900a..f7506e36 100644 --- a/ksvg/data/SVGPointListImpl.lut.h +++ b/ksvg/data/SVGPointListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPointListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPointListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGPreserveAspectRatioImpl.lut.h b/ksvg/data/SVGPreserveAspectRatioImpl.lut.h index 944fe692..080a796a 100644 --- a/ksvg/data/SVGPreserveAspectRatioImpl.lut.h +++ b/ksvg/data/SVGPreserveAspectRatioImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGPreserveAspectRatioImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGPreserveAspectRatioImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGRadialGradientElementImpl.lut.h b/ksvg/data/SVGRadialGradientElementImpl.lut.h index 0cada147..dc927ea4 100644 --- a/ksvg/data/SVGRadialGradientElementImpl.lut.h +++ b/ksvg/data/SVGRadialGradientElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGRadialGradientElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGRadialGradientElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGRectElementImpl.lut.h b/ksvg/data/SVGRectElementImpl.lut.h index a20e808e..d0df0902 100644 --- a/ksvg/data/SVGRectElementImpl.lut.h +++ b/ksvg/data/SVGRectElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGRectElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGRectElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGRectImpl.lut.h b/ksvg/data/SVGRectImpl.lut.h index 9480824a..c92d6f59 100644 --- a/ksvg/data/SVGRectImpl.lut.h +++ b/ksvg/data/SVGRectImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGRectImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGRectImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGSVGElementImpl.lut.h b/ksvg/data/SVGSVGElementImpl.lut.h index 9666e6f9..a3774004 100644 --- a/ksvg/data/SVGSVGElementImpl.lut.h +++ b/ksvg/data/SVGSVGElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGSVGElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGSVGElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGScriptElementImpl.lut.h b/ksvg/data/SVGScriptElementImpl.lut.h index af7c480b..175d43a5 100644 --- a/ksvg/data/SVGScriptElementImpl.lut.h +++ b/ksvg/data/SVGScriptElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGScriptElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGScriptElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGStopElementImpl.lut.h b/ksvg/data/SVGStopElementImpl.lut.h index 9aa2ee3c..85f8467c 100644 --- a/ksvg/data/SVGStopElementImpl.lut.h +++ b/ksvg/data/SVGStopElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGStopElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGStopElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGStringListImpl.lut.h b/ksvg/data/SVGStringListImpl.lut.h index 84f734d6..a1e170d8 100644 --- a/ksvg/data/SVGStringListImpl.lut.h +++ b/ksvg/data/SVGStringListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGStringListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGStringListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGStylableImpl.lut.h b/ksvg/data/SVGStylableImpl.lut.h index 838001a7..4df9c0ed 100644 --- a/ksvg/data/SVGStylableImpl.lut.h +++ b/ksvg/data/SVGStylableImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGStylableImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGStylableImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGStyleElementImpl.lut.h b/ksvg/data/SVGStyleElementImpl.lut.h index 230402a9..2d06559a 100644 --- a/ksvg/data/SVGStyleElementImpl.lut.h +++ b/ksvg/data/SVGStyleElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGStyleElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGStyleElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGSymbolElementImpl.lut.h b/ksvg/data/SVGSymbolElementImpl.lut.h index 1b2b0888..b24274be 100644 --- a/ksvg/data/SVGSymbolElementImpl.lut.h +++ b/ksvg/data/SVGSymbolElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGSymbolElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGSymbolElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGTestsImpl.lut.h b/ksvg/data/SVGTestsImpl.lut.h index 15bb4518..87bef91f 100644 --- a/ksvg/data/SVGTestsImpl.lut.h +++ b/ksvg/data/SVGTestsImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGTestsImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGTestsImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGTextContentElementImpl.lut.h b/ksvg/data/SVGTextContentElementImpl.lut.h index a8710d9a..7a122dc7 100644 --- a/ksvg/data/SVGTextContentElementImpl.lut.h +++ b/ksvg/data/SVGTextContentElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGTextContentElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGTextContentElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGTextPathElementImpl.lut.h b/ksvg/data/SVGTextPathElementImpl.lut.h index d9986d91..9ec2dd2c 100644 --- a/ksvg/data/SVGTextPathElementImpl.lut.h +++ b/ksvg/data/SVGTextPathElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGTextPathElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGTextPathElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGTextPositioningElementImpl.lut.h b/ksvg/data/SVGTextPositioningElementImpl.lut.h index 77f6dae3..cf37e411 100644 --- a/ksvg/data/SVGTextPositioningElementImpl.lut.h +++ b/ksvg/data/SVGTextPositioningElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGTextPositioningElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGTextPositioningElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGTransformImpl.lut.h b/ksvg/data/SVGTransformImpl.lut.h index 50a5c7dd..75c5659f 100644 --- a/ksvg/data/SVGTransformImpl.lut.h +++ b/ksvg/data/SVGTransformImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGTransformImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGTransformImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGTransformListImpl.lut.h b/ksvg/data/SVGTransformListImpl.lut.h index 25af98e8..c7d2b7cd 100644 --- a/ksvg/data/SVGTransformListImpl.lut.h +++ b/ksvg/data/SVGTransformListImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGTransformListImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGTransformListImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGTransformableImpl.lut.h b/ksvg/data/SVGTransformableImpl.lut.h index 39dada09..f8573852 100644 --- a/ksvg/data/SVGTransformableImpl.lut.h +++ b/ksvg/data/SVGTransformableImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGTransformableImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGTransformableImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGURIReferenceImpl.lut.h b/ksvg/data/SVGURIReferenceImpl.lut.h index 7df7ccb4..053deb47 100644 --- a/ksvg/data/SVGURIReferenceImpl.lut.h +++ b/ksvg/data/SVGURIReferenceImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGURIReferenceImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGURIReferenceImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGUseElementImpl.lut.h b/ksvg/data/SVGUseElementImpl.lut.h index fe27d2b8..daad02bc 100644 --- a/ksvg/data/SVGUseElementImpl.lut.h +++ b/ksvg/data/SVGUseElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGUseElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGUseElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGViewElementImpl.lut.h b/ksvg/data/SVGViewElementImpl.lut.h index 2a40c677..666a4aa4 100644 --- a/ksvg/data/SVGViewElementImpl.lut.h +++ b/ksvg/data/SVGViewElementImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGViewElementImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGViewElementImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGZoomAndPanImpl.lut.h b/ksvg/data/SVGZoomAndPanImpl.lut.h index 80a647a6..71e3bba5 100644 --- a/ksvg/data/SVGZoomAndPanImpl.lut.h +++ b/ksvg/data/SVGZoomAndPanImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGZoomAndPanImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGZoomAndPanImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/data/SVGZoomEventImpl.lut.h b/ksvg/data/SVGZoomEventImpl.lut.h index 2b927ca3..29464130 100644 --- a/ksvg/data/SVGZoomEventImpl.lut.h +++ b/ksvg/data/SVGZoomEventImpl.lut.h @@ -1,4 +1,4 @@ -/* Automatically generated from impl/SVGZoomEventImpl.cc using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ +/* Automatically generated from impl/SVGZoomEventImpl.cpp using ../../tdelibs/kjs/create_hash_table. DO NOT EDIT ! */ using namespace KJS; diff --git a/ksvg/dom/CMakeLists.txt b/ksvg/dom/CMakeLists.txt index 8d6658e9..08f0ab03 100644 --- a/ksvg/dom/CMakeLists.txt +++ b/ksvg/dom/CMakeLists.txt @@ -76,50 +76,50 @@ install( FILES tde_add_library( ksvgdom STATIC_PIC SOURCES - SVGLength.cc SVGAnimatedLength.cc SVGNumber.cc SVGAnimatedNumber.cc - SVGPoint.cc SVGTSpanElement.cc SVGTRefElement.cc SVGAnimatedLengthList.cc - SVGAnimatedNumberList.cc SVGTransformList.cc SVGAElement.cc - SVGAnimatedTransformList.cc SVGRectElement.cc SVGCircleElement.cc - SVGEllipseElement.cc SVGLineElement.cc SVGPolylineElement.cc - SVGPolygonElement.cc SVGTextPositioningElement.cc SVGTextContentElement.cc - SVGTextElement.cc SVGImageElement.cc SVGUseElement.cc SVGMatrix.cc - SVGTransform.cc SVGPointList.cc SVGDocument.cc SVGAnimatedEnumeration.cc - SVGDefsElement.cc SVGLocatable.cc SVGTransformable.cc SVGStylable.cc - SVGGElement.cc SVGAngle.cc SVGAnimatedAngle.cc SVGColor.cc SVGPathElement.cc - SVGPathSegList.cc SVGTests.cc SVGLangSpace.cc SVGStringList.cc SVGPathSeg.cc - SVGPathSegClosePath.cc SVGPathSegMoveto.cc SVGPathSegLinetoHorizontal.cc - SVGPathSegLinetoVertical.cc SVGPathSegLineto.cc SVGPathSegCurvetoCubic.cc - SVGDescElement.cc SVGTitleElement.cc SVGExternalResourcesRequired.cc - SVGAnimatedBoolean.cc SVGNumberList.cc SVGPathSegCurvetoCubicSmooth.cc - SVGPathSegCurvetoQuadratic.cc SVGAnimatedRect.cc SVGAnimatedString.cc - SVGPathSegCurvetoQuadraticSmooth.cc SVGPathSegArc.cc SVGURIReference.cc - SVGAnimatedInteger.cc SVGLengthList.cc SVGSVGElement.cc SVGRect.cc - SVGFitToViewBox.cc SVGAnimatedPreserveAspectRatio.cc SVGPreserveAspectRatio.cc - SVGElement.cc SVGStyleElement.cc SVGClipPathElement.cc SVGMaskElement.cc - SVGColorProfileElement.cc SVGColorProfileRule.cc SVGZoomAndPan.cc - SVGScriptElement.cc SVGSwitchElement.cc SVGSymbolElement.cc - SVGDefinitionSrcElement.cc SVGFontFaceElement.cc SVGFontFaceFormatElement.cc - SVGFontFaceNameElement.cc SVGFontFaceSrcElement.cc SVGHKernElement.cc - SVGMetadataElement.cc SVGVKernElement.cc SVGCursorElement.cc - SVGForeignObjectElement.cc SVGFontFaceUriElement.cc SVGElementInstance.cc - SVGElementInstanceList.cc SVGAnimatedPoints.cc SVGAnimatedPathData.cc - SVGMarkerElement.cc SVGViewSpec.cc SVGViewElement.cc SVGFilterElement.cc - SVGFilterPrimitiveStandardAttributes.cc SVGFEBlendElement.cc - SVGFEColorMatrixElement.cc SVGFEComponentTransferElement.cc - SVGComponentTransferFunctionElement.cc SVGFEFuncAElement.cc - SVGFEFuncBElement.cc SVGFEFuncGElement.cc SVGFEFuncRElement.cc - SVGFECompositeElement.cc SVGFEConvolveMatrixElement.cc SVGFEFloodElement.cc - SVGFEGaussianBlurElement.cc SVGFEDiffuseLightingElement.cc - SVGFEDistantLightElement.cc SVGFEPointLightElement.cc - SVGFESpotLightElement.cc SVGFEDisplacementMapElement.cc SVGFEMergeElement.cc - SVGFEMergeNodeElement.cc SVGFEImageElement.cc SVGFEMorphologyElement.cc - SVGFEOffsetElement.cc SVGFESpecularLightingElement.cc SVGFETileElement.cc - SVGFETurbulenceElement.cc SVGAnimationElement.cc SVGAnimateElement.cc - SVGSetElement.cc SVGAnimateMotionElement.cc SVGAnimateColorElement.cc - SVGAnimateTransformElement.cc SVGEvent.cc SVGZoomEvent.cc SVGICCColor.cc - SVGCSSRule.cc SVGGradientElement.cc SVGRadialGradientElement.cc - SVGLinearGradientElement.cc SVGStopElement.cc SVGPatternElement.cc - SVGMPathElement.cc SVGFontElement.cc SVGAltGlyphElement.cc - SVGGlyphRefElement.cc SVGAltGlyphDefElement.cc SVGGlyphElement.cc - SVGMissingGlyphElement.cc SVGPaint.cc SVGTextPathElement.cc SVGWindow.cc + SVGLength.cpp SVGAnimatedLength.cpp SVGNumber.cpp SVGAnimatedNumber.cpp + SVGPoint.cpp SVGTSpanElement.cpp SVGTRefElement.cpp SVGAnimatedLengthList.cpp + SVGAnimatedNumberList.cpp SVGTransformList.cpp SVGAElement.cpp + SVGAnimatedTransformList.cpp SVGRectElement.cpp SVGCircleElement.cpp + SVGEllipseElement.cpp SVGLineElement.cpp SVGPolylineElement.cpp + SVGPolygonElement.cpp SVGTextPositioningElement.cpp SVGTextContentElement.cpp + SVGTextElement.cpp SVGImageElement.cpp SVGUseElement.cpp SVGMatrix.cpp + SVGTransform.cpp SVGPointList.cpp SVGDocument.cpp SVGAnimatedEnumeration.cpp + SVGDefsElement.cpp SVGLocatable.cpp SVGTransformable.cpp SVGStylable.cpp + SVGGElement.cpp SVGAngle.cpp SVGAnimatedAngle.cpp SVGColor.cpp SVGPathElement.cpp + SVGPathSegList.cpp SVGTests.cpp SVGLangSpace.cpp SVGStringList.cpp SVGPathSeg.cpp + SVGPathSegClosePath.cpp SVGPathSegMoveto.cpp SVGPathSegLinetoHorizontal.cpp + SVGPathSegLinetoVertical.cpp SVGPathSegLineto.cpp SVGPathSegCurvetoCubic.cpp + SVGDescElement.cpp SVGTitleElement.cpp SVGExternalResourcesRequired.cpp + SVGAnimatedBoolean.cpp SVGNumberList.cpp SVGPathSegCurvetoCubicSmooth.cpp + SVGPathSegCurvetoQuadratic.cpp SVGAnimatedRect.cpp SVGAnimatedString.cpp + SVGPathSegCurvetoQuadraticSmooth.cpp SVGPathSegArc.cpp SVGURIReference.cpp + SVGAnimatedInteger.cpp SVGLengthList.cpp SVGSVGElement.cpp SVGRect.cpp + SVGFitToViewBox.cpp SVGAnimatedPreserveAspectRatio.cpp SVGPreserveAspectRatio.cpp + SVGElement.cpp SVGStyleElement.cpp SVGClipPathElement.cpp SVGMaskElement.cpp + SVGColorProfileElement.cpp SVGColorProfileRule.cpp SVGZoomAndPan.cpp + SVGScriptElement.cpp SVGSwitchElement.cpp SVGSymbolElement.cpp + SVGDefinitionSrcElement.cpp SVGFontFaceElement.cpp SVGFontFaceFormatElement.cpp + SVGFontFaceNameElement.cpp SVGFontFaceSrcElement.cpp SVGHKernElement.cpp + SVGMetadataElement.cpp SVGVKernElement.cpp SVGCursorElement.cpp + SVGForeignObjectElement.cpp SVGFontFaceUriElement.cpp SVGElementInstance.cpp + SVGElementInstanceList.cpp SVGAnimatedPoints.cpp SVGAnimatedPathData.cpp + SVGMarkerElement.cpp SVGViewSpec.cpp SVGViewElement.cpp SVGFilterElement.cpp + SVGFilterPrimitiveStandardAttributes.cpp SVGFEBlendElement.cpp + SVGFEColorMatrixElement.cpp SVGFEComponentTransferElement.cpp + SVGComponentTransferFunctionElement.cpp SVGFEFuncAElement.cpp + SVGFEFuncBElement.cpp SVGFEFuncGElement.cpp SVGFEFuncRElement.cpp + SVGFECompositeElement.cpp SVGFEConvolveMatrixElement.cpp SVGFEFloodElement.cpp + SVGFEGaussianBlurElement.cpp SVGFEDiffuseLightingElement.cpp + SVGFEDistantLightElement.cpp SVGFEPointLightElement.cpp + SVGFESpotLightElement.cpp SVGFEDisplacementMapElement.cpp SVGFEMergeElement.cpp + SVGFEMergeNodeElement.cpp SVGFEImageElement.cpp SVGFEMorphologyElement.cpp + SVGFEOffsetElement.cpp SVGFESpecularLightingElement.cpp SVGFETileElement.cpp + SVGFETurbulenceElement.cpp SVGAnimationElement.cpp SVGAnimateElement.cpp + SVGSetElement.cpp SVGAnimateMotionElement.cpp SVGAnimateColorElement.cpp + SVGAnimateTransformElement.cpp SVGEvent.cpp SVGZoomEvent.cpp SVGICCColor.cpp + SVGCSSRule.cpp SVGGradientElement.cpp SVGRadialGradientElement.cpp + SVGLinearGradientElement.cpp SVGStopElement.cpp SVGPatternElement.cpp + SVGMPathElement.cpp SVGFontElement.cpp SVGAltGlyphElement.cpp + SVGGlyphRefElement.cpp SVGAltGlyphDefElement.cpp SVGGlyphElement.cpp + SVGMissingGlyphElement.cpp SVGPaint.cpp SVGTextPathElement.cpp SVGWindow.cpp ) diff --git a/ksvg/dom/Makefile.am b/ksvg/dom/Makefile.am index 9b6b1cf7..7c51c022 100644 --- a/ksvg/dom/Makefile.am +++ b/ksvg/dom/Makefile.am @@ -31,27 +31,27 @@ myinclude_HEADERS = SVGAElement.h SVGAltGlyphElement.h SVGAltGlyphDefElement.h S SVGTitleElement.h SVGTransform.h SVGTransformList.h SVGTransformable.h SVGURIReference.h SVGUnitTypes.h \ SVGUseElement.h SVGVKernElement.h SVGViewElement.h SVGViewSpec.h SVGWindow.h SVGZoomAndPan.h SVGZoomEvent.h -libksvgdom_la_SOURCES = SVGLength.cc SVGAnimatedLength.cc SVGNumber.cc SVGAnimatedNumber.cc SVGPoint.cc SVGTSpanElement.cc SVGTRefElement.cc \ - SVGAnimatedLengthList.cc SVGAnimatedNumberList.cc SVGTransformList.cc SVGAElement.cc SVGAnimatedTransformList.cc \ - SVGRectElement.cc SVGCircleElement.cc SVGEllipseElement.cc SVGLineElement.cc SVGPolylineElement.cc SVGPolygonElement.cc \ - SVGTextPositioningElement.cc SVGTextContentElement.cc SVGTextElement.cc SVGImageElement.cc SVGUseElement.cc \ - SVGMatrix.cc SVGTransform.cc SVGPointList.cc SVGDocument.cc SVGAnimatedEnumeration.cc SVGDefsElement.cc \ - SVGLocatable.cc SVGTransformable.cc SVGStylable.cc SVGGElement.cc SVGAngle.cc SVGAnimatedAngle.cc \ - SVGColor.cc SVGPathElement.cc SVGPathSegList.cc SVGTests.cc SVGLangSpace.cc SVGStringList.cc \ - SVGPathSeg.cc SVGPathSegClosePath.cc SVGPathSegMoveto.cc SVGPathSegLinetoHorizontal.cc SVGPathSegLinetoVertical.cc SVGPathSegLineto.cc \ - SVGPathSegCurvetoCubic.cc SVGDescElement.cc SVGTitleElement.cc SVGExternalResourcesRequired.cc SVGAnimatedBoolean.cc SVGNumberList.cc \ - SVGPathSegCurvetoCubicSmooth.cc SVGPathSegCurvetoQuadratic.cc SVGAnimatedRect.cc SVGAnimatedString.cc \ - SVGPathSegCurvetoQuadraticSmooth.cc SVGPathSegArc.cc SVGURIReference.cc SVGAnimatedInteger.cc SVGLengthList.cc \ - SVGSVGElement.cc SVGRect.cc SVGFitToViewBox.cc SVGAnimatedPreserveAspectRatio.cc SVGPreserveAspectRatio.cc SVGElement.cc \ - SVGStyleElement.cc SVGClipPathElement.cc SVGMaskElement.cc SVGColorProfileElement.cc SVGColorProfileRule.cc SVGZoomAndPan.cc SVGScriptElement.cc \ - SVGSwitchElement.cc SVGSymbolElement.cc \ - SVGDefinitionSrcElement.cc SVGFontFaceElement.cc SVGFontFaceFormatElement.cc SVGFontFaceNameElement.cc SVGFontFaceSrcElement.cc SVGHKernElement.cc SVGMetadataElement.cc SVGVKernElement.cc SVGCursorElement.cc SVGForeignObjectElement.cc SVGFontFaceUriElement.cc \ - SVGElementInstance.cc SVGElementInstanceList.cc SVGAnimatedPoints.cc SVGAnimatedPathData.cc SVGMarkerElement.cc SVGViewSpec.cc SVGViewElement.cc \ - SVGFilterElement.cc SVGFilterPrimitiveStandardAttributes.cc SVGFEBlendElement.cc SVGFEColorMatrixElement.cc SVGFEComponentTransferElement.cc SVGComponentTransferFunctionElement.cc SVGFEFuncAElement.cc SVGFEFuncBElement.cc SVGFEFuncGElement.cc SVGFEFuncRElement.cc SVGFECompositeElement.cc SVGFEConvolveMatrixElement.cc SVGFEFloodElement.cc SVGFEGaussianBlurElement.cc SVGFEDiffuseLightingElement.cc SVGFEDistantLightElement.cc SVGFEPointLightElement.cc SVGFESpotLightElement.cc SVGFEDisplacementMapElement.cc SVGFEMergeElement.cc SVGFEMergeNodeElement.cc SVGFEImageElement.cc SVGFEMorphologyElement.cc SVGFEOffsetElement.cc SVGFESpecularLightingElement.cc SVGFETileElement.cc SVGFETurbulenceElement.cc \ - SVGAnimationElement.cc SVGAnimateElement.cc SVGSetElement.cc SVGAnimateMotionElement.cc SVGAnimateColorElement.cc SVGAnimateTransformElement.cc \ - SVGEvent.cc SVGZoomEvent.cc SVGICCColor.cc SVGCSSRule.cc \ - SVGGradientElement.cc SVGRadialGradientElement.cc SVGLinearGradientElement.cc SVGStopElement.cc SVGPatternElement.cc SVGMPathElement.cc \ - SVGFontElement.cc SVGAltGlyphElement.cc SVGGlyphRefElement.cc SVGAltGlyphDefElement.cc SVGGlyphElement.cc SVGMissingGlyphElement.cc SVGPaint.cc SVGTextPathElement.cc SVGWindow.cc +libksvgdom_la_SOURCES = SVGLength.cpp SVGAnimatedLength.cpp SVGNumber.cpp SVGAnimatedNumber.cpp SVGPoint.cpp SVGTSpanElement.cpp SVGTRefElement.cpp \ + SVGAnimatedLengthList.cpp SVGAnimatedNumberList.cpp SVGTransformList.cpp SVGAElement.cpp SVGAnimatedTransformList.cpp \ + SVGRectElement.cpp SVGCircleElement.cpp SVGEllipseElement.cpp SVGLineElement.cpp SVGPolylineElement.cpp SVGPolygonElement.cpp \ + SVGTextPositioningElement.cpp SVGTextContentElement.cpp SVGTextElement.cpp SVGImageElement.cpp SVGUseElement.cpp \ + SVGMatrix.cpp SVGTransform.cpp SVGPointList.cpp SVGDocument.cpp SVGAnimatedEnumeration.cpp SVGDefsElement.cpp \ + SVGLocatable.cpp SVGTransformable.cpp SVGStylable.cpp SVGGElement.cpp SVGAngle.cpp SVGAnimatedAngle.cpp \ + SVGColor.cpp SVGPathElement.cpp SVGPathSegList.cpp SVGTests.cpp SVGLangSpace.cpp SVGStringList.cpp \ + SVGPathSeg.cpp SVGPathSegClosePath.cpp SVGPathSegMoveto.cpp SVGPathSegLinetoHorizontal.cpp SVGPathSegLinetoVertical.cpp SVGPathSegLineto.cpp \ + SVGPathSegCurvetoCubic.cpp SVGDescElement.cpp SVGTitleElement.cpp SVGExternalResourcesRequired.cpp SVGAnimatedBoolean.cpp SVGNumberList.cpp \ + SVGPathSegCurvetoCubicSmooth.cpp SVGPathSegCurvetoQuadratic.cpp SVGAnimatedRect.cpp SVGAnimatedString.cpp \ + SVGPathSegCurvetoQuadraticSmooth.cpp SVGPathSegArc.cpp SVGURIReference.cpp SVGAnimatedInteger.cpp SVGLengthList.cpp \ + SVGSVGElement.cpp SVGRect.cpp SVGFitToViewBox.cpp SVGAnimatedPreserveAspectRatio.cpp SVGPreserveAspectRatio.cpp SVGElement.cpp \ + SVGStyleElement.cpp SVGClipPathElement.cpp SVGMaskElement.cpp SVGColorProfileElement.cpp SVGColorProfileRule.cpp SVGZoomAndPan.cpp SVGScriptElement.cpp \ + SVGSwitchElement.cpp SVGSymbolElement.cpp \ + SVGDefinitionSrcElement.cpp SVGFontFaceElement.cpp SVGFontFaceFormatElement.cpp SVGFontFaceNameElement.cpp SVGFontFaceSrcElement.cpp SVGHKernElement.cpp SVGMetadataElement.cpp SVGVKernElement.cpp SVGCursorElement.cpp SVGForeignObjectElement.cpp SVGFontFaceUriElement.cpp \ + SVGElementInstance.cpp SVGElementInstanceList.cpp SVGAnimatedPoints.cpp SVGAnimatedPathData.cpp SVGMarkerElement.cpp SVGViewSpec.cpp SVGViewElement.cpp \ + SVGFilterElement.cpp SVGFilterPrimitiveStandardAttributes.cpp SVGFEBlendElement.cpp SVGFEColorMatrixElement.cpp SVGFEComponentTransferElement.cpp SVGComponentTransferFunctionElement.cpp SVGFEFuncAElement.cpp SVGFEFuncBElement.cpp SVGFEFuncGElement.cpp SVGFEFuncRElement.cpp SVGFECompositeElement.cpp SVGFEConvolveMatrixElement.cpp SVGFEFloodElement.cpp SVGFEGaussianBlurElement.cpp SVGFEDiffuseLightingElement.cpp SVGFEDistantLightElement.cpp SVGFEPointLightElement.cpp SVGFESpotLightElement.cpp SVGFEDisplacementMapElement.cpp SVGFEMergeElement.cpp SVGFEMergeNodeElement.cpp SVGFEImageElement.cpp SVGFEMorphologyElement.cpp SVGFEOffsetElement.cpp SVGFESpecularLightingElement.cpp SVGFETileElement.cpp SVGFETurbulenceElement.cpp \ + SVGAnimationElement.cpp SVGAnimateElement.cpp SVGSetElement.cpp SVGAnimateMotionElement.cpp SVGAnimateColorElement.cpp SVGAnimateTransformElement.cpp \ + SVGEvent.cpp SVGZoomEvent.cpp SVGICCColor.cpp SVGCSSRule.cpp \ + SVGGradientElement.cpp SVGRadialGradientElement.cpp SVGLinearGradientElement.cpp SVGStopElement.cpp SVGPatternElement.cpp SVGMPathElement.cpp \ + SVGFontElement.cpp SVGAltGlyphElement.cpp SVGGlyphRefElement.cpp SVGAltGlyphDefElement.cpp SVGGlyphElement.cpp SVGMissingGlyphElement.cpp SVGPaint.cpp SVGTextPathElement.cpp SVGWindow.cpp libksvgdom_la_METASOURCES = AUTO diff --git a/ksvg/dom/SVGAElement.cc b/ksvg/dom/SVGAElement.cc deleted file mode 100644 index de7b1a20..00000000 --- a/ksvg/dom/SVGAElement.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAElement.h" -#include "SVGAElementImpl.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGAElement::SVGAElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGURIReference() -{ - impl = 0; -} - -SVGAElement::SVGAElement(const SVGAElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other), impl(0) -{ - (*this) = other; -} - -SVGAElement &SVGAElement::operator=(const SVGAElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - SVGURIReference::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAElement::SVGAElement(SVGAElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAElement::~SVGAElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGAElement::target() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->target()); -} diff --git a/ksvg/dom/SVGAElement.cpp b/ksvg/dom/SVGAElement.cpp new file mode 100644 index 00000000..de7b1a20 --- /dev/null +++ b/ksvg/dom/SVGAElement.cpp @@ -0,0 +1,78 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAElement.h" +#include "SVGAElementImpl.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGAElement::SVGAElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGURIReference() +{ + impl = 0; +} + +SVGAElement::SVGAElement(const SVGAElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other), impl(0) +{ + (*this) = other; +} + +SVGAElement &SVGAElement::operator=(const SVGAElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + SVGURIReference::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAElement::SVGAElement(SVGAElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAElement::~SVGAElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGAElement::target() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->target()); +} diff --git a/ksvg/dom/SVGAltGlyphDefElement.cc b/ksvg/dom/SVGAltGlyphDefElement.cc deleted file mode 100644 index caeddbd9..00000000 --- a/ksvg/dom/SVGAltGlyphDefElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAltGlyphDefElement.h" -#include "SVGAltGlyphDefElementImpl.h" - -using namespace KSVG; - -SVGAltGlyphDefElement::SVGAltGlyphDefElement() : SVGElement() -{ - impl = 0; -} - -SVGAltGlyphDefElement::SVGAltGlyphDefElement(const SVGAltGlyphDefElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGAltGlyphDefElement &SVGAltGlyphDefElement::operator=(const SVGAltGlyphDefElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAltGlyphDefElement::SVGAltGlyphDefElement(SVGAltGlyphDefElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAltGlyphDefElement::~SVGAltGlyphDefElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGAltGlyphDefElement.cpp b/ksvg/dom/SVGAltGlyphDefElement.cpp new file mode 100644 index 00000000..caeddbd9 --- /dev/null +++ b/ksvg/dom/SVGAltGlyphDefElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAltGlyphDefElement.h" +#include "SVGAltGlyphDefElementImpl.h" + +using namespace KSVG; + +SVGAltGlyphDefElement::SVGAltGlyphDefElement() : SVGElement() +{ + impl = 0; +} + +SVGAltGlyphDefElement::SVGAltGlyphDefElement(const SVGAltGlyphDefElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGAltGlyphDefElement &SVGAltGlyphDefElement::operator=(const SVGAltGlyphDefElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAltGlyphDefElement::SVGAltGlyphDefElement(SVGAltGlyphDefElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAltGlyphDefElement::~SVGAltGlyphDefElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGAltGlyphElement.cc b/ksvg/dom/SVGAltGlyphElement.cc deleted file mode 100644 index c21d7623..00000000 --- a/ksvg/dom/SVGAltGlyphElement.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAltGlyphElement.h" -#include "SVGAltGlyphElementImpl.h" - -using namespace KSVG; - -SVGAltGlyphElement::SVGAltGlyphElement() : SVGTextPositioningElement(), SVGURIReference() -{ - impl = 0; -} - -SVGAltGlyphElement::SVGAltGlyphElement(const SVGAltGlyphElement &other) : SVGTextPositioningElement(other), SVGURIReference(other), impl(0) -{ - (*this) = other; -} - -SVGAltGlyphElement &SVGAltGlyphElement::operator=(const SVGAltGlyphElement &other) -{ - SVGTextPositioningElement::operator=(other); - SVGURIReference::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAltGlyphElement::SVGAltGlyphElement(SVGAltGlyphElementImpl *other) : SVGTextPositioningElement(other), SVGURIReference(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAltGlyphElement::~SVGAltGlyphElement() -{ - if(impl) - impl->deref(); -} - -DOM::DOMString SVGAltGlyphElement::format() -{ - if(!impl) return DOM::DOMString(); - return impl->format(); -} - -DOM::DOMString SVGAltGlyphElement::glyphRef() -{ - if(!impl) return DOM::DOMString(); - return impl->glyphRef(); -} diff --git a/ksvg/dom/SVGAltGlyphElement.cpp b/ksvg/dom/SVGAltGlyphElement.cpp new file mode 100644 index 00000000..c21d7623 --- /dev/null +++ b/ksvg/dom/SVGAltGlyphElement.cpp @@ -0,0 +1,78 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAltGlyphElement.h" +#include "SVGAltGlyphElementImpl.h" + +using namespace KSVG; + +SVGAltGlyphElement::SVGAltGlyphElement() : SVGTextPositioningElement(), SVGURIReference() +{ + impl = 0; +} + +SVGAltGlyphElement::SVGAltGlyphElement(const SVGAltGlyphElement &other) : SVGTextPositioningElement(other), SVGURIReference(other), impl(0) +{ + (*this) = other; +} + +SVGAltGlyphElement &SVGAltGlyphElement::operator=(const SVGAltGlyphElement &other) +{ + SVGTextPositioningElement::operator=(other); + SVGURIReference::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAltGlyphElement::SVGAltGlyphElement(SVGAltGlyphElementImpl *other) : SVGTextPositioningElement(other), SVGURIReference(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAltGlyphElement::~SVGAltGlyphElement() +{ + if(impl) + impl->deref(); +} + +DOM::DOMString SVGAltGlyphElement::format() +{ + if(!impl) return DOM::DOMString(); + return impl->format(); +} + +DOM::DOMString SVGAltGlyphElement::glyphRef() +{ + if(!impl) return DOM::DOMString(); + return impl->glyphRef(); +} diff --git a/ksvg/dom/SVGAngle.cc b/ksvg/dom/SVGAngle.cc deleted file mode 100644 index bb1aac60..00000000 --- a/ksvg/dom/SVGAngle.cc +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAngle.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -SVGAngle::SVGAngle() -{ - impl = new SVGAngleImpl(); - impl->ref(); -} - -SVGAngle::SVGAngle(const SVGAngle &other) : impl(0) -{ - (*this) = other; -} - -SVGAngle &SVGAngle::operator =(const SVGAngle &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAngle::SVGAngle(SVGAngleImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAngle::~SVGAngle() -{ - if(impl) - impl->deref(); -} - -unsigned short SVGAngle::unitType() const -{ - if(!impl) return SVG_ANGLETYPE_UNKNOWN; - return impl->unitType(); -} - -void SVGAngle::setValue(float value) -{ - if(impl) - impl->setValue(value); -} - -float SVGAngle::value() const -{ - if(!impl) return -1; - return impl->value(); -} - -void SVGAngle::setValueInSpecifiedUnits(float valueInSpecifiedUnits) -{ - if(impl) - impl->setValueInSpecifiedUnits(valueInSpecifiedUnits); -} - -float SVGAngle::valueInSpecifiedUnits() const -{ - if(!impl) return -1; - return impl->valueInSpecifiedUnits(); -} - -void SVGAngle::setValueAsString(const DOM::DOMString &valueAsString) -{ - if(impl) - impl->setValueAsString(valueAsString); -} - -DOM::DOMString SVGAngle::valueAsString() const -{ - if(!impl) return DOM::DOMString(); - return impl->valueAsString(); -} - -void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) -{ - if(impl) - impl->newValueSpecifiedUnits(unitType, valueInSpecifiedUnits); -} - -void SVGAngle::convertToSpecifiedUnits(unsigned short unitType) -{ - if(impl) - impl->convertToSpecifiedUnits(unitType); -} diff --git a/ksvg/dom/SVGAngle.cpp b/ksvg/dom/SVGAngle.cpp new file mode 100644 index 00000000..bb1aac60 --- /dev/null +++ b/ksvg/dom/SVGAngle.cpp @@ -0,0 +1,118 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAngle.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +SVGAngle::SVGAngle() +{ + impl = new SVGAngleImpl(); + impl->ref(); +} + +SVGAngle::SVGAngle(const SVGAngle &other) : impl(0) +{ + (*this) = other; +} + +SVGAngle &SVGAngle::operator =(const SVGAngle &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAngle::SVGAngle(SVGAngleImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAngle::~SVGAngle() +{ + if(impl) + impl->deref(); +} + +unsigned short SVGAngle::unitType() const +{ + if(!impl) return SVG_ANGLETYPE_UNKNOWN; + return impl->unitType(); +} + +void SVGAngle::setValue(float value) +{ + if(impl) + impl->setValue(value); +} + +float SVGAngle::value() const +{ + if(!impl) return -1; + return impl->value(); +} + +void SVGAngle::setValueInSpecifiedUnits(float valueInSpecifiedUnits) +{ + if(impl) + impl->setValueInSpecifiedUnits(valueInSpecifiedUnits); +} + +float SVGAngle::valueInSpecifiedUnits() const +{ + if(!impl) return -1; + return impl->valueInSpecifiedUnits(); +} + +void SVGAngle::setValueAsString(const DOM::DOMString &valueAsString) +{ + if(impl) + impl->setValueAsString(valueAsString); +} + +DOM::DOMString SVGAngle::valueAsString() const +{ + if(!impl) return DOM::DOMString(); + return impl->valueAsString(); +} + +void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) +{ + if(impl) + impl->newValueSpecifiedUnits(unitType, valueInSpecifiedUnits); +} + +void SVGAngle::convertToSpecifiedUnits(unsigned short unitType) +{ + if(impl) + impl->convertToSpecifiedUnits(unitType); +} diff --git a/ksvg/dom/SVGAnimateColorElement.cc b/ksvg/dom/SVGAnimateColorElement.cc deleted file mode 100644 index 32a5f153..00000000 --- a/ksvg/dom/SVGAnimateColorElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimateColorElement.h" -#include "SVGAnimateColorElementImpl.h" - -using namespace KSVG; - -SVGAnimateColorElement::SVGAnimateColorElement() : SVGAnimationElement() -{ - impl = 0; -} - -SVGAnimateColorElement::SVGAnimateColorElement(const SVGAnimateColorElement &other) : SVGAnimationElement(other), impl(0) -{ - (*this) = other; -} - -SVGAnimateColorElement &SVGAnimateColorElement::operator=(const SVGAnimateColorElement &other) -{ - SVGAnimationElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimateColorElement::SVGAnimateColorElement(SVGAnimateColorElementImpl *other) : SVGAnimationElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimateColorElement::~SVGAnimateColorElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGAnimateColorElement.cpp b/ksvg/dom/SVGAnimateColorElement.cpp new file mode 100644 index 00000000..32a5f153 --- /dev/null +++ b/ksvg/dom/SVGAnimateColorElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimateColorElement.h" +#include "SVGAnimateColorElementImpl.h" + +using namespace KSVG; + +SVGAnimateColorElement::SVGAnimateColorElement() : SVGAnimationElement() +{ + impl = 0; +} + +SVGAnimateColorElement::SVGAnimateColorElement(const SVGAnimateColorElement &other) : SVGAnimationElement(other), impl(0) +{ + (*this) = other; +} + +SVGAnimateColorElement &SVGAnimateColorElement::operator=(const SVGAnimateColorElement &other) +{ + SVGAnimationElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimateColorElement::SVGAnimateColorElement(SVGAnimateColorElementImpl *other) : SVGAnimationElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimateColorElement::~SVGAnimateColorElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGAnimateElement.cc b/ksvg/dom/SVGAnimateElement.cc deleted file mode 100644 index 1370b93d..00000000 --- a/ksvg/dom/SVGAnimateElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimateElement.h" -#include "SVGAnimateElementImpl.h" - -using namespace KSVG; - -SVGAnimateElement::SVGAnimateElement() : SVGAnimationElement() -{ - impl = 0; -} - -SVGAnimateElement::SVGAnimateElement(const SVGAnimateElement &other) : SVGAnimationElement(other), impl(0) -{ - (*this) = other; -} - -SVGAnimateElement &SVGAnimateElement::operator=(const SVGAnimateElement &other) -{ - SVGAnimationElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimateElement::SVGAnimateElement(SVGAnimateElementImpl *other) : SVGAnimationElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimateElement::~SVGAnimateElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGAnimateElement.cpp b/ksvg/dom/SVGAnimateElement.cpp new file mode 100644 index 00000000..1370b93d --- /dev/null +++ b/ksvg/dom/SVGAnimateElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimateElement.h" +#include "SVGAnimateElementImpl.h" + +using namespace KSVG; + +SVGAnimateElement::SVGAnimateElement() : SVGAnimationElement() +{ + impl = 0; +} + +SVGAnimateElement::SVGAnimateElement(const SVGAnimateElement &other) : SVGAnimationElement(other), impl(0) +{ + (*this) = other; +} + +SVGAnimateElement &SVGAnimateElement::operator=(const SVGAnimateElement &other) +{ + SVGAnimationElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimateElement::SVGAnimateElement(SVGAnimateElementImpl *other) : SVGAnimationElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimateElement::~SVGAnimateElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGAnimateMotionElement.cc b/ksvg/dom/SVGAnimateMotionElement.cc deleted file mode 100644 index 8b1b7d2c..00000000 --- a/ksvg/dom/SVGAnimateMotionElement.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimateMotionElement.h" -#include "SVGAnimateMotionElementImpl.h" - -using namespace KSVG; - -SVGAnimateMotionElement::SVGAnimateMotionElement() : SVGAnimationElement() -{ - impl = 0; -} - -SVGAnimateMotionElement::SVGAnimateMotionElement(const SVGAnimateMotionElement &other) : SVGAnimationElement(), impl(0) -{ - (*this) = other; -} - -SVGAnimateMotionElement &SVGAnimateMotionElement::operator =(const SVGAnimateMotionElement &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimateMotionElement::SVGAnimateMotionElement(SVGAnimateMotionElementImpl *other) : SVGAnimationElement() -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimateMotionElement::~SVGAnimateMotionElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGAnimateMotionElement.cpp b/ksvg/dom/SVGAnimateMotionElement.cpp new file mode 100644 index 00000000..8b1b7d2c --- /dev/null +++ b/ksvg/dom/SVGAnimateMotionElement.cpp @@ -0,0 +1,63 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimateMotionElement.h" +#include "SVGAnimateMotionElementImpl.h" + +using namespace KSVG; + +SVGAnimateMotionElement::SVGAnimateMotionElement() : SVGAnimationElement() +{ + impl = 0; +} + +SVGAnimateMotionElement::SVGAnimateMotionElement(const SVGAnimateMotionElement &other) : SVGAnimationElement(), impl(0) +{ + (*this) = other; +} + +SVGAnimateMotionElement &SVGAnimateMotionElement::operator =(const SVGAnimateMotionElement &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimateMotionElement::SVGAnimateMotionElement(SVGAnimateMotionElementImpl *other) : SVGAnimationElement() +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimateMotionElement::~SVGAnimateMotionElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGAnimateTransformElement.cc b/ksvg/dom/SVGAnimateTransformElement.cc deleted file mode 100644 index 3bc6a04b..00000000 --- a/ksvg/dom/SVGAnimateTransformElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimateTransformElement.h" -#include "SVGAnimateTransformElementImpl.h" - -using namespace KSVG; - -SVGAnimateTransformElement::SVGAnimateTransformElement() : SVGAnimationElement() -{ - impl = 0; -} - -SVGAnimateTransformElement::SVGAnimateTransformElement(const SVGAnimateTransformElement &other) : SVGAnimationElement(other), impl(0) -{ - (*this) = other; -} - -SVGAnimateTransformElement &SVGAnimateTransformElement::operator=(const SVGAnimateTransformElement &other) -{ - SVGAnimationElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimateTransformElement::SVGAnimateTransformElement(SVGAnimateTransformElementImpl *other) : SVGAnimationElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimateTransformElement::~SVGAnimateTransformElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGAnimateTransformElement.cpp b/ksvg/dom/SVGAnimateTransformElement.cpp new file mode 100644 index 00000000..3bc6a04b --- /dev/null +++ b/ksvg/dom/SVGAnimateTransformElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimateTransformElement.h" +#include "SVGAnimateTransformElementImpl.h" + +using namespace KSVG; + +SVGAnimateTransformElement::SVGAnimateTransformElement() : SVGAnimationElement() +{ + impl = 0; +} + +SVGAnimateTransformElement::SVGAnimateTransformElement(const SVGAnimateTransformElement &other) : SVGAnimationElement(other), impl(0) +{ + (*this) = other; +} + +SVGAnimateTransformElement &SVGAnimateTransformElement::operator=(const SVGAnimateTransformElement &other) +{ + SVGAnimationElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimateTransformElement::SVGAnimateTransformElement(SVGAnimateTransformElementImpl *other) : SVGAnimationElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimateTransformElement::~SVGAnimateTransformElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGAnimatedAngle.cc b/ksvg/dom/SVGAnimatedAngle.cc deleted file mode 100644 index f602defe..00000000 --- a/ksvg/dom/SVGAnimatedAngle.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedAngle.h" -#include "SVGAnimatedAngleImpl.h" -#include "SVGAngle.h" - -using namespace KSVG; - -SVGAnimatedAngle::SVGAnimatedAngle() -{ - impl = new SVGAnimatedAngleImpl(); - impl->ref(); -} - -SVGAnimatedAngle::SVGAnimatedAngle(const SVGAnimatedAngle &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedAngle &SVGAnimatedAngle::operator=(const SVGAnimatedAngle &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedAngle::SVGAnimatedAngle(SVGAnimatedAngleImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedAngle::~SVGAnimatedAngle() -{ - if(impl) - impl->deref(); -} - -SVGAngle SVGAnimatedAngle::baseVal() const -{ - if(!impl) return SVGAngle(0); - return SVGAngle(impl->baseVal()); -} - -SVGAngle SVGAnimatedAngle::animVal() const -{ - if(!impl) return SVGAngle(0); - return SVGAngle(impl->animVal()); -} diff --git a/ksvg/dom/SVGAnimatedAngle.cpp b/ksvg/dom/SVGAnimatedAngle.cpp new file mode 100644 index 00000000..f602defe --- /dev/null +++ b/ksvg/dom/SVGAnimatedAngle.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedAngle.h" +#include "SVGAnimatedAngleImpl.h" +#include "SVGAngle.h" + +using namespace KSVG; + +SVGAnimatedAngle::SVGAnimatedAngle() +{ + impl = new SVGAnimatedAngleImpl(); + impl->ref(); +} + +SVGAnimatedAngle::SVGAnimatedAngle(const SVGAnimatedAngle &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedAngle &SVGAnimatedAngle::operator=(const SVGAnimatedAngle &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedAngle::SVGAnimatedAngle(SVGAnimatedAngleImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedAngle::~SVGAnimatedAngle() +{ + if(impl) + impl->deref(); +} + +SVGAngle SVGAnimatedAngle::baseVal() const +{ + if(!impl) return SVGAngle(0); + return SVGAngle(impl->baseVal()); +} + +SVGAngle SVGAnimatedAngle::animVal() const +{ + if(!impl) return SVGAngle(0); + return SVGAngle(impl->animVal()); +} diff --git a/ksvg/dom/SVGAnimatedBoolean.cc b/ksvg/dom/SVGAnimatedBoolean.cc deleted file mode 100644 index 29e24a67..00000000 --- a/ksvg/dom/SVGAnimatedBoolean.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedBoolean.h" -#include "SVGAnimatedBooleanImpl.h" - -using namespace KSVG; - -SVGAnimatedBoolean::SVGAnimatedBoolean() -{ - impl = new SVGAnimatedBooleanImpl(); - impl->ref(); -} - -SVGAnimatedBoolean::SVGAnimatedBoolean(const SVGAnimatedBoolean &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedBoolean &SVGAnimatedBoolean::operator=(const SVGAnimatedBoolean &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedBoolean::SVGAnimatedBoolean(SVGAnimatedBooleanImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedBoolean::~SVGAnimatedBoolean() -{ - if(impl) - impl->deref(); -} - -void SVGAnimatedBoolean::setBaseVal(bool baseVal) -{ - if(impl) - impl->setBaseVal(baseVal); -} - -bool SVGAnimatedBoolean::baseVal() const -{ - if(!impl) return false; - return impl->baseVal(); -} - -bool SVGAnimatedBoolean::animVal() const -{ - if(!impl) return false; - return impl->animVal(); -} diff --git a/ksvg/dom/SVGAnimatedBoolean.cpp b/ksvg/dom/SVGAnimatedBoolean.cpp new file mode 100644 index 00000000..29e24a67 --- /dev/null +++ b/ksvg/dom/SVGAnimatedBoolean.cpp @@ -0,0 +1,82 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedBooleanImpl.h" + +using namespace KSVG; + +SVGAnimatedBoolean::SVGAnimatedBoolean() +{ + impl = new SVGAnimatedBooleanImpl(); + impl->ref(); +} + +SVGAnimatedBoolean::SVGAnimatedBoolean(const SVGAnimatedBoolean &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedBoolean &SVGAnimatedBoolean::operator=(const SVGAnimatedBoolean &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedBoolean::SVGAnimatedBoolean(SVGAnimatedBooleanImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedBoolean::~SVGAnimatedBoolean() +{ + if(impl) + impl->deref(); +} + +void SVGAnimatedBoolean::setBaseVal(bool baseVal) +{ + if(impl) + impl->setBaseVal(baseVal); +} + +bool SVGAnimatedBoolean::baseVal() const +{ + if(!impl) return false; + return impl->baseVal(); +} + +bool SVGAnimatedBoolean::animVal() const +{ + if(!impl) return false; + return impl->animVal(); +} diff --git a/ksvg/dom/SVGAnimatedEnumeration.cc b/ksvg/dom/SVGAnimatedEnumeration.cc deleted file mode 100644 index 061dc0df..00000000 --- a/ksvg/dom/SVGAnimatedEnumeration.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedEnumerationImpl.h" - -using namespace KSVG; - -SVGAnimatedEnumeration::SVGAnimatedEnumeration() -{ - impl = new SVGAnimatedEnumerationImpl(); - impl->ref(); -} - -SVGAnimatedEnumeration::SVGAnimatedEnumeration(const SVGAnimatedEnumeration &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedEnumeration &SVGAnimatedEnumeration::operator=(const SVGAnimatedEnumeration &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedEnumeration::SVGAnimatedEnumeration(SVGAnimatedEnumerationImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedEnumeration::~SVGAnimatedEnumeration() -{ - if(impl) - impl->deref(); -} - -void SVGAnimatedEnumeration::setBaseVal(unsigned short baseVal) -{ - if(impl) - impl->setBaseVal(baseVal); -} - -unsigned short SVGAnimatedEnumeration::baseVal() const -{ - if(!impl) return 0; - return impl->baseVal(); -} - -unsigned short SVGAnimatedEnumeration::animVal() const -{ - if(!impl) return 0; - return impl->animVal(); -} diff --git a/ksvg/dom/SVGAnimatedEnumeration.cpp b/ksvg/dom/SVGAnimatedEnumeration.cpp new file mode 100644 index 00000000..061dc0df --- /dev/null +++ b/ksvg/dom/SVGAnimatedEnumeration.cpp @@ -0,0 +1,82 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedEnumerationImpl.h" + +using namespace KSVG; + +SVGAnimatedEnumeration::SVGAnimatedEnumeration() +{ + impl = new SVGAnimatedEnumerationImpl(); + impl->ref(); +} + +SVGAnimatedEnumeration::SVGAnimatedEnumeration(const SVGAnimatedEnumeration &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedEnumeration &SVGAnimatedEnumeration::operator=(const SVGAnimatedEnumeration &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedEnumeration::SVGAnimatedEnumeration(SVGAnimatedEnumerationImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedEnumeration::~SVGAnimatedEnumeration() +{ + if(impl) + impl->deref(); +} + +void SVGAnimatedEnumeration::setBaseVal(unsigned short baseVal) +{ + if(impl) + impl->setBaseVal(baseVal); +} + +unsigned short SVGAnimatedEnumeration::baseVal() const +{ + if(!impl) return 0; + return impl->baseVal(); +} + +unsigned short SVGAnimatedEnumeration::animVal() const +{ + if(!impl) return 0; + return impl->animVal(); +} diff --git a/ksvg/dom/SVGAnimatedInteger.cc b/ksvg/dom/SVGAnimatedInteger.cc deleted file mode 100644 index ab91c1cf..00000000 --- a/ksvg/dom/SVGAnimatedInteger.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedInteger.h" -#include "SVGAnimatedIntegerImpl.h" - -using namespace KSVG; - -SVGAnimatedInteger::SVGAnimatedInteger() -{ - impl = new SVGAnimatedIntegerImpl(); - impl->ref(); -} - -SVGAnimatedInteger::SVGAnimatedInteger(const SVGAnimatedInteger &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedInteger &SVGAnimatedInteger::operator=(const SVGAnimatedInteger &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedInteger::SVGAnimatedInteger(SVGAnimatedIntegerImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedInteger::~SVGAnimatedInteger() -{ - if(impl) - impl->deref(); -} - -void SVGAnimatedInteger::setBaseVal(long baseVal) -{ - if(impl) - impl->setBaseVal(baseVal); -} - -long SVGAnimatedInteger::baseVal() const -{ - if(!impl) return -1; - return impl->baseVal(); -} - -long SVGAnimatedInteger::animVal() const -{ - if(!impl) return -1; - return impl->animVal(); -} diff --git a/ksvg/dom/SVGAnimatedInteger.cpp b/ksvg/dom/SVGAnimatedInteger.cpp new file mode 100644 index 00000000..ab91c1cf --- /dev/null +++ b/ksvg/dom/SVGAnimatedInteger.cpp @@ -0,0 +1,82 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedInteger.h" +#include "SVGAnimatedIntegerImpl.h" + +using namespace KSVG; + +SVGAnimatedInteger::SVGAnimatedInteger() +{ + impl = new SVGAnimatedIntegerImpl(); + impl->ref(); +} + +SVGAnimatedInteger::SVGAnimatedInteger(const SVGAnimatedInteger &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedInteger &SVGAnimatedInteger::operator=(const SVGAnimatedInteger &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedInteger::SVGAnimatedInteger(SVGAnimatedIntegerImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedInteger::~SVGAnimatedInteger() +{ + if(impl) + impl->deref(); +} + +void SVGAnimatedInteger::setBaseVal(long baseVal) +{ + if(impl) + impl->setBaseVal(baseVal); +} + +long SVGAnimatedInteger::baseVal() const +{ + if(!impl) return -1; + return impl->baseVal(); +} + +long SVGAnimatedInteger::animVal() const +{ + if(!impl) return -1; + return impl->animVal(); +} diff --git a/ksvg/dom/SVGAnimatedLength.cc b/ksvg/dom/SVGAnimatedLength.cc deleted file mode 100644 index 4e1cb06b..00000000 --- a/ksvg/dom/SVGAnimatedLength.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedLength.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGLength.h" - -using namespace KSVG; - -SVGAnimatedLength::SVGAnimatedLength() -{ - impl = new SVGAnimatedLengthImpl(); - impl->ref(); -} - -SVGAnimatedLength::SVGAnimatedLength(const SVGAnimatedLength &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedLength &SVGAnimatedLength::operator=(const SVGAnimatedLength &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedLength::SVGAnimatedLength(SVGAnimatedLengthImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedLength::~SVGAnimatedLength() -{ - if(impl) - impl->deref(); -} - -SVGLength SVGAnimatedLength::baseVal() const -{ - if(!impl) return SVGLength(0); - return SVGLength(impl->baseVal()); -} - -SVGLength SVGAnimatedLength::animVal() const -{ - if(!impl) return SVGLength(0); - return SVGLength(impl->animVal()); -} diff --git a/ksvg/dom/SVGAnimatedLength.cpp b/ksvg/dom/SVGAnimatedLength.cpp new file mode 100644 index 00000000..4e1cb06b --- /dev/null +++ b/ksvg/dom/SVGAnimatedLength.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedLength.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGLength.h" + +using namespace KSVG; + +SVGAnimatedLength::SVGAnimatedLength() +{ + impl = new SVGAnimatedLengthImpl(); + impl->ref(); +} + +SVGAnimatedLength::SVGAnimatedLength(const SVGAnimatedLength &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedLength &SVGAnimatedLength::operator=(const SVGAnimatedLength &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedLength::SVGAnimatedLength(SVGAnimatedLengthImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedLength::~SVGAnimatedLength() +{ + if(impl) + impl->deref(); +} + +SVGLength SVGAnimatedLength::baseVal() const +{ + if(!impl) return SVGLength(0); + return SVGLength(impl->baseVal()); +} + +SVGLength SVGAnimatedLength::animVal() const +{ + if(!impl) return SVGLength(0); + return SVGLength(impl->animVal()); +} diff --git a/ksvg/dom/SVGAnimatedLengthList.cc b/ksvg/dom/SVGAnimatedLengthList.cc deleted file mode 100644 index 2921c4b5..00000000 --- a/ksvg/dom/SVGAnimatedLengthList.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2002 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedLengthList.h" -#include "SVGAnimatedLengthListImpl.h" - -using namespace KSVG; - -SVGAnimatedLengthList::SVGAnimatedLengthList() -{ - impl = new SVGAnimatedLengthListImpl(); - impl->ref(); -} - -SVGAnimatedLengthList::SVGAnimatedLengthList(const SVGAnimatedLengthList &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedLengthList &SVGAnimatedLengthList::operator=(const SVGAnimatedLengthList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedLengthList::SVGAnimatedLengthList(SVGAnimatedLengthListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedLengthList::~SVGAnimatedLengthList() -{ - if(impl) - impl->deref(); -} - -SVGLengthList SVGAnimatedLengthList::baseVal() const -{ - if(!impl) return 0; - return impl->animVal(); -} - -SVGLengthList SVGAnimatedLengthList::animVal() const -{ - if(!impl) return 0; - return impl->baseVal(); -} diff --git a/ksvg/dom/SVGAnimatedLengthList.cpp b/ksvg/dom/SVGAnimatedLengthList.cpp new file mode 100644 index 00000000..2921c4b5 --- /dev/null +++ b/ksvg/dom/SVGAnimatedLengthList.cpp @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedLengthList.h" +#include "SVGAnimatedLengthListImpl.h" + +using namespace KSVG; + +SVGAnimatedLengthList::SVGAnimatedLengthList() +{ + impl = new SVGAnimatedLengthListImpl(); + impl->ref(); +} + +SVGAnimatedLengthList::SVGAnimatedLengthList(const SVGAnimatedLengthList &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedLengthList &SVGAnimatedLengthList::operator=(const SVGAnimatedLengthList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedLengthList::SVGAnimatedLengthList(SVGAnimatedLengthListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedLengthList::~SVGAnimatedLengthList() +{ + if(impl) + impl->deref(); +} + +SVGLengthList SVGAnimatedLengthList::baseVal() const +{ + if(!impl) return 0; + return impl->animVal(); +} + +SVGLengthList SVGAnimatedLengthList::animVal() const +{ + if(!impl) return 0; + return impl->baseVal(); +} diff --git a/ksvg/dom/SVGAnimatedNumber.cc b/ksvg/dom/SVGAnimatedNumber.cc deleted file mode 100644 index 78dab4a6..00000000 --- a/ksvg/dom/SVGAnimatedNumber.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedNumberImpl.h" - -using namespace KSVG; - -SVGAnimatedNumber::SVGAnimatedNumber() -{ - impl = new SVGAnimatedNumberImpl(); - impl->ref(); -} - -SVGAnimatedNumber::SVGAnimatedNumber(const SVGAnimatedNumber &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedNumber &SVGAnimatedNumber::operator=(const SVGAnimatedNumber &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedNumber::SVGAnimatedNumber(SVGAnimatedNumberImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedNumber::~SVGAnimatedNumber() -{ - if(impl) - impl->deref(); -} - -void SVGAnimatedNumber::setBaseVal(float baseVal) -{ - if(impl) - impl->setBaseVal(baseVal); -} - -float SVGAnimatedNumber::baseVal() const -{ - if(!impl) return -1; - return impl->baseVal(); -} - -float SVGAnimatedNumber::animVal() const -{ - if(!impl) return -1; - return impl->animVal(); -} diff --git a/ksvg/dom/SVGAnimatedNumber.cpp b/ksvg/dom/SVGAnimatedNumber.cpp new file mode 100644 index 00000000..78dab4a6 --- /dev/null +++ b/ksvg/dom/SVGAnimatedNumber.cpp @@ -0,0 +1,82 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedNumberImpl.h" + +using namespace KSVG; + +SVGAnimatedNumber::SVGAnimatedNumber() +{ + impl = new SVGAnimatedNumberImpl(); + impl->ref(); +} + +SVGAnimatedNumber::SVGAnimatedNumber(const SVGAnimatedNumber &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedNumber &SVGAnimatedNumber::operator=(const SVGAnimatedNumber &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedNumber::SVGAnimatedNumber(SVGAnimatedNumberImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedNumber::~SVGAnimatedNumber() +{ + if(impl) + impl->deref(); +} + +void SVGAnimatedNumber::setBaseVal(float baseVal) +{ + if(impl) + impl->setBaseVal(baseVal); +} + +float SVGAnimatedNumber::baseVal() const +{ + if(!impl) return -1; + return impl->baseVal(); +} + +float SVGAnimatedNumber::animVal() const +{ + if(!impl) return -1; + return impl->animVal(); +} diff --git a/ksvg/dom/SVGAnimatedNumberList.cc b/ksvg/dom/SVGAnimatedNumberList.cc deleted file mode 100644 index cf4fb8ae..00000000 --- a/ksvg/dom/SVGAnimatedNumberList.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2002 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberList.h" -#include "SVGAnimatedNumberListImpl.h" - -using namespace KSVG; - -SVGAnimatedNumberList::SVGAnimatedNumberList() -{ - impl = new SVGAnimatedNumberListImpl(); - impl->ref(); -} - -SVGAnimatedNumberList::SVGAnimatedNumberList(const SVGAnimatedNumberList &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedNumberList &SVGAnimatedNumberList::operator=(const SVGAnimatedNumberList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedNumberList::SVGAnimatedNumberList(SVGAnimatedNumberListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedNumberList::~SVGAnimatedNumberList() -{ - if(impl) - impl->deref(); -} - -SVGNumberList SVGAnimatedNumberList::baseVal() const -{ - if(!impl) return 0; - return impl->animVal(); -} - -SVGNumberList SVGAnimatedNumberList::animVal() const -{ - if(!impl) return 0; - return impl->baseVal(); -} diff --git a/ksvg/dom/SVGAnimatedNumberList.cpp b/ksvg/dom/SVGAnimatedNumberList.cpp new file mode 100644 index 00000000..cf4fb8ae --- /dev/null +++ b/ksvg/dom/SVGAnimatedNumberList.cpp @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberList.h" +#include "SVGAnimatedNumberListImpl.h" + +using namespace KSVG; + +SVGAnimatedNumberList::SVGAnimatedNumberList() +{ + impl = new SVGAnimatedNumberListImpl(); + impl->ref(); +} + +SVGAnimatedNumberList::SVGAnimatedNumberList(const SVGAnimatedNumberList &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedNumberList &SVGAnimatedNumberList::operator=(const SVGAnimatedNumberList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedNumberList::SVGAnimatedNumberList(SVGAnimatedNumberListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedNumberList::~SVGAnimatedNumberList() +{ + if(impl) + impl->deref(); +} + +SVGNumberList SVGAnimatedNumberList::baseVal() const +{ + if(!impl) return 0; + return impl->animVal(); +} + +SVGNumberList SVGAnimatedNumberList::animVal() const +{ + if(!impl) return 0; + return impl->baseVal(); +} diff --git a/ksvg/dom/SVGAnimatedPathData.cc b/ksvg/dom/SVGAnimatedPathData.cc deleted file mode 100644 index 98b3c739..00000000 --- a/ksvg/dom/SVGAnimatedPathData.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedPathData.h" -#include "SVGAnimatedPathDataImpl.h" -#include "SVGPathSegList.h" - -using namespace KSVG; - -SVGAnimatedPathData::SVGAnimatedPathData() -{ - impl = new SVGAnimatedPathDataImpl(); - impl->ref(); -} - -SVGAnimatedPathData::SVGAnimatedPathData(const SVGAnimatedPathData &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedPathData &SVGAnimatedPathData::operator=(const SVGAnimatedPathData &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedPathData::SVGAnimatedPathData(SVGAnimatedPathDataImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedPathData::~SVGAnimatedPathData() -{ - if(impl) - impl->deref(); -} - -SVGPathSegList SVGAnimatedPathData::pathSegList() const -{ - if(!impl) return SVGPathSegList(0); - return SVGPathSegList(impl->pathSegList()); -} - -SVGPathSegList SVGAnimatedPathData::normalizedPathSegList() const -{ - if(!impl) return SVGPathSegList(0); - return SVGPathSegList(impl->normalizedPathSegList()); -} - -SVGPathSegList SVGAnimatedPathData::animatedPathSegList() const -{ - if(!impl) return SVGPathSegList(0); - return SVGPathSegList(impl->animatedPathSegList()); -} - -SVGPathSegList SVGAnimatedPathData::animatedNormalizedPathSegList() const -{ - if(!impl) return SVGPathSegList(0); - return SVGPathSegList(impl->animatedNormalizedPathSegList()); -} diff --git a/ksvg/dom/SVGAnimatedPathData.cpp b/ksvg/dom/SVGAnimatedPathData.cpp new file mode 100644 index 00000000..98b3c739 --- /dev/null +++ b/ksvg/dom/SVGAnimatedPathData.cpp @@ -0,0 +1,89 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedPathData.h" +#include "SVGAnimatedPathDataImpl.h" +#include "SVGPathSegList.h" + +using namespace KSVG; + +SVGAnimatedPathData::SVGAnimatedPathData() +{ + impl = new SVGAnimatedPathDataImpl(); + impl->ref(); +} + +SVGAnimatedPathData::SVGAnimatedPathData(const SVGAnimatedPathData &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedPathData &SVGAnimatedPathData::operator=(const SVGAnimatedPathData &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedPathData::SVGAnimatedPathData(SVGAnimatedPathDataImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedPathData::~SVGAnimatedPathData() +{ + if(impl) + impl->deref(); +} + +SVGPathSegList SVGAnimatedPathData::pathSegList() const +{ + if(!impl) return SVGPathSegList(0); + return SVGPathSegList(impl->pathSegList()); +} + +SVGPathSegList SVGAnimatedPathData::normalizedPathSegList() const +{ + if(!impl) return SVGPathSegList(0); + return SVGPathSegList(impl->normalizedPathSegList()); +} + +SVGPathSegList SVGAnimatedPathData::animatedPathSegList() const +{ + if(!impl) return SVGPathSegList(0); + return SVGPathSegList(impl->animatedPathSegList()); +} + +SVGPathSegList SVGAnimatedPathData::animatedNormalizedPathSegList() const +{ + if(!impl) return SVGPathSegList(0); + return SVGPathSegList(impl->animatedNormalizedPathSegList()); +} diff --git a/ksvg/dom/SVGAnimatedPoints.cc b/ksvg/dom/SVGAnimatedPoints.cc deleted file mode 100644 index 2b91f989..00000000 --- a/ksvg/dom/SVGAnimatedPoints.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedPoints.h" -#include "SVGAnimatedPointsImpl.h" -#include "SVGPointList.h" - -using namespace KSVG; - -SVGAnimatedPoints::SVGAnimatedPoints() -{ - impl = new SVGAnimatedPointsImpl(); - impl->ref(); -} - -SVGAnimatedPoints::SVGAnimatedPoints(const SVGAnimatedPoints &other) : impl(0) -{ - (*this) = other;; -} - -SVGAnimatedPoints &SVGAnimatedPoints::operator=(const SVGAnimatedPoints &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedPoints::SVGAnimatedPoints(SVGAnimatedPointsImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedPoints::~SVGAnimatedPoints() -{ - if(impl) - impl->deref(); -} - -SVGPointList SVGAnimatedPoints::points() const -{ - if(!impl) return SVGPointList(0); - return SVGPointList(impl->points()); -} - -SVGPointList SVGAnimatedPoints::animatedPoints() const -{ - if(!impl) return SVGPointList(0); - return SVGPointList(impl->animatedPoints()); -} diff --git a/ksvg/dom/SVGAnimatedPoints.cpp b/ksvg/dom/SVGAnimatedPoints.cpp new file mode 100644 index 00000000..2b91f989 --- /dev/null +++ b/ksvg/dom/SVGAnimatedPoints.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedPoints.h" +#include "SVGAnimatedPointsImpl.h" +#include "SVGPointList.h" + +using namespace KSVG; + +SVGAnimatedPoints::SVGAnimatedPoints() +{ + impl = new SVGAnimatedPointsImpl(); + impl->ref(); +} + +SVGAnimatedPoints::SVGAnimatedPoints(const SVGAnimatedPoints &other) : impl(0) +{ + (*this) = other;; +} + +SVGAnimatedPoints &SVGAnimatedPoints::operator=(const SVGAnimatedPoints &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedPoints::SVGAnimatedPoints(SVGAnimatedPointsImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedPoints::~SVGAnimatedPoints() +{ + if(impl) + impl->deref(); +} + +SVGPointList SVGAnimatedPoints::points() const +{ + if(!impl) return SVGPointList(0); + return SVGPointList(impl->points()); +} + +SVGPointList SVGAnimatedPoints::animatedPoints() const +{ + if(!impl) return SVGPointList(0); + return SVGPointList(impl->animatedPoints()); +} diff --git a/ksvg/dom/SVGAnimatedPreserveAspectRatio.cc b/ksvg/dom/SVGAnimatedPreserveAspectRatio.cc deleted file mode 100644 index 2f3d3e17..00000000 --- a/ksvg/dom/SVGAnimatedPreserveAspectRatio.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedPreserveAspectRatio.h" -#include "SVGAnimatedPreserveAspectRatioImpl.h" -#include "SVGPreserveAspectRatio.h" - -using namespace KSVG; - -SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio() -{ - impl = new SVGAnimatedPreserveAspectRatioImpl(); - impl->ref(); -} - -SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio(const SVGAnimatedPreserveAspectRatio &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedPreserveAspectRatio &SVGAnimatedPreserveAspectRatio::operator=(const SVGAnimatedPreserveAspectRatio &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio(SVGAnimatedPreserveAspectRatioImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedPreserveAspectRatio::~SVGAnimatedPreserveAspectRatio() -{ - if(impl) - impl->deref(); -} - -SVGPreserveAspectRatio SVGAnimatedPreserveAspectRatio::baseVal() const -{ - if(!impl) return SVGPreserveAspectRatio(0); - return SVGPreserveAspectRatio(impl->baseVal()); -} - -SVGPreserveAspectRatio SVGAnimatedPreserveAspectRatio::animVal() const -{ - if(!impl) return SVGPreserveAspectRatio(0); - return SVGPreserveAspectRatio(impl->animVal()); -} diff --git a/ksvg/dom/SVGAnimatedPreserveAspectRatio.cpp b/ksvg/dom/SVGAnimatedPreserveAspectRatio.cpp new file mode 100644 index 00000000..2f3d3e17 --- /dev/null +++ b/ksvg/dom/SVGAnimatedPreserveAspectRatio.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedPreserveAspectRatio.h" +#include "SVGAnimatedPreserveAspectRatioImpl.h" +#include "SVGPreserveAspectRatio.h" + +using namespace KSVG; + +SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio() +{ + impl = new SVGAnimatedPreserveAspectRatioImpl(); + impl->ref(); +} + +SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio(const SVGAnimatedPreserveAspectRatio &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedPreserveAspectRatio &SVGAnimatedPreserveAspectRatio::operator=(const SVGAnimatedPreserveAspectRatio &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio(SVGAnimatedPreserveAspectRatioImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedPreserveAspectRatio::~SVGAnimatedPreserveAspectRatio() +{ + if(impl) + impl->deref(); +} + +SVGPreserveAspectRatio SVGAnimatedPreserveAspectRatio::baseVal() const +{ + if(!impl) return SVGPreserveAspectRatio(0); + return SVGPreserveAspectRatio(impl->baseVal()); +} + +SVGPreserveAspectRatio SVGAnimatedPreserveAspectRatio::animVal() const +{ + if(!impl) return SVGPreserveAspectRatio(0); + return SVGPreserveAspectRatio(impl->animVal()); +} diff --git a/ksvg/dom/SVGAnimatedRect.cc b/ksvg/dom/SVGAnimatedRect.cc deleted file mode 100644 index 29cf0518..00000000 --- a/ksvg/dom/SVGAnimatedRect.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedRect.h" -#include "SVGAnimatedRectImpl.h" -#include "SVGRect.h" - -using namespace KSVG; - -SVGAnimatedRect::SVGAnimatedRect() -{ - impl = new SVGAnimatedRectImpl(); - impl->ref(); -} - -SVGAnimatedRect::SVGAnimatedRect(const SVGAnimatedRect &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedRect &SVGAnimatedRect::operator=(const SVGAnimatedRect &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedRect::SVGAnimatedRect(SVGAnimatedRectImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedRect::~SVGAnimatedRect() -{ - if(impl) - impl->deref(); -} - -SVGRect SVGAnimatedRect::baseVal() const -{ - if(!impl) return SVGRect(0); - return SVGRect(impl->baseVal()); -} - -SVGRect SVGAnimatedRect::animVal() const -{ - if(!impl) return SVGRect(0); - return SVGRect(impl->animVal()); -} diff --git a/ksvg/dom/SVGAnimatedRect.cpp b/ksvg/dom/SVGAnimatedRect.cpp new file mode 100644 index 00000000..29cf0518 --- /dev/null +++ b/ksvg/dom/SVGAnimatedRect.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedRect.h" +#include "SVGAnimatedRectImpl.h" +#include "SVGRect.h" + +using namespace KSVG; + +SVGAnimatedRect::SVGAnimatedRect() +{ + impl = new SVGAnimatedRectImpl(); + impl->ref(); +} + +SVGAnimatedRect::SVGAnimatedRect(const SVGAnimatedRect &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedRect &SVGAnimatedRect::operator=(const SVGAnimatedRect &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedRect::SVGAnimatedRect(SVGAnimatedRectImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedRect::~SVGAnimatedRect() +{ + if(impl) + impl->deref(); +} + +SVGRect SVGAnimatedRect::baseVal() const +{ + if(!impl) return SVGRect(0); + return SVGRect(impl->baseVal()); +} + +SVGRect SVGAnimatedRect::animVal() const +{ + if(!impl) return SVGRect(0); + return SVGRect(impl->animVal()); +} diff --git a/ksvg/dom/SVGAnimatedString.cc b/ksvg/dom/SVGAnimatedString.cc deleted file mode 100644 index ba69c6e1..00000000 --- a/ksvg/dom/SVGAnimatedString.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedString.h" -#include "SVGAnimatedStringImpl.h" - -using namespace KSVG; - -SVGAnimatedString::SVGAnimatedString() -{ - impl = new SVGAnimatedStringImpl(); - impl->ref(); -} - -SVGAnimatedString::SVGAnimatedString(const SVGAnimatedString &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedString &SVGAnimatedString::operator=(const SVGAnimatedString &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedString::SVGAnimatedString(SVGAnimatedStringImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedString::~SVGAnimatedString() -{ - if(impl) - impl->deref(); -} - -void SVGAnimatedString::setBaseVal(const DOM::DOMString &baseVal) -{ - if(impl) - impl->setBaseVal(baseVal); -} - -DOM::DOMString SVGAnimatedString::baseVal() const -{ - if(!impl) return DOM::DOMString(); - return impl->baseVal(); -} - -DOM::DOMString SVGAnimatedString::animVal() const -{ - if(!impl) return DOM::DOMString(); - return impl->animVal(); -} diff --git a/ksvg/dom/SVGAnimatedString.cpp b/ksvg/dom/SVGAnimatedString.cpp new file mode 100644 index 00000000..ba69c6e1 --- /dev/null +++ b/ksvg/dom/SVGAnimatedString.cpp @@ -0,0 +1,82 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedString.h" +#include "SVGAnimatedStringImpl.h" + +using namespace KSVG; + +SVGAnimatedString::SVGAnimatedString() +{ + impl = new SVGAnimatedStringImpl(); + impl->ref(); +} + +SVGAnimatedString::SVGAnimatedString(const SVGAnimatedString &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedString &SVGAnimatedString::operator=(const SVGAnimatedString &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedString::SVGAnimatedString(SVGAnimatedStringImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedString::~SVGAnimatedString() +{ + if(impl) + impl->deref(); +} + +void SVGAnimatedString::setBaseVal(const DOM::DOMString &baseVal) +{ + if(impl) + impl->setBaseVal(baseVal); +} + +DOM::DOMString SVGAnimatedString::baseVal() const +{ + if(!impl) return DOM::DOMString(); + return impl->baseVal(); +} + +DOM::DOMString SVGAnimatedString::animVal() const +{ + if(!impl) return DOM::DOMString(); + return impl->animVal(); +} diff --git a/ksvg/dom/SVGAnimatedTransformList.cc b/ksvg/dom/SVGAnimatedTransformList.cc deleted file mode 100644 index 7a8cbe49..00000000 --- a/ksvg/dom/SVGAnimatedTransformList.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedTransformList.h" -#include "SVGAnimatedTransformListImpl.h" -#include "SVGTransformList.h" - -using namespace KSVG; - -SVGAnimatedTransformList::SVGAnimatedTransformList() -{ - impl = new SVGAnimatedTransformListImpl(); - impl->ref(); -} - -SVGAnimatedTransformList::SVGAnimatedTransformList(const SVGAnimatedTransformList &other) : impl(0) -{ - (*this) = other; -} - -SVGAnimatedTransformList &SVGAnimatedTransformList::operator=(const SVGAnimatedTransformList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimatedTransformList::SVGAnimatedTransformList(SVGAnimatedTransformListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimatedTransformList::~SVGAnimatedTransformList() -{ - if(impl) - impl->deref(); -} - -SVGTransformList SVGAnimatedTransformList::baseVal() const -{ - if(!impl) return SVGTransformList(0); - return SVGTransformList(impl->baseVal()); -} - -SVGTransformList SVGAnimatedTransformList::animVal() const -{ - if(!impl) return SVGTransformList(0); - return SVGTransformList(impl->animVal()); -} diff --git a/ksvg/dom/SVGAnimatedTransformList.cpp b/ksvg/dom/SVGAnimatedTransformList.cpp new file mode 100644 index 00000000..7a8cbe49 --- /dev/null +++ b/ksvg/dom/SVGAnimatedTransformList.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedTransformList.h" +#include "SVGAnimatedTransformListImpl.h" +#include "SVGTransformList.h" + +using namespace KSVG; + +SVGAnimatedTransformList::SVGAnimatedTransformList() +{ + impl = new SVGAnimatedTransformListImpl(); + impl->ref(); +} + +SVGAnimatedTransformList::SVGAnimatedTransformList(const SVGAnimatedTransformList &other) : impl(0) +{ + (*this) = other; +} + +SVGAnimatedTransformList &SVGAnimatedTransformList::operator=(const SVGAnimatedTransformList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimatedTransformList::SVGAnimatedTransformList(SVGAnimatedTransformListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimatedTransformList::~SVGAnimatedTransformList() +{ + if(impl) + impl->deref(); +} + +SVGTransformList SVGAnimatedTransformList::baseVal() const +{ + if(!impl) return SVGTransformList(0); + return SVGTransformList(impl->baseVal()); +} + +SVGTransformList SVGAnimatedTransformList::animVal() const +{ + if(!impl) return SVGTransformList(0); + return SVGTransformList(impl->animVal()); +} diff --git a/ksvg/dom/SVGAnimationElement.cc b/ksvg/dom/SVGAnimationElement.cc deleted file mode 100644 index 0cc1ce3b..00000000 --- a/ksvg/dom/SVGAnimationElement.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimationElement.h" -#include "SVGAnimationElementImpl.h" - -using namespace KSVG; - -SVGAnimationElement::SVGAnimationElement() : SVGElement(), SVGTests(), SVGExternalResourcesRequired() -{ - impl = 0; -} - -SVGAnimationElement::SVGAnimationElement(const SVGAnimationElement &other) : SVGElement(other), SVGTests(other), SVGExternalResourcesRequired(other), impl(0) -{ - (*this) = other; -} - -SVGAnimationElement &SVGAnimationElement::operator=(const SVGAnimationElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGExternalResourcesRequired::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGAnimationElement::SVGAnimationElement(SVGAnimationElementImpl *other) : SVGElement(other), SVGTests(other), SVGExternalResourcesRequired(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGAnimationElement::~SVGAnimationElement() -{ - if(impl) - impl->deref(); -} - -SVGElement SVGAnimationElement::targetElement() const -{ - if(!impl) return SVGElement(0); - return SVGElement(impl->targetElement()); -} - -float SVGAnimationElement::getStartTime() -{ - if(!impl) return -1; - return impl->getStartTime(); -} - -float SVGAnimationElement::getCurrentTime() -{ - if(!impl) return -1; - return impl->getCurrentTime(); -} - -float SVGAnimationElement::getSimpleDuration() -{ - if(!impl) return -1; - return impl->getSimpleDuration(); -} diff --git a/ksvg/dom/SVGAnimationElement.cpp b/ksvg/dom/SVGAnimationElement.cpp new file mode 100644 index 00000000..0cc1ce3b --- /dev/null +++ b/ksvg/dom/SVGAnimationElement.cpp @@ -0,0 +1,91 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimationElement.h" +#include "SVGAnimationElementImpl.h" + +using namespace KSVG; + +SVGAnimationElement::SVGAnimationElement() : SVGElement(), SVGTests(), SVGExternalResourcesRequired() +{ + impl = 0; +} + +SVGAnimationElement::SVGAnimationElement(const SVGAnimationElement &other) : SVGElement(other), SVGTests(other), SVGExternalResourcesRequired(other), impl(0) +{ + (*this) = other; +} + +SVGAnimationElement &SVGAnimationElement::operator=(const SVGAnimationElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGExternalResourcesRequired::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGAnimationElement::SVGAnimationElement(SVGAnimationElementImpl *other) : SVGElement(other), SVGTests(other), SVGExternalResourcesRequired(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGAnimationElement::~SVGAnimationElement() +{ + if(impl) + impl->deref(); +} + +SVGElement SVGAnimationElement::targetElement() const +{ + if(!impl) return SVGElement(0); + return SVGElement(impl->targetElement()); +} + +float SVGAnimationElement::getStartTime() +{ + if(!impl) return -1; + return impl->getStartTime(); +} + +float SVGAnimationElement::getCurrentTime() +{ + if(!impl) return -1; + return impl->getCurrentTime(); +} + +float SVGAnimationElement::getSimpleDuration() +{ + if(!impl) return -1; + return impl->getSimpleDuration(); +} diff --git a/ksvg/dom/SVGCSSRule.cc b/ksvg/dom/SVGCSSRule.cc deleted file mode 100644 index 0cb02c97..00000000 --- a/ksvg/dom/SVGCSSRule.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGCSSRule.h" -#include "SVGCSSRuleImpl.h" - -using namespace KSVG; - -SVGCSSRule::SVGCSSRule() //: css::CSSRule() -{ - impl = new SVGCSSRuleImpl(); - impl->ref(); -} - -SVGCSSRule::SVGCSSRule(const SVGCSSRule &other) : /*css::CSSRule(),*/ impl(0) -{ - (*this) = other; -} - -SVGCSSRule &SVGCSSRule::operator=(const SVGCSSRule &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGCSSRule::SVGCSSRule(SVGCSSRuleImpl *other) //: css::CSSRule() -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGCSSRule::~SVGCSSRule() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGCSSRule.cpp b/ksvg/dom/SVGCSSRule.cpp new file mode 100644 index 00000000..0cb02c97 --- /dev/null +++ b/ksvg/dom/SVGCSSRule.cpp @@ -0,0 +1,64 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGCSSRule.h" +#include "SVGCSSRuleImpl.h" + +using namespace KSVG; + +SVGCSSRule::SVGCSSRule() //: css::CSSRule() +{ + impl = new SVGCSSRuleImpl(); + impl->ref(); +} + +SVGCSSRule::SVGCSSRule(const SVGCSSRule &other) : /*css::CSSRule(),*/ impl(0) +{ + (*this) = other; +} + +SVGCSSRule &SVGCSSRule::operator=(const SVGCSSRule &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGCSSRule::SVGCSSRule(SVGCSSRuleImpl *other) //: css::CSSRule() +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGCSSRule::~SVGCSSRule() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGCircleElement.cc b/ksvg/dom/SVGCircleElement.cc deleted file mode 100644 index 746160e6..00000000 --- a/ksvg/dom/SVGCircleElement.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGCircleElement.h" -#include "SVGCircleElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGCircleElement::SVGCircleElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGCircleElement::SVGCircleElement(const SVGCircleElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) -{ - (*this) = other; -} - -SVGCircleElement &SVGCircleElement::operator=(const SVGCircleElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGCircleElement::SVGCircleElement(SVGCircleElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGCircleElement::~SVGCircleElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGCircleElement::cx() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->cx()); -} - -SVGAnimatedLength SVGCircleElement::cy() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->cy()); -} - -SVGAnimatedLength SVGCircleElement::r() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->r()); -} diff --git a/ksvg/dom/SVGCircleElement.cpp b/ksvg/dom/SVGCircleElement.cpp new file mode 100644 index 00000000..746160e6 --- /dev/null +++ b/ksvg/dom/SVGCircleElement.cpp @@ -0,0 +1,90 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGCircleElement.h" +#include "SVGCircleElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGCircleElement::SVGCircleElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGCircleElement::SVGCircleElement(const SVGCircleElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) +{ + (*this) = other; +} + +SVGCircleElement &SVGCircleElement::operator=(const SVGCircleElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGCircleElement::SVGCircleElement(SVGCircleElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGCircleElement::~SVGCircleElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGCircleElement::cx() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->cx()); +} + +SVGAnimatedLength SVGCircleElement::cy() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->cy()); +} + +SVGAnimatedLength SVGCircleElement::r() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->r()); +} diff --git a/ksvg/dom/SVGClipPathElement.cc b/ksvg/dom/SVGClipPathElement.cc deleted file mode 100644 index e6c66f7f..00000000 --- a/ksvg/dom/SVGClipPathElement.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGClipPathElement.h" -#include "SVGClipPathElementImpl.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGClipPathElement::SVGClipPathElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGClipPathElement::SVGClipPathElement(const SVGClipPathElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - (*this) = other; -} - -SVGClipPathElement &SVGClipPathElement::operator=(const SVGClipPathElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGClipPathElement::SVGClipPathElement(SVGClipPathElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGClipPathElement::~SVGClipPathElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedEnumeration SVGClipPathElement::clipPathUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->clipPathUnits()); -} diff --git a/ksvg/dom/SVGClipPathElement.cpp b/ksvg/dom/SVGClipPathElement.cpp new file mode 100644 index 00000000..e6c66f7f --- /dev/null +++ b/ksvg/dom/SVGClipPathElement.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGClipPathElement.h" +#include "SVGClipPathElementImpl.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGClipPathElement::SVGClipPathElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGClipPathElement::SVGClipPathElement(const SVGClipPathElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + (*this) = other; +} + +SVGClipPathElement &SVGClipPathElement::operator=(const SVGClipPathElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGClipPathElement::SVGClipPathElement(SVGClipPathElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGClipPathElement::~SVGClipPathElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedEnumeration SVGClipPathElement::clipPathUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->clipPathUnits()); +} diff --git a/ksvg/dom/SVGColor.cc b/ksvg/dom/SVGColor.cc deleted file mode 100644 index 2a7947ab..00000000 --- a/ksvg/dom/SVGColor.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGColor.h" -#include "SVGICCColor.h" -#include "SVGColorImpl.h" - -using namespace KSVG; - -SVGColor::SVGColor() -{ - // FIXME: no icc color support... - impl = new SVGColorImpl(0); - impl->ref(); -} - -SVGColor::SVGColor(const SVGColor &other) : impl(0) -{ - (*this) = other; -} - -SVGColor &SVGColor::operator=(const SVGColor &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; - -} - -SVGColor::SVGColor(SVGColorImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGColor::~SVGColor() -{ - if(impl) - impl->deref(); -} - -unsigned short SVGColor::colorType() const -{ - if(!impl) return SVG_COLORTYPE_UNKNOWN; - return impl->colorType(); -} - -DOM::RGBColor SVGColor::rgbColor() const -{ - if(!impl) return DOM::RGBColor(); - return impl->rgbColor(); -} - -SVGICCColor SVGColor::iccColor() const -{ - if(!impl) return SVGICCColor(); - return impl->iccColor(); -} - -void SVGColor::setRGBColor(const DOM::DOMString &rgbColor) -{ - if(impl) - impl->setRGBColor(rgbColor); -} - -void SVGColor::setRGBColorICCColor(const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) -{ - if(impl) - impl->setRGBColorICCColor(rgbColor, iccColor); -} - -void SVGColor::setColor(unsigned short colorType, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) -{ - if(impl) - impl->setColor(colorType, rgbColor, iccColor); -} diff --git a/ksvg/dom/SVGColor.cpp b/ksvg/dom/SVGColor.cpp new file mode 100644 index 00000000..2a7947ab --- /dev/null +++ b/ksvg/dom/SVGColor.cpp @@ -0,0 +1,103 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGColor.h" +#include "SVGICCColor.h" +#include "SVGColorImpl.h" + +using namespace KSVG; + +SVGColor::SVGColor() +{ + // FIXME: no icc color support... + impl = new SVGColorImpl(0); + impl->ref(); +} + +SVGColor::SVGColor(const SVGColor &other) : impl(0) +{ + (*this) = other; +} + +SVGColor &SVGColor::operator=(const SVGColor &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; + +} + +SVGColor::SVGColor(SVGColorImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGColor::~SVGColor() +{ + if(impl) + impl->deref(); +} + +unsigned short SVGColor::colorType() const +{ + if(!impl) return SVG_COLORTYPE_UNKNOWN; + return impl->colorType(); +} + +DOM::RGBColor SVGColor::rgbColor() const +{ + if(!impl) return DOM::RGBColor(); + return impl->rgbColor(); +} + +SVGICCColor SVGColor::iccColor() const +{ + if(!impl) return SVGICCColor(); + return impl->iccColor(); +} + +void SVGColor::setRGBColor(const DOM::DOMString &rgbColor) +{ + if(impl) + impl->setRGBColor(rgbColor); +} + +void SVGColor::setRGBColorICCColor(const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) +{ + if(impl) + impl->setRGBColorICCColor(rgbColor, iccColor); +} + +void SVGColor::setColor(unsigned short colorType, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) +{ + if(impl) + impl->setColor(colorType, rgbColor, iccColor); +} diff --git a/ksvg/dom/SVGColorProfileElement.cc b/ksvg/dom/SVGColorProfileElement.cc deleted file mode 100644 index fa86f4f5..00000000 --- a/ksvg/dom/SVGColorProfileElement.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGColorProfileElement.h" -#include "SVGColorProfileElementImpl.h" -#include "SVGRenderingIntent.h" - -using namespace KSVG; - -SVGColorProfileElement::SVGColorProfileElement() : SVGElement(), SVGURIReference() -{ - impl = 0; -} - -SVGColorProfileElement::SVGColorProfileElement(const SVGColorProfileElement &other) : SVGElement(other), SVGURIReference(other), impl(0) -{ - (*this) = other; -} - -SVGColorProfileElement &SVGColorProfileElement::operator=(const SVGColorProfileElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGColorProfileElement::SVGColorProfileElement(SVGColorProfileElementImpl *other) : SVGElement(other), SVGURIReference(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGColorProfileElement::~SVGColorProfileElement() -{ - if(impl) - impl->deref(); -} - -void SVGColorProfileElement::setLocal(const DOM::DOMString &local) -{ - if(impl) - impl->setLocal(local); -} - -DOM::DOMString SVGColorProfileElement::local() const -{ - if(!impl) return DOM::DOMString(); - return impl->local(); -} - -void SVGColorProfileElement::setName(const DOM::DOMString &name) -{ - if(impl) - impl->setName(name); -} - -DOM::DOMString SVGColorProfileElement::name() const -{ - if(!impl) return DOM::DOMString(); - return impl->name(); -} - -void SVGColorProfileElement::setRenderingIntent(unsigned short renderingIntent) -{ - if(impl) - impl->setRenderingIntent(renderingIntent); -} - -unsigned short SVGColorProfileElement::renderingIntent() const -{ - if(!impl) return RENDERING_INTENT_UNKNOWN; - return impl->renderingIntent(); -} diff --git a/ksvg/dom/SVGColorProfileElement.cpp b/ksvg/dom/SVGColorProfileElement.cpp new file mode 100644 index 00000000..fa86f4f5 --- /dev/null +++ b/ksvg/dom/SVGColorProfileElement.cpp @@ -0,0 +1,103 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGColorProfileElement.h" +#include "SVGColorProfileElementImpl.h" +#include "SVGRenderingIntent.h" + +using namespace KSVG; + +SVGColorProfileElement::SVGColorProfileElement() : SVGElement(), SVGURIReference() +{ + impl = 0; +} + +SVGColorProfileElement::SVGColorProfileElement(const SVGColorProfileElement &other) : SVGElement(other), SVGURIReference(other), impl(0) +{ + (*this) = other; +} + +SVGColorProfileElement &SVGColorProfileElement::operator=(const SVGColorProfileElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGColorProfileElement::SVGColorProfileElement(SVGColorProfileElementImpl *other) : SVGElement(other), SVGURIReference(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGColorProfileElement::~SVGColorProfileElement() +{ + if(impl) + impl->deref(); +} + +void SVGColorProfileElement::setLocal(const DOM::DOMString &local) +{ + if(impl) + impl->setLocal(local); +} + +DOM::DOMString SVGColorProfileElement::local() const +{ + if(!impl) return DOM::DOMString(); + return impl->local(); +} + +void SVGColorProfileElement::setName(const DOM::DOMString &name) +{ + if(impl) + impl->setName(name); +} + +DOM::DOMString SVGColorProfileElement::name() const +{ + if(!impl) return DOM::DOMString(); + return impl->name(); +} + +void SVGColorProfileElement::setRenderingIntent(unsigned short renderingIntent) +{ + if(impl) + impl->setRenderingIntent(renderingIntent); +} + +unsigned short SVGColorProfileElement::renderingIntent() const +{ + if(!impl) return RENDERING_INTENT_UNKNOWN; + return impl->renderingIntent(); +} diff --git a/ksvg/dom/SVGColorProfileRule.cc b/ksvg/dom/SVGColorProfileRule.cc deleted file mode 100644 index 0a2da253..00000000 --- a/ksvg/dom/SVGColorProfileRule.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGColorProfileRule.h" -#include "SVGColorProfileRuleImpl.h" -#include "SVGRenderingIntent.h" - -using namespace KSVG; - -SVGColorProfileRule::SVGColorProfileRule() : SVGCSSRule() -{ - impl = new SVGColorProfileRuleImpl(); - impl->ref(); -} - -SVGColorProfileRule::SVGColorProfileRule(const SVGColorProfileRule &other) : SVGCSSRule(), impl(0) -{ - (*this) = other; -} - -SVGColorProfileRule &SVGColorProfileRule::operator=(const SVGColorProfileRule &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGColorProfileRule::SVGColorProfileRule(SVGColorProfileRuleImpl *other) : SVGCSSRule(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGColorProfileRule::~SVGColorProfileRule() -{ - if(impl) - impl->deref(); -} - -void SVGColorProfileRule::setSrc(const DOM::DOMString &src) -{ - if(impl) - impl->setSrc(src); -} - -DOM::DOMString SVGColorProfileRule::src() const -{ - if(!impl) return DOM::DOMString(); - return impl->src(); -} - -void SVGColorProfileRule::setName(const DOM::DOMString &name) -{ - if(impl) - impl->setName(name); -} - -DOM::DOMString SVGColorProfileRule::name() const -{ - if(!impl) return DOM::DOMString(); - return impl->name(); -} - -void SVGColorProfileRule::setRenderingIntent(unsigned short renderingIntent) -{ - if(impl) - impl->setRenderingIntent(renderingIntent); -} - -unsigned short SVGColorProfileRule::renderingIntent() const -{ - if(!impl) return RENDERING_INTENT_UNKNOWN; - return impl->renderingIntent(); -} diff --git a/ksvg/dom/SVGColorProfileRule.cpp b/ksvg/dom/SVGColorProfileRule.cpp new file mode 100644 index 00000000..0a2da253 --- /dev/null +++ b/ksvg/dom/SVGColorProfileRule.cpp @@ -0,0 +1,101 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGColorProfileRule.h" +#include "SVGColorProfileRuleImpl.h" +#include "SVGRenderingIntent.h" + +using namespace KSVG; + +SVGColorProfileRule::SVGColorProfileRule() : SVGCSSRule() +{ + impl = new SVGColorProfileRuleImpl(); + impl->ref(); +} + +SVGColorProfileRule::SVGColorProfileRule(const SVGColorProfileRule &other) : SVGCSSRule(), impl(0) +{ + (*this) = other; +} + +SVGColorProfileRule &SVGColorProfileRule::operator=(const SVGColorProfileRule &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGColorProfileRule::SVGColorProfileRule(SVGColorProfileRuleImpl *other) : SVGCSSRule(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGColorProfileRule::~SVGColorProfileRule() +{ + if(impl) + impl->deref(); +} + +void SVGColorProfileRule::setSrc(const DOM::DOMString &src) +{ + if(impl) + impl->setSrc(src); +} + +DOM::DOMString SVGColorProfileRule::src() const +{ + if(!impl) return DOM::DOMString(); + return impl->src(); +} + +void SVGColorProfileRule::setName(const DOM::DOMString &name) +{ + if(impl) + impl->setName(name); +} + +DOM::DOMString SVGColorProfileRule::name() const +{ + if(!impl) return DOM::DOMString(); + return impl->name(); +} + +void SVGColorProfileRule::setRenderingIntent(unsigned short renderingIntent) +{ + if(impl) + impl->setRenderingIntent(renderingIntent); +} + +unsigned short SVGColorProfileRule::renderingIntent() const +{ + if(!impl) return RENDERING_INTENT_UNKNOWN; + return impl->renderingIntent(); +} diff --git a/ksvg/dom/SVGComponentTransferFunctionElement.cc b/ksvg/dom/SVGComponentTransferFunctionElement.cc deleted file mode 100644 index 66639416..00000000 --- a/ksvg/dom/SVGComponentTransferFunctionElement.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGComponentTransferFunctionElement.h" -#include "SVGComponentTransferFunctionElementImpl.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedNumberList.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement() : SVGElement() -{ - impl = 0; -} - -SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const SVGComponentTransferFunctionElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGComponentTransferFunctionElement &SVGComponentTransferFunctionElement::operator =(const SVGComponentTransferFunctionElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(SVGComponentTransferFunctionElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGComponentTransferFunctionElement::~SVGComponentTransferFunctionElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedEnumeration SVGComponentTransferFunctionElement::type() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->type()); -} - -SVGAnimatedNumberList SVGComponentTransferFunctionElement::tableValues() const -{ - if(!impl) return SVGAnimatedNumberList(0); - return SVGAnimatedNumberList(impl->tableValues()); -} - -SVGAnimatedNumber SVGComponentTransferFunctionElement::slope() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->slope()); -} - -SVGAnimatedNumber SVGComponentTransferFunctionElement::intercept() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->intercept()); -} - -SVGAnimatedNumber SVGComponentTransferFunctionElement::amplitude() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->amplitude()); -} - -SVGAnimatedNumber SVGComponentTransferFunctionElement::exponent() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->exponent()); -} - -SVGAnimatedNumber SVGComponentTransferFunctionElement::offset() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->offset()); -} diff --git a/ksvg/dom/SVGComponentTransferFunctionElement.cpp b/ksvg/dom/SVGComponentTransferFunctionElement.cpp new file mode 100644 index 00000000..66639416 --- /dev/null +++ b/ksvg/dom/SVGComponentTransferFunctionElement.cpp @@ -0,0 +1,110 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGComponentTransferFunctionElement.h" +#include "SVGComponentTransferFunctionElementImpl.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedNumberList.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement() : SVGElement() +{ + impl = 0; +} + +SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const SVGComponentTransferFunctionElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGComponentTransferFunctionElement &SVGComponentTransferFunctionElement::operator =(const SVGComponentTransferFunctionElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(SVGComponentTransferFunctionElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGComponentTransferFunctionElement::~SVGComponentTransferFunctionElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedEnumeration SVGComponentTransferFunctionElement::type() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->type()); +} + +SVGAnimatedNumberList SVGComponentTransferFunctionElement::tableValues() const +{ + if(!impl) return SVGAnimatedNumberList(0); + return SVGAnimatedNumberList(impl->tableValues()); +} + +SVGAnimatedNumber SVGComponentTransferFunctionElement::slope() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->slope()); +} + +SVGAnimatedNumber SVGComponentTransferFunctionElement::intercept() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->intercept()); +} + +SVGAnimatedNumber SVGComponentTransferFunctionElement::amplitude() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->amplitude()); +} + +SVGAnimatedNumber SVGComponentTransferFunctionElement::exponent() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->exponent()); +} + +SVGAnimatedNumber SVGComponentTransferFunctionElement::offset() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->offset()); +} diff --git a/ksvg/dom/SVGCursorElement.cc b/ksvg/dom/SVGCursorElement.cc deleted file mode 100644 index 9b882405..00000000 --- a/ksvg/dom/SVGCursorElement.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGCursorElement.h" -#include "SVGCursorElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGCursorElement::SVGCursorElement() : SVGElement(), SVGURIReference(), SVGTests(), SVGExternalResourcesRequired() -{ - impl = 0; -} - -SVGCursorElement::SVGCursorElement(const SVGCursorElement &other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGExternalResourcesRequired(other), impl(0) -{ - (*this) = other; -} - -SVGCursorElement &SVGCursorElement::operator =(const SVGCursorElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - SVGTests::operator=(other); - SVGExternalResourcesRequired::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGCursorElement::SVGCursorElement(SVGCursorElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGExternalResourcesRequired(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGCursorElement::~SVGCursorElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGCursorElement::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGCursorElement::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} diff --git a/ksvg/dom/SVGCursorElement.cpp b/ksvg/dom/SVGCursorElement.cpp new file mode 100644 index 00000000..9b882405 --- /dev/null +++ b/ksvg/dom/SVGCursorElement.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGCursorElement.h" +#include "SVGCursorElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGCursorElement::SVGCursorElement() : SVGElement(), SVGURIReference(), SVGTests(), SVGExternalResourcesRequired() +{ + impl = 0; +} + +SVGCursorElement::SVGCursorElement(const SVGCursorElement &other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGExternalResourcesRequired(other), impl(0) +{ + (*this) = other; +} + +SVGCursorElement &SVGCursorElement::operator =(const SVGCursorElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + SVGTests::operator=(other); + SVGExternalResourcesRequired::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGCursorElement::SVGCursorElement(SVGCursorElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGExternalResourcesRequired(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGCursorElement::~SVGCursorElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGCursorElement::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGCursorElement::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} diff --git a/ksvg/dom/SVGDefinitionSrcElement.cc b/ksvg/dom/SVGDefinitionSrcElement.cc deleted file mode 100644 index 6a965215..00000000 --- a/ksvg/dom/SVGDefinitionSrcElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDefinitionSrcElement.h" -#include "SVGDefinitionSrcElementImpl.h" - -using namespace KSVG; - -SVGDefinitionSrcElement::SVGDefinitionSrcElement() : SVGElement() -{ - impl = 0; -} - -SVGDefinitionSrcElement::SVGDefinitionSrcElement(const SVGDefinitionSrcElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGDefinitionSrcElement &SVGDefinitionSrcElement::operator =(const SVGDefinitionSrcElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGDefinitionSrcElement::SVGDefinitionSrcElement(SVGDefinitionSrcElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGDefinitionSrcElement::~SVGDefinitionSrcElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGDefinitionSrcElement.cpp b/ksvg/dom/SVGDefinitionSrcElement.cpp new file mode 100644 index 00000000..6a965215 --- /dev/null +++ b/ksvg/dom/SVGDefinitionSrcElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDefinitionSrcElement.h" +#include "SVGDefinitionSrcElementImpl.h" + +using namespace KSVG; + +SVGDefinitionSrcElement::SVGDefinitionSrcElement() : SVGElement() +{ + impl = 0; +} + +SVGDefinitionSrcElement::SVGDefinitionSrcElement(const SVGDefinitionSrcElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGDefinitionSrcElement &SVGDefinitionSrcElement::operator =(const SVGDefinitionSrcElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGDefinitionSrcElement::SVGDefinitionSrcElement(SVGDefinitionSrcElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGDefinitionSrcElement::~SVGDefinitionSrcElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGDefsElement.cc b/ksvg/dom/SVGDefsElement.cc deleted file mode 100644 index 9382286e..00000000 --- a/ksvg/dom/SVGDefsElement.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDefsElement.h" -#include "SVGDefsElementImpl.h" - -using namespace KSVG; - -SVGDefsElement::SVGDefsElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGDefsElement::SVGDefsElement(const SVGDefsElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) -{ - (*this) = other; -} - -SVGDefsElement &SVGDefsElement::operator =(const SVGDefsElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGDefsElement::SVGDefsElement(SVGDefsElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGDefsElement::~SVGDefsElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGDefsElement.cpp b/ksvg/dom/SVGDefsElement.cpp new file mode 100644 index 00000000..9382286e --- /dev/null +++ b/ksvg/dom/SVGDefsElement.cpp @@ -0,0 +1,70 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDefsElement.h" +#include "SVGDefsElementImpl.h" + +using namespace KSVG; + +SVGDefsElement::SVGDefsElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGDefsElement::SVGDefsElement(const SVGDefsElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) +{ + (*this) = other; +} + +SVGDefsElement &SVGDefsElement::operator =(const SVGDefsElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGDefsElement::SVGDefsElement(SVGDefsElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGDefsElement::~SVGDefsElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGDescElement.cc b/ksvg/dom/SVGDescElement.cc deleted file mode 100644 index 35f77c76..00000000 --- a/ksvg/dom/SVGDescElement.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDescElement.h" -#include "SVGDescElementImpl.h" - -using namespace KSVG; - -SVGDescElement::SVGDescElement() : SVGElement(), SVGLangSpace(), SVGStylable() -{ - impl = 0; -} - -SVGDescElement::SVGDescElement(const SVGDescElement &other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other), impl(0) -{ - (*this) = other; -} - -SVGDescElement &SVGDescElement::operator =(const SVGDescElement &other) -{ - SVGElement::operator=(other); - SVGLangSpace::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGDescElement::SVGDescElement(SVGDescElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGDescElement::~SVGDescElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGDescElement.cpp b/ksvg/dom/SVGDescElement.cpp new file mode 100644 index 00000000..35f77c76 --- /dev/null +++ b/ksvg/dom/SVGDescElement.cpp @@ -0,0 +1,67 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDescElement.h" +#include "SVGDescElementImpl.h" + +using namespace KSVG; + +SVGDescElement::SVGDescElement() : SVGElement(), SVGLangSpace(), SVGStylable() +{ + impl = 0; +} + +SVGDescElement::SVGDescElement(const SVGDescElement &other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other), impl(0) +{ + (*this) = other; +} + +SVGDescElement &SVGDescElement::operator =(const SVGDescElement &other) +{ + SVGElement::operator=(other); + SVGLangSpace::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGDescElement::SVGDescElement(SVGDescElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGDescElement::~SVGDescElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGDocument.cc b/ksvg/dom/SVGDocument.cc deleted file mode 100644 index f9d46968..00000000 --- a/ksvg/dom/SVGDocument.cc +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "ksvg_ecma.h" - -#include "SVGDocument.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElement.h" -#include "SVGWindow.h" - -using namespace KSVG; - -SVGDocument::SVGDocument() : DOM::Document(*(new SVGDocumentImpl())) -{ - impl = reinterpret_cast(handle()); - impl->ref(); -} - -SVGDocument::SVGDocument(const SVGDocument &other) : DOM::Document(other), impl(0) -{ - (*this) = other; -} - -SVGDocument &SVGDocument::operator=(const SVGDocument &other) -{ - DOM::Document::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGDocument::SVGDocument(SVGDocumentImpl *other) : DOM::Document(other->handle()) -{ - impl = other; - - if(impl) - impl->ref(); -} - -SVGDocument::~SVGDocument() -{ - if(impl) - impl->deref(); -} - -DOM::DOMString SVGDocument::title() const -{ - if(!impl) return DOM::DOMString(); - return impl->title(); -} - -DOM::DOMString SVGDocument::referrer() const -{ - if(!impl) return DOM::DOMString(); - return impl->referrer(); -} - -DOM::DOMString SVGDocument::domain() const -{ - if(!impl) return DOM::DOMString(); - return impl->domain(); -} - -DOM::DOMString SVGDocument::URL() const -{ - if(!impl) return DOM::DOMString(); - return impl->URL(); -} - -SVGWindow SVGDocument::window() const -{ - if(!impl) return SVGWindow(); - return impl->window(); -} - -SVGSVGElement SVGDocument::rootElement() const -{ - if(!impl) return SVGSVGElement(0); - return SVGSVGElement(impl->rootElement()); -} - -SVGElement SVGDocument::createElement(const DOM::DOMString &tagName) -{ - if(!impl) return SVGElement(0); - - DOM::Element impl = DOM::Document::createElement(tagName); - return SVGElement(SVGDocumentImpl::createElement(tagName, impl)); -} - -SVGElement SVGDocument::createElementNS(const DOM::DOMString &namespaceURI, const DOM::DOMString &qualifiedName) -{ - if(!impl) return SVGElement(0); - - DOM::Element impl = DOM::Document::createElementNS(namespaceURI, qualifiedName); - return SVGElement(SVGDocumentImpl::createElement(qualifiedName, impl)); -} - -// Internal -KJS::Object SVGDocument::globalJSObject() -{ - if(!impl) return KJS::Object(); - return impl->ecmaEngine()->globalObject(); -} - -KJS::ExecState *SVGDocument::globalJSExec() -{ - if(!impl) return 0; - return impl->ecmaEngine()->globalExec(); -} diff --git a/ksvg/dom/SVGDocument.cpp b/ksvg/dom/SVGDocument.cpp new file mode 100644 index 00000000..f9d46968 --- /dev/null +++ b/ksvg/dom/SVGDocument.cpp @@ -0,0 +1,136 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "ksvg_ecma.h" + +#include "SVGDocument.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElement.h" +#include "SVGWindow.h" + +using namespace KSVG; + +SVGDocument::SVGDocument() : DOM::Document(*(new SVGDocumentImpl())) +{ + impl = reinterpret_cast(handle()); + impl->ref(); +} + +SVGDocument::SVGDocument(const SVGDocument &other) : DOM::Document(other), impl(0) +{ + (*this) = other; +} + +SVGDocument &SVGDocument::operator=(const SVGDocument &other) +{ + DOM::Document::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGDocument::SVGDocument(SVGDocumentImpl *other) : DOM::Document(other->handle()) +{ + impl = other; + + if(impl) + impl->ref(); +} + +SVGDocument::~SVGDocument() +{ + if(impl) + impl->deref(); +} + +DOM::DOMString SVGDocument::title() const +{ + if(!impl) return DOM::DOMString(); + return impl->title(); +} + +DOM::DOMString SVGDocument::referrer() const +{ + if(!impl) return DOM::DOMString(); + return impl->referrer(); +} + +DOM::DOMString SVGDocument::domain() const +{ + if(!impl) return DOM::DOMString(); + return impl->domain(); +} + +DOM::DOMString SVGDocument::URL() const +{ + if(!impl) return DOM::DOMString(); + return impl->URL(); +} + +SVGWindow SVGDocument::window() const +{ + if(!impl) return SVGWindow(); + return impl->window(); +} + +SVGSVGElement SVGDocument::rootElement() const +{ + if(!impl) return SVGSVGElement(0); + return SVGSVGElement(impl->rootElement()); +} + +SVGElement SVGDocument::createElement(const DOM::DOMString &tagName) +{ + if(!impl) return SVGElement(0); + + DOM::Element impl = DOM::Document::createElement(tagName); + return SVGElement(SVGDocumentImpl::createElement(tagName, impl)); +} + +SVGElement SVGDocument::createElementNS(const DOM::DOMString &namespaceURI, const DOM::DOMString &qualifiedName) +{ + if(!impl) return SVGElement(0); + + DOM::Element impl = DOM::Document::createElementNS(namespaceURI, qualifiedName); + return SVGElement(SVGDocumentImpl::createElement(qualifiedName, impl)); +} + +// Internal +KJS::Object SVGDocument::globalJSObject() +{ + if(!impl) return KJS::Object(); + return impl->ecmaEngine()->globalObject(); +} + +KJS::ExecState *SVGDocument::globalJSExec() +{ + if(!impl) return 0; + return impl->ecmaEngine()->globalExec(); +} diff --git a/ksvg/dom/SVGElement.cc b/ksvg/dom/SVGElement.cc deleted file mode 100644 index e753bac3..00000000 --- a/ksvg/dom/SVGElement.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGSVGElement.h" -#include "SVGElement.h" -#include "SVGElementImpl.h" - -using namespace KSVG; - -// There is no way to create a SVGElement this way! Use SVGDocument. -SVGElement::SVGElement() : DOM::Element() -{ - impl = 0; // new SVGElementImpl(ownerDocument().createElement().handle()); -} - -SVGElement::SVGElement(const SVGElement &other) : DOM::Element(other), impl(0) -{ - (*this) = other; -} - -SVGElement &SVGElement::operator=(const SVGElement &other) -{ - // Baseclass assignement operators always first (Niko) - DOM::Element::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGElement::SVGElement(SVGElementImpl *other) : DOM::Element(other->handle()) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGElement::~SVGElement() -{ - if(impl) - impl->deref(); -} - -void SVGElement::setId(DOM::DOMString value) -{ - if(impl) - impl->setId(value); -} - -DOM::DOMString SVGElement::id() -{ - if(!impl) return DOM::DOMString(); - return impl->id(); -} - -void SVGElement::setXmlbase(DOM::DOMString value) -{ - if(impl) - impl->setXmlbase(value); -} - -DOM::DOMString SVGElement::xmlbase() -{ - if(!impl) return DOM::DOMString(); - return impl->xmlbase(); -} - -SVGSVGElement SVGElement::ownerSVGElement() -{ - if(!impl) return SVGSVGElement(0); - return impl->ownerSVGElement(); -} - -SVGElement SVGElement::viewportElement() -{ - if(!impl) return SVGElement(0); - return impl->viewportElement(); -} - -void SVGElement::setAttribute(const DOM::DOMString &name, const DOM::DOMString &value) -{ - if(impl) - impl->setAttributeInternal(name, value); -} - -DOM::DOMString SVGElement::getAttribute(const DOM::DOMString &name) -{ - if(!impl) return DOM::DOMString(); - return impl->getAttributeInternal(name); -} - -bool SVGElement::hasAttribute(const DOM::DOMString &name) -{ - if(!impl) return false; - return impl->hasAttribute(name); -} diff --git a/ksvg/dom/SVGElement.cpp b/ksvg/dom/SVGElement.cpp new file mode 100644 index 00000000..e753bac3 --- /dev/null +++ b/ksvg/dom/SVGElement.cpp @@ -0,0 +1,122 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGSVGElement.h" +#include "SVGElement.h" +#include "SVGElementImpl.h" + +using namespace KSVG; + +// There is no way to create a SVGElement this way! Use SVGDocument. +SVGElement::SVGElement() : DOM::Element() +{ + impl = 0; // new SVGElementImpl(ownerDocument().createElement().handle()); +} + +SVGElement::SVGElement(const SVGElement &other) : DOM::Element(other), impl(0) +{ + (*this) = other; +} + +SVGElement &SVGElement::operator=(const SVGElement &other) +{ + // Baseclass assignement operators always first (Niko) + DOM::Element::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGElement::SVGElement(SVGElementImpl *other) : DOM::Element(other->handle()) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGElement::~SVGElement() +{ + if(impl) + impl->deref(); +} + +void SVGElement::setId(DOM::DOMString value) +{ + if(impl) + impl->setId(value); +} + +DOM::DOMString SVGElement::id() +{ + if(!impl) return DOM::DOMString(); + return impl->id(); +} + +void SVGElement::setXmlbase(DOM::DOMString value) +{ + if(impl) + impl->setXmlbase(value); +} + +DOM::DOMString SVGElement::xmlbase() +{ + if(!impl) return DOM::DOMString(); + return impl->xmlbase(); +} + +SVGSVGElement SVGElement::ownerSVGElement() +{ + if(!impl) return SVGSVGElement(0); + return impl->ownerSVGElement(); +} + +SVGElement SVGElement::viewportElement() +{ + if(!impl) return SVGElement(0); + return impl->viewportElement(); +} + +void SVGElement::setAttribute(const DOM::DOMString &name, const DOM::DOMString &value) +{ + if(impl) + impl->setAttributeInternal(name, value); +} + +DOM::DOMString SVGElement::getAttribute(const DOM::DOMString &name) +{ + if(!impl) return DOM::DOMString(); + return impl->getAttributeInternal(name); +} + +bool SVGElement::hasAttribute(const DOM::DOMString &name) +{ + if(!impl) return false; + return impl->hasAttribute(name); +} diff --git a/ksvg/dom/SVGElementInstance.cc b/ksvg/dom/SVGElementInstance.cc deleted file mode 100644 index 6af2d11e..00000000 --- a/ksvg/dom/SVGElementInstance.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGElementInstance.h" -#include "SVGElementInstanceImpl.h" -#include "SVGElementInstanceList.h" -#include "SVGElement.h" -#include "SVGUseElement.h" - -using namespace KSVG; - -SVGElementInstance::SVGElementInstance() -{ - impl = new SVGElementInstanceImpl(); - impl->ref(); -} - -SVGElementInstance::SVGElementInstance(const SVGElementInstance &other) : impl(0) -{ - (*this) = other; -} - -SVGElementInstance &SVGElementInstance::operator =(const SVGElementInstance &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGElementInstance::SVGElementInstance(SVGElementInstanceImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGElementInstance::~SVGElementInstance() -{ - if(impl) - impl->deref(); -} - -SVGElement SVGElementInstance::correspondingElement() const -{ - if(!impl) return SVGElement(0); - return SVGElement(impl->correspondingElement()); -} - -SVGUseElement SVGElementInstance::correspondingUseElement() const -{ - if(!impl) return SVGUseElement(0); - return SVGUseElement(impl->correspondingUseElement()); -} - -SVGElementInstance SVGElementInstance::parentNode() const -{ - if(!impl) return SVGElementInstance(0); - return SVGElementInstance(impl->parentNode()); -} - -SVGElementInstanceList SVGElementInstance::childNodes() const -{ - if(!impl) return SVGElementInstanceList(0); - return SVGElementInstanceList(impl->childNodes()); -} - -SVGElementInstance SVGElementInstance::firstChild() const -{ - if(!impl) return SVGElementInstance(0); - return SVGElementInstance(impl->firstChild()); -} - -SVGElementInstance SVGElementInstance::lastChild() const -{ - if(!impl) return SVGElementInstance(0); - return SVGElementInstance(impl->lastChild()); -} - -SVGElementInstance SVGElementInstance::previousSibling() const -{ - if(!impl) return SVGElementInstance(0); - return SVGElementInstance(impl->previousSibling()); -} - -SVGElementInstance SVGElementInstance::nextSibling() const -{ - if(!impl) return SVGElementInstance(0); - return SVGElementInstance(impl->nextSibling()); -} diff --git a/ksvg/dom/SVGElementInstance.cpp b/ksvg/dom/SVGElementInstance.cpp new file mode 100644 index 00000000..6af2d11e --- /dev/null +++ b/ksvg/dom/SVGElementInstance.cpp @@ -0,0 +1,115 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGElementInstance.h" +#include "SVGElementInstanceImpl.h" +#include "SVGElementInstanceList.h" +#include "SVGElement.h" +#include "SVGUseElement.h" + +using namespace KSVG; + +SVGElementInstance::SVGElementInstance() +{ + impl = new SVGElementInstanceImpl(); + impl->ref(); +} + +SVGElementInstance::SVGElementInstance(const SVGElementInstance &other) : impl(0) +{ + (*this) = other; +} + +SVGElementInstance &SVGElementInstance::operator =(const SVGElementInstance &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGElementInstance::SVGElementInstance(SVGElementInstanceImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGElementInstance::~SVGElementInstance() +{ + if(impl) + impl->deref(); +} + +SVGElement SVGElementInstance::correspondingElement() const +{ + if(!impl) return SVGElement(0); + return SVGElement(impl->correspondingElement()); +} + +SVGUseElement SVGElementInstance::correspondingUseElement() const +{ + if(!impl) return SVGUseElement(0); + return SVGUseElement(impl->correspondingUseElement()); +} + +SVGElementInstance SVGElementInstance::parentNode() const +{ + if(!impl) return SVGElementInstance(0); + return SVGElementInstance(impl->parentNode()); +} + +SVGElementInstanceList SVGElementInstance::childNodes() const +{ + if(!impl) return SVGElementInstanceList(0); + return SVGElementInstanceList(impl->childNodes()); +} + +SVGElementInstance SVGElementInstance::firstChild() const +{ + if(!impl) return SVGElementInstance(0); + return SVGElementInstance(impl->firstChild()); +} + +SVGElementInstance SVGElementInstance::lastChild() const +{ + if(!impl) return SVGElementInstance(0); + return SVGElementInstance(impl->lastChild()); +} + +SVGElementInstance SVGElementInstance::previousSibling() const +{ + if(!impl) return SVGElementInstance(0); + return SVGElementInstance(impl->previousSibling()); +} + +SVGElementInstance SVGElementInstance::nextSibling() const +{ + if(!impl) return SVGElementInstance(0); + return SVGElementInstance(impl->nextSibling()); +} diff --git a/ksvg/dom/SVGElementInstanceList.cc b/ksvg/dom/SVGElementInstanceList.cc deleted file mode 100644 index 6b4fd80e..00000000 --- a/ksvg/dom/SVGElementInstanceList.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGElementInstanceList.h" -#include "SVGElementInstanceListImpl.h" -#include "SVGElementInstance.h" - -using namespace KSVG; - -SVGElementInstanceList::SVGElementInstanceList() -{ - impl = new SVGElementInstanceListImpl(); - impl->ref(); -} - -SVGElementInstanceList::SVGElementInstanceList(const SVGElementInstanceList &other) : impl(0) -{ - (*this) = other; -} - -SVGElementInstanceList &SVGElementInstanceList::operator=(const SVGElementInstanceList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGElementInstanceList::SVGElementInstanceList(SVGElementInstanceListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGElementInstanceList::~SVGElementInstanceList() -{ - if(impl) - impl->deref(); -} - -unsigned long SVGElementInstanceList::length() const -{ - if(!impl) return 0; - return impl->length(); -} - -SVGElementInstance SVGElementInstanceList::item(unsigned long index) -{ - if(!impl) return SVGElementInstance(0); - return SVGElementInstance(impl->item(index)); -} diff --git a/ksvg/dom/SVGElementInstanceList.cpp b/ksvg/dom/SVGElementInstanceList.cpp new file mode 100644 index 00000000..6b4fd80e --- /dev/null +++ b/ksvg/dom/SVGElementInstanceList.cpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGElementInstanceList.h" +#include "SVGElementInstanceListImpl.h" +#include "SVGElementInstance.h" + +using namespace KSVG; + +SVGElementInstanceList::SVGElementInstanceList() +{ + impl = new SVGElementInstanceListImpl(); + impl->ref(); +} + +SVGElementInstanceList::SVGElementInstanceList(const SVGElementInstanceList &other) : impl(0) +{ + (*this) = other; +} + +SVGElementInstanceList &SVGElementInstanceList::operator=(const SVGElementInstanceList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGElementInstanceList::SVGElementInstanceList(SVGElementInstanceListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGElementInstanceList::~SVGElementInstanceList() +{ + if(impl) + impl->deref(); +} + +unsigned long SVGElementInstanceList::length() const +{ + if(!impl) return 0; + return impl->length(); +} + +SVGElementInstance SVGElementInstanceList::item(unsigned long index) +{ + if(!impl) return SVGElementInstance(0); + return SVGElementInstance(impl->item(index)); +} diff --git a/ksvg/dom/SVGEllipseElement.cc b/ksvg/dom/SVGEllipseElement.cc deleted file mode 100644 index 36d2449e..00000000 --- a/ksvg/dom/SVGEllipseElement.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGEllipseElement.h" -#include "SVGEllipseElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGEllipseElement::SVGEllipseElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGEllipseElement::SVGEllipseElement(const SVGEllipseElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) -{ - (*this) = other; -} - -SVGEllipseElement &SVGEllipseElement::operator=(const SVGEllipseElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGEllipseElement::SVGEllipseElement(SVGEllipseElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGEllipseElement::~SVGEllipseElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGEllipseElement::cx() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->cx()); -} - -SVGAnimatedLength SVGEllipseElement::cy() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->cy()); -} - -SVGAnimatedLength SVGEllipseElement::rx() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->rx()); -} - -SVGAnimatedLength SVGEllipseElement::ry() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->ry()); -} diff --git a/ksvg/dom/SVGEllipseElement.cpp b/ksvg/dom/SVGEllipseElement.cpp new file mode 100644 index 00000000..36d2449e --- /dev/null +++ b/ksvg/dom/SVGEllipseElement.cpp @@ -0,0 +1,96 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGEllipseElement.h" +#include "SVGEllipseElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGEllipseElement::SVGEllipseElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGEllipseElement::SVGEllipseElement(const SVGEllipseElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) +{ + (*this) = other; +} + +SVGEllipseElement &SVGEllipseElement::operator=(const SVGEllipseElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGEllipseElement::SVGEllipseElement(SVGEllipseElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGEllipseElement::~SVGEllipseElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGEllipseElement::cx() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->cx()); +} + +SVGAnimatedLength SVGEllipseElement::cy() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->cy()); +} + +SVGAnimatedLength SVGEllipseElement::rx() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->rx()); +} + +SVGAnimatedLength SVGEllipseElement::ry() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->ry()); +} diff --git a/ksvg/dom/SVGEvent.cc b/ksvg/dom/SVGEvent.cc deleted file mode 100644 index 67cc8ddf..00000000 --- a/ksvg/dom/SVGEvent.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGEvent.h" -#include "SVGEventImpl.h" - -using namespace KSVG; - -SVGEvent::SVGEvent() : DOM::Event() -{ - impl = 0; -} - -SVGEvent::SVGEvent(const SVGEvent &other) : DOM::Event(other), impl(0) -{ - (*this) = other; -} - -SVGEvent &SVGEvent::operator =(const SVGEvent &other) -{ - DOM::Event::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGEvent::SVGEvent(SVGEventImpl *other) : DOM::Event() -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGEvent::~SVGEvent() -{ - if(impl) - impl->deref(); -} - -SVGEvent::EventId SVGEvent::typeToId(DOM::DOMString type) -{ - if(type == "DOMFocusIn") - return DOMFOCUSIN_EVENT; - else if(type == "DOMFocusOut") - return DOMFOCUSOUT_EVENT; - else if(type == "DOMActivate") - return DOMACTIVATE_EVENT; - else if(type == "click") - return CLICK_EVENT; - else if(type == "mousedown") - return MOUSEDOWN_EVENT; - else if(type == "mouseup") - return MOUSEUP_EVENT; - else if(type == "mouseover") - return MOUSEOVER_EVENT; - else if(type == "mousemove") - return MOUSEMOVE_EVENT; - else if(type == "mouseout") - return MOUSEOUT_EVENT; - else if(type == "DOMSubtreeModified") - return DOMSUBTREEMODIFIED_EVENT; - else if(type == "DOMNodeInserted") - return DOMNODEINSERTED_EVENT; - else if(type == "DOMNodeRemoved") - return DOMNODEREMOVED_EVENT; - else if(type == "DOMNodeRemovedFromDocument") - return DOMNODEREMOVEDFROMDOCUMENT_EVENT; - else if(type == "DOMNodeInsertedIntoDocument") - return DOMNODEINSERTEDINTODOCUMENT_EVENT; - else if(type == "DOMAttrModified") - return DOMATTRMODIFIED_EVENT; - else if(type == "DOMCharacterDataModified") - return DOMCHARACTERDATAMODIFIED_EVENT; - else if(type == "load") - return LOAD_EVENT; - else if(type == "unload") - return UNLOAD_EVENT; - else if(type == "abort") - return ABORT_EVENT; - else if(type == "error") - return ERROR_EVENT; - else if(type == "resize") - return RESIZE_EVENT; - else if(type == "scroll") - return SCROLL_EVENT; - else if(type == "zoom") - return ZOOM_EVENT; - else if(type == "keydown") - return KEYDOWN_EVENT; - else if(type == "keyup") - return KEYUP_EVENT; - else if(type == "keypress") - return KEYPRESS_EVENT; - - return UNKNOWN_EVENT; -} - -DOM::DOMString SVGEvent::idToType(EventId id) -{ - switch(id) - { - case DOMFOCUSIN_EVENT: - return "DOMFocusIn"; - case DOMFOCUSOUT_EVENT: - return "DOMFocusOut"; - case DOMACTIVATE_EVENT: - return "DOMActivate"; - case CLICK_EVENT: - return "click"; - case MOUSEDOWN_EVENT: - return "mousedown"; - case MOUSEUP_EVENT: - return "mouseup"; - case MOUSEOVER_EVENT: - return "mouseover"; - case MOUSEMOVE_EVENT: - return "mousemove"; - case MOUSEOUT_EVENT: - return "mouseout"; - case DOMSUBTREEMODIFIED_EVENT: - return "DOMSubtreeModified"; - case DOMNODEINSERTED_EVENT: - return "DOMNodeInserted"; - case DOMNODEREMOVED_EVENT: - return "DOMNodeRemoved"; - case DOMNODEREMOVEDFROMDOCUMENT_EVENT: - return "DOMNodeRemovedFromDocument"; - case DOMNODEINSERTEDINTODOCUMENT_EVENT: - return "DOMNodeInsertedIntoDocument"; - case DOMATTRMODIFIED_EVENT: - return "DOMAttrModified"; - case DOMCHARACTERDATAMODIFIED_EVENT: - return "DOMCharacterDataModified"; - case LOAD_EVENT: - return "load"; - case UNLOAD_EVENT: - return "unload"; - case ABORT_EVENT: - return "abort"; - case ERROR_EVENT: - return "error"; - case RESIZE_EVENT: - return "resize"; - case SCROLL_EVENT: - return "scroll"; - case ZOOM_EVENT: - return "zoom"; - case KEYDOWN_EVENT: - return "keydown"; - case KEYUP_EVENT: - return "keyup"; - case KEYPRESS_EVENT: - return "keypress"; - default: - return DOM::DOMString(); - break; - } -} diff --git a/ksvg/dom/SVGEvent.cpp b/ksvg/dom/SVGEvent.cpp new file mode 100644 index 00000000..67cc8ddf --- /dev/null +++ b/ksvg/dom/SVGEvent.cpp @@ -0,0 +1,185 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGEvent.h" +#include "SVGEventImpl.h" + +using namespace KSVG; + +SVGEvent::SVGEvent() : DOM::Event() +{ + impl = 0; +} + +SVGEvent::SVGEvent(const SVGEvent &other) : DOM::Event(other), impl(0) +{ + (*this) = other; +} + +SVGEvent &SVGEvent::operator =(const SVGEvent &other) +{ + DOM::Event::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGEvent::SVGEvent(SVGEventImpl *other) : DOM::Event() +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGEvent::~SVGEvent() +{ + if(impl) + impl->deref(); +} + +SVGEvent::EventId SVGEvent::typeToId(DOM::DOMString type) +{ + if(type == "DOMFocusIn") + return DOMFOCUSIN_EVENT; + else if(type == "DOMFocusOut") + return DOMFOCUSOUT_EVENT; + else if(type == "DOMActivate") + return DOMACTIVATE_EVENT; + else if(type == "click") + return CLICK_EVENT; + else if(type == "mousedown") + return MOUSEDOWN_EVENT; + else if(type == "mouseup") + return MOUSEUP_EVENT; + else if(type == "mouseover") + return MOUSEOVER_EVENT; + else if(type == "mousemove") + return MOUSEMOVE_EVENT; + else if(type == "mouseout") + return MOUSEOUT_EVENT; + else if(type == "DOMSubtreeModified") + return DOMSUBTREEMODIFIED_EVENT; + else if(type == "DOMNodeInserted") + return DOMNODEINSERTED_EVENT; + else if(type == "DOMNodeRemoved") + return DOMNODEREMOVED_EVENT; + else if(type == "DOMNodeRemovedFromDocument") + return DOMNODEREMOVEDFROMDOCUMENT_EVENT; + else if(type == "DOMNodeInsertedIntoDocument") + return DOMNODEINSERTEDINTODOCUMENT_EVENT; + else if(type == "DOMAttrModified") + return DOMATTRMODIFIED_EVENT; + else if(type == "DOMCharacterDataModified") + return DOMCHARACTERDATAMODIFIED_EVENT; + else if(type == "load") + return LOAD_EVENT; + else if(type == "unload") + return UNLOAD_EVENT; + else if(type == "abort") + return ABORT_EVENT; + else if(type == "error") + return ERROR_EVENT; + else if(type == "resize") + return RESIZE_EVENT; + else if(type == "scroll") + return SCROLL_EVENT; + else if(type == "zoom") + return ZOOM_EVENT; + else if(type == "keydown") + return KEYDOWN_EVENT; + else if(type == "keyup") + return KEYUP_EVENT; + else if(type == "keypress") + return KEYPRESS_EVENT; + + return UNKNOWN_EVENT; +} + +DOM::DOMString SVGEvent::idToType(EventId id) +{ + switch(id) + { + case DOMFOCUSIN_EVENT: + return "DOMFocusIn"; + case DOMFOCUSOUT_EVENT: + return "DOMFocusOut"; + case DOMACTIVATE_EVENT: + return "DOMActivate"; + case CLICK_EVENT: + return "click"; + case MOUSEDOWN_EVENT: + return "mousedown"; + case MOUSEUP_EVENT: + return "mouseup"; + case MOUSEOVER_EVENT: + return "mouseover"; + case MOUSEMOVE_EVENT: + return "mousemove"; + case MOUSEOUT_EVENT: + return "mouseout"; + case DOMSUBTREEMODIFIED_EVENT: + return "DOMSubtreeModified"; + case DOMNODEINSERTED_EVENT: + return "DOMNodeInserted"; + case DOMNODEREMOVED_EVENT: + return "DOMNodeRemoved"; + case DOMNODEREMOVEDFROMDOCUMENT_EVENT: + return "DOMNodeRemovedFromDocument"; + case DOMNODEINSERTEDINTODOCUMENT_EVENT: + return "DOMNodeInsertedIntoDocument"; + case DOMATTRMODIFIED_EVENT: + return "DOMAttrModified"; + case DOMCHARACTERDATAMODIFIED_EVENT: + return "DOMCharacterDataModified"; + case LOAD_EVENT: + return "load"; + case UNLOAD_EVENT: + return "unload"; + case ABORT_EVENT: + return "abort"; + case ERROR_EVENT: + return "error"; + case RESIZE_EVENT: + return "resize"; + case SCROLL_EVENT: + return "scroll"; + case ZOOM_EVENT: + return "zoom"; + case KEYDOWN_EVENT: + return "keydown"; + case KEYUP_EVENT: + return "keyup"; + case KEYPRESS_EVENT: + return "keypress"; + default: + return DOM::DOMString(); + break; + } +} diff --git a/ksvg/dom/SVGExternalResourcesRequired.cc b/ksvg/dom/SVGExternalResourcesRequired.cc deleted file mode 100644 index 189d72ee..00000000 --- a/ksvg/dom/SVGExternalResourcesRequired.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGExternalResourcesRequired.h" -#include "SVGExternalResourcesRequiredImpl.h" -#include "SVGAnimatedBoolean.h" - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGExternalResourcesRequired::SVGExternalResourcesRequired() -{ - impl = 0; -} - -SVGExternalResourcesRequired::SVGExternalResourcesRequired(const SVGExternalResourcesRequired &other) : impl(0) -{ - (*this) = other; -} - -SVGExternalResourcesRequired &SVGExternalResourcesRequired::operator=(const SVGExternalResourcesRequired &other) -{ - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGExternalResourcesRequiredImpl *other) -{ - impl = other; -} - -SVGExternalResourcesRequired::~SVGExternalResourcesRequired() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -SVGAnimatedBoolean SVGExternalResourcesRequired::externalResourcesRequired() const -{ - if(!impl) return SVGAnimatedBoolean(0); - return SVGAnimatedBoolean(impl->externalResourcesRequired()); -} diff --git a/ksvg/dom/SVGExternalResourcesRequired.cpp b/ksvg/dom/SVGExternalResourcesRequired.cpp new file mode 100644 index 00000000..189d72ee --- /dev/null +++ b/ksvg/dom/SVGExternalResourcesRequired.cpp @@ -0,0 +1,63 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGExternalResourcesRequired.h" +#include "SVGExternalResourcesRequiredImpl.h" +#include "SVGAnimatedBoolean.h" + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGExternalResourcesRequired::SVGExternalResourcesRequired() +{ + impl = 0; +} + +SVGExternalResourcesRequired::SVGExternalResourcesRequired(const SVGExternalResourcesRequired &other) : impl(0) +{ + (*this) = other; +} + +SVGExternalResourcesRequired &SVGExternalResourcesRequired::operator=(const SVGExternalResourcesRequired &other) +{ + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGExternalResourcesRequiredImpl *other) +{ + impl = other; +} + +SVGExternalResourcesRequired::~SVGExternalResourcesRequired() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +SVGAnimatedBoolean SVGExternalResourcesRequired::externalResourcesRequired() const +{ + if(!impl) return SVGAnimatedBoolean(0); + return SVGAnimatedBoolean(impl->externalResourcesRequired()); +} diff --git a/ksvg/dom/SVGFEBlendElement.cc b/ksvg/dom/SVGFEBlendElement.cc deleted file mode 100644 index f0fe7b8b..00000000 --- a/ksvg/dom/SVGFEBlendElement.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEBlendElement.h" -#include "SVGFEBlendElementImpl.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGFEBlendElement::SVGFEBlendElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEBlendElement::SVGFEBlendElement(const SVGFEBlendElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEBlendElement &SVGFEBlendElement::operator =(const SVGFEBlendElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEBlendElement::SVGFEBlendElement(SVGFEBlendElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEBlendElement::~SVGFEBlendElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEBlendElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedString SVGFEBlendElement::in2() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in2()); -} - -SVGAnimatedEnumeration SVGFEBlendElement::mode() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->mode()); -} diff --git a/ksvg/dom/SVGFEBlendElement.cpp b/ksvg/dom/SVGFEBlendElement.cpp new file mode 100644 index 00000000..f0fe7b8b --- /dev/null +++ b/ksvg/dom/SVGFEBlendElement.cpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEBlendElement.h" +#include "SVGFEBlendElementImpl.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGFEBlendElement::SVGFEBlendElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEBlendElement::SVGFEBlendElement(const SVGFEBlendElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEBlendElement &SVGFEBlendElement::operator =(const SVGFEBlendElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEBlendElement::SVGFEBlendElement(SVGFEBlendElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEBlendElement::~SVGFEBlendElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEBlendElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedString SVGFEBlendElement::in2() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in2()); +} + +SVGAnimatedEnumeration SVGFEBlendElement::mode() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->mode()); +} diff --git a/ksvg/dom/SVGFEColorMatrixElement.cc b/ksvg/dom/SVGFEColorMatrixElement.cc deleted file mode 100644 index 5c4c5104..00000000 --- a/ksvg/dom/SVGFEColorMatrixElement.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEColorMatrixElement.h" -#include "SVGFEColorMatrixElementImpl.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedNumberList.h" - -using namespace KSVG; - -SVGFEColorMatrixElement::SVGFEColorMatrixElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEColorMatrixElement::SVGFEColorMatrixElement(const SVGFEColorMatrixElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEColorMatrixElement &SVGFEColorMatrixElement::operator =(const SVGFEColorMatrixElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEColorMatrixElement::SVGFEColorMatrixElement(SVGFEColorMatrixElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEColorMatrixElement::~SVGFEColorMatrixElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEColorMatrixElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedEnumeration SVGFEColorMatrixElement::type() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->type()); -} - -SVGAnimatedNumberList SVGFEColorMatrixElement::values() const -{ - if(!impl) return SVGAnimatedNumberList(0); - return SVGAnimatedNumberList(impl->values()); -} diff --git a/ksvg/dom/SVGFEColorMatrixElement.cpp b/ksvg/dom/SVGFEColorMatrixElement.cpp new file mode 100644 index 00000000..5c4c5104 --- /dev/null +++ b/ksvg/dom/SVGFEColorMatrixElement.cpp @@ -0,0 +1,87 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEColorMatrixElement.h" +#include "SVGFEColorMatrixElementImpl.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumberList.h" + +using namespace KSVG; + +SVGFEColorMatrixElement::SVGFEColorMatrixElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEColorMatrixElement::SVGFEColorMatrixElement(const SVGFEColorMatrixElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEColorMatrixElement &SVGFEColorMatrixElement::operator =(const SVGFEColorMatrixElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEColorMatrixElement::SVGFEColorMatrixElement(SVGFEColorMatrixElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEColorMatrixElement::~SVGFEColorMatrixElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEColorMatrixElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedEnumeration SVGFEColorMatrixElement::type() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->type()); +} + +SVGAnimatedNumberList SVGFEColorMatrixElement::values() const +{ + if(!impl) return SVGAnimatedNumberList(0); + return SVGAnimatedNumberList(impl->values()); +} diff --git a/ksvg/dom/SVGFEComponentTransferElement.cc b/ksvg/dom/SVGFEComponentTransferElement.cc deleted file mode 100644 index bc96a48d..00000000 --- a/ksvg/dom/SVGFEComponentTransferElement.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEComponentTransferElement.h" -#include "SVGFEComponentTransferElementImpl.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGFEComponentTransferElement::SVGFEComponentTransferElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEComponentTransferElement::SVGFEComponentTransferElement(const SVGFEComponentTransferElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEComponentTransferElement &SVGFEComponentTransferElement::operator =(const SVGFEComponentTransferElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEComponentTransferElement::SVGFEComponentTransferElement(SVGFEComponentTransferElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEComponentTransferElement::~SVGFEComponentTransferElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEComponentTransferElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} diff --git a/ksvg/dom/SVGFEComponentTransferElement.cpp b/ksvg/dom/SVGFEComponentTransferElement.cpp new file mode 100644 index 00000000..bc96a48d --- /dev/null +++ b/ksvg/dom/SVGFEComponentTransferElement.cpp @@ -0,0 +1,73 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEComponentTransferElement.h" +#include "SVGFEComponentTransferElementImpl.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGFEComponentTransferElement::SVGFEComponentTransferElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEComponentTransferElement::SVGFEComponentTransferElement(const SVGFEComponentTransferElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEComponentTransferElement &SVGFEComponentTransferElement::operator =(const SVGFEComponentTransferElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEComponentTransferElement::SVGFEComponentTransferElement(SVGFEComponentTransferElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEComponentTransferElement::~SVGFEComponentTransferElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEComponentTransferElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} diff --git a/ksvg/dom/SVGFECompositeElement.cc b/ksvg/dom/SVGFECompositeElement.cc deleted file mode 100644 index b7ff69f5..00000000 --- a/ksvg/dom/SVGFECompositeElement.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFECompositeElement.h" -#include "SVGFECompositeElementImpl.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGFECompositeElement::SVGFECompositeElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFECompositeElement::SVGFECompositeElement(const SVGFECompositeElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFECompositeElement &SVGFECompositeElement::operator =(const SVGFECompositeElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFECompositeElement::SVGFECompositeElement(SVGFECompositeElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFECompositeElement::~SVGFECompositeElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFECompositeElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedString SVGFECompositeElement::in2() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in2()); -} - -SVGAnimatedEnumeration SVGFECompositeElement::Operator() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->Operator()); -} - -SVGAnimatedNumber SVGFECompositeElement::k1() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->k1()); -} - -SVGAnimatedNumber SVGFECompositeElement::k2() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->k2()); -} - -SVGAnimatedNumber SVGFECompositeElement::k3() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->k3()); -} - -SVGAnimatedNumber SVGFECompositeElement::k4() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->k4()); -} diff --git a/ksvg/dom/SVGFECompositeElement.cpp b/ksvg/dom/SVGFECompositeElement.cpp new file mode 100644 index 00000000..b7ff69f5 --- /dev/null +++ b/ksvg/dom/SVGFECompositeElement.cpp @@ -0,0 +1,111 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFECompositeElement.h" +#include "SVGFECompositeElementImpl.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGFECompositeElement::SVGFECompositeElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFECompositeElement::SVGFECompositeElement(const SVGFECompositeElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFECompositeElement &SVGFECompositeElement::operator =(const SVGFECompositeElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFECompositeElement::SVGFECompositeElement(SVGFECompositeElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFECompositeElement::~SVGFECompositeElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFECompositeElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedString SVGFECompositeElement::in2() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in2()); +} + +SVGAnimatedEnumeration SVGFECompositeElement::Operator() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->Operator()); +} + +SVGAnimatedNumber SVGFECompositeElement::k1() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->k1()); +} + +SVGAnimatedNumber SVGFECompositeElement::k2() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->k2()); +} + +SVGAnimatedNumber SVGFECompositeElement::k3() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->k3()); +} + +SVGAnimatedNumber SVGFECompositeElement::k4() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->k4()); +} diff --git a/ksvg/dom/SVGFEConvolveMatrixElement.cc b/ksvg/dom/SVGFEConvolveMatrixElement.cc deleted file mode 100644 index 7f66b8b4..00000000 --- a/ksvg/dom/SVGFEConvolveMatrixElement.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEConvolveMatrixElement.h" -#include "SVGFEConvolveMatrixElementImpl.h" -#include "SVGAnimatedInteger.h" -#include "SVGAnimatedNumberList.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedLength.h" -#include "SVGAnimatedBoolean.h" - -using namespace KSVG; - -SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const SVGFEConvolveMatrixElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEConvolveMatrixElement &SVGFEConvolveMatrixElement::operator =(const SVGFEConvolveMatrixElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(SVGFEConvolveMatrixElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEConvolveMatrixElement::~SVGFEConvolveMatrixElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedInteger SVGFEConvolveMatrixElement::orderX() const -{ - if(!impl) return SVGAnimatedInteger(0); - return SVGAnimatedInteger(impl->orderX()); -} - -SVGAnimatedInteger SVGFEConvolveMatrixElement::orderY() const -{ - if(!impl) return SVGAnimatedInteger(0); - return SVGAnimatedInteger(impl->orderY()); -} - -SVGAnimatedNumberList SVGFEConvolveMatrixElement::kernelMatrix() const -{ - if(!impl) return SVGAnimatedNumberList(0); - return SVGAnimatedNumberList(impl->kernelMatrix()); -} - -SVGAnimatedNumber SVGFEConvolveMatrixElement::divisor() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->divisor()); -} - -SVGAnimatedNumber SVGFEConvolveMatrixElement::bias() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->bias()); -} - -SVGAnimatedInteger SVGFEConvolveMatrixElement::targetX() const -{ - if(!impl) return SVGAnimatedInteger(0); - return SVGAnimatedInteger(impl->targetX()); -} - -SVGAnimatedInteger SVGFEConvolveMatrixElement::targetY() const -{ - if(!impl) return SVGAnimatedInteger(0); - return SVGAnimatedInteger(impl->targetY()); -} - -SVGAnimatedEnumeration SVGFEConvolveMatrixElement::edgeMode() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->edgeMode()); -} - -SVGAnimatedLength SVGFEConvolveMatrixElement::kernelUnitLengthX() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->kernelUnitLengthX()); -} - -SVGAnimatedLength SVGFEConvolveMatrixElement::kernelUnitLengthY() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->kernelUnitLengthY()); -} - -SVGAnimatedBoolean SVGFEConvolveMatrixElement::preserveAlpha() const -{ - if(!impl) return SVGAnimatedBoolean(0); - return SVGAnimatedBoolean(impl->preserveAlpha()); -} diff --git a/ksvg/dom/SVGFEConvolveMatrixElement.cpp b/ksvg/dom/SVGFEConvolveMatrixElement.cpp new file mode 100644 index 00000000..7f66b8b4 --- /dev/null +++ b/ksvg/dom/SVGFEConvolveMatrixElement.cpp @@ -0,0 +1,138 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEConvolveMatrixElement.h" +#include "SVGFEConvolveMatrixElementImpl.h" +#include "SVGAnimatedInteger.h" +#include "SVGAnimatedNumberList.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedLength.h" +#include "SVGAnimatedBoolean.h" + +using namespace KSVG; + +SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const SVGFEConvolveMatrixElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEConvolveMatrixElement &SVGFEConvolveMatrixElement::operator =(const SVGFEConvolveMatrixElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(SVGFEConvolveMatrixElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEConvolveMatrixElement::~SVGFEConvolveMatrixElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedInteger SVGFEConvolveMatrixElement::orderX() const +{ + if(!impl) return SVGAnimatedInteger(0); + return SVGAnimatedInteger(impl->orderX()); +} + +SVGAnimatedInteger SVGFEConvolveMatrixElement::orderY() const +{ + if(!impl) return SVGAnimatedInteger(0); + return SVGAnimatedInteger(impl->orderY()); +} + +SVGAnimatedNumberList SVGFEConvolveMatrixElement::kernelMatrix() const +{ + if(!impl) return SVGAnimatedNumberList(0); + return SVGAnimatedNumberList(impl->kernelMatrix()); +} + +SVGAnimatedNumber SVGFEConvolveMatrixElement::divisor() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->divisor()); +} + +SVGAnimatedNumber SVGFEConvolveMatrixElement::bias() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->bias()); +} + +SVGAnimatedInteger SVGFEConvolveMatrixElement::targetX() const +{ + if(!impl) return SVGAnimatedInteger(0); + return SVGAnimatedInteger(impl->targetX()); +} + +SVGAnimatedInteger SVGFEConvolveMatrixElement::targetY() const +{ + if(!impl) return SVGAnimatedInteger(0); + return SVGAnimatedInteger(impl->targetY()); +} + +SVGAnimatedEnumeration SVGFEConvolveMatrixElement::edgeMode() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->edgeMode()); +} + +SVGAnimatedLength SVGFEConvolveMatrixElement::kernelUnitLengthX() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->kernelUnitLengthX()); +} + +SVGAnimatedLength SVGFEConvolveMatrixElement::kernelUnitLengthY() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->kernelUnitLengthY()); +} + +SVGAnimatedBoolean SVGFEConvolveMatrixElement::preserveAlpha() const +{ + if(!impl) return SVGAnimatedBoolean(0); + return SVGAnimatedBoolean(impl->preserveAlpha()); +} diff --git a/ksvg/dom/SVGFEDiffuseLightingElement.cc b/ksvg/dom/SVGFEDiffuseLightingElement.cc deleted file mode 100644 index 6e084f25..00000000 --- a/ksvg/dom/SVGFEDiffuseLightingElement.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEDiffuseLightingElement.h" -#include "SVGFEDiffuseLightingElementImpl.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedNumber.h" - -using namespace KSVG; - -SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const SVGFEDiffuseLightingElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEDiffuseLightingElement &SVGFEDiffuseLightingElement::operator =(const SVGFEDiffuseLightingElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(SVGFEDiffuseLightingElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEDiffuseLightingElement::~SVGFEDiffuseLightingElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEDiffuseLightingElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedNumber SVGFEDiffuseLightingElement::surfaceScale() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->surfaceScale()); -} - -SVGAnimatedNumber SVGFEDiffuseLightingElement::diffuseConstant() const -{ - if(!impl) return SVGAnimatedNumber(); - return SVGAnimatedNumber(impl->diffuseConstant()); -} diff --git a/ksvg/dom/SVGFEDiffuseLightingElement.cpp b/ksvg/dom/SVGFEDiffuseLightingElement.cpp new file mode 100644 index 00000000..6e084f25 --- /dev/null +++ b/ksvg/dom/SVGFEDiffuseLightingElement.cpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEDiffuseLightingElement.h" +#include "SVGFEDiffuseLightingElementImpl.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedNumber.h" + +using namespace KSVG; + +SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const SVGFEDiffuseLightingElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEDiffuseLightingElement &SVGFEDiffuseLightingElement::operator =(const SVGFEDiffuseLightingElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(SVGFEDiffuseLightingElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEDiffuseLightingElement::~SVGFEDiffuseLightingElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEDiffuseLightingElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedNumber SVGFEDiffuseLightingElement::surfaceScale() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->surfaceScale()); +} + +SVGAnimatedNumber SVGFEDiffuseLightingElement::diffuseConstant() const +{ + if(!impl) return SVGAnimatedNumber(); + return SVGAnimatedNumber(impl->diffuseConstant()); +} diff --git a/ksvg/dom/SVGFEDisplacementMapElement.cc b/ksvg/dom/SVGFEDisplacementMapElement.cc deleted file mode 100644 index 9bb4938e..00000000 --- a/ksvg/dom/SVGFEDisplacementMapElement.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEDisplacementMapElement.h" -#include "SVGFEDisplacementMapElementImpl.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGFEDisplacementMapElement::SVGFEDisplacementMapElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const SVGFEDisplacementMapElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEDisplacementMapElement &SVGFEDisplacementMapElement::operator =(const SVGFEDisplacementMapElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(SVGFEDisplacementMapElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEDisplacementMapElement::~SVGFEDisplacementMapElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEDisplacementMapElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedString SVGFEDisplacementMapElement::in2() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in2()); -} - -SVGAnimatedNumber SVGFEDisplacementMapElement::scale() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->scale()); -} - -SVGAnimatedEnumeration SVGFEDisplacementMapElement::xChannelSelector() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->xChannelSelector()); -} - -SVGAnimatedEnumeration SVGFEDisplacementMapElement::yChannelSelector() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->yChannelSelector()); -} diff --git a/ksvg/dom/SVGFEDisplacementMapElement.cpp b/ksvg/dom/SVGFEDisplacementMapElement.cpp new file mode 100644 index 00000000..9bb4938e --- /dev/null +++ b/ksvg/dom/SVGFEDisplacementMapElement.cpp @@ -0,0 +1,99 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEDisplacementMapElement.h" +#include "SVGFEDisplacementMapElementImpl.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGFEDisplacementMapElement::SVGFEDisplacementMapElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const SVGFEDisplacementMapElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEDisplacementMapElement &SVGFEDisplacementMapElement::operator =(const SVGFEDisplacementMapElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(SVGFEDisplacementMapElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEDisplacementMapElement::~SVGFEDisplacementMapElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEDisplacementMapElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedString SVGFEDisplacementMapElement::in2() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in2()); +} + +SVGAnimatedNumber SVGFEDisplacementMapElement::scale() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->scale()); +} + +SVGAnimatedEnumeration SVGFEDisplacementMapElement::xChannelSelector() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->xChannelSelector()); +} + +SVGAnimatedEnumeration SVGFEDisplacementMapElement::yChannelSelector() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->yChannelSelector()); +} diff --git a/ksvg/dom/SVGFEDistantLightElement.cc b/ksvg/dom/SVGFEDistantLightElement.cc deleted file mode 100644 index 5e5f4f30..00000000 --- a/ksvg/dom/SVGFEDistantLightElement.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEDistantLightElement.h" -#include "SVGFEDistantLightElementImpl.h" -#include "SVGAnimatedNumber.h" - -using namespace KSVG; - -SVGFEDistantLightElement::SVGFEDistantLightElement() : SVGElement() -{ - impl = 0; -} - -SVGFEDistantLightElement::SVGFEDistantLightElement(const SVGFEDistantLightElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFEDistantLightElement &SVGFEDistantLightElement::operator =(const SVGFEDistantLightElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEDistantLightElement::SVGFEDistantLightElement(SVGFEDistantLightElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEDistantLightElement::~SVGFEDistantLightElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedNumber SVGFEDistantLightElement::azimuth() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->azimuth()); -} - -SVGAnimatedNumber SVGFEDistantLightElement::elevation() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->elevation()); -} diff --git a/ksvg/dom/SVGFEDistantLightElement.cpp b/ksvg/dom/SVGFEDistantLightElement.cpp new file mode 100644 index 00000000..5e5f4f30 --- /dev/null +++ b/ksvg/dom/SVGFEDistantLightElement.cpp @@ -0,0 +1,78 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEDistantLightElement.h" +#include "SVGFEDistantLightElementImpl.h" +#include "SVGAnimatedNumber.h" + +using namespace KSVG; + +SVGFEDistantLightElement::SVGFEDistantLightElement() : SVGElement() +{ + impl = 0; +} + +SVGFEDistantLightElement::SVGFEDistantLightElement(const SVGFEDistantLightElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFEDistantLightElement &SVGFEDistantLightElement::operator =(const SVGFEDistantLightElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEDistantLightElement::SVGFEDistantLightElement(SVGFEDistantLightElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEDistantLightElement::~SVGFEDistantLightElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedNumber SVGFEDistantLightElement::azimuth() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->azimuth()); +} + +SVGAnimatedNumber SVGFEDistantLightElement::elevation() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->elevation()); +} diff --git a/ksvg/dom/SVGFEFloodElement.cc b/ksvg/dom/SVGFEFloodElement.cc deleted file mode 100644 index 0689cb10..00000000 --- a/ksvg/dom/SVGFEFloodElement.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFloodElement.h" -#include "SVGFEFloodElementImpl.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGFEFloodElement::SVGFEFloodElement() : SVGElement(), SVGStylable(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEFloodElement::SVGFEFloodElement(const SVGFEFloodElement &other) : SVGElement(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEFloodElement &SVGFEFloodElement::operator =(const SVGFEFloodElement &other) -{ - SVGElement::operator=(other); - SVGStylable::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEFloodElement::SVGFEFloodElement(SVGFEFloodElementImpl *other) : SVGElement(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEFloodElement::~SVGFEFloodElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEFloodElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} diff --git a/ksvg/dom/SVGFEFloodElement.cpp b/ksvg/dom/SVGFEFloodElement.cpp new file mode 100644 index 00000000..0689cb10 --- /dev/null +++ b/ksvg/dom/SVGFEFloodElement.cpp @@ -0,0 +1,74 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFloodElement.h" +#include "SVGFEFloodElementImpl.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGFEFloodElement::SVGFEFloodElement() : SVGElement(), SVGStylable(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEFloodElement::SVGFEFloodElement(const SVGFEFloodElement &other) : SVGElement(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEFloodElement &SVGFEFloodElement::operator =(const SVGFEFloodElement &other) +{ + SVGElement::operator=(other); + SVGStylable::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEFloodElement::SVGFEFloodElement(SVGFEFloodElementImpl *other) : SVGElement(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEFloodElement::~SVGFEFloodElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEFloodElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} diff --git a/ksvg/dom/SVGFEFuncAElement.cc b/ksvg/dom/SVGFEFuncAElement.cc deleted file mode 100644 index 00db637e..00000000 --- a/ksvg/dom/SVGFEFuncAElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncAElement.h" -#include "SVGFEFuncAElementImpl.h" - -using namespace KSVG; - -SVGFEFuncAElement::SVGFEFuncAElement() : SVGComponentTransferFunctionElement() -{ - impl = 0; -} - -SVGFEFuncAElement::SVGFEFuncAElement(const SVGFEFuncAElement &other) : SVGComponentTransferFunctionElement(other), impl(0) -{ - (*this) = other; -} - -SVGFEFuncAElement &SVGFEFuncAElement::operator =(const SVGFEFuncAElement &other) -{ - SVGComponentTransferFunctionElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEFuncAElement::SVGFEFuncAElement(SVGFEFuncAElementImpl *other) : SVGComponentTransferFunctionElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEFuncAElement::~SVGFEFuncAElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFEFuncAElement.cpp b/ksvg/dom/SVGFEFuncAElement.cpp new file mode 100644 index 00000000..00db637e --- /dev/null +++ b/ksvg/dom/SVGFEFuncAElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncAElement.h" +#include "SVGFEFuncAElementImpl.h" + +using namespace KSVG; + +SVGFEFuncAElement::SVGFEFuncAElement() : SVGComponentTransferFunctionElement() +{ + impl = 0; +} + +SVGFEFuncAElement::SVGFEFuncAElement(const SVGFEFuncAElement &other) : SVGComponentTransferFunctionElement(other), impl(0) +{ + (*this) = other; +} + +SVGFEFuncAElement &SVGFEFuncAElement::operator =(const SVGFEFuncAElement &other) +{ + SVGComponentTransferFunctionElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEFuncAElement::SVGFEFuncAElement(SVGFEFuncAElementImpl *other) : SVGComponentTransferFunctionElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEFuncAElement::~SVGFEFuncAElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFEFuncBElement.cc b/ksvg/dom/SVGFEFuncBElement.cc deleted file mode 100644 index 01e060f3..00000000 --- a/ksvg/dom/SVGFEFuncBElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncBElement.h" -#include "SVGFEFuncBElementImpl.h" - -using namespace KSVG; - -SVGFEFuncBElement::SVGFEFuncBElement() : SVGComponentTransferFunctionElement() -{ - impl = 0; -} - -SVGFEFuncBElement::SVGFEFuncBElement(const SVGFEFuncBElement &other) : SVGComponentTransferFunctionElement(other), impl(0) -{ - (*this) = other; -} - -SVGFEFuncBElement &SVGFEFuncBElement::operator =(const SVGFEFuncBElement &other) -{ - SVGComponentTransferFunctionElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEFuncBElement::SVGFEFuncBElement(SVGFEFuncBElementImpl *other) : SVGComponentTransferFunctionElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEFuncBElement::~SVGFEFuncBElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFEFuncBElement.cpp b/ksvg/dom/SVGFEFuncBElement.cpp new file mode 100644 index 00000000..01e060f3 --- /dev/null +++ b/ksvg/dom/SVGFEFuncBElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncBElement.h" +#include "SVGFEFuncBElementImpl.h" + +using namespace KSVG; + +SVGFEFuncBElement::SVGFEFuncBElement() : SVGComponentTransferFunctionElement() +{ + impl = 0; +} + +SVGFEFuncBElement::SVGFEFuncBElement(const SVGFEFuncBElement &other) : SVGComponentTransferFunctionElement(other), impl(0) +{ + (*this) = other; +} + +SVGFEFuncBElement &SVGFEFuncBElement::operator =(const SVGFEFuncBElement &other) +{ + SVGComponentTransferFunctionElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEFuncBElement::SVGFEFuncBElement(SVGFEFuncBElementImpl *other) : SVGComponentTransferFunctionElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEFuncBElement::~SVGFEFuncBElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFEFuncGElement.cc b/ksvg/dom/SVGFEFuncGElement.cc deleted file mode 100644 index c4af7f36..00000000 --- a/ksvg/dom/SVGFEFuncGElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncGElement.h" -#include "SVGFEFuncGElementImpl.h" - -using namespace KSVG; - -SVGFEFuncGElement::SVGFEFuncGElement() : SVGComponentTransferFunctionElement() -{ - impl = 0; -} - -SVGFEFuncGElement::SVGFEFuncGElement(const SVGFEFuncGElement &other) : SVGComponentTransferFunctionElement(other), impl(0) -{ - (*this) = other; -} - -SVGFEFuncGElement &SVGFEFuncGElement::operator =(const SVGFEFuncGElement &other) -{ - SVGComponentTransferFunctionElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEFuncGElement::SVGFEFuncGElement(SVGFEFuncGElementImpl *other) : SVGComponentTransferFunctionElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEFuncGElement::~SVGFEFuncGElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFEFuncGElement.cpp b/ksvg/dom/SVGFEFuncGElement.cpp new file mode 100644 index 00000000..c4af7f36 --- /dev/null +++ b/ksvg/dom/SVGFEFuncGElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncGElement.h" +#include "SVGFEFuncGElementImpl.h" + +using namespace KSVG; + +SVGFEFuncGElement::SVGFEFuncGElement() : SVGComponentTransferFunctionElement() +{ + impl = 0; +} + +SVGFEFuncGElement::SVGFEFuncGElement(const SVGFEFuncGElement &other) : SVGComponentTransferFunctionElement(other), impl(0) +{ + (*this) = other; +} + +SVGFEFuncGElement &SVGFEFuncGElement::operator =(const SVGFEFuncGElement &other) +{ + SVGComponentTransferFunctionElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEFuncGElement::SVGFEFuncGElement(SVGFEFuncGElementImpl *other) : SVGComponentTransferFunctionElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEFuncGElement::~SVGFEFuncGElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFEFuncRElement.cc b/ksvg/dom/SVGFEFuncRElement.cc deleted file mode 100644 index 59b87ea2..00000000 --- a/ksvg/dom/SVGFEFuncRElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncRElement.h" -#include "SVGFEFuncRElementImpl.h" - -using namespace KSVG; - -SVGFEFuncRElement::SVGFEFuncRElement() : SVGComponentTransferFunctionElement() -{ - impl = 0; -} - -SVGFEFuncRElement::SVGFEFuncRElement(const SVGFEFuncRElement &other) : SVGComponentTransferFunctionElement(other), impl(0) -{ - (*this) = other; -} - -SVGFEFuncRElement &SVGFEFuncRElement::operator =(const SVGFEFuncRElement &other) -{ - SVGComponentTransferFunctionElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEFuncRElement::SVGFEFuncRElement(SVGFEFuncRElementImpl *other) : SVGComponentTransferFunctionElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEFuncRElement::~SVGFEFuncRElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFEFuncRElement.cpp b/ksvg/dom/SVGFEFuncRElement.cpp new file mode 100644 index 00000000..59b87ea2 --- /dev/null +++ b/ksvg/dom/SVGFEFuncRElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncRElement.h" +#include "SVGFEFuncRElementImpl.h" + +using namespace KSVG; + +SVGFEFuncRElement::SVGFEFuncRElement() : SVGComponentTransferFunctionElement() +{ + impl = 0; +} + +SVGFEFuncRElement::SVGFEFuncRElement(const SVGFEFuncRElement &other) : SVGComponentTransferFunctionElement(other), impl(0) +{ + (*this) = other; +} + +SVGFEFuncRElement &SVGFEFuncRElement::operator =(const SVGFEFuncRElement &other) +{ + SVGComponentTransferFunctionElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEFuncRElement::SVGFEFuncRElement(SVGFEFuncRElementImpl *other) : SVGComponentTransferFunctionElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEFuncRElement::~SVGFEFuncRElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFEGaussianBlurElement.cc b/ksvg/dom/SVGFEGaussianBlurElement.cc deleted file mode 100644 index b3b9d9f7..00000000 --- a/ksvg/dom/SVGFEGaussianBlurElement.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEGaussianBlurElement.h" -#include "SVGFEGaussianBlurElementImpl.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedNumber.h" - -using namespace KSVG; - -SVGFEGaussianBlurElement::SVGFEGaussianBlurElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const SVGFEGaussianBlurElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEGaussianBlurElement &SVGFEGaussianBlurElement::operator =(const SVGFEGaussianBlurElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(SVGFEGaussianBlurElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEGaussianBlurElement::~SVGFEGaussianBlurElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEGaussianBlurElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedNumber SVGFEGaussianBlurElement::stdDeviationX() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->stdDeviationX()); -} - -SVGAnimatedNumber SVGFEGaussianBlurElement::stdDeviationY() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->stdDeviationY()); -} - -void SVGFEGaussianBlurElement::setStdDeviation(float stdDeviationX, float stdDeviationY) -{ - if(impl) - impl->setStdDeviation(stdDeviationX, stdDeviationY); -} diff --git a/ksvg/dom/SVGFEGaussianBlurElement.cpp b/ksvg/dom/SVGFEGaussianBlurElement.cpp new file mode 100644 index 00000000..b3b9d9f7 --- /dev/null +++ b/ksvg/dom/SVGFEGaussianBlurElement.cpp @@ -0,0 +1,92 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEGaussianBlurElement.h" +#include "SVGFEGaussianBlurElementImpl.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedNumber.h" + +using namespace KSVG; + +SVGFEGaussianBlurElement::SVGFEGaussianBlurElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const SVGFEGaussianBlurElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEGaussianBlurElement &SVGFEGaussianBlurElement::operator =(const SVGFEGaussianBlurElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(SVGFEGaussianBlurElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEGaussianBlurElement::~SVGFEGaussianBlurElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEGaussianBlurElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedNumber SVGFEGaussianBlurElement::stdDeviationX() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->stdDeviationX()); +} + +SVGAnimatedNumber SVGFEGaussianBlurElement::stdDeviationY() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->stdDeviationY()); +} + +void SVGFEGaussianBlurElement::setStdDeviation(float stdDeviationX, float stdDeviationY) +{ + if(impl) + impl->setStdDeviation(stdDeviationX, stdDeviationY); +} diff --git a/ksvg/dom/SVGFEImageElement.cc b/ksvg/dom/SVGFEImageElement.cc deleted file mode 100644 index d0708306..00000000 --- a/ksvg/dom/SVGFEImageElement.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEImageElement.h" -#include "SVGFEImageElementImpl.h" - -using namespace KSVG; - -SVGFEImageElement::SVGFEImageElement() : SVGElement(), SVGURIReference(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEImageElement::SVGFEImageElement(const SVGFEImageElement &other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEImageElement &SVGFEImageElement::operator =(const SVGFEImageElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEImageElement::SVGFEImageElement(SVGFEImageElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEImageElement::~SVGFEImageElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFEImageElement.cpp b/ksvg/dom/SVGFEImageElement.cpp new file mode 100644 index 00000000..d0708306 --- /dev/null +++ b/ksvg/dom/SVGFEImageElement.cpp @@ -0,0 +1,70 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEImageElement.h" +#include "SVGFEImageElementImpl.h" + +using namespace KSVG; + +SVGFEImageElement::SVGFEImageElement() : SVGElement(), SVGURIReference(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEImageElement::SVGFEImageElement(const SVGFEImageElement &other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEImageElement &SVGFEImageElement::operator =(const SVGFEImageElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEImageElement::SVGFEImageElement(SVGFEImageElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEImageElement::~SVGFEImageElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFEMergeElement.cc b/ksvg/dom/SVGFEMergeElement.cc deleted file mode 100644 index 7398bf9b..00000000 --- a/ksvg/dom/SVGFEMergeElement.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEMergeElement.h" -#include "SVGFEMergeElementImpl.h" - -using namespace KSVG; - -SVGFEMergeElement::SVGFEMergeElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEMergeElement::SVGFEMergeElement(const SVGFEMergeElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEMergeElement &SVGFEMergeElement::operator =(const SVGFEMergeElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEMergeElement::SVGFEMergeElement(SVGFEMergeElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEMergeElement::~SVGFEMergeElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFEMergeElement.cpp b/ksvg/dom/SVGFEMergeElement.cpp new file mode 100644 index 00000000..7398bf9b --- /dev/null +++ b/ksvg/dom/SVGFEMergeElement.cpp @@ -0,0 +1,66 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEMergeElement.h" +#include "SVGFEMergeElementImpl.h" + +using namespace KSVG; + +SVGFEMergeElement::SVGFEMergeElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEMergeElement::SVGFEMergeElement(const SVGFEMergeElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEMergeElement &SVGFEMergeElement::operator =(const SVGFEMergeElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEMergeElement::SVGFEMergeElement(SVGFEMergeElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEMergeElement::~SVGFEMergeElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFEMergeNodeElement.cc b/ksvg/dom/SVGFEMergeNodeElement.cc deleted file mode 100644 index 65d6b18d..00000000 --- a/ksvg/dom/SVGFEMergeNodeElement.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEMergeNodeElement.h" -#include "SVGFEMergeNodeElementImpl.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGFEMergeNodeElement::SVGFEMergeNodeElement() : SVGElement() -{ - impl = 0; -} - -SVGFEMergeNodeElement::SVGFEMergeNodeElement(const SVGFEMergeNodeElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFEMergeNodeElement &SVGFEMergeNodeElement::operator =(const SVGFEMergeNodeElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEMergeNodeElement::SVGFEMergeNodeElement(SVGFEMergeNodeElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEMergeNodeElement::~SVGFEMergeNodeElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEMergeNodeElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} diff --git a/ksvg/dom/SVGFEMergeNodeElement.cpp b/ksvg/dom/SVGFEMergeNodeElement.cpp new file mode 100644 index 00000000..65d6b18d --- /dev/null +++ b/ksvg/dom/SVGFEMergeNodeElement.cpp @@ -0,0 +1,72 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEMergeNodeElement.h" +#include "SVGFEMergeNodeElementImpl.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGFEMergeNodeElement::SVGFEMergeNodeElement() : SVGElement() +{ + impl = 0; +} + +SVGFEMergeNodeElement::SVGFEMergeNodeElement(const SVGFEMergeNodeElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFEMergeNodeElement &SVGFEMergeNodeElement::operator =(const SVGFEMergeNodeElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEMergeNodeElement::SVGFEMergeNodeElement(SVGFEMergeNodeElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEMergeNodeElement::~SVGFEMergeNodeElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEMergeNodeElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} diff --git a/ksvg/dom/SVGFEMorphologyElement.cc b/ksvg/dom/SVGFEMorphologyElement.cc deleted file mode 100644 index e6f2543a..00000000 --- a/ksvg/dom/SVGFEMorphologyElement.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEMorphologyElement.h" -#include "SVGFEMorphologyElementImpl.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGFEMorphologyElement::SVGFEMorphologyElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEMorphologyElement::SVGFEMorphologyElement(const SVGFEMorphologyElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEMorphologyElement &SVGFEMorphologyElement::operator =(const SVGFEMorphologyElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEMorphologyElement::SVGFEMorphologyElement(SVGFEMorphologyElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEMorphologyElement::~SVGFEMorphologyElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEMorphologyElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedEnumeration SVGFEMorphologyElement::Operator() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->Operator()); -} - -SVGAnimatedLength SVGFEMorphologyElement::radiusX() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->radiusX()); -} - -SVGAnimatedLength SVGFEMorphologyElement::radiusY() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->radiusY()); -} diff --git a/ksvg/dom/SVGFEMorphologyElement.cpp b/ksvg/dom/SVGFEMorphologyElement.cpp new file mode 100644 index 00000000..e6f2543a --- /dev/null +++ b/ksvg/dom/SVGFEMorphologyElement.cpp @@ -0,0 +1,93 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEMorphologyElement.h" +#include "SVGFEMorphologyElementImpl.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGFEMorphologyElement::SVGFEMorphologyElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEMorphologyElement::SVGFEMorphologyElement(const SVGFEMorphologyElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEMorphologyElement &SVGFEMorphologyElement::operator =(const SVGFEMorphologyElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEMorphologyElement::SVGFEMorphologyElement(SVGFEMorphologyElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEMorphologyElement::~SVGFEMorphologyElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEMorphologyElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedEnumeration SVGFEMorphologyElement::Operator() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->Operator()); +} + +SVGAnimatedLength SVGFEMorphologyElement::radiusX() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->radiusX()); +} + +SVGAnimatedLength SVGFEMorphologyElement::radiusY() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->radiusY()); +} diff --git a/ksvg/dom/SVGFEOffsetElement.cc b/ksvg/dom/SVGFEOffsetElement.cc deleted file mode 100644 index bd9a94fd..00000000 --- a/ksvg/dom/SVGFEOffsetElement.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEOffsetElement.h" -#include "SVGFEOffsetElementImpl.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGFEOffsetElement::SVGFEOffsetElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFEOffsetElement::SVGFEOffsetElement(const SVGFEOffsetElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFEOffsetElement &SVGFEOffsetElement::operator =(const SVGFEOffsetElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEOffsetElement::SVGFEOffsetElement(SVGFEOffsetElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEOffsetElement::~SVGFEOffsetElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFEOffsetElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedNumber SVGFEOffsetElement::dx() const -{ - if(!impl) return SVGAnimatedNumber(0); // FIXME - return SVGAnimatedNumber(impl->dx()); -} - -SVGAnimatedNumber SVGFEOffsetElement::dy() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->dy()); -} diff --git a/ksvg/dom/SVGFEOffsetElement.cpp b/ksvg/dom/SVGFEOffsetElement.cpp new file mode 100644 index 00000000..bd9a94fd --- /dev/null +++ b/ksvg/dom/SVGFEOffsetElement.cpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEOffsetElement.h" +#include "SVGFEOffsetElementImpl.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGFEOffsetElement::SVGFEOffsetElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFEOffsetElement::SVGFEOffsetElement(const SVGFEOffsetElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFEOffsetElement &SVGFEOffsetElement::operator =(const SVGFEOffsetElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEOffsetElement::SVGFEOffsetElement(SVGFEOffsetElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEOffsetElement::~SVGFEOffsetElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFEOffsetElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedNumber SVGFEOffsetElement::dx() const +{ + if(!impl) return SVGAnimatedNumber(0); // FIXME + return SVGAnimatedNumber(impl->dx()); +} + +SVGAnimatedNumber SVGFEOffsetElement::dy() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->dy()); +} diff --git a/ksvg/dom/SVGFEPointLightElement.cc b/ksvg/dom/SVGFEPointLightElement.cc deleted file mode 100644 index 99028920..00000000 --- a/ksvg/dom/SVGFEPointLightElement.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEPointLightElement.h" -#include "SVGFEPointLightElementImpl.h" -#include "SVGAnimatedNumber.h" - -using namespace KSVG; - -SVGFEPointLightElement::SVGFEPointLightElement() : SVGElement() -{ - impl = 0; -} - -SVGFEPointLightElement::SVGFEPointLightElement(const SVGFEPointLightElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFEPointLightElement &SVGFEPointLightElement::operator =(const SVGFEPointLightElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFEPointLightElement::SVGFEPointLightElement(SVGFEPointLightElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFEPointLightElement::~SVGFEPointLightElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedNumber SVGFEPointLightElement::x() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->x()); -} - -SVGAnimatedNumber SVGFEPointLightElement::y() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->y()); -} - -SVGAnimatedNumber SVGFEPointLightElement::z() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->z()); -} diff --git a/ksvg/dom/SVGFEPointLightElement.cpp b/ksvg/dom/SVGFEPointLightElement.cpp new file mode 100644 index 00000000..99028920 --- /dev/null +++ b/ksvg/dom/SVGFEPointLightElement.cpp @@ -0,0 +1,84 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEPointLightElement.h" +#include "SVGFEPointLightElementImpl.h" +#include "SVGAnimatedNumber.h" + +using namespace KSVG; + +SVGFEPointLightElement::SVGFEPointLightElement() : SVGElement() +{ + impl = 0; +} + +SVGFEPointLightElement::SVGFEPointLightElement(const SVGFEPointLightElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFEPointLightElement &SVGFEPointLightElement::operator =(const SVGFEPointLightElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFEPointLightElement::SVGFEPointLightElement(SVGFEPointLightElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFEPointLightElement::~SVGFEPointLightElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedNumber SVGFEPointLightElement::x() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->x()); +} + +SVGAnimatedNumber SVGFEPointLightElement::y() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->y()); +} + +SVGAnimatedNumber SVGFEPointLightElement::z() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->z()); +} diff --git a/ksvg/dom/SVGFESpecularLightingElement.cc b/ksvg/dom/SVGFESpecularLightingElement.cc deleted file mode 100644 index cd4785dc..00000000 --- a/ksvg/dom/SVGFESpecularLightingElement.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFESpecularLightingElement.h" -#include "SVGFESpecularLightingElementImpl.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGFESpecularLightingElement::SVGFESpecularLightingElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFESpecularLightingElement::SVGFESpecularLightingElement(const SVGFESpecularLightingElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFESpecularLightingElement &SVGFESpecularLightingElement::operator =(const SVGFESpecularLightingElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFESpecularLightingElement::SVGFESpecularLightingElement(SVGFESpecularLightingElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFESpecularLightingElement::~SVGFESpecularLightingElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFESpecularLightingElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} - -SVGAnimatedNumber SVGFESpecularLightingElement::surfaceScale() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->surfaceScale()); -} - -SVGAnimatedNumber SVGFESpecularLightingElement::specularConstant() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->specularConstant()); -} - -SVGAnimatedNumber SVGFESpecularLightingElement::specularExponent() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->specularExponent()); -} diff --git a/ksvg/dom/SVGFESpecularLightingElement.cpp b/ksvg/dom/SVGFESpecularLightingElement.cpp new file mode 100644 index 00000000..cd4785dc --- /dev/null +++ b/ksvg/dom/SVGFESpecularLightingElement.cpp @@ -0,0 +1,92 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFESpecularLightingElement.h" +#include "SVGFESpecularLightingElementImpl.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGFESpecularLightingElement::SVGFESpecularLightingElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFESpecularLightingElement::SVGFESpecularLightingElement(const SVGFESpecularLightingElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFESpecularLightingElement &SVGFESpecularLightingElement::operator =(const SVGFESpecularLightingElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFESpecularLightingElement::SVGFESpecularLightingElement(SVGFESpecularLightingElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFESpecularLightingElement::~SVGFESpecularLightingElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFESpecularLightingElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} + +SVGAnimatedNumber SVGFESpecularLightingElement::surfaceScale() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->surfaceScale()); +} + +SVGAnimatedNumber SVGFESpecularLightingElement::specularConstant() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->specularConstant()); +} + +SVGAnimatedNumber SVGFESpecularLightingElement::specularExponent() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->specularExponent()); +} diff --git a/ksvg/dom/SVGFESpotLightElement.cc b/ksvg/dom/SVGFESpotLightElement.cc deleted file mode 100644 index 15353880..00000000 --- a/ksvg/dom/SVGFESpotLightElement.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFESpotLightElement.h" -#include "SVGFESpotLightElementImpl.h" -#include "SVGAnimatedNumber.h" - -using namespace KSVG; - -SVGFESpotLightElement::SVGFESpotLightElement() : SVGElement() -{ - impl = 0; -} - -SVGFESpotLightElement::SVGFESpotLightElement(const SVGFESpotLightElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFESpotLightElement &SVGFESpotLightElement::operator =(const SVGFESpotLightElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFESpotLightElement::SVGFESpotLightElement(SVGFESpotLightElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFESpotLightElement::~SVGFESpotLightElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedNumber SVGFESpotLightElement::x() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->x()); -} - -SVGAnimatedNumber SVGFESpotLightElement::y() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->y()); -} - -SVGAnimatedNumber SVGFESpotLightElement::z() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->z()); -} - -SVGAnimatedNumber SVGFESpotLightElement::pointsAtX() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->pointsAtX()); -} - -SVGAnimatedNumber SVGFESpotLightElement::pointsAtY() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->pointsAtY()); -} - -SVGAnimatedNumber SVGFESpotLightElement::pointsAtZ() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->pointsAtZ()); -} - -SVGAnimatedNumber SVGFESpotLightElement::specularExponent() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->specularExponent()); -} - -SVGAnimatedNumber SVGFESpotLightElement::limitingConeAngle() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->limitingConeAngle()); -} diff --git a/ksvg/dom/SVGFESpotLightElement.cpp b/ksvg/dom/SVGFESpotLightElement.cpp new file mode 100644 index 00000000..15353880 --- /dev/null +++ b/ksvg/dom/SVGFESpotLightElement.cpp @@ -0,0 +1,114 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFESpotLightElement.h" +#include "SVGFESpotLightElementImpl.h" +#include "SVGAnimatedNumber.h" + +using namespace KSVG; + +SVGFESpotLightElement::SVGFESpotLightElement() : SVGElement() +{ + impl = 0; +} + +SVGFESpotLightElement::SVGFESpotLightElement(const SVGFESpotLightElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFESpotLightElement &SVGFESpotLightElement::operator =(const SVGFESpotLightElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFESpotLightElement::SVGFESpotLightElement(SVGFESpotLightElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFESpotLightElement::~SVGFESpotLightElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedNumber SVGFESpotLightElement::x() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->x()); +} + +SVGAnimatedNumber SVGFESpotLightElement::y() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->y()); +} + +SVGAnimatedNumber SVGFESpotLightElement::z() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->z()); +} + +SVGAnimatedNumber SVGFESpotLightElement::pointsAtX() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->pointsAtX()); +} + +SVGAnimatedNumber SVGFESpotLightElement::pointsAtY() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->pointsAtY()); +} + +SVGAnimatedNumber SVGFESpotLightElement::pointsAtZ() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->pointsAtZ()); +} + +SVGAnimatedNumber SVGFESpotLightElement::specularExponent() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->specularExponent()); +} + +SVGAnimatedNumber SVGFESpotLightElement::limitingConeAngle() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->limitingConeAngle()); +} diff --git a/ksvg/dom/SVGFETileElement.cc b/ksvg/dom/SVGFETileElement.cc deleted file mode 100644 index d88a4f2a..00000000 --- a/ksvg/dom/SVGFETileElement.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFETileElement.h" -#include "SVGFETileElementImpl.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGFETileElement::SVGFETileElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFETileElement::SVGFETileElement(const SVGFETileElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFETileElement &SVGFETileElement::operator =(const SVGFETileElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFETileElement::SVGFETileElement(SVGFETileElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFETileElement::~SVGFETileElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedString SVGFETileElement::in1() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->in1()); -} diff --git a/ksvg/dom/SVGFETileElement.cpp b/ksvg/dom/SVGFETileElement.cpp new file mode 100644 index 00000000..d88a4f2a --- /dev/null +++ b/ksvg/dom/SVGFETileElement.cpp @@ -0,0 +1,73 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFETileElement.h" +#include "SVGFETileElementImpl.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGFETileElement::SVGFETileElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFETileElement::SVGFETileElement(const SVGFETileElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFETileElement &SVGFETileElement::operator =(const SVGFETileElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFETileElement::SVGFETileElement(SVGFETileElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFETileElement::~SVGFETileElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedString SVGFETileElement::in1() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->in1()); +} diff --git a/ksvg/dom/SVGFETurbulenceElement.cc b/ksvg/dom/SVGFETurbulenceElement.cc deleted file mode 100644 index 2f4fd5b8..00000000 --- a/ksvg/dom/SVGFETurbulenceElement.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFETurbulenceElement.h" -#include "SVGFETurbulenceElementImpl.h" -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedInteger.h" - -using namespace KSVG; - -SVGFETurbulenceElement::SVGFETurbulenceElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() -{ - impl = 0; -} - -SVGFETurbulenceElement::SVGFETurbulenceElement(const SVGFETurbulenceElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) -{ - (*this) = other; -} - -SVGFETurbulenceElement &SVGFETurbulenceElement::operator =(const SVGFETurbulenceElement &other) -{ - SVGElement::operator=(other); - SVGFilterPrimitiveStandardAttributes::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFETurbulenceElement::SVGFETurbulenceElement(SVGFETurbulenceElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFETurbulenceElement::~SVGFETurbulenceElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedNumber SVGFETurbulenceElement::baseFrequencyX() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->baseFrequencyX()); -} - -SVGAnimatedNumber SVGFETurbulenceElement::baseFrequencyY() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->baseFrequencyY()); -} - -SVGAnimatedInteger SVGFETurbulenceElement::numOctaves() const -{ - if(!impl) return SVGAnimatedInteger(0); - return SVGAnimatedInteger(impl->numOctaves()); -} - -SVGAnimatedNumber SVGFETurbulenceElement::seed() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->seed()); -} - -SVGAnimatedEnumeration SVGFETurbulenceElement::stitchTiles() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->stitchTiles()); -} - -SVGAnimatedEnumeration SVGFETurbulenceElement::type() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->type()); -} diff --git a/ksvg/dom/SVGFETurbulenceElement.cpp b/ksvg/dom/SVGFETurbulenceElement.cpp new file mode 100644 index 00000000..2f4fd5b8 --- /dev/null +++ b/ksvg/dom/SVGFETurbulenceElement.cpp @@ -0,0 +1,105 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFETurbulenceElement.h" +#include "SVGFETurbulenceElementImpl.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedInteger.h" + +using namespace KSVG; + +SVGFETurbulenceElement::SVGFETurbulenceElement() : SVGElement(), SVGFilterPrimitiveStandardAttributes() +{ + impl = 0; +} + +SVGFETurbulenceElement::SVGFETurbulenceElement(const SVGFETurbulenceElement &other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other), impl(0) +{ + (*this) = other; +} + +SVGFETurbulenceElement &SVGFETurbulenceElement::operator =(const SVGFETurbulenceElement &other) +{ + SVGElement::operator=(other); + SVGFilterPrimitiveStandardAttributes::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFETurbulenceElement::SVGFETurbulenceElement(SVGFETurbulenceElementImpl *other) : SVGElement(other), SVGFilterPrimitiveStandardAttributes(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFETurbulenceElement::~SVGFETurbulenceElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedNumber SVGFETurbulenceElement::baseFrequencyX() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->baseFrequencyX()); +} + +SVGAnimatedNumber SVGFETurbulenceElement::baseFrequencyY() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->baseFrequencyY()); +} + +SVGAnimatedInteger SVGFETurbulenceElement::numOctaves() const +{ + if(!impl) return SVGAnimatedInteger(0); + return SVGAnimatedInteger(impl->numOctaves()); +} + +SVGAnimatedNumber SVGFETurbulenceElement::seed() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->seed()); +} + +SVGAnimatedEnumeration SVGFETurbulenceElement::stitchTiles() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->stitchTiles()); +} + +SVGAnimatedEnumeration SVGFETurbulenceElement::type() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->type()); +} diff --git a/ksvg/dom/SVGFilterElement.cc b/ksvg/dom/SVGFilterElement.cc deleted file mode 100644 index f505252e..00000000 --- a/ksvg/dom/SVGFilterElement.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFilterElement.h" -#include "SVGFilterElementImpl.h" -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedInteger.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGFilterElement::SVGFilterElement() : SVGElement(), SVGURIReference(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGUnitTypes() -{ - impl = 0; -} - -SVGFilterElement::SVGFilterElement(const SVGFilterElement &other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes(), impl(0) -{ - (*this) = other; -} - -SVGFilterElement &SVGFilterElement::operator =(const SVGFilterElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFilterElement::SVGFilterElement(SVGFilterElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes() -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFilterElement::~SVGFilterElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedEnumeration SVGFilterElement::filterUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->filterUnits()); -} - -SVGAnimatedEnumeration SVGFilterElement::primitiveUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->primitiveUnits()); -} - -SVGAnimatedLength SVGFilterElement::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGFilterElement::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGFilterElement::width() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGFilterElement::height() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} - -SVGAnimatedInteger SVGFilterElement::filterResX() const -{ - if(!impl) return SVGAnimatedInteger(0); - return SVGAnimatedInteger(impl->filterResX()); -} - -SVGAnimatedInteger SVGFilterElement::filterResY() const -{ - if(!impl) return SVGAnimatedInteger(0); - return SVGAnimatedInteger(impl->filterResY()); -} - -void SVGFilterElement::setFilterRes(unsigned long filterResX, unsigned long filterResY) -{ - if(impl) - impl->setFilterRes(filterResX, filterResY); -} diff --git a/ksvg/dom/SVGFilterElement.cpp b/ksvg/dom/SVGFilterElement.cpp new file mode 100644 index 00000000..f505252e --- /dev/null +++ b/ksvg/dom/SVGFilterElement.cpp @@ -0,0 +1,126 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFilterElement.h" +#include "SVGFilterElementImpl.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedInteger.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGFilterElement::SVGFilterElement() : SVGElement(), SVGURIReference(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGUnitTypes() +{ + impl = 0; +} + +SVGFilterElement::SVGFilterElement(const SVGFilterElement &other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes(), impl(0) +{ + (*this) = other; +} + +SVGFilterElement &SVGFilterElement::operator =(const SVGFilterElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFilterElement::SVGFilterElement(SVGFilterElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes() +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFilterElement::~SVGFilterElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedEnumeration SVGFilterElement::filterUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->filterUnits()); +} + +SVGAnimatedEnumeration SVGFilterElement::primitiveUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->primitiveUnits()); +} + +SVGAnimatedLength SVGFilterElement::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGFilterElement::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGFilterElement::width() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGFilterElement::height() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} + +SVGAnimatedInteger SVGFilterElement::filterResX() const +{ + if(!impl) return SVGAnimatedInteger(0); + return SVGAnimatedInteger(impl->filterResX()); +} + +SVGAnimatedInteger SVGFilterElement::filterResY() const +{ + if(!impl) return SVGAnimatedInteger(0); + return SVGAnimatedInteger(impl->filterResY()); +} + +void SVGFilterElement::setFilterRes(unsigned long filterResX, unsigned long filterResY) +{ + if(impl) + impl->setFilterRes(filterResX, filterResY); +} diff --git a/ksvg/dom/SVGFilterPrimitiveStandardAttributes.cc b/ksvg/dom/SVGFilterPrimitiveStandardAttributes.cc deleted file mode 100644 index fd629054..00000000 --- a/ksvg/dom/SVGFilterPrimitiveStandardAttributes.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFilterPrimitiveStandardAttributes.h" -#include "SVGFilterPrimitiveStandardAttributesImpl.h" -#include "SVGAnimatedString.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes() -{ - impl = new SVGFilterPrimitiveStandardAttributesImpl(); -} - -SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const SVGFilterPrimitiveStandardAttributes &other) -{ - impl = other.impl; -} - -SVGFilterPrimitiveStandardAttributes &SVGFilterPrimitiveStandardAttributes::operator=(const SVGFilterPrimitiveStandardAttributes &other) -{ - if(impl == other.impl) - return *this; - - delete impl; - impl = other.impl; - - return *this; -} - -SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(SVGFilterPrimitiveStandardAttributesImpl *other) -{ - impl = other; -} - -SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes() -{ -} - -SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::width() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::height() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} - -SVGAnimatedString SVGFilterPrimitiveStandardAttributes::result() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->result()); -} diff --git a/ksvg/dom/SVGFilterPrimitiveStandardAttributes.cpp b/ksvg/dom/SVGFilterPrimitiveStandardAttributes.cpp new file mode 100644 index 00000000..fd629054 --- /dev/null +++ b/ksvg/dom/SVGFilterPrimitiveStandardAttributes.cpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFilterPrimitiveStandardAttributes.h" +#include "SVGFilterPrimitiveStandardAttributesImpl.h" +#include "SVGAnimatedString.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes() +{ + impl = new SVGFilterPrimitiveStandardAttributesImpl(); +} + +SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const SVGFilterPrimitiveStandardAttributes &other) +{ + impl = other.impl; +} + +SVGFilterPrimitiveStandardAttributes &SVGFilterPrimitiveStandardAttributes::operator=(const SVGFilterPrimitiveStandardAttributes &other) +{ + if(impl == other.impl) + return *this; + + delete impl; + impl = other.impl; + + return *this; +} + +SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(SVGFilterPrimitiveStandardAttributesImpl *other) +{ + impl = other; +} + +SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes() +{ +} + +SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::width() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGFilterPrimitiveStandardAttributes::height() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} + +SVGAnimatedString SVGFilterPrimitiveStandardAttributes::result() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->result()); +} diff --git a/ksvg/dom/SVGFitToViewBox.cc b/ksvg/dom/SVGFitToViewBox.cc deleted file mode 100644 index 4f54e2b4..00000000 --- a/ksvg/dom/SVGFitToViewBox.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFitToViewBox.h" -#include "SVGFitToViewBoxImpl.h" -#include "SVGAnimatedRect.h" -#include "SVGAnimatedPreserveAspectRatio.h" - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGFitToViewBox::SVGFitToViewBox() -{ - impl = 0; -} - -SVGFitToViewBox::SVGFitToViewBox(const SVGFitToViewBox &other) : impl(0) -{ - (*this) = other; -} - -SVGFitToViewBox &SVGFitToViewBox::operator=(const SVGFitToViewBox &other) -{ - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGFitToViewBox::SVGFitToViewBox(SVGFitToViewBoxImpl *other) -{ - impl = other; -} - -SVGFitToViewBox::~SVGFitToViewBox() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -SVGAnimatedRect SVGFitToViewBox::viewBox() const -{ - if(!impl) return SVGAnimatedRect(0); - return SVGAnimatedRect(impl->viewBox()); -} - -SVGAnimatedPreserveAspectRatio SVGFitToViewBox::preserveAspectRatio() const -{ - if(!impl) return SVGAnimatedPreserveAspectRatio(0); - return SVGAnimatedPreserveAspectRatio(impl->preserveAspectRatio()); -} diff --git a/ksvg/dom/SVGFitToViewBox.cpp b/ksvg/dom/SVGFitToViewBox.cpp new file mode 100644 index 00000000..4f54e2b4 --- /dev/null +++ b/ksvg/dom/SVGFitToViewBox.cpp @@ -0,0 +1,70 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFitToViewBox.h" +#include "SVGFitToViewBoxImpl.h" +#include "SVGAnimatedRect.h" +#include "SVGAnimatedPreserveAspectRatio.h" + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGFitToViewBox::SVGFitToViewBox() +{ + impl = 0; +} + +SVGFitToViewBox::SVGFitToViewBox(const SVGFitToViewBox &other) : impl(0) +{ + (*this) = other; +} + +SVGFitToViewBox &SVGFitToViewBox::operator=(const SVGFitToViewBox &other) +{ + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGFitToViewBox::SVGFitToViewBox(SVGFitToViewBoxImpl *other) +{ + impl = other; +} + +SVGFitToViewBox::~SVGFitToViewBox() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +SVGAnimatedRect SVGFitToViewBox::viewBox() const +{ + if(!impl) return SVGAnimatedRect(0); + return SVGAnimatedRect(impl->viewBox()); +} + +SVGAnimatedPreserveAspectRatio SVGFitToViewBox::preserveAspectRatio() const +{ + if(!impl) return SVGAnimatedPreserveAspectRatio(0); + return SVGAnimatedPreserveAspectRatio(impl->preserveAspectRatio()); +} diff --git a/ksvg/dom/SVGFontElement.cc b/ksvg/dom/SVGFontElement.cc deleted file mode 100644 index 30244c6f..00000000 --- a/ksvg/dom/SVGFontElement.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontElement.h" -#include "SVGFontElementImpl.h" - -using namespace KSVG; - -SVGFontElement::SVGFontElement() : SVGElement(), SVGExternalResourcesRequired(), SVGStylable() -{ - impl = 0; -} - -SVGFontElement::SVGFontElement(const SVGFontElement &other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGStylable(other), impl(0) -{ - (*this) = other; -} - -SVGFontElement &SVGFontElement::operator =(const SVGFontElement &other) -{ - SVGElement::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFontElement::SVGFontElement(SVGFontElementImpl *other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGStylable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFontElement::~SVGFontElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFontElement.cpp b/ksvg/dom/SVGFontElement.cpp new file mode 100644 index 00000000..30244c6f --- /dev/null +++ b/ksvg/dom/SVGFontElement.cpp @@ -0,0 +1,67 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontElement.h" +#include "SVGFontElementImpl.h" + +using namespace KSVG; + +SVGFontElement::SVGFontElement() : SVGElement(), SVGExternalResourcesRequired(), SVGStylable() +{ + impl = 0; +} + +SVGFontElement::SVGFontElement(const SVGFontElement &other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGStylable(other), impl(0) +{ + (*this) = other; +} + +SVGFontElement &SVGFontElement::operator =(const SVGFontElement &other) +{ + SVGElement::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFontElement::SVGFontElement(SVGFontElementImpl *other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGStylable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFontElement::~SVGFontElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFontFaceElement.cc b/ksvg/dom/SVGFontFaceElement.cc deleted file mode 100644 index f5c7a12a..00000000 --- a/ksvg/dom/SVGFontFaceElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceElement.h" -#include "SVGFontFaceElementImpl.h" - -using namespace KSVG; - -SVGFontFaceElement::SVGFontFaceElement() : SVGElement() -{ - impl = 0; -} - -SVGFontFaceElement::SVGFontFaceElement(const SVGFontFaceElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFontFaceElement &SVGFontFaceElement::operator =(const SVGFontFaceElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFontFaceElement::SVGFontFaceElement(SVGFontFaceElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFontFaceElement::~SVGFontFaceElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFontFaceElement.cpp b/ksvg/dom/SVGFontFaceElement.cpp new file mode 100644 index 00000000..f5c7a12a --- /dev/null +++ b/ksvg/dom/SVGFontFaceElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceElement.h" +#include "SVGFontFaceElementImpl.h" + +using namespace KSVG; + +SVGFontFaceElement::SVGFontFaceElement() : SVGElement() +{ + impl = 0; +} + +SVGFontFaceElement::SVGFontFaceElement(const SVGFontFaceElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFontFaceElement &SVGFontFaceElement::operator =(const SVGFontFaceElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFontFaceElement::SVGFontFaceElement(SVGFontFaceElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFontFaceElement::~SVGFontFaceElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFontFaceFormatElement.cc b/ksvg/dom/SVGFontFaceFormatElement.cc deleted file mode 100644 index ede5a248..00000000 --- a/ksvg/dom/SVGFontFaceFormatElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceFormatElement.h" -#include "SVGFontFaceFormatElementImpl.h" - -using namespace KSVG; - -SVGFontFaceFormatElement::SVGFontFaceFormatElement() : SVGElement() -{ - impl = 0; -} - -SVGFontFaceFormatElement::SVGFontFaceFormatElement(const SVGFontFaceFormatElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFontFaceFormatElement &SVGFontFaceFormatElement::operator =(const SVGFontFaceFormatElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFontFaceFormatElement::SVGFontFaceFormatElement(SVGFontFaceFormatElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFontFaceFormatElement::~SVGFontFaceFormatElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFontFaceFormatElement.cpp b/ksvg/dom/SVGFontFaceFormatElement.cpp new file mode 100644 index 00000000..ede5a248 --- /dev/null +++ b/ksvg/dom/SVGFontFaceFormatElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceFormatElement.h" +#include "SVGFontFaceFormatElementImpl.h" + +using namespace KSVG; + +SVGFontFaceFormatElement::SVGFontFaceFormatElement() : SVGElement() +{ + impl = 0; +} + +SVGFontFaceFormatElement::SVGFontFaceFormatElement(const SVGFontFaceFormatElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFontFaceFormatElement &SVGFontFaceFormatElement::operator =(const SVGFontFaceFormatElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFontFaceFormatElement::SVGFontFaceFormatElement(SVGFontFaceFormatElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFontFaceFormatElement::~SVGFontFaceFormatElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFontFaceNameElement.cc b/ksvg/dom/SVGFontFaceNameElement.cc deleted file mode 100644 index ce2413fd..00000000 --- a/ksvg/dom/SVGFontFaceNameElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceNameElement.h" -#include "SVGFontFaceNameElementImpl.h" - -using namespace KSVG; - -SVGFontFaceNameElement::SVGFontFaceNameElement() : SVGElement() -{ - impl = 0; -} - -SVGFontFaceNameElement::SVGFontFaceNameElement(const SVGFontFaceNameElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFontFaceNameElement &SVGFontFaceNameElement::operator =(const SVGFontFaceNameElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFontFaceNameElement::SVGFontFaceNameElement(SVGFontFaceNameElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFontFaceNameElement::~SVGFontFaceNameElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFontFaceNameElement.cpp b/ksvg/dom/SVGFontFaceNameElement.cpp new file mode 100644 index 00000000..ce2413fd --- /dev/null +++ b/ksvg/dom/SVGFontFaceNameElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceNameElement.h" +#include "SVGFontFaceNameElementImpl.h" + +using namespace KSVG; + +SVGFontFaceNameElement::SVGFontFaceNameElement() : SVGElement() +{ + impl = 0; +} + +SVGFontFaceNameElement::SVGFontFaceNameElement(const SVGFontFaceNameElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFontFaceNameElement &SVGFontFaceNameElement::operator =(const SVGFontFaceNameElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFontFaceNameElement::SVGFontFaceNameElement(SVGFontFaceNameElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFontFaceNameElement::~SVGFontFaceNameElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFontFaceSrcElement.cc b/ksvg/dom/SVGFontFaceSrcElement.cc deleted file mode 100644 index c34e7734..00000000 --- a/ksvg/dom/SVGFontFaceSrcElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceSrcElement.h" -#include "SVGFontFaceSrcElementImpl.h" - -using namespace KSVG; - -SVGFontFaceSrcElement::SVGFontFaceSrcElement() : SVGElement() -{ - impl = 0; -} - -SVGFontFaceSrcElement::SVGFontFaceSrcElement(const SVGFontFaceSrcElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFontFaceSrcElement &SVGFontFaceSrcElement::operator =(const SVGFontFaceSrcElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFontFaceSrcElement::SVGFontFaceSrcElement(SVGFontFaceSrcElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFontFaceSrcElement::~SVGFontFaceSrcElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFontFaceSrcElement.cpp b/ksvg/dom/SVGFontFaceSrcElement.cpp new file mode 100644 index 00000000..c34e7734 --- /dev/null +++ b/ksvg/dom/SVGFontFaceSrcElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceSrcElement.h" +#include "SVGFontFaceSrcElementImpl.h" + +using namespace KSVG; + +SVGFontFaceSrcElement::SVGFontFaceSrcElement() : SVGElement() +{ + impl = 0; +} + +SVGFontFaceSrcElement::SVGFontFaceSrcElement(const SVGFontFaceSrcElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFontFaceSrcElement &SVGFontFaceSrcElement::operator =(const SVGFontFaceSrcElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFontFaceSrcElement::SVGFontFaceSrcElement(SVGFontFaceSrcElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFontFaceSrcElement::~SVGFontFaceSrcElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGFontFaceUriElement.cc b/ksvg/dom/SVGFontFaceUriElement.cc deleted file mode 100644 index 98a13d4d..00000000 --- a/ksvg/dom/SVGFontFaceUriElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceUriElement.h" -#include "SVGFontFaceUriElementImpl.h" - -using namespace KSVG; - -SVGFontFaceUriElement::SVGFontFaceUriElement() : SVGElement() -{ - impl = 0; -} - -SVGFontFaceUriElement::SVGFontFaceUriElement(const SVGFontFaceUriElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGFontFaceUriElement &SVGFontFaceUriElement::operator =(const SVGFontFaceUriElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGFontFaceUriElement::SVGFontFaceUriElement(SVGFontFaceUriElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGFontFaceUriElement::~SVGFontFaceUriElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGFontFaceUriElement.cpp b/ksvg/dom/SVGFontFaceUriElement.cpp new file mode 100644 index 00000000..98a13d4d --- /dev/null +++ b/ksvg/dom/SVGFontFaceUriElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceUriElement.h" +#include "SVGFontFaceUriElementImpl.h" + +using namespace KSVG; + +SVGFontFaceUriElement::SVGFontFaceUriElement() : SVGElement() +{ + impl = 0; +} + +SVGFontFaceUriElement::SVGFontFaceUriElement(const SVGFontFaceUriElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGFontFaceUriElement &SVGFontFaceUriElement::operator =(const SVGFontFaceUriElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGFontFaceUriElement::SVGFontFaceUriElement(SVGFontFaceUriElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGFontFaceUriElement::~SVGFontFaceUriElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGForeignObjectElement.cc b/ksvg/dom/SVGForeignObjectElement.cc deleted file mode 100644 index cd7ffad5..00000000 --- a/ksvg/dom/SVGForeignObjectElement.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGForeignObjectElement.h" -#include "SVGForeignObjectElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGForeignObjectElement::SVGForeignObjectElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGForeignObjectElement::SVGForeignObjectElement(const SVGForeignObjectElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - (*this) = other; -} - -SVGForeignObjectElement &SVGForeignObjectElement::operator =(const SVGForeignObjectElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGForeignObjectElement::SVGForeignObjectElement(SVGForeignObjectElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGForeignObjectElement::~SVGForeignObjectElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGForeignObjectElement::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGForeignObjectElement::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGForeignObjectElement::width() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGForeignObjectElement::height() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} diff --git a/ksvg/dom/SVGForeignObjectElement.cpp b/ksvg/dom/SVGForeignObjectElement.cpp new file mode 100644 index 00000000..cd7ffad5 --- /dev/null +++ b/ksvg/dom/SVGForeignObjectElement.cpp @@ -0,0 +1,95 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGForeignObjectElement.h" +#include "SVGForeignObjectElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGForeignObjectElement::SVGForeignObjectElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGForeignObjectElement::SVGForeignObjectElement(const SVGForeignObjectElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + (*this) = other; +} + +SVGForeignObjectElement &SVGForeignObjectElement::operator =(const SVGForeignObjectElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGForeignObjectElement::SVGForeignObjectElement(SVGForeignObjectElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGForeignObjectElement::~SVGForeignObjectElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGForeignObjectElement::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGForeignObjectElement::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGForeignObjectElement::width() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGForeignObjectElement::height() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} diff --git a/ksvg/dom/SVGGElement.cc b/ksvg/dom/SVGGElement.cc deleted file mode 100644 index 6a6cfb96..00000000 --- a/ksvg/dom/SVGGElement.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGElement.h" -#include "SVGGElementImpl.h" - -using namespace KSVG; - -SVGGElement::SVGGElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGGElement::SVGGElement(const SVGGElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) -{ - (*this) = other; -} - -SVGGElement &SVGGElement::operator =(const SVGGElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGGElement::SVGGElement(SVGGElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGGElement::~SVGGElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGGElement.cpp b/ksvg/dom/SVGGElement.cpp new file mode 100644 index 00000000..6a6cfb96 --- /dev/null +++ b/ksvg/dom/SVGGElement.cpp @@ -0,0 +1,70 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGElement.h" +#include "SVGGElementImpl.h" + +using namespace KSVG; + +SVGGElement::SVGGElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGGElement::SVGGElement(const SVGGElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) +{ + (*this) = other; +} + +SVGGElement &SVGGElement::operator =(const SVGGElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGGElement::SVGGElement(SVGGElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGGElement::~SVGGElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGGlyphElement.cc b/ksvg/dom/SVGGlyphElement.cc deleted file mode 100644 index 7f6f4ae4..00000000 --- a/ksvg/dom/SVGGlyphElement.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGlyphElement.h" -#include "SVGGlyphElementImpl.h" - -using namespace KSVG; - -SVGGlyphElement::SVGGlyphElement() : SVGElement(), SVGStylable() -{ - impl = 0; -} - -SVGGlyphElement::SVGGlyphElement(const SVGGlyphElement &other) : SVGElement(other), SVGStylable(other), impl(0) -{ - (*this) = other; -} - -SVGGlyphElement &SVGGlyphElement::operator =(const SVGGlyphElement &other) -{ - SVGElement::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGGlyphElement::SVGGlyphElement(SVGGlyphElementImpl *other) : SVGElement(other), SVGStylable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGGlyphElement::~SVGGlyphElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGGlyphElement.cpp b/ksvg/dom/SVGGlyphElement.cpp new file mode 100644 index 00000000..7f6f4ae4 --- /dev/null +++ b/ksvg/dom/SVGGlyphElement.cpp @@ -0,0 +1,66 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGlyphElement.h" +#include "SVGGlyphElementImpl.h" + +using namespace KSVG; + +SVGGlyphElement::SVGGlyphElement() : SVGElement(), SVGStylable() +{ + impl = 0; +} + +SVGGlyphElement::SVGGlyphElement(const SVGGlyphElement &other) : SVGElement(other), SVGStylable(other), impl(0) +{ + (*this) = other; +} + +SVGGlyphElement &SVGGlyphElement::operator =(const SVGGlyphElement &other) +{ + SVGElement::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGGlyphElement::SVGGlyphElement(SVGGlyphElementImpl *other) : SVGElement(other), SVGStylable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGGlyphElement::~SVGGlyphElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGGlyphRefElement.cc b/ksvg/dom/SVGGlyphRefElement.cc deleted file mode 100644 index 5b1f8deb..00000000 --- a/ksvg/dom/SVGGlyphRefElement.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGlyphRefElement.h" -#include "SVGGlyphRefElementImpl.h" - -using namespace KSVG; - -SVGGlyphRefElement::SVGGlyphRefElement() : SVGElement(), SVGURIReference(), SVGStylable() -{ - impl = 0; -} - -SVGGlyphRefElement::SVGGlyphRefElement(const SVGGlyphRefElement &other) : SVGElement(other), SVGURIReference(other), SVGStylable(other), impl(0) -{ - (*this) = other; -} - -SVGGlyphRefElement &SVGGlyphRefElement::operator =(const SVGGlyphRefElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGGlyphRefElement::SVGGlyphRefElement(SVGGlyphRefElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGStylable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGGlyphRefElement::~SVGGlyphRefElement() -{ - if(impl) - impl->deref(); -} - -DOM::DOMString SVGGlyphRefElement::format() -{ - if(!impl) return DOM::DOMString(); - return impl->format(); -} - -DOM::DOMString SVGGlyphRefElement::glyphRef() -{ - if(!impl) return DOM::DOMString(); - return impl->glyphRef(); -} diff --git a/ksvg/dom/SVGGlyphRefElement.cpp b/ksvg/dom/SVGGlyphRefElement.cpp new file mode 100644 index 00000000..5b1f8deb --- /dev/null +++ b/ksvg/dom/SVGGlyphRefElement.cpp @@ -0,0 +1,79 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGlyphRefElement.h" +#include "SVGGlyphRefElementImpl.h" + +using namespace KSVG; + +SVGGlyphRefElement::SVGGlyphRefElement() : SVGElement(), SVGURIReference(), SVGStylable() +{ + impl = 0; +} + +SVGGlyphRefElement::SVGGlyphRefElement(const SVGGlyphRefElement &other) : SVGElement(other), SVGURIReference(other), SVGStylable(other), impl(0) +{ + (*this) = other; +} + +SVGGlyphRefElement &SVGGlyphRefElement::operator =(const SVGGlyphRefElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGGlyphRefElement::SVGGlyphRefElement(SVGGlyphRefElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGStylable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGGlyphRefElement::~SVGGlyphRefElement() +{ + if(impl) + impl->deref(); +} + +DOM::DOMString SVGGlyphRefElement::format() +{ + if(!impl) return DOM::DOMString(); + return impl->format(); +} + +DOM::DOMString SVGGlyphRefElement::glyphRef() +{ + if(!impl) return DOM::DOMString(); + return impl->glyphRef(); +} diff --git a/ksvg/dom/SVGGradientElement.cc b/ksvg/dom/SVGGradientElement.cc deleted file mode 100644 index 895b6d8e..00000000 --- a/ksvg/dom/SVGGradientElement.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGradientElement.h" -#include "SVGGradientElementImpl.h" -#include "SVGAnimatedTransformList.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGGradientElement::SVGGradientElement() : SVGElement(), SVGURIReference(), SVGExternalResourcesRequired(), SVGStylable(), SVGUnitTypes() -{ - impl = 0; -} - -SVGGradientElement::SVGGradientElement(const SVGGradientElement &other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes(other), impl(0) -{ - (*this) = other; -} - -SVGGradientElement &SVGGradientElement::operator =(const SVGGradientElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGGradientElement::SVGGradientElement(SVGGradientElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes() -{ - impl = other; -} - -SVGGradientElement::~SVGGradientElement() -{ -} - -SVGAnimatedEnumeration SVGGradientElement::gradientUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->gradientUnits()); -} - -SVGAnimatedTransformList SVGGradientElement::gradientTransform() const -{ - if(!impl) return SVGAnimatedTransformList(0); - return SVGAnimatedTransformList(impl->gradientTransform()); -} - -SVGAnimatedEnumeration SVGGradientElement::spreadMethod() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->spreadMethod()); -} diff --git a/ksvg/dom/SVGGradientElement.cpp b/ksvg/dom/SVGGradientElement.cpp new file mode 100644 index 00000000..895b6d8e --- /dev/null +++ b/ksvg/dom/SVGGradientElement.cpp @@ -0,0 +1,78 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGradientElement.h" +#include "SVGGradientElementImpl.h" +#include "SVGAnimatedTransformList.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGGradientElement::SVGGradientElement() : SVGElement(), SVGURIReference(), SVGExternalResourcesRequired(), SVGStylable(), SVGUnitTypes() +{ + impl = 0; +} + +SVGGradientElement::SVGGradientElement(const SVGGradientElement &other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes(other), impl(0) +{ + (*this) = other; +} + +SVGGradientElement &SVGGradientElement::operator =(const SVGGradientElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGGradientElement::SVGGradientElement(SVGGradientElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes() +{ + impl = other; +} + +SVGGradientElement::~SVGGradientElement() +{ +} + +SVGAnimatedEnumeration SVGGradientElement::gradientUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->gradientUnits()); +} + +SVGAnimatedTransformList SVGGradientElement::gradientTransform() const +{ + if(!impl) return SVGAnimatedTransformList(0); + return SVGAnimatedTransformList(impl->gradientTransform()); +} + +SVGAnimatedEnumeration SVGGradientElement::spreadMethod() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->spreadMethod()); +} diff --git a/ksvg/dom/SVGHKernElement.cc b/ksvg/dom/SVGHKernElement.cc deleted file mode 100644 index ca8d32bf..00000000 --- a/ksvg/dom/SVGHKernElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGHKernElement.h" -#include "SVGHKernElementImpl.h" - -using namespace KSVG; - -SVGHKernElement::SVGHKernElement() : SVGElement() -{ - impl = 0; -} - -SVGHKernElement::SVGHKernElement(const SVGHKernElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGHKernElement &SVGHKernElement::operator =(const SVGHKernElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGHKernElement::SVGHKernElement(SVGHKernElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGHKernElement::~SVGHKernElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGHKernElement.cpp b/ksvg/dom/SVGHKernElement.cpp new file mode 100644 index 00000000..ca8d32bf --- /dev/null +++ b/ksvg/dom/SVGHKernElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGHKernElement.h" +#include "SVGHKernElementImpl.h" + +using namespace KSVG; + +SVGHKernElement::SVGHKernElement() : SVGElement() +{ + impl = 0; +} + +SVGHKernElement::SVGHKernElement(const SVGHKernElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGHKernElement &SVGHKernElement::operator =(const SVGHKernElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGHKernElement::SVGHKernElement(SVGHKernElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGHKernElement::~SVGHKernElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGICCColor.cc b/ksvg/dom/SVGICCColor.cc deleted file mode 100644 index 3baef1c1..00000000 --- a/ksvg/dom/SVGICCColor.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGICCColor.h" -#include "SVGICCColorImpl.h" -#include "SVGNumberList.h" - -using namespace KSVG; - -SVGICCColor::SVGICCColor() -{ - impl = new SVGICCColorImpl(); - impl->ref(); -} - -SVGICCColor::SVGICCColor(const SVGICCColor &other) : impl(0) -{ - (*this) = other; -} - -SVGICCColor &SVGICCColor::operator =(const SVGICCColor &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGICCColor::SVGICCColor(SVGICCColorImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGICCColor::~SVGICCColor() -{ - if(impl) - impl->deref(); -} - -void SVGICCColor::setColorProfile(const DOM::DOMString &colorProfile) -{ - if(impl) - impl->setColorProfile(colorProfile); -} - -DOM::DOMString SVGICCColor::colorProfile() const -{ - if(!impl) return DOM::DOMString(); - return DOM::DOMString(impl->colorProfile()); -} - -SVGNumberList SVGICCColor::colors() const -{ - if(!impl) return SVGNumberList(0); - return SVGNumberList(impl->colors()); -} diff --git a/ksvg/dom/SVGICCColor.cpp b/ksvg/dom/SVGICCColor.cpp new file mode 100644 index 00000000..3baef1c1 --- /dev/null +++ b/ksvg/dom/SVGICCColor.cpp @@ -0,0 +1,83 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGICCColor.h" +#include "SVGICCColorImpl.h" +#include "SVGNumberList.h" + +using namespace KSVG; + +SVGICCColor::SVGICCColor() +{ + impl = new SVGICCColorImpl(); + impl->ref(); +} + +SVGICCColor::SVGICCColor(const SVGICCColor &other) : impl(0) +{ + (*this) = other; +} + +SVGICCColor &SVGICCColor::operator =(const SVGICCColor &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGICCColor::SVGICCColor(SVGICCColorImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGICCColor::~SVGICCColor() +{ + if(impl) + impl->deref(); +} + +void SVGICCColor::setColorProfile(const DOM::DOMString &colorProfile) +{ + if(impl) + impl->setColorProfile(colorProfile); +} + +DOM::DOMString SVGICCColor::colorProfile() const +{ + if(!impl) return DOM::DOMString(); + return DOM::DOMString(impl->colorProfile()); +} + +SVGNumberList SVGICCColor::colors() const +{ + if(!impl) return SVGNumberList(0); + return SVGNumberList(impl->colors()); +} diff --git a/ksvg/dom/SVGImageElement.cc b/ksvg/dom/SVGImageElement.cc deleted file mode 100644 index 2981abef..00000000 --- a/ksvg/dom/SVGImageElement.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGImageElement.h" -#include "SVGImageElementImpl.h" -#include "SVGAnimatedLength.h" -#include "SVGAnimatedPreserveAspectRatio.h" - -using namespace KSVG; - -SVGImageElement::SVGImageElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGURIReference() -{ - impl = 0; -} - -SVGImageElement::SVGImageElement(const SVGImageElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other), impl(0) -{ - (*this) = other; -} - -SVGImageElement &SVGImageElement::operator=(const SVGImageElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - SVGURIReference::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGImageElement::SVGImageElement(SVGImageElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGImageElement::~SVGImageElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGImageElement::x() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGImageElement::y() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGImageElement::width() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGImageElement::height() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} - -SVGAnimatedPreserveAspectRatio SVGImageElement::preserveAspectRatio() const -{ - if(!impl) return SVGAnimatedPreserveAspectRatio(0); - return SVGAnimatedPreserveAspectRatio(impl->preserveAspectRatio()); -} diff --git a/ksvg/dom/SVGImageElement.cpp b/ksvg/dom/SVGImageElement.cpp new file mode 100644 index 00000000..2981abef --- /dev/null +++ b/ksvg/dom/SVGImageElement.cpp @@ -0,0 +1,104 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGImageElement.h" +#include "SVGImageElementImpl.h" +#include "SVGAnimatedLength.h" +#include "SVGAnimatedPreserveAspectRatio.h" + +using namespace KSVG; + +SVGImageElement::SVGImageElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGURIReference() +{ + impl = 0; +} + +SVGImageElement::SVGImageElement(const SVGImageElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other), impl(0) +{ + (*this) = other; +} + +SVGImageElement &SVGImageElement::operator=(const SVGImageElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + SVGURIReference::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGImageElement::SVGImageElement(SVGImageElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGImageElement::~SVGImageElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGImageElement::x() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGImageElement::y() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGImageElement::width() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGImageElement::height() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} + +SVGAnimatedPreserveAspectRatio SVGImageElement::preserveAspectRatio() const +{ + if(!impl) return SVGAnimatedPreserveAspectRatio(0); + return SVGAnimatedPreserveAspectRatio(impl->preserveAspectRatio()); +} diff --git a/ksvg/dom/SVGLangSpace.cc b/ksvg/dom/SVGLangSpace.cc deleted file mode 100644 index dc4e0cb3..00000000 --- a/ksvg/dom/SVGLangSpace.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGLangSpace.h" -#include "SVGLangSpaceImpl.h" - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGLangSpace::SVGLangSpace() -{ - impl = 0; -} - -SVGLangSpace::SVGLangSpace(const SVGLangSpace &other) : impl(0) -{ - (*this) = other; -} - -SVGLangSpace &SVGLangSpace::operator=(const SVGLangSpace &other) -{ - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGLangSpace::SVGLangSpace(SVGLangSpaceImpl *other) -{ - impl = other; -} - -SVGLangSpace::~SVGLangSpace() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -void SVGLangSpace::setXmllang(const DOM::DOMString &xmllang) -{ - if(impl) - impl->setXmllang(xmllang); -} - -DOM::DOMString SVGLangSpace::xmllang() const -{ - if(!impl) return DOM::DOMString(); - return impl->xmllang(); -} - -void SVGLangSpace::setXmlspace(const DOM::DOMString &xmlspace) -{ - if(impl) - impl->setXmlspace(xmlspace); -} - -DOM::DOMString SVGLangSpace::xmlspace() const -{ - if(!impl) return DOM::DOMString(); - return impl->xmlspace(); -} diff --git a/ksvg/dom/SVGLangSpace.cpp b/ksvg/dom/SVGLangSpace.cpp new file mode 100644 index 00000000..dc4e0cb3 --- /dev/null +++ b/ksvg/dom/SVGLangSpace.cpp @@ -0,0 +1,80 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGLangSpace.h" +#include "SVGLangSpaceImpl.h" + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGLangSpace::SVGLangSpace() +{ + impl = 0; +} + +SVGLangSpace::SVGLangSpace(const SVGLangSpace &other) : impl(0) +{ + (*this) = other; +} + +SVGLangSpace &SVGLangSpace::operator=(const SVGLangSpace &other) +{ + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGLangSpace::SVGLangSpace(SVGLangSpaceImpl *other) +{ + impl = other; +} + +SVGLangSpace::~SVGLangSpace() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +void SVGLangSpace::setXmllang(const DOM::DOMString &xmllang) +{ + if(impl) + impl->setXmllang(xmllang); +} + +DOM::DOMString SVGLangSpace::xmllang() const +{ + if(!impl) return DOM::DOMString(); + return impl->xmllang(); +} + +void SVGLangSpace::setXmlspace(const DOM::DOMString &xmlspace) +{ + if(impl) + impl->setXmlspace(xmlspace); +} + +DOM::DOMString SVGLangSpace::xmlspace() const +{ + if(!impl) return DOM::DOMString(); + return impl->xmlspace(); +} diff --git a/ksvg/dom/SVGLength.cc b/ksvg/dom/SVGLength.cc deleted file mode 100644 index 7d55252a..00000000 --- a/ksvg/dom/SVGLength.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGLength.h" -#include "SVGShapeImpl.h" -#include "SVGLengthImpl.h" - -using namespace KSVG; - -SVGLength::SVGLength() -{ - impl = new SVGLengthImpl(); - impl->ref(); -} - -SVGLength::SVGLength(const SVGLength &other) : impl(0) -{ - (*this) = other; -} - -SVGLength &SVGLength::operator =(const SVGLength &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGLength::SVGLength(SVGLengthImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGLength::~SVGLength() -{ - if(impl) - impl->deref(); -} - -unsigned short SVGLength::unitType() const -{ - if(!impl) return SVG_LENGTHTYPE_UNKNOWN; - return impl->unitType(); -} - -void SVGLength::setValue(float value) -{ - if(impl) - { - impl->setValue(value); - - // Automatic updating of the shape if any value is changed, imagine: - // SVGCircleElement c; [...] c.r().baseVal().setValue(150); - if(impl->context() && dynamic_cast(impl->context())) - dynamic_cast(impl->context())->update(UPDATE_TRANSFORM, 0, 0); - } -} - -float SVGLength::value() const -{ - if(!impl) return -1; - return impl->value(); -} - -void SVGLength::setValueInSpecifiedUnits(float valueInSpecifiedUnits) -{ - if(impl) - impl->setValueInSpecifiedUnits(valueInSpecifiedUnits); -} - -float SVGLength::valueInSpecifiedUnits() const -{ - if(!impl) return -1; - return impl->valueInSpecifiedUnits(); -} - -void SVGLength::setValueAsString(const DOM::DOMString &valueAsString) -{ - if(impl) - impl->setValueAsString(valueAsString); -} - -DOM::DOMString SVGLength::valueAsString() const -{ - if(!impl) return DOM::DOMString(); - return impl->valueAsString(); -} - -void SVGLength::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) -{ - if(impl) - impl->newValueSpecifiedUnits(unitType, valueInSpecifiedUnits); -} - -void SVGLength::convertToSpecifiedUnits(unsigned short unitType) -{ - if(impl) - impl->convertToSpecifiedUnits(unitType); -} - -SVGLength::operator float() -{ - if(!impl) return -1; - return impl->valueInSpecifiedUnits(); -} diff --git a/ksvg/dom/SVGLength.cpp b/ksvg/dom/SVGLength.cpp new file mode 100644 index 00000000..7d55252a --- /dev/null +++ b/ksvg/dom/SVGLength.cpp @@ -0,0 +1,133 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGLength.h" +#include "SVGShapeImpl.h" +#include "SVGLengthImpl.h" + +using namespace KSVG; + +SVGLength::SVGLength() +{ + impl = new SVGLengthImpl(); + impl->ref(); +} + +SVGLength::SVGLength(const SVGLength &other) : impl(0) +{ + (*this) = other; +} + +SVGLength &SVGLength::operator =(const SVGLength &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGLength::SVGLength(SVGLengthImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGLength::~SVGLength() +{ + if(impl) + impl->deref(); +} + +unsigned short SVGLength::unitType() const +{ + if(!impl) return SVG_LENGTHTYPE_UNKNOWN; + return impl->unitType(); +} + +void SVGLength::setValue(float value) +{ + if(impl) + { + impl->setValue(value); + + // Automatic updating of the shape if any value is changed, imagine: + // SVGCircleElement c; [...] c.r().baseVal().setValue(150); + if(impl->context() && dynamic_cast(impl->context())) + dynamic_cast(impl->context())->update(UPDATE_TRANSFORM, 0, 0); + } +} + +float SVGLength::value() const +{ + if(!impl) return -1; + return impl->value(); +} + +void SVGLength::setValueInSpecifiedUnits(float valueInSpecifiedUnits) +{ + if(impl) + impl->setValueInSpecifiedUnits(valueInSpecifiedUnits); +} + +float SVGLength::valueInSpecifiedUnits() const +{ + if(!impl) return -1; + return impl->valueInSpecifiedUnits(); +} + +void SVGLength::setValueAsString(const DOM::DOMString &valueAsString) +{ + if(impl) + impl->setValueAsString(valueAsString); +} + +DOM::DOMString SVGLength::valueAsString() const +{ + if(!impl) return DOM::DOMString(); + return impl->valueAsString(); +} + +void SVGLength::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) +{ + if(impl) + impl->newValueSpecifiedUnits(unitType, valueInSpecifiedUnits); +} + +void SVGLength::convertToSpecifiedUnits(unsigned short unitType) +{ + if(impl) + impl->convertToSpecifiedUnits(unitType); +} + +SVGLength::operator float() +{ + if(!impl) return -1; + return impl->valueInSpecifiedUnits(); +} diff --git a/ksvg/dom/SVGLengthList.cc b/ksvg/dom/SVGLengthList.cc deleted file mode 100644 index 30f59d70..00000000 --- a/ksvg/dom/SVGLengthList.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGLengthList.h" -#include "SVGLengthListImpl.h" -#include "SVGLength.h" - -using namespace KSVG; - -SVGLengthList::SVGLengthList() -{ - impl = new SVGLengthListImpl(); - impl->ref(); -} - -SVGLengthList::SVGLengthList(const SVGLengthList &other) : impl(0) -{ - (*this) = other; -} - -SVGLengthList &SVGLengthList::operator=(const SVGLengthList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGLengthList::SVGLengthList(SVGLengthListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGLengthList::~SVGLengthList() -{ - if(impl) - impl->deref(); -} - -unsigned long SVGLengthList::numberOfItems() const -{ - if(!impl) return 0; - return impl->numberOfItems(); -} - -void SVGLengthList::clear() -{ - if(impl) - impl->clear(); -} - -SVGLength *SVGLengthList::initialize(SVGLength *newItem) -{ - if(!impl) return new SVGLength(0); - return new SVGLength(impl->initialize(newItem->handle())); -} - -SVGLength *SVGLengthList::getItem(unsigned long index) -{ - if(!impl) return new SVGLength(0); - return new SVGLength(impl->getItem(index)); -} - -SVGLength *SVGLengthList::insertItemBefore(SVGLength *newItem, unsigned long index) -{ - if(!impl) return new SVGLength(0); - return new SVGLength(impl->insertItemBefore(newItem->handle(), index)); -} - -SVGLength *SVGLengthList::replaceItem(SVGLength *newItem, unsigned long index) -{ - if(!impl) return new SVGLength(0); - return new SVGLength(impl->replaceItem(newItem->handle(), index)); -} - -SVGLength *SVGLengthList::removeItem(unsigned long index) -{ - if(!impl) return new SVGLength(0); - return new SVGLength(impl->removeItem(index)); -} - -SVGLength *SVGLengthList::appendItem(SVGLength *newItem) -{ - if(!impl) return new SVGLength(0); - return new SVGLength(impl->appendItem(newItem->handle())); -} diff --git a/ksvg/dom/SVGLengthList.cpp b/ksvg/dom/SVGLengthList.cpp new file mode 100644 index 00000000..30f59d70 --- /dev/null +++ b/ksvg/dom/SVGLengthList.cpp @@ -0,0 +1,113 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGLengthList.h" +#include "SVGLengthListImpl.h" +#include "SVGLength.h" + +using namespace KSVG; + +SVGLengthList::SVGLengthList() +{ + impl = new SVGLengthListImpl(); + impl->ref(); +} + +SVGLengthList::SVGLengthList(const SVGLengthList &other) : impl(0) +{ + (*this) = other; +} + +SVGLengthList &SVGLengthList::operator=(const SVGLengthList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGLengthList::SVGLengthList(SVGLengthListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGLengthList::~SVGLengthList() +{ + if(impl) + impl->deref(); +} + +unsigned long SVGLengthList::numberOfItems() const +{ + if(!impl) return 0; + return impl->numberOfItems(); +} + +void SVGLengthList::clear() +{ + if(impl) + impl->clear(); +} + +SVGLength *SVGLengthList::initialize(SVGLength *newItem) +{ + if(!impl) return new SVGLength(0); + return new SVGLength(impl->initialize(newItem->handle())); +} + +SVGLength *SVGLengthList::getItem(unsigned long index) +{ + if(!impl) return new SVGLength(0); + return new SVGLength(impl->getItem(index)); +} + +SVGLength *SVGLengthList::insertItemBefore(SVGLength *newItem, unsigned long index) +{ + if(!impl) return new SVGLength(0); + return new SVGLength(impl->insertItemBefore(newItem->handle(), index)); +} + +SVGLength *SVGLengthList::replaceItem(SVGLength *newItem, unsigned long index) +{ + if(!impl) return new SVGLength(0); + return new SVGLength(impl->replaceItem(newItem->handle(), index)); +} + +SVGLength *SVGLengthList::removeItem(unsigned long index) +{ + if(!impl) return new SVGLength(0); + return new SVGLength(impl->removeItem(index)); +} + +SVGLength *SVGLengthList::appendItem(SVGLength *newItem) +{ + if(!impl) return new SVGLength(0); + return new SVGLength(impl->appendItem(newItem->handle())); +} diff --git a/ksvg/dom/SVGLineElement.cc b/ksvg/dom/SVGLineElement.cc deleted file mode 100644 index 918734ea..00000000 --- a/ksvg/dom/SVGLineElement.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGLineElement.h" -#include "SVGLineElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGLineElement::SVGLineElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGLineElement::SVGLineElement(const SVGLineElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) -{ - (*this) = other; -} - -SVGLineElement &SVGLineElement::operator=(const SVGLineElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGLineElement::SVGLineElement(SVGLineElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGLineElement::~SVGLineElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGLineElement::x1() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x1()); -} - -SVGAnimatedLength SVGLineElement::y1() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y1()); -} - -SVGAnimatedLength SVGLineElement::x2() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x2()); -} - -SVGAnimatedLength SVGLineElement::y2() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y2()); -} diff --git a/ksvg/dom/SVGLineElement.cpp b/ksvg/dom/SVGLineElement.cpp new file mode 100644 index 00000000..918734ea --- /dev/null +++ b/ksvg/dom/SVGLineElement.cpp @@ -0,0 +1,96 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGLineElement.h" +#include "SVGLineElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGLineElement::SVGLineElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGLineElement::SVGLineElement(const SVGLineElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) +{ + (*this) = other; +} + +SVGLineElement &SVGLineElement::operator=(const SVGLineElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGLineElement::SVGLineElement(SVGLineElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGLineElement::~SVGLineElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGLineElement::x1() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x1()); +} + +SVGAnimatedLength SVGLineElement::y1() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y1()); +} + +SVGAnimatedLength SVGLineElement::x2() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x2()); +} + +SVGAnimatedLength SVGLineElement::y2() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y2()); +} diff --git a/ksvg/dom/SVGLinearGradientElement.cc b/ksvg/dom/SVGLinearGradientElement.cc deleted file mode 100644 index 41c076dc..00000000 --- a/ksvg/dom/SVGLinearGradientElement.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGLinearGradientElement.h" -#include "SVGLinearGradientElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGLinearGradientElement::SVGLinearGradientElement() : SVGGradientElement() -{ - impl = 0; -} - -SVGLinearGradientElement::SVGLinearGradientElement(const SVGLinearGradientElement &other) : SVGGradientElement(other), impl(0) -{ - (*this) = other; -} - -SVGLinearGradientElement &SVGLinearGradientElement::operator =(const SVGLinearGradientElement &other) -{ - SVGGradientElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGLinearGradientElement::SVGLinearGradientElement(SVGLinearGradientElementImpl *other) : SVGGradientElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGLinearGradientElement::~SVGLinearGradientElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGLinearGradientElement::x1() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x1()); -} - -SVGAnimatedLength SVGLinearGradientElement::y1() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y1()); -} - -SVGAnimatedLength SVGLinearGradientElement::x2() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x2()); -} - -SVGAnimatedLength SVGLinearGradientElement::y2() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y2()); -} diff --git a/ksvg/dom/SVGLinearGradientElement.cpp b/ksvg/dom/SVGLinearGradientElement.cpp new file mode 100644 index 00000000..41c076dc --- /dev/null +++ b/ksvg/dom/SVGLinearGradientElement.cpp @@ -0,0 +1,90 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGLinearGradientElement.h" +#include "SVGLinearGradientElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGLinearGradientElement::SVGLinearGradientElement() : SVGGradientElement() +{ + impl = 0; +} + +SVGLinearGradientElement::SVGLinearGradientElement(const SVGLinearGradientElement &other) : SVGGradientElement(other), impl(0) +{ + (*this) = other; +} + +SVGLinearGradientElement &SVGLinearGradientElement::operator =(const SVGLinearGradientElement &other) +{ + SVGGradientElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGLinearGradientElement::SVGLinearGradientElement(SVGLinearGradientElementImpl *other) : SVGGradientElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGLinearGradientElement::~SVGLinearGradientElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGLinearGradientElement::x1() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x1()); +} + +SVGAnimatedLength SVGLinearGradientElement::y1() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y1()); +} + +SVGAnimatedLength SVGLinearGradientElement::x2() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x2()); +} + +SVGAnimatedLength SVGLinearGradientElement::y2() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y2()); +} diff --git a/ksvg/dom/SVGLocatable.cc b/ksvg/dom/SVGLocatable.cc deleted file mode 100644 index 43a9aac7..00000000 --- a/ksvg/dom/SVGLocatable.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGLocatable.h" -#include "SVGLocatableImpl.h" -#include "SVGElement.h" -#include "SVGRect.h" -#include "SVGMatrix.h" - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGLocatable::SVGLocatable() -{ - impl = 0; -} - -SVGLocatable::SVGLocatable(const SVGLocatable &other) -{ - (*this) = other; -} - -SVGLocatable &SVGLocatable::operator=(const SVGLocatable &other) -{ - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGLocatable::SVGLocatable(SVGLocatableImpl *other) -{ - impl = other; -} - -SVGLocatable::~SVGLocatable() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -SVGElement SVGLocatable::nearestViewportElement() const -{ - if(!impl) return SVGElement(0); - return impl->nearestViewportElement(); -} - -SVGElement SVGLocatable::farthestViewportElement() const -{ - if(!impl) return SVGElement(0); - return impl->farthestViewportElement(); -} - -SVGRect SVGLocatable::getBBox() -{ - if(!impl) return SVGRect(0); - return SVGRect(impl->getBBox()); // TODO: Check correctness -} - -SVGMatrix SVGLocatable::getCTM() -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->getCTM()); -} - -SVGMatrix SVGLocatable::getScreenCTM() -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->getScreenCTM()); -} - -SVGMatrix SVGLocatable::getTransformToElement(const SVGElement &element) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->getTransformToElement(element.handle())); -} diff --git a/ksvg/dom/SVGLocatable.cpp b/ksvg/dom/SVGLocatable.cpp new file mode 100644 index 00000000..43a9aac7 --- /dev/null +++ b/ksvg/dom/SVGLocatable.cpp @@ -0,0 +1,95 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGLocatable.h" +#include "SVGLocatableImpl.h" +#include "SVGElement.h" +#include "SVGRect.h" +#include "SVGMatrix.h" + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGLocatable::SVGLocatable() +{ + impl = 0; +} + +SVGLocatable::SVGLocatable(const SVGLocatable &other) +{ + (*this) = other; +} + +SVGLocatable &SVGLocatable::operator=(const SVGLocatable &other) +{ + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGLocatable::SVGLocatable(SVGLocatableImpl *other) +{ + impl = other; +} + +SVGLocatable::~SVGLocatable() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +SVGElement SVGLocatable::nearestViewportElement() const +{ + if(!impl) return SVGElement(0); + return impl->nearestViewportElement(); +} + +SVGElement SVGLocatable::farthestViewportElement() const +{ + if(!impl) return SVGElement(0); + return impl->farthestViewportElement(); +} + +SVGRect SVGLocatable::getBBox() +{ + if(!impl) return SVGRect(0); + return SVGRect(impl->getBBox()); // TODO: Check correctness +} + +SVGMatrix SVGLocatable::getCTM() +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->getCTM()); +} + +SVGMatrix SVGLocatable::getScreenCTM() +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->getScreenCTM()); +} + +SVGMatrix SVGLocatable::getTransformToElement(const SVGElement &element) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->getTransformToElement(element.handle())); +} diff --git a/ksvg/dom/SVGMPathElement.cc b/ksvg/dom/SVGMPathElement.cc deleted file mode 100644 index cb725260..00000000 --- a/ksvg/dom/SVGMPathElement.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMPathElement.h" -#include "SVGMPathElementImpl.h" - -using namespace KSVG; - -SVGMPathElement::SVGMPathElement() : SVGElement(), SVGURIReference(), SVGExternalResourcesRequired() -{ - impl = 0; -} - -SVGMPathElement::SVGMPathElement(const SVGMPathElement &other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), impl(0) -{ - (*this) = other; -} - -SVGMPathElement &SVGMPathElement::operator =(const SVGMPathElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - SVGExternalResourcesRequired::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGMPathElement::SVGMPathElement(SVGMPathElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGMPathElement::~SVGMPathElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGMPathElement.cpp b/ksvg/dom/SVGMPathElement.cpp new file mode 100644 index 00000000..cb725260 --- /dev/null +++ b/ksvg/dom/SVGMPathElement.cpp @@ -0,0 +1,67 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMPathElement.h" +#include "SVGMPathElementImpl.h" + +using namespace KSVG; + +SVGMPathElement::SVGMPathElement() : SVGElement(), SVGURIReference(), SVGExternalResourcesRequired() +{ + impl = 0; +} + +SVGMPathElement::SVGMPathElement(const SVGMPathElement &other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), impl(0) +{ + (*this) = other; +} + +SVGMPathElement &SVGMPathElement::operator =(const SVGMPathElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + SVGExternalResourcesRequired::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGMPathElement::SVGMPathElement(SVGMPathElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGMPathElement::~SVGMPathElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGMarkerElement.cc b/ksvg/dom/SVGMarkerElement.cc deleted file mode 100644 index de59227d..00000000 --- a/ksvg/dom/SVGMarkerElement.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMarkerElement.h" -#include "SVGMarkerElementImpl.h" -#include "SVGAnimatedLength.h" -#include "SVGAnimatedAngle.h" -#include "SVGAngle.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGMarkerElement::SVGMarkerElement() : SVGElement(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFitToViewBox() -{ - impl = 0; -} - -SVGMarkerElement::SVGMarkerElement(const SVGMarkerElement &other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), impl(0) -{ - (*this) = other; -} - -SVGMarkerElement &SVGMarkerElement::operator =(const SVGMarkerElement &other) -{ - SVGElement::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGFitToViewBox::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGMarkerElement::SVGMarkerElement(SVGMarkerElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGMarkerElement::~SVGMarkerElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGMarkerElement::refX() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->refX()); -} - -SVGAnimatedLength SVGMarkerElement::refY() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->refY()); -} - -SVGAnimatedEnumeration SVGMarkerElement::markerUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->markerUnits()); -} - -SVGAnimatedLength SVGMarkerElement::markerWidth() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->markerWidth()); -} - -SVGAnimatedLength SVGMarkerElement::markerHeight() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->markerHeight()); -} - -SVGAnimatedEnumeration SVGMarkerElement::orientType() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->orientType()); -} - -SVGAnimatedAngle SVGMarkerElement::orientAngle() const -{ - if(!impl) return SVGAnimatedAngle(0); - return SVGAnimatedAngle(impl->orientAngle()); -} - -void SVGMarkerElement::setOrientToAuto() -{ - if(impl) - impl->setOrientToAuto(); -} - -void SVGMarkerElement::setOrientToAngle(const SVGAngle &angle) -{ - if(impl) - impl->setOrientToAngle(angle.handle()); -} diff --git a/ksvg/dom/SVGMarkerElement.cpp b/ksvg/dom/SVGMarkerElement.cpp new file mode 100644 index 00000000..de59227d --- /dev/null +++ b/ksvg/dom/SVGMarkerElement.cpp @@ -0,0 +1,127 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMarkerElement.h" +#include "SVGMarkerElementImpl.h" +#include "SVGAnimatedLength.h" +#include "SVGAnimatedAngle.h" +#include "SVGAngle.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGMarkerElement::SVGMarkerElement() : SVGElement(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFitToViewBox() +{ + impl = 0; +} + +SVGMarkerElement::SVGMarkerElement(const SVGMarkerElement &other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), impl(0) +{ + (*this) = other; +} + +SVGMarkerElement &SVGMarkerElement::operator =(const SVGMarkerElement &other) +{ + SVGElement::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGFitToViewBox::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGMarkerElement::SVGMarkerElement(SVGMarkerElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGMarkerElement::~SVGMarkerElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGMarkerElement::refX() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->refX()); +} + +SVGAnimatedLength SVGMarkerElement::refY() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->refY()); +} + +SVGAnimatedEnumeration SVGMarkerElement::markerUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->markerUnits()); +} + +SVGAnimatedLength SVGMarkerElement::markerWidth() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->markerWidth()); +} + +SVGAnimatedLength SVGMarkerElement::markerHeight() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->markerHeight()); +} + +SVGAnimatedEnumeration SVGMarkerElement::orientType() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->orientType()); +} + +SVGAnimatedAngle SVGMarkerElement::orientAngle() const +{ + if(!impl) return SVGAnimatedAngle(0); + return SVGAnimatedAngle(impl->orientAngle()); +} + +void SVGMarkerElement::setOrientToAuto() +{ + if(impl) + impl->setOrientToAuto(); +} + +void SVGMarkerElement::setOrientToAngle(const SVGAngle &angle) +{ + if(impl) + impl->setOrientToAngle(angle.handle()); +} diff --git a/ksvg/dom/SVGMaskElement.cc b/ksvg/dom/SVGMaskElement.cc deleted file mode 100644 index 7e1f9cee..00000000 --- a/ksvg/dom/SVGMaskElement.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMaskElement.h" -#include "SVGMaskElementImpl.h" -#include "SVGAnimatedLength.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGMaskElement::SVGMaskElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGUnitTypes() -{ - impl = 0; -} - -SVGMaskElement::SVGMaskElement(const SVGMaskElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes(), impl(0) -{ - (*this) = other; -} - -SVGMaskElement &SVGMaskElement::operator =(const SVGMaskElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGMaskElement::SVGMaskElement(SVGMaskElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes() -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGMaskElement::~SVGMaskElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedEnumeration SVGMaskElement::maskUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->maskUnits()); -} - -SVGAnimatedEnumeration SVGMaskElement::maskContentUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->maskContentUnits()); -} - -SVGAnimatedLength SVGMaskElement::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGMaskElement::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGMaskElement::width() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGMaskElement::height() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} diff --git a/ksvg/dom/SVGMaskElement.cpp b/ksvg/dom/SVGMaskElement.cpp new file mode 100644 index 00000000..7e1f9cee --- /dev/null +++ b/ksvg/dom/SVGMaskElement.cpp @@ -0,0 +1,107 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMaskElement.h" +#include "SVGMaskElementImpl.h" +#include "SVGAnimatedLength.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGMaskElement::SVGMaskElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGUnitTypes() +{ + impl = 0; +} + +SVGMaskElement::SVGMaskElement(const SVGMaskElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes(), impl(0) +{ + (*this) = other; +} + +SVGMaskElement &SVGMaskElement::operator =(const SVGMaskElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGMaskElement::SVGMaskElement(SVGMaskElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGUnitTypes() +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGMaskElement::~SVGMaskElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedEnumeration SVGMaskElement::maskUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->maskUnits()); +} + +SVGAnimatedEnumeration SVGMaskElement::maskContentUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->maskContentUnits()); +} + +SVGAnimatedLength SVGMaskElement::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGMaskElement::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGMaskElement::width() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGMaskElement::height() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} diff --git a/ksvg/dom/SVGMatrix.cc b/ksvg/dom/SVGMatrix.cc deleted file mode 100644 index e5e8c6db..00000000 --- a/ksvg/dom/SVGMatrix.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMatrixImpl.h" -#include "SVGMatrix.h" - -using namespace KSVG; - -SVGMatrix::SVGMatrix() -{ - impl = new SVGMatrixImpl(); - impl->ref(); -} - -SVGMatrix::SVGMatrix(double a, double b, double c, double d, double e, double f) -{ - impl = new SVGMatrixImpl(a, b, c, d, e, f); - impl->ref(); -} - -SVGMatrix::SVGMatrix(const SVGMatrix &other) : impl(0) -{ - (*this) = other; -} - -SVGMatrix &SVGMatrix::operator=(const SVGMatrix &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGMatrix::SVGMatrix(SVGMatrixImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGMatrix::~SVGMatrix() -{ - if(impl) - impl->deref(); -} - -void SVGMatrix::setA(const double &a) -{ - if(impl) - impl->setA(a); -} - -double SVGMatrix::a() const -{ - if(!impl) return -1; - return impl->a(); -} - -void SVGMatrix::setB(const double &b) -{ - if(impl) - impl->setB(b); -} - -double SVGMatrix::b() const -{ - if(!impl) return -1; - return impl->b(); -} - -void SVGMatrix::setC(const double &c) -{ - if(impl) - impl->setC(c); -} - -double SVGMatrix::c() const -{ - if(!impl) return -1; - return impl->c(); -} - -void SVGMatrix::setD(const double &d) -{ - if(impl) - impl->setD(d); -} - -double SVGMatrix::d() const -{ - if(!impl) return -1; - return impl->d(); -} - -void SVGMatrix::setE(const double &e) -{ - if(impl) - impl->setE(e); -} - -double SVGMatrix::e() const -{ - if(!impl) return -1; - return impl->e(); -} - -void SVGMatrix::setF(const double &f) -{ - if(impl) - impl->setF(f); -} - -double SVGMatrix::f() const -{ - if(!impl) return -1; - return impl->f(); -} - -SVGMatrix SVGMatrix::multiply(SVGMatrix &secondMatrix) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->multiply(secondMatrix.handle())); -} - -SVGMatrix SVGMatrix::inverse() -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->inverse()); -} - -SVGMatrix SVGMatrix::translate(const double &x, const double &y) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->translate(x, y)); -} - -SVGMatrix SVGMatrix::scale(const double &scaleFactor) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->scale(scaleFactor)); -} - -SVGMatrix SVGMatrix::scaleNonUniform(const double &scaleFactorX, const double &scaleFactorY) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->scaleNonUniform(scaleFactorX, scaleFactorY)); -} - -SVGMatrix SVGMatrix::rotate(const double &angle) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->rotate(angle)); -} - -SVGMatrix SVGMatrix::rotateFromVector(const double &x, const double &y) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->rotateFromVector(x, y)); -} - -SVGMatrix SVGMatrix::flipX() -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->flipX()); -} - -SVGMatrix SVGMatrix::flipY() -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->flipY()); -} - -SVGMatrix SVGMatrix::skewX(const double &angle) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->skewX(angle)); -} - -SVGMatrix SVGMatrix::skewY(const double &angle) -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->skewY(angle)); -} diff --git a/ksvg/dom/SVGMatrix.cpp b/ksvg/dom/SVGMatrix.cpp new file mode 100644 index 00000000..e5e8c6db --- /dev/null +++ b/ksvg/dom/SVGMatrix.cpp @@ -0,0 +1,208 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMatrixImpl.h" +#include "SVGMatrix.h" + +using namespace KSVG; + +SVGMatrix::SVGMatrix() +{ + impl = new SVGMatrixImpl(); + impl->ref(); +} + +SVGMatrix::SVGMatrix(double a, double b, double c, double d, double e, double f) +{ + impl = new SVGMatrixImpl(a, b, c, d, e, f); + impl->ref(); +} + +SVGMatrix::SVGMatrix(const SVGMatrix &other) : impl(0) +{ + (*this) = other; +} + +SVGMatrix &SVGMatrix::operator=(const SVGMatrix &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGMatrix::SVGMatrix(SVGMatrixImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGMatrix::~SVGMatrix() +{ + if(impl) + impl->deref(); +} + +void SVGMatrix::setA(const double &a) +{ + if(impl) + impl->setA(a); +} + +double SVGMatrix::a() const +{ + if(!impl) return -1; + return impl->a(); +} + +void SVGMatrix::setB(const double &b) +{ + if(impl) + impl->setB(b); +} + +double SVGMatrix::b() const +{ + if(!impl) return -1; + return impl->b(); +} + +void SVGMatrix::setC(const double &c) +{ + if(impl) + impl->setC(c); +} + +double SVGMatrix::c() const +{ + if(!impl) return -1; + return impl->c(); +} + +void SVGMatrix::setD(const double &d) +{ + if(impl) + impl->setD(d); +} + +double SVGMatrix::d() const +{ + if(!impl) return -1; + return impl->d(); +} + +void SVGMatrix::setE(const double &e) +{ + if(impl) + impl->setE(e); +} + +double SVGMatrix::e() const +{ + if(!impl) return -1; + return impl->e(); +} + +void SVGMatrix::setF(const double &f) +{ + if(impl) + impl->setF(f); +} + +double SVGMatrix::f() const +{ + if(!impl) return -1; + return impl->f(); +} + +SVGMatrix SVGMatrix::multiply(SVGMatrix &secondMatrix) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->multiply(secondMatrix.handle())); +} + +SVGMatrix SVGMatrix::inverse() +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->inverse()); +} + +SVGMatrix SVGMatrix::translate(const double &x, const double &y) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->translate(x, y)); +} + +SVGMatrix SVGMatrix::scale(const double &scaleFactor) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->scale(scaleFactor)); +} + +SVGMatrix SVGMatrix::scaleNonUniform(const double &scaleFactorX, const double &scaleFactorY) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->scaleNonUniform(scaleFactorX, scaleFactorY)); +} + +SVGMatrix SVGMatrix::rotate(const double &angle) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->rotate(angle)); +} + +SVGMatrix SVGMatrix::rotateFromVector(const double &x, const double &y) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->rotateFromVector(x, y)); +} + +SVGMatrix SVGMatrix::flipX() +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->flipX()); +} + +SVGMatrix SVGMatrix::flipY() +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->flipY()); +} + +SVGMatrix SVGMatrix::skewX(const double &angle) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->skewX(angle)); +} + +SVGMatrix SVGMatrix::skewY(const double &angle) +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->skewY(angle)); +} diff --git a/ksvg/dom/SVGMetadataElement.cc b/ksvg/dom/SVGMetadataElement.cc deleted file mode 100644 index 11a4820c..00000000 --- a/ksvg/dom/SVGMetadataElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMetadataElement.h" -#include "SVGMetadataElementImpl.h" - -using namespace KSVG; - -SVGMetadataElement::SVGMetadataElement() : SVGElement() -{ - impl = 0; -} - -SVGMetadataElement::SVGMetadataElement(const SVGMetadataElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGMetadataElement &SVGMetadataElement::operator =(const SVGMetadataElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGMetadataElement::SVGMetadataElement(SVGMetadataElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGMetadataElement::~SVGMetadataElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGMetadataElement.cpp b/ksvg/dom/SVGMetadataElement.cpp new file mode 100644 index 00000000..11a4820c --- /dev/null +++ b/ksvg/dom/SVGMetadataElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMetadataElement.h" +#include "SVGMetadataElementImpl.h" + +using namespace KSVG; + +SVGMetadataElement::SVGMetadataElement() : SVGElement() +{ + impl = 0; +} + +SVGMetadataElement::SVGMetadataElement(const SVGMetadataElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGMetadataElement &SVGMetadataElement::operator =(const SVGMetadataElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGMetadataElement::SVGMetadataElement(SVGMetadataElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGMetadataElement::~SVGMetadataElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGMissingGlyphElement.cc b/ksvg/dom/SVGMissingGlyphElement.cc deleted file mode 100644 index e4d5bd79..00000000 --- a/ksvg/dom/SVGMissingGlyphElement.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMissingGlyphElement.h" -#include "SVGMissingGlyphElementImpl.h" - -using namespace KSVG; - -SVGMissingGlyphElement::SVGMissingGlyphElement() : SVGElement(), SVGStylable() -{ - impl = 0; -} - -SVGMissingGlyphElement::SVGMissingGlyphElement(const SVGMissingGlyphElement &other) : SVGElement(other), SVGStylable(other), impl(0) -{ - (*this) = other; -} - -SVGMissingGlyphElement &SVGMissingGlyphElement::operator =(const SVGMissingGlyphElement &other) -{ - SVGElement::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGMissingGlyphElement::SVGMissingGlyphElement(SVGMissingGlyphElementImpl *other) : SVGElement(other), SVGStylable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGMissingGlyphElement::~SVGMissingGlyphElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGMissingGlyphElement.cpp b/ksvg/dom/SVGMissingGlyphElement.cpp new file mode 100644 index 00000000..e4d5bd79 --- /dev/null +++ b/ksvg/dom/SVGMissingGlyphElement.cpp @@ -0,0 +1,66 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMissingGlyphElement.h" +#include "SVGMissingGlyphElementImpl.h" + +using namespace KSVG; + +SVGMissingGlyphElement::SVGMissingGlyphElement() : SVGElement(), SVGStylable() +{ + impl = 0; +} + +SVGMissingGlyphElement::SVGMissingGlyphElement(const SVGMissingGlyphElement &other) : SVGElement(other), SVGStylable(other), impl(0) +{ + (*this) = other; +} + +SVGMissingGlyphElement &SVGMissingGlyphElement::operator =(const SVGMissingGlyphElement &other) +{ + SVGElement::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGMissingGlyphElement::SVGMissingGlyphElement(SVGMissingGlyphElementImpl *other) : SVGElement(other), SVGStylable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGMissingGlyphElement::~SVGMissingGlyphElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGNumber.cc b/ksvg/dom/SVGNumber.cc deleted file mode 100644 index 9230acb2..00000000 --- a/ksvg/dom/SVGNumber.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGNumber.h" -#include "SVGNumberImpl.h" - -using namespace KSVG; - -SVGNumber::SVGNumber() -{ - impl = new SVGNumberImpl(); - impl->ref(); -} - -SVGNumber::SVGNumber(const SVGNumber &other) : impl(0) -{ - (*this) = other; -} - -SVGNumber &SVGNumber::operator=(const SVGNumber &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGNumber::SVGNumber(SVGNumberImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGNumber::~SVGNumber() -{ - if(impl) - impl->deref(); -} - -void SVGNumber::setValue(float value) -{ - if(impl) - impl->setValue(value); -} - -float SVGNumber::value() const -{ - if(!impl) return -1; - return impl->value(); -} diff --git a/ksvg/dom/SVGNumber.cpp b/ksvg/dom/SVGNumber.cpp new file mode 100644 index 00000000..9230acb2 --- /dev/null +++ b/ksvg/dom/SVGNumber.cpp @@ -0,0 +1,76 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGNumber.h" +#include "SVGNumberImpl.h" + +using namespace KSVG; + +SVGNumber::SVGNumber() +{ + impl = new SVGNumberImpl(); + impl->ref(); +} + +SVGNumber::SVGNumber(const SVGNumber &other) : impl(0) +{ + (*this) = other; +} + +SVGNumber &SVGNumber::operator=(const SVGNumber &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGNumber::SVGNumber(SVGNumberImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGNumber::~SVGNumber() +{ + if(impl) + impl->deref(); +} + +void SVGNumber::setValue(float value) +{ + if(impl) + impl->setValue(value); +} + +float SVGNumber::value() const +{ + if(!impl) return -1; + return impl->value(); +} diff --git a/ksvg/dom/SVGNumberList.cc b/ksvg/dom/SVGNumberList.cc deleted file mode 100644 index f0587a6e..00000000 --- a/ksvg/dom/SVGNumberList.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGNumberList.h" -#include "SVGNumberListImpl.h" -#include "SVGNumber.h" - -using namespace KSVG; - -SVGNumberList::SVGNumberList() -{ - impl = new SVGNumberListImpl(); - impl->ref(); -} - -SVGNumberList::SVGNumberList(const SVGNumberList &other) : impl(0) -{ - (*this) = other; -} - -SVGNumberList &SVGNumberList::operator=(const SVGNumberList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGNumberList::SVGNumberList(SVGNumberListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGNumberList::~SVGNumberList() -{ - if(impl) - impl->deref(); -} - -unsigned long SVGNumberList::numberOfItems() const -{ - if(!impl) return 0; - return impl->numberOfItems(); -} - -void SVGNumberList::clear() -{ - if(impl) - impl->clear(); -} - -SVGNumber *SVGNumberList::initialize(SVGNumber *newItem) -{ - if(!impl) return new SVGNumber(0); - return new SVGNumber(impl->initialize(newItem->handle())); -} - -SVGNumber *SVGNumberList::getItem(unsigned long index) -{ - if(!impl) return new SVGNumber(0); - return new SVGNumber(impl->getItem(index)); -} - -SVGNumber *SVGNumberList::insertItemBefore(SVGNumber *newItem, unsigned long index) -{ - if(!impl) return new SVGNumber(0); - return new SVGNumber(impl->insertItemBefore(newItem->handle(), index)); -} - -SVGNumber *SVGNumberList::replaceItem(SVGNumber *newItem, unsigned long index) -{ - if(!impl) return new SVGNumber(0); - return new SVGNumber(impl->replaceItem(newItem->handle(), index)); -} - -SVGNumber *SVGNumberList::removeItem(unsigned long index) -{ - if(!impl) return new SVGNumber(0); - return new SVGNumber(impl->removeItem(index)); -} - -SVGNumber *SVGNumberList::appendItem(SVGNumber *newItem) -{ - if(!impl) return new SVGNumber(0); - return new SVGNumber(impl->appendItem(newItem->handle())); -} diff --git a/ksvg/dom/SVGNumberList.cpp b/ksvg/dom/SVGNumberList.cpp new file mode 100644 index 00000000..f0587a6e --- /dev/null +++ b/ksvg/dom/SVGNumberList.cpp @@ -0,0 +1,113 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGNumberList.h" +#include "SVGNumberListImpl.h" +#include "SVGNumber.h" + +using namespace KSVG; + +SVGNumberList::SVGNumberList() +{ + impl = new SVGNumberListImpl(); + impl->ref(); +} + +SVGNumberList::SVGNumberList(const SVGNumberList &other) : impl(0) +{ + (*this) = other; +} + +SVGNumberList &SVGNumberList::operator=(const SVGNumberList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGNumberList::SVGNumberList(SVGNumberListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGNumberList::~SVGNumberList() +{ + if(impl) + impl->deref(); +} + +unsigned long SVGNumberList::numberOfItems() const +{ + if(!impl) return 0; + return impl->numberOfItems(); +} + +void SVGNumberList::clear() +{ + if(impl) + impl->clear(); +} + +SVGNumber *SVGNumberList::initialize(SVGNumber *newItem) +{ + if(!impl) return new SVGNumber(0); + return new SVGNumber(impl->initialize(newItem->handle())); +} + +SVGNumber *SVGNumberList::getItem(unsigned long index) +{ + if(!impl) return new SVGNumber(0); + return new SVGNumber(impl->getItem(index)); +} + +SVGNumber *SVGNumberList::insertItemBefore(SVGNumber *newItem, unsigned long index) +{ + if(!impl) return new SVGNumber(0); + return new SVGNumber(impl->insertItemBefore(newItem->handle(), index)); +} + +SVGNumber *SVGNumberList::replaceItem(SVGNumber *newItem, unsigned long index) +{ + if(!impl) return new SVGNumber(0); + return new SVGNumber(impl->replaceItem(newItem->handle(), index)); +} + +SVGNumber *SVGNumberList::removeItem(unsigned long index) +{ + if(!impl) return new SVGNumber(0); + return new SVGNumber(impl->removeItem(index)); +} + +SVGNumber *SVGNumberList::appendItem(SVGNumber *newItem) +{ + if(!impl) return new SVGNumber(0); + return new SVGNumber(impl->appendItem(newItem->handle())); +} diff --git a/ksvg/dom/SVGPaint.cc b/ksvg/dom/SVGPaint.cc deleted file mode 100644 index f8df586b..00000000 --- a/ksvg/dom/SVGPaint.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPaint.h" -#include "SVGPaintImpl.h" - -using namespace KSVG; - -SVGPaint::SVGPaint() : SVGColor() -{ - // FIXME: no icc color support... - impl = new SVGPaintImpl(0); - impl->ref(); -} - -SVGPaint::SVGPaint(const SVGPaint &other) : SVGColor(other), impl(0) -{ - (*this) = other; -} - -SVGPaint &SVGPaint::operator =(const SVGPaint &other) -{ - SVGColor::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGPaint::SVGPaint(SVGPaintImpl *other) : SVGColor(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPaint::~SVGPaint() -{ - if(impl) - impl->deref(); -} - -unsigned short SVGPaint::paintType() const -{ - if(!impl) return SVG_PAINTTYPE_UNKNOWN; - return impl->paintType(); -} - -DOM::DOMString SVGPaint::uri() const -{ - if(!impl) return DOM::DOMString(); - return impl->uri(); -} - -void SVGPaint::setUri(const DOM::DOMString &uri) -{ - if(impl) - impl->setUri(uri); -} - -void SVGPaint::setPaint(unsigned short paintType, const DOM::DOMString &uri, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) -{ - if(impl) - impl->setPaint(paintType, uri, rgbColor, iccColor); -} diff --git a/ksvg/dom/SVGPaint.cpp b/ksvg/dom/SVGPaint.cpp new file mode 100644 index 00000000..f8df586b --- /dev/null +++ b/ksvg/dom/SVGPaint.cpp @@ -0,0 +1,91 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPaint.h" +#include "SVGPaintImpl.h" + +using namespace KSVG; + +SVGPaint::SVGPaint() : SVGColor() +{ + // FIXME: no icc color support... + impl = new SVGPaintImpl(0); + impl->ref(); +} + +SVGPaint::SVGPaint(const SVGPaint &other) : SVGColor(other), impl(0) +{ + (*this) = other; +} + +SVGPaint &SVGPaint::operator =(const SVGPaint &other) +{ + SVGColor::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGPaint::SVGPaint(SVGPaintImpl *other) : SVGColor(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPaint::~SVGPaint() +{ + if(impl) + impl->deref(); +} + +unsigned short SVGPaint::paintType() const +{ + if(!impl) return SVG_PAINTTYPE_UNKNOWN; + return impl->paintType(); +} + +DOM::DOMString SVGPaint::uri() const +{ + if(!impl) return DOM::DOMString(); + return impl->uri(); +} + +void SVGPaint::setUri(const DOM::DOMString &uri) +{ + if(impl) + impl->setUri(uri); +} + +void SVGPaint::setPaint(unsigned short paintType, const DOM::DOMString &uri, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) +{ + if(impl) + impl->setPaint(paintType, uri, rgbColor, iccColor); +} diff --git a/ksvg/dom/SVGPathElement.cc b/ksvg/dom/SVGPathElement.cc deleted file mode 100644 index d3610f47..00000000 --- a/ksvg/dom/SVGPathElement.cc +++ /dev/null @@ -1,198 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathElement.h" -#include "SVGPathElementImpl.h" -#include "SVGPoint.h" -#include "SVGPathSegClosePath.h" -#include "SVGPathSegLineto.h" -#include "SVGPathSegLinetoHorizontal.h" -#include "SVGPathSegLinetoVertical.h" -#include "SVGPathSegMoveto.h" -#include "SVGPathSegArc.h" -#include "SVGPathSegCurvetoCubic.h" -#include "SVGPathSegCurvetoCubicSmooth.h" -#include "SVGPathSegCurvetoQuadratic.h" -#include "SVGPathSegCurvetoQuadraticSmooth.h" - -using namespace KSVG; - -SVGPathElement::SVGPathElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGAnimatedPathData() -{ - impl = 0; -} - -SVGPathElement::SVGPathElement(const SVGPathElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPathData(other), impl(0) -{ - (*this) = other; -} - -SVGPathElement &SVGPathElement::operator=(const SVGPathElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGPathElement::SVGPathElement(SVGPathElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPathData(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPathElement::~SVGPathElement() -{ - if(impl) - impl->deref(); -} - -/* -SVGAnimatedNumber SVGPathElement::pathLength() const -{ - return m_pathLength; -} -*/ - -float SVGPathElement::getTotalLength() -{ - return impl->getTotalLength(); -} - -SVGPoint SVGPathElement::getPointAtLength(float distance) -{ - return SVGPoint(impl->getPointAtLength(distance)); -} - -unsigned long SVGPathElement::getPathSegAtLength(float distance) -{ - return impl->getPathSegAtLength(distance); -} - -SVGPathSegClosePath SVGPathElement::createSVGPathSegClosePath() -{ - return impl->createSVGPathSegClosePath(); -} - -SVGPathSegMovetoAbs SVGPathElement::createSVGPathSegMovetoAbs(float x,float y) -{ - return impl->createSVGPathSegMovetoAbs(x, y);; -} - -SVGPathSegMovetoRel SVGPathElement::createSVGPathSegMovetoRel(float x,float y) -{ - return impl->createSVGPathSegMovetoRel(x, y); -} - -SVGPathSegLinetoAbs SVGPathElement::createSVGPathSegLinetoAbs(float x,float y) -{ - return impl->createSVGPathSegLinetoAbs(x, y); -} - -SVGPathSegLinetoRel SVGPathElement::createSVGPathSegLinetoRel(float x,float y) -{ - return impl->createSVGPathSegLinetoRel(x, y); -} - -SVGPathSegCurvetoCubicAbs SVGPathElement::createSVGPathSegCurvetoCubicAbs(float x,float y,float x1,float y1,float x2,float y2) -{ - return impl->createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2); -} - -SVGPathSegCurvetoCubicRel SVGPathElement::createSVGPathSegCurvetoCubicRel(float x,float y,float x1,float y1,float x2,float y2) -{ - return impl->createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2); -} - -SVGPathSegCurvetoQuadraticAbs SVGPathElement::createSVGPathSegCurvetoQuadraticAbs(float x,float y,float x1,float y1) -{ - return impl->createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1); -} - -SVGPathSegCurvetoQuadraticRel SVGPathElement::createSVGPathSegCurvetoQuadraticRel(float x,float y,float x1,float y1) -{ - return impl->createSVGPathSegCurvetoQuadraticRel(x, y, x1, y1); -} - -SVGPathSegArcAbs SVGPathElement::createSVGPathSegArcAbs(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag) -{ - return impl->createSVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag); -} - -SVGPathSegArcRel SVGPathElement::createSVGPathSegArcRel(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag) -{ - return impl->createSVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag); -} - -SVGPathSegLinetoHorizontalAbs SVGPathElement::createSVGPathSegLinetoHorizontalAbs(float x) -{ - return impl->createSVGPathSegLinetoHorizontalAbs(x); -} - -SVGPathSegLinetoHorizontalRel SVGPathElement::createSVGPathSegLinetoHorizontalRel(float x) -{ - return impl->createSVGPathSegLinetoHorizontalRel(x); -} - -SVGPathSegLinetoVerticalAbs SVGPathElement::createSVGPathSegLinetoVerticalAbs(float y) -{ - return impl->createSVGPathSegLinetoVerticalAbs(y); -} - -SVGPathSegLinetoVerticalRel SVGPathElement::createSVGPathSegLinetoVerticalRel(float y) -{ - return impl->createSVGPathSegLinetoVerticalRel(y); -} - -SVGPathSegCurvetoCubicSmoothAbs SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs(float x,float y,float x2,float y2) -{ - return impl->createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2);; -} - -SVGPathSegCurvetoCubicSmoothRel SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel(float x,float y,float x2,float y2) -{ - return impl->createSVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2); -} - -SVGPathSegCurvetoQuadraticSmoothAbs SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs(float x,float y) -{ - return impl->createSVGPathSegCurvetoQuadraticSmoothAbs(x, y); -} - -SVGPathSegCurvetoQuadraticSmoothRel SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel(float x,float y) -{ - return impl->createSVGPathSegCurvetoQuadraticSmoothRel(x, y); -} diff --git a/ksvg/dom/SVGPathElement.cpp b/ksvg/dom/SVGPathElement.cpp new file mode 100644 index 00000000..d3610f47 --- /dev/null +++ b/ksvg/dom/SVGPathElement.cpp @@ -0,0 +1,198 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathElement.h" +#include "SVGPathElementImpl.h" +#include "SVGPoint.h" +#include "SVGPathSegClosePath.h" +#include "SVGPathSegLineto.h" +#include "SVGPathSegLinetoHorizontal.h" +#include "SVGPathSegLinetoVertical.h" +#include "SVGPathSegMoveto.h" +#include "SVGPathSegArc.h" +#include "SVGPathSegCurvetoCubic.h" +#include "SVGPathSegCurvetoCubicSmooth.h" +#include "SVGPathSegCurvetoQuadratic.h" +#include "SVGPathSegCurvetoQuadraticSmooth.h" + +using namespace KSVG; + +SVGPathElement::SVGPathElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGAnimatedPathData() +{ + impl = 0; +} + +SVGPathElement::SVGPathElement(const SVGPathElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPathData(other), impl(0) +{ + (*this) = other; +} + +SVGPathElement &SVGPathElement::operator=(const SVGPathElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGPathElement::SVGPathElement(SVGPathElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPathData(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPathElement::~SVGPathElement() +{ + if(impl) + impl->deref(); +} + +/* +SVGAnimatedNumber SVGPathElement::pathLength() const +{ + return m_pathLength; +} +*/ + +float SVGPathElement::getTotalLength() +{ + return impl->getTotalLength(); +} + +SVGPoint SVGPathElement::getPointAtLength(float distance) +{ + return SVGPoint(impl->getPointAtLength(distance)); +} + +unsigned long SVGPathElement::getPathSegAtLength(float distance) +{ + return impl->getPathSegAtLength(distance); +} + +SVGPathSegClosePath SVGPathElement::createSVGPathSegClosePath() +{ + return impl->createSVGPathSegClosePath(); +} + +SVGPathSegMovetoAbs SVGPathElement::createSVGPathSegMovetoAbs(float x,float y) +{ + return impl->createSVGPathSegMovetoAbs(x, y);; +} + +SVGPathSegMovetoRel SVGPathElement::createSVGPathSegMovetoRel(float x,float y) +{ + return impl->createSVGPathSegMovetoRel(x, y); +} + +SVGPathSegLinetoAbs SVGPathElement::createSVGPathSegLinetoAbs(float x,float y) +{ + return impl->createSVGPathSegLinetoAbs(x, y); +} + +SVGPathSegLinetoRel SVGPathElement::createSVGPathSegLinetoRel(float x,float y) +{ + return impl->createSVGPathSegLinetoRel(x, y); +} + +SVGPathSegCurvetoCubicAbs SVGPathElement::createSVGPathSegCurvetoCubicAbs(float x,float y,float x1,float y1,float x2,float y2) +{ + return impl->createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2); +} + +SVGPathSegCurvetoCubicRel SVGPathElement::createSVGPathSegCurvetoCubicRel(float x,float y,float x1,float y1,float x2,float y2) +{ + return impl->createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2); +} + +SVGPathSegCurvetoQuadraticAbs SVGPathElement::createSVGPathSegCurvetoQuadraticAbs(float x,float y,float x1,float y1) +{ + return impl->createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1); +} + +SVGPathSegCurvetoQuadraticRel SVGPathElement::createSVGPathSegCurvetoQuadraticRel(float x,float y,float x1,float y1) +{ + return impl->createSVGPathSegCurvetoQuadraticRel(x, y, x1, y1); +} + +SVGPathSegArcAbs SVGPathElement::createSVGPathSegArcAbs(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag) +{ + return impl->createSVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag); +} + +SVGPathSegArcRel SVGPathElement::createSVGPathSegArcRel(float x,float y,float r1,float r2,float angle,bool largeArcFlag,bool sweepFlag) +{ + return impl->createSVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag); +} + +SVGPathSegLinetoHorizontalAbs SVGPathElement::createSVGPathSegLinetoHorizontalAbs(float x) +{ + return impl->createSVGPathSegLinetoHorizontalAbs(x); +} + +SVGPathSegLinetoHorizontalRel SVGPathElement::createSVGPathSegLinetoHorizontalRel(float x) +{ + return impl->createSVGPathSegLinetoHorizontalRel(x); +} + +SVGPathSegLinetoVerticalAbs SVGPathElement::createSVGPathSegLinetoVerticalAbs(float y) +{ + return impl->createSVGPathSegLinetoVerticalAbs(y); +} + +SVGPathSegLinetoVerticalRel SVGPathElement::createSVGPathSegLinetoVerticalRel(float y) +{ + return impl->createSVGPathSegLinetoVerticalRel(y); +} + +SVGPathSegCurvetoCubicSmoothAbs SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs(float x,float y,float x2,float y2) +{ + return impl->createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2);; +} + +SVGPathSegCurvetoCubicSmoothRel SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel(float x,float y,float x2,float y2) +{ + return impl->createSVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2); +} + +SVGPathSegCurvetoQuadraticSmoothAbs SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs(float x,float y) +{ + return impl->createSVGPathSegCurvetoQuadraticSmoothAbs(x, y); +} + +SVGPathSegCurvetoQuadraticSmoothRel SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel(float x,float y) +{ + return impl->createSVGPathSegCurvetoQuadraticSmoothRel(x, y); +} diff --git a/ksvg/dom/SVGPathSeg.cc b/ksvg/dom/SVGPathSeg.cc deleted file mode 100644 index 7b912e11..00000000 --- a/ksvg/dom/SVGPathSeg.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSeg.h" -#include "SVGPathSegImpl.h" - -using namespace KSVG; - -SVGPathSeg::SVGPathSeg() -{ - impl = new SVGPathSegImpl(); -} - -SVGPathSeg::SVGPathSeg(const SVGPathSeg &other) -{ - impl = other.impl; -} - -SVGPathSeg &SVGPathSeg::operator=(const SVGPathSeg &other) -{ - if(impl == other.impl) - return *this; - - delete impl; - impl = other.impl; - - return *this; -} - -SVGPathSeg::SVGPathSeg(SVGPathSegImpl *other) -{ - impl = other; -} - -SVGPathSeg::~SVGPathSeg() -{ - delete impl; -} - -unsigned short SVGPathSeg::pathSegType() const -{ - if(!impl) return PATHSEG_UNKNOWN; - return impl->pathSegType(); -} - -DOM::DOMString SVGPathSeg::pathSegTypeAsLetter() const -{ - if(!impl) return DOM::DOMString(""); - return impl->pathSegTypeAsLetter(); -} diff --git a/ksvg/dom/SVGPathSeg.cpp b/ksvg/dom/SVGPathSeg.cpp new file mode 100644 index 00000000..7b912e11 --- /dev/null +++ b/ksvg/dom/SVGPathSeg.cpp @@ -0,0 +1,67 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSeg.h" +#include "SVGPathSegImpl.h" + +using namespace KSVG; + +SVGPathSeg::SVGPathSeg() +{ + impl = new SVGPathSegImpl(); +} + +SVGPathSeg::SVGPathSeg(const SVGPathSeg &other) +{ + impl = other.impl; +} + +SVGPathSeg &SVGPathSeg::operator=(const SVGPathSeg &other) +{ + if(impl == other.impl) + return *this; + + delete impl; + impl = other.impl; + + return *this; +} + +SVGPathSeg::SVGPathSeg(SVGPathSegImpl *other) +{ + impl = other; +} + +SVGPathSeg::~SVGPathSeg() +{ + delete impl; +} + +unsigned short SVGPathSeg::pathSegType() const +{ + if(!impl) return PATHSEG_UNKNOWN; + return impl->pathSegType(); +} + +DOM::DOMString SVGPathSeg::pathSegTypeAsLetter() const +{ + if(!impl) return DOM::DOMString(""); + return impl->pathSegTypeAsLetter(); +} diff --git a/ksvg/dom/SVGPathSegArc.cc b/ksvg/dom/SVGPathSegArc.cc deleted file mode 100644 index 9e775ff8..00000000 --- a/ksvg/dom/SVGPathSegArc.cc +++ /dev/null @@ -1,236 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegArc.h" -#include "SVGPathSegArcImpl.h" - -using namespace KSVG; - -SVGPathSegArcAbs::SVGPathSegArcAbs() : SVGPathSeg() -{ - impl = new SVGPathSegArcAbsImpl(); -} - -SVGPathSegArcAbs::SVGPathSegArcAbs(const SVGPathSegArcAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegArcAbs::SVGPathSegArcAbs(SVGPathSegArcAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegArcAbs::~SVGPathSegArcAbs() -{ - delete impl; -} - -void SVGPathSegArcAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegArcAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegArcAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegArcAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegArcAbs::setR1(const float &r1) -{ - if(impl) - impl->setR1(r1); -} - -float SVGPathSegArcAbs::r1() const -{ - if(!impl) return -1; - return impl->r1(); -} - -void SVGPathSegArcAbs::setR2(const float &r2) -{ - if(impl) - impl->setR2(r2); -} - -float SVGPathSegArcAbs::r2() const -{ - if(!impl) return -1; - return impl->r2(); -} - -void SVGPathSegArcAbs::setAngle(const float &angle) -{ - if(impl) - impl->setAngle(angle); -} - -float SVGPathSegArcAbs::angle() const -{ - if(!impl) return -1; - return impl->angle(); -} - -void SVGPathSegArcAbs::setLargeArcFlag(bool largeArcFlag) -{ - if(impl) - impl->setLargeArcFlag(largeArcFlag); -} - -bool SVGPathSegArcAbs::largeArcFlag() const -{ - if(!impl) return false; - return impl->largeArcFlag(); -} - -void SVGPathSegArcAbs::setSweepFlag(bool sweepFlag) -{ - if(impl) - impl->setSweepFlag(sweepFlag); -} - -bool SVGPathSegArcAbs::sweepFlag() const -{ - if(!impl) return false; - return impl->sweepFlag(); -} - - - - - -SVGPathSegArcRel::SVGPathSegArcRel() : SVGPathSeg() -{ - impl = new SVGPathSegArcRelImpl(); -} - -SVGPathSegArcRel::SVGPathSegArcRel(const SVGPathSegArcRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegArcRel::SVGPathSegArcRel(SVGPathSegArcRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegArcRel::~SVGPathSegArcRel() -{ - delete impl; -} - -void SVGPathSegArcRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegArcRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegArcRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegArcRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegArcRel::setR1(const float &r1) -{ - if(impl) - impl->setR1(r1); -} - -float SVGPathSegArcRel::r1() const -{ - if(!impl) return -1; - return impl->r1(); -} - -void SVGPathSegArcRel::setR2(const float &r2) -{ - if(impl) - impl->setR2(r2); -} - -float SVGPathSegArcRel::r2() const -{ - if(!impl) return -1; - return impl->r2(); -} - -void SVGPathSegArcRel::setAngle(const float &angle) -{ - if(impl) - impl->setAngle(angle); -} - -float SVGPathSegArcRel::angle() const -{ - if(!impl) return -1; - return impl->angle(); -} - -void SVGPathSegArcRel::setLargeArcFlag(bool largeArcFlag) -{ - if(impl) - impl->setLargeArcFlag(largeArcFlag); -} - -bool SVGPathSegArcRel::largeArcFlag() const -{ - if(!impl) return false; - return impl->largeArcFlag(); -} - -void SVGPathSegArcRel::setSweepFlag(bool sweepFlag) -{ - if(impl) - impl->setSweepFlag(sweepFlag); -} - -bool SVGPathSegArcRel::sweepFlag() const -{ - if(!impl) return false; - return impl->sweepFlag(); -} diff --git a/ksvg/dom/SVGPathSegArc.cpp b/ksvg/dom/SVGPathSegArc.cpp new file mode 100644 index 00000000..9e775ff8 --- /dev/null +++ b/ksvg/dom/SVGPathSegArc.cpp @@ -0,0 +1,236 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegArc.h" +#include "SVGPathSegArcImpl.h" + +using namespace KSVG; + +SVGPathSegArcAbs::SVGPathSegArcAbs() : SVGPathSeg() +{ + impl = new SVGPathSegArcAbsImpl(); +} + +SVGPathSegArcAbs::SVGPathSegArcAbs(const SVGPathSegArcAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegArcAbs::SVGPathSegArcAbs(SVGPathSegArcAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegArcAbs::~SVGPathSegArcAbs() +{ + delete impl; +} + +void SVGPathSegArcAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegArcAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegArcAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegArcAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegArcAbs::setR1(const float &r1) +{ + if(impl) + impl->setR1(r1); +} + +float SVGPathSegArcAbs::r1() const +{ + if(!impl) return -1; + return impl->r1(); +} + +void SVGPathSegArcAbs::setR2(const float &r2) +{ + if(impl) + impl->setR2(r2); +} + +float SVGPathSegArcAbs::r2() const +{ + if(!impl) return -1; + return impl->r2(); +} + +void SVGPathSegArcAbs::setAngle(const float &angle) +{ + if(impl) + impl->setAngle(angle); +} + +float SVGPathSegArcAbs::angle() const +{ + if(!impl) return -1; + return impl->angle(); +} + +void SVGPathSegArcAbs::setLargeArcFlag(bool largeArcFlag) +{ + if(impl) + impl->setLargeArcFlag(largeArcFlag); +} + +bool SVGPathSegArcAbs::largeArcFlag() const +{ + if(!impl) return false; + return impl->largeArcFlag(); +} + +void SVGPathSegArcAbs::setSweepFlag(bool sweepFlag) +{ + if(impl) + impl->setSweepFlag(sweepFlag); +} + +bool SVGPathSegArcAbs::sweepFlag() const +{ + if(!impl) return false; + return impl->sweepFlag(); +} + + + + + +SVGPathSegArcRel::SVGPathSegArcRel() : SVGPathSeg() +{ + impl = new SVGPathSegArcRelImpl(); +} + +SVGPathSegArcRel::SVGPathSegArcRel(const SVGPathSegArcRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegArcRel::SVGPathSegArcRel(SVGPathSegArcRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegArcRel::~SVGPathSegArcRel() +{ + delete impl; +} + +void SVGPathSegArcRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegArcRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegArcRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegArcRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegArcRel::setR1(const float &r1) +{ + if(impl) + impl->setR1(r1); +} + +float SVGPathSegArcRel::r1() const +{ + if(!impl) return -1; + return impl->r1(); +} + +void SVGPathSegArcRel::setR2(const float &r2) +{ + if(impl) + impl->setR2(r2); +} + +float SVGPathSegArcRel::r2() const +{ + if(!impl) return -1; + return impl->r2(); +} + +void SVGPathSegArcRel::setAngle(const float &angle) +{ + if(impl) + impl->setAngle(angle); +} + +float SVGPathSegArcRel::angle() const +{ + if(!impl) return -1; + return impl->angle(); +} + +void SVGPathSegArcRel::setLargeArcFlag(bool largeArcFlag) +{ + if(impl) + impl->setLargeArcFlag(largeArcFlag); +} + +bool SVGPathSegArcRel::largeArcFlag() const +{ + if(!impl) return false; + return impl->largeArcFlag(); +} + +void SVGPathSegArcRel::setSweepFlag(bool sweepFlag) +{ + if(impl) + impl->setSweepFlag(sweepFlag); +} + +bool SVGPathSegArcRel::sweepFlag() const +{ + if(!impl) return false; + return impl->sweepFlag(); +} diff --git a/ksvg/dom/SVGPathSegClosePath.cc b/ksvg/dom/SVGPathSegClosePath.cc deleted file mode 100644 index af7dc302..00000000 --- a/ksvg/dom/SVGPathSegClosePath.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegClosePath.h" -#include "SVGPathSegClosePathImpl.h" - -using namespace KSVG; - -SVGPathSegClosePath::SVGPathSegClosePath() : SVGPathSeg() -{ - impl = new SVGPathSegClosePathImpl(); -} - -SVGPathSegClosePath::SVGPathSegClosePath(const SVGPathSegClosePath &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegClosePath::SVGPathSegClosePath(SVGPathSegClosePathImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegClosePath::~SVGPathSegClosePath() -{ - delete impl; -} diff --git a/ksvg/dom/SVGPathSegClosePath.cpp b/ksvg/dom/SVGPathSegClosePath.cpp new file mode 100644 index 00000000..af7dc302 --- /dev/null +++ b/ksvg/dom/SVGPathSegClosePath.cpp @@ -0,0 +1,44 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegClosePath.h" +#include "SVGPathSegClosePathImpl.h" + +using namespace KSVG; + +SVGPathSegClosePath::SVGPathSegClosePath() : SVGPathSeg() +{ + impl = new SVGPathSegClosePathImpl(); +} + +SVGPathSegClosePath::SVGPathSegClosePath(const SVGPathSegClosePath &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegClosePath::SVGPathSegClosePath(SVGPathSegClosePathImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegClosePath::~SVGPathSegClosePath() +{ + delete impl; +} diff --git a/ksvg/dom/SVGPathSegCurvetoCubic.cc b/ksvg/dom/SVGPathSegCurvetoCubic.cc deleted file mode 100644 index 02313de9..00000000 --- a/ksvg/dom/SVGPathSegCurvetoCubic.cc +++ /dev/null @@ -1,212 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegCurvetoCubic.h" -#include "SVGPathSegCurvetoCubicImpl.h" - -using namespace KSVG; - -SVGPathSegCurvetoCubicAbs::SVGPathSegCurvetoCubicAbs() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoCubicAbsImpl(); -} - -SVGPathSegCurvetoCubicAbs::SVGPathSegCurvetoCubicAbs(const SVGPathSegCurvetoCubicAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoCubicAbs::SVGPathSegCurvetoCubicAbs(SVGPathSegCurvetoCubicAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoCubicAbs::~SVGPathSegCurvetoCubicAbs() -{ - delete impl; -} - -void SVGPathSegCurvetoCubicAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoCubicAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoCubicAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoCubicAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegCurvetoCubicAbs::setX1(const float &x1) -{ - if(impl) - impl->setX1(x1); -} - -float SVGPathSegCurvetoCubicAbs::x1() const -{ - if(!impl) return -1; - return impl->x1(); -} - -void SVGPathSegCurvetoCubicAbs::setY1(const float &y1) -{ - if(impl) - impl->setY1(y1); -} - -float SVGPathSegCurvetoCubicAbs::y1() const -{ - if(!impl) return -1; - return impl->y1(); -} - -void SVGPathSegCurvetoCubicAbs::setX2(const float &x2) -{ - if(impl) - impl->setX2(x2); -} - -float SVGPathSegCurvetoCubicAbs::x2() const -{ - if(!impl) return -1; - return impl->x2(); -} - -void SVGPathSegCurvetoCubicAbs::setY2(const float &y2) -{ - if(impl) - impl->setY2(y2); -} - -float SVGPathSegCurvetoCubicAbs::y2() const -{ - if(!impl) return -1; - return impl->y2(); -} - - - - - -SVGPathSegCurvetoCubicRel::SVGPathSegCurvetoCubicRel() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoCubicRelImpl(); -} - -SVGPathSegCurvetoCubicRel::SVGPathSegCurvetoCubicRel(const SVGPathSegCurvetoCubicRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoCubicRel::SVGPathSegCurvetoCubicRel(SVGPathSegCurvetoCubicRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoCubicRel::~SVGPathSegCurvetoCubicRel() -{ - delete impl; -} - -void SVGPathSegCurvetoCubicRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoCubicRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoCubicRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoCubicRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegCurvetoCubicRel::setX1(const float &x1) -{ - if(impl) - impl->setX1(x1); -} - -float SVGPathSegCurvetoCubicRel::x1() const -{ - if(!impl) return -1; - return impl->x1(); -} - -void SVGPathSegCurvetoCubicRel::setY1(const float &y1) -{ - if(impl) - impl->setY1(y1); -} - -float SVGPathSegCurvetoCubicRel::y1() const -{ - if(!impl) return -1; - return impl->y1(); -} - -void SVGPathSegCurvetoCubicRel::setX2(const float &x2) -{ - if(impl) - impl->setX2(x2); -} - -float SVGPathSegCurvetoCubicRel::x2() const -{ - if(!impl) return -1; - return impl->x2(); -} - -void SVGPathSegCurvetoCubicRel::setY2(const float &y2) -{ - if(impl) - impl->setY2(y2); -} - -float SVGPathSegCurvetoCubicRel::y2() const -{ - if(!impl) return -1; - return impl->y2(); -} diff --git a/ksvg/dom/SVGPathSegCurvetoCubic.cpp b/ksvg/dom/SVGPathSegCurvetoCubic.cpp new file mode 100644 index 00000000..02313de9 --- /dev/null +++ b/ksvg/dom/SVGPathSegCurvetoCubic.cpp @@ -0,0 +1,212 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegCurvetoCubic.h" +#include "SVGPathSegCurvetoCubicImpl.h" + +using namespace KSVG; + +SVGPathSegCurvetoCubicAbs::SVGPathSegCurvetoCubicAbs() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoCubicAbsImpl(); +} + +SVGPathSegCurvetoCubicAbs::SVGPathSegCurvetoCubicAbs(const SVGPathSegCurvetoCubicAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoCubicAbs::SVGPathSegCurvetoCubicAbs(SVGPathSegCurvetoCubicAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoCubicAbs::~SVGPathSegCurvetoCubicAbs() +{ + delete impl; +} + +void SVGPathSegCurvetoCubicAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoCubicAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoCubicAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoCubicAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegCurvetoCubicAbs::setX1(const float &x1) +{ + if(impl) + impl->setX1(x1); +} + +float SVGPathSegCurvetoCubicAbs::x1() const +{ + if(!impl) return -1; + return impl->x1(); +} + +void SVGPathSegCurvetoCubicAbs::setY1(const float &y1) +{ + if(impl) + impl->setY1(y1); +} + +float SVGPathSegCurvetoCubicAbs::y1() const +{ + if(!impl) return -1; + return impl->y1(); +} + +void SVGPathSegCurvetoCubicAbs::setX2(const float &x2) +{ + if(impl) + impl->setX2(x2); +} + +float SVGPathSegCurvetoCubicAbs::x2() const +{ + if(!impl) return -1; + return impl->x2(); +} + +void SVGPathSegCurvetoCubicAbs::setY2(const float &y2) +{ + if(impl) + impl->setY2(y2); +} + +float SVGPathSegCurvetoCubicAbs::y2() const +{ + if(!impl) return -1; + return impl->y2(); +} + + + + + +SVGPathSegCurvetoCubicRel::SVGPathSegCurvetoCubicRel() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoCubicRelImpl(); +} + +SVGPathSegCurvetoCubicRel::SVGPathSegCurvetoCubicRel(const SVGPathSegCurvetoCubicRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoCubicRel::SVGPathSegCurvetoCubicRel(SVGPathSegCurvetoCubicRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoCubicRel::~SVGPathSegCurvetoCubicRel() +{ + delete impl; +} + +void SVGPathSegCurvetoCubicRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoCubicRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoCubicRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoCubicRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegCurvetoCubicRel::setX1(const float &x1) +{ + if(impl) + impl->setX1(x1); +} + +float SVGPathSegCurvetoCubicRel::x1() const +{ + if(!impl) return -1; + return impl->x1(); +} + +void SVGPathSegCurvetoCubicRel::setY1(const float &y1) +{ + if(impl) + impl->setY1(y1); +} + +float SVGPathSegCurvetoCubicRel::y1() const +{ + if(!impl) return -1; + return impl->y1(); +} + +void SVGPathSegCurvetoCubicRel::setX2(const float &x2) +{ + if(impl) + impl->setX2(x2); +} + +float SVGPathSegCurvetoCubicRel::x2() const +{ + if(!impl) return -1; + return impl->x2(); +} + +void SVGPathSegCurvetoCubicRel::setY2(const float &y2) +{ + if(impl) + impl->setY2(y2); +} + +float SVGPathSegCurvetoCubicRel::y2() const +{ + if(!impl) return -1; + return impl->y2(); +} diff --git a/ksvg/dom/SVGPathSegCurvetoCubicSmooth.cc b/ksvg/dom/SVGPathSegCurvetoCubicSmooth.cc deleted file mode 100644 index a8fabdf3..00000000 --- a/ksvg/dom/SVGPathSegCurvetoCubicSmooth.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegCurvetoCubicSmooth.h" -#include "SVGPathSegCurvetoCubicSmoothImpl.h" - -using namespace KSVG; - -SVGPathSegCurvetoCubicSmoothAbs::SVGPathSegCurvetoCubicSmoothAbs() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoCubicSmoothAbsImpl(); -} - -SVGPathSegCurvetoCubicSmoothAbs::SVGPathSegCurvetoCubicSmoothAbs(const SVGPathSegCurvetoCubicSmoothAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoCubicSmoothAbs::SVGPathSegCurvetoCubicSmoothAbs(SVGPathSegCurvetoCubicSmoothAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoCubicSmoothAbs::~SVGPathSegCurvetoCubicSmoothAbs() -{ - delete impl; -} - -void SVGPathSegCurvetoCubicSmoothAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoCubicSmoothAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoCubicSmoothAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoCubicSmoothAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegCurvetoCubicSmoothAbs::setX2(const float &x2) -{ - if(impl) - impl->setX2(x2); -} - -float SVGPathSegCurvetoCubicSmoothAbs::x2() const -{ - if(!impl) return -1; - return impl->x2(); -} - -void SVGPathSegCurvetoCubicSmoothAbs::setY2(const float &y2) -{ - if(impl) - impl->setY2(y2); -} - -float SVGPathSegCurvetoCubicSmoothAbs::y2() const -{ - if(!impl) return -1; - return impl->y2(); -} - - - - - -SVGPathSegCurvetoCubicSmoothRel::SVGPathSegCurvetoCubicSmoothRel() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoCubicSmoothRelImpl(); -} - -SVGPathSegCurvetoCubicSmoothRel::SVGPathSegCurvetoCubicSmoothRel(const SVGPathSegCurvetoCubicSmoothRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoCubicSmoothRel::SVGPathSegCurvetoCubicSmoothRel(SVGPathSegCurvetoCubicSmoothRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoCubicSmoothRel::~SVGPathSegCurvetoCubicSmoothRel() -{ - delete impl; -} - -void SVGPathSegCurvetoCubicSmoothRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoCubicSmoothRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoCubicSmoothRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoCubicSmoothRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegCurvetoCubicSmoothRel::setX2(const float &x2) -{ - if(impl) - impl->setX2(x2); -} - -float SVGPathSegCurvetoCubicSmoothRel::x2() const -{ - if(!impl) return -1; - return impl->x2(); -} - -void SVGPathSegCurvetoCubicSmoothRel::setY2(const float &y2) -{ - if(impl) - impl->setY2(y2); -} - -float SVGPathSegCurvetoCubicSmoothRel::y2() const -{ - if(!impl) return -1; - return impl->y2(); -} diff --git a/ksvg/dom/SVGPathSegCurvetoCubicSmooth.cpp b/ksvg/dom/SVGPathSegCurvetoCubicSmooth.cpp new file mode 100644 index 00000000..a8fabdf3 --- /dev/null +++ b/ksvg/dom/SVGPathSegCurvetoCubicSmooth.cpp @@ -0,0 +1,164 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegCurvetoCubicSmooth.h" +#include "SVGPathSegCurvetoCubicSmoothImpl.h" + +using namespace KSVG; + +SVGPathSegCurvetoCubicSmoothAbs::SVGPathSegCurvetoCubicSmoothAbs() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoCubicSmoothAbsImpl(); +} + +SVGPathSegCurvetoCubicSmoothAbs::SVGPathSegCurvetoCubicSmoothAbs(const SVGPathSegCurvetoCubicSmoothAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoCubicSmoothAbs::SVGPathSegCurvetoCubicSmoothAbs(SVGPathSegCurvetoCubicSmoothAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoCubicSmoothAbs::~SVGPathSegCurvetoCubicSmoothAbs() +{ + delete impl; +} + +void SVGPathSegCurvetoCubicSmoothAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoCubicSmoothAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoCubicSmoothAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoCubicSmoothAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegCurvetoCubicSmoothAbs::setX2(const float &x2) +{ + if(impl) + impl->setX2(x2); +} + +float SVGPathSegCurvetoCubicSmoothAbs::x2() const +{ + if(!impl) return -1; + return impl->x2(); +} + +void SVGPathSegCurvetoCubicSmoothAbs::setY2(const float &y2) +{ + if(impl) + impl->setY2(y2); +} + +float SVGPathSegCurvetoCubicSmoothAbs::y2() const +{ + if(!impl) return -1; + return impl->y2(); +} + + + + + +SVGPathSegCurvetoCubicSmoothRel::SVGPathSegCurvetoCubicSmoothRel() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoCubicSmoothRelImpl(); +} + +SVGPathSegCurvetoCubicSmoothRel::SVGPathSegCurvetoCubicSmoothRel(const SVGPathSegCurvetoCubicSmoothRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoCubicSmoothRel::SVGPathSegCurvetoCubicSmoothRel(SVGPathSegCurvetoCubicSmoothRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoCubicSmoothRel::~SVGPathSegCurvetoCubicSmoothRel() +{ + delete impl; +} + +void SVGPathSegCurvetoCubicSmoothRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoCubicSmoothRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoCubicSmoothRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoCubicSmoothRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegCurvetoCubicSmoothRel::setX2(const float &x2) +{ + if(impl) + impl->setX2(x2); +} + +float SVGPathSegCurvetoCubicSmoothRel::x2() const +{ + if(!impl) return -1; + return impl->x2(); +} + +void SVGPathSegCurvetoCubicSmoothRel::setY2(const float &y2) +{ + if(impl) + impl->setY2(y2); +} + +float SVGPathSegCurvetoCubicSmoothRel::y2() const +{ + if(!impl) return -1; + return impl->y2(); +} diff --git a/ksvg/dom/SVGPathSegCurvetoQuadratic.cc b/ksvg/dom/SVGPathSegCurvetoQuadratic.cc deleted file mode 100644 index 8f83bcf2..00000000 --- a/ksvg/dom/SVGPathSegCurvetoQuadratic.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegCurvetoQuadratic.h" -#include "SVGPathSegCurvetoQuadraticImpl.h" - -using namespace KSVG; - -SVGPathSegCurvetoQuadraticAbs::SVGPathSegCurvetoQuadraticAbs() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoQuadraticAbsImpl(); -} - -SVGPathSegCurvetoQuadraticAbs::SVGPathSegCurvetoQuadraticAbs(const SVGPathSegCurvetoQuadraticAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoQuadraticAbs::SVGPathSegCurvetoQuadraticAbs(SVGPathSegCurvetoQuadraticAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoQuadraticAbs::~SVGPathSegCurvetoQuadraticAbs() -{ - delete impl; -} - -void SVGPathSegCurvetoQuadraticAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoQuadraticAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoQuadraticAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoQuadraticAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegCurvetoQuadraticAbs::setX1(const float &x1) -{ - if(impl) - impl->setX1(x1); -} - -float SVGPathSegCurvetoQuadraticAbs::x1() const -{ - if(!impl) return -1; - return impl->x1(); -} - -void SVGPathSegCurvetoQuadraticAbs::setY1(const float &y1) -{ - if(impl) - impl->setY1(y1); -} - -float SVGPathSegCurvetoQuadraticAbs::y1() const -{ - if(!impl) return -1; - return impl->y1(); -} - - - - - -SVGPathSegCurvetoQuadraticRel::SVGPathSegCurvetoQuadraticRel() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoQuadraticRelImpl(); -} - -SVGPathSegCurvetoQuadraticRel::SVGPathSegCurvetoQuadraticRel(const SVGPathSegCurvetoQuadraticRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoQuadraticRel::SVGPathSegCurvetoQuadraticRel(SVGPathSegCurvetoQuadraticRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoQuadraticRel::~SVGPathSegCurvetoQuadraticRel() -{ - delete impl; -} - -void SVGPathSegCurvetoQuadraticRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoQuadraticRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoQuadraticRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoQuadraticRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGPathSegCurvetoQuadraticRel::setX1(const float &x1) -{ - if(impl) - impl->setX1(x1); -} - -float SVGPathSegCurvetoQuadraticRel::x1() const -{ - if(!impl) return -1; - return impl->x1(); -} - -void SVGPathSegCurvetoQuadraticRel::setY1(const float &y1) -{ - if(impl) - impl->setY1(y1); -} - -float SVGPathSegCurvetoQuadraticRel::y1() const -{ - if(!impl) return -1; - return impl->y1(); -} diff --git a/ksvg/dom/SVGPathSegCurvetoQuadratic.cpp b/ksvg/dom/SVGPathSegCurvetoQuadratic.cpp new file mode 100644 index 00000000..8f83bcf2 --- /dev/null +++ b/ksvg/dom/SVGPathSegCurvetoQuadratic.cpp @@ -0,0 +1,164 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegCurvetoQuadratic.h" +#include "SVGPathSegCurvetoQuadraticImpl.h" + +using namespace KSVG; + +SVGPathSegCurvetoQuadraticAbs::SVGPathSegCurvetoQuadraticAbs() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoQuadraticAbsImpl(); +} + +SVGPathSegCurvetoQuadraticAbs::SVGPathSegCurvetoQuadraticAbs(const SVGPathSegCurvetoQuadraticAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoQuadraticAbs::SVGPathSegCurvetoQuadraticAbs(SVGPathSegCurvetoQuadraticAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoQuadraticAbs::~SVGPathSegCurvetoQuadraticAbs() +{ + delete impl; +} + +void SVGPathSegCurvetoQuadraticAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoQuadraticAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoQuadraticAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoQuadraticAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegCurvetoQuadraticAbs::setX1(const float &x1) +{ + if(impl) + impl->setX1(x1); +} + +float SVGPathSegCurvetoQuadraticAbs::x1() const +{ + if(!impl) return -1; + return impl->x1(); +} + +void SVGPathSegCurvetoQuadraticAbs::setY1(const float &y1) +{ + if(impl) + impl->setY1(y1); +} + +float SVGPathSegCurvetoQuadraticAbs::y1() const +{ + if(!impl) return -1; + return impl->y1(); +} + + + + + +SVGPathSegCurvetoQuadraticRel::SVGPathSegCurvetoQuadraticRel() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoQuadraticRelImpl(); +} + +SVGPathSegCurvetoQuadraticRel::SVGPathSegCurvetoQuadraticRel(const SVGPathSegCurvetoQuadraticRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoQuadraticRel::SVGPathSegCurvetoQuadraticRel(SVGPathSegCurvetoQuadraticRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoQuadraticRel::~SVGPathSegCurvetoQuadraticRel() +{ + delete impl; +} + +void SVGPathSegCurvetoQuadraticRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoQuadraticRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoQuadraticRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoQuadraticRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGPathSegCurvetoQuadraticRel::setX1(const float &x1) +{ + if(impl) + impl->setX1(x1); +} + +float SVGPathSegCurvetoQuadraticRel::x1() const +{ + if(!impl) return -1; + return impl->x1(); +} + +void SVGPathSegCurvetoQuadraticRel::setY1(const float &y1) +{ + if(impl) + impl->setY1(y1); +} + +float SVGPathSegCurvetoQuadraticRel::y1() const +{ + if(!impl) return -1; + return impl->y1(); +} diff --git a/ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cc b/ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cc deleted file mode 100644 index d0a52205..00000000 --- a/ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegCurvetoQuadraticSmooth.h" -#include "SVGPathSegCurvetoQuadraticSmoothImpl.h" - -using namespace KSVG; - -SVGPathSegCurvetoQuadraticSmoothAbs::SVGPathSegCurvetoQuadraticSmoothAbs() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoQuadraticSmoothAbsImpl(); -} - -SVGPathSegCurvetoQuadraticSmoothAbs::SVGPathSegCurvetoQuadraticSmoothAbs(const SVGPathSegCurvetoQuadraticSmoothAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoQuadraticSmoothAbs::SVGPathSegCurvetoQuadraticSmoothAbs(SVGPathSegCurvetoQuadraticSmoothAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoQuadraticSmoothAbs::~SVGPathSegCurvetoQuadraticSmoothAbs() -{ - delete impl; -} - -void SVGPathSegCurvetoQuadraticSmoothAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoQuadraticSmoothAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoQuadraticSmoothAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoQuadraticSmoothAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - - - - - -SVGPathSegCurvetoQuadraticSmoothRel::SVGPathSegCurvetoQuadraticSmoothRel() : SVGPathSeg() -{ - impl = new SVGPathSegCurvetoQuadraticSmoothRelImpl(); -} - -SVGPathSegCurvetoQuadraticSmoothRel::SVGPathSegCurvetoQuadraticSmoothRel(const SVGPathSegCurvetoQuadraticSmoothRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegCurvetoQuadraticSmoothRel::SVGPathSegCurvetoQuadraticSmoothRel(SVGPathSegCurvetoQuadraticSmoothRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegCurvetoQuadraticSmoothRel::~SVGPathSegCurvetoQuadraticSmoothRel() -{ - delete impl; -} - -void SVGPathSegCurvetoQuadraticSmoothRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegCurvetoQuadraticSmoothRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegCurvetoQuadraticSmoothRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegCurvetoQuadraticSmoothRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} diff --git a/ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cpp b/ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cpp new file mode 100644 index 00000000..d0a52205 --- /dev/null +++ b/ksvg/dom/SVGPathSegCurvetoQuadraticSmooth.cpp @@ -0,0 +1,116 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegCurvetoQuadraticSmooth.h" +#include "SVGPathSegCurvetoQuadraticSmoothImpl.h" + +using namespace KSVG; + +SVGPathSegCurvetoQuadraticSmoothAbs::SVGPathSegCurvetoQuadraticSmoothAbs() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoQuadraticSmoothAbsImpl(); +} + +SVGPathSegCurvetoQuadraticSmoothAbs::SVGPathSegCurvetoQuadraticSmoothAbs(const SVGPathSegCurvetoQuadraticSmoothAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoQuadraticSmoothAbs::SVGPathSegCurvetoQuadraticSmoothAbs(SVGPathSegCurvetoQuadraticSmoothAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoQuadraticSmoothAbs::~SVGPathSegCurvetoQuadraticSmoothAbs() +{ + delete impl; +} + +void SVGPathSegCurvetoQuadraticSmoothAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoQuadraticSmoothAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoQuadraticSmoothAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoQuadraticSmoothAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + + + + + +SVGPathSegCurvetoQuadraticSmoothRel::SVGPathSegCurvetoQuadraticSmoothRel() : SVGPathSeg() +{ + impl = new SVGPathSegCurvetoQuadraticSmoothRelImpl(); +} + +SVGPathSegCurvetoQuadraticSmoothRel::SVGPathSegCurvetoQuadraticSmoothRel(const SVGPathSegCurvetoQuadraticSmoothRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegCurvetoQuadraticSmoothRel::SVGPathSegCurvetoQuadraticSmoothRel(SVGPathSegCurvetoQuadraticSmoothRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegCurvetoQuadraticSmoothRel::~SVGPathSegCurvetoQuadraticSmoothRel() +{ + delete impl; +} + +void SVGPathSegCurvetoQuadraticSmoothRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegCurvetoQuadraticSmoothRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegCurvetoQuadraticSmoothRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegCurvetoQuadraticSmoothRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} diff --git a/ksvg/dom/SVGPathSegLineto.cc b/ksvg/dom/SVGPathSegLineto.cc deleted file mode 100644 index d4ef6399..00000000 --- a/ksvg/dom/SVGPathSegLineto.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegLineto.h" -#include "SVGPathSegLinetoImpl.h" - -using namespace KSVG; - -SVGPathSegLinetoAbs::SVGPathSegLinetoAbs() : SVGPathSeg() -{ - impl = new SVGPathSegLinetoAbsImpl(); -} - -SVGPathSegLinetoAbs::SVGPathSegLinetoAbs(const SVGPathSegLinetoAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegLinetoAbs::SVGPathSegLinetoAbs(SVGPathSegLinetoAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegLinetoAbs::~SVGPathSegLinetoAbs() -{ - delete impl; -} - -void SVGPathSegLinetoAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegLinetoAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegLinetoAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegLinetoAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - - - - - -SVGPathSegLinetoRel::SVGPathSegLinetoRel() : SVGPathSeg() -{ - impl = new SVGPathSegLinetoRelImpl(); -} - -SVGPathSegLinetoRel::SVGPathSegLinetoRel(const SVGPathSegLinetoRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegLinetoRel::SVGPathSegLinetoRel(SVGPathSegLinetoRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegLinetoRel::~SVGPathSegLinetoRel() -{ - delete impl; -} - -void SVGPathSegLinetoRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegLinetoRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegLinetoRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegLinetoRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} diff --git a/ksvg/dom/SVGPathSegLineto.cpp b/ksvg/dom/SVGPathSegLineto.cpp new file mode 100644 index 00000000..d4ef6399 --- /dev/null +++ b/ksvg/dom/SVGPathSegLineto.cpp @@ -0,0 +1,116 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegLineto.h" +#include "SVGPathSegLinetoImpl.h" + +using namespace KSVG; + +SVGPathSegLinetoAbs::SVGPathSegLinetoAbs() : SVGPathSeg() +{ + impl = new SVGPathSegLinetoAbsImpl(); +} + +SVGPathSegLinetoAbs::SVGPathSegLinetoAbs(const SVGPathSegLinetoAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegLinetoAbs::SVGPathSegLinetoAbs(SVGPathSegLinetoAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegLinetoAbs::~SVGPathSegLinetoAbs() +{ + delete impl; +} + +void SVGPathSegLinetoAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegLinetoAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegLinetoAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegLinetoAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + + + + + +SVGPathSegLinetoRel::SVGPathSegLinetoRel() : SVGPathSeg() +{ + impl = new SVGPathSegLinetoRelImpl(); +} + +SVGPathSegLinetoRel::SVGPathSegLinetoRel(const SVGPathSegLinetoRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegLinetoRel::SVGPathSegLinetoRel(SVGPathSegLinetoRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegLinetoRel::~SVGPathSegLinetoRel() +{ + delete impl; +} + +void SVGPathSegLinetoRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegLinetoRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegLinetoRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegLinetoRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} diff --git a/ksvg/dom/SVGPathSegLinetoHorizontal.cc b/ksvg/dom/SVGPathSegLinetoHorizontal.cc deleted file mode 100644 index e42b0337..00000000 --- a/ksvg/dom/SVGPathSegLinetoHorizontal.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegLinetoHorizontal.h" -#include "SVGPathSegLinetoHorizontalImpl.h" - -using namespace KSVG; - -SVGPathSegLinetoHorizontalAbs::SVGPathSegLinetoHorizontalAbs() : SVGPathSeg() -{ - impl = new SVGPathSegLinetoHorizontalAbsImpl(); -} - -SVGPathSegLinetoHorizontalAbs::SVGPathSegLinetoHorizontalAbs(const SVGPathSegLinetoHorizontalAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegLinetoHorizontalAbs::SVGPathSegLinetoHorizontalAbs(SVGPathSegLinetoHorizontalAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegLinetoHorizontalAbs::~SVGPathSegLinetoHorizontalAbs() -{ - delete impl; -} - -void SVGPathSegLinetoHorizontalAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegLinetoHorizontalAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - - - - - -SVGPathSegLinetoHorizontalRel::SVGPathSegLinetoHorizontalRel() : SVGPathSeg() -{ - impl = new SVGPathSegLinetoHorizontalRelImpl(); -} - -SVGPathSegLinetoHorizontalRel::SVGPathSegLinetoHorizontalRel(const SVGPathSegLinetoHorizontalRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegLinetoHorizontalRel::SVGPathSegLinetoHorizontalRel(SVGPathSegLinetoHorizontalRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegLinetoHorizontalRel::~SVGPathSegLinetoHorizontalRel() -{ - delete impl; -} - -void SVGPathSegLinetoHorizontalRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegLinetoHorizontalRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} diff --git a/ksvg/dom/SVGPathSegLinetoHorizontal.cpp b/ksvg/dom/SVGPathSegLinetoHorizontal.cpp new file mode 100644 index 00000000..e42b0337 --- /dev/null +++ b/ksvg/dom/SVGPathSegLinetoHorizontal.cpp @@ -0,0 +1,92 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegLinetoHorizontal.h" +#include "SVGPathSegLinetoHorizontalImpl.h" + +using namespace KSVG; + +SVGPathSegLinetoHorizontalAbs::SVGPathSegLinetoHorizontalAbs() : SVGPathSeg() +{ + impl = new SVGPathSegLinetoHorizontalAbsImpl(); +} + +SVGPathSegLinetoHorizontalAbs::SVGPathSegLinetoHorizontalAbs(const SVGPathSegLinetoHorizontalAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegLinetoHorizontalAbs::SVGPathSegLinetoHorizontalAbs(SVGPathSegLinetoHorizontalAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegLinetoHorizontalAbs::~SVGPathSegLinetoHorizontalAbs() +{ + delete impl; +} + +void SVGPathSegLinetoHorizontalAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegLinetoHorizontalAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + + + + + +SVGPathSegLinetoHorizontalRel::SVGPathSegLinetoHorizontalRel() : SVGPathSeg() +{ + impl = new SVGPathSegLinetoHorizontalRelImpl(); +} + +SVGPathSegLinetoHorizontalRel::SVGPathSegLinetoHorizontalRel(const SVGPathSegLinetoHorizontalRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegLinetoHorizontalRel::SVGPathSegLinetoHorizontalRel(SVGPathSegLinetoHorizontalRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegLinetoHorizontalRel::~SVGPathSegLinetoHorizontalRel() +{ + delete impl; +} + +void SVGPathSegLinetoHorizontalRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegLinetoHorizontalRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} diff --git a/ksvg/dom/SVGPathSegLinetoVertical.cc b/ksvg/dom/SVGPathSegLinetoVertical.cc deleted file mode 100644 index b271f5cc..00000000 --- a/ksvg/dom/SVGPathSegLinetoVertical.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegLinetoVertical.h" -#include "SVGPathSegLinetoVerticalImpl.h" - -using namespace KSVG; - -SVGPathSegLinetoVerticalAbs::SVGPathSegLinetoVerticalAbs() : SVGPathSeg() -{ - impl = new SVGPathSegLinetoVerticalAbsImpl(); -} - -SVGPathSegLinetoVerticalAbs::SVGPathSegLinetoVerticalAbs(const SVGPathSegLinetoVerticalAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegLinetoVerticalAbs::SVGPathSegLinetoVerticalAbs(SVGPathSegLinetoVerticalAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegLinetoVerticalAbs::~SVGPathSegLinetoVerticalAbs() -{ - delete impl; -} - -void SVGPathSegLinetoVerticalAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegLinetoVerticalAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - - - - - -SVGPathSegLinetoVerticalRel::SVGPathSegLinetoVerticalRel() : SVGPathSeg() -{ - impl = new SVGPathSegLinetoVerticalRelImpl(); -} - -SVGPathSegLinetoVerticalRel::SVGPathSegLinetoVerticalRel(const SVGPathSegLinetoVerticalRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegLinetoVerticalRel::SVGPathSegLinetoVerticalRel(SVGPathSegLinetoVerticalRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegLinetoVerticalRel::~SVGPathSegLinetoVerticalRel() -{ - delete impl; -} - -void SVGPathSegLinetoVerticalRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegLinetoVerticalRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} diff --git a/ksvg/dom/SVGPathSegLinetoVertical.cpp b/ksvg/dom/SVGPathSegLinetoVertical.cpp new file mode 100644 index 00000000..b271f5cc --- /dev/null +++ b/ksvg/dom/SVGPathSegLinetoVertical.cpp @@ -0,0 +1,92 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegLinetoVertical.h" +#include "SVGPathSegLinetoVerticalImpl.h" + +using namespace KSVG; + +SVGPathSegLinetoVerticalAbs::SVGPathSegLinetoVerticalAbs() : SVGPathSeg() +{ + impl = new SVGPathSegLinetoVerticalAbsImpl(); +} + +SVGPathSegLinetoVerticalAbs::SVGPathSegLinetoVerticalAbs(const SVGPathSegLinetoVerticalAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegLinetoVerticalAbs::SVGPathSegLinetoVerticalAbs(SVGPathSegLinetoVerticalAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegLinetoVerticalAbs::~SVGPathSegLinetoVerticalAbs() +{ + delete impl; +} + +void SVGPathSegLinetoVerticalAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegLinetoVerticalAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + + + + + +SVGPathSegLinetoVerticalRel::SVGPathSegLinetoVerticalRel() : SVGPathSeg() +{ + impl = new SVGPathSegLinetoVerticalRelImpl(); +} + +SVGPathSegLinetoVerticalRel::SVGPathSegLinetoVerticalRel(const SVGPathSegLinetoVerticalRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegLinetoVerticalRel::SVGPathSegLinetoVerticalRel(SVGPathSegLinetoVerticalRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegLinetoVerticalRel::~SVGPathSegLinetoVerticalRel() +{ + delete impl; +} + +void SVGPathSegLinetoVerticalRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegLinetoVerticalRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} diff --git a/ksvg/dom/SVGPathSegList.cc b/ksvg/dom/SVGPathSegList.cc deleted file mode 100644 index 24d255bc..00000000 --- a/ksvg/dom/SVGPathSegList.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegList.h" -#include "SVGPathSegListImpl.h" - -using namespace KSVG; - -SVGPathSegList::SVGPathSegList() -{ - impl = new SVGPathSegListImpl(); - impl->ref(); -} - -SVGPathSegList::SVGPathSegList(const SVGPathSegList &other) -{ - (*this) = other; -} - -SVGPathSegList &SVGPathSegList::operator=(const SVGPathSegList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGPathSegList::SVGPathSegList(SVGPathSegListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPathSegList::~SVGPathSegList() -{ - if(impl) - impl->deref(); -} - -unsigned long SVGPathSegList::numberOfItems() const -{ - if(!impl) return 0; - return impl->numberOfItems(); -} - -void SVGPathSegList::clear() -{ - if(impl) - impl->clear(); -} - -SVGPathSeg *SVGPathSegList::initialize(SVGPathSeg *newItem) -{ - if(!impl) return new SVGPathSeg(0); - return new SVGPathSeg(impl->initialize(newItem->handle())); -} - -SVGPathSeg *SVGPathSegList::getItem(unsigned long index) -{ - if(!impl) return new SVGPathSeg(0); - return new SVGPathSeg(impl->getItem(index)); -} - -SVGPathSeg *SVGPathSegList::insertItemBefore(SVGPathSeg *newItem, unsigned long index) -{ - if(!impl) return new SVGPathSeg(0); - return new SVGPathSeg(impl->insertItemBefore(newItem->handle(), index)); -} - -SVGPathSeg *SVGPathSegList::replaceItem(SVGPathSeg *newItem, unsigned long index) -{ - if(!impl) return new SVGPathSeg(0); - return new SVGPathSeg(impl->replaceItem(newItem->handle(), index)); -} - -SVGPathSeg *SVGPathSegList::removeItem(unsigned long index) -{ - if(!impl) return new SVGPathSeg(0); - return new SVGPathSeg(impl->removeItem(index)); -} - -SVGPathSeg *SVGPathSegList::appendItem(SVGPathSeg *newItem) -{ - if(!impl) return new SVGPathSeg(0); - return new SVGPathSeg(impl->appendItem(newItem->handle())); -} diff --git a/ksvg/dom/SVGPathSegList.cpp b/ksvg/dom/SVGPathSegList.cpp new file mode 100644 index 00000000..24d255bc --- /dev/null +++ b/ksvg/dom/SVGPathSegList.cpp @@ -0,0 +1,112 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegList.h" +#include "SVGPathSegListImpl.h" + +using namespace KSVG; + +SVGPathSegList::SVGPathSegList() +{ + impl = new SVGPathSegListImpl(); + impl->ref(); +} + +SVGPathSegList::SVGPathSegList(const SVGPathSegList &other) +{ + (*this) = other; +} + +SVGPathSegList &SVGPathSegList::operator=(const SVGPathSegList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGPathSegList::SVGPathSegList(SVGPathSegListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPathSegList::~SVGPathSegList() +{ + if(impl) + impl->deref(); +} + +unsigned long SVGPathSegList::numberOfItems() const +{ + if(!impl) return 0; + return impl->numberOfItems(); +} + +void SVGPathSegList::clear() +{ + if(impl) + impl->clear(); +} + +SVGPathSeg *SVGPathSegList::initialize(SVGPathSeg *newItem) +{ + if(!impl) return new SVGPathSeg(0); + return new SVGPathSeg(impl->initialize(newItem->handle())); +} + +SVGPathSeg *SVGPathSegList::getItem(unsigned long index) +{ + if(!impl) return new SVGPathSeg(0); + return new SVGPathSeg(impl->getItem(index)); +} + +SVGPathSeg *SVGPathSegList::insertItemBefore(SVGPathSeg *newItem, unsigned long index) +{ + if(!impl) return new SVGPathSeg(0); + return new SVGPathSeg(impl->insertItemBefore(newItem->handle(), index)); +} + +SVGPathSeg *SVGPathSegList::replaceItem(SVGPathSeg *newItem, unsigned long index) +{ + if(!impl) return new SVGPathSeg(0); + return new SVGPathSeg(impl->replaceItem(newItem->handle(), index)); +} + +SVGPathSeg *SVGPathSegList::removeItem(unsigned long index) +{ + if(!impl) return new SVGPathSeg(0); + return new SVGPathSeg(impl->removeItem(index)); +} + +SVGPathSeg *SVGPathSegList::appendItem(SVGPathSeg *newItem) +{ + if(!impl) return new SVGPathSeg(0); + return new SVGPathSeg(impl->appendItem(newItem->handle())); +} diff --git a/ksvg/dom/SVGPathSegMoveto.cc b/ksvg/dom/SVGPathSegMoveto.cc deleted file mode 100644 index f32f6f55..00000000 --- a/ksvg/dom/SVGPathSegMoveto.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegMoveto.h" -#include "SVGPathSegMovetoImpl.h" - -using namespace KSVG; - -SVGPathSegMovetoAbs::SVGPathSegMovetoAbs() : SVGPathSeg() -{ - impl = new SVGPathSegMovetoAbsImpl(); -} - -SVGPathSegMovetoAbs::SVGPathSegMovetoAbs(const SVGPathSegMovetoAbs &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegMovetoAbs::SVGPathSegMovetoAbs(SVGPathSegMovetoAbsImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegMovetoAbs::~SVGPathSegMovetoAbs() -{ - delete impl; -} - -void SVGPathSegMovetoAbs::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegMovetoAbs::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegMovetoAbs::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegMovetoAbs::y() const -{ - if(!impl) return -1; - return impl->y(); -} - - - - - -SVGPathSegMovetoRel::SVGPathSegMovetoRel() : SVGPathSeg() -{ - impl = new SVGPathSegMovetoRelImpl(); -} - -SVGPathSegMovetoRel::SVGPathSegMovetoRel(const SVGPathSegMovetoRel &other) : SVGPathSeg(other) -{ - impl = other.impl; -} - -SVGPathSegMovetoRel::SVGPathSegMovetoRel(SVGPathSegMovetoRelImpl *other) : SVGPathSeg(other) -{ - impl = other; -} - -SVGPathSegMovetoRel::~SVGPathSegMovetoRel() -{ - delete impl; -} - -void SVGPathSegMovetoRel::setX(const float &x) -{ - if(impl) - impl->setX(x); -} - -float SVGPathSegMovetoRel::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPathSegMovetoRel::setY(const float &y) -{ - if(impl) - impl->setY(y); -} - -float SVGPathSegMovetoRel::y() const -{ - if(!impl) return -1; - return impl->y(); -} diff --git a/ksvg/dom/SVGPathSegMoveto.cpp b/ksvg/dom/SVGPathSegMoveto.cpp new file mode 100644 index 00000000..f32f6f55 --- /dev/null +++ b/ksvg/dom/SVGPathSegMoveto.cpp @@ -0,0 +1,116 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegMoveto.h" +#include "SVGPathSegMovetoImpl.h" + +using namespace KSVG; + +SVGPathSegMovetoAbs::SVGPathSegMovetoAbs() : SVGPathSeg() +{ + impl = new SVGPathSegMovetoAbsImpl(); +} + +SVGPathSegMovetoAbs::SVGPathSegMovetoAbs(const SVGPathSegMovetoAbs &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegMovetoAbs::SVGPathSegMovetoAbs(SVGPathSegMovetoAbsImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegMovetoAbs::~SVGPathSegMovetoAbs() +{ + delete impl; +} + +void SVGPathSegMovetoAbs::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegMovetoAbs::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegMovetoAbs::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegMovetoAbs::y() const +{ + if(!impl) return -1; + return impl->y(); +} + + + + + +SVGPathSegMovetoRel::SVGPathSegMovetoRel() : SVGPathSeg() +{ + impl = new SVGPathSegMovetoRelImpl(); +} + +SVGPathSegMovetoRel::SVGPathSegMovetoRel(const SVGPathSegMovetoRel &other) : SVGPathSeg(other) +{ + impl = other.impl; +} + +SVGPathSegMovetoRel::SVGPathSegMovetoRel(SVGPathSegMovetoRelImpl *other) : SVGPathSeg(other) +{ + impl = other; +} + +SVGPathSegMovetoRel::~SVGPathSegMovetoRel() +{ + delete impl; +} + +void SVGPathSegMovetoRel::setX(const float &x) +{ + if(impl) + impl->setX(x); +} + +float SVGPathSegMovetoRel::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPathSegMovetoRel::setY(const float &y) +{ + if(impl) + impl->setY(y); +} + +float SVGPathSegMovetoRel::y() const +{ + if(!impl) return -1; + return impl->y(); +} diff --git a/ksvg/dom/SVGPatternElement.cc b/ksvg/dom/SVGPatternElement.cc deleted file mode 100644 index 8dcc86f8..00000000 --- a/ksvg/dom/SVGPatternElement.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPatternElement.h" -#include "SVGPatternElementImpl.h" -#include "SVGAnimatedTransformList.h" -#include "SVGAnimatedLength.h" -#include "SVGAnimatedEnumeration.h" - -using namespace KSVG; - -SVGPatternElement::SVGPatternElement() : SVGElement(), SVGURIReference(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFitToViewBox(), SVGUnitTypes() -{ - impl = 0; -} - -SVGPatternElement::SVGPatternElement(const SVGPatternElement &other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), SVGUnitTypes(), impl(0) -{ - (*this) = other; -} - -SVGPatternElement &SVGPatternElement::operator =(const SVGPatternElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGFitToViewBox::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGPatternElement::SVGPatternElement(SVGPatternElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), SVGUnitTypes() -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPatternElement::~SVGPatternElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedEnumeration SVGPatternElement::patternUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->patternUnits()); -} - -SVGAnimatedEnumeration SVGPatternElement::patternContentUnits() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->patternContentUnits()); -} - -SVGAnimatedTransformList SVGPatternElement::patternTransform() const -{ - if(!impl) return SVGAnimatedTransformList(0); - return SVGAnimatedTransformList(impl->patternTransform()); -} - -SVGAnimatedLength SVGPatternElement::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGPatternElement::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGPatternElement::width() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGPatternElement::height() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} diff --git a/ksvg/dom/SVGPatternElement.cpp b/ksvg/dom/SVGPatternElement.cpp new file mode 100644 index 00000000..8dcc86f8 --- /dev/null +++ b/ksvg/dom/SVGPatternElement.cpp @@ -0,0 +1,115 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPatternElement.h" +#include "SVGPatternElementImpl.h" +#include "SVGAnimatedTransformList.h" +#include "SVGAnimatedLength.h" +#include "SVGAnimatedEnumeration.h" + +using namespace KSVG; + +SVGPatternElement::SVGPatternElement() : SVGElement(), SVGURIReference(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFitToViewBox(), SVGUnitTypes() +{ + impl = 0; +} + +SVGPatternElement::SVGPatternElement(const SVGPatternElement &other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), SVGUnitTypes(), impl(0) +{ + (*this) = other; +} + +SVGPatternElement &SVGPatternElement::operator =(const SVGPatternElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGFitToViewBox::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGPatternElement::SVGPatternElement(SVGPatternElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), SVGUnitTypes() +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPatternElement::~SVGPatternElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedEnumeration SVGPatternElement::patternUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->patternUnits()); +} + +SVGAnimatedEnumeration SVGPatternElement::patternContentUnits() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->patternContentUnits()); +} + +SVGAnimatedTransformList SVGPatternElement::patternTransform() const +{ + if(!impl) return SVGAnimatedTransformList(0); + return SVGAnimatedTransformList(impl->patternTransform()); +} + +SVGAnimatedLength SVGPatternElement::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGPatternElement::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGPatternElement::width() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGPatternElement::height() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} diff --git a/ksvg/dom/SVGPoint.cc b/ksvg/dom/SVGPoint.cc deleted file mode 100644 index c385c904..00000000 --- a/ksvg/dom/SVGPoint.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPoint.h" -#include "SVGMatrix.h" -#include "SVGPointImpl.h" - -using namespace KSVG; - -SVGPoint::SVGPoint() -{ - impl = new SVGPointImpl(); - impl->ref(); -} - -SVGPoint::SVGPoint(const SVGPoint &other) : impl(0) -{ - (*this) = other; -} - -SVGPoint &SVGPoint::operator=(const SVGPoint &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGPoint::SVGPoint(SVGPointImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPoint::~SVGPoint() -{ - if(impl) - impl->deref(); -} - -void SVGPoint::setX(float x) -{ - if(impl) - impl->setX(x); -} - -float SVGPoint::x() -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGPoint::setY(float y) -{ - if(impl) - impl->setY(y); -} - -float SVGPoint::y() -{ - if(!impl) return -1; - return impl->y(); -} - -SVGPoint SVGPoint::matrixTransform(SVGMatrix &matrix) -{ - if(!impl) return SVGPoint(0); - return SVGPoint(impl->matrixTransform(*matrix.handle())); -} diff --git a/ksvg/dom/SVGPoint.cpp b/ksvg/dom/SVGPoint.cpp new file mode 100644 index 00000000..c385c904 --- /dev/null +++ b/ksvg/dom/SVGPoint.cpp @@ -0,0 +1,95 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPoint.h" +#include "SVGMatrix.h" +#include "SVGPointImpl.h" + +using namespace KSVG; + +SVGPoint::SVGPoint() +{ + impl = new SVGPointImpl(); + impl->ref(); +} + +SVGPoint::SVGPoint(const SVGPoint &other) : impl(0) +{ + (*this) = other; +} + +SVGPoint &SVGPoint::operator=(const SVGPoint &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGPoint::SVGPoint(SVGPointImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPoint::~SVGPoint() +{ + if(impl) + impl->deref(); +} + +void SVGPoint::setX(float x) +{ + if(impl) + impl->setX(x); +} + +float SVGPoint::x() +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGPoint::setY(float y) +{ + if(impl) + impl->setY(y); +} + +float SVGPoint::y() +{ + if(!impl) return -1; + return impl->y(); +} + +SVGPoint SVGPoint::matrixTransform(SVGMatrix &matrix) +{ + if(!impl) return SVGPoint(0); + return SVGPoint(impl->matrixTransform(*matrix.handle())); +} diff --git a/ksvg/dom/SVGPointList.cc b/ksvg/dom/SVGPointList.cc deleted file mode 100644 index 963b1c60..00000000 --- a/ksvg/dom/SVGPointList.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPoint.h" -#include "SVGPointImpl.h" -#include "SVGPointList.h" -#include "SVGPointListImpl.h" - -using namespace KSVG; - -SVGPointList::SVGPointList() -{ - impl = new SVGPointListImpl(); - impl->ref(); -} - -SVGPointList::SVGPointList(const SVGPointList &other) : impl(0) -{ - (*this) = other; -} - -SVGPointList &SVGPointList::operator=(const SVGPointList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGPointList::SVGPointList(SVGPointListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPointList::~SVGPointList() -{ - if(impl) - impl->deref(); -} - -unsigned long SVGPointList::numberOfItems() const -{ - if(!impl) return 0; - return impl->numberOfItems(); -} - -void SVGPointList::clear() -{ - if(impl) - impl->clear(); -} - -SVGPoint *SVGPointList::initialize(SVGPoint *newItem) -{ - if(!impl) return new SVGPoint(0); - return new SVGPoint(impl->initialize(newItem->handle())); -} - -SVGPoint *SVGPointList::getItem(unsigned long index) -{ - if(!impl) return new SVGPoint(0); - return new SVGPoint(impl->getItem(index)); -} - -SVGPoint *SVGPointList::insertItemBefore(SVGPoint *newItem, unsigned long index) -{ - if(!impl) return new SVGPoint(0); - return new SVGPoint(impl->insertItemBefore(newItem->handle(), index)); -} - -SVGPoint *SVGPointList::replaceItem(SVGPoint *newItem, unsigned long index) -{ - if(!impl) return new SVGPoint(0); - return new SVGPoint(impl->replaceItem(newItem->handle(), index)); -} - -SVGPoint *SVGPointList::removeItem(unsigned long index) -{ - if(!impl) return new SVGPoint(0); - return new SVGPoint(impl->removeItem(index)); -} - -SVGPoint *SVGPointList::appendItem(SVGPoint *newItem) -{ - if(!impl) return new SVGPoint(0); - return new SVGPoint(impl->appendItem(newItem->handle())); -} diff --git a/ksvg/dom/SVGPointList.cpp b/ksvg/dom/SVGPointList.cpp new file mode 100644 index 00000000..963b1c60 --- /dev/null +++ b/ksvg/dom/SVGPointList.cpp @@ -0,0 +1,114 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPoint.h" +#include "SVGPointImpl.h" +#include "SVGPointList.h" +#include "SVGPointListImpl.h" + +using namespace KSVG; + +SVGPointList::SVGPointList() +{ + impl = new SVGPointListImpl(); + impl->ref(); +} + +SVGPointList::SVGPointList(const SVGPointList &other) : impl(0) +{ + (*this) = other; +} + +SVGPointList &SVGPointList::operator=(const SVGPointList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGPointList::SVGPointList(SVGPointListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPointList::~SVGPointList() +{ + if(impl) + impl->deref(); +} + +unsigned long SVGPointList::numberOfItems() const +{ + if(!impl) return 0; + return impl->numberOfItems(); +} + +void SVGPointList::clear() +{ + if(impl) + impl->clear(); +} + +SVGPoint *SVGPointList::initialize(SVGPoint *newItem) +{ + if(!impl) return new SVGPoint(0); + return new SVGPoint(impl->initialize(newItem->handle())); +} + +SVGPoint *SVGPointList::getItem(unsigned long index) +{ + if(!impl) return new SVGPoint(0); + return new SVGPoint(impl->getItem(index)); +} + +SVGPoint *SVGPointList::insertItemBefore(SVGPoint *newItem, unsigned long index) +{ + if(!impl) return new SVGPoint(0); + return new SVGPoint(impl->insertItemBefore(newItem->handle(), index)); +} + +SVGPoint *SVGPointList::replaceItem(SVGPoint *newItem, unsigned long index) +{ + if(!impl) return new SVGPoint(0); + return new SVGPoint(impl->replaceItem(newItem->handle(), index)); +} + +SVGPoint *SVGPointList::removeItem(unsigned long index) +{ + if(!impl) return new SVGPoint(0); + return new SVGPoint(impl->removeItem(index)); +} + +SVGPoint *SVGPointList::appendItem(SVGPoint *newItem) +{ + if(!impl) return new SVGPoint(0); + return new SVGPoint(impl->appendItem(newItem->handle())); +} diff --git a/ksvg/dom/SVGPolygonElement.cc b/ksvg/dom/SVGPolygonElement.cc deleted file mode 100644 index 043c19df..00000000 --- a/ksvg/dom/SVGPolygonElement.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGPolygonElement.h" -#include "SVGPolygonElementImpl.h" -#include "SVGPointList.h" - -using namespace KSVG; - -SVGPolygonElement::SVGPolygonElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGAnimatedPoints() -{ - impl = 0; -} - -SVGPolygonElement::SVGPolygonElement(const SVGPolygonElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other), impl(0) -{ - (*this) = other; -} - -SVGPolygonElement &SVGPolygonElement::operator=(const SVGPolygonElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - SVGAnimatedPoints::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - return *this; -} - -SVGPolygonElement::SVGPolygonElement(SVGPolygonElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPolygonElement::~SVGPolygonElement() -{ - if(impl) - impl->deref(); -} - -SVGPointList SVGPolygonElement::points() -{ - if(!impl) return SVGPointList(0); - return SVGPointList(impl->points()); -} - -SVGPointList SVGPolygonElement::animatedPoints() -{ - if(!impl) return SVGPointList(0); - return SVGPointList(impl->animatedPoints()); -} diff --git a/ksvg/dom/SVGPolygonElement.cpp b/ksvg/dom/SVGPolygonElement.cpp new file mode 100644 index 00000000..043c19df --- /dev/null +++ b/ksvg/dom/SVGPolygonElement.cpp @@ -0,0 +1,84 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGPolygonElement.h" +#include "SVGPolygonElementImpl.h" +#include "SVGPointList.h" + +using namespace KSVG; + +SVGPolygonElement::SVGPolygonElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGAnimatedPoints() +{ + impl = 0; +} + +SVGPolygonElement::SVGPolygonElement(const SVGPolygonElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other), impl(0) +{ + (*this) = other; +} + +SVGPolygonElement &SVGPolygonElement::operator=(const SVGPolygonElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + SVGAnimatedPoints::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + return *this; +} + +SVGPolygonElement::SVGPolygonElement(SVGPolygonElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPolygonElement::~SVGPolygonElement() +{ + if(impl) + impl->deref(); +} + +SVGPointList SVGPolygonElement::points() +{ + if(!impl) return SVGPointList(0); + return SVGPointList(impl->points()); +} + +SVGPointList SVGPolygonElement::animatedPoints() +{ + if(!impl) return SVGPointList(0); + return SVGPointList(impl->animatedPoints()); +} diff --git a/ksvg/dom/SVGPolylineElement.cc b/ksvg/dom/SVGPolylineElement.cc deleted file mode 100644 index 789c5847..00000000 --- a/ksvg/dom/SVGPolylineElement.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGPolylineElement.h" -#include "SVGPolylineElementImpl.h" -#include "SVGPointList.h" - -using namespace KSVG; - -SVGPolylineElement::SVGPolylineElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGAnimatedPoints() -{ - impl = 0; -} - -SVGPolylineElement::SVGPolylineElement(const SVGPolylineElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other), impl(0) -{ - (*this) = other; -} - -SVGPolylineElement &SVGPolylineElement::operator=(const SVGPolylineElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - SVGAnimatedPoints::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGPolylineElement::SVGPolylineElement(SVGPolylineElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGPolylineElement::~SVGPolylineElement() -{ - if(impl) - impl->deref(); -} - -SVGPointList SVGPolylineElement::points() -{ - if(!impl) return SVGPointList(0); - return SVGPointList(impl->points()); -} - -SVGPointList SVGPolylineElement::animatedPoints() -{ - if(!impl) return SVGPointList(0); - return SVGPointList(impl->animatedPoints()); -} diff --git a/ksvg/dom/SVGPolylineElement.cpp b/ksvg/dom/SVGPolylineElement.cpp new file mode 100644 index 00000000..789c5847 --- /dev/null +++ b/ksvg/dom/SVGPolylineElement.cpp @@ -0,0 +1,85 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGPolylineElement.h" +#include "SVGPolylineElementImpl.h" +#include "SVGPointList.h" + +using namespace KSVG; + +SVGPolylineElement::SVGPolylineElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGAnimatedPoints() +{ + impl = 0; +} + +SVGPolylineElement::SVGPolylineElement(const SVGPolylineElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other), impl(0) +{ + (*this) = other; +} + +SVGPolylineElement &SVGPolylineElement::operator=(const SVGPolylineElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + SVGAnimatedPoints::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGPolylineElement::SVGPolylineElement(SVGPolylineElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGAnimatedPoints(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGPolylineElement::~SVGPolylineElement() +{ + if(impl) + impl->deref(); +} + +SVGPointList SVGPolylineElement::points() +{ + if(!impl) return SVGPointList(0); + return SVGPointList(impl->points()); +} + +SVGPointList SVGPolylineElement::animatedPoints() +{ + if(!impl) return SVGPointList(0); + return SVGPointList(impl->animatedPoints()); +} diff --git a/ksvg/dom/SVGPreserveAspectRatio.cc b/ksvg/dom/SVGPreserveAspectRatio.cc deleted file mode 100644 index 51f6e32b..00000000 --- a/ksvg/dom/SVGPreserveAspectRatio.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPreserveAspectRatio.h" -#include "SVGPreserveAspectRatioImpl.h" - -using namespace KSVG; - -SVGPreserveAspectRatio::SVGPreserveAspectRatio() -{ - impl = new SVGPreserveAspectRatioImpl(); -} - -SVGPreserveAspectRatio::SVGPreserveAspectRatio(const SVGPreserveAspectRatio &other) -{ - impl = other.impl; -} - -SVGPreserveAspectRatio &SVGPreserveAspectRatio::operator=(const SVGPreserveAspectRatio &other) -{ - if(impl == other.impl) - return *this; - - delete impl; - impl = other.impl; - - return *this; -} - -SVGPreserveAspectRatio::SVGPreserveAspectRatio(SVGPreserveAspectRatioImpl *other) -{ - impl = other; -} - -SVGPreserveAspectRatio::~SVGPreserveAspectRatio() -{ - delete impl; -} - -void SVGPreserveAspectRatio::setAlign(unsigned short align) -{ - if(impl) - impl->setAlign(align); -} - -unsigned short SVGPreserveAspectRatio::align() const -{ - if(!impl) return SVG_PRESERVEASPECTRATIO_UNKNOWN; - return impl->align(); -} - -void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice) -{ - if(impl) - impl->setMeetOrSlice(meetOrSlice); -} - -unsigned short SVGPreserveAspectRatio::meetOrSlice() const -{ - if(!impl) return SVG_MEETORSLICE_UNKNOWN; - return impl->meetOrSlice(); -} diff --git a/ksvg/dom/SVGPreserveAspectRatio.cpp b/ksvg/dom/SVGPreserveAspectRatio.cpp new file mode 100644 index 00000000..51f6e32b --- /dev/null +++ b/ksvg/dom/SVGPreserveAspectRatio.cpp @@ -0,0 +1,79 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPreserveAspectRatio.h" +#include "SVGPreserveAspectRatioImpl.h" + +using namespace KSVG; + +SVGPreserveAspectRatio::SVGPreserveAspectRatio() +{ + impl = new SVGPreserveAspectRatioImpl(); +} + +SVGPreserveAspectRatio::SVGPreserveAspectRatio(const SVGPreserveAspectRatio &other) +{ + impl = other.impl; +} + +SVGPreserveAspectRatio &SVGPreserveAspectRatio::operator=(const SVGPreserveAspectRatio &other) +{ + if(impl == other.impl) + return *this; + + delete impl; + impl = other.impl; + + return *this; +} + +SVGPreserveAspectRatio::SVGPreserveAspectRatio(SVGPreserveAspectRatioImpl *other) +{ + impl = other; +} + +SVGPreserveAspectRatio::~SVGPreserveAspectRatio() +{ + delete impl; +} + +void SVGPreserveAspectRatio::setAlign(unsigned short align) +{ + if(impl) + impl->setAlign(align); +} + +unsigned short SVGPreserveAspectRatio::align() const +{ + if(!impl) return SVG_PRESERVEASPECTRATIO_UNKNOWN; + return impl->align(); +} + +void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice) +{ + if(impl) + impl->setMeetOrSlice(meetOrSlice); +} + +unsigned short SVGPreserveAspectRatio::meetOrSlice() const +{ + if(!impl) return SVG_MEETORSLICE_UNKNOWN; + return impl->meetOrSlice(); +} diff --git a/ksvg/dom/SVGRadialGradientElement.cc b/ksvg/dom/SVGRadialGradientElement.cc deleted file mode 100644 index 0e71d846..00000000 --- a/ksvg/dom/SVGRadialGradientElement.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGRadialGradientElement.h" -#include "SVGRadialGradientElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGRadialGradientElement::SVGRadialGradientElement() : SVGGradientElement() -{ - impl = 0; -} - -SVGRadialGradientElement::SVGRadialGradientElement(const SVGRadialGradientElement &other) : SVGGradientElement(other), impl(0) -{ - (*this) = other; -} - -SVGRadialGradientElement &SVGRadialGradientElement::operator =(const SVGRadialGradientElement &other) -{ - SVGGradientElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGRadialGradientElement::SVGRadialGradientElement(SVGRadialGradientElementImpl *other) : SVGGradientElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGRadialGradientElement::~SVGRadialGradientElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGRadialGradientElement::cx() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->cx()); -} - -SVGAnimatedLength SVGRadialGradientElement::cy() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->cy()); -} - -SVGAnimatedLength SVGRadialGradientElement::r() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->r()); -} - -SVGAnimatedLength SVGRadialGradientElement::fx() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->fx()); -} - -SVGAnimatedLength SVGRadialGradientElement::fy() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->fy()); -} diff --git a/ksvg/dom/SVGRadialGradientElement.cpp b/ksvg/dom/SVGRadialGradientElement.cpp new file mode 100644 index 00000000..0e71d846 --- /dev/null +++ b/ksvg/dom/SVGRadialGradientElement.cpp @@ -0,0 +1,96 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGRadialGradientElement.h" +#include "SVGRadialGradientElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGRadialGradientElement::SVGRadialGradientElement() : SVGGradientElement() +{ + impl = 0; +} + +SVGRadialGradientElement::SVGRadialGradientElement(const SVGRadialGradientElement &other) : SVGGradientElement(other), impl(0) +{ + (*this) = other; +} + +SVGRadialGradientElement &SVGRadialGradientElement::operator =(const SVGRadialGradientElement &other) +{ + SVGGradientElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGRadialGradientElement::SVGRadialGradientElement(SVGRadialGradientElementImpl *other) : SVGGradientElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGRadialGradientElement::~SVGRadialGradientElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGRadialGradientElement::cx() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->cx()); +} + +SVGAnimatedLength SVGRadialGradientElement::cy() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->cy()); +} + +SVGAnimatedLength SVGRadialGradientElement::r() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->r()); +} + +SVGAnimatedLength SVGRadialGradientElement::fx() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->fx()); +} + +SVGAnimatedLength SVGRadialGradientElement::fy() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->fy()); +} diff --git a/ksvg/dom/SVGRect.cc b/ksvg/dom/SVGRect.cc deleted file mode 100644 index 35a4d550..00000000 --- a/ksvg/dom/SVGRect.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGRect.h" -#include "SVGRectImpl.h" - -using namespace KSVG; - -SVGRect::SVGRect() -{ - impl = new SVGRectImpl(); - impl->ref(); -} - -SVGRect::SVGRect(const SVGRect &other) : impl(0) -{ - (*this) = other; -} - -SVGRect &SVGRect::operator=(const SVGRect &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGRect::SVGRect(SVGRectImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGRect::~SVGRect() -{ - if(impl) - impl->deref(); -} - -void SVGRect::setX(float x) -{ - if(impl) - impl->setX(x); -} - -float SVGRect::x() const -{ - if(!impl) return -1; - return impl->x(); -} - -void SVGRect::setY(float y) -{ - if(impl) - impl->setY(y); -} - -float SVGRect::y() const -{ - if(!impl) return -1; - return impl->y(); -} - -void SVGRect::setWidth(float width) -{ - if(impl) - impl->setWidth(width); -} - -float SVGRect::width() const -{ - if(!impl) return -1; - return impl->width(); -} - -void SVGRect::setHeight(float height) -{ - if(impl) - impl->setHeight(height); -} - -float SVGRect::height() const -{ - if(!impl) return -1; - return impl->height(); -} diff --git a/ksvg/dom/SVGRect.cpp b/ksvg/dom/SVGRect.cpp new file mode 100644 index 00000000..35a4d550 --- /dev/null +++ b/ksvg/dom/SVGRect.cpp @@ -0,0 +1,112 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGRect.h" +#include "SVGRectImpl.h" + +using namespace KSVG; + +SVGRect::SVGRect() +{ + impl = new SVGRectImpl(); + impl->ref(); +} + +SVGRect::SVGRect(const SVGRect &other) : impl(0) +{ + (*this) = other; +} + +SVGRect &SVGRect::operator=(const SVGRect &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGRect::SVGRect(SVGRectImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGRect::~SVGRect() +{ + if(impl) + impl->deref(); +} + +void SVGRect::setX(float x) +{ + if(impl) + impl->setX(x); +} + +float SVGRect::x() const +{ + if(!impl) return -1; + return impl->x(); +} + +void SVGRect::setY(float y) +{ + if(impl) + impl->setY(y); +} + +float SVGRect::y() const +{ + if(!impl) return -1; + return impl->y(); +} + +void SVGRect::setWidth(float width) +{ + if(impl) + impl->setWidth(width); +} + +float SVGRect::width() const +{ + if(!impl) return -1; + return impl->width(); +} + +void SVGRect::setHeight(float height) +{ + if(impl) + impl->setHeight(height); +} + +float SVGRect::height() const +{ + if(!impl) return -1; + return impl->height(); +} diff --git a/ksvg/dom/SVGRectElement.cc b/ksvg/dom/SVGRectElement.cc deleted file mode 100644 index 51af0272..00000000 --- a/ksvg/dom/SVGRectElement.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGRectElement.h" -#include "SVGRectElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGRectElement::SVGRectElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGRectElement::SVGRectElement(const SVGRectElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) -{ - (*this) = other; -} - -SVGRectElement &SVGRectElement::operator=(const SVGRectElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGRectElement::SVGRectElement(SVGRectElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGRectElement::~SVGRectElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGRectElement::x() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGRectElement::y() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGRectElement::width() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGRectElement::height() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} - -SVGAnimatedLength SVGRectElement::rx() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->rx()); -} - -SVGAnimatedLength SVGRectElement::ry() -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->ry()); -} diff --git a/ksvg/dom/SVGRectElement.cpp b/ksvg/dom/SVGRectElement.cpp new file mode 100644 index 00000000..51af0272 --- /dev/null +++ b/ksvg/dom/SVGRectElement.cpp @@ -0,0 +1,107 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGRectElement.h" +#include "SVGRectElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGRectElement::SVGRectElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGRectElement::SVGRectElement(const SVGRectElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) +{ + (*this) = other; +} + +SVGRectElement &SVGRectElement::operator=(const SVGRectElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGRectElement::SVGRectElement(SVGRectElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGRectElement::~SVGRectElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGRectElement::x() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGRectElement::y() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGRectElement::width() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGRectElement::height() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} + +SVGAnimatedLength SVGRectElement::rx() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->rx()); +} + +SVGAnimatedLength SVGRectElement::ry() +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->ry()); +} diff --git a/ksvg/dom/SVGSVGElement.cc b/ksvg/dom/SVGSVGElement.cc deleted file mode 100644 index 5f19c508..00000000 --- a/ksvg/dom/SVGSVGElement.cc +++ /dev/null @@ -1,335 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGRect.h" -#include "SVGSVGElement.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedLength.h" -#include "SVGPoint.h" -#include "SVGNumber.h" -#include "SVGAngle.h" -#include "SVGMatrix.h" -#include "SVGLength.h" -#include "SVGRect.h" -#include "SVGTransform.h" -#include "SVGViewSpec.h" -#include - -using namespace KSVG; - -SVGSVGElement::SVGSVGElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGLocatable(), SVGFitToViewBox(), SVGZoomAndPan() -{ - impl = 0; -} - -SVGSVGElement::SVGSVGElement(const SVGSVGElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGLocatable(other), SVGFitToViewBox(other), SVGZoomAndPan(other), impl(0) -{ - (*this) = other; -} - -SVGSVGElement &SVGSVGElement::operator=(const SVGSVGElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGLocatable::operator=(other); - SVGFitToViewBox::operator=(other); - SVGZoomAndPan::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGSVGElement::SVGSVGElement(SVGSVGElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGLocatable(other), SVGFitToViewBox(other), SVGZoomAndPan(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGSVGElement::~SVGSVGElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGSVGElement::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGSafeCreator::create(impl->x()); -} - -SVGAnimatedLength SVGSVGElement::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGSafeCreator::create(impl->y()); -} - -SVGAnimatedLength SVGSVGElement::width() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGSafeCreator::create(impl->width()); -} - -SVGAnimatedLength SVGSVGElement::height() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGSafeCreator::create(impl->height()); -} - -void SVGSVGElement::setContentScriptType(const DOM::DOMString &contentScriptType) -{ - if(impl) - setContentScriptType(contentScriptType); -} - -DOM::DOMString SVGSVGElement::contentScriptType() const -{ - if(!impl) return DOM::DOMString(); - return impl->contentScriptType(); -} - -void SVGSVGElement::setContentStyleType(const DOM::DOMString &contentStyleType) -{ - if(impl) - setContentStyleType(contentStyleType); -} - -DOM::DOMString SVGSVGElement::contentStyleType() const -{ - if(!impl) return DOM::DOMString(); - return impl->contentStyleType(); -} - -SVGRect SVGSVGElement::viewport() const -{ - if(!impl) return SVGRect(0); - return SVGRect(impl->viewport()); -} - -float SVGSVGElement::pixelUnitToMillimeterX() const -{ - if(!impl) return -1; - return impl->pixelUnitToMillimeterX(); -} - -float SVGSVGElement::pixelUnitToMillimeterY() const -{ - if(!impl) return -1; - return impl->pixelUnitToMillimeterY(); -} - -float SVGSVGElement::screenPixelToMillimeterX() const -{ - if(!impl) return -1; - return impl->screenPixelToMillimeterX(); -} - -float SVGSVGElement::screenPixelToMillimeterY() const -{ - if(!impl) return -1; - return impl->screenPixelToMillimeterY(); -} - -void SVGSVGElement::setUseCurrentView(bool useCurrentView) -{ - if(impl) - impl->setUseCurrentView(useCurrentView); -} - -bool SVGSVGElement::useCurrentView() const -{ - if(!impl) return false; - return impl->useCurrentView(); -} - -SVGViewSpec SVGSVGElement::currentView() const -{ - if(!impl) return SVGViewSpec(0); - return impl->currentView(); -} - -void SVGSVGElement::setCurrentScale(float currentScale) -{ - if(impl) - impl->setCurrentScale(currentScale); -} - -float SVGSVGElement::currentScale() const -{ - if(!impl) return -1; - return impl->currentScale(); -} - -SVGPoint SVGSVGElement::currentTranslate() const -{ - if(!impl) return SVGPoint(0); - return SVGSafeCreator::create(impl->currentTranslate()); -} - -unsigned long SVGSVGElement::suspendRedraw(unsigned long time) -{ - if(!impl) return 0; - return impl->suspendRedraw(time); -} - -void SVGSVGElement::unsuspendRedraw(unsigned long id) -{ - if(impl) - impl->unsuspendRedraw(id); -} - -void SVGSVGElement::unsuspendRedrawAll() -{ - if(impl) - impl->unsuspendRedrawAll(); -} - -void SVGSVGElement::forceRedraw() -{ - if(impl) - impl->forceRedraw(); -} - -void SVGSVGElement::pauseAnimations() -{ - if(impl) - impl->pauseAnimations(); -} - -void SVGSVGElement::unpauseAnimations() -{ - if(impl) - impl->unpauseAnimations(); -} - -bool SVGSVGElement::animationsPaused() -{ - if(!impl) return false; - return impl->animationsPaused(); -} - -float SVGSVGElement::getCurrentTime() -{ - if(!impl) return -1; - return impl->getCurrentTime(); -} - -void SVGSVGElement::setCurrentTime(float time) -{ - if(impl) - impl->setCurrentTime(time); -} - -DOM::NodeList SVGSVGElement::getIntersectionList(const SVGRect &rect,const SVGElement &referenceElement) -{ - if(!impl) return DOM::NodeList(); - return impl->getIntersectionList(rect.handle(), referenceElement.handle()); -} - -DOM::NodeList SVGSVGElement::getEnclosureList(const SVGRect &rect,const SVGElement &referenceElement) -{ - if(!impl) return DOM::NodeList(); - return impl->getEnclosureList(rect.handle(), referenceElement.handle()); -} - -bool SVGSVGElement::checkIntersection(const SVGElement &element,const SVGRect &rect) -{ - if(!impl) return false; - return impl->checkIntersection(element.handle(), rect.handle()); -} - -bool SVGSVGElement::checkEnclosure(const SVGElement &element,const SVGRect &rect) -{ - if(!impl) return false; - return impl->checkEnclosure(element.handle(), rect.handle()); -} - -void SVGSVGElement::deSelectAll() -{ - if(impl) - impl->deSelectAll(); -} - -SVGNumber SVGSVGElement::createSVGNumber() -{ - if(!impl) return SVGNumber(0); - return SVGSafeCreator::create(impl->createSVGNumber()); -} - -SVGLength SVGSVGElement::createSVGLength() -{ - if(!impl) return SVGLength(0); - return SVGSafeCreator::create(impl->createSVGLength()); -} - -SVGAngle SVGSVGElement::createSVGAngle() -{ - if(!impl) return SVGAngle(0); - return SVGSafeCreator::create(impl->createSVGAngle()); -} - -SVGPoint SVGSVGElement::createSVGPoint() -{ - if(!impl) return SVGPoint(0); - return SVGSafeCreator::create(impl->createSVGPoint()); -} - -SVGMatrix SVGSVGElement::createSVGMatrix() -{ - if(!impl) return SVGMatrix(0); - return SVGSafeCreator::create(impl->createSVGMatrix()); -} - -SVGRect SVGSVGElement::createSVGRect() -{ - if(!impl) return SVGRect(0); - return SVGSafeCreator::create(impl->createSVGRect()); -} - -SVGTransform SVGSVGElement::createSVGTransform() -{ - if(!impl) return SVGTransform(0); - return SVGSafeCreator::create(impl->createSVGTransform()); -} - -SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix &matrix) -{ - if(!impl) return SVGTransform(0); - return SVGSafeCreator::create(impl->createSVGTransformFromMatrix(matrix.handle())); -} - -SVGElement SVGSVGElement::getElementById(const DOM::DOMString &elementId) -{ - if(!impl) return SVGElement(0); - return SVGSafeCreator::create(impl->getElementById(elementId)); -} diff --git a/ksvg/dom/SVGSVGElement.cpp b/ksvg/dom/SVGSVGElement.cpp new file mode 100644 index 00000000..5f19c508 --- /dev/null +++ b/ksvg/dom/SVGSVGElement.cpp @@ -0,0 +1,335 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGRect.h" +#include "SVGSVGElement.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedLength.h" +#include "SVGPoint.h" +#include "SVGNumber.h" +#include "SVGAngle.h" +#include "SVGMatrix.h" +#include "SVGLength.h" +#include "SVGRect.h" +#include "SVGTransform.h" +#include "SVGViewSpec.h" +#include + +using namespace KSVG; + +SVGSVGElement::SVGSVGElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGLocatable(), SVGFitToViewBox(), SVGZoomAndPan() +{ + impl = 0; +} + +SVGSVGElement::SVGSVGElement(const SVGSVGElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGLocatable(other), SVGFitToViewBox(other), SVGZoomAndPan(other), impl(0) +{ + (*this) = other; +} + +SVGSVGElement &SVGSVGElement::operator=(const SVGSVGElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGLocatable::operator=(other); + SVGFitToViewBox::operator=(other); + SVGZoomAndPan::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGSVGElement::SVGSVGElement(SVGSVGElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGLocatable(other), SVGFitToViewBox(other), SVGZoomAndPan(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGSVGElement::~SVGSVGElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGSVGElement::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGSafeCreator::create(impl->x()); +} + +SVGAnimatedLength SVGSVGElement::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGSafeCreator::create(impl->y()); +} + +SVGAnimatedLength SVGSVGElement::width() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGSafeCreator::create(impl->width()); +} + +SVGAnimatedLength SVGSVGElement::height() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGSafeCreator::create(impl->height()); +} + +void SVGSVGElement::setContentScriptType(const DOM::DOMString &contentScriptType) +{ + if(impl) + setContentScriptType(contentScriptType); +} + +DOM::DOMString SVGSVGElement::contentScriptType() const +{ + if(!impl) return DOM::DOMString(); + return impl->contentScriptType(); +} + +void SVGSVGElement::setContentStyleType(const DOM::DOMString &contentStyleType) +{ + if(impl) + setContentStyleType(contentStyleType); +} + +DOM::DOMString SVGSVGElement::contentStyleType() const +{ + if(!impl) return DOM::DOMString(); + return impl->contentStyleType(); +} + +SVGRect SVGSVGElement::viewport() const +{ + if(!impl) return SVGRect(0); + return SVGRect(impl->viewport()); +} + +float SVGSVGElement::pixelUnitToMillimeterX() const +{ + if(!impl) return -1; + return impl->pixelUnitToMillimeterX(); +} + +float SVGSVGElement::pixelUnitToMillimeterY() const +{ + if(!impl) return -1; + return impl->pixelUnitToMillimeterY(); +} + +float SVGSVGElement::screenPixelToMillimeterX() const +{ + if(!impl) return -1; + return impl->screenPixelToMillimeterX(); +} + +float SVGSVGElement::screenPixelToMillimeterY() const +{ + if(!impl) return -1; + return impl->screenPixelToMillimeterY(); +} + +void SVGSVGElement::setUseCurrentView(bool useCurrentView) +{ + if(impl) + impl->setUseCurrentView(useCurrentView); +} + +bool SVGSVGElement::useCurrentView() const +{ + if(!impl) return false; + return impl->useCurrentView(); +} + +SVGViewSpec SVGSVGElement::currentView() const +{ + if(!impl) return SVGViewSpec(0); + return impl->currentView(); +} + +void SVGSVGElement::setCurrentScale(float currentScale) +{ + if(impl) + impl->setCurrentScale(currentScale); +} + +float SVGSVGElement::currentScale() const +{ + if(!impl) return -1; + return impl->currentScale(); +} + +SVGPoint SVGSVGElement::currentTranslate() const +{ + if(!impl) return SVGPoint(0); + return SVGSafeCreator::create(impl->currentTranslate()); +} + +unsigned long SVGSVGElement::suspendRedraw(unsigned long time) +{ + if(!impl) return 0; + return impl->suspendRedraw(time); +} + +void SVGSVGElement::unsuspendRedraw(unsigned long id) +{ + if(impl) + impl->unsuspendRedraw(id); +} + +void SVGSVGElement::unsuspendRedrawAll() +{ + if(impl) + impl->unsuspendRedrawAll(); +} + +void SVGSVGElement::forceRedraw() +{ + if(impl) + impl->forceRedraw(); +} + +void SVGSVGElement::pauseAnimations() +{ + if(impl) + impl->pauseAnimations(); +} + +void SVGSVGElement::unpauseAnimations() +{ + if(impl) + impl->unpauseAnimations(); +} + +bool SVGSVGElement::animationsPaused() +{ + if(!impl) return false; + return impl->animationsPaused(); +} + +float SVGSVGElement::getCurrentTime() +{ + if(!impl) return -1; + return impl->getCurrentTime(); +} + +void SVGSVGElement::setCurrentTime(float time) +{ + if(impl) + impl->setCurrentTime(time); +} + +DOM::NodeList SVGSVGElement::getIntersectionList(const SVGRect &rect,const SVGElement &referenceElement) +{ + if(!impl) return DOM::NodeList(); + return impl->getIntersectionList(rect.handle(), referenceElement.handle()); +} + +DOM::NodeList SVGSVGElement::getEnclosureList(const SVGRect &rect,const SVGElement &referenceElement) +{ + if(!impl) return DOM::NodeList(); + return impl->getEnclosureList(rect.handle(), referenceElement.handle()); +} + +bool SVGSVGElement::checkIntersection(const SVGElement &element,const SVGRect &rect) +{ + if(!impl) return false; + return impl->checkIntersection(element.handle(), rect.handle()); +} + +bool SVGSVGElement::checkEnclosure(const SVGElement &element,const SVGRect &rect) +{ + if(!impl) return false; + return impl->checkEnclosure(element.handle(), rect.handle()); +} + +void SVGSVGElement::deSelectAll() +{ + if(impl) + impl->deSelectAll(); +} + +SVGNumber SVGSVGElement::createSVGNumber() +{ + if(!impl) return SVGNumber(0); + return SVGSafeCreator::create(impl->createSVGNumber()); +} + +SVGLength SVGSVGElement::createSVGLength() +{ + if(!impl) return SVGLength(0); + return SVGSafeCreator::create(impl->createSVGLength()); +} + +SVGAngle SVGSVGElement::createSVGAngle() +{ + if(!impl) return SVGAngle(0); + return SVGSafeCreator::create(impl->createSVGAngle()); +} + +SVGPoint SVGSVGElement::createSVGPoint() +{ + if(!impl) return SVGPoint(0); + return SVGSafeCreator::create(impl->createSVGPoint()); +} + +SVGMatrix SVGSVGElement::createSVGMatrix() +{ + if(!impl) return SVGMatrix(0); + return SVGSafeCreator::create(impl->createSVGMatrix()); +} + +SVGRect SVGSVGElement::createSVGRect() +{ + if(!impl) return SVGRect(0); + return SVGSafeCreator::create(impl->createSVGRect()); +} + +SVGTransform SVGSVGElement::createSVGTransform() +{ + if(!impl) return SVGTransform(0); + return SVGSafeCreator::create(impl->createSVGTransform()); +} + +SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix &matrix) +{ + if(!impl) return SVGTransform(0); + return SVGSafeCreator::create(impl->createSVGTransformFromMatrix(matrix.handle())); +} + +SVGElement SVGSVGElement::getElementById(const DOM::DOMString &elementId) +{ + if(!impl) return SVGElement(0); + return SVGSafeCreator::create(impl->getElementById(elementId)); +} diff --git a/ksvg/dom/SVGScriptElement.cc b/ksvg/dom/SVGScriptElement.cc deleted file mode 100644 index 48974905..00000000 --- a/ksvg/dom/SVGScriptElement.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGScriptElement.h" -#include "SVGScriptElementImpl.h" - -using namespace KSVG; - -SVGScriptElement::SVGScriptElement() : SVGElement(), SVGURIReference(), SVGExternalResourcesRequired() -{ - impl = 0; -} - -SVGScriptElement::SVGScriptElement(const SVGScriptElement &other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), impl(0) -{ - (*this) = other; -} - -SVGScriptElement &SVGScriptElement::operator =(const SVGScriptElement &other) -{ - SVGElement::operator=(other); - SVGURIReference::operator=(other); - SVGExternalResourcesRequired::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGScriptElement::SVGScriptElement(SVGScriptElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGScriptElement::~SVGScriptElement() -{ - if(impl) - impl->deref(); -} - -void SVGScriptElement::setType(const DOM::DOMString &type) -{ - if(impl) - impl->setType(type); -} - -DOM::DOMString SVGScriptElement::type() const -{ - if(!impl) return DOM::DOMString(); - return impl->type(); -} diff --git a/ksvg/dom/SVGScriptElement.cpp b/ksvg/dom/SVGScriptElement.cpp new file mode 100644 index 00000000..48974905 --- /dev/null +++ b/ksvg/dom/SVGScriptElement.cpp @@ -0,0 +1,79 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGScriptElement.h" +#include "SVGScriptElementImpl.h" + +using namespace KSVG; + +SVGScriptElement::SVGScriptElement() : SVGElement(), SVGURIReference(), SVGExternalResourcesRequired() +{ + impl = 0; +} + +SVGScriptElement::SVGScriptElement(const SVGScriptElement &other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other), impl(0) +{ + (*this) = other; +} + +SVGScriptElement &SVGScriptElement::operator =(const SVGScriptElement &other) +{ + SVGElement::operator=(other); + SVGURIReference::operator=(other); + SVGExternalResourcesRequired::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGScriptElement::SVGScriptElement(SVGScriptElementImpl *other) : SVGElement(other), SVGURIReference(other), SVGExternalResourcesRequired(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGScriptElement::~SVGScriptElement() +{ + if(impl) + impl->deref(); +} + +void SVGScriptElement::setType(const DOM::DOMString &type) +{ + if(impl) + impl->setType(type); +} + +DOM::DOMString SVGScriptElement::type() const +{ + if(!impl) return DOM::DOMString(); + return impl->type(); +} diff --git a/ksvg/dom/SVGSetElement.cc b/ksvg/dom/SVGSetElement.cc deleted file mode 100644 index 9dff9064..00000000 --- a/ksvg/dom/SVGSetElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGSetElement.h" -#include "SVGSetElementImpl.h" - -using namespace KSVG; - -SVGSetElement::SVGSetElement() : SVGAnimationElement() -{ - impl = 0; -} - -SVGSetElement::SVGSetElement(const SVGSetElement &other) : SVGAnimationElement(other), impl(0) -{ - (*this) = other; -} - -SVGSetElement &SVGSetElement::operator =(const SVGSetElement &other) -{ - SVGAnimationElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGSetElement::SVGSetElement(SVGSetElementImpl *other) : SVGAnimationElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGSetElement::~SVGSetElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGSetElement.cpp b/ksvg/dom/SVGSetElement.cpp new file mode 100644 index 00000000..9dff9064 --- /dev/null +++ b/ksvg/dom/SVGSetElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGSetElement.h" +#include "SVGSetElementImpl.h" + +using namespace KSVG; + +SVGSetElement::SVGSetElement() : SVGAnimationElement() +{ + impl = 0; +} + +SVGSetElement::SVGSetElement(const SVGSetElement &other) : SVGAnimationElement(other), impl(0) +{ + (*this) = other; +} + +SVGSetElement &SVGSetElement::operator =(const SVGSetElement &other) +{ + SVGAnimationElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGSetElement::SVGSetElement(SVGSetElementImpl *other) : SVGAnimationElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGSetElement::~SVGSetElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGStopElement.cc b/ksvg/dom/SVGStopElement.cc deleted file mode 100644 index 1288a49e..00000000 --- a/ksvg/dom/SVGStopElement.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGStopElement.h" -#include "SVGStopElementImpl.h" -#include "SVGAnimatedNumber.h" - -using namespace KSVG; - -SVGStopElement::SVGStopElement() : SVGElement(), SVGStylable() -{ - impl = 0; -} - -SVGStopElement::SVGStopElement(const SVGStopElement &other) : SVGElement(other), SVGStylable(other), impl(0) -{ - (*this) = other; -} - -SVGStopElement &SVGStopElement::operator =(const SVGStopElement &other) -{ - SVGElement::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGStopElement::SVGStopElement(SVGStopElementImpl *other) : SVGElement(other), SVGStylable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGStopElement::~SVGStopElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedNumber SVGStopElement::offset() const -{ - if(!impl) return SVGAnimatedNumber(0); - return SVGAnimatedNumber(impl->offset()); -} diff --git a/ksvg/dom/SVGStopElement.cpp b/ksvg/dom/SVGStopElement.cpp new file mode 100644 index 00000000..1288a49e --- /dev/null +++ b/ksvg/dom/SVGStopElement.cpp @@ -0,0 +1,73 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGStopElement.h" +#include "SVGStopElementImpl.h" +#include "SVGAnimatedNumber.h" + +using namespace KSVG; + +SVGStopElement::SVGStopElement() : SVGElement(), SVGStylable() +{ + impl = 0; +} + +SVGStopElement::SVGStopElement(const SVGStopElement &other) : SVGElement(other), SVGStylable(other), impl(0) +{ + (*this) = other; +} + +SVGStopElement &SVGStopElement::operator =(const SVGStopElement &other) +{ + SVGElement::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGStopElement::SVGStopElement(SVGStopElementImpl *other) : SVGElement(other), SVGStylable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGStopElement::~SVGStopElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedNumber SVGStopElement::offset() const +{ + if(!impl) return SVGAnimatedNumber(0); + return SVGAnimatedNumber(impl->offset()); +} diff --git a/ksvg/dom/SVGStringList.cc b/ksvg/dom/SVGStringList.cc deleted file mode 100644 index de9527f3..00000000 --- a/ksvg/dom/SVGStringList.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGStringList.h" -#include "SVGStringListImpl.h" - -using namespace KSVG; - -SVGStringList::SVGStringList() -{ - impl = new SVGStringListImpl(); - impl->ref(); -} - -SVGStringList::SVGStringList(const SVGStringList &other) : impl(0) -{ - (*this) = other; -} - -SVGStringList &SVGStringList::operator=(const SVGStringList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGStringList::SVGStringList(SVGStringListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGStringList::~SVGStringList() -{ - if(impl) - impl->deref(); -} - -unsigned long SVGStringList::numberOfItems() const -{ - if(!impl) return 0; - return impl->numberOfItems(); -} - -void SVGStringList::clear() -{ - if(impl) - impl->clear(); -} - -DOM::DOMString *SVGStringList::initialize(DOM::DOMString *newItem) -{ - if(!impl) return new DOM::DOMString(); - return impl->initialize(new SharedString(newItem)); -} - -DOM::DOMString *SVGStringList::getItem(unsigned long index) -{ - if(!impl) return new DOM::DOMString(); - return impl->getItem(index); -} - -DOM::DOMString *SVGStringList::insertItemBefore(DOM::DOMString *newItem, unsigned long index) -{ - if(!impl) return new DOM::DOMString(); - return impl->insertItemBefore(new SharedString(newItem), index); -} - -DOM::DOMString *SVGStringList::replaceItem(DOM::DOMString *newItem, unsigned long index) -{ - if(!impl) return new DOM::DOMString(); - return impl->replaceItem(new SharedString(newItem), index); -} - -DOM::DOMString *SVGStringList::removeItem(unsigned long index) -{ - if(!impl) return new DOM::DOMString(); - return impl->removeItem(index); -} - -DOM::DOMString *SVGStringList::appendItem(DOM::DOMString *newItem) -{ - if(!impl) return new DOM::DOMString(); - return impl->appendItem(new SharedString(newItem)); -} diff --git a/ksvg/dom/SVGStringList.cpp b/ksvg/dom/SVGStringList.cpp new file mode 100644 index 00000000..de9527f3 --- /dev/null +++ b/ksvg/dom/SVGStringList.cpp @@ -0,0 +1,113 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGStringList.h" +#include "SVGStringListImpl.h" + +using namespace KSVG; + +SVGStringList::SVGStringList() +{ + impl = new SVGStringListImpl(); + impl->ref(); +} + +SVGStringList::SVGStringList(const SVGStringList &other) : impl(0) +{ + (*this) = other; +} + +SVGStringList &SVGStringList::operator=(const SVGStringList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGStringList::SVGStringList(SVGStringListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGStringList::~SVGStringList() +{ + if(impl) + impl->deref(); +} + +unsigned long SVGStringList::numberOfItems() const +{ + if(!impl) return 0; + return impl->numberOfItems(); +} + +void SVGStringList::clear() +{ + if(impl) + impl->clear(); +} + +DOM::DOMString *SVGStringList::initialize(DOM::DOMString *newItem) +{ + if(!impl) return new DOM::DOMString(); + return impl->initialize(new SharedString(newItem)); +} + +DOM::DOMString *SVGStringList::getItem(unsigned long index) +{ + if(!impl) return new DOM::DOMString(); + return impl->getItem(index); +} + +DOM::DOMString *SVGStringList::insertItemBefore(DOM::DOMString *newItem, unsigned long index) +{ + if(!impl) return new DOM::DOMString(); + return impl->insertItemBefore(new SharedString(newItem), index); +} + +DOM::DOMString *SVGStringList::replaceItem(DOM::DOMString *newItem, unsigned long index) +{ + if(!impl) return new DOM::DOMString(); + return impl->replaceItem(new SharedString(newItem), index); +} + +DOM::DOMString *SVGStringList::removeItem(unsigned long index) +{ + if(!impl) return new DOM::DOMString(); + return impl->removeItem(index); +} + +DOM::DOMString *SVGStringList::appendItem(DOM::DOMString *newItem) +{ + if(!impl) return new DOM::DOMString(); + return impl->appendItem(new SharedString(newItem)); +} diff --git a/ksvg/dom/SVGStylable.cc b/ksvg/dom/SVGStylable.cc deleted file mode 100644 index 9092c981..00000000 --- a/ksvg/dom/SVGStylable.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGStylable.h" -#include "SVGStylableImpl.h" -#include - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGStylable::SVGStylable() -{ - impl = 0; -} - -SVGStylable::SVGStylable(const SVGStylable &other) : impl(0) -{ - (*this) = other; -} - -SVGStylable &SVGStylable::operator=(const SVGStylable &other) -{ - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGStylable::SVGStylable(SVGStylableImpl *other) -{ - impl = other; -} - -SVGStylable::~SVGStylable() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -/* -SVGAnimatedString SVGStylable::className() const -{ - return impl->className(); -} - -css::CSSStyleDeclaration SVGStylable::style() const -{ - return impl->style(); -} - -css::CSSValue SVGStylable::getPresentationAttribute(const DOMString &name) -{ - return impl->getPresentationAttribute(name); -} -*/ diff --git a/ksvg/dom/SVGStylable.cpp b/ksvg/dom/SVGStylable.cpp new file mode 100644 index 00000000..9092c981 --- /dev/null +++ b/ksvg/dom/SVGStylable.cpp @@ -0,0 +1,74 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGStylable.h" +#include "SVGStylableImpl.h" +#include + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGStylable::SVGStylable() +{ + impl = 0; +} + +SVGStylable::SVGStylable(const SVGStylable &other) : impl(0) +{ + (*this) = other; +} + +SVGStylable &SVGStylable::operator=(const SVGStylable &other) +{ + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGStylable::SVGStylable(SVGStylableImpl *other) +{ + impl = other; +} + +SVGStylable::~SVGStylable() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +/* +SVGAnimatedString SVGStylable::className() const +{ + return impl->className(); +} + +css::CSSStyleDeclaration SVGStylable::style() const +{ + return impl->style(); +} + +css::CSSValue SVGStylable::getPresentationAttribute(const DOMString &name) +{ + return impl->getPresentationAttribute(name); +} +*/ diff --git a/ksvg/dom/SVGStyleElement.cc b/ksvg/dom/SVGStyleElement.cc deleted file mode 100644 index 7e734336..00000000 --- a/ksvg/dom/SVGStyleElement.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGStyleElement.h" -#include "SVGStyleElementImpl.h" - -using namespace KSVG; - -SVGStyleElement::SVGStyleElement() : SVGElement() -{ - impl = 0; -} - -SVGStyleElement::SVGStyleElement(const SVGStyleElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGStyleElement &SVGStyleElement::operator =(const SVGStyleElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGStyleElement::SVGStyleElement(SVGStyleElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGStyleElement::~SVGStyleElement() -{ - if(impl) - impl->deref(); -} - -void SVGStyleElement::setXmlspace(const DOM::DOMString &xmlspace) -{ - if(impl) - impl->setXmlspace(xmlspace); -} - -DOM::DOMString SVGStyleElement::xmlspace() const -{ - if(!impl) return DOM::DOMString(); - return impl->xmlspace(); -} - -void SVGStyleElement::setType(const DOM::DOMString &type) -{ - if(impl) - impl->setType(type); -} - -DOM::DOMString SVGStyleElement::type() const -{ - if(!impl) return DOM::DOMString(); - return impl->type(); -} - -void SVGStyleElement::setMedia(const DOM::DOMString &media) -{ - if(impl) - impl->setMedia(media); -} - -DOM::DOMString SVGStyleElement::media() const -{ - if(!impl) return DOM::DOMString(); - return impl->media(); -} - -void SVGStyleElement::setTitle(const DOM::DOMString &title) -{ - if(impl) - impl->setTitle(title); -} - -DOM::DOMString SVGStyleElement::title() const -{ - if(!impl) return DOM::DOMString(); - return impl->title(); -} diff --git a/ksvg/dom/SVGStyleElement.cpp b/ksvg/dom/SVGStyleElement.cpp new file mode 100644 index 00000000..7e734336 --- /dev/null +++ b/ksvg/dom/SVGStyleElement.cpp @@ -0,0 +1,113 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGStyleElement.h" +#include "SVGStyleElementImpl.h" + +using namespace KSVG; + +SVGStyleElement::SVGStyleElement() : SVGElement() +{ + impl = 0; +} + +SVGStyleElement::SVGStyleElement(const SVGStyleElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGStyleElement &SVGStyleElement::operator =(const SVGStyleElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGStyleElement::SVGStyleElement(SVGStyleElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGStyleElement::~SVGStyleElement() +{ + if(impl) + impl->deref(); +} + +void SVGStyleElement::setXmlspace(const DOM::DOMString &xmlspace) +{ + if(impl) + impl->setXmlspace(xmlspace); +} + +DOM::DOMString SVGStyleElement::xmlspace() const +{ + if(!impl) return DOM::DOMString(); + return impl->xmlspace(); +} + +void SVGStyleElement::setType(const DOM::DOMString &type) +{ + if(impl) + impl->setType(type); +} + +DOM::DOMString SVGStyleElement::type() const +{ + if(!impl) return DOM::DOMString(); + return impl->type(); +} + +void SVGStyleElement::setMedia(const DOM::DOMString &media) +{ + if(impl) + impl->setMedia(media); +} + +DOM::DOMString SVGStyleElement::media() const +{ + if(!impl) return DOM::DOMString(); + return impl->media(); +} + +void SVGStyleElement::setTitle(const DOM::DOMString &title) +{ + if(impl) + impl->setTitle(title); +} + +DOM::DOMString SVGStyleElement::title() const +{ + if(!impl) return DOM::DOMString(); + return impl->title(); +} diff --git a/ksvg/dom/SVGSwitchElement.cc b/ksvg/dom/SVGSwitchElement.cc deleted file mode 100644 index ecaa2a1c..00000000 --- a/ksvg/dom/SVGSwitchElement.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGSwitchElement.h" -#include "SVGSwitchElementImpl.h" - -using namespace KSVG; - -SVGSwitchElement::SVGSwitchElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() -{ - impl = 0; -} - -SVGSwitchElement::SVGSwitchElement(const SVGSwitchElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) -{ - (*this) = other; -} - -SVGSwitchElement &SVGSwitchElement::operator =(const SVGSwitchElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGSwitchElement::SVGSwitchElement(SVGSwitchElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGSwitchElement::~SVGSwitchElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGSwitchElement.cpp b/ksvg/dom/SVGSwitchElement.cpp new file mode 100644 index 00000000..ecaa2a1c --- /dev/null +++ b/ksvg/dom/SVGSwitchElement.cpp @@ -0,0 +1,70 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGSwitchElement.h" +#include "SVGSwitchElementImpl.h" + +using namespace KSVG; + +SVGSwitchElement::SVGSwitchElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable() +{ + impl = 0; +} + +SVGSwitchElement::SVGSwitchElement(const SVGSwitchElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), impl(0) +{ + (*this) = other; +} + +SVGSwitchElement &SVGSwitchElement::operator =(const SVGSwitchElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGSwitchElement::SVGSwitchElement(SVGSwitchElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGSwitchElement::~SVGSwitchElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGSymbolElement.cc b/ksvg/dom/SVGSymbolElement.cc deleted file mode 100644 index 9b8d89f5..00000000 --- a/ksvg/dom/SVGSymbolElement.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGSymbolElement.h" -#include "SVGSymbolElementImpl.h" - -using namespace KSVG; - -SVGSymbolElement::SVGSymbolElement() : SVGElement(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFitToViewBox() -{ - impl = 0; -} - -SVGSymbolElement::SVGSymbolElement(const SVGSymbolElement &other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), impl(0) -{ - (*this) = other; -} - -SVGSymbolElement &SVGSymbolElement::operator =(const SVGSymbolElement &other) -{ - SVGElement::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGFitToViewBox::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGSymbolElement::SVGSymbolElement(SVGSymbolElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGSymbolElement::~SVGSymbolElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGSymbolElement.cpp b/ksvg/dom/SVGSymbolElement.cpp new file mode 100644 index 00000000..9b8d89f5 --- /dev/null +++ b/ksvg/dom/SVGSymbolElement.cpp @@ -0,0 +1,69 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGSymbolElement.h" +#include "SVGSymbolElementImpl.h" + +using namespace KSVG; + +SVGSymbolElement::SVGSymbolElement() : SVGElement(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGFitToViewBox() +{ + impl = 0; +} + +SVGSymbolElement::SVGSymbolElement(const SVGSymbolElement &other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other), impl(0) +{ + (*this) = other; +} + +SVGSymbolElement &SVGSymbolElement::operator =(const SVGSymbolElement &other) +{ + SVGElement::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGFitToViewBox::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGSymbolElement::SVGSymbolElement(SVGSymbolElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGFitToViewBox(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGSymbolElement::~SVGSymbolElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGTRefElement.cc b/ksvg/dom/SVGTRefElement.cc deleted file mode 100644 index f987e3aa..00000000 --- a/ksvg/dom/SVGTRefElement.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTRefElement.h" -#include "SVGTRefElementImpl.h" - -using namespace KSVG; - -SVGTRefElement::SVGTRefElement() : SVGTextPositioningElement(), SVGURIReference() -{ - impl = 0; -} - -SVGTRefElement::SVGTRefElement(const SVGTRefElement &other) : SVGTextPositioningElement(other), SVGURIReference(other), impl(0) -{ - (*this) = other; -} - -SVGTRefElement &SVGTRefElement::operator =(const SVGTRefElement &other) -{ - SVGTextPositioningElement::operator=(other); - SVGURIReference::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGTRefElement::SVGTRefElement(SVGTRefElementImpl *other) : SVGTextPositioningElement(other), SVGURIReference(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGTRefElement::~SVGTRefElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGTRefElement.cpp b/ksvg/dom/SVGTRefElement.cpp new file mode 100644 index 00000000..f987e3aa --- /dev/null +++ b/ksvg/dom/SVGTRefElement.cpp @@ -0,0 +1,66 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTRefElement.h" +#include "SVGTRefElementImpl.h" + +using namespace KSVG; + +SVGTRefElement::SVGTRefElement() : SVGTextPositioningElement(), SVGURIReference() +{ + impl = 0; +} + +SVGTRefElement::SVGTRefElement(const SVGTRefElement &other) : SVGTextPositioningElement(other), SVGURIReference(other), impl(0) +{ + (*this) = other; +} + +SVGTRefElement &SVGTRefElement::operator =(const SVGTRefElement &other) +{ + SVGTextPositioningElement::operator=(other); + SVGURIReference::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGTRefElement::SVGTRefElement(SVGTRefElementImpl *other) : SVGTextPositioningElement(other), SVGURIReference(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGTRefElement::~SVGTRefElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGTSpanElement.cc b/ksvg/dom/SVGTSpanElement.cc deleted file mode 100644 index 6a2cf66c..00000000 --- a/ksvg/dom/SVGTSpanElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTSpanElement.h" -#include "SVGTSpanElementImpl.h" - -using namespace KSVG; - -SVGTSpanElement::SVGTSpanElement() : SVGTextPositioningElement() -{ - impl = 0; -} - -SVGTSpanElement::SVGTSpanElement(const SVGTSpanElement &other) : SVGTextPositioningElement(other), impl(0) -{ - (*this) = other; -} - -SVGTSpanElement &SVGTSpanElement::operator =(const SVGTSpanElement &other) -{ - SVGTextPositioningElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGTSpanElement::SVGTSpanElement(SVGTSpanElementImpl *other) : SVGTextPositioningElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGTSpanElement::~SVGTSpanElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGTSpanElement.cpp b/ksvg/dom/SVGTSpanElement.cpp new file mode 100644 index 00000000..6a2cf66c --- /dev/null +++ b/ksvg/dom/SVGTSpanElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTSpanElement.h" +#include "SVGTSpanElementImpl.h" + +using namespace KSVG; + +SVGTSpanElement::SVGTSpanElement() : SVGTextPositioningElement() +{ + impl = 0; +} + +SVGTSpanElement::SVGTSpanElement(const SVGTSpanElement &other) : SVGTextPositioningElement(other), impl(0) +{ + (*this) = other; +} + +SVGTSpanElement &SVGTSpanElement::operator =(const SVGTSpanElement &other) +{ + SVGTextPositioningElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGTSpanElement::SVGTSpanElement(SVGTSpanElementImpl *other) : SVGTextPositioningElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGTSpanElement::~SVGTSpanElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGTests.cc b/ksvg/dom/SVGTests.cc deleted file mode 100644 index 145da6af..00000000 --- a/ksvg/dom/SVGTests.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTests.h" -#include "SVGTestsImpl.h" -#include "SVGStringList.h" - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGTests::SVGTests() -{ - impl = 0; -} - -SVGTests::SVGTests(const SVGTests &other) : impl(0) -{ - (*this) = other; -} - -SVGTests &SVGTests::operator=(const SVGTests &other) -{ - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGTests::SVGTests(SVGTestsImpl *other) -{ - impl = other; -} - -SVGTests::~SVGTests() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -SVGStringList SVGTests::requiredFeatures() const -{ - if(!impl) return SVGStringList(0); - return SVGStringList(impl->requiredFeatures()); -} - -SVGStringList SVGTests::requiredExtensions() const -{ - if(!impl) return SVGStringList(0); - return SVGStringList(impl->requiredExtensions()); -} - -SVGStringList SVGTests::systemLanguage() const -{ - if(!impl) return SVGStringList(0); - return SVGStringList(impl->systemLanguage()); -} - -bool SVGTests::hasExtension(const DOM::DOMString &extension) -{ - if(!impl) return false; - return impl->hasExtension(extension); -} diff --git a/ksvg/dom/SVGTests.cpp b/ksvg/dom/SVGTests.cpp new file mode 100644 index 00000000..145da6af --- /dev/null +++ b/ksvg/dom/SVGTests.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTests.h" +#include "SVGTestsImpl.h" +#include "SVGStringList.h" + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGTests::SVGTests() +{ + impl = 0; +} + +SVGTests::SVGTests(const SVGTests &other) : impl(0) +{ + (*this) = other; +} + +SVGTests &SVGTests::operator=(const SVGTests &other) +{ + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGTests::SVGTests(SVGTestsImpl *other) +{ + impl = other; +} + +SVGTests::~SVGTests() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +SVGStringList SVGTests::requiredFeatures() const +{ + if(!impl) return SVGStringList(0); + return SVGStringList(impl->requiredFeatures()); +} + +SVGStringList SVGTests::requiredExtensions() const +{ + if(!impl) return SVGStringList(0); + return SVGStringList(impl->requiredExtensions()); +} + +SVGStringList SVGTests::systemLanguage() const +{ + if(!impl) return SVGStringList(0); + return SVGStringList(impl->systemLanguage()); +} + +bool SVGTests::hasExtension(const DOM::DOMString &extension) +{ + if(!impl) return false; + return impl->hasExtension(extension); +} diff --git a/ksvg/dom/SVGTextContentElement.cc b/ksvg/dom/SVGTextContentElement.cc deleted file mode 100644 index f40d23b6..00000000 --- a/ksvg/dom/SVGTextContentElement.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTextContentElement.h" -#include "SVGTextContentElementImpl.h" -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGTextContentElement::SVGTextContentElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable() -{ - impl = new SVGTextContentElementImpl(0); -} - -SVGTextContentElement::SVGTextContentElement(const SVGTextContentElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other) -{ - impl = other.impl; -} - -SVGTextContentElement &SVGTextContentElement::operator=(const SVGTextContentElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - delete impl; - impl = other.impl; - - return *this; -} - -SVGTextContentElement::SVGTextContentElement(SVGTextContentElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other) -{ - impl = other; -} - -SVGTextContentElement::~SVGTextContentElement() -{ -} - - -SVGAnimatedLength SVGTextContentElement::textLength() const -{ - return impl->textLength(); -} - -SVGAnimatedEnumeration SVGTextContentElement::lengthAdjust() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->lengthAdjust()); -} - -long SVGTextContentElement::getNumberOfChars() -{ - return impl->getNumberOfChars(); -} - -float SVGTextContentElement::getComputedTextLength() -{ - return impl->getComputedTextLength(); -} -/* -float SVGTextContentElement::getSubStringLength(const unsigned long &charnum, const unsigned long &nchars) -{ - return impl->getSubStringLength(charnum, nchars); -} - -SVGPoint SVGTextContentElement::getStartPositionOfChar(const unsigned long &charnum) -{ - return impl->getStartPositionOfChar(charnum); -} - -SVGPoint SVGTextContentElement::getEndPositionOfChar(const unsigned long &charnum) -{ - return impl->getEndPositionOfChar(charnum); -} - -SVGRect SVGTextContentElement::getExtentOfChar(const unsigned long &charnum) -{ - return impl->getExtentOfChar(charnum); -} - -float SVGTextContentElement::getRotationOfChar(const unsigned long &charnum) -{ - return impl->getRotationOfChar(charnum); -} - -long SVGTextContentElement::getCharNumAtPosition(const SVGPoint &point) -{ - return impl->getCharNumAtPosition(point); -} - -void SVGTextContentElement::selectSubString(const unsigned long &charnum, const unsigned long &nchars) -{ - return impl->selectSubString(charnum, nchars); -} -*/ diff --git a/ksvg/dom/SVGTextContentElement.cpp b/ksvg/dom/SVGTextContentElement.cpp new file mode 100644 index 00000000..f40d23b6 --- /dev/null +++ b/ksvg/dom/SVGTextContentElement.cpp @@ -0,0 +1,120 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTextContentElement.h" +#include "SVGTextContentElementImpl.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGTextContentElement::SVGTextContentElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable() +{ + impl = new SVGTextContentElementImpl(0); +} + +SVGTextContentElement::SVGTextContentElement(const SVGTextContentElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other) +{ + impl = other.impl; +} + +SVGTextContentElement &SVGTextContentElement::operator=(const SVGTextContentElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + delete impl; + impl = other.impl; + + return *this; +} + +SVGTextContentElement::SVGTextContentElement(SVGTextContentElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other) +{ + impl = other; +} + +SVGTextContentElement::~SVGTextContentElement() +{ +} + + +SVGAnimatedLength SVGTextContentElement::textLength() const +{ + return impl->textLength(); +} + +SVGAnimatedEnumeration SVGTextContentElement::lengthAdjust() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->lengthAdjust()); +} + +long SVGTextContentElement::getNumberOfChars() +{ + return impl->getNumberOfChars(); +} + +float SVGTextContentElement::getComputedTextLength() +{ + return impl->getComputedTextLength(); +} +/* +float SVGTextContentElement::getSubStringLength(const unsigned long &charnum, const unsigned long &nchars) +{ + return impl->getSubStringLength(charnum, nchars); +} + +SVGPoint SVGTextContentElement::getStartPositionOfChar(const unsigned long &charnum) +{ + return impl->getStartPositionOfChar(charnum); +} + +SVGPoint SVGTextContentElement::getEndPositionOfChar(const unsigned long &charnum) +{ + return impl->getEndPositionOfChar(charnum); +} + +SVGRect SVGTextContentElement::getExtentOfChar(const unsigned long &charnum) +{ + return impl->getExtentOfChar(charnum); +} + +float SVGTextContentElement::getRotationOfChar(const unsigned long &charnum) +{ + return impl->getRotationOfChar(charnum); +} + +long SVGTextContentElement::getCharNumAtPosition(const SVGPoint &point) +{ + return impl->getCharNumAtPosition(point); +} + +void SVGTextContentElement::selectSubString(const unsigned long &charnum, const unsigned long &nchars) +{ + return impl->selectSubString(charnum, nchars); +} +*/ diff --git a/ksvg/dom/SVGTextElement.cc b/ksvg/dom/SVGTextElement.cc deleted file mode 100644 index b80a148a..00000000 --- a/ksvg/dom/SVGTextElement.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGTextElement.h" -#include "SVGTextElementImpl.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGTextElement::SVGTextElement() : SVGTextPositioningElement(), SVGTransformable() -{ - impl = 0; -} - -SVGTextElement::SVGTextElement(const SVGTextElement &other) : SVGTextPositioningElement(other), SVGTransformable(other) -{ - (*this) = other; -} - -SVGTextElement &SVGTextElement::operator =(const SVGTextElement &other) -{ - SVGTextPositioningElement::operator=(other); - SVGTransformable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGTextElement::SVGTextElement(SVGTextElementImpl *other) : SVGTextPositioningElement(other), SVGTransformable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGTextElement::~SVGTextElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGTextElement.cpp b/ksvg/dom/SVGTextElement.cpp new file mode 100644 index 00000000..b80a148a --- /dev/null +++ b/ksvg/dom/SVGTextElement.cpp @@ -0,0 +1,68 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGTextElement.h" +#include "SVGTextElementImpl.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGTextElement::SVGTextElement() : SVGTextPositioningElement(), SVGTransformable() +{ + impl = 0; +} + +SVGTextElement::SVGTextElement(const SVGTextElement &other) : SVGTextPositioningElement(other), SVGTransformable(other) +{ + (*this) = other; +} + +SVGTextElement &SVGTextElement::operator =(const SVGTextElement &other) +{ + SVGTextPositioningElement::operator=(other); + SVGTransformable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGTextElement::SVGTextElement(SVGTextElementImpl *other) : SVGTextPositioningElement(other), SVGTransformable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGTextElement::~SVGTextElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGTextPathElement.cc b/ksvg/dom/SVGTextPathElement.cc deleted file mode 100644 index 09d26e20..00000000 --- a/ksvg/dom/SVGTextPathElement.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTextPathElement.h" -#include "SVGTextPathElementImpl.h" -#include "SVGAnimatedEnumeration.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGTextPathElement::SVGTextPathElement() : SVGTextContentElement(), SVGURIReference() -{ - impl = new SVGTextPathElementImpl(0); - impl->ref(); -} - -SVGTextPathElement::SVGTextPathElement(const SVGTextPathElement &other) : SVGTextContentElement(other), SVGURIReference(other), impl(0) -{ - (*this) = other; -} - -SVGTextPathElement &SVGTextPathElement::operator =(const SVGTextPathElement &other) -{ - SVGTextContentElement::operator=(other); - SVGURIReference::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGTextPathElement::SVGTextPathElement(SVGTextPathElementImpl *other) : SVGTextContentElement(other), SVGURIReference(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGTextPathElement::~SVGTextPathElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGTextPathElement::startOffset() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->startOffset()); -} - -SVGAnimatedEnumeration SVGTextPathElement::method() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->method()); -} - -SVGAnimatedEnumeration SVGTextPathElement::spacing() const -{ - if(!impl) return SVGAnimatedEnumeration(0); - return SVGAnimatedEnumeration(impl->spacing()); -} diff --git a/ksvg/dom/SVGTextPathElement.cpp b/ksvg/dom/SVGTextPathElement.cpp new file mode 100644 index 00000000..09d26e20 --- /dev/null +++ b/ksvg/dom/SVGTextPathElement.cpp @@ -0,0 +1,87 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTextPathElement.h" +#include "SVGTextPathElementImpl.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGTextPathElement::SVGTextPathElement() : SVGTextContentElement(), SVGURIReference() +{ + impl = new SVGTextPathElementImpl(0); + impl->ref(); +} + +SVGTextPathElement::SVGTextPathElement(const SVGTextPathElement &other) : SVGTextContentElement(other), SVGURIReference(other), impl(0) +{ + (*this) = other; +} + +SVGTextPathElement &SVGTextPathElement::operator =(const SVGTextPathElement &other) +{ + SVGTextContentElement::operator=(other); + SVGURIReference::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGTextPathElement::SVGTextPathElement(SVGTextPathElementImpl *other) : SVGTextContentElement(other), SVGURIReference(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGTextPathElement::~SVGTextPathElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGTextPathElement::startOffset() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->startOffset()); +} + +SVGAnimatedEnumeration SVGTextPathElement::method() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->method()); +} + +SVGAnimatedEnumeration SVGTextPathElement::spacing() const +{ + if(!impl) return SVGAnimatedEnumeration(0); + return SVGAnimatedEnumeration(impl->spacing()); +} diff --git a/ksvg/dom/SVGTextPositioningElement.cc b/ksvg/dom/SVGTextPositioningElement.cc deleted file mode 100644 index 6ce7d346..00000000 --- a/ksvg/dom/SVGTextPositioningElement.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGTextPositioningElement.h" -#include "SVGTextPositioningElementImpl.h" -#include "SVGAnimatedNumber.h" -#include "SVGAnimatedNumberList.h" -#include "SVGAnimatedLength.h" -#include "SVGAnimatedLengthList.h" - -using namespace KSVG; - -SVGTextPositioningElement::SVGTextPositioningElement() : SVGTextContentElement() -{ - impl = new SVGTextPositioningElementImpl(0); -} - -SVGTextPositioningElement::SVGTextPositioningElement(const SVGTextPositioningElement &other) : SVGTextContentElement(other) -{ - impl = other.impl; -} - -SVGTextPositioningElement &SVGTextPositioningElement::operator=(const SVGTextPositioningElement &other) -{ - SVGTextContentElement::operator=(other); - - if(impl == other.impl) - return *this; - - delete impl; - impl = other.impl; - - return *this; -} -SVGTextPositioningElement::SVGTextPositioningElement(SVGTextPositioningElementImpl *other) : SVGTextContentElement(other) -{ - impl = other; -} - -SVGTextPositioningElement::~SVGTextPositioningElement() -{ -} - -SVGAnimatedLengthList SVGTextPositioningElement::x() -{ - return SVGAnimatedLengthList(impl->x()); -} - -SVGAnimatedLengthList SVGTextPositioningElement::y() -{ - return SVGAnimatedLengthList(impl->y()); -} - -SVGAnimatedLengthList SVGTextPositioningElement::dx() -{ - return SVGAnimatedLengthList(impl->dx()); -} - -SVGAnimatedLengthList SVGTextPositioningElement::dy() -{ - return SVGAnimatedLengthList(impl->dy()); -} - -SVGAnimatedNumberList SVGTextPositioningElement::rotate() -{ - return SVGAnimatedNumberList(impl->rotate()); -} diff --git a/ksvg/dom/SVGTextPositioningElement.cpp b/ksvg/dom/SVGTextPositioningElement.cpp new file mode 100644 index 00000000..6ce7d346 --- /dev/null +++ b/ksvg/dom/SVGTextPositioningElement.cpp @@ -0,0 +1,85 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGTextPositioningElement.h" +#include "SVGTextPositioningElementImpl.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedNumberList.h" +#include "SVGAnimatedLength.h" +#include "SVGAnimatedLengthList.h" + +using namespace KSVG; + +SVGTextPositioningElement::SVGTextPositioningElement() : SVGTextContentElement() +{ + impl = new SVGTextPositioningElementImpl(0); +} + +SVGTextPositioningElement::SVGTextPositioningElement(const SVGTextPositioningElement &other) : SVGTextContentElement(other) +{ + impl = other.impl; +} + +SVGTextPositioningElement &SVGTextPositioningElement::operator=(const SVGTextPositioningElement &other) +{ + SVGTextContentElement::operator=(other); + + if(impl == other.impl) + return *this; + + delete impl; + impl = other.impl; + + return *this; +} +SVGTextPositioningElement::SVGTextPositioningElement(SVGTextPositioningElementImpl *other) : SVGTextContentElement(other) +{ + impl = other; +} + +SVGTextPositioningElement::~SVGTextPositioningElement() +{ +} + +SVGAnimatedLengthList SVGTextPositioningElement::x() +{ + return SVGAnimatedLengthList(impl->x()); +} + +SVGAnimatedLengthList SVGTextPositioningElement::y() +{ + return SVGAnimatedLengthList(impl->y()); +} + +SVGAnimatedLengthList SVGTextPositioningElement::dx() +{ + return SVGAnimatedLengthList(impl->dx()); +} + +SVGAnimatedLengthList SVGTextPositioningElement::dy() +{ + return SVGAnimatedLengthList(impl->dy()); +} + +SVGAnimatedNumberList SVGTextPositioningElement::rotate() +{ + return SVGAnimatedNumberList(impl->rotate()); +} diff --git a/ksvg/dom/SVGTitleElement.cc b/ksvg/dom/SVGTitleElement.cc deleted file mode 100644 index 9c301d10..00000000 --- a/ksvg/dom/SVGTitleElement.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTitleElement.h" -#include "SVGTitleElementImpl.h" - -using namespace KSVG; - -SVGTitleElement::SVGTitleElement() : SVGElement(), SVGLangSpace(), SVGStylable() -{ - impl = 0; -} - -SVGTitleElement::SVGTitleElement(const SVGTitleElement &other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other), impl(0) -{ - (*this) = other; -} - -SVGTitleElement &SVGTitleElement::operator =(const SVGTitleElement &other) -{ - SVGElement::operator=(other); - SVGLangSpace::operator=(other); - SVGStylable::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGTitleElement::SVGTitleElement(SVGTitleElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGTitleElement::~SVGTitleElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGTitleElement.cpp b/ksvg/dom/SVGTitleElement.cpp new file mode 100644 index 00000000..9c301d10 --- /dev/null +++ b/ksvg/dom/SVGTitleElement.cpp @@ -0,0 +1,67 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTitleElement.h" +#include "SVGTitleElementImpl.h" + +using namespace KSVG; + +SVGTitleElement::SVGTitleElement() : SVGElement(), SVGLangSpace(), SVGStylable() +{ + impl = 0; +} + +SVGTitleElement::SVGTitleElement(const SVGTitleElement &other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other), impl(0) +{ + (*this) = other; +} + +SVGTitleElement &SVGTitleElement::operator =(const SVGTitleElement &other) +{ + SVGElement::operator=(other); + SVGLangSpace::operator=(other); + SVGStylable::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGTitleElement::SVGTitleElement(SVGTitleElementImpl *other) : SVGElement(other), SVGLangSpace(other), SVGStylable(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGTitleElement::~SVGTitleElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGTransform.cc b/ksvg/dom/SVGTransform.cc deleted file mode 100644 index a8bbe4db..00000000 --- a/ksvg/dom/SVGTransform.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTransformImpl.h" -#include "SVGTransform.h" -#include "SVGMatrix.h" - -using namespace KSVG; - -SVGTransform::SVGTransform() -{ - impl = new SVGTransformImpl(); - impl->ref(); -} - -SVGTransform::SVGTransform(const SVGTransform &other) : impl(0) -{ - (*this) = other; -} - -SVGTransform &SVGTransform::operator=(const SVGTransform &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGTransform::SVGTransform(SVGTransformImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGTransform::~SVGTransform() -{ -} - -unsigned short SVGTransform::type() const -{ - if(!impl) return SVG_TRANSFORM_UNKNOWN; - return impl->type(); -} - -SVGMatrix SVGTransform::matrix() const -{ - if(!impl) return SVGMatrix(0); - return SVGMatrix(impl->matrix()); -} - -double SVGTransform::angle() const -{ - if(!impl) return -1; - return impl->angle(); -} - -void SVGTransform::setMatrix(SVGMatrix matrix) -{ - if(impl) - impl->setMatrix(matrix.handle()); -} - -void SVGTransform::setTranslate(double tx, double ty) -{ - if(impl) - impl->setTranslate(tx, ty); -} - -void SVGTransform::setScale(double sx, double sy) -{ - if(impl) - impl->setScale(sx, sy); -} - -void SVGTransform::setRotate(double angle, double cx, double cy) -{ - if(impl) - impl->setRotate(angle, cx, cy); -} - -void SVGTransform::setSkewX(double angle) -{ - if(impl) - impl->setSkewX(angle); -} - -void SVGTransform::setSkewY(double angle) -{ - if(impl) - impl->setSkewY(angle); -} diff --git a/ksvg/dom/SVGTransform.cpp b/ksvg/dom/SVGTransform.cpp new file mode 100644 index 00000000..a8bbe4db --- /dev/null +++ b/ksvg/dom/SVGTransform.cpp @@ -0,0 +1,117 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTransformImpl.h" +#include "SVGTransform.h" +#include "SVGMatrix.h" + +using namespace KSVG; + +SVGTransform::SVGTransform() +{ + impl = new SVGTransformImpl(); + impl->ref(); +} + +SVGTransform::SVGTransform(const SVGTransform &other) : impl(0) +{ + (*this) = other; +} + +SVGTransform &SVGTransform::operator=(const SVGTransform &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGTransform::SVGTransform(SVGTransformImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGTransform::~SVGTransform() +{ +} + +unsigned short SVGTransform::type() const +{ + if(!impl) return SVG_TRANSFORM_UNKNOWN; + return impl->type(); +} + +SVGMatrix SVGTransform::matrix() const +{ + if(!impl) return SVGMatrix(0); + return SVGMatrix(impl->matrix()); +} + +double SVGTransform::angle() const +{ + if(!impl) return -1; + return impl->angle(); +} + +void SVGTransform::setMatrix(SVGMatrix matrix) +{ + if(impl) + impl->setMatrix(matrix.handle()); +} + +void SVGTransform::setTranslate(double tx, double ty) +{ + if(impl) + impl->setTranslate(tx, ty); +} + +void SVGTransform::setScale(double sx, double sy) +{ + if(impl) + impl->setScale(sx, sy); +} + +void SVGTransform::setRotate(double angle, double cx, double cy) +{ + if(impl) + impl->setRotate(angle, cx, cy); +} + +void SVGTransform::setSkewX(double angle) +{ + if(impl) + impl->setSkewX(angle); +} + +void SVGTransform::setSkewY(double angle) +{ + if(impl) + impl->setSkewY(angle); +} diff --git a/ksvg/dom/SVGTransformList.cc b/ksvg/dom/SVGTransformList.cc deleted file mode 100644 index d363aef6..00000000 --- a/ksvg/dom/SVGTransformList.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTransformList.h" -#include "SVGTransformListImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGMatrix.h" -#include "SVGTransform.h" - -using namespace KSVG; - -SVGTransformList::SVGTransformList() -{ - impl = new SVGTransformListImpl(); - impl->ref(); -} - -SVGTransformList::SVGTransformList(const SVGTransformList &other) -{ - (*this) = other; -} - -SVGTransformList &SVGTransformList::operator=(const SVGTransformList &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGTransformList::SVGTransformList(SVGTransformListImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGTransformList::~SVGTransformList() -{ - if(impl) - impl->deref(); -} - -unsigned long SVGTransformList::numberOfItems() const -{ - if(!impl) return 0; - return impl->numberOfItems(); -} - -void SVGTransformList::clear() -{ - if(impl) - impl->clear(); -} - -SVGTransform *SVGTransformList::initialize(SVGTransform *newItem) -{ - if(!impl) return new SVGTransform(0); - return new SVGTransform(impl->initialize(newItem->handle())); -} - -SVGTransform *SVGTransformList::getItem(unsigned long index) -{ - if(!impl) return new SVGTransform(0); - return new SVGTransform(impl->getItem(index)); -} - -SVGTransform *SVGTransformList::insertItemBefore(SVGTransform *newItem, unsigned long index) -{ - if(!impl) return new SVGTransform(0); - return new SVGTransform(impl->insertItemBefore(newItem->handle(), index)); -} - -SVGTransform *SVGTransformList::replaceItem(SVGTransform *newItem, unsigned long index) -{ - if(!impl) return new SVGTransform(0); - return new SVGTransform(impl->replaceItem(newItem->handle(), index)); -} - -SVGTransform *SVGTransformList::removeItem(unsigned long index) -{ - if(!impl) return new SVGTransform(0); - return new SVGTransform(impl->removeItem(index)); -} - -SVGTransform *SVGTransformList::appendItem(SVGTransform *newItem) -{ - if(!impl) return new SVGTransform(0); - return new SVGTransform(impl->appendItem(newItem->handle())); -} - -SVGTransform *SVGTransformList::createSVGTransformFromMatrix(SVGMatrix &matrix) -{ - if(!impl) return new SVGTransform(0); - return new SVGTransform(SVGSVGElementImpl::createSVGTransformFromMatrix(matrix.handle())); -} - -SVGTransform *SVGTransformList::consolidate() -{ - if(!impl || impl->numberOfItems()==0) return 0; - return new SVGTransform(impl->consolidate()); -} diff --git a/ksvg/dom/SVGTransformList.cpp b/ksvg/dom/SVGTransformList.cpp new file mode 100644 index 00000000..d363aef6 --- /dev/null +++ b/ksvg/dom/SVGTransformList.cpp @@ -0,0 +1,127 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTransformList.h" +#include "SVGTransformListImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGMatrix.h" +#include "SVGTransform.h" + +using namespace KSVG; + +SVGTransformList::SVGTransformList() +{ + impl = new SVGTransformListImpl(); + impl->ref(); +} + +SVGTransformList::SVGTransformList(const SVGTransformList &other) +{ + (*this) = other; +} + +SVGTransformList &SVGTransformList::operator=(const SVGTransformList &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGTransformList::SVGTransformList(SVGTransformListImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGTransformList::~SVGTransformList() +{ + if(impl) + impl->deref(); +} + +unsigned long SVGTransformList::numberOfItems() const +{ + if(!impl) return 0; + return impl->numberOfItems(); +} + +void SVGTransformList::clear() +{ + if(impl) + impl->clear(); +} + +SVGTransform *SVGTransformList::initialize(SVGTransform *newItem) +{ + if(!impl) return new SVGTransform(0); + return new SVGTransform(impl->initialize(newItem->handle())); +} + +SVGTransform *SVGTransformList::getItem(unsigned long index) +{ + if(!impl) return new SVGTransform(0); + return new SVGTransform(impl->getItem(index)); +} + +SVGTransform *SVGTransformList::insertItemBefore(SVGTransform *newItem, unsigned long index) +{ + if(!impl) return new SVGTransform(0); + return new SVGTransform(impl->insertItemBefore(newItem->handle(), index)); +} + +SVGTransform *SVGTransformList::replaceItem(SVGTransform *newItem, unsigned long index) +{ + if(!impl) return new SVGTransform(0); + return new SVGTransform(impl->replaceItem(newItem->handle(), index)); +} + +SVGTransform *SVGTransformList::removeItem(unsigned long index) +{ + if(!impl) return new SVGTransform(0); + return new SVGTransform(impl->removeItem(index)); +} + +SVGTransform *SVGTransformList::appendItem(SVGTransform *newItem) +{ + if(!impl) return new SVGTransform(0); + return new SVGTransform(impl->appendItem(newItem->handle())); +} + +SVGTransform *SVGTransformList::createSVGTransformFromMatrix(SVGMatrix &matrix) +{ + if(!impl) return new SVGTransform(0); + return new SVGTransform(SVGSVGElementImpl::createSVGTransformFromMatrix(matrix.handle())); +} + +SVGTransform *SVGTransformList::consolidate() +{ + if(!impl || impl->numberOfItems()==0) return 0; + return new SVGTransform(impl->consolidate()); +} diff --git a/ksvg/dom/SVGTransformable.cc b/ksvg/dom/SVGTransformable.cc deleted file mode 100644 index 3c2d22f6..00000000 --- a/ksvg/dom/SVGTransformable.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGTransformable.h" -#include "SVGTransformableImpl.h" -#include "SVGAnimatedTransformList.h" - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGTransformable::SVGTransformable() : SVGLocatable() -{ - impl = 0; -} - -SVGTransformable::SVGTransformable(const SVGTransformable &other) : SVGLocatable(other) -{ - (*this) = other; -} - -SVGTransformable &SVGTransformable::operator=(const SVGTransformable &other) -{ - SVGLocatable::operator=(other); - - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGTransformable::SVGTransformable(SVGTransformableImpl *other) : SVGLocatable(other) -{ - impl = other; -} - -SVGTransformable::~SVGTransformable() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -SVGAnimatedTransformList SVGTransformable::transform() -{ - if(!impl) return SVGAnimatedTransformList(0); - return SVGAnimatedTransformList(impl->transform()); -} diff --git a/ksvg/dom/SVGTransformable.cpp b/ksvg/dom/SVGTransformable.cpp new file mode 100644 index 00000000..3c2d22f6 --- /dev/null +++ b/ksvg/dom/SVGTransformable.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGTransformable.h" +#include "SVGTransformableImpl.h" +#include "SVGAnimatedTransformList.h" + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGTransformable::SVGTransformable() : SVGLocatable() +{ + impl = 0; +} + +SVGTransformable::SVGTransformable(const SVGTransformable &other) : SVGLocatable(other) +{ + (*this) = other; +} + +SVGTransformable &SVGTransformable::operator=(const SVGTransformable &other) +{ + SVGLocatable::operator=(other); + + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGTransformable::SVGTransformable(SVGTransformableImpl *other) : SVGLocatable(other) +{ + impl = other; +} + +SVGTransformable::~SVGTransformable() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +SVGAnimatedTransformList SVGTransformable::transform() +{ + if(!impl) return SVGAnimatedTransformList(0); + return SVGAnimatedTransformList(impl->transform()); +} diff --git a/ksvg/dom/SVGURIReference.cc b/ksvg/dom/SVGURIReference.cc deleted file mode 100644 index 85658aa4..00000000 --- a/ksvg/dom/SVGURIReference.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGURIReference.h" -#include "SVGURIReferenceImpl.h" -#include "SVGAnimatedString.h" - -using namespace KSVG; - -SVGURIReference::SVGURIReference() -{ - impl = new SVGURIReferenceImpl(); -} - -SVGURIReference::SVGURIReference(const SVGURIReference &other) -{ - impl = other.impl; -} - -SVGURIReference &SVGURIReference::operator=(const SVGURIReference &other) -{ - if(impl == other.impl) - return *this; - - delete impl; - impl = other.impl; - - return *this; -} - -SVGURIReference::SVGURIReference(SVGURIReferenceImpl *other) -{ - impl = other; -} - -SVGURIReference::~SVGURIReference() -{ -} - -SVGAnimatedString SVGURIReference::href() const -{ - if(!impl) return SVGAnimatedString(0); - return SVGAnimatedString(impl->href()); -} diff --git a/ksvg/dom/SVGURIReference.cpp b/ksvg/dom/SVGURIReference.cpp new file mode 100644 index 00000000..85658aa4 --- /dev/null +++ b/ksvg/dom/SVGURIReference.cpp @@ -0,0 +1,61 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGURIReference.h" +#include "SVGURIReferenceImpl.h" +#include "SVGAnimatedString.h" + +using namespace KSVG; + +SVGURIReference::SVGURIReference() +{ + impl = new SVGURIReferenceImpl(); +} + +SVGURIReference::SVGURIReference(const SVGURIReference &other) +{ + impl = other.impl; +} + +SVGURIReference &SVGURIReference::operator=(const SVGURIReference &other) +{ + if(impl == other.impl) + return *this; + + delete impl; + impl = other.impl; + + return *this; +} + +SVGURIReference::SVGURIReference(SVGURIReferenceImpl *other) +{ + impl = other; +} + +SVGURIReference::~SVGURIReference() +{ +} + +SVGAnimatedString SVGURIReference::href() const +{ + if(!impl) return SVGAnimatedString(0); + return SVGAnimatedString(impl->href()); +} diff --git a/ksvg/dom/SVGUseElement.cc b/ksvg/dom/SVGUseElement.cc deleted file mode 100644 index e74e05e8..00000000 --- a/ksvg/dom/SVGUseElement.cc +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGUseElement.h" -#include "SVGUseElementImpl.h" -#include "SVGElementInstance.h" -#include "SVGAnimatedLength.h" - -using namespace KSVG; - -SVGUseElement::SVGUseElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGURIReference() -{ - impl = 0; -} - -SVGUseElement::SVGUseElement(const SVGUseElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other), impl(0) -{ - (*this) = other; -} - -SVGUseElement &SVGUseElement::operator =(const SVGUseElement &other) -{ - SVGElement::operator=(other); - SVGTests::operator=(other); - SVGLangSpace::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGStylable::operator=(other); - SVGTransformable::operator=(other); - SVGURIReference::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGUseElement::SVGUseElement(SVGUseElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGUseElement::~SVGUseElement() -{ - if(impl) - impl->deref(); -} - -SVGAnimatedLength SVGUseElement::x() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->x()); -} - -SVGAnimatedLength SVGUseElement::y() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->y()); -} - -SVGAnimatedLength SVGUseElement::width() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->width()); -} - -SVGAnimatedLength SVGUseElement::height() const -{ - if(!impl) return SVGAnimatedLength(0); - return SVGAnimatedLength(impl->height()); -} - -SVGElementInstance SVGUseElement::instanceRoot() const -{ - if(!impl) return SVGElementInstance(0); - return impl->instanceRoot(); -} - -SVGElementInstance SVGUseElement::animatedInstanceRoot() const -{ - if(!impl) return SVGElementInstance(0); - return impl->animatedInstanceRoot(); -} diff --git a/ksvg/dom/SVGUseElement.cpp b/ksvg/dom/SVGUseElement.cpp new file mode 100644 index 00000000..e74e05e8 --- /dev/null +++ b/ksvg/dom/SVGUseElement.cpp @@ -0,0 +1,109 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGUseElement.h" +#include "SVGUseElementImpl.h" +#include "SVGElementInstance.h" +#include "SVGAnimatedLength.h" + +using namespace KSVG; + +SVGUseElement::SVGUseElement() : SVGElement(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGStylable(), SVGTransformable(), SVGURIReference() +{ + impl = 0; +} + +SVGUseElement::SVGUseElement(const SVGUseElement &other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other), impl(0) +{ + (*this) = other; +} + +SVGUseElement &SVGUseElement::operator =(const SVGUseElement &other) +{ + SVGElement::operator=(other); + SVGTests::operator=(other); + SVGLangSpace::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGStylable::operator=(other); + SVGTransformable::operator=(other); + SVGURIReference::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGUseElement::SVGUseElement(SVGUseElementImpl *other) : SVGElement(other), SVGTests(other), SVGLangSpace(other), SVGExternalResourcesRequired(other), SVGStylable(other), SVGTransformable(other), SVGURIReference(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGUseElement::~SVGUseElement() +{ + if(impl) + impl->deref(); +} + +SVGAnimatedLength SVGUseElement::x() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->x()); +} + +SVGAnimatedLength SVGUseElement::y() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->y()); +} + +SVGAnimatedLength SVGUseElement::width() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->width()); +} + +SVGAnimatedLength SVGUseElement::height() const +{ + if(!impl) return SVGAnimatedLength(0); + return SVGAnimatedLength(impl->height()); +} + +SVGElementInstance SVGUseElement::instanceRoot() const +{ + if(!impl) return SVGElementInstance(0); + return impl->instanceRoot(); +} + +SVGElementInstance SVGUseElement::animatedInstanceRoot() const +{ + if(!impl) return SVGElementInstance(0); + return impl->animatedInstanceRoot(); +} diff --git a/ksvg/dom/SVGVKernElement.cc b/ksvg/dom/SVGVKernElement.cc deleted file mode 100644 index 7a52b933..00000000 --- a/ksvg/dom/SVGVKernElement.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGVKernElement.h" -#include "SVGVKernElementImpl.h" - -using namespace KSVG; - -SVGVKernElement::SVGVKernElement() : SVGElement() -{ - impl = 0; -} - -SVGVKernElement::SVGVKernElement(const SVGVKernElement &other) : SVGElement(other), impl(0) -{ - (*this) = other; -} - -SVGVKernElement &SVGVKernElement::operator =(const SVGVKernElement &other) -{ - SVGElement::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGVKernElement::SVGVKernElement(SVGVKernElementImpl *other) : SVGElement(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGVKernElement::~SVGVKernElement() -{ - if(impl) - impl->deref(); -} diff --git a/ksvg/dom/SVGVKernElement.cpp b/ksvg/dom/SVGVKernElement.cpp new file mode 100644 index 00000000..7a52b933 --- /dev/null +++ b/ksvg/dom/SVGVKernElement.cpp @@ -0,0 +1,65 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGVKernElement.h" +#include "SVGVKernElementImpl.h" + +using namespace KSVG; + +SVGVKernElement::SVGVKernElement() : SVGElement() +{ + impl = 0; +} + +SVGVKernElement::SVGVKernElement(const SVGVKernElement &other) : SVGElement(other), impl(0) +{ + (*this) = other; +} + +SVGVKernElement &SVGVKernElement::operator =(const SVGVKernElement &other) +{ + SVGElement::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGVKernElement::SVGVKernElement(SVGVKernElementImpl *other) : SVGElement(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGVKernElement::~SVGVKernElement() +{ + if(impl) + impl->deref(); +} diff --git a/ksvg/dom/SVGViewElement.cc b/ksvg/dom/SVGViewElement.cc deleted file mode 100644 index 0214be20..00000000 --- a/ksvg/dom/SVGViewElement.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGViewElement.h" -#include "SVGViewElementImpl.h" -#include "SVGStringList.h" - -using namespace KSVG; - -SVGViewElement::SVGViewElement() : SVGElement(), SVGExternalResourcesRequired(), SVGFitToViewBox(), SVGZoomAndPan() -{ - impl = 0; -} - -SVGViewElement::SVGViewElement(const SVGViewElement &other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGFitToViewBox(other), SVGZoomAndPan(other), impl(0) -{ - (*this) = other; -} - -SVGViewElement &SVGViewElement::operator =(const SVGViewElement &other) -{ - SVGElement::operator=(other); - SVGExternalResourcesRequired::operator=(other); - SVGFitToViewBox::operator=(other); - SVGZoomAndPan::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGViewElement::SVGViewElement(SVGViewElementImpl *other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGFitToViewBox(other), SVGZoomAndPan(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGViewElement::~SVGViewElement() -{ - if(impl) - impl->deref(); -} - -SVGStringList SVGViewElement::viewTarget() const -{ - if(!impl) return SVGStringList(0); - return SVGStringList(impl->viewTarget()); -} diff --git a/ksvg/dom/SVGViewElement.cpp b/ksvg/dom/SVGViewElement.cpp new file mode 100644 index 00000000..0214be20 --- /dev/null +++ b/ksvg/dom/SVGViewElement.cpp @@ -0,0 +1,75 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGViewElement.h" +#include "SVGViewElementImpl.h" +#include "SVGStringList.h" + +using namespace KSVG; + +SVGViewElement::SVGViewElement() : SVGElement(), SVGExternalResourcesRequired(), SVGFitToViewBox(), SVGZoomAndPan() +{ + impl = 0; +} + +SVGViewElement::SVGViewElement(const SVGViewElement &other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGFitToViewBox(other), SVGZoomAndPan(other), impl(0) +{ + (*this) = other; +} + +SVGViewElement &SVGViewElement::operator =(const SVGViewElement &other) +{ + SVGElement::operator=(other); + SVGExternalResourcesRequired::operator=(other); + SVGFitToViewBox::operator=(other); + SVGZoomAndPan::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGViewElement::SVGViewElement(SVGViewElementImpl *other) : SVGElement(other), SVGExternalResourcesRequired(other), SVGFitToViewBox(other), SVGZoomAndPan(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGViewElement::~SVGViewElement() +{ + if(impl) + impl->deref(); +} + +SVGStringList SVGViewElement::viewTarget() const +{ + if(!impl) return SVGStringList(0); + return SVGStringList(impl->viewTarget()); +} diff --git a/ksvg/dom/SVGViewSpec.cc b/ksvg/dom/SVGViewSpec.cc deleted file mode 100644 index c7877736..00000000 --- a/ksvg/dom/SVGViewSpec.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGViewSpec.h" -#include "SVGViewSpecImpl.h" -#include "SVGElement.h" -#include "SVGTransformList.h" - -using namespace KSVG; - -SVGViewSpec::SVGViewSpec() : SVGZoomAndPan(), SVGFitToViewBox() -{ - impl = new SVGViewSpecImpl(); - impl->ref(); -} - -SVGViewSpec::SVGViewSpec(const SVGViewSpec &other) : SVGZoomAndPan(other), SVGFitToViewBox(other), impl(0) -{ - (*this) = other; -} - -SVGViewSpec &SVGViewSpec::operator =(const SVGViewSpec &other) -{ - SVGZoomAndPan::operator=(other); - SVGFitToViewBox::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGViewSpec::SVGViewSpec(SVGViewSpecImpl *other) : SVGZoomAndPan(other), SVGFitToViewBox(other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGViewSpec::~SVGViewSpec() -{ - if(impl) - impl->deref(); -} - -SVGTransformList SVGViewSpec::transform() const -{ - if(!impl) return SVGTransformList(0); - return SVGTransformList(impl->transform()); -} - -SVGElement SVGViewSpec::viewTarget() const -{ - if(!impl) return SVGElement(0); - return SVGElement(impl->viewTarget()); -} - -DOM::DOMString SVGViewSpec::viewBoxString() const -{ - if(!impl) return DOM::DOMString(); - return impl->viewBoxString(); -} - -DOM::DOMString SVGViewSpec::preserveAspectRatioString() const -{ - if(!impl) return DOM::DOMString(); - return impl->preserveAspectRatioString(); -} - -DOM::DOMString SVGViewSpec::transformString() const -{ - if(!impl) return DOM::DOMString(); - return impl->transformString(); -} - -DOM::DOMString SVGViewSpec::viewTargetString() const -{ - if(!impl) return DOM::DOMString(); - return impl->viewTargetString(); -} diff --git a/ksvg/dom/SVGViewSpec.cpp b/ksvg/dom/SVGViewSpec.cpp new file mode 100644 index 00000000..c7877736 --- /dev/null +++ b/ksvg/dom/SVGViewSpec.cpp @@ -0,0 +1,105 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGViewSpec.h" +#include "SVGViewSpecImpl.h" +#include "SVGElement.h" +#include "SVGTransformList.h" + +using namespace KSVG; + +SVGViewSpec::SVGViewSpec() : SVGZoomAndPan(), SVGFitToViewBox() +{ + impl = new SVGViewSpecImpl(); + impl->ref(); +} + +SVGViewSpec::SVGViewSpec(const SVGViewSpec &other) : SVGZoomAndPan(other), SVGFitToViewBox(other), impl(0) +{ + (*this) = other; +} + +SVGViewSpec &SVGViewSpec::operator =(const SVGViewSpec &other) +{ + SVGZoomAndPan::operator=(other); + SVGFitToViewBox::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGViewSpec::SVGViewSpec(SVGViewSpecImpl *other) : SVGZoomAndPan(other), SVGFitToViewBox(other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGViewSpec::~SVGViewSpec() +{ + if(impl) + impl->deref(); +} + +SVGTransformList SVGViewSpec::transform() const +{ + if(!impl) return SVGTransformList(0); + return SVGTransformList(impl->transform()); +} + +SVGElement SVGViewSpec::viewTarget() const +{ + if(!impl) return SVGElement(0); + return SVGElement(impl->viewTarget()); +} + +DOM::DOMString SVGViewSpec::viewBoxString() const +{ + if(!impl) return DOM::DOMString(); + return impl->viewBoxString(); +} + +DOM::DOMString SVGViewSpec::preserveAspectRatioString() const +{ + if(!impl) return DOM::DOMString(); + return impl->preserveAspectRatioString(); +} + +DOM::DOMString SVGViewSpec::transformString() const +{ + if(!impl) return DOM::DOMString(); + return impl->transformString(); +} + +DOM::DOMString SVGViewSpec::viewTargetString() const +{ + if(!impl) return DOM::DOMString(); + return impl->viewTargetString(); +} diff --git a/ksvg/dom/SVGWindow.cc b/ksvg/dom/SVGWindow.cc deleted file mode 100644 index 22a8dcc0..00000000 --- a/ksvg/dom/SVGWindow.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGWindow.h" -#include "SVGWindowImpl.h" -#include "SVGDocument.h" - -using namespace KSVG; - -SVGWindow::SVGWindow() -{ - impl = new SVGWindowImpl(); - impl->ref(); -} - -SVGWindow::SVGWindow(const SVGWindow &other) : impl(0) -{ - (*this) = other; -} - -SVGWindow &SVGWindow::operator =(const SVGWindow &other) -{ - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGWindow::SVGWindow(SVGWindowImpl *other) -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGWindow::~SVGWindow() -{ - if(impl) - impl->deref(); -} - -/*StyleSheet SVGWindow::defaultStyleSheet() const -{ - if(!impl) return ; // FIXME - return impl->defaultStyleSheet(); -}*/ - -SVGDocument SVGWindow::document() const -{ - if(!impl) return SVGDocument(0); // FIXME - return impl->document(); -} - -DOM::Event SVGWindow::evt() const -{ - if(!impl) return DOM::Event(); // FIXME - return impl->evt(); -} - -long SVGWindow::innerHeight() const -{ - if(!impl) return 0; // FIXME - return impl->innerHeight(); -} - -long SVGWindow::innerWidth() const -{ - if(!impl) return 0; // FIXME - return impl->innerWidth(); -} - -void SVGWindow::setSrc(const DOM::DOMString &src) -{ - if(impl) - impl->setSrc(src); -} - -DOM::DOMString SVGWindow::src() const -{ - if(!impl) return DOM::DOMString(); // FIXME - return impl->src(); -} - -void SVGWindow::clearInterval(long interval) -{ - if(impl) - impl->clearInterval(interval); -} - -void SVGWindow::clearTimeout(long timeout) -{ - if(impl) - impl->clearTimeout(timeout); -} - -void SVGWindow::getURL(const DOM::DOMString &uri, const DOM::EventListener &callback) -{ - if(impl) - impl->getURL(uri, callback); -} - -/*DocumentFragment SVGWindow::parseXML(const DOM::DOMString &source, const Document &document) -{ - if(!impl) return ; // FIXME - return impl->parseXML(source, document); -}*/ - -void SVGWindow::postURL(const DOM::DOMString &uri, const DOM::DOMString &data, const DOM::EventListener &callback, const DOM::DOMString &mimeType, const DOM::DOMString &contentEncoding) -{ - if(impl) - impl->postURL(uri, data, callback, mimeType, contentEncoding); -} - -DOM::DOMString SVGWindow::printNode(const DOM::Node &node) -{ - if(!impl) return DOM::DOMString(); // FIXME - return impl->printNode(node); -} - -long SVGWindow::setInterval(const DOM::DOMString &code, const long &delay) -{ - if(!impl) return 0; // FIXME - return impl->setInterval(code, delay); -} - -long SVGWindow::setTimeout(const DOM::DOMString &code, const long &delay) -{ - if(!impl) return 0; // FIXME - return impl->setTimeout(code, delay); -} - -void SVGWindow::alert(const DOM::DOMString &message) -{ - if(impl) - impl->alert(message); -} - -bool SVGWindow::confirm(const DOM::DOMString &message) -{ - if(!impl) return false; // FIXME - return impl->confirm(message); -} - -DOM::DOMString SVGWindow::prompt(const DOM::DOMString &message, const DOM::DOMString &_default) -{ - if(!impl) return DOM::DOMString(); // FIXME - return impl->prompt(message, _default); -} diff --git a/ksvg/dom/SVGWindow.cpp b/ksvg/dom/SVGWindow.cpp new file mode 100644 index 00000000..22a8dcc0 --- /dev/null +++ b/ksvg/dom/SVGWindow.cpp @@ -0,0 +1,173 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGWindow.h" +#include "SVGWindowImpl.h" +#include "SVGDocument.h" + +using namespace KSVG; + +SVGWindow::SVGWindow() +{ + impl = new SVGWindowImpl(); + impl->ref(); +} + +SVGWindow::SVGWindow(const SVGWindow &other) : impl(0) +{ + (*this) = other; +} + +SVGWindow &SVGWindow::operator =(const SVGWindow &other) +{ + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGWindow::SVGWindow(SVGWindowImpl *other) +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGWindow::~SVGWindow() +{ + if(impl) + impl->deref(); +} + +/*StyleSheet SVGWindow::defaultStyleSheet() const +{ + if(!impl) return ; // FIXME + return impl->defaultStyleSheet(); +}*/ + +SVGDocument SVGWindow::document() const +{ + if(!impl) return SVGDocument(0); // FIXME + return impl->document(); +} + +DOM::Event SVGWindow::evt() const +{ + if(!impl) return DOM::Event(); // FIXME + return impl->evt(); +} + +long SVGWindow::innerHeight() const +{ + if(!impl) return 0; // FIXME + return impl->innerHeight(); +} + +long SVGWindow::innerWidth() const +{ + if(!impl) return 0; // FIXME + return impl->innerWidth(); +} + +void SVGWindow::setSrc(const DOM::DOMString &src) +{ + if(impl) + impl->setSrc(src); +} + +DOM::DOMString SVGWindow::src() const +{ + if(!impl) return DOM::DOMString(); // FIXME + return impl->src(); +} + +void SVGWindow::clearInterval(long interval) +{ + if(impl) + impl->clearInterval(interval); +} + +void SVGWindow::clearTimeout(long timeout) +{ + if(impl) + impl->clearTimeout(timeout); +} + +void SVGWindow::getURL(const DOM::DOMString &uri, const DOM::EventListener &callback) +{ + if(impl) + impl->getURL(uri, callback); +} + +/*DocumentFragment SVGWindow::parseXML(const DOM::DOMString &source, const Document &document) +{ + if(!impl) return ; // FIXME + return impl->parseXML(source, document); +}*/ + +void SVGWindow::postURL(const DOM::DOMString &uri, const DOM::DOMString &data, const DOM::EventListener &callback, const DOM::DOMString &mimeType, const DOM::DOMString &contentEncoding) +{ + if(impl) + impl->postURL(uri, data, callback, mimeType, contentEncoding); +} + +DOM::DOMString SVGWindow::printNode(const DOM::Node &node) +{ + if(!impl) return DOM::DOMString(); // FIXME + return impl->printNode(node); +} + +long SVGWindow::setInterval(const DOM::DOMString &code, const long &delay) +{ + if(!impl) return 0; // FIXME + return impl->setInterval(code, delay); +} + +long SVGWindow::setTimeout(const DOM::DOMString &code, const long &delay) +{ + if(!impl) return 0; // FIXME + return impl->setTimeout(code, delay); +} + +void SVGWindow::alert(const DOM::DOMString &message) +{ + if(impl) + impl->alert(message); +} + +bool SVGWindow::confirm(const DOM::DOMString &message) +{ + if(!impl) return false; // FIXME + return impl->confirm(message); +} + +DOM::DOMString SVGWindow::prompt(const DOM::DOMString &message, const DOM::DOMString &_default) +{ + if(!impl) return DOM::DOMString(); // FIXME + return impl->prompt(message, _default); +} diff --git a/ksvg/dom/SVGZoomAndPan.cc b/ksvg/dom/SVGZoomAndPan.cc deleted file mode 100644 index a8a0bf04..00000000 --- a/ksvg/dom/SVGZoomAndPan.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGZoomAndPan.h" -#include "SVGZoomAndPanImpl.h" - -using namespace KSVG; - -// This class can't be constructed seperately. -SVGZoomAndPan::SVGZoomAndPan() -{ - impl = 0; -} - -SVGZoomAndPan::SVGZoomAndPan(const SVGZoomAndPan &other) : impl(0) -{ - (*this) = other; -} - -SVGZoomAndPan &SVGZoomAndPan::operator=(const SVGZoomAndPan &other) -{ - if(impl == other.impl) - return *this; - - impl = other.impl; - - return *this; -} - -SVGZoomAndPan::SVGZoomAndPan(SVGZoomAndPanImpl *other) -{ - impl = other; -} - -SVGZoomAndPan::~SVGZoomAndPan() -{ - // We are not allowed to delete 'impl' as it's not refcounted. - // delete impl; -} - -void SVGZoomAndPan::setZoomAndPan(unsigned short zoomAndPan) -{ - if(impl) - impl->setZoomAndPan(zoomAndPan); -} - -unsigned short SVGZoomAndPan::zoomAndPan() const -{ - if(!impl) return SVG_ZOOMANDPAN_UNKNOWN; - return impl->zoomAndPan(); -} diff --git a/ksvg/dom/SVGZoomAndPan.cpp b/ksvg/dom/SVGZoomAndPan.cpp new file mode 100644 index 00000000..a8a0bf04 --- /dev/null +++ b/ksvg/dom/SVGZoomAndPan.cpp @@ -0,0 +1,68 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGZoomAndPan.h" +#include "SVGZoomAndPanImpl.h" + +using namespace KSVG; + +// This class can't be constructed seperately. +SVGZoomAndPan::SVGZoomAndPan() +{ + impl = 0; +} + +SVGZoomAndPan::SVGZoomAndPan(const SVGZoomAndPan &other) : impl(0) +{ + (*this) = other; +} + +SVGZoomAndPan &SVGZoomAndPan::operator=(const SVGZoomAndPan &other) +{ + if(impl == other.impl) + return *this; + + impl = other.impl; + + return *this; +} + +SVGZoomAndPan::SVGZoomAndPan(SVGZoomAndPanImpl *other) +{ + impl = other; +} + +SVGZoomAndPan::~SVGZoomAndPan() +{ + // We are not allowed to delete 'impl' as it's not refcounted. + // delete impl; +} + +void SVGZoomAndPan::setZoomAndPan(unsigned short zoomAndPan) +{ + if(impl) + impl->setZoomAndPan(zoomAndPan); +} + +unsigned short SVGZoomAndPan::zoomAndPan() const +{ + if(!impl) return SVG_ZOOMANDPAN_UNKNOWN; + return impl->zoomAndPan(); +} diff --git a/ksvg/dom/SVGZoomEvent.cc b/ksvg/dom/SVGZoomEvent.cc deleted file mode 100644 index cf3cd8d6..00000000 --- a/ksvg/dom/SVGZoomEvent.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGZoomEvent.h" -#include "SVGZoomEventImpl.h" -#include "SVGRect.h" -#include "SVGPoint.h" - -using namespace KSVG; - -SVGZoomEvent::SVGZoomEvent() : DOM::UIEvent() -{ - impl = 0; -} - -SVGZoomEvent::SVGZoomEvent(const SVGZoomEvent &other) : DOM::UIEvent(other), impl(0) -{ - (*this) = other; -} - -SVGZoomEvent &SVGZoomEvent::operator =(const SVGZoomEvent &other) -{ - DOM::UIEvent::operator=(other); - - if(impl == other.impl) - return *this; - - if(impl) - impl->deref(); - - impl = other.impl; - - if(impl) - impl->ref(); - - return *this; -} - -SVGZoomEvent::SVGZoomEvent(SVGZoomEventImpl *other) : DOM::UIEvent() -{ - impl = other; - if(impl) - impl->ref(); -} - -SVGZoomEvent::~SVGZoomEvent() -{ - if(impl) - impl->deref(); -} - -SVGRect SVGZoomEvent::zoomRectScreen() const -{ - if(!impl) return SVGRect(0); - return SVGRect(impl->zoomRectScreen()); -} - -float SVGZoomEvent::previousScale() const -{ - if(!impl) return -1; - return impl->previousScale(); -} - -SVGPoint SVGZoomEvent::previousTranslate() const -{ - if(!impl) return SVGPoint(0); - return SVGPoint(impl->previousTranslate()); -} - -float SVGZoomEvent::newScale() const -{ - if(!impl) return -1; - return impl->newScale(); -} - -SVGPoint SVGZoomEvent::newTranslate() const -{ - if(!impl) return SVGPoint(0); - return SVGPoint(impl->newTranslate()); -} diff --git a/ksvg/dom/SVGZoomEvent.cpp b/ksvg/dom/SVGZoomEvent.cpp new file mode 100644 index 00000000..cf3cd8d6 --- /dev/null +++ b/ksvg/dom/SVGZoomEvent.cpp @@ -0,0 +1,97 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGZoomEvent.h" +#include "SVGZoomEventImpl.h" +#include "SVGRect.h" +#include "SVGPoint.h" + +using namespace KSVG; + +SVGZoomEvent::SVGZoomEvent() : DOM::UIEvent() +{ + impl = 0; +} + +SVGZoomEvent::SVGZoomEvent(const SVGZoomEvent &other) : DOM::UIEvent(other), impl(0) +{ + (*this) = other; +} + +SVGZoomEvent &SVGZoomEvent::operator =(const SVGZoomEvent &other) +{ + DOM::UIEvent::operator=(other); + + if(impl == other.impl) + return *this; + + if(impl) + impl->deref(); + + impl = other.impl; + + if(impl) + impl->ref(); + + return *this; +} + +SVGZoomEvent::SVGZoomEvent(SVGZoomEventImpl *other) : DOM::UIEvent() +{ + impl = other; + if(impl) + impl->ref(); +} + +SVGZoomEvent::~SVGZoomEvent() +{ + if(impl) + impl->deref(); +} + +SVGRect SVGZoomEvent::zoomRectScreen() const +{ + if(!impl) return SVGRect(0); + return SVGRect(impl->zoomRectScreen()); +} + +float SVGZoomEvent::previousScale() const +{ + if(!impl) return -1; + return impl->previousScale(); +} + +SVGPoint SVGZoomEvent::previousTranslate() const +{ + if(!impl) return SVGPoint(0); + return SVGPoint(impl->previousTranslate()); +} + +float SVGZoomEvent::newScale() const +{ + if(!impl) return -1; + return impl->newScale(); +} + +SVGPoint SVGZoomEvent::newTranslate() const +{ + if(!impl) return SVGPoint(0); + return SVGPoint(impl->newTranslate()); +} diff --git a/ksvg/impl/CMakeLists.txt b/ksvg/impl/CMakeLists.txt index 64599da1..82980a01 100644 --- a/ksvg/impl/CMakeLists.txt +++ b/ksvg/impl/CMakeLists.txt @@ -30,64 +30,64 @@ include_directories( tde_add_library( ksvgdomimpl STATIC_PIC AUTOMOC SOURCES - SVGLengthImpl.cc SVGNumberImpl.cc SVGPointImpl.cc SVGTransformImpl.cc - SVGMatrixImpl.cc SVGRectImpl.cc SVGAngleImpl.cc SVGAnimatedLengthImpl.cc - SVGAnimatedNumberImpl.cc SVGAnimatedIntegerImpl.cc SVGAnimatedBooleanImpl.cc - SVGAnimatedEnumerationImpl.cc SVGAnimatedPreserveAspectRatioImpl.cc - SVGAnimatedRectImpl.cc SVGAnimatedAngleImpl.cc SVGAnimatedPathDataImpl.cc - SVGAnimatedStringImpl.cc SVGLengthListImpl.cc SVGNumberListImpl.cc - SVGPointListImpl.cc SVGTransformListImpl.cc SVGStringListImpl.cc - SVGPathSegListImpl.cc SVGElementInstanceListImpl.cc - SVGAnimatedLengthListImpl.cc SVGAnimatedNumberListImpl.cc - SVGAnimatedPointsImpl.cc SVGAnimatedTransformListImpl.cc - SVGShapeImpl.cc SVGContainerImpl.cc SVGBBoxTarget.cc SVGHelperImpl.cc - SVGStylableImpl.cc SVGTransformableImpl.cc SVGTestsImpl.cc SVGLangSpaceImpl.cc - SVGExternalResourcesRequiredImpl.cc SVGLocatableImpl.cc SVGFitToViewBoxImpl.cc - SVGPreserveAspectRatioImpl.cc SVGZoomAndPanImpl.cc SVGViewSpecImpl.cc - SVGElementImpl.cc SVGElementInstanceImpl.cc SVGDocumentImpl.cc - SVGSVGElementImpl.cc SVGWindowImpl.cc SVGDefsElementImpl.cc - SVGUseElementImpl.cc SVGDescElementImpl.cc SVGTitleElementImpl.cc - SVGGElementImpl.cc SVGSwitchElementImpl.cc SVGSymbolElementImpl.cc - SVGImageElementImpl.cc SVGURIReferenceImpl.cc SVGStyleElementImpl.cc - SVGCSSRuleImpl.cc SVGPathElementImpl.cc SVGPathSegImpl.cc - SVGPathSegClosePathImpl.cc SVGPathSegArcImpl.cc SVGPathSegMovetoImpl.cc - SVGPathSegCurvetoQuadraticImpl.cc SVGPathSegCurvetoQuadraticSmoothImpl.cc - SVGPathSegCurvetoCubicImpl.cc SVGPathSegCurvetoCubicSmoothImpl.cc - SVGPathSegLinetoImpl.cc SVGPathSegLinetoHorizontalImpl.cc - SVGPathSegLinetoVerticalImpl.cc SVGRectElementImpl.cc SVGCircleElementImpl.cc - SVGEllipseElementImpl.cc SVGLineElementImpl.cc SVGPolyElementImpl.cc - SVGPolylineElementImpl.cc SVGPolygonElementImpl.cc SVGTextElementImpl.cc - SVGTSpanElementImpl.cc SVGTRefElementImpl.cc SVGTextPositioningElementImpl.cc - SVGTextContentElementImpl.cc SVGTextPathElementImpl.cc SVGPaintImpl.cc - SVGMarkerElementImpl.cc SVGColorImpl.cc SVGICCColorImpl.cc - SVGColorProfileElementImpl.cc SVGColorProfileRuleImpl.cc SVGPaintServerImpl.cc - SVGGradientElementImpl.cc SVGStopElementImpl.cc SVGLinearGradientElementImpl.cc - SVGRadialGradientElementImpl.cc SVGPatternElementImpl.cc - SVGClipPathElementImpl.cc SVGMaskElementImpl.cc SVGFilterElementImpl.cc - SVGFilterPrimitiveStandardAttributesImpl.cc SVGFEBlendElementImpl.cc - SVGFEColorMatrixElementImpl.cc SVGFEComponentTransferElementImpl.cc - SVGComponentTransferFunctionElementImpl.cc SVGFEFuncAElementImpl.cc - SVGFEFuncBElementImpl.cc SVGFEFuncGElementImpl.cc SVGFEFuncRElementImpl.cc - SVGFECompositeElementImpl.cc SVGFEConvolveMatrixElementImpl.cc - SVGFEFloodElementImpl.cc SVGFEGaussianBlurElementImpl.cc - SVGFEDiffuseLightingElementImpl.cc SVGFEDistantLightElementImpl.cc - SVGFEPointLightElementImpl.cc SVGFESpotLightElementImpl.cc - SVGFEDisplacementMapElementImpl.cc SVGFEMergeElementImpl.cc - SVGFEMergeNodeElementImpl.cc SVGFEImageElementImpl.cc - SVGFEMorphologyElementImpl.cc SVGFEOffsetElementImpl.cc - SVGFESpecularLightingElementImpl.cc SVGFETileElementImpl.cc - SVGFETurbulenceElementImpl.cc SVGCursorElementImpl.cc - SVGAElementImpl.cc SVGViewElementImpl.cc SVGScriptElementImpl.cc - SVGEventImpl.cc SVGZoomEventImpl.cc SVGEcma.cc generateddata.cpp - SVGAnimationElementImpl.cc SVGAnimateElementImpl.cc SVGSetElementImpl.cc - SVGAnimateMotionElementImpl.cc SVGAnimateColorElementImpl.cc - SVGAnimateTransformElementImpl.cc SVGMPathElementImpl.cc SVGTimeScheduler.cc - SVGFontElementImpl.cc SVGAltGlyphElementImpl.cc SVGAltGlyphDefElementImpl.cc - SVGGlyphRefElementImpl.cc SVGGlyphElementImpl.cc SVGMissingGlyphElementImpl.cc - SVGFontFaceElementImpl.cc SVGFontFaceFormatElementImpl.cc - SVGFontFaceNameElementImpl.cc SVGFontFaceSrcElementImpl.cc - SVGFontFaceUriElementImpl.cc SVGDefinitionSrcElementImpl.cc - SVGHKernElementImpl.cc SVGVKernElementImpl.cc SVGMetadataElementImpl.cc - SVGForeignObjectElementImpl.cc svgpathparser.cc + SVGLengthImpl.cpp SVGNumberImpl.cpp SVGPointImpl.cpp SVGTransformImpl.cpp + SVGMatrixImpl.cpp SVGRectImpl.cpp SVGAngleImpl.cpp SVGAnimatedLengthImpl.cpp + SVGAnimatedNumberImpl.cpp SVGAnimatedIntegerImpl.cpp SVGAnimatedBooleanImpl.cpp + SVGAnimatedEnumerationImpl.cpp SVGAnimatedPreserveAspectRatioImpl.cpp + SVGAnimatedRectImpl.cpp SVGAnimatedAngleImpl.cpp SVGAnimatedPathDataImpl.cpp + SVGAnimatedStringImpl.cpp SVGLengthListImpl.cpp SVGNumberListImpl.cpp + SVGPointListImpl.cpp SVGTransformListImpl.cpp SVGStringListImpl.cpp + SVGPathSegListImpl.cpp SVGElementInstanceListImpl.cpp + SVGAnimatedLengthListImpl.cpp SVGAnimatedNumberListImpl.cpp + SVGAnimatedPointsImpl.cpp SVGAnimatedTransformListImpl.cpp + SVGShapeImpl.cpp SVGContainerImpl.cpp SVGBBoxTarget.cpp SVGHelperImpl.cpp + SVGStylableImpl.cpp SVGTransformableImpl.cpp SVGTestsImpl.cpp SVGLangSpaceImpl.cpp + SVGExternalResourcesRequiredImpl.cpp SVGLocatableImpl.cpp SVGFitToViewBoxImpl.cpp + SVGPreserveAspectRatioImpl.cpp SVGZoomAndPanImpl.cpp SVGViewSpecImpl.cpp + SVGElementImpl.cpp SVGElementInstanceImpl.cpp SVGDocumentImpl.cpp + SVGSVGElementImpl.cpp SVGWindowImpl.cpp SVGDefsElementImpl.cpp + SVGUseElementImpl.cpp SVGDescElementImpl.cpp SVGTitleElementImpl.cpp + SVGGElementImpl.cpp SVGSwitchElementImpl.cpp SVGSymbolElementImpl.cpp + SVGImageElementImpl.cpp SVGURIReferenceImpl.cpp SVGStyleElementImpl.cpp + SVGCSSRuleImpl.cpp SVGPathElementImpl.cpp SVGPathSegImpl.cpp + SVGPathSegClosePathImpl.cpp SVGPathSegArcImpl.cpp SVGPathSegMovetoImpl.cpp + SVGPathSegCurvetoQuadraticImpl.cpp SVGPathSegCurvetoQuadraticSmoothImpl.cpp + SVGPathSegCurvetoCubicImpl.cpp SVGPathSegCurvetoCubicSmoothImpl.cpp + SVGPathSegLinetoImpl.cpp SVGPathSegLinetoHorizontalImpl.cpp + SVGPathSegLinetoVerticalImpl.cpp SVGRectElementImpl.cpp SVGCircleElementImpl.cpp + SVGEllipseElementImpl.cpp SVGLineElementImpl.cpp SVGPolyElementImpl.cpp + SVGPolylineElementImpl.cpp SVGPolygonElementImpl.cpp SVGTextElementImpl.cpp + SVGTSpanElementImpl.cpp SVGTRefElementImpl.cpp SVGTextPositioningElementImpl.cpp + SVGTextContentElementImpl.cpp SVGTextPathElementImpl.cpp SVGPaintImpl.cpp + SVGMarkerElementImpl.cpp SVGColorImpl.cpp SVGICCColorImpl.cpp + SVGColorProfileElementImpl.cpp SVGColorProfileRuleImpl.cpp SVGPaintServerImpl.cpp + SVGGradientElementImpl.cpp SVGStopElementImpl.cpp SVGLinearGradientElementImpl.cpp + SVGRadialGradientElementImpl.cpp SVGPatternElementImpl.cpp + SVGClipPathElementImpl.cpp SVGMaskElementImpl.cpp SVGFilterElementImpl.cpp + SVGFilterPrimitiveStandardAttributesImpl.cpp SVGFEBlendElementImpl.cpp + SVGFEColorMatrixElementImpl.cpp SVGFEComponentTransferElementImpl.cpp + SVGComponentTransferFunctionElementImpl.cpp SVGFEFuncAElementImpl.cpp + SVGFEFuncBElementImpl.cpp SVGFEFuncGElementImpl.cpp SVGFEFuncRElementImpl.cpp + SVGFECompositeElementImpl.cpp SVGFEConvolveMatrixElementImpl.cpp + SVGFEFloodElementImpl.cpp SVGFEGaussianBlurElementImpl.cpp + SVGFEDiffuseLightingElementImpl.cpp SVGFEDistantLightElementImpl.cpp + SVGFEPointLightElementImpl.cpp SVGFESpotLightElementImpl.cpp + SVGFEDisplacementMapElementImpl.cpp SVGFEMergeElementImpl.cpp + SVGFEMergeNodeElementImpl.cpp SVGFEImageElementImpl.cpp + SVGFEMorphologyElementImpl.cpp SVGFEOffsetElementImpl.cpp + SVGFESpecularLightingElementImpl.cpp SVGFETileElementImpl.cpp + SVGFETurbulenceElementImpl.cpp SVGCursorElementImpl.cpp + SVGAElementImpl.cpp SVGViewElementImpl.cpp SVGScriptElementImpl.cpp + SVGEventImpl.cpp SVGZoomEventImpl.cpp SVGEcma.cpp generateddata.cpp + SVGAnimationElementImpl.cpp SVGAnimateElementImpl.cpp SVGSetElementImpl.cpp + SVGAnimateMotionElementImpl.cpp SVGAnimateColorElementImpl.cpp + SVGAnimateTransformElementImpl.cpp SVGMPathElementImpl.cpp SVGTimeScheduler.cpp + SVGFontElementImpl.cpp SVGAltGlyphElementImpl.cpp SVGAltGlyphDefElementImpl.cpp + SVGGlyphRefElementImpl.cpp SVGGlyphElementImpl.cpp SVGMissingGlyphElementImpl.cpp + SVGFontFaceElementImpl.cpp SVGFontFaceFormatElementImpl.cpp + SVGFontFaceNameElementImpl.cpp SVGFontFaceSrcElementImpl.cpp + SVGFontFaceUriElementImpl.cpp SVGDefinitionSrcElementImpl.cpp + SVGHKernElementImpl.cpp SVGVKernElementImpl.cpp SVGMetadataElementImpl.cpp + SVGForeignObjectElementImpl.cpp svgpathparser.cpp LINK kjs-shared ) diff --git a/ksvg/impl/Makefile.am b/ksvg/impl/Makefile.am index 24e40d67..8509022f 100644 --- a/ksvg/impl/Makefile.am +++ b/ksvg/impl/Makefile.am @@ -29,87 +29,87 @@ KDE_OPTIONS = nofinal KDE_CXXFLAGS = $(USE_EXCEPTIONS) libksvgdomimpl_la_SOURCES = \ -SVGLengthImpl.cc SVGNumberImpl.cc SVGPointImpl.cc SVGTransformImpl.cc \ -SVGMatrixImpl.cc SVGRectImpl.cc SVGAngleImpl.cc \ +SVGLengthImpl.cpp SVGNumberImpl.cpp SVGPointImpl.cpp SVGTransformImpl.cpp \ +SVGMatrixImpl.cpp SVGRectImpl.cpp SVGAngleImpl.cpp \ \ -SVGAnimatedLengthImpl.cc SVGAnimatedNumberImpl.cc SVGAnimatedIntegerImpl.cc \ -SVGAnimatedBooleanImpl.cc SVGAnimatedEnumerationImpl.cc SVGAnimatedPreserveAspectRatioImpl.cc \ -SVGAnimatedRectImpl.cc SVGAnimatedAngleImpl.cc SVGAnimatedPathDataImpl.cc SVGAnimatedStringImpl.cc \ +SVGAnimatedLengthImpl.cpp SVGAnimatedNumberImpl.cpp SVGAnimatedIntegerImpl.cpp \ +SVGAnimatedBooleanImpl.cpp SVGAnimatedEnumerationImpl.cpp SVGAnimatedPreserveAspectRatioImpl.cpp \ +SVGAnimatedRectImpl.cpp SVGAnimatedAngleImpl.cpp SVGAnimatedPathDataImpl.cpp SVGAnimatedStringImpl.cpp \ \ -SVGLengthListImpl.cc SVGNumberListImpl.cc SVGPointListImpl.cc SVGTransformListImpl.cc \ -SVGStringListImpl.cc SVGPathSegListImpl.cc SVGElementInstanceListImpl.cc \ +SVGLengthListImpl.cpp SVGNumberListImpl.cpp SVGPointListImpl.cpp SVGTransformListImpl.cpp \ +SVGStringListImpl.cpp SVGPathSegListImpl.cpp SVGElementInstanceListImpl.cpp \ \ -SVGAnimatedLengthListImpl.cc SVGAnimatedNumberListImpl.cc \ -SVGAnimatedPointsImpl.cc SVGAnimatedTransformListImpl.cc \ +SVGAnimatedLengthListImpl.cpp SVGAnimatedNumberListImpl.cpp \ +SVGAnimatedPointsImpl.cpp SVGAnimatedTransformListImpl.cpp \ \ -SVGShapeImpl.cc SVGContainerImpl.cc SVGBBoxTarget.cc SVGHelperImpl.cc \ -SVGStylableImpl.cc SVGTransformableImpl.cc SVGTestsImpl.cc SVGLangSpaceImpl.cc \ -SVGExternalResourcesRequiredImpl.cc SVGLocatableImpl.cc SVGFitToViewBoxImpl.cc \ -SVGPreserveAspectRatioImpl.cc SVGZoomAndPanImpl.cc SVGViewSpecImpl.cc \ +SVGShapeImpl.cpp SVGContainerImpl.cpp SVGBBoxTarget.cpp SVGHelperImpl.cpp \ +SVGStylableImpl.cpp SVGTransformableImpl.cpp SVGTestsImpl.cpp SVGLangSpaceImpl.cpp \ +SVGExternalResourcesRequiredImpl.cpp SVGLocatableImpl.cpp SVGFitToViewBoxImpl.cpp \ +SVGPreserveAspectRatioImpl.cpp SVGZoomAndPanImpl.cpp SVGViewSpecImpl.cpp \ \ -SVGElementImpl.cc SVGElementInstanceImpl.cc \ -SVGDocumentImpl.cc SVGSVGElementImpl.cc SVGWindowImpl.cc \ -SVGDefsElementImpl.cc SVGUseElementImpl.cc \ -SVGDescElementImpl.cc SVGTitleElementImpl.cc \ -SVGGElementImpl.cc SVGSwitchElementImpl.cc \ -SVGSymbolElementImpl.cc SVGImageElementImpl.cc \ -SVGURIReferenceImpl.cc \ +SVGElementImpl.cpp SVGElementInstanceImpl.cpp \ +SVGDocumentImpl.cpp SVGSVGElementImpl.cpp SVGWindowImpl.cpp \ +SVGDefsElementImpl.cpp SVGUseElementImpl.cpp \ +SVGDescElementImpl.cpp SVGTitleElementImpl.cpp \ +SVGGElementImpl.cpp SVGSwitchElementImpl.cpp \ +SVGSymbolElementImpl.cpp SVGImageElementImpl.cpp \ +SVGURIReferenceImpl.cpp \ \ -SVGStyleElementImpl.cc SVGCSSRuleImpl.cc \ +SVGStyleElementImpl.cpp SVGCSSRuleImpl.cpp \ \ -SVGPathElementImpl.cc SVGPathSegImpl.cc SVGPathSegClosePathImpl.cc SVGPathSegArcImpl.cc \ -SVGPathSegMovetoImpl.cc SVGPathSegCurvetoQuadraticImpl.cc SVGPathSegCurvetoQuadraticSmoothImpl.cc \ -SVGPathSegCurvetoCubicImpl.cc SVGPathSegCurvetoCubicSmoothImpl.cc SVGPathSegLinetoImpl.cc \ -SVGPathSegLinetoHorizontalImpl.cc SVGPathSegLinetoVerticalImpl.cc \ +SVGPathElementImpl.cpp SVGPathSegImpl.cpp SVGPathSegClosePathImpl.cpp SVGPathSegArcImpl.cpp \ +SVGPathSegMovetoImpl.cpp SVGPathSegCurvetoQuadraticImpl.cpp SVGPathSegCurvetoQuadraticSmoothImpl.cpp \ +SVGPathSegCurvetoCubicImpl.cpp SVGPathSegCurvetoCubicSmoothImpl.cpp SVGPathSegLinetoImpl.cpp \ +SVGPathSegLinetoHorizontalImpl.cpp SVGPathSegLinetoVerticalImpl.cpp \ \ -SVGRectElementImpl.cc SVGCircleElementImpl.cc SVGEllipseElementImpl.cc SVGLineElementImpl.cc \ -SVGPolyElementImpl.cc SVGPolylineElementImpl.cc SVGPolygonElementImpl.cc \ +SVGRectElementImpl.cpp SVGCircleElementImpl.cpp SVGEllipseElementImpl.cpp SVGLineElementImpl.cpp \ +SVGPolyElementImpl.cpp SVGPolylineElementImpl.cpp SVGPolygonElementImpl.cpp \ \ -SVGTextElementImpl.cc SVGTSpanElementImpl.cc SVGTRefElementImpl.cc \ -SVGTextPositioningElementImpl.cc SVGTextContentElementImpl.cc SVGTextPathElementImpl.cc \ +SVGTextElementImpl.cpp SVGTSpanElementImpl.cpp SVGTRefElementImpl.cpp \ +SVGTextPositioningElementImpl.cpp SVGTextContentElementImpl.cpp SVGTextPathElementImpl.cpp \ \ -SVGPaintImpl.cc SVGMarkerElementImpl.cc \ +SVGPaintImpl.cpp SVGMarkerElementImpl.cpp \ \ -SVGColorImpl.cc SVGICCColorImpl.cc SVGColorProfileElementImpl.cc SVGColorProfileRuleImpl.cc \ +SVGColorImpl.cpp SVGICCColorImpl.cpp SVGColorProfileElementImpl.cpp SVGColorProfileRuleImpl.cpp \ \ -SVGPaintServerImpl.cc SVGGradientElementImpl.cc SVGStopElementImpl.cc \ -SVGLinearGradientElementImpl.cc SVGRadialGradientElementImpl.cc SVGPatternElementImpl.cc \ +SVGPaintServerImpl.cpp SVGGradientElementImpl.cpp SVGStopElementImpl.cpp \ +SVGLinearGradientElementImpl.cpp SVGRadialGradientElementImpl.cpp SVGPatternElementImpl.cpp \ \ -SVGClipPathElementImpl.cc SVGMaskElementImpl.cc \ +SVGClipPathElementImpl.cpp SVGMaskElementImpl.cpp \ \ -SVGFilterElementImpl.cc SVGFilterPrimitiveStandardAttributesImpl.cc \ -SVGFEBlendElementImpl.cc SVGFEColorMatrixElementImpl.cc \ -SVGFEComponentTransferElementImpl.cc SVGComponentTransferFunctionElementImpl.cc \ -SVGFEFuncAElementImpl.cc SVGFEFuncBElementImpl.cc SVGFEFuncGElementImpl.cc \ -SVGFEFuncRElementImpl.cc SVGFECompositeElementImpl.cc SVGFEConvolveMatrixElementImpl.cc \ -SVGFEFloodElementImpl.cc SVGFEGaussianBlurElementImpl.cc SVGFEDiffuseLightingElementImpl.cc \ -SVGFEDistantLightElementImpl.cc SVGFEPointLightElementImpl.cc SVGFESpotLightElementImpl.cc \ -SVGFEDisplacementMapElementImpl.cc SVGFEMergeElementImpl.cc SVGFEMergeNodeElementImpl.cc \ -SVGFEImageElementImpl.cc SVGFEMorphologyElementImpl.cc SVGFEOffsetElementImpl.cc \ -SVGFESpecularLightingElementImpl.cc SVGFETileElementImpl.cc SVGFETurbulenceElementImpl.cc \ +SVGFilterElementImpl.cpp SVGFilterPrimitiveStandardAttributesImpl.cpp \ +SVGFEBlendElementImpl.cpp SVGFEColorMatrixElementImpl.cpp \ +SVGFEComponentTransferElementImpl.cpp SVGComponentTransferFunctionElementImpl.cpp \ +SVGFEFuncAElementImpl.cpp SVGFEFuncBElementImpl.cpp SVGFEFuncGElementImpl.cpp \ +SVGFEFuncRElementImpl.cpp SVGFECompositeElementImpl.cpp SVGFEConvolveMatrixElementImpl.cpp \ +SVGFEFloodElementImpl.cpp SVGFEGaussianBlurElementImpl.cpp SVGFEDiffuseLightingElementImpl.cpp \ +SVGFEDistantLightElementImpl.cpp SVGFEPointLightElementImpl.cpp SVGFESpotLightElementImpl.cpp \ +SVGFEDisplacementMapElementImpl.cpp SVGFEMergeElementImpl.cpp SVGFEMergeNodeElementImpl.cpp \ +SVGFEImageElementImpl.cpp SVGFEMorphologyElementImpl.cpp SVGFEOffsetElementImpl.cpp \ +SVGFESpecularLightingElementImpl.cpp SVGFETileElementImpl.cpp SVGFETurbulenceElementImpl.cpp \ \ -SVGCursorElementImpl.cc \ +SVGCursorElementImpl.cpp \ \ -SVGAElementImpl.cc SVGViewElementImpl.cc \ +SVGAElementImpl.cpp SVGViewElementImpl.cpp \ \ -SVGScriptElementImpl.cc SVGEventImpl.cc SVGZoomEventImpl.cc \ -SVGEcma.cc generateddata.cpp \ +SVGScriptElementImpl.cpp SVGEventImpl.cpp SVGZoomEventImpl.cpp \ +SVGEcma.cpp generateddata.cpp \ \ -SVGAnimationElementImpl.cc SVGAnimateElementImpl.cc SVGSetElementImpl.cc \ -SVGAnimateMotionElementImpl.cc SVGAnimateColorElementImpl.cc \ -SVGAnimateTransformElementImpl.cc SVGMPathElementImpl.cc SVGTimeScheduler.cc \ +SVGAnimationElementImpl.cpp SVGAnimateElementImpl.cpp SVGSetElementImpl.cpp \ +SVGAnimateMotionElementImpl.cpp SVGAnimateColorElementImpl.cpp \ +SVGAnimateTransformElementImpl.cpp SVGMPathElementImpl.cpp SVGTimeScheduler.cpp \ \ -SVGFontElementImpl.cc SVGAltGlyphElementImpl.cc SVGAltGlyphDefElementImpl.cc \ -SVGGlyphRefElementImpl.cc SVGGlyphElementImpl.cc SVGMissingGlyphElementImpl.cc \ -SVGFontFaceElementImpl.cc SVGFontFaceFormatElementImpl.cc SVGFontFaceNameElementImpl.cc \ -SVGFontFaceSrcElementImpl.cc SVGFontFaceUriElementImpl.cc SVGDefinitionSrcElementImpl.cc \ -SVGHKernElementImpl.cc SVGVKernElementImpl.cc \ +SVGFontElementImpl.cpp SVGAltGlyphElementImpl.cpp SVGAltGlyphDefElementImpl.cpp \ +SVGGlyphRefElementImpl.cpp SVGGlyphElementImpl.cpp SVGMissingGlyphElementImpl.cpp \ +SVGFontFaceElementImpl.cpp SVGFontFaceFormatElementImpl.cpp SVGFontFaceNameElementImpl.cpp \ +SVGFontFaceSrcElementImpl.cpp SVGFontFaceUriElementImpl.cpp SVGDefinitionSrcElementImpl.cpp \ +SVGHKernElementImpl.cpp SVGVKernElementImpl.cpp \ \ -SVGMetadataElementImpl.cc \ +SVGMetadataElementImpl.cpp \ \ -SVGForeignObjectElementImpl.cc \ +SVGForeignObjectElementImpl.cpp \ \ -svgpathparser.cc +svgpathparser.cpp libksvgdomimpl_la_METASOURCES = AUTO diff --git a/ksvg/impl/SVGAElementImpl.cc b/ksvg/impl/SVGAElementImpl.cc deleted file mode 100644 index 0885f254..00000000 --- a/ksvg/impl/SVGAElementImpl.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAElementImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGAnimatedStringImpl.h" - -using namespace KSVG; - -#include "SVGAElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAElementImpl::SVGAElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - KSVG_EMPTY_FLAGS - - m_target = new SVGAnimatedStringImpl(); - m_target->ref(); -} - -SVGAElementImpl::~SVGAElementImpl() -{ - if(m_target) - m_target->deref(); -} - -/* -@namespace KSVG -@begin SVGAElementImpl::s_hashTable 2 - target SVGAElementImpl::Target DontDelete|ReadOnly -@end -*/ - -Value SVGAElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case Target: - return m_target->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGAElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Target: - { - if(m_target) - m_target->deref(); - - SVGAnimatedStringImpl *temp = new SVGAnimatedStringImpl(); - temp->ref(); - temp->setBaseVal(value.toString(exec).string()); - setTarget(temp); - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGAElementImpl::setTarget(SVGAnimatedStringImpl *target) -{ - m_target = target; -} - -SVGAnimatedStringImpl *SVGAElementImpl::target() const -{ - return m_target; -} - -SVGAElementImpl *SVGAElementImpl::getLink(SVGElementImpl *sourceElem) -{ - for(DOM::Node node = *sourceElem; !node.isNull(); node = node.parentNode()) - { - SVGElementImpl *elem = sourceElem->ownerDoc()->getElementFromHandle(node.handle()); - if(elem) - { - SVGAElementImpl *link = dynamic_cast(elem); - if(link) - return link; - } - } - - return 0; -} diff --git a/ksvg/impl/SVGAElementImpl.cpp b/ksvg/impl/SVGAElementImpl.cpp new file mode 100644 index 00000000..0885f254 --- /dev/null +++ b/ksvg/impl/SVGAElementImpl.cpp @@ -0,0 +1,115 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAElementImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGAnimatedStringImpl.h" + +using namespace KSVG; + +#include "SVGAElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAElementImpl::SVGAElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + KSVG_EMPTY_FLAGS + + m_target = new SVGAnimatedStringImpl(); + m_target->ref(); +} + +SVGAElementImpl::~SVGAElementImpl() +{ + if(m_target) + m_target->deref(); +} + +/* +@namespace KSVG +@begin SVGAElementImpl::s_hashTable 2 + target SVGAElementImpl::Target DontDelete|ReadOnly +@end +*/ + +Value SVGAElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case Target: + return m_target->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGAElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Target: + { + if(m_target) + m_target->deref(); + + SVGAnimatedStringImpl *temp = new SVGAnimatedStringImpl(); + temp->ref(); + temp->setBaseVal(value.toString(exec).string()); + setTarget(temp); + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGAElementImpl::setTarget(SVGAnimatedStringImpl *target) +{ + m_target = target; +} + +SVGAnimatedStringImpl *SVGAElementImpl::target() const +{ + return m_target; +} + +SVGAElementImpl *SVGAElementImpl::getLink(SVGElementImpl *sourceElem) +{ + for(DOM::Node node = *sourceElem; !node.isNull(); node = node.parentNode()) + { + SVGElementImpl *elem = sourceElem->ownerDoc()->getElementFromHandle(node.handle()); + if(elem) + { + SVGAElementImpl *link = dynamic_cast(elem); + if(link) + return link; + } + } + + return 0; +} diff --git a/ksvg/impl/SVGAltGlyphDefElementImpl.cc b/ksvg/impl/SVGAltGlyphDefElementImpl.cc deleted file mode 100644 index 6c60d72c..00000000 --- a/ksvg/impl/SVGAltGlyphDefElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAltGlyphDefElementImpl.h" - -using namespace KSVG; - -SVGAltGlyphDefElementImpl::SVGAltGlyphDefElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGAltGlyphDefElementImpl::~SVGAltGlyphDefElementImpl() -{ -} diff --git a/ksvg/impl/SVGAltGlyphDefElementImpl.cpp b/ksvg/impl/SVGAltGlyphDefElementImpl.cpp new file mode 100644 index 00000000..6c60d72c --- /dev/null +++ b/ksvg/impl/SVGAltGlyphDefElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAltGlyphDefElementImpl.h" + +using namespace KSVG; + +SVGAltGlyphDefElementImpl::SVGAltGlyphDefElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGAltGlyphDefElementImpl::~SVGAltGlyphDefElementImpl() +{ +} diff --git a/ksvg/impl/SVGAltGlyphElementImpl.cc b/ksvg/impl/SVGAltGlyphElementImpl.cc deleted file mode 100644 index 724fa50c..00000000 --- a/ksvg/impl/SVGAltGlyphElementImpl.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGSVGElementImpl.h" -#include "SVGAltGlyphElementImpl.h" - -using namespace KSVG; - -SVGAltGlyphElementImpl::SVGAltGlyphElementImpl(DOM::ElementImpl *impl) : SVGTSpanElementImpl(impl), SVGURIReferenceImpl() -{ -} - -SVGAltGlyphElementImpl::~SVGAltGlyphElementImpl() -{ -} - -void SVGAltGlyphElementImpl::setAttributes() -{ - SVGTSpanElementImpl::setAttributes(); -} - -DOM::DOMString SVGAltGlyphElementImpl::format() -{ - return ""; -} - -DOM::DOMString SVGAltGlyphElementImpl::glyphRef() -{ - return ""; -} diff --git a/ksvg/impl/SVGAltGlyphElementImpl.cpp b/ksvg/impl/SVGAltGlyphElementImpl.cpp new file mode 100644 index 00000000..724fa50c --- /dev/null +++ b/ksvg/impl/SVGAltGlyphElementImpl.cpp @@ -0,0 +1,47 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGSVGElementImpl.h" +#include "SVGAltGlyphElementImpl.h" + +using namespace KSVG; + +SVGAltGlyphElementImpl::SVGAltGlyphElementImpl(DOM::ElementImpl *impl) : SVGTSpanElementImpl(impl), SVGURIReferenceImpl() +{ +} + +SVGAltGlyphElementImpl::~SVGAltGlyphElementImpl() +{ +} + +void SVGAltGlyphElementImpl::setAttributes() +{ + SVGTSpanElementImpl::setAttributes(); +} + +DOM::DOMString SVGAltGlyphElementImpl::format() +{ + return ""; +} + +DOM::DOMString SVGAltGlyphElementImpl::glyphRef() +{ + return ""; +} diff --git a/ksvg/impl/SVGAngleImpl.cc b/ksvg/impl/SVGAngleImpl.cc deleted file mode 100644 index b69d95e8..00000000 --- a/ksvg/impl/SVGAngleImpl.cc +++ /dev/null @@ -1,275 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAngle.h" - -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGAngleImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_cacheimpl.h" - -const double deg2rad = 0.017453292519943295769; // pi/180 -const double deg2grad = 400.0 / 360.0; -const double rad2grad = deg2grad / deg2rad; - -SVGAngleImpl::SVGAngleImpl() -{ - KSVG_EMPTY_FLAGS - - m_unitType = SVG_ANGLETYPE_UNKNOWN; - m_valueInSpecifiedUnits = 0; - m_value = 0; -} - -SVGAngleImpl::~SVGAngleImpl() -{ -} - -unsigned short SVGAngleImpl::unitType() const -{ - return m_unitType; -} - -void SVGAngleImpl::setValue(float value) -{ - m_value = value; -} - -float SVGAngleImpl::value() const -{ - return m_value; -} - -// calc m_value -void SVGAngleImpl::calculate() -{ - if(m_unitType == SVG_ANGLETYPE_GRAD) - m_value = m_valueInSpecifiedUnits / deg2grad; - else if(m_unitType == SVG_ANGLETYPE_RAD) - m_value = m_valueInSpecifiedUnits / deg2rad; - else if(m_unitType == SVG_ANGLETYPE_UNSPECIFIED || m_unitType == SVG_ANGLETYPE_DEG) - m_value = m_valueInSpecifiedUnits; -} - -void SVGAngleImpl::setValueInSpecifiedUnits(float valueInSpecifiedUnits) -{ - m_valueInSpecifiedUnits = valueInSpecifiedUnits; - calculate(); -} - -float SVGAngleImpl::valueInSpecifiedUnits() const -{ - return m_valueInSpecifiedUnits; -} - -void SVGAngleImpl::setValueAsString(const DOM::DOMString &valueAsString) -{ - m_valueAsString = valueAsString; - - TQString s = valueAsString.string(); - - bool bOK; - m_valueInSpecifiedUnits = s.toFloat(&bOK); - m_unitType = SVG_ANGLETYPE_UNSPECIFIED; - - if(!bOK) - { - if(s.endsWith("deg")) - m_unitType = SVG_ANGLETYPE_DEG; - else if(s.endsWith("grad")) - m_unitType = SVG_ANGLETYPE_GRAD; - else if(s.endsWith("rad")) - m_unitType = SVG_ANGLETYPE_RAD; - } - - calculate(); -} - -DOM::DOMString SVGAngleImpl::valueAsString() const -{ - m_valueAsString.string().setNum(m_valueInSpecifiedUnits); - - switch(m_unitType) - { - case SVG_ANGLETYPE_UNSPECIFIED: - case SVG_ANGLETYPE_DEG: - m_valueAsString.string() += "deg"; - break; - case SVG_ANGLETYPE_RAD: - m_valueAsString.string() += "rad"; - break; - case SVG_ANGLETYPE_GRAD: - m_valueAsString.string() += "grad"; - break; - } - - return m_valueAsString; -} - -void SVGAngleImpl::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) -{ - m_unitType = unitType; - m_valueInSpecifiedUnits = valueInSpecifiedUnits; - calculate(); -} - -void SVGAngleImpl::convertToSpecifiedUnits(unsigned short unitType) -{ - if(m_unitType == unitType) - return; - - if(m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_RAD) - m_valueInSpecifiedUnits *= deg2rad; - else if(m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_RAD) - m_valueInSpecifiedUnits /= rad2grad; - else if(m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_GRAD) - m_valueInSpecifiedUnits *= deg2grad; - else if(m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_GRAD) - m_valueInSpecifiedUnits *= rad2grad; - else if(m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_DEG) - m_valueInSpecifiedUnits /= deg2rad; - else if(m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_DEG) - m_valueInSpecifiedUnits /= deg2grad; - - m_unitType = unitType; -} - -// Helpers -double SVGAngleImpl::todeg(double rad) -{ - return rad / deg2rad; -} - -double SVGAngleImpl::torad(double deg) -{ - return deg * deg2rad; -} - -double SVGAngleImpl::shortestArcBisector(double angle1, double angle2) -{ - double bisector = (angle1 + angle2) / 2; - - if(fabs(angle1 - angle2) > 180) - bisector += 180; - - return bisector; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAngleImpl::s_hashTable 5 - value SVGAngleImpl::Value DontDelete - valueInSpecifiedUnits SVGAngleImpl::ValueInSpecifiedUnits DontDelete - valueAsString SVGAngleImpl::ValueAsString DontDelete - unitType SVGAngleImpl::UnitType DontDelete -@end -@namespace KSVG -@begin SVGAngleImplProto::s_hashTable 3 - convertToSpecifiedUnits SVGAngleImpl::ConvertToSpecifiedUnits DontDelete|Function 1 - newValueSpecifiedUnits SVGAngleImpl::NewValueSpecifiedUnits DontDelete|Function 2 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGAngle", SVGAngleImplProto, SVGAngleImplProtoFunc) - -Value SVGAngleImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Value: - return Number(value()); - case ValueInSpecifiedUnits: - return Number(valueInSpecifiedUnits()); - case ValueAsString: - return String(valueAsString().string()); - case UnitType: - return Number(unitType()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGAngleImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case Value: - setValue(value.toNumber(exec)); - break; - case ValueInSpecifiedUnits: - setValueInSpecifiedUnits(value.toNumber(exec)); - break; - case ValueAsString: - setValueAsString(value.toString(exec).string()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGAngleImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGAngleImpl) - - switch(id) - { - case SVGAngleImpl::ConvertToSpecifiedUnits: - obj->convertToSpecifiedUnits(static_cast(args[0].toNumber(exec))); - break; - case SVGAngleImpl::NewValueSpecifiedUnits: - obj->newValueSpecifiedUnits(static_cast(args[0].toNumber(exec)), args[1].toNumber(exec)); - break; - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -/* -@namespace KSVG -@begin SVGAngleImplConstructor::s_hashTable 7 - SVG_ANGLETYPE_UNKNOWN KSVG::SVG_ANGLETYPE_UNKNOWN DontDelete|ReadOnly - SVG_ANGLETYPE_UNSPECIFIED KSVG::SVG_ANGLETYPE_UNSPECIFIED DontDelete|ReadOnly - SVG_ANGLETYPE_RAD KSVG::SVG_ANGLETYPE_RAD DontDelete|ReadOnly - SVG_ANGLETYPE_DEG KSVG::SVG_ANGLETYPE_DEG DontDelete|ReadOnly - SVG_ANGLETYPE_GRAD KSVG::SVG_ANGLETYPE_GRAD DontDelete|ReadOnly -@end -*/ - -Value SVGAngleImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGAngleImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgangle.constructor]]"); -} diff --git a/ksvg/impl/SVGAngleImpl.cpp b/ksvg/impl/SVGAngleImpl.cpp new file mode 100644 index 00000000..b69d95e8 --- /dev/null +++ b/ksvg/impl/SVGAngleImpl.cpp @@ -0,0 +1,275 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAngle.h" + +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGAngleImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_cacheimpl.h" + +const double deg2rad = 0.017453292519943295769; // pi/180 +const double deg2grad = 400.0 / 360.0; +const double rad2grad = deg2grad / deg2rad; + +SVGAngleImpl::SVGAngleImpl() +{ + KSVG_EMPTY_FLAGS + + m_unitType = SVG_ANGLETYPE_UNKNOWN; + m_valueInSpecifiedUnits = 0; + m_value = 0; +} + +SVGAngleImpl::~SVGAngleImpl() +{ +} + +unsigned short SVGAngleImpl::unitType() const +{ + return m_unitType; +} + +void SVGAngleImpl::setValue(float value) +{ + m_value = value; +} + +float SVGAngleImpl::value() const +{ + return m_value; +} + +// calc m_value +void SVGAngleImpl::calculate() +{ + if(m_unitType == SVG_ANGLETYPE_GRAD) + m_value = m_valueInSpecifiedUnits / deg2grad; + else if(m_unitType == SVG_ANGLETYPE_RAD) + m_value = m_valueInSpecifiedUnits / deg2rad; + else if(m_unitType == SVG_ANGLETYPE_UNSPECIFIED || m_unitType == SVG_ANGLETYPE_DEG) + m_value = m_valueInSpecifiedUnits; +} + +void SVGAngleImpl::setValueInSpecifiedUnits(float valueInSpecifiedUnits) +{ + m_valueInSpecifiedUnits = valueInSpecifiedUnits; + calculate(); +} + +float SVGAngleImpl::valueInSpecifiedUnits() const +{ + return m_valueInSpecifiedUnits; +} + +void SVGAngleImpl::setValueAsString(const DOM::DOMString &valueAsString) +{ + m_valueAsString = valueAsString; + + TQString s = valueAsString.string(); + + bool bOK; + m_valueInSpecifiedUnits = s.toFloat(&bOK); + m_unitType = SVG_ANGLETYPE_UNSPECIFIED; + + if(!bOK) + { + if(s.endsWith("deg")) + m_unitType = SVG_ANGLETYPE_DEG; + else if(s.endsWith("grad")) + m_unitType = SVG_ANGLETYPE_GRAD; + else if(s.endsWith("rad")) + m_unitType = SVG_ANGLETYPE_RAD; + } + + calculate(); +} + +DOM::DOMString SVGAngleImpl::valueAsString() const +{ + m_valueAsString.string().setNum(m_valueInSpecifiedUnits); + + switch(m_unitType) + { + case SVG_ANGLETYPE_UNSPECIFIED: + case SVG_ANGLETYPE_DEG: + m_valueAsString.string() += "deg"; + break; + case SVG_ANGLETYPE_RAD: + m_valueAsString.string() += "rad"; + break; + case SVG_ANGLETYPE_GRAD: + m_valueAsString.string() += "grad"; + break; + } + + return m_valueAsString; +} + +void SVGAngleImpl::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) +{ + m_unitType = unitType; + m_valueInSpecifiedUnits = valueInSpecifiedUnits; + calculate(); +} + +void SVGAngleImpl::convertToSpecifiedUnits(unsigned short unitType) +{ + if(m_unitType == unitType) + return; + + if(m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_RAD) + m_valueInSpecifiedUnits *= deg2rad; + else if(m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_RAD) + m_valueInSpecifiedUnits /= rad2grad; + else if(m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_GRAD) + m_valueInSpecifiedUnits *= deg2grad; + else if(m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_GRAD) + m_valueInSpecifiedUnits *= rad2grad; + else if(m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_DEG) + m_valueInSpecifiedUnits /= deg2rad; + else if(m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_DEG) + m_valueInSpecifiedUnits /= deg2grad; + + m_unitType = unitType; +} + +// Helpers +double SVGAngleImpl::todeg(double rad) +{ + return rad / deg2rad; +} + +double SVGAngleImpl::torad(double deg) +{ + return deg * deg2rad; +} + +double SVGAngleImpl::shortestArcBisector(double angle1, double angle2) +{ + double bisector = (angle1 + angle2) / 2; + + if(fabs(angle1 - angle2) > 180) + bisector += 180; + + return bisector; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAngleImpl::s_hashTable 5 + value SVGAngleImpl::Value DontDelete + valueInSpecifiedUnits SVGAngleImpl::ValueInSpecifiedUnits DontDelete + valueAsString SVGAngleImpl::ValueAsString DontDelete + unitType SVGAngleImpl::UnitType DontDelete +@end +@namespace KSVG +@begin SVGAngleImplProto::s_hashTable 3 + convertToSpecifiedUnits SVGAngleImpl::ConvertToSpecifiedUnits DontDelete|Function 1 + newValueSpecifiedUnits SVGAngleImpl::NewValueSpecifiedUnits DontDelete|Function 2 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGAngle", SVGAngleImplProto, SVGAngleImplProtoFunc) + +Value SVGAngleImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Value: + return Number(value()); + case ValueInSpecifiedUnits: + return Number(valueInSpecifiedUnits()); + case ValueAsString: + return String(valueAsString().string()); + case UnitType: + return Number(unitType()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGAngleImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case Value: + setValue(value.toNumber(exec)); + break; + case ValueInSpecifiedUnits: + setValueInSpecifiedUnits(value.toNumber(exec)); + break; + case ValueAsString: + setValueAsString(value.toString(exec).string()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGAngleImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGAngleImpl) + + switch(id) + { + case SVGAngleImpl::ConvertToSpecifiedUnits: + obj->convertToSpecifiedUnits(static_cast(args[0].toNumber(exec))); + break; + case SVGAngleImpl::NewValueSpecifiedUnits: + obj->newValueSpecifiedUnits(static_cast(args[0].toNumber(exec)), args[1].toNumber(exec)); + break; + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +/* +@namespace KSVG +@begin SVGAngleImplConstructor::s_hashTable 7 + SVG_ANGLETYPE_UNKNOWN KSVG::SVG_ANGLETYPE_UNKNOWN DontDelete|ReadOnly + SVG_ANGLETYPE_UNSPECIFIED KSVG::SVG_ANGLETYPE_UNSPECIFIED DontDelete|ReadOnly + SVG_ANGLETYPE_RAD KSVG::SVG_ANGLETYPE_RAD DontDelete|ReadOnly + SVG_ANGLETYPE_DEG KSVG::SVG_ANGLETYPE_DEG DontDelete|ReadOnly + SVG_ANGLETYPE_GRAD KSVG::SVG_ANGLETYPE_GRAD DontDelete|ReadOnly +@end +*/ + +Value SVGAngleImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGAngleImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgangle.constructor]]"); +} diff --git a/ksvg/impl/SVGAnimateColorElementImpl.cc b/ksvg/impl/SVGAnimateColorElementImpl.cc deleted file mode 100644 index 0d2f0ff7..00000000 --- a/ksvg/impl/SVGAnimateColorElementImpl.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGColorImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGStylableImpl.h" -#include "SVGAnimateColorElementImpl.h" - -using namespace KSVG; - -SVGAnimateColorElementImpl::SVGAnimateColorElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) -{ - m_fromColor = new SVGColorImpl(this); - m_fromColor->ref(); - - m_toColor = new SVGColorImpl(this); - m_toColor->ref(); -} - -SVGAnimateColorElementImpl::~SVGAnimateColorElementImpl() -{ - m_fromColor->deref(); - m_toColor->deref(); -} - -/* - * Outstanding issues - * - 'values' support - * - 'by' support - */ - -void SVGAnimateColorElementImpl::setAttributes() -{ - SVGAnimationElementImpl::setAttributes(); - - SVGStylableImpl::setColor(getFrom(), m_fromColor); - SVGStylableImpl::setColor(getTo(), m_toColor); - - ownerDoc()->timeScheduler()->addTimer(this, int(getStartTime() * 1000.0)); -} - -void SVGAnimateColorElementImpl::handleTimerEvent() -{ - if(!m_connected) - { - double duration = getSimpleDuration() * 1000.0; - double dinterval = SVGTimeScheduler::staticTimerInterval; - - m_step = 0; - m_steps = (int) rint(duration / dinterval); - - m_connected = true; - ownerDoc()->timeScheduler()->connectIntervalTimer(this); - } - else - { - TQColor fromColor(m_fromColor->rgbColor().color()); - TQColor toColor(m_toColor->rgbColor().color()); - - int red = (int) rint(((toColor.red() - fromColor.red()) / static_cast(m_steps)) * m_step + fromColor.red()); - int green = (int) rint(((toColor.green() - fromColor.green()) / static_cast(m_steps)) * m_step + fromColor.green()); - int blue = (int) rint(((toColor.blue() - fromColor.blue()) / static_cast(m_steps)) * m_step + fromColor.blue()); - - TQString color = "rgb(" + TQString::number(red) + "," + TQString::number(green) + "," + TQString::number(blue) + ")"; - applyAttribute(getAttributeName(), color); - } - - if(m_step < m_steps) - m_step++; - else - { - ownerDoc()->timeScheduler()->disconnectIntervalTimer(this); - m_connected = false; - } -} diff --git a/ksvg/impl/SVGAnimateColorElementImpl.cpp b/ksvg/impl/SVGAnimateColorElementImpl.cpp new file mode 100644 index 00000000..0d2f0ff7 --- /dev/null +++ b/ksvg/impl/SVGAnimateColorElementImpl.cpp @@ -0,0 +1,96 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGColorImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGStylableImpl.h" +#include "SVGAnimateColorElementImpl.h" + +using namespace KSVG; + +SVGAnimateColorElementImpl::SVGAnimateColorElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) +{ + m_fromColor = new SVGColorImpl(this); + m_fromColor->ref(); + + m_toColor = new SVGColorImpl(this); + m_toColor->ref(); +} + +SVGAnimateColorElementImpl::~SVGAnimateColorElementImpl() +{ + m_fromColor->deref(); + m_toColor->deref(); +} + +/* + * Outstanding issues + * - 'values' support + * - 'by' support + */ + +void SVGAnimateColorElementImpl::setAttributes() +{ + SVGAnimationElementImpl::setAttributes(); + + SVGStylableImpl::setColor(getFrom(), m_fromColor); + SVGStylableImpl::setColor(getTo(), m_toColor); + + ownerDoc()->timeScheduler()->addTimer(this, int(getStartTime() * 1000.0)); +} + +void SVGAnimateColorElementImpl::handleTimerEvent() +{ + if(!m_connected) + { + double duration = getSimpleDuration() * 1000.0; + double dinterval = SVGTimeScheduler::staticTimerInterval; + + m_step = 0; + m_steps = (int) rint(duration / dinterval); + + m_connected = true; + ownerDoc()->timeScheduler()->connectIntervalTimer(this); + } + else + { + TQColor fromColor(m_fromColor->rgbColor().color()); + TQColor toColor(m_toColor->rgbColor().color()); + + int red = (int) rint(((toColor.red() - fromColor.red()) / static_cast(m_steps)) * m_step + fromColor.red()); + int green = (int) rint(((toColor.green() - fromColor.green()) / static_cast(m_steps)) * m_step + fromColor.green()); + int blue = (int) rint(((toColor.blue() - fromColor.blue()) / static_cast(m_steps)) * m_step + fromColor.blue()); + + TQString color = "rgb(" + TQString::number(red) + "," + TQString::number(green) + "," + TQString::number(blue) + ")"; + applyAttribute(getAttributeName(), color); + } + + if(m_step < m_steps) + m_step++; + else + { + ownerDoc()->timeScheduler()->disconnectIntervalTimer(this); + m_connected = false; + } +} diff --git a/ksvg/impl/SVGAnimateElementImpl.cc b/ksvg/impl/SVGAnimateElementImpl.cc deleted file mode 100644 index a67a9837..00000000 --- a/ksvg/impl/SVGAnimateElementImpl.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGDocumentImpl.h" -#include "SVGAnimateElementImpl.h" - -using namespace KSVG; - -SVGAnimateElementImpl::SVGAnimateElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) -{ - m_animVal = 0.0; - m_addStep = 0.0; -} - -SVGAnimateElementImpl::~SVGAnimateElementImpl() -{ -} - -void SVGAnimateElementImpl::setAttributes() -{ - SVGAnimationElementImpl::setAttributes(); - - ownerDoc()->timeScheduler()->addTimer(this, int(getStartTime() * 1000.0)); -} - -void SVGAnimateElementImpl::handleTimerEvent() -{ - if(!m_connected) - { - double duration = getSimpleDuration() * 1000.0; - double dinterval = SVGTimeScheduler::staticTimerInterval; - - m_step = 0; - m_steps = (int) rint(duration / dinterval); - - double to = 0, from = 0; - if(getTo().isEmpty()) - to = targetElement()->getAttribute(getAttributeName()).string().toDouble(); - else - to = getTo().toDouble(); - - if(getFrom().isEmpty()) - from = targetElement()->getAttribute(getAttributeName()).string().toDouble(); - else - from = getFrom().toDouble(); - - // 'by' support - if(!getBy().isEmpty()) - { - m_animVal = from; - m_addStep = getBy().toDouble() / m_steps; - } - else - { - m_animVal = from; - m_addStep = (to - m_animVal) / m_steps; - } - - m_connected = true; - ownerDoc()->timeScheduler()->connectIntervalTimer(this); - } - else - { - m_animVal += m_addStep; - applyAttribute(getAttributeName(), TQString::number(m_animVal)); - } - - if(m_step < m_steps) - m_step++; - else - { - ownerDoc()->timeScheduler()->disconnectIntervalTimer(this); - m_connected = false; - if(m_fill == REMOVE) - applyAttribute(getAttributeName(), targetElement()->getAttribute(getAttributeName()).string()); - } - -#if 0 - m_attributeTimer = addTimer(interval() * 1000, false); - - - /* - m_steps = (getSimpleDuration() * 1000) / SVGAnimationElementImpl::timerTime; - m_step = 0; - - if(m_additive == "sum" && m_times == 1 && !needCombine) - { - float add; - - SVGLengthImpl *temp = new SVGLengthImpl(); - temp->ref(); - temp->setValueAsString(targetElement()->getAttribute(m_attributeName).string()); - add = temp->value(); - temp->deref(); - - m_from += add; - m_newFrom += add; - m_to += add; - m_newTo += add; - - m_additiveAdded = add; - } - - m_addStep = (m_to - m_from) / m_steps; - m_attributeTimer = addTimer(SVGAnimationElementImpl::timerTime, false);*/ - } - else - { -/* m_from += m_addStep; - - if(m_additive == "replace" && needCombine) - needCombine = false; - - applyAttribute(m_attributeName, TQString::number(m_from), needCombine); - - m_step++; - - if(m_step == m_steps) - { - removeTimer(m_attributeTimer); - - if(getRepeatDuration() == "indefinite" || getRepeatCount() == "indefinite") - { - m_times++; - m_firstEvent = true; - - if(m_accumulate != "sum") - { - m_from = m_newFrom; - m_to = m_newTo; - } - else - { - m_from += (m_newFrom - m_additiveAdded) / 2; - m_to += (m_newTo - m_additiveAdded) / 2; - } - - m_addStep = 0; - m_attributeTimer = 0; - - addTimer(1); - } - else if(!getRepeatCount().isEmpty()) - { - if(m_times <= getRepeatCount().toInt()) - { - m_times++; - m_firstEvent = true; - - if(m_accumulate != "sum") - { - m_from = m_newFrom; - m_to = m_newTo; - } - else - { - m_from += (m_newFrom - m_additiveAdded) / 2; - m_to += (m_newTo - m_additiveAdded) / 2; - } - - m_addStep = 0; - m_attributeTimer = 0; - - addTimer(1); - } - } - }*/ - } -#endif // 0 -} diff --git a/ksvg/impl/SVGAnimateElementImpl.cpp b/ksvg/impl/SVGAnimateElementImpl.cpp new file mode 100644 index 00000000..a67a9837 --- /dev/null +++ b/ksvg/impl/SVGAnimateElementImpl.cpp @@ -0,0 +1,189 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGDocumentImpl.h" +#include "SVGAnimateElementImpl.h" + +using namespace KSVG; + +SVGAnimateElementImpl::SVGAnimateElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) +{ + m_animVal = 0.0; + m_addStep = 0.0; +} + +SVGAnimateElementImpl::~SVGAnimateElementImpl() +{ +} + +void SVGAnimateElementImpl::setAttributes() +{ + SVGAnimationElementImpl::setAttributes(); + + ownerDoc()->timeScheduler()->addTimer(this, int(getStartTime() * 1000.0)); +} + +void SVGAnimateElementImpl::handleTimerEvent() +{ + if(!m_connected) + { + double duration = getSimpleDuration() * 1000.0; + double dinterval = SVGTimeScheduler::staticTimerInterval; + + m_step = 0; + m_steps = (int) rint(duration / dinterval); + + double to = 0, from = 0; + if(getTo().isEmpty()) + to = targetElement()->getAttribute(getAttributeName()).string().toDouble(); + else + to = getTo().toDouble(); + + if(getFrom().isEmpty()) + from = targetElement()->getAttribute(getAttributeName()).string().toDouble(); + else + from = getFrom().toDouble(); + + // 'by' support + if(!getBy().isEmpty()) + { + m_animVal = from; + m_addStep = getBy().toDouble() / m_steps; + } + else + { + m_animVal = from; + m_addStep = (to - m_animVal) / m_steps; + } + + m_connected = true; + ownerDoc()->timeScheduler()->connectIntervalTimer(this); + } + else + { + m_animVal += m_addStep; + applyAttribute(getAttributeName(), TQString::number(m_animVal)); + } + + if(m_step < m_steps) + m_step++; + else + { + ownerDoc()->timeScheduler()->disconnectIntervalTimer(this); + m_connected = false; + if(m_fill == REMOVE) + applyAttribute(getAttributeName(), targetElement()->getAttribute(getAttributeName()).string()); + } + +#if 0 + m_attributeTimer = addTimer(interval() * 1000, false); + + + /* + m_steps = (getSimpleDuration() * 1000) / SVGAnimationElementImpl::timerTime; + m_step = 0; + + if(m_additive == "sum" && m_times == 1 && !needCombine) + { + float add; + + SVGLengthImpl *temp = new SVGLengthImpl(); + temp->ref(); + temp->setValueAsString(targetElement()->getAttribute(m_attributeName).string()); + add = temp->value(); + temp->deref(); + + m_from += add; + m_newFrom += add; + m_to += add; + m_newTo += add; + + m_additiveAdded = add; + } + + m_addStep = (m_to - m_from) / m_steps; + m_attributeTimer = addTimer(SVGAnimationElementImpl::timerTime, false);*/ + } + else + { +/* m_from += m_addStep; + + if(m_additive == "replace" && needCombine) + needCombine = false; + + applyAttribute(m_attributeName, TQString::number(m_from), needCombine); + + m_step++; + + if(m_step == m_steps) + { + removeTimer(m_attributeTimer); + + if(getRepeatDuration() == "indefinite" || getRepeatCount() == "indefinite") + { + m_times++; + m_firstEvent = true; + + if(m_accumulate != "sum") + { + m_from = m_newFrom; + m_to = m_newTo; + } + else + { + m_from += (m_newFrom - m_additiveAdded) / 2; + m_to += (m_newTo - m_additiveAdded) / 2; + } + + m_addStep = 0; + m_attributeTimer = 0; + + addTimer(1); + } + else if(!getRepeatCount().isEmpty()) + { + if(m_times <= getRepeatCount().toInt()) + { + m_times++; + m_firstEvent = true; + + if(m_accumulate != "sum") + { + m_from = m_newFrom; + m_to = m_newTo; + } + else + { + m_from += (m_newFrom - m_additiveAdded) / 2; + m_to += (m_newTo - m_additiveAdded) / 2; + } + + m_addStep = 0; + m_attributeTimer = 0; + + addTimer(1); + } + } + }*/ + } +#endif // 0 +} diff --git a/ksvg/impl/SVGAnimateMotionElementImpl.cc b/ksvg/impl/SVGAnimateMotionElementImpl.cc deleted file mode 100644 index 3de6bab2..00000000 --- a/ksvg/impl/SVGAnimateMotionElementImpl.cc +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -// TODO: CLEANUP - -#include -#include "SVGDocumentImpl.h" -#include "SVGPathElementImpl.h" -#include "SVGAnimateMotionElementImpl.h" - -using namespace KSVG; - -SVGAnimateMotionElementImpl::SVGAnimateMotionElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) -{ -} - -SVGAnimateMotionElementImpl::~SVGAnimateMotionElementImpl() -{ -} - -void SVGAnimateMotionElementImpl::setAttributes() -{ - SVGAnimationElementImpl::setAttributes(); - -/* - // TODO: rotate.. - - DOM::DOMString _path = getAttribute("path"); - if(!_path.isNull()) - { - if(m_path) - m_path->deref(); - - m_path = new SVGPathElementImpl(reinterpret_cast(static_cast(ownerDoc())->createElement("path").handle())); - m_path->setOwnerDoc(ownerDoc()); - m_path->setAttribute("d", _path); - m_path->setAttributes(); - } - - addTimer(int(getStartTime() * 1000));*/ -} - -//void SVGAnimateMotionElementImpl::prerender(KSVGPainter *p) -//{ -// SVGAnimationElementImpl::prerender(p); - -/* if(!m_pathArray) - { - bool temp; - m_pathArray = m_path->preparePath(&temp, p->worldMatrix()); - }*/ -//} - -void SVGAnimateMotionElementImpl::handleTimerEvent(bool /*needCombine*/) -{ -/* if(m_firstEvent) - { - m_firstEvent = false; - - m_steps = (int) (getSimpleDuration() * 1000) / interval(); - m_step = 0; - - m_motionTimer = addTimer(interval() * 1000, false); - } - else - { - m_step++; - - if(m_step <= m_pathArray->count() - 1) - { - TQPoint p = m_pathArray->point(m_step - 50); - applyAttribute("x", TQString::number(p.x())); - applyAttribute("y", TQString::number(p.y())); - kdDebug() << " X " << p.x() << " Y " << p.y() << " (" << m_pathArray->count() << "; " << m_step << ")" < +#include "SVGDocumentImpl.h" +#include "SVGPathElementImpl.h" +#include "SVGAnimateMotionElementImpl.h" + +using namespace KSVG; + +SVGAnimateMotionElementImpl::SVGAnimateMotionElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) +{ +} + +SVGAnimateMotionElementImpl::~SVGAnimateMotionElementImpl() +{ +} + +void SVGAnimateMotionElementImpl::setAttributes() +{ + SVGAnimationElementImpl::setAttributes(); + +/* + // TODO: rotate.. + + DOM::DOMString _path = getAttribute("path"); + if(!_path.isNull()) + { + if(m_path) + m_path->deref(); + + m_path = new SVGPathElementImpl(reinterpret_cast(static_cast(ownerDoc())->createElement("path").handle())); + m_path->setOwnerDoc(ownerDoc()); + m_path->setAttribute("d", _path); + m_path->setAttributes(); + } + + addTimer(int(getStartTime() * 1000));*/ +} + +//void SVGAnimateMotionElementImpl::prerender(KSVGPainter *p) +//{ +// SVGAnimationElementImpl::prerender(p); + +/* if(!m_pathArray) + { + bool temp; + m_pathArray = m_path->preparePath(&temp, p->worldMatrix()); + }*/ +//} + +void SVGAnimateMotionElementImpl::handleTimerEvent(bool /*needCombine*/) +{ +/* if(m_firstEvent) + { + m_firstEvent = false; + + m_steps = (int) (getSimpleDuration() * 1000) / interval(); + m_step = 0; + + m_motionTimer = addTimer(interval() * 1000, false); + } + else + { + m_step++; + + if(m_step <= m_pathArray->count() - 1) + { + TQPoint p = m_pathArray->point(m_step - 50); + applyAttribute("x", TQString::number(p.x())); + applyAttribute("y", TQString::number(p.y())); + kdDebug() << " X " << p.x() << " Y " << p.y() << " (" << m_pathArray->count() << "; " << m_step << ")" < - -#include "SVGLengthImpl.h" -#include "SVGHelperImpl.h" -#include "SVGTransformImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGAnimatedTransformListImpl.h" -#include "SVGAnimateTransformElementImpl.h" - -using namespace KSVG; - -SVGAnimateTransformElementImpl::SVGAnimateTransformElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) -{ - m_firstEvent = true; - m_setAttributes = false; - - m_rotateX = -1; - m_rotateY = -1; - m_times = 1; - m_from = 0; - m_to = 0; - - m_addStep = 0; -} - -SVGAnimateTransformElementImpl::~SVGAnimateTransformElementImpl() -{ -} - -void SVGAnimateTransformElementImpl::setAttributes() -{ - if(m_setAttributes) - return; - - m_setAttributes = true; - - SVGAnimationElementImpl::setAttributes(); - - /* - // TODO: much :) - - DOM::DOMString _type = getAttribute("type"); - if(!_type.isNull()) - m_type = _type.string().lower(); - - DOM::DOMString _from = getAttribute("from"); - if(!_from.isNull()) - { - if(m_type != "rotate") - { - SVGLengthImpl *temp = SVGSVGElementImpl::createSVGLength(); - temp->setValueAsString(_from.string()); - - m_from = temp->value(); - - temp->deref(); - } - else - { - SVGTransformListImpl *list = new SVGTransformListImpl(); - list->ref(); - - SVGHelperImpl::parseTransformAttribute(list, m_type + "(" + _from.string() + ")"); - - m_from = list->getFirst()->angle(); - - TQStringList stringList = TQStringList::split(' ', list->getFirst()->toString()); - m_rotateX = stringList[1].toInt(); - m_rotateY = stringList[2].mid(0, stringList[2].length() - 1).toInt(); - - list->deref(); - } - - m_newFrom = m_from; - m_addStep = m_from; - } - - DOM::DOMString _to = getAttribute("to"); - if(!_to.isNull()) - { - if(m_type != "rotate") - { - SVGLengthImpl *temp = SVGSVGElementImpl::createSVGLength(); - temp->setValueAsString(_to.string()); - - m_to = temp->value(); - - temp->deref(); - } - else - { - SVGTransformListImpl *list = new SVGTransformListImpl(); - list->ref(); - - SVGHelperImpl::parseTransformAttribute(list, m_type + "(" + _to.string() + ")"); - - m_to = list->getFirst()->angle(); - - list->deref(); - } - - m_newTo = m_to; - } - - // TODO: values + rotate including cx + cy - DOM::DOMString _values = getAttribute("values"); - if(!_values.isNull()) - { - TQString test = _values.string(); - - if(test.contains(";")) - { - SVGLengthImpl *temp = SVGSVGElementImpl::createSVGLength(); - - TQStringList list = TQStringList::split(';', test); - temp->setValueAsString(list[0]); - m_from = temp->value(); - temp->setValueAsString(list[1]); - m_to = temp->value(); - - m_newFrom = m_from; - m_newTo = m_to; - m_addStep = m_from; - - temp->deref(); - } - } - - if(getStartTime() != -1) - addTimer(int(getStartTime() * 1000)); - else - addTimer(1); - */ -} - -void SVGAnimateTransformElementImpl::handleTimerEvent(bool) -{ /* - if(m_firstEvent) - { - m_firstEvent = false; - - m_steps = (int) (getSimpleDuration() * 1000) / interval(); - m_step = 0; - - m_addStep = (m_to - m_from) / m_steps; - - m_transformTimer = addTimer(interval() * 1000, false); - } - else - { - m_from += m_addStep; - - SVGTransformImpl *transform = SVGSVGElementImpl::createSVGTransform(); - - if(m_type == "rotate") - { - int x = 0, y = 0; - - if(m_rotateX != -1) - x = m_rotateX; - - if(m_rotateY != -1) - y = m_rotateY; - - transform->setRotate(m_from, x, y); - } - else if(m_type == "scale") - transform->setScale(m_from, m_from); - else if(m_type == "skewx") - transform->setSkewX(m_from); - else if(m_type == "skewy") - transform->setSkewY(m_from); - - TQString trans = transform->toString(); - TQString last = trans; - - if(targetElement()->hasAttribute("transform")) - { - trans += " " + targetElement()->getAttribute("transform").string(); - - if(!m_lastTransform.isEmpty()) - { - int pos = trans.find(m_lastTransform); - - TQString extract; - extract += trans.mid(0, pos); - extract += trans.mid(pos + m_lastTransform.length() + 1, trans.length()); - - trans = extract; - } - } - - m_lastTransform = last; - - transform->deref(); - - applyAttribute("transform", trans); - - m_step++; - - if(m_step == m_steps) - { - removeTimer(m_transformTimer); - - if(getRepeatDuration() == "indefinite" || getRepeatCount() == "indefinite") - { - m_firstEvent = true; - m_from = m_newFrom; - m_to = m_newTo; - - m_addStep = 0; - m_transformTimer = 0; - - addTimer(1); - } - else if(!getRepeatCount().isEmpty()) - { - if(m_times <= getRepeatCount().toInt()) - { - m_times++; - m_firstEvent = true; - m_from = m_newFrom; - m_to = m_newTo; - - m_addStep = 0; - m_transformTimer = 0; - - addTimer(1); - } - } - } - } - */ -} diff --git a/ksvg/impl/SVGAnimateTransformElementImpl.cpp b/ksvg/impl/SVGAnimateTransformElementImpl.cpp new file mode 100644 index 00000000..3eae35dd --- /dev/null +++ b/ksvg/impl/SVGAnimateTransformElementImpl.cpp @@ -0,0 +1,255 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGLengthImpl.h" +#include "SVGHelperImpl.h" +#include "SVGTransformImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGAnimatedTransformListImpl.h" +#include "SVGAnimateTransformElementImpl.h" + +using namespace KSVG; + +SVGAnimateTransformElementImpl::SVGAnimateTransformElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) +{ + m_firstEvent = true; + m_setAttributes = false; + + m_rotateX = -1; + m_rotateY = -1; + m_times = 1; + m_from = 0; + m_to = 0; + + m_addStep = 0; +} + +SVGAnimateTransformElementImpl::~SVGAnimateTransformElementImpl() +{ +} + +void SVGAnimateTransformElementImpl::setAttributes() +{ + if(m_setAttributes) + return; + + m_setAttributes = true; + + SVGAnimationElementImpl::setAttributes(); + + /* + // TODO: much :) + + DOM::DOMString _type = getAttribute("type"); + if(!_type.isNull()) + m_type = _type.string().lower(); + + DOM::DOMString _from = getAttribute("from"); + if(!_from.isNull()) + { + if(m_type != "rotate") + { + SVGLengthImpl *temp = SVGSVGElementImpl::createSVGLength(); + temp->setValueAsString(_from.string()); + + m_from = temp->value(); + + temp->deref(); + } + else + { + SVGTransformListImpl *list = new SVGTransformListImpl(); + list->ref(); + + SVGHelperImpl::parseTransformAttribute(list, m_type + "(" + _from.string() + ")"); + + m_from = list->getFirst()->angle(); + + TQStringList stringList = TQStringList::split(' ', list->getFirst()->toString()); + m_rotateX = stringList[1].toInt(); + m_rotateY = stringList[2].mid(0, stringList[2].length() - 1).toInt(); + + list->deref(); + } + + m_newFrom = m_from; + m_addStep = m_from; + } + + DOM::DOMString _to = getAttribute("to"); + if(!_to.isNull()) + { + if(m_type != "rotate") + { + SVGLengthImpl *temp = SVGSVGElementImpl::createSVGLength(); + temp->setValueAsString(_to.string()); + + m_to = temp->value(); + + temp->deref(); + } + else + { + SVGTransformListImpl *list = new SVGTransformListImpl(); + list->ref(); + + SVGHelperImpl::parseTransformAttribute(list, m_type + "(" + _to.string() + ")"); + + m_to = list->getFirst()->angle(); + + list->deref(); + } + + m_newTo = m_to; + } + + // TODO: values + rotate including cx + cy + DOM::DOMString _values = getAttribute("values"); + if(!_values.isNull()) + { + TQString test = _values.string(); + + if(test.contains(";")) + { + SVGLengthImpl *temp = SVGSVGElementImpl::createSVGLength(); + + TQStringList list = TQStringList::split(';', test); + temp->setValueAsString(list[0]); + m_from = temp->value(); + temp->setValueAsString(list[1]); + m_to = temp->value(); + + m_newFrom = m_from; + m_newTo = m_to; + m_addStep = m_from; + + temp->deref(); + } + } + + if(getStartTime() != -1) + addTimer(int(getStartTime() * 1000)); + else + addTimer(1); + */ +} + +void SVGAnimateTransformElementImpl::handleTimerEvent(bool) +{ /* + if(m_firstEvent) + { + m_firstEvent = false; + + m_steps = (int) (getSimpleDuration() * 1000) / interval(); + m_step = 0; + + m_addStep = (m_to - m_from) / m_steps; + + m_transformTimer = addTimer(interval() * 1000, false); + } + else + { + m_from += m_addStep; + + SVGTransformImpl *transform = SVGSVGElementImpl::createSVGTransform(); + + if(m_type == "rotate") + { + int x = 0, y = 0; + + if(m_rotateX != -1) + x = m_rotateX; + + if(m_rotateY != -1) + y = m_rotateY; + + transform->setRotate(m_from, x, y); + } + else if(m_type == "scale") + transform->setScale(m_from, m_from); + else if(m_type == "skewx") + transform->setSkewX(m_from); + else if(m_type == "skewy") + transform->setSkewY(m_from); + + TQString trans = transform->toString(); + TQString last = trans; + + if(targetElement()->hasAttribute("transform")) + { + trans += " " + targetElement()->getAttribute("transform").string(); + + if(!m_lastTransform.isEmpty()) + { + int pos = trans.find(m_lastTransform); + + TQString extract; + extract += trans.mid(0, pos); + extract += trans.mid(pos + m_lastTransform.length() + 1, trans.length()); + + trans = extract; + } + } + + m_lastTransform = last; + + transform->deref(); + + applyAttribute("transform", trans); + + m_step++; + + if(m_step == m_steps) + { + removeTimer(m_transformTimer); + + if(getRepeatDuration() == "indefinite" || getRepeatCount() == "indefinite") + { + m_firstEvent = true; + m_from = m_newFrom; + m_to = m_newTo; + + m_addStep = 0; + m_transformTimer = 0; + + addTimer(1); + } + else if(!getRepeatCount().isEmpty()) + { + if(m_times <= getRepeatCount().toInt()) + { + m_times++; + m_firstEvent = true; + m_from = m_newFrom; + m_to = m_newTo; + + m_addStep = 0; + m_transformTimer = 0; + + addTimer(1); + } + } + } + } + */ +} diff --git a/ksvg/impl/SVGAnimatedAngleImpl.cc b/ksvg/impl/SVGAnimatedAngleImpl.cc deleted file mode 100644 index 41429847..00000000 --- a/ksvg/impl/SVGAnimatedAngleImpl.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAngleImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedAngleImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedAngleImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAnimatedAngleImpl::SVGAnimatedAngleImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS - - m_baseVal = SVGSVGElementImpl::createSVGAngle(); - m_animVal = SVGSVGElementImpl::createSVGAngle(); -} - -SVGAnimatedAngleImpl::~SVGAnimatedAngleImpl() -{ - if(m_baseVal) - m_baseVal->deref(); - if(m_animVal) - m_animVal->deref(); -} - -SVGAngleImpl *SVGAnimatedAngleImpl::baseVal() const -{ - return m_baseVal; -} - -SVGAngleImpl *SVGAnimatedAngleImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedAngleImpl::s_hashTable 3 - baseVal SVGAnimatedAngleImpl::BaseVal DontDelete|ReadOnly - animVal SVGAnimatedAngleImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedAngleImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case BaseVal: - return m_baseVal->cache(exec); - case AnimVal: - return m_animVal->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGAnimatedAngleImpl.cpp b/ksvg/impl/SVGAnimatedAngleImpl.cpp new file mode 100644 index 00000000..41429847 --- /dev/null +++ b/ksvg/impl/SVGAnimatedAngleImpl.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAngleImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedAngleImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedAngleImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAnimatedAngleImpl::SVGAnimatedAngleImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS + + m_baseVal = SVGSVGElementImpl::createSVGAngle(); + m_animVal = SVGSVGElementImpl::createSVGAngle(); +} + +SVGAnimatedAngleImpl::~SVGAnimatedAngleImpl() +{ + if(m_baseVal) + m_baseVal->deref(); + if(m_animVal) + m_animVal->deref(); +} + +SVGAngleImpl *SVGAnimatedAngleImpl::baseVal() const +{ + return m_baseVal; +} + +SVGAngleImpl *SVGAnimatedAngleImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedAngleImpl::s_hashTable 3 + baseVal SVGAnimatedAngleImpl::BaseVal DontDelete|ReadOnly + animVal SVGAnimatedAngleImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedAngleImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case BaseVal: + return m_baseVal->cache(exec); + case AnimVal: + return m_animVal->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGAnimatedBooleanImpl.cc b/ksvg/impl/SVGAnimatedBooleanImpl.cc deleted file mode 100644 index f60b6a04..00000000 --- a/ksvg/impl/SVGAnimatedBooleanImpl.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedBooleanImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedBooleanImpl.lut.h" -#include "ksvg_bridge.h" - -SVGAnimatedBooleanImpl::SVGAnimatedBooleanImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS - - m_baseVal = false; - m_animVal = false; -} - -SVGAnimatedBooleanImpl::~SVGAnimatedBooleanImpl() -{ -} - -void SVGAnimatedBooleanImpl::setBaseVal(bool baseVal) -{ - m_baseVal = baseVal; -} - -bool SVGAnimatedBooleanImpl::baseVal() const -{ - return m_baseVal; -} - -bool SVGAnimatedBooleanImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedBooleanImpl::s_hashTable 3 - baseVal SVGAnimatedBooleanImpl::BaseVal DontDelete - animVal SVGAnimatedBooleanImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedBooleanImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case BaseVal: - return Number(baseVal()); - case AnimVal: - return Number(animVal()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGAnimatedBooleanImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case BaseVal: - setBaseVal(value.toBoolean(exec)); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGAnimatedBooleanImpl.cpp b/ksvg/impl/SVGAnimatedBooleanImpl.cpp new file mode 100644 index 00000000..f60b6a04 --- /dev/null +++ b/ksvg/impl/SVGAnimatedBooleanImpl.cpp @@ -0,0 +1,91 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedBooleanImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedBooleanImpl.lut.h" +#include "ksvg_bridge.h" + +SVGAnimatedBooleanImpl::SVGAnimatedBooleanImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS + + m_baseVal = false; + m_animVal = false; +} + +SVGAnimatedBooleanImpl::~SVGAnimatedBooleanImpl() +{ +} + +void SVGAnimatedBooleanImpl::setBaseVal(bool baseVal) +{ + m_baseVal = baseVal; +} + +bool SVGAnimatedBooleanImpl::baseVal() const +{ + return m_baseVal; +} + +bool SVGAnimatedBooleanImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedBooleanImpl::s_hashTable 3 + baseVal SVGAnimatedBooleanImpl::BaseVal DontDelete + animVal SVGAnimatedBooleanImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedBooleanImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case BaseVal: + return Number(baseVal()); + case AnimVal: + return Number(animVal()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGAnimatedBooleanImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case BaseVal: + setBaseVal(value.toBoolean(exec)); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGAnimatedEnumerationImpl.cc b/ksvg/impl/SVGAnimatedEnumerationImpl.cc deleted file mode 100644 index 11e769ba..00000000 --- a/ksvg/impl/SVGAnimatedEnumerationImpl.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedEnumerationImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedEnumerationImpl.lut.h" -#include "ksvg_bridge.h" - -SVGAnimatedEnumerationImpl::SVGAnimatedEnumerationImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS - - m_baseVal = 0; - m_animVal = 0; -} - -SVGAnimatedEnumerationImpl::~SVGAnimatedEnumerationImpl() -{ -} - -void SVGAnimatedEnumerationImpl::setBaseVal(unsigned short baseVal) -{ - m_baseVal = baseVal; -} - -unsigned short SVGAnimatedEnumerationImpl::baseVal() const -{ - return m_baseVal; -} - -unsigned short SVGAnimatedEnumerationImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedEnumerationImpl::s_hashTable 3 - baseVal SVGAnimatedEnumerationImpl::BaseVal DontDelete - animVal SVGAnimatedEnumerationImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedEnumerationImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case BaseVal: - return Number(baseVal()); - case AnimVal: - return Number(animVal()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGAnimatedEnumerationImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case BaseVal: - setBaseVal(static_cast(value.toNumber(exec))); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGAnimatedEnumerationImpl.cpp b/ksvg/impl/SVGAnimatedEnumerationImpl.cpp new file mode 100644 index 00000000..11e769ba --- /dev/null +++ b/ksvg/impl/SVGAnimatedEnumerationImpl.cpp @@ -0,0 +1,91 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedEnumerationImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedEnumerationImpl.lut.h" +#include "ksvg_bridge.h" + +SVGAnimatedEnumerationImpl::SVGAnimatedEnumerationImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS + + m_baseVal = 0; + m_animVal = 0; +} + +SVGAnimatedEnumerationImpl::~SVGAnimatedEnumerationImpl() +{ +} + +void SVGAnimatedEnumerationImpl::setBaseVal(unsigned short baseVal) +{ + m_baseVal = baseVal; +} + +unsigned short SVGAnimatedEnumerationImpl::baseVal() const +{ + return m_baseVal; +} + +unsigned short SVGAnimatedEnumerationImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedEnumerationImpl::s_hashTable 3 + baseVal SVGAnimatedEnumerationImpl::BaseVal DontDelete + animVal SVGAnimatedEnumerationImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedEnumerationImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case BaseVal: + return Number(baseVal()); + case AnimVal: + return Number(animVal()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGAnimatedEnumerationImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case BaseVal: + setBaseVal(static_cast(value.toNumber(exec))); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGAnimatedIntegerImpl.cc b/ksvg/impl/SVGAnimatedIntegerImpl.cc deleted file mode 100644 index 00999e0e..00000000 --- a/ksvg/impl/SVGAnimatedIntegerImpl.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedIntegerImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedIntegerImpl.lut.h" -#include "ksvg_bridge.h" - -SVGAnimatedIntegerImpl::SVGAnimatedIntegerImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS - - m_baseVal = 0; - m_animVal = 0; -} - -SVGAnimatedIntegerImpl::~SVGAnimatedIntegerImpl() -{ -} - -void SVGAnimatedIntegerImpl::setBaseVal(long baseVal) -{ - m_baseVal = baseVal; -} - -long SVGAnimatedIntegerImpl::baseVal() const -{ - return m_baseVal; -} - -long SVGAnimatedIntegerImpl::animVal() const -{ - return m_animVal; -} - -/* -@namespace KSVG -@begin SVGAnimatedIntegerImpl::s_hashTable 3 - baseVal SVGAnimatedIntegerImpl::BaseVal DontDelete - animVal SVGAnimatedIntegerImpl::AnimVal DontDelete -@end -*/ - -Value SVGAnimatedIntegerImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case BaseVal: - return Number(baseVal()); - case AnimVal: - return Number(animVal()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } - return KJS::Undefined(); -} - -void SVGAnimatedIntegerImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case BaseVal: - setBaseVal(value.toInteger(exec)); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGAnimatedIntegerImpl.cpp b/ksvg/impl/SVGAnimatedIntegerImpl.cpp new file mode 100644 index 00000000..00999e0e --- /dev/null +++ b/ksvg/impl/SVGAnimatedIntegerImpl.cpp @@ -0,0 +1,89 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedIntegerImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedIntegerImpl.lut.h" +#include "ksvg_bridge.h" + +SVGAnimatedIntegerImpl::SVGAnimatedIntegerImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS + + m_baseVal = 0; + m_animVal = 0; +} + +SVGAnimatedIntegerImpl::~SVGAnimatedIntegerImpl() +{ +} + +void SVGAnimatedIntegerImpl::setBaseVal(long baseVal) +{ + m_baseVal = baseVal; +} + +long SVGAnimatedIntegerImpl::baseVal() const +{ + return m_baseVal; +} + +long SVGAnimatedIntegerImpl::animVal() const +{ + return m_animVal; +} + +/* +@namespace KSVG +@begin SVGAnimatedIntegerImpl::s_hashTable 3 + baseVal SVGAnimatedIntegerImpl::BaseVal DontDelete + animVal SVGAnimatedIntegerImpl::AnimVal DontDelete +@end +*/ + +Value SVGAnimatedIntegerImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case BaseVal: + return Number(baseVal()); + case AnimVal: + return Number(animVal()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } + return KJS::Undefined(); +} + +void SVGAnimatedIntegerImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case BaseVal: + setBaseVal(value.toInteger(exec)); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGAnimatedLengthImpl.cc b/ksvg/impl/SVGAnimatedLengthImpl.cc deleted file mode 100644 index 1dead454..00000000 --- a/ksvg/impl/SVGAnimatedLengthImpl.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedLengthImpl.h" -#include "SVGElementImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedLengthImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAnimatedLengthImpl::SVGAnimatedLengthImpl(LengthMode mode, SVGElementImpl *object) : DOM::DomShared() -{ - m_baseVal = new SVGLengthImpl(mode, object); - m_baseVal->ref(); - - m_animVal = new SVGLengthImpl(mode, object); - m_animVal->ref(); -} - -SVGAnimatedLengthImpl::SVGAnimatedLengthImpl(const SVGAnimatedLengthImpl &other) : DOM::DomShared() -{ - (*this) = other; -} - -SVGAnimatedLengthImpl::~SVGAnimatedLengthImpl() -{ - if(m_baseVal) - m_baseVal->deref(); - if(m_animVal) - m_animVal->deref(); -} - -SVGAnimatedLengthImpl &SVGAnimatedLengthImpl::operator=(const SVGAnimatedLengthImpl &other) -{ - *m_baseVal = *(other.m_baseVal); - *m_animVal = *(other.m_animVal); - - return *this; -} - -SVGLengthImpl *SVGAnimatedLengthImpl::baseVal() const -{ - return m_baseVal; -} - -SVGLengthImpl *SVGAnimatedLengthImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedLengthImpl::s_hashTable 3 - baseVal SVGAnimatedLengthImpl::BaseVal DontDelete|ReadOnly - animVal SVGAnimatedLengthImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedLengthImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case BaseVal: - return m_baseVal->cache(exec); - case AnimVal: - return m_animVal->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGAnimatedLengthImpl.cpp b/ksvg/impl/SVGAnimatedLengthImpl.cpp new file mode 100644 index 00000000..1dead454 --- /dev/null +++ b/ksvg/impl/SVGAnimatedLengthImpl.cpp @@ -0,0 +1,94 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedLengthImpl.h" +#include "SVGElementImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedLengthImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAnimatedLengthImpl::SVGAnimatedLengthImpl(LengthMode mode, SVGElementImpl *object) : DOM::DomShared() +{ + m_baseVal = new SVGLengthImpl(mode, object); + m_baseVal->ref(); + + m_animVal = new SVGLengthImpl(mode, object); + m_animVal->ref(); +} + +SVGAnimatedLengthImpl::SVGAnimatedLengthImpl(const SVGAnimatedLengthImpl &other) : DOM::DomShared() +{ + (*this) = other; +} + +SVGAnimatedLengthImpl::~SVGAnimatedLengthImpl() +{ + if(m_baseVal) + m_baseVal->deref(); + if(m_animVal) + m_animVal->deref(); +} + +SVGAnimatedLengthImpl &SVGAnimatedLengthImpl::operator=(const SVGAnimatedLengthImpl &other) +{ + *m_baseVal = *(other.m_baseVal); + *m_animVal = *(other.m_animVal); + + return *this; +} + +SVGLengthImpl *SVGAnimatedLengthImpl::baseVal() const +{ + return m_baseVal; +} + +SVGLengthImpl *SVGAnimatedLengthImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedLengthImpl::s_hashTable 3 + baseVal SVGAnimatedLengthImpl::BaseVal DontDelete|ReadOnly + animVal SVGAnimatedLengthImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedLengthImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case BaseVal: + return m_baseVal->cache(exec); + case AnimVal: + return m_animVal->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGAnimatedLengthListImpl.cc b/ksvg/impl/SVGAnimatedLengthListImpl.cc deleted file mode 100644 index cd603f27..00000000 --- a/ksvg/impl/SVGAnimatedLengthListImpl.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedLengthListImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedLengthListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAnimatedLengthListImpl::SVGAnimatedLengthListImpl() : DOM::DomShared() -{ - m_baseVal = new SVGLengthListImpl(); - m_baseVal->ref(); - - m_animVal = new SVGLengthListImpl(); - m_animVal->ref(); -} - -SVGAnimatedLengthListImpl::SVGAnimatedLengthListImpl(const SVGAnimatedLengthListImpl &other) : DOM::DomShared() -{ - (*this) = other; -} - -SVGAnimatedLengthListImpl::~SVGAnimatedLengthListImpl() -{ - if(m_baseVal) - m_baseVal->deref(); - if(m_animVal) - m_animVal->deref(); -} - -SVGAnimatedLengthListImpl &SVGAnimatedLengthListImpl::operator=(const SVGAnimatedLengthListImpl &other) -{ - *m_baseVal = *(other.m_baseVal); - *m_animVal = *(other.m_animVal); - - return *this; -} - -SVGLengthListImpl *SVGAnimatedLengthListImpl::baseVal() const -{ - return m_baseVal; -} - -SVGLengthListImpl *SVGAnimatedLengthListImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedLengthListImpl::s_hashTable 3 - baseVal SVGAnimatedLengthListImpl::BaseVal DontDelete|ReadOnly - animVal SVGAnimatedLengthListImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedLengthListImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case BaseVal: - return m_baseVal->cache(exec); - case AnimVal: - return m_animVal->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGAnimatedLengthListImpl.cpp b/ksvg/impl/SVGAnimatedLengthListImpl.cpp new file mode 100644 index 00000000..cd603f27 --- /dev/null +++ b/ksvg/impl/SVGAnimatedLengthListImpl.cpp @@ -0,0 +1,93 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedLengthListImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedLengthListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAnimatedLengthListImpl::SVGAnimatedLengthListImpl() : DOM::DomShared() +{ + m_baseVal = new SVGLengthListImpl(); + m_baseVal->ref(); + + m_animVal = new SVGLengthListImpl(); + m_animVal->ref(); +} + +SVGAnimatedLengthListImpl::SVGAnimatedLengthListImpl(const SVGAnimatedLengthListImpl &other) : DOM::DomShared() +{ + (*this) = other; +} + +SVGAnimatedLengthListImpl::~SVGAnimatedLengthListImpl() +{ + if(m_baseVal) + m_baseVal->deref(); + if(m_animVal) + m_animVal->deref(); +} + +SVGAnimatedLengthListImpl &SVGAnimatedLengthListImpl::operator=(const SVGAnimatedLengthListImpl &other) +{ + *m_baseVal = *(other.m_baseVal); + *m_animVal = *(other.m_animVal); + + return *this; +} + +SVGLengthListImpl *SVGAnimatedLengthListImpl::baseVal() const +{ + return m_baseVal; +} + +SVGLengthListImpl *SVGAnimatedLengthListImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedLengthListImpl::s_hashTable 3 + baseVal SVGAnimatedLengthListImpl::BaseVal DontDelete|ReadOnly + animVal SVGAnimatedLengthListImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedLengthListImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case BaseVal: + return m_baseVal->cache(exec); + case AnimVal: + return m_animVal->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGAnimatedNumberImpl.cc b/ksvg/impl/SVGAnimatedNumberImpl.cc deleted file mode 100644 index 890d1895..00000000 --- a/ksvg/impl/SVGAnimatedNumberImpl.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedNumberImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedNumberImpl.lut.h" -#include "ksvg_bridge.h" - -SVGAnimatedNumberImpl::SVGAnimatedNumberImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS - - m_baseVal = 0; - m_animVal = 0; -} - -SVGAnimatedNumberImpl::~SVGAnimatedNumberImpl() -{ -} - -void SVGAnimatedNumberImpl::setBaseVal(float baseVal) -{ - m_baseVal = baseVal; -} - -float SVGAnimatedNumberImpl::baseVal() const -{ - return m_baseVal; -} - -float SVGAnimatedNumberImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedNumberImpl::s_hashTable 3 - baseVal SVGAnimatedNumberImpl::BaseVal DontDelete - animVal SVGAnimatedNumberImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedNumberImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case BaseVal: - return Number(baseVal()); - case AnimVal: - return Number(animVal()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } - - return Undefined(); -} - -void SVGAnimatedNumberImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case BaseVal: - setBaseVal(value.toNumber(exec)); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGAnimatedNumberImpl.cpp b/ksvg/impl/SVGAnimatedNumberImpl.cpp new file mode 100644 index 00000000..890d1895 --- /dev/null +++ b/ksvg/impl/SVGAnimatedNumberImpl.cpp @@ -0,0 +1,92 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedNumberImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedNumberImpl.lut.h" +#include "ksvg_bridge.h" + +SVGAnimatedNumberImpl::SVGAnimatedNumberImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS + + m_baseVal = 0; + m_animVal = 0; +} + +SVGAnimatedNumberImpl::~SVGAnimatedNumberImpl() +{ +} + +void SVGAnimatedNumberImpl::setBaseVal(float baseVal) +{ + m_baseVal = baseVal; +} + +float SVGAnimatedNumberImpl::baseVal() const +{ + return m_baseVal; +} + +float SVGAnimatedNumberImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedNumberImpl::s_hashTable 3 + baseVal SVGAnimatedNumberImpl::BaseVal DontDelete + animVal SVGAnimatedNumberImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedNumberImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case BaseVal: + return Number(baseVal()); + case AnimVal: + return Number(animVal()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } + + return Undefined(); +} + +void SVGAnimatedNumberImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case BaseVal: + setBaseVal(value.toNumber(exec)); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGAnimatedNumberListImpl.cc b/ksvg/impl/SVGAnimatedNumberListImpl.cc deleted file mode 100644 index b04b31c0..00000000 --- a/ksvg/impl/SVGAnimatedNumberListImpl.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedNumberListImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedNumberListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAnimatedNumberListImpl::SVGAnimatedNumberListImpl() : DOM::DomShared() -{ - m_baseVal = new SVGNumberListImpl(); - m_baseVal->ref(); - - m_animVal = new SVGNumberListImpl(); - m_animVal->ref(); -} - -SVGAnimatedNumberListImpl::~SVGAnimatedNumberListImpl() -{ - if(m_baseVal) - m_baseVal->deref(); - if(m_animVal) - m_animVal->deref(); -} - -SVGNumberListImpl *SVGAnimatedNumberListImpl::baseVal() const -{ - return m_baseVal; -} - -SVGNumberListImpl *SVGAnimatedNumberListImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedNumberListImpl::s_hashTable 3 - baseVal SVGAnimatedNumberListImpl::BaseVal DontDelete|ReadOnly - animVal SVGAnimatedNumberListImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedNumberListImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case BaseVal: - return m_baseVal->cache(exec); - case AnimVal: - return m_animVal->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGAnimatedNumberListImpl.cpp b/ksvg/impl/SVGAnimatedNumberListImpl.cpp new file mode 100644 index 00000000..b04b31c0 --- /dev/null +++ b/ksvg/impl/SVGAnimatedNumberListImpl.cpp @@ -0,0 +1,80 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedNumberListImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedNumberListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAnimatedNumberListImpl::SVGAnimatedNumberListImpl() : DOM::DomShared() +{ + m_baseVal = new SVGNumberListImpl(); + m_baseVal->ref(); + + m_animVal = new SVGNumberListImpl(); + m_animVal->ref(); +} + +SVGAnimatedNumberListImpl::~SVGAnimatedNumberListImpl() +{ + if(m_baseVal) + m_baseVal->deref(); + if(m_animVal) + m_animVal->deref(); +} + +SVGNumberListImpl *SVGAnimatedNumberListImpl::baseVal() const +{ + return m_baseVal; +} + +SVGNumberListImpl *SVGAnimatedNumberListImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedNumberListImpl::s_hashTable 3 + baseVal SVGAnimatedNumberListImpl::BaseVal DontDelete|ReadOnly + animVal SVGAnimatedNumberListImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedNumberListImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case BaseVal: + return m_baseVal->cache(exec); + case AnimVal: + return m_animVal->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGAnimatedPathDataImpl.cc b/ksvg/impl/SVGAnimatedPathDataImpl.cc deleted file mode 100644 index d0d7faae..00000000 --- a/ksvg/impl/SVGAnimatedPathDataImpl.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegListImpl.h" -#include "SVGAnimatedPathDataImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedPathDataImpl.lut.h" -#include "ksvg_bridge.h" - -SVGAnimatedPathDataImpl::SVGAnimatedPathDataImpl() : DOM::DomShared() -{ - m_pathSegList = new SVGPathSegListImpl(); - m_pathSegList->ref(); - - m_normalizedPathSegList = new SVGPathSegListImpl(); - m_normalizedPathSegList->ref(); - - m_animatedPathSegList = new SVGPathSegListImpl(); - m_animatedPathSegList->ref(); - - m_animatedNormalizedPathSegList = new SVGPathSegListImpl(); - m_animatedNormalizedPathSegList->ref(); -} - -SVGAnimatedPathDataImpl::~SVGAnimatedPathDataImpl() -{ - if(m_pathSegList) - m_pathSegList->deref(); - if(m_normalizedPathSegList) - m_normalizedPathSegList->deref(); - if(m_animatedPathSegList) - m_animatedPathSegList->deref(); - if(m_animatedNormalizedPathSegList) - m_animatedNormalizedPathSegList->deref(); -} - -SVGPathSegListImpl *SVGAnimatedPathDataImpl::pathSegList() const -{ - return m_pathSegList; -} - -SVGPathSegListImpl *SVGAnimatedPathDataImpl::normalizedPathSegList() const -{ - return m_normalizedPathSegList; -} - -SVGPathSegListImpl *SVGAnimatedPathDataImpl::animatedPathSegList() const -{ - return m_animatedPathSegList; -} - -SVGPathSegListImpl *SVGAnimatedPathDataImpl::animatedNormalizedPathSegList() const -{ - return m_animatedNormalizedPathSegList; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedPathDataImpl::s_hashTable 5 - pathSegList SVGAnimatedPathDataImpl::PathSegList DontDelete|ReadOnly - normalizedPathSegList SVGAnimatedPathDataImpl::NormalizedPathSegList DontDelete|ReadOnly - animatedPathSegList SVGAnimatedPathDataImpl::AnimatedPathSegList DontDelete|ReadOnly - animatedNormalizedPathSegList SVGAnimatedPathDataImpl::AnimatedNormalizedPathSegList DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedPathDataImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case PathSegList: - return pathSegList()->cache(exec); - case NormalizedPathSegList: - return normalizedPathSegList()->cache(exec); - case AnimatedPathSegList: - return animatedPathSegList()->cache(exec); - case AnimatedNormalizedPathSegList: - return animatedNormalizedPathSegList()->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); -} -} diff --git a/ksvg/impl/SVGAnimatedPathDataImpl.cpp b/ksvg/impl/SVGAnimatedPathDataImpl.cpp new file mode 100644 index 00000000..d0d7faae --- /dev/null +++ b/ksvg/impl/SVGAnimatedPathDataImpl.cpp @@ -0,0 +1,106 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegListImpl.h" +#include "SVGAnimatedPathDataImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedPathDataImpl.lut.h" +#include "ksvg_bridge.h" + +SVGAnimatedPathDataImpl::SVGAnimatedPathDataImpl() : DOM::DomShared() +{ + m_pathSegList = new SVGPathSegListImpl(); + m_pathSegList->ref(); + + m_normalizedPathSegList = new SVGPathSegListImpl(); + m_normalizedPathSegList->ref(); + + m_animatedPathSegList = new SVGPathSegListImpl(); + m_animatedPathSegList->ref(); + + m_animatedNormalizedPathSegList = new SVGPathSegListImpl(); + m_animatedNormalizedPathSegList->ref(); +} + +SVGAnimatedPathDataImpl::~SVGAnimatedPathDataImpl() +{ + if(m_pathSegList) + m_pathSegList->deref(); + if(m_normalizedPathSegList) + m_normalizedPathSegList->deref(); + if(m_animatedPathSegList) + m_animatedPathSegList->deref(); + if(m_animatedNormalizedPathSegList) + m_animatedNormalizedPathSegList->deref(); +} + +SVGPathSegListImpl *SVGAnimatedPathDataImpl::pathSegList() const +{ + return m_pathSegList; +} + +SVGPathSegListImpl *SVGAnimatedPathDataImpl::normalizedPathSegList() const +{ + return m_normalizedPathSegList; +} + +SVGPathSegListImpl *SVGAnimatedPathDataImpl::animatedPathSegList() const +{ + return m_animatedPathSegList; +} + +SVGPathSegListImpl *SVGAnimatedPathDataImpl::animatedNormalizedPathSegList() const +{ + return m_animatedNormalizedPathSegList; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedPathDataImpl::s_hashTable 5 + pathSegList SVGAnimatedPathDataImpl::PathSegList DontDelete|ReadOnly + normalizedPathSegList SVGAnimatedPathDataImpl::NormalizedPathSegList DontDelete|ReadOnly + animatedPathSegList SVGAnimatedPathDataImpl::AnimatedPathSegList DontDelete|ReadOnly + animatedNormalizedPathSegList SVGAnimatedPathDataImpl::AnimatedNormalizedPathSegList DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedPathDataImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case PathSegList: + return pathSegList()->cache(exec); + case NormalizedPathSegList: + return normalizedPathSegList()->cache(exec); + case AnimatedPathSegList: + return animatedPathSegList()->cache(exec); + case AnimatedNormalizedPathSegList: + return animatedNormalizedPathSegList()->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); +} +} diff --git a/ksvg/impl/SVGAnimatedPointsImpl.cc b/ksvg/impl/SVGAnimatedPointsImpl.cc deleted file mode 100644 index 22246286..00000000 --- a/ksvg/impl/SVGAnimatedPointsImpl.cc +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "CanvasItem.h" -#include "SVGPointListImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedPointsImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedPointsImpl.lut.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGAnimatedPointsImpl::SVGAnimatedPointsImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS - - m_points = new SVGPointListImpl(); - m_points->ref(); - - m_animatedPoints = new SVGPointListImpl(); - m_animatedPoints->ref(); -} - -SVGAnimatedPointsImpl::~SVGAnimatedPointsImpl() -{ - if(m_points) - m_points->deref(); - if(m_animatedPoints) - m_animatedPoints->deref(); -} - -SVGPointListImpl *SVGAnimatedPointsImpl::points() const -{ - return m_points; -} - -SVGPointListImpl *SVGAnimatedPointsImpl::animatedPoints() const -{ - return m_animatedPoints; -} - -void SVGAnimatedPointsImpl::parsePoints(TQString _points, SVGPointListImpl *points) -{ - if(_points.isEmpty()) - return; - - _points = _points.simplifyWhiteSpace(); - - if(_points.contains(",,") || _points.contains(", ,")) - return; - - _points.replace(',', ' '); - _points.replace('\r', TQString()); - _points.replace('\n', TQString()); - - _points = _points.simplifyWhiteSpace(); - - TQStringList pointList = TQStringList::split(' ', _points); - for(TQStringList::Iterator it = pointList.begin(); it != pointList.end(); it++) - { - SVGPointImpl *point = SVGSVGElementImpl::createSVGPoint(); - point->setX((*(it++)).toFloat()); - point->setY((*it).toFloat()); - - points->appendItem(point); - } -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedPointsImpl::s_hashTable 3 - points SVGAnimatedPointsImpl::Points DontDelete|ReadOnly - animatedPoints SVGAnimatedPointsImpl::AnimatedPoints DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedPointsImpl::getValueProperty(ExecState *exec, int token) const -{ - //KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case Points: // TODO: We need a pointList->toText function, quite trivial -// if(!attributeMode) - return points()->cache(exec); - case AnimatedPoints: - return animatedPoints()->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGAnimatedPointsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Points: - parsePoints(value.toString(exec).qstring(), m_points); - break; - case AnimatedPoints: - parsePoints(value.toString(exec).qstring(), m_animatedPoints); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGAnimatedPointsImpl.cpp b/ksvg/impl/SVGAnimatedPointsImpl.cpp new file mode 100644 index 00000000..22246286 --- /dev/null +++ b/ksvg/impl/SVGAnimatedPointsImpl.cpp @@ -0,0 +1,137 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "CanvasItem.h" +#include "SVGPointListImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedPointsImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedPointsImpl.lut.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGAnimatedPointsImpl::SVGAnimatedPointsImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS + + m_points = new SVGPointListImpl(); + m_points->ref(); + + m_animatedPoints = new SVGPointListImpl(); + m_animatedPoints->ref(); +} + +SVGAnimatedPointsImpl::~SVGAnimatedPointsImpl() +{ + if(m_points) + m_points->deref(); + if(m_animatedPoints) + m_animatedPoints->deref(); +} + +SVGPointListImpl *SVGAnimatedPointsImpl::points() const +{ + return m_points; +} + +SVGPointListImpl *SVGAnimatedPointsImpl::animatedPoints() const +{ + return m_animatedPoints; +} + +void SVGAnimatedPointsImpl::parsePoints(TQString _points, SVGPointListImpl *points) +{ + if(_points.isEmpty()) + return; + + _points = _points.simplifyWhiteSpace(); + + if(_points.contains(",,") || _points.contains(", ,")) + return; + + _points.replace(',', ' '); + _points.replace('\r', TQString()); + _points.replace('\n', TQString()); + + _points = _points.simplifyWhiteSpace(); + + TQStringList pointList = TQStringList::split(' ', _points); + for(TQStringList::Iterator it = pointList.begin(); it != pointList.end(); it++) + { + SVGPointImpl *point = SVGSVGElementImpl::createSVGPoint(); + point->setX((*(it++)).toFloat()); + point->setY((*it).toFloat()); + + points->appendItem(point); + } +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedPointsImpl::s_hashTable 3 + points SVGAnimatedPointsImpl::Points DontDelete|ReadOnly + animatedPoints SVGAnimatedPointsImpl::AnimatedPoints DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedPointsImpl::getValueProperty(ExecState *exec, int token) const +{ + //KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case Points: // TODO: We need a pointList->toText function, quite trivial +// if(!attributeMode) + return points()->cache(exec); + case AnimatedPoints: + return animatedPoints()->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGAnimatedPointsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Points: + parsePoints(value.toString(exec).qstring(), m_points); + break; + case AnimatedPoints: + parsePoints(value.toString(exec).qstring(), m_animatedPoints); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cc b/ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cc deleted file mode 100644 index 24ab74a5..00000000 --- a/ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPreserveAspectRatioImpl.h" -#include "SVGAnimatedPreserveAspectRatioImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedPreserveAspectRatioImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAnimatedPreserveAspectRatioImpl::SVGAnimatedPreserveAspectRatioImpl() : DOM::DomShared() -{ - m_baseVal = new SVGPreserveAspectRatioImpl(); - m_baseVal->ref(); - - m_animVal = new SVGPreserveAspectRatioImpl(); - m_animVal->ref(); -} - -SVGAnimatedPreserveAspectRatioImpl::~SVGAnimatedPreserveAspectRatioImpl() -{ - if(m_baseVal) - m_baseVal->deref(); - if(m_animVal) - m_animVal->deref(); -} - -SVGPreserveAspectRatioImpl *SVGAnimatedPreserveAspectRatioImpl::baseVal() const -{ - return m_baseVal; -} - -SVGPreserveAspectRatioImpl *SVGAnimatedPreserveAspectRatioImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedPreserveAspectRatioImpl::s_hashTable 3 - baseVal SVGAnimatedPreserveAspectRatioImpl::BaseVal DontDelete|ReadOnly - animVal SVGAnimatedPreserveAspectRatioImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedPreserveAspectRatioImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case BaseVal: - return m_baseVal->cache(exec); - case AnimVal: - return m_animVal->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cpp b/ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cpp new file mode 100644 index 00000000..24ab74a5 --- /dev/null +++ b/ksvg/impl/SVGAnimatedPreserveAspectRatioImpl.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPreserveAspectRatioImpl.h" +#include "SVGAnimatedPreserveAspectRatioImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedPreserveAspectRatioImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAnimatedPreserveAspectRatioImpl::SVGAnimatedPreserveAspectRatioImpl() : DOM::DomShared() +{ + m_baseVal = new SVGPreserveAspectRatioImpl(); + m_baseVal->ref(); + + m_animVal = new SVGPreserveAspectRatioImpl(); + m_animVal->ref(); +} + +SVGAnimatedPreserveAspectRatioImpl::~SVGAnimatedPreserveAspectRatioImpl() +{ + if(m_baseVal) + m_baseVal->deref(); + if(m_animVal) + m_animVal->deref(); +} + +SVGPreserveAspectRatioImpl *SVGAnimatedPreserveAspectRatioImpl::baseVal() const +{ + return m_baseVal; +} + +SVGPreserveAspectRatioImpl *SVGAnimatedPreserveAspectRatioImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedPreserveAspectRatioImpl::s_hashTable 3 + baseVal SVGAnimatedPreserveAspectRatioImpl::BaseVal DontDelete|ReadOnly + animVal SVGAnimatedPreserveAspectRatioImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedPreserveAspectRatioImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case BaseVal: + return m_baseVal->cache(exec); + case AnimVal: + return m_animVal->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGAnimatedRectImpl.cc b/ksvg/impl/SVGAnimatedRectImpl.cc deleted file mode 100644 index 62a35e1e..00000000 --- a/ksvg/impl/SVGAnimatedRectImpl.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGRectImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedRectImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedRectImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAnimatedRectImpl::SVGAnimatedRectImpl() : DOM::DomShared() -{ - m_baseVal = SVGSVGElementImpl::createSVGRect(); - m_animVal = SVGSVGElementImpl::createSVGRect(); -} - -SVGAnimatedRectImpl::~SVGAnimatedRectImpl() -{ - if(m_baseVal) - m_baseVal->deref(); - if(m_animVal) - m_animVal->deref(); -} - -SVGRectImpl *SVGAnimatedRectImpl::baseVal() const -{ - return m_baseVal; -} - -SVGRectImpl *SVGAnimatedRectImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedRectImpl::s_hashTable 3 - baseVal SVGAnimatedRectImpl::BaseVal DontDelete - animVal SVGAnimatedRectImpl::AnimVal DontDelete -@end -*/ - -Value SVGAnimatedRectImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case BaseVal: - return m_baseVal->cache(exec); - case AnimVal: - return m_animVal->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGAnimatedRectImpl.cpp b/ksvg/impl/SVGAnimatedRectImpl.cpp new file mode 100644 index 00000000..62a35e1e --- /dev/null +++ b/ksvg/impl/SVGAnimatedRectImpl.cpp @@ -0,0 +1,79 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGRectImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedRectImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedRectImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAnimatedRectImpl::SVGAnimatedRectImpl() : DOM::DomShared() +{ + m_baseVal = SVGSVGElementImpl::createSVGRect(); + m_animVal = SVGSVGElementImpl::createSVGRect(); +} + +SVGAnimatedRectImpl::~SVGAnimatedRectImpl() +{ + if(m_baseVal) + m_baseVal->deref(); + if(m_animVal) + m_animVal->deref(); +} + +SVGRectImpl *SVGAnimatedRectImpl::baseVal() const +{ + return m_baseVal; +} + +SVGRectImpl *SVGAnimatedRectImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedRectImpl::s_hashTable 3 + baseVal SVGAnimatedRectImpl::BaseVal DontDelete + animVal SVGAnimatedRectImpl::AnimVal DontDelete +@end +*/ + +Value SVGAnimatedRectImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case BaseVal: + return m_baseVal->cache(exec); + case AnimVal: + return m_animVal->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGAnimatedStringImpl.cc b/ksvg/impl/SVGAnimatedStringImpl.cc deleted file mode 100644 index 90b58d83..00000000 --- a/ksvg/impl/SVGAnimatedStringImpl.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedStringImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedStringImpl.lut.h" -#include "ksvg_bridge.h" - -SVGAnimatedStringImpl::SVGAnimatedStringImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS -} - -SVGAnimatedStringImpl::~SVGAnimatedStringImpl() -{ -} - -void SVGAnimatedStringImpl::setBaseVal(const DOM::DOMString &baseVal) -{ - m_baseVal = baseVal; -} - -DOM::DOMString SVGAnimatedStringImpl::baseVal() const -{ - return m_baseVal; -} - -DOM::DOMString SVGAnimatedStringImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedStringImpl::s_hashTable 3 - baseVal SVGAnimatedStringImpl::BaseVal DontDelete - animVal SVGAnimatedStringImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedStringImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case BaseVal: - return String(baseVal().string()); - case AnimVal: - return String(animVal().string()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGAnimatedStringImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case BaseVal: - setBaseVal(value.toString(exec).string()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGAnimatedStringImpl.cpp b/ksvg/impl/SVGAnimatedStringImpl.cpp new file mode 100644 index 00000000..90b58d83 --- /dev/null +++ b/ksvg/impl/SVGAnimatedStringImpl.cpp @@ -0,0 +1,88 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedStringImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedStringImpl.lut.h" +#include "ksvg_bridge.h" + +SVGAnimatedStringImpl::SVGAnimatedStringImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS +} + +SVGAnimatedStringImpl::~SVGAnimatedStringImpl() +{ +} + +void SVGAnimatedStringImpl::setBaseVal(const DOM::DOMString &baseVal) +{ + m_baseVal = baseVal; +} + +DOM::DOMString SVGAnimatedStringImpl::baseVal() const +{ + return m_baseVal; +} + +DOM::DOMString SVGAnimatedStringImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedStringImpl::s_hashTable 3 + baseVal SVGAnimatedStringImpl::BaseVal DontDelete + animVal SVGAnimatedStringImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedStringImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case BaseVal: + return String(baseVal().string()); + case AnimVal: + return String(animVal().string()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGAnimatedStringImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case BaseVal: + setBaseVal(value.toString(exec).string()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGAnimatedTransformListImpl.cc b/ksvg/impl/SVGAnimatedTransformListImpl.cc deleted file mode 100644 index 6c191c06..00000000 --- a/ksvg/impl/SVGAnimatedTransformListImpl.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGTransformListImpl.h" -#include "SVGAnimatedTransformListImpl.h" - -using namespace KSVG; - -#include "SVGAnimatedTransformListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGAnimatedTransformListImpl::SVGAnimatedTransformListImpl() : DOM::DomShared() -{ - m_baseVal = new SVGTransformListImpl(); - m_baseVal->ref(); - - m_animVal = new SVGTransformListImpl(); - m_animVal->ref(); -} - -SVGAnimatedTransformListImpl::~SVGAnimatedTransformListImpl() -{ - if(m_baseVal) - m_baseVal->deref(); - if(m_animVal) - m_animVal->deref(); -} - -SVGTransformListImpl *SVGAnimatedTransformListImpl::baseVal() const -{ - return m_baseVal; -} - -SVGTransformListImpl *SVGAnimatedTransformListImpl::animVal() const -{ - return m_animVal; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGAnimatedTransformListImpl::s_hashTable 3 - baseVal SVGAnimatedTransformListImpl::BaseVal DontDelete|ReadOnly - animVal SVGAnimatedTransformListImpl::AnimVal DontDelete|ReadOnly -@end -*/ - -Value SVGAnimatedTransformListImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case BaseVal: - return m_baseVal->cache(exec); - case AnimVal: - return m_animVal->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGAnimatedTransformListImpl.cpp b/ksvg/impl/SVGAnimatedTransformListImpl.cpp new file mode 100644 index 00000000..6c191c06 --- /dev/null +++ b/ksvg/impl/SVGAnimatedTransformListImpl.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGTransformListImpl.h" +#include "SVGAnimatedTransformListImpl.h" + +using namespace KSVG; + +#include "SVGAnimatedTransformListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGAnimatedTransformListImpl::SVGAnimatedTransformListImpl() : DOM::DomShared() +{ + m_baseVal = new SVGTransformListImpl(); + m_baseVal->ref(); + + m_animVal = new SVGTransformListImpl(); + m_animVal->ref(); +} + +SVGAnimatedTransformListImpl::~SVGAnimatedTransformListImpl() +{ + if(m_baseVal) + m_baseVal->deref(); + if(m_animVal) + m_animVal->deref(); +} + +SVGTransformListImpl *SVGAnimatedTransformListImpl::baseVal() const +{ + return m_baseVal; +} + +SVGTransformListImpl *SVGAnimatedTransformListImpl::animVal() const +{ + return m_animVal; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGAnimatedTransformListImpl::s_hashTable 3 + baseVal SVGAnimatedTransformListImpl::BaseVal DontDelete|ReadOnly + animVal SVGAnimatedTransformListImpl::AnimVal DontDelete|ReadOnly +@end +*/ + +Value SVGAnimatedTransformListImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case BaseVal: + return m_baseVal->cache(exec); + case AnimVal: + return m_animVal->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGAnimationElementImpl.cc b/ksvg/impl/SVGAnimationElementImpl.cc deleted file mode 100644 index b87a9829..00000000 --- a/ksvg/impl/SVGAnimationElementImpl.cc +++ /dev/null @@ -1,463 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include - -#include "CanvasItem.h" -#include "SVGHelperImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGStringListImpl.h" -#include "SVGURIReferenceImpl.h" -#include "SVGAnimationElementImpl.h" - -using namespace KSVG; - -#include "SVGAnimationElementImpl.lut.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGAnimationElementImpl::SVGAnimationElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGTestsImpl(), SVGExternalResourcesRequiredImpl() -{ - KSVG_EMPTY_FLAGS - - m_connected = false; - m_targetElement = 0; - - m_values = new SVGStringListImpl(); - m_keyTimes= new SVGStringListImpl(); - m_keySplines = new SVGStringListImpl(); - - m_fill = REMOVE; - m_additive = REPLACE; - m_accumulate = ACCUMULATE_NONE; -} - -SVGAnimationElementImpl::~SVGAnimationElementImpl() -{ - if(m_targetElement) - m_targetElement->deref(); -} - -SVGElementImpl *SVGAnimationElementImpl::targetElement() const -{ - if(!m_targetElement) - { - SVGAnimationElementImpl *modify = const_cast(this); - if(!m_href.isEmpty()) - modify->setTargetElement(ownerDoc()->getElementByIdRecursive(ownerSVGElement(), SVGURIReferenceImpl::getTarget(m_href))); - else if(!parentNode().isNull()) - modify->setTargetElement(ownerDoc()->getElementFromHandle(parentNode().handle())); - } - - return m_targetElement; -} - -double SVGAnimationElementImpl::parseClockValue(const TQString &data) const -{ - TQString parse = data.stripWhiteSpace(); - TQString debugOutput = "parseClockValue(" + parse + ") -> "; - - if(parse == "indefinite") // Saves some time... - return -1; - - double result; - - int doublePointOne = parse.find(':'); - int doublePointTwo = parse.find(':', doublePointOne + 1); - - if(doublePointOne != -1 && doublePointTwo != -1) // Spec: "Full clock values" - { - unsigned int hours = parse.mid(0, 2).toUInt(); - unsigned int minutes = parse.mid(3, 2).toUInt(); - unsigned int seconds = parse.mid(6, 2).toUInt(); - unsigned int milliseconds = 0; - - result = (3600 * hours) + (60 * minutes) + seconds; - - if(parse.find('.') != -1) - { - TQString temp = parse.mid(9, 2); - milliseconds = temp.toUInt(); - result += (milliseconds * (1 / pow(10.0, temp.length()))); - } - } - else if(doublePointOne != -1 && doublePointTwo == -1) // Spec: "Partial clock values" - { - unsigned int minutes = parse.mid(0, 2).toUInt(); - unsigned int seconds = parse.mid(3, 2).toUInt(); - unsigned int milliseconds = 0; - - result = (60 * minutes) + seconds; - - if(parse.find('.') != -1) - { - TQString temp = parse.mid(6, 2); - milliseconds = temp.toUInt(); - result += (milliseconds * (1 / pow(10.0, temp.length()))); - } - } - else // Spec: "Timecount values" - { - int dotPosition = parse.find('.'); - - if(parse.endsWith("h")) - { - if(dotPosition == -1) - result = parse.mid(0, parse.length() - 1).toUInt() * 3600; - else - { - result = parse.mid(0, dotPosition).toUInt() * 3600; - TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 2); - result += (3600.0 * temp.toUInt()) * (1 / pow(10.0, temp.length())); - } - } - else if(parse.endsWith("min")) - { - if(dotPosition == -1) - result = parse.mid(0, parse.length() - 3).toUInt() * 60; - else - { - result = parse.mid(0, dotPosition).toUInt() * 60; - TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 4); - result += (60.0 * temp.toUInt()) * (1 / pow(10.0, temp.length())); - } - } - else if(parse.endsWith("ms")) - { - if(dotPosition == -1) - result = parse.mid(0, parse.length() - 2).toUInt() / 1000.0; - else - { - result = parse.mid(0, dotPosition).toUInt() / 1000.0; - TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 3); - result += (temp.toUInt() / 1000.0) * (1 / pow(10.0, temp.length())); - } - } - else if(parse.endsWith("s")) - { - if(dotPosition == -1) - result = parse.mid(0, parse.length() - 1).toUInt(); - else - { - result = parse.mid(0, dotPosition).toUInt(); - TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 2); - result += temp.toUInt() * (1 / pow(10.0, temp.length())); - } - } - else - result = parse.toDouble(); - } - - kdDebug() << debugOutput << result << endl; - return result; -} - -/* -@namespace KSVG -@begin SVGAnimationElementImpl::s_hashTable 23 - targetElement SVGAnimationElementImpl::TargetElement DontDelete|ReadOnly - href SVGAnimationElementImpl::Href DontDelete|ReadOnly - additive SVGAnimationElementImpl::Additive DontDelete|ReadOnly - accumulate SVGAnimationElementImpl::Accumulate DontDelete|ReadOnly - attributeName SVGAnimationElementImpl::AttributeName DontDelete|ReadOnly - attributeType SVGAnimationElementImpl::AttributeType DontDelete|ReadOnly - calcMode SVGAnimationElementImpl::CalcMode DontDelete|ReadOnly - values SVGAnimationElementImpl::Values DontDelete|ReadOnly - keyTimes SVGAnimationElementImpl::KeyTimes DontDelete|ReadOnly - keySplines SVGAnimationElementImpl::KeySplines DontDelete|ReadOnly - from SVGAnimationElementImpl::From DontDelete|ReadOnly - to SVGAnimationElementImpl::To DontDelete|ReadOnly - by SVGAnimationElementImpl::By DontDelete|ReadOnly - begin SVGAnimationElementImpl::Begin DontDelete|ReadOnly - dur SVGAnimationElementImpl::Dur DontDelete|ReadOnly - end SVGAnimationElementImpl::End DontDelete|ReadOnly - min SVGAnimationElementImpl::Min DontDelete|ReadOnly - max SVGAnimationElementImpl::Max DontDelete|ReadOnly - restart SVGAnimationElementImpl::Restart DontDelete|ReadOnly - repeatCount SVGAnimationElementImpl::RepeatCount DontDelete|ReadOnly - repeatDur SVGAnimationElementImpl::RepeatDur DontDelete|ReadOnly - fill SVGAnimationElementImpl::Fill DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGAnimationElementImplProto::s_hashTable 5 - getStartTime SVGAnimationElementImpl::GetStartTime DontDelete|Function 0 - getCurrentTime SVGAnimationElementImpl::GetCurrentTime DontDelete|Function 0 - getSimpleDuration SVGAnimationElementImpl::GetSimpleDuration DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGAnimationElement",SVGAnimationElementImplProto,SVGAnimationElementImplProtoFunc) - -Value SVGAnimationElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case TargetElement: - return m_targetElement->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGAnimationElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - TQString val = value.toString(exec).qstring(); - switch(token) - { - case Href: - m_href = val; - break; - case Additive: - m_additive = (val == "sum") ? SUM : REPLACE; - break; - case Accumulate: - m_accumulate = (val == "sum") ? ACCUMULATE_SUM : ACCUMULATE_NONE; - break; - case AttributeName: - m_attributeName = val; - break; - case AttributeType: - if(val == "css") - m_attributeType = CSS; - else if(val == "xml") - m_attributeType = XML; - else - m_attributeType = AUTO; - break; - case CalcMode: // FIXME: See spec for default values!!! - if(val == "discrete") - m_calcMode = DISCRETE; - else if(val == "linear") - m_calcMode = LINEAR; - else if(val == "spline") - m_calcMode = SPLINE; - else if(val == "paced") - m_calcMode = PACED; - break; - case Values: - SVGHelperImpl::parseSemicolonSeperatedList(m_values, val); - break; - case KeyTimes: - SVGHelperImpl::parseSemicolonSeperatedList(m_keyTimes, val); - break; - case KeySplines: - SVGHelperImpl::parseSemicolonSeperatedList(m_keySplines, val); - break; - case From: - m_from = val; - break; - case To: - m_to = val; - break; - case By: - m_by = val; - break; - case Begin: - case End: - { - // Create list - SVGStringListImpl *temp = new SVGStringListImpl(); - temp->ref(); - - // Feed data into list - SVGHelperImpl::parseSemicolonSeperatedList(temp, val); - - // Parse data - for(unsigned int i = 0; i < temp->numberOfItems(); i++) - { - TQString current = temp->getItem(i)->string(); - - if(current.startsWith("accessKey")) - { - // Register keyDownEventListener for the character - TQString character = current.mid(current.length() - 2, 1); - - kdDebug() << "ACCESSKEY CHARACTER " << character << endl; - } - else if(current.startsWith("wallclock")) - { - int firstBrace = current.find("("); - int secondBrace = current.find(")"); - - TQString wallclockValue = current.mid(firstBrace + 1, secondBrace - firstBrace - 2); - - kdDebug() << "WALLCLOCK VALUE " << wallclockValue << endl; - } - else if(current.contains(".")) - { - int dotPosition = current.find("."); - - TQString element = current.mid(0, dotPosition); - TQString clockValue; - - if(current.contains("begin")) - clockValue = current.mid(dotPosition + 6); - else if(current.contains("end")) - clockValue = current.mid(dotPosition + 4); - else if(current.contains("repeat")) - clockValue = current.mid(dotPosition + 7); - else // DOM2 Event Reference - { - int plusMinusPosition = -1; - - if(current.contains("+")) - plusMinusPosition = current.find("+"); - else if(current.contains("-")) - plusMinusPosition = current.find("-"); - - TQString event = current.mid(dotPosition + 1, plusMinusPosition - dotPosition - 1); - - clockValue = current.mid(dotPosition + event.length() + 1); - kdDebug() << "EVENT " << event << endl; - } - - kdDebug() << "ELEMENT " << element << " CLOCKVALUE " << clockValue << endl; - } - else - { - if(token == Begin) - m_begin = parseClockValue(current); - else - m_end = parseClockValue(current); - } - } - - temp->deref(); - - break; - } - case Dur: - m_duration = parseClockValue(val); - break; -// case Min: -// case Max: - case Restart: - if(val == "whenNotActive") - m_restart = WHENNOTACTIVE; - else if(val == "never") - m_restart = NEVER; - else - m_restart = ALWAYS; - break; - case RepeatCount: - m_repeatCount = val; - break; - case RepeatDur: - m_repeatDur = val; - break; - case Fill: - m_fill = (val == "freeze") ? FREEZE : REMOVE; - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGAnimationElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) -{ - KSVG_CHECK_THIS(SVGAnimationElementImpl) - - switch(id) - { - case SVGAnimationElementImpl::GetStartTime: - return Number(obj->getStartTime()); - case SVGAnimationElementImpl::GetCurrentTime: - return Number(obj->getCurrentTime()); - case SVGAnimationElementImpl::GetSimpleDuration: - return Number(obj->getSimpleDuration()); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -void SVGAnimationElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: Default value is "replace" - if(KSVG_TOKEN_NOT_PARSED(Additive)) - KSVG_SET_ALT_ATTRIBUTE(Additive, "replace") - - // Spec: Default value is "none" - if(KSVG_TOKEN_NOT_PARSED(Accumulate)) - KSVG_SET_ALT_ATTRIBUTE(Accumulate, "none") - - // Spec: Default value is "always" - if(KSVG_TOKEN_NOT_PARSED(Restart)) - KSVG_SET_ALT_ATTRIBUTE(Restart, "always") -} - -void SVGAnimationElementImpl::setTargetElement(SVGElementImpl *target) -{ - if(m_targetElement) - m_targetElement->deref(); - - m_targetElement = target; - m_targetElement->ref(); -} - -void SVGAnimationElementImpl::applyAttribute(const TQString &name, const TQString &value) -{ - SVGElementImpl *target = targetElement(); - if(!target) - { - kdDebug() << k_funcinfo << " name: " << name << " value: " << value << " NO TARGET ELEMENT!" << endl; - return; - } - - // The only two cases I can imagine, where combining is needed (Niko) - bool combine = (name == "style" || name == "transform"); - - if(!combine) - target->setAttributeInternal(name, value); - else - { - kdDebug() << "TODO COMBINE: " << value << " NAME " << name << endl; - } -} - -double SVGAnimationElementImpl::getStartTime() const -{ - return m_begin; -} - -double SVGAnimationElementImpl::getCurrentTime() const -{ - return 0.0; -} - -double SVGAnimationElementImpl::getSimpleDuration() const -{ - return m_duration; -} diff --git a/ksvg/impl/SVGAnimationElementImpl.cpp b/ksvg/impl/SVGAnimationElementImpl.cpp new file mode 100644 index 00000000..b87a9829 --- /dev/null +++ b/ksvg/impl/SVGAnimationElementImpl.cpp @@ -0,0 +1,463 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include + +#include "CanvasItem.h" +#include "SVGHelperImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGStringListImpl.h" +#include "SVGURIReferenceImpl.h" +#include "SVGAnimationElementImpl.h" + +using namespace KSVG; + +#include "SVGAnimationElementImpl.lut.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGAnimationElementImpl::SVGAnimationElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGTestsImpl(), SVGExternalResourcesRequiredImpl() +{ + KSVG_EMPTY_FLAGS + + m_connected = false; + m_targetElement = 0; + + m_values = new SVGStringListImpl(); + m_keyTimes= new SVGStringListImpl(); + m_keySplines = new SVGStringListImpl(); + + m_fill = REMOVE; + m_additive = REPLACE; + m_accumulate = ACCUMULATE_NONE; +} + +SVGAnimationElementImpl::~SVGAnimationElementImpl() +{ + if(m_targetElement) + m_targetElement->deref(); +} + +SVGElementImpl *SVGAnimationElementImpl::targetElement() const +{ + if(!m_targetElement) + { + SVGAnimationElementImpl *modify = const_cast(this); + if(!m_href.isEmpty()) + modify->setTargetElement(ownerDoc()->getElementByIdRecursive(ownerSVGElement(), SVGURIReferenceImpl::getTarget(m_href))); + else if(!parentNode().isNull()) + modify->setTargetElement(ownerDoc()->getElementFromHandle(parentNode().handle())); + } + + return m_targetElement; +} + +double SVGAnimationElementImpl::parseClockValue(const TQString &data) const +{ + TQString parse = data.stripWhiteSpace(); + TQString debugOutput = "parseClockValue(" + parse + ") -> "; + + if(parse == "indefinite") // Saves some time... + return -1; + + double result; + + int doublePointOne = parse.find(':'); + int doublePointTwo = parse.find(':', doublePointOne + 1); + + if(doublePointOne != -1 && doublePointTwo != -1) // Spec: "Full clock values" + { + unsigned int hours = parse.mid(0, 2).toUInt(); + unsigned int minutes = parse.mid(3, 2).toUInt(); + unsigned int seconds = parse.mid(6, 2).toUInt(); + unsigned int milliseconds = 0; + + result = (3600 * hours) + (60 * minutes) + seconds; + + if(parse.find('.') != -1) + { + TQString temp = parse.mid(9, 2); + milliseconds = temp.toUInt(); + result += (milliseconds * (1 / pow(10.0, temp.length()))); + } + } + else if(doublePointOne != -1 && doublePointTwo == -1) // Spec: "Partial clock values" + { + unsigned int minutes = parse.mid(0, 2).toUInt(); + unsigned int seconds = parse.mid(3, 2).toUInt(); + unsigned int milliseconds = 0; + + result = (60 * minutes) + seconds; + + if(parse.find('.') != -1) + { + TQString temp = parse.mid(6, 2); + milliseconds = temp.toUInt(); + result += (milliseconds * (1 / pow(10.0, temp.length()))); + } + } + else // Spec: "Timecount values" + { + int dotPosition = parse.find('.'); + + if(parse.endsWith("h")) + { + if(dotPosition == -1) + result = parse.mid(0, parse.length() - 1).toUInt() * 3600; + else + { + result = parse.mid(0, dotPosition).toUInt() * 3600; + TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 2); + result += (3600.0 * temp.toUInt()) * (1 / pow(10.0, temp.length())); + } + } + else if(parse.endsWith("min")) + { + if(dotPosition == -1) + result = parse.mid(0, parse.length() - 3).toUInt() * 60; + else + { + result = parse.mid(0, dotPosition).toUInt() * 60; + TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 4); + result += (60.0 * temp.toUInt()) * (1 / pow(10.0, temp.length())); + } + } + else if(parse.endsWith("ms")) + { + if(dotPosition == -1) + result = parse.mid(0, parse.length() - 2).toUInt() / 1000.0; + else + { + result = parse.mid(0, dotPosition).toUInt() / 1000.0; + TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 3); + result += (temp.toUInt() / 1000.0) * (1 / pow(10.0, temp.length())); + } + } + else if(parse.endsWith("s")) + { + if(dotPosition == -1) + result = parse.mid(0, parse.length() - 1).toUInt(); + else + { + result = parse.mid(0, dotPosition).toUInt(); + TQString temp = parse.mid(dotPosition + 1, parse.length() - dotPosition - 2); + result += temp.toUInt() * (1 / pow(10.0, temp.length())); + } + } + else + result = parse.toDouble(); + } + + kdDebug() << debugOutput << result << endl; + return result; +} + +/* +@namespace KSVG +@begin SVGAnimationElementImpl::s_hashTable 23 + targetElement SVGAnimationElementImpl::TargetElement DontDelete|ReadOnly + href SVGAnimationElementImpl::Href DontDelete|ReadOnly + additive SVGAnimationElementImpl::Additive DontDelete|ReadOnly + accumulate SVGAnimationElementImpl::Accumulate DontDelete|ReadOnly + attributeName SVGAnimationElementImpl::AttributeName DontDelete|ReadOnly + attributeType SVGAnimationElementImpl::AttributeType DontDelete|ReadOnly + calcMode SVGAnimationElementImpl::CalcMode DontDelete|ReadOnly + values SVGAnimationElementImpl::Values DontDelete|ReadOnly + keyTimes SVGAnimationElementImpl::KeyTimes DontDelete|ReadOnly + keySplines SVGAnimationElementImpl::KeySplines DontDelete|ReadOnly + from SVGAnimationElementImpl::From DontDelete|ReadOnly + to SVGAnimationElementImpl::To DontDelete|ReadOnly + by SVGAnimationElementImpl::By DontDelete|ReadOnly + begin SVGAnimationElementImpl::Begin DontDelete|ReadOnly + dur SVGAnimationElementImpl::Dur DontDelete|ReadOnly + end SVGAnimationElementImpl::End DontDelete|ReadOnly + min SVGAnimationElementImpl::Min DontDelete|ReadOnly + max SVGAnimationElementImpl::Max DontDelete|ReadOnly + restart SVGAnimationElementImpl::Restart DontDelete|ReadOnly + repeatCount SVGAnimationElementImpl::RepeatCount DontDelete|ReadOnly + repeatDur SVGAnimationElementImpl::RepeatDur DontDelete|ReadOnly + fill SVGAnimationElementImpl::Fill DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGAnimationElementImplProto::s_hashTable 5 + getStartTime SVGAnimationElementImpl::GetStartTime DontDelete|Function 0 + getCurrentTime SVGAnimationElementImpl::GetCurrentTime DontDelete|Function 0 + getSimpleDuration SVGAnimationElementImpl::GetSimpleDuration DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGAnimationElement",SVGAnimationElementImplProto,SVGAnimationElementImplProtoFunc) + +Value SVGAnimationElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case TargetElement: + return m_targetElement->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGAnimationElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + TQString val = value.toString(exec).qstring(); + switch(token) + { + case Href: + m_href = val; + break; + case Additive: + m_additive = (val == "sum") ? SUM : REPLACE; + break; + case Accumulate: + m_accumulate = (val == "sum") ? ACCUMULATE_SUM : ACCUMULATE_NONE; + break; + case AttributeName: + m_attributeName = val; + break; + case AttributeType: + if(val == "css") + m_attributeType = CSS; + else if(val == "xml") + m_attributeType = XML; + else + m_attributeType = AUTO; + break; + case CalcMode: // FIXME: See spec for default values!!! + if(val == "discrete") + m_calcMode = DISCRETE; + else if(val == "linear") + m_calcMode = LINEAR; + else if(val == "spline") + m_calcMode = SPLINE; + else if(val == "paced") + m_calcMode = PACED; + break; + case Values: + SVGHelperImpl::parseSemicolonSeperatedList(m_values, val); + break; + case KeyTimes: + SVGHelperImpl::parseSemicolonSeperatedList(m_keyTimes, val); + break; + case KeySplines: + SVGHelperImpl::parseSemicolonSeperatedList(m_keySplines, val); + break; + case From: + m_from = val; + break; + case To: + m_to = val; + break; + case By: + m_by = val; + break; + case Begin: + case End: + { + // Create list + SVGStringListImpl *temp = new SVGStringListImpl(); + temp->ref(); + + // Feed data into list + SVGHelperImpl::parseSemicolonSeperatedList(temp, val); + + // Parse data + for(unsigned int i = 0; i < temp->numberOfItems(); i++) + { + TQString current = temp->getItem(i)->string(); + + if(current.startsWith("accessKey")) + { + // Register keyDownEventListener for the character + TQString character = current.mid(current.length() - 2, 1); + + kdDebug() << "ACCESSKEY CHARACTER " << character << endl; + } + else if(current.startsWith("wallclock")) + { + int firstBrace = current.find("("); + int secondBrace = current.find(")"); + + TQString wallclockValue = current.mid(firstBrace + 1, secondBrace - firstBrace - 2); + + kdDebug() << "WALLCLOCK VALUE " << wallclockValue << endl; + } + else if(current.contains(".")) + { + int dotPosition = current.find("."); + + TQString element = current.mid(0, dotPosition); + TQString clockValue; + + if(current.contains("begin")) + clockValue = current.mid(dotPosition + 6); + else if(current.contains("end")) + clockValue = current.mid(dotPosition + 4); + else if(current.contains("repeat")) + clockValue = current.mid(dotPosition + 7); + else // DOM2 Event Reference + { + int plusMinusPosition = -1; + + if(current.contains("+")) + plusMinusPosition = current.find("+"); + else if(current.contains("-")) + plusMinusPosition = current.find("-"); + + TQString event = current.mid(dotPosition + 1, plusMinusPosition - dotPosition - 1); + + clockValue = current.mid(dotPosition + event.length() + 1); + kdDebug() << "EVENT " << event << endl; + } + + kdDebug() << "ELEMENT " << element << " CLOCKVALUE " << clockValue << endl; + } + else + { + if(token == Begin) + m_begin = parseClockValue(current); + else + m_end = parseClockValue(current); + } + } + + temp->deref(); + + break; + } + case Dur: + m_duration = parseClockValue(val); + break; +// case Min: +// case Max: + case Restart: + if(val == "whenNotActive") + m_restart = WHENNOTACTIVE; + else if(val == "never") + m_restart = NEVER; + else + m_restart = ALWAYS; + break; + case RepeatCount: + m_repeatCount = val; + break; + case RepeatDur: + m_repeatDur = val; + break; + case Fill: + m_fill = (val == "freeze") ? FREEZE : REMOVE; + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGAnimationElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) +{ + KSVG_CHECK_THIS(SVGAnimationElementImpl) + + switch(id) + { + case SVGAnimationElementImpl::GetStartTime: + return Number(obj->getStartTime()); + case SVGAnimationElementImpl::GetCurrentTime: + return Number(obj->getCurrentTime()); + case SVGAnimationElementImpl::GetSimpleDuration: + return Number(obj->getSimpleDuration()); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +void SVGAnimationElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: Default value is "replace" + if(KSVG_TOKEN_NOT_PARSED(Additive)) + KSVG_SET_ALT_ATTRIBUTE(Additive, "replace") + + // Spec: Default value is "none" + if(KSVG_TOKEN_NOT_PARSED(Accumulate)) + KSVG_SET_ALT_ATTRIBUTE(Accumulate, "none") + + // Spec: Default value is "always" + if(KSVG_TOKEN_NOT_PARSED(Restart)) + KSVG_SET_ALT_ATTRIBUTE(Restart, "always") +} + +void SVGAnimationElementImpl::setTargetElement(SVGElementImpl *target) +{ + if(m_targetElement) + m_targetElement->deref(); + + m_targetElement = target; + m_targetElement->ref(); +} + +void SVGAnimationElementImpl::applyAttribute(const TQString &name, const TQString &value) +{ + SVGElementImpl *target = targetElement(); + if(!target) + { + kdDebug() << k_funcinfo << " name: " << name << " value: " << value << " NO TARGET ELEMENT!" << endl; + return; + } + + // The only two cases I can imagine, where combining is needed (Niko) + bool combine = (name == "style" || name == "transform"); + + if(!combine) + target->setAttributeInternal(name, value); + else + { + kdDebug() << "TODO COMBINE: " << value << " NAME " << name << endl; + } +} + +double SVGAnimationElementImpl::getStartTime() const +{ + return m_begin; +} + +double SVGAnimationElementImpl::getCurrentTime() const +{ + return 0.0; +} + +double SVGAnimationElementImpl::getSimpleDuration() const +{ + return m_duration; +} diff --git a/ksvg/impl/SVGBBoxTarget.cc b/ksvg/impl/SVGBBoxTarget.cc deleted file mode 100644 index 7d690373..00000000 --- a/ksvg/impl/SVGBBoxTarget.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGShapeImpl.h" -#include "SVGBBoxTarget.h" - -using namespace KSVG; - -SVGBBoxTarget::SVGBBoxTarget() -{ - m_target = 0; -} - -SVGBBoxTarget::~SVGBBoxTarget() -{ - if(m_target) - dynamic_cast(m_target)->deref(); -} - -SVGShapeImpl *SVGBBoxTarget::getBBoxTarget() const -{ - return m_target; -} - -void SVGBBoxTarget::setBBoxTarget(SVGShapeImpl *target) -{ - if(m_target) - dynamic_cast(m_target)->deref(); - - m_target = target; - - if(m_target) - dynamic_cast(m_target)->ref(); -} diff --git a/ksvg/impl/SVGBBoxTarget.cpp b/ksvg/impl/SVGBBoxTarget.cpp new file mode 100644 index 00000000..7d690373 --- /dev/null +++ b/ksvg/impl/SVGBBoxTarget.cpp @@ -0,0 +1,53 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGShapeImpl.h" +#include "SVGBBoxTarget.h" + +using namespace KSVG; + +SVGBBoxTarget::SVGBBoxTarget() +{ + m_target = 0; +} + +SVGBBoxTarget::~SVGBBoxTarget() +{ + if(m_target) + dynamic_cast(m_target)->deref(); +} + +SVGShapeImpl *SVGBBoxTarget::getBBoxTarget() const +{ + return m_target; +} + +void SVGBBoxTarget::setBBoxTarget(SVGShapeImpl *target) +{ + if(m_target) + dynamic_cast(m_target)->deref(); + + m_target = target; + + if(m_target) + dynamic_cast(m_target)->ref(); +} diff --git a/ksvg/impl/SVGCSSRuleImpl.cc b/ksvg/impl/SVGCSSRuleImpl.cc deleted file mode 100644 index 250ed687..00000000 --- a/ksvg/impl/SVGCSSRuleImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGCSSRuleImpl.h" - -using namespace KSVG; - -SVGCSSRuleImpl::SVGCSSRuleImpl() : DOM::DomShared()//, css::CSSRule() -{ -} - -SVGCSSRuleImpl::~SVGCSSRuleImpl() -{ -} diff --git a/ksvg/impl/SVGCSSRuleImpl.cpp b/ksvg/impl/SVGCSSRuleImpl.cpp new file mode 100644 index 00000000..250ed687 --- /dev/null +++ b/ksvg/impl/SVGCSSRuleImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGCSSRuleImpl.h" + +using namespace KSVG; + +SVGCSSRuleImpl::SVGCSSRuleImpl() : DOM::DomShared()//, css::CSSRule() +{ +} + +SVGCSSRuleImpl::~SVGCSSRuleImpl() +{ +} diff --git a/ksvg/impl/SVGCircleElementImpl.cc b/ksvg/impl/SVGCircleElementImpl.cc deleted file mode 100644 index b50f2661..00000000 --- a/ksvg/impl/SVGCircleElementImpl.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -#include "SVGRectImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGCircleElementImpl.h" -#include "SVGAnimatedLengthImpl.h" - -using namespace KSVG; - -#include "SVGCircleElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGCircleElementImpl::SVGCircleElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - KSVG_EMPTY_FLAGS - - m_cx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_cx->ref(); - m_cx->baseVal()->setValueAsString("-1"); - - m_cy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_cy->ref(); - m_cy->baseVal()->setValueAsString("-1"); - - m_r = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, this); - m_r->ref(); - m_r->baseVal()->setValueAsString("-1"); -} - -SVGCircleElementImpl::~SVGCircleElementImpl() -{ - if(m_cx) - m_cx->deref(); - if(m_cy) - m_cy->deref(); - if(m_r) - m_r->deref(); -} - -SVGAnimatedLengthImpl *SVGCircleElementImpl::cx() -{ - return m_cx; -} - -SVGAnimatedLengthImpl *SVGCircleElementImpl::cy() -{ - return m_cy; -} - -SVGAnimatedLengthImpl *SVGCircleElementImpl::r() -{ - return m_r; -} - -/* -@namespace KSVG -@begin SVGCircleElementImpl::s_hashTable 5 - cx SVGCircleElementImpl::Cx DontDelete|ReadOnly - cy SVGCircleElementImpl::Cy DontDelete|ReadOnly - r SVGCircleElementImpl::R DontDelete|ReadOnly -@end -*/ - -Value SVGCircleElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case Cx: - if(!attributeMode) - return m_cx->cache(exec); - else - return Number(m_cx->baseVal()->value()); - case Cy: - if(!attributeMode) - return m_cy->cache(exec); - else - return Number(m_cy->baseVal()->value()); - case R: - if(!attributeMode) - return m_r->cache(exec); - else - return Number(m_r->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGCircleElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Cx: - cx()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Cy: - cy()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case R: - r()->baseVal()->setValueAsString(value.toString(exec).qstring()); - if(r()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute r of element is illegal")); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -SVGRectImpl *SVGCircleElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - ret->setX(m_cx->baseVal()->value() - m_r->baseVal()->value()); - ret->setY(m_cy->baseVal()->value() - m_r->baseVal()->value()); - ret->setWidth(m_r->baseVal()->value() * 2.0); - ret->setHeight(m_r->baseVal()->value() * 2.0); - return ret; -} - -void SVGCircleElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Cx)) - KSVG_SET_ALT_ATTRIBUTE(Cx, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Cy)) - KSVG_SET_ALT_ATTRIBUTE(Cy, "0") -} - -void SVGCircleElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createCircle(this); - c->insert(m_item); - } -} diff --git a/ksvg/impl/SVGCircleElementImpl.cpp b/ksvg/impl/SVGCircleElementImpl.cpp new file mode 100644 index 00000000..b50f2661 --- /dev/null +++ b/ksvg/impl/SVGCircleElementImpl.cpp @@ -0,0 +1,176 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +#include "SVGRectImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGCircleElementImpl.h" +#include "SVGAnimatedLengthImpl.h" + +using namespace KSVG; + +#include "SVGCircleElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGCircleElementImpl::SVGCircleElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + KSVG_EMPTY_FLAGS + + m_cx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_cx->ref(); + m_cx->baseVal()->setValueAsString("-1"); + + m_cy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_cy->ref(); + m_cy->baseVal()->setValueAsString("-1"); + + m_r = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, this); + m_r->ref(); + m_r->baseVal()->setValueAsString("-1"); +} + +SVGCircleElementImpl::~SVGCircleElementImpl() +{ + if(m_cx) + m_cx->deref(); + if(m_cy) + m_cy->deref(); + if(m_r) + m_r->deref(); +} + +SVGAnimatedLengthImpl *SVGCircleElementImpl::cx() +{ + return m_cx; +} + +SVGAnimatedLengthImpl *SVGCircleElementImpl::cy() +{ + return m_cy; +} + +SVGAnimatedLengthImpl *SVGCircleElementImpl::r() +{ + return m_r; +} + +/* +@namespace KSVG +@begin SVGCircleElementImpl::s_hashTable 5 + cx SVGCircleElementImpl::Cx DontDelete|ReadOnly + cy SVGCircleElementImpl::Cy DontDelete|ReadOnly + r SVGCircleElementImpl::R DontDelete|ReadOnly +@end +*/ + +Value SVGCircleElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case Cx: + if(!attributeMode) + return m_cx->cache(exec); + else + return Number(m_cx->baseVal()->value()); + case Cy: + if(!attributeMode) + return m_cy->cache(exec); + else + return Number(m_cy->baseVal()->value()); + case R: + if(!attributeMode) + return m_r->cache(exec); + else + return Number(m_r->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGCircleElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Cx: + cx()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Cy: + cy()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case R: + r()->baseVal()->setValueAsString(value.toString(exec).qstring()); + if(r()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute r of element is illegal")); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +SVGRectImpl *SVGCircleElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + ret->setX(m_cx->baseVal()->value() - m_r->baseVal()->value()); + ret->setY(m_cy->baseVal()->value() - m_r->baseVal()->value()); + ret->setWidth(m_r->baseVal()->value() * 2.0); + ret->setHeight(m_r->baseVal()->value() * 2.0); + return ret; +} + +void SVGCircleElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Cx)) + KSVG_SET_ALT_ATTRIBUTE(Cx, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Cy)) + KSVG_SET_ALT_ATTRIBUTE(Cy, "0") +} + +void SVGCircleElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createCircle(this); + c->insert(m_item); + } +} diff --git a/ksvg/impl/SVGClipPathElementImpl.cc b/ksvg/impl/SVGClipPathElementImpl.cc deleted file mode 100644 index 03512a41..00000000 --- a/ksvg/impl/SVGClipPathElementImpl.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGClipPathElement.h" -#include "SVGClipPathElementImpl.h" -#include "KSVGCanvas.h" -#include "SVGDocumentImpl.h" -#include "SVGAnimatedEnumerationImpl.h" - -using namespace KSVG; - -#include "SVGClipPathElementImpl.lut.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGClipPathElementImpl::SVGClipPathElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl(), SVGBBoxTarget() -{ - KSVG_EMPTY_FLAGS - - m_clipPathUnits = new SVGAnimatedEnumerationImpl(); - m_clipPathUnits->ref(); - m_clipPathUnits->setBaseVal(SVGClipPathElement::SVG_UNIT_TYPE_UNKNOWN); -} - -SVGClipPathElementImpl::~SVGClipPathElementImpl() -{ - if(m_clipPathUnits) - m_clipPathUnits->deref(); -} - -SVGAnimatedEnumerationImpl *SVGClipPathElementImpl::clipPathUnits() const -{ - return m_clipPathUnits; -} - -/* -@namespace KSVG -@begin SVGClipPathElementImpl::s_hashTable 2 - clipPathUnits SVGClipPathElementImpl::ClipPathUnits DontDelete|ReadOnly -@end -*/ - -Value SVGClipPathElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case ClipPathUnits: - return m_clipPathUnits->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGClipPathElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case ClipPathUnits: - if(value.toString(exec).qstring() == "objectBoundingBox") - m_clipPathUnits->setBaseVal(SVGClipPathElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); - else - m_clipPathUnits->setBaseVal(SVGClipPathElement::SVG_UNIT_TYPE_USERSPACEONUSE); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGClipPathElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if attribute not specified, use userSpaceOnUse - if(KSVG_TOKEN_NOT_PARSED(ClipPathUnits)) - KSVG_SET_ALT_ATTRIBUTE(ClipPathUnits, "userSpaceOnUse") - - if(!m_item) - m_item = ownerDoc()->canvas()->createClipPath(this); -} diff --git a/ksvg/impl/SVGClipPathElementImpl.cpp b/ksvg/impl/SVGClipPathElementImpl.cpp new file mode 100644 index 00000000..03512a41 --- /dev/null +++ b/ksvg/impl/SVGClipPathElementImpl.cpp @@ -0,0 +1,102 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGClipPathElement.h" +#include "SVGClipPathElementImpl.h" +#include "KSVGCanvas.h" +#include "SVGDocumentImpl.h" +#include "SVGAnimatedEnumerationImpl.h" + +using namespace KSVG; + +#include "SVGClipPathElementImpl.lut.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGClipPathElementImpl::SVGClipPathElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl(), SVGBBoxTarget() +{ + KSVG_EMPTY_FLAGS + + m_clipPathUnits = new SVGAnimatedEnumerationImpl(); + m_clipPathUnits->ref(); + m_clipPathUnits->setBaseVal(SVGClipPathElement::SVG_UNIT_TYPE_UNKNOWN); +} + +SVGClipPathElementImpl::~SVGClipPathElementImpl() +{ + if(m_clipPathUnits) + m_clipPathUnits->deref(); +} + +SVGAnimatedEnumerationImpl *SVGClipPathElementImpl::clipPathUnits() const +{ + return m_clipPathUnits; +} + +/* +@namespace KSVG +@begin SVGClipPathElementImpl::s_hashTable 2 + clipPathUnits SVGClipPathElementImpl::ClipPathUnits DontDelete|ReadOnly +@end +*/ + +Value SVGClipPathElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case ClipPathUnits: + return m_clipPathUnits->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGClipPathElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case ClipPathUnits: + if(value.toString(exec).qstring() == "objectBoundingBox") + m_clipPathUnits->setBaseVal(SVGClipPathElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); + else + m_clipPathUnits->setBaseVal(SVGClipPathElement::SVG_UNIT_TYPE_USERSPACEONUSE); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGClipPathElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if attribute not specified, use userSpaceOnUse + if(KSVG_TOKEN_NOT_PARSED(ClipPathUnits)) + KSVG_SET_ALT_ATTRIBUTE(ClipPathUnits, "userSpaceOnUse") + + if(!m_item) + m_item = ownerDoc()->canvas()->createClipPath(this); +} diff --git a/ksvg/impl/SVGColorImpl.cc b/ksvg/impl/SVGColorImpl.cc deleted file mode 100644 index c5c44bcc..00000000 --- a/ksvg/impl/SVGColorImpl.cc +++ /dev/null @@ -1,538 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGColor.h" - -#include "SVGColorImpl.h" -#include "SVGNumberImpl.h" -#include "SVGICCColorImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGNumberListImpl.h" -#include "SVGURIReferenceImpl.h" -#include "SVGColorProfileElementImpl.h" - -using namespace KSVG; - -#include "SVGColorImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_cacheimpl.h" - -SVGColorImpl::SVGColorImpl(SVGElementImpl *object) : m_object(object) -{ - m_colorType = SVG_COLORTYPE_UNKNOWN; - m_iccColor = 0; -} - -SVGColorImpl::SVGColorImpl(const SVGColorImpl &other) : DOM::DomShared() -{ - (*this) = other; -} - -SVGColorImpl::~SVGColorImpl() -{ - if(m_iccColor) - m_iccColor->deref(); -} - -SVGColorImpl &SVGColorImpl::operator=(const SVGColorImpl &other) -{ - m_colorType = other.m_colorType; - m_rgbColor = other.m_rgbColor; - - if(m_iccColor && other.m_iccColor) - *m_iccColor = *(other.m_iccColor); - - return *this; -} - -unsigned short SVGColorImpl::colorType() const -{ - return m_colorType; -} - -DOM::RGBColor SVGColorImpl::rgbColor() const -{ - return m_rgbColor; -} - -SVGICCColorImpl *SVGColorImpl::iccColor() const -{ - return m_iccColor; -} - -void SVGColorImpl::setRGBColor(TQColor color) -{ - m_colorType = SVG_COLORTYPE_RGBCOLOR; - m_rgbColor = DOM::RGBColor(color.rgb()); -} - -void SVGColorImpl::setRGBColor(int r, int g, int b) -{ - m_colorType = SVG_COLORTYPE_RGBCOLOR; - m_rgbColor = DOM::RGBColor(TQColor(r, g, b).rgb()); -} - -void SVGColorImpl::setRGBColor(const DOM::DOMString &rgbColor) -{ - if(rgbColor == "aliceblue") - setRGBColor(240, 248, 255); - else if(rgbColor == "antiquewhite") - setRGBColor(250, 235, 215); - else if(rgbColor == "aqua") - setRGBColor(0, 255, 255); - else if(rgbColor == "aquamarine") - setRGBColor(127, 255, 212); - else if(rgbColor == "azure") - setRGBColor(240, 255, 255); - else if(rgbColor == "beige") - setRGBColor(245, 245, 220); - else if(rgbColor == "bisque") - setRGBColor(255, 228, 196); - else if(rgbColor == "black") - setRGBColor(0, 0, 0); - else if(rgbColor == "blanchedalmond") - setRGBColor(255, 235, 205); - else if(rgbColor == "blue") - setRGBColor(0, 0, 255); - else if(rgbColor == "blueviolet") - setRGBColor(138, 43, 226); - else if(rgbColor == "brown") - setRGBColor(165, 42, 42); - else if(rgbColor == "burlywood") - setRGBColor(222, 184, 135); - else if(rgbColor == "cadetblue") - setRGBColor(95, 158, 160); - else if(rgbColor == "chartreuse") - setRGBColor(127, 255, 0); - else if(rgbColor == "chocolate") - setRGBColor(210, 105, 30); - else if(rgbColor == "coral") - setRGBColor(255, 127, 80); - else if(rgbColor == "cornflowerblue") - setRGBColor(100, 149, 237); - else if(rgbColor == "cornsilk") - setRGBColor(255, 248, 220); - else if(rgbColor == "crimson") - setRGBColor(220, 20, 60); - else if(rgbColor == "cyan") - setRGBColor(0, 255, 255); - else if(rgbColor == "darkblue") - setRGBColor(0, 0, 139); - else if(rgbColor == "darkcyan") - setRGBColor(0, 139, 139); - else if(rgbColor == "darkgoldenrod") - setRGBColor(184, 134, 11); - else if(rgbColor == "darkgray") - setRGBColor(169, 169, 169); - else if(rgbColor == "darkgrey") - setRGBColor(169, 169, 169); - else if(rgbColor == "darkgreen") - setRGBColor(0, 100, 0); - else if(rgbColor == "darkkhaki") - setRGBColor(189, 183, 107); - else if(rgbColor == "darkmagenta") - setRGBColor(139, 0, 139); - else if(rgbColor == "darkolivegreen") - setRGBColor(85, 107, 47); - else if(rgbColor == "darkorange") - setRGBColor(255, 140, 0); - else if(rgbColor == "darkorchid") - setRGBColor(153, 50, 204); - else if(rgbColor == "darkred") - setRGBColor(139, 0, 0); - else if(rgbColor == "darksalmon") - setRGBColor(233, 150, 122); - else if(rgbColor == "darkseagreen") - setRGBColor(143, 188, 143); - else if(rgbColor == "darkslateblue") - setRGBColor(72, 61, 139); - else if(rgbColor == "darkslategray") - setRGBColor(47, 79, 79); - else if(rgbColor == "darkslategrey") - setRGBColor(47, 79, 79); - else if(rgbColor == "darkturquoise") - setRGBColor(0, 206, 209); - else if(rgbColor == "darkviolet") - setRGBColor(148, 0, 211); - else if(rgbColor == "deeppink") - setRGBColor(255, 20, 147); - else if(rgbColor == "deepskyblue") - setRGBColor(0, 191, 255); - else if(rgbColor == "dimgray") - setRGBColor(105, 105, 105); - else if(rgbColor == "dimgrey") - setRGBColor(105, 105, 105); - else if(rgbColor == "dodgerblue") - setRGBColor(30, 144, 255); - else if(rgbColor == "firebrick") - setRGBColor(178, 34, 34); - else if(rgbColor == "floralwhite") - setRGBColor(255, 250, 240); - else if(rgbColor == "forestgreen") - setRGBColor(34, 139, 34); - else if(rgbColor == "fuchsia") - setRGBColor(255, 0, 255); - else if(rgbColor == "gainsboro") - setRGBColor(220, 220, 220); - else if(rgbColor == "ghostwhite") - setRGBColor(248, 248, 255); - else if(rgbColor == "gold") - setRGBColor(255, 215, 0); - else if(rgbColor == "goldenrod") - setRGBColor(218, 165, 32); - else if(rgbColor == "gray") - setRGBColor(128, 128, 128); - else if(rgbColor == "grey") - setRGBColor(128, 128, 128); - else if(rgbColor == "green") - setRGBColor(0, 128, 0); - else if(rgbColor == "greenyellow") - setRGBColor(173, 255, 47); - else if(rgbColor == "honeydew") - setRGBColor(240, 255, 240); - else if(rgbColor == "hotpink") - setRGBColor(255, 105, 180); - else if(rgbColor == "indianred") - setRGBColor(205, 92, 92); - else if(rgbColor == "indigo") - setRGBColor(75, 0, 130); - else if(rgbColor == "ivory") - setRGBColor(255, 255, 240); - else if(rgbColor == "khaki") - setRGBColor(240, 230, 140); - else if(rgbColor == "lavender") - setRGBColor(230, 230, 250); - else if(rgbColor == "lavenderblush") - setRGBColor(255, 240, 245); - else if(rgbColor == "lawngreen") - setRGBColor(124, 252, 0); - else if(rgbColor == "lemonchiffon") - setRGBColor(255, 250, 205); - else if(rgbColor == "lightblue") - setRGBColor(173, 216, 230); - else if(rgbColor == "lightcoral") - setRGBColor(240, 128, 128); - else if(rgbColor == "lightcyan") - setRGBColor(224, 255, 255); - else if(rgbColor == "lightgoldenrodyellow") - setRGBColor(250, 250, 210); - else if(rgbColor == "lightgray") - setRGBColor(211, 211, 211); - else if(rgbColor == "lightgrey") - setRGBColor(211, 211, 211); - else if(rgbColor == "lightgreen") - setRGBColor(144, 238, 144); - else if(rgbColor == "lightpink") - setRGBColor(255, 182, 193); - else if(rgbColor == "lightsalmon") - setRGBColor(255, 160, 122); - else if(rgbColor == "lightseagreen") - setRGBColor(32, 178, 170); - else if(rgbColor == "lightskyblue") - setRGBColor(135, 206, 250); - else if(rgbColor == "lightslategray") - setRGBColor(119, 136, 153); - else if(rgbColor == "lightslategrey") - setRGBColor(119, 136, 153); - else if(rgbColor == "lightsteelblue") - setRGBColor(176, 196, 222); - else if(rgbColor == "lightyellow") - setRGBColor(255, 255, 224); - else if(rgbColor == "lime") - setRGBColor(0, 255, 0); - else if(rgbColor == "limegreen") - setRGBColor(50, 205, 50); - else if(rgbColor == "linen") - setRGBColor(250, 240, 230); - else if(rgbColor == "magenta") - setRGBColor(255, 0, 255); - else if(rgbColor == "maroon") - setRGBColor(128, 0, 0); - else if(rgbColor == "mediumaquamarine") - setRGBColor(102, 205, 170); - else if(rgbColor == "mediumblue") - setRGBColor(0, 0, 205); - else if(rgbColor == "mediumorchid") - setRGBColor(186, 85, 211); - else if(rgbColor == "mediumpurple") - setRGBColor(147, 112, 219); - else if(rgbColor == "mediumseagreen") - setRGBColor(60, 179, 113); - else if(rgbColor == "mediumslateblue") - setRGBColor(123, 104, 238); - else if(rgbColor == "mediumspringgreen") - setRGBColor(0, 250, 154); - else if(rgbColor == "mediumturquoise") - setRGBColor(72, 209, 204); - else if(rgbColor == "mediumvioletred") - setRGBColor(199, 21, 133); - else if(rgbColor == "midnightblue") - setRGBColor(25, 25, 112); - else if(rgbColor == "mintcream") - setRGBColor(245, 255, 250); - else if(rgbColor == "mistyrose") - setRGBColor(255, 228, 225); - else if(rgbColor == "moccasin") - setRGBColor(255, 228, 181); - else if(rgbColor == "navajowhite") - setRGBColor(255, 222, 173); - else if(rgbColor == "navy") - setRGBColor(0, 0, 128); - else if(rgbColor == "oldlace") - setRGBColor(253, 245, 230); - else if(rgbColor == "olive") - setRGBColor(128, 128, 0); - else if(rgbColor == "olivedrab") - setRGBColor(107, 142, 35); - else if(rgbColor == "orange") - setRGBColor(255, 165, 0); - else if(rgbColor == "orangered") - setRGBColor(255, 69, 0); - else if(rgbColor == "orchid") - setRGBColor(218, 112, 214); - else if(rgbColor == "palegoldenrod") - setRGBColor(238, 232, 170); - else if(rgbColor == "palegreen") - setRGBColor(152, 251, 152); - else if(rgbColor == "paleturquoise") - setRGBColor(175, 238, 238); - else if(rgbColor == "palevioletred") - setRGBColor(219, 112, 147); - else if(rgbColor == "papayawhip") - setRGBColor(255, 239, 213); - else if(rgbColor == "peachpuff") - setRGBColor(255, 218, 185); - else if(rgbColor == "peru") - setRGBColor(205, 133, 63); - else if(rgbColor == "pink") - setRGBColor(255, 192, 203); - else if(rgbColor == "plum") - setRGBColor(221, 160, 221); - else if(rgbColor == "powderblue") - setRGBColor(176, 224, 230); - else if(rgbColor == "purple") - setRGBColor(128, 0, 128); - else if(rgbColor == "red") - setRGBColor(255, 0, 0); - else if(rgbColor == "rosybrown") - setRGBColor(188, 143, 143); - else if(rgbColor == "royalblue") - setRGBColor(65, 105, 225); - else if(rgbColor == "saddlebrown") - setRGBColor(139, 69, 19); - else if(rgbColor == "salmon") - setRGBColor(250, 128, 114); - else if(rgbColor == "sandybrown") - setRGBColor(244, 164, 96); - else if(rgbColor == "seagreen") - setRGBColor(46, 139, 87); - else if(rgbColor == "seashell") - setRGBColor(255, 245, 238); - else if(rgbColor == "sienna") - setRGBColor(160, 82, 45); - else if(rgbColor == "silver") - setRGBColor(192, 192, 192); - else if(rgbColor == "skyblue") - setRGBColor(135, 206, 235); - else if(rgbColor == "slateblue") - setRGBColor(106, 90, 205); - else if(rgbColor == "slategray") - setRGBColor(112, 128, 144); - else if(rgbColor == "slategrey") - setRGBColor(112, 128, 144); - else if(rgbColor == "snow") - setRGBColor(255, 250, 250); - else if(rgbColor == "springgreen") - setRGBColor(0, 255, 127); - else if(rgbColor == "steelblue") - setRGBColor(70, 130, 180); - else if(rgbColor == "tan") - setRGBColor(210, 180, 140); - else if(rgbColor == "teal") - setRGBColor(0, 128, 128); - else if(rgbColor == "thistle") - setRGBColor(216, 191, 216); - else if(rgbColor == "tomato") - setRGBColor(255, 99, 71); - else if(rgbColor == "turquoise") - setRGBColor(64, 224, 208); - else if(rgbColor == "violet") - setRGBColor(238, 130, 238); - else if(rgbColor == "wheat") - setRGBColor(245, 222, 179); - else if(rgbColor == "white") - setRGBColor(255, 255, 255); - else if(rgbColor == "whitesmoke") - setRGBColor(245, 245, 245); - else if(rgbColor == "yellow") - setRGBColor(255, 255, 0); - else if(rgbColor == "yellowgreen") - setRGBColor(154, 205, 50); -} - -void SVGColorImpl::setRGBColorICCColor(const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) -{ - TQColor color; - - TQString content = iccColor.string().right(iccColor.string().length() - 10); - TQString iccTarget = content.mid(0, content.find(',')); - - TQStringList colors = TQStringList::split(',', content); - TQString r = colors[1]; - TQString g = colors[2]; - TQString b = colors[3].left(colors[3].length() - 1); - - iccTarget = SVGURIReferenceImpl::getTarget(iccTarget); - - SVGColorProfileElementImpl *handle = 0; - if(m_object) - handle = static_cast(dynamic_cast(m_object)->ownerDoc()->rootElement()->getElementById(iccTarget)); - - if(iccTarget.isEmpty() || !handle) - { - color.setNamedColor(rgbColor.string().stripWhiteSpace()); - setRGBColor(color); - } - else - { - color.setRgb(handle->correctPixel(r.toFloat() * 257, g.toFloat() * 257, b.toFloat() * 257)); - setRGBColor(color); - - m_colorType = SVG_COLORTYPE_RGBCOLOR_ICCCOLOR; - - if(!m_iccColor) - { - m_iccColor = new SVGICCColorImpl(); - m_iccColor->ref(); - } - - m_iccColor->setColorProfile(DOM::DOMString(content)); - - SVGNumberImpl *rnumber = SVGSVGElementImpl::createSVGNumber(); - rnumber->setValue(r.toFloat()); - - SVGNumberImpl *gnumber = SVGSVGElementImpl::createSVGNumber(); - gnumber->setValue(g.toFloat()); - - SVGNumberImpl *bnumber = SVGSVGElementImpl::createSVGNumber(); - bnumber->setValue(b.toFloat()); - - m_iccColor->colors()->clear(); - m_iccColor->colors()->appendItem(bnumber); - m_iccColor->colors()->appendItem(gnumber); - m_iccColor->colors()->appendItem(rnumber); - } -} - -void SVGColorImpl::setColor(unsigned short colorType, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) -{ - m_colorType = colorType; - - if(m_colorType == SVG_COLORTYPE_UNKNOWN || m_colorType == SVG_COLORTYPE_CURRENTCOLOR) - return; - - setRGBColorICCColor(rgbColor, iccColor); -} - -// Ecma stuff -/* -@namespace KSVG -@begin SVGColorImpl::s_hashTable 5 - colorType SVGColorImpl::ColorType DontDelete|ReadOnly - RGBColor SVGColorImpl::RGBColor DontDelete|ReadOnly - ICCColor SVGColorImpl::ICCColor DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGColorImplProto::s_hashTable 5 - setRGBColor SVGColorImpl::SetRGBColor DontDelete|Function 1 - setRGBColorICCColor SVGColorImpl::SetRGBColorICCColor DontDelete|Function 2 - setColor SVGColorImpl::SetColor DontDelete|Function 3 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGColor", SVGColorImplProto, SVGColorImplProtoFunc) - -Value SVGColorImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case ColorType: - return Number(colorType()); -#ifdef __GNUC__ -#warning FIXME bridge stuff -#endif - case RGBColor: - return Undefined(); - case ICCColor: - return m_iccColor->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGColorImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGColorImpl) - - switch(id) - { - case SVGColorImpl::SetRGBColor: - obj->setRGBColor(args[0].toString(exec).string()); - break; - case SVGColorImpl::SetRGBColorICCColor: - obj->setRGBColorICCColor(args[0].toString(exec).string(), args[1].toString(exec).string()); - break; - case SVGColorImpl::SetColor: - obj->setColor(static_cast(args[0].toNumber(exec)), args[1].toString(exec).string(), args[2].toString(exec).string()); - break; - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -/* -@namespace KSVG -@begin SVGColorImplConstructor::s_hashTable 5 - SVG_COLORTYPE_UNKNOWN KSVG::SVG_COLORTYPE_UNKNOWN DontDelete|ReadOnly - SVG_COLORTYPE_RGBCOLOR KSVG::SVG_COLORTYPE_RGBCOLOR DontDelete|ReadOnly - SVG_COLORTYPE_RGBCOLOR_ICCCOLOR KSVG::SVG_COLORTYPE_RGBCOLOR_ICCCOLOR DontDelete|ReadOnly - SVG_COLORTYPE_CURRENTCOLOR KSVG::SVG_COLORTYPE_CURRENTCOLOR DontDelete|ReadOnly -@end -*/ - -Value SVGColorImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGColorImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgcolor.constructor]]"); -} diff --git a/ksvg/impl/SVGColorImpl.cpp b/ksvg/impl/SVGColorImpl.cpp new file mode 100644 index 00000000..c5c44bcc --- /dev/null +++ b/ksvg/impl/SVGColorImpl.cpp @@ -0,0 +1,538 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGColor.h" + +#include "SVGColorImpl.h" +#include "SVGNumberImpl.h" +#include "SVGICCColorImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGNumberListImpl.h" +#include "SVGURIReferenceImpl.h" +#include "SVGColorProfileElementImpl.h" + +using namespace KSVG; + +#include "SVGColorImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_cacheimpl.h" + +SVGColorImpl::SVGColorImpl(SVGElementImpl *object) : m_object(object) +{ + m_colorType = SVG_COLORTYPE_UNKNOWN; + m_iccColor = 0; +} + +SVGColorImpl::SVGColorImpl(const SVGColorImpl &other) : DOM::DomShared() +{ + (*this) = other; +} + +SVGColorImpl::~SVGColorImpl() +{ + if(m_iccColor) + m_iccColor->deref(); +} + +SVGColorImpl &SVGColorImpl::operator=(const SVGColorImpl &other) +{ + m_colorType = other.m_colorType; + m_rgbColor = other.m_rgbColor; + + if(m_iccColor && other.m_iccColor) + *m_iccColor = *(other.m_iccColor); + + return *this; +} + +unsigned short SVGColorImpl::colorType() const +{ + return m_colorType; +} + +DOM::RGBColor SVGColorImpl::rgbColor() const +{ + return m_rgbColor; +} + +SVGICCColorImpl *SVGColorImpl::iccColor() const +{ + return m_iccColor; +} + +void SVGColorImpl::setRGBColor(TQColor color) +{ + m_colorType = SVG_COLORTYPE_RGBCOLOR; + m_rgbColor = DOM::RGBColor(color.rgb()); +} + +void SVGColorImpl::setRGBColor(int r, int g, int b) +{ + m_colorType = SVG_COLORTYPE_RGBCOLOR; + m_rgbColor = DOM::RGBColor(TQColor(r, g, b).rgb()); +} + +void SVGColorImpl::setRGBColor(const DOM::DOMString &rgbColor) +{ + if(rgbColor == "aliceblue") + setRGBColor(240, 248, 255); + else if(rgbColor == "antiquewhite") + setRGBColor(250, 235, 215); + else if(rgbColor == "aqua") + setRGBColor(0, 255, 255); + else if(rgbColor == "aquamarine") + setRGBColor(127, 255, 212); + else if(rgbColor == "azure") + setRGBColor(240, 255, 255); + else if(rgbColor == "beige") + setRGBColor(245, 245, 220); + else if(rgbColor == "bisque") + setRGBColor(255, 228, 196); + else if(rgbColor == "black") + setRGBColor(0, 0, 0); + else if(rgbColor == "blanchedalmond") + setRGBColor(255, 235, 205); + else if(rgbColor == "blue") + setRGBColor(0, 0, 255); + else if(rgbColor == "blueviolet") + setRGBColor(138, 43, 226); + else if(rgbColor == "brown") + setRGBColor(165, 42, 42); + else if(rgbColor == "burlywood") + setRGBColor(222, 184, 135); + else if(rgbColor == "cadetblue") + setRGBColor(95, 158, 160); + else if(rgbColor == "chartreuse") + setRGBColor(127, 255, 0); + else if(rgbColor == "chocolate") + setRGBColor(210, 105, 30); + else if(rgbColor == "coral") + setRGBColor(255, 127, 80); + else if(rgbColor == "cornflowerblue") + setRGBColor(100, 149, 237); + else if(rgbColor == "cornsilk") + setRGBColor(255, 248, 220); + else if(rgbColor == "crimson") + setRGBColor(220, 20, 60); + else if(rgbColor == "cyan") + setRGBColor(0, 255, 255); + else if(rgbColor == "darkblue") + setRGBColor(0, 0, 139); + else if(rgbColor == "darkcyan") + setRGBColor(0, 139, 139); + else if(rgbColor == "darkgoldenrod") + setRGBColor(184, 134, 11); + else if(rgbColor == "darkgray") + setRGBColor(169, 169, 169); + else if(rgbColor == "darkgrey") + setRGBColor(169, 169, 169); + else if(rgbColor == "darkgreen") + setRGBColor(0, 100, 0); + else if(rgbColor == "darkkhaki") + setRGBColor(189, 183, 107); + else if(rgbColor == "darkmagenta") + setRGBColor(139, 0, 139); + else if(rgbColor == "darkolivegreen") + setRGBColor(85, 107, 47); + else if(rgbColor == "darkorange") + setRGBColor(255, 140, 0); + else if(rgbColor == "darkorchid") + setRGBColor(153, 50, 204); + else if(rgbColor == "darkred") + setRGBColor(139, 0, 0); + else if(rgbColor == "darksalmon") + setRGBColor(233, 150, 122); + else if(rgbColor == "darkseagreen") + setRGBColor(143, 188, 143); + else if(rgbColor == "darkslateblue") + setRGBColor(72, 61, 139); + else if(rgbColor == "darkslategray") + setRGBColor(47, 79, 79); + else if(rgbColor == "darkslategrey") + setRGBColor(47, 79, 79); + else if(rgbColor == "darkturquoise") + setRGBColor(0, 206, 209); + else if(rgbColor == "darkviolet") + setRGBColor(148, 0, 211); + else if(rgbColor == "deeppink") + setRGBColor(255, 20, 147); + else if(rgbColor == "deepskyblue") + setRGBColor(0, 191, 255); + else if(rgbColor == "dimgray") + setRGBColor(105, 105, 105); + else if(rgbColor == "dimgrey") + setRGBColor(105, 105, 105); + else if(rgbColor == "dodgerblue") + setRGBColor(30, 144, 255); + else if(rgbColor == "firebrick") + setRGBColor(178, 34, 34); + else if(rgbColor == "floralwhite") + setRGBColor(255, 250, 240); + else if(rgbColor == "forestgreen") + setRGBColor(34, 139, 34); + else if(rgbColor == "fuchsia") + setRGBColor(255, 0, 255); + else if(rgbColor == "gainsboro") + setRGBColor(220, 220, 220); + else if(rgbColor == "ghostwhite") + setRGBColor(248, 248, 255); + else if(rgbColor == "gold") + setRGBColor(255, 215, 0); + else if(rgbColor == "goldenrod") + setRGBColor(218, 165, 32); + else if(rgbColor == "gray") + setRGBColor(128, 128, 128); + else if(rgbColor == "grey") + setRGBColor(128, 128, 128); + else if(rgbColor == "green") + setRGBColor(0, 128, 0); + else if(rgbColor == "greenyellow") + setRGBColor(173, 255, 47); + else if(rgbColor == "honeydew") + setRGBColor(240, 255, 240); + else if(rgbColor == "hotpink") + setRGBColor(255, 105, 180); + else if(rgbColor == "indianred") + setRGBColor(205, 92, 92); + else if(rgbColor == "indigo") + setRGBColor(75, 0, 130); + else if(rgbColor == "ivory") + setRGBColor(255, 255, 240); + else if(rgbColor == "khaki") + setRGBColor(240, 230, 140); + else if(rgbColor == "lavender") + setRGBColor(230, 230, 250); + else if(rgbColor == "lavenderblush") + setRGBColor(255, 240, 245); + else if(rgbColor == "lawngreen") + setRGBColor(124, 252, 0); + else if(rgbColor == "lemonchiffon") + setRGBColor(255, 250, 205); + else if(rgbColor == "lightblue") + setRGBColor(173, 216, 230); + else if(rgbColor == "lightcoral") + setRGBColor(240, 128, 128); + else if(rgbColor == "lightcyan") + setRGBColor(224, 255, 255); + else if(rgbColor == "lightgoldenrodyellow") + setRGBColor(250, 250, 210); + else if(rgbColor == "lightgray") + setRGBColor(211, 211, 211); + else if(rgbColor == "lightgrey") + setRGBColor(211, 211, 211); + else if(rgbColor == "lightgreen") + setRGBColor(144, 238, 144); + else if(rgbColor == "lightpink") + setRGBColor(255, 182, 193); + else if(rgbColor == "lightsalmon") + setRGBColor(255, 160, 122); + else if(rgbColor == "lightseagreen") + setRGBColor(32, 178, 170); + else if(rgbColor == "lightskyblue") + setRGBColor(135, 206, 250); + else if(rgbColor == "lightslategray") + setRGBColor(119, 136, 153); + else if(rgbColor == "lightslategrey") + setRGBColor(119, 136, 153); + else if(rgbColor == "lightsteelblue") + setRGBColor(176, 196, 222); + else if(rgbColor == "lightyellow") + setRGBColor(255, 255, 224); + else if(rgbColor == "lime") + setRGBColor(0, 255, 0); + else if(rgbColor == "limegreen") + setRGBColor(50, 205, 50); + else if(rgbColor == "linen") + setRGBColor(250, 240, 230); + else if(rgbColor == "magenta") + setRGBColor(255, 0, 255); + else if(rgbColor == "maroon") + setRGBColor(128, 0, 0); + else if(rgbColor == "mediumaquamarine") + setRGBColor(102, 205, 170); + else if(rgbColor == "mediumblue") + setRGBColor(0, 0, 205); + else if(rgbColor == "mediumorchid") + setRGBColor(186, 85, 211); + else if(rgbColor == "mediumpurple") + setRGBColor(147, 112, 219); + else if(rgbColor == "mediumseagreen") + setRGBColor(60, 179, 113); + else if(rgbColor == "mediumslateblue") + setRGBColor(123, 104, 238); + else if(rgbColor == "mediumspringgreen") + setRGBColor(0, 250, 154); + else if(rgbColor == "mediumturquoise") + setRGBColor(72, 209, 204); + else if(rgbColor == "mediumvioletred") + setRGBColor(199, 21, 133); + else if(rgbColor == "midnightblue") + setRGBColor(25, 25, 112); + else if(rgbColor == "mintcream") + setRGBColor(245, 255, 250); + else if(rgbColor == "mistyrose") + setRGBColor(255, 228, 225); + else if(rgbColor == "moccasin") + setRGBColor(255, 228, 181); + else if(rgbColor == "navajowhite") + setRGBColor(255, 222, 173); + else if(rgbColor == "navy") + setRGBColor(0, 0, 128); + else if(rgbColor == "oldlace") + setRGBColor(253, 245, 230); + else if(rgbColor == "olive") + setRGBColor(128, 128, 0); + else if(rgbColor == "olivedrab") + setRGBColor(107, 142, 35); + else if(rgbColor == "orange") + setRGBColor(255, 165, 0); + else if(rgbColor == "orangered") + setRGBColor(255, 69, 0); + else if(rgbColor == "orchid") + setRGBColor(218, 112, 214); + else if(rgbColor == "palegoldenrod") + setRGBColor(238, 232, 170); + else if(rgbColor == "palegreen") + setRGBColor(152, 251, 152); + else if(rgbColor == "paleturquoise") + setRGBColor(175, 238, 238); + else if(rgbColor == "palevioletred") + setRGBColor(219, 112, 147); + else if(rgbColor == "papayawhip") + setRGBColor(255, 239, 213); + else if(rgbColor == "peachpuff") + setRGBColor(255, 218, 185); + else if(rgbColor == "peru") + setRGBColor(205, 133, 63); + else if(rgbColor == "pink") + setRGBColor(255, 192, 203); + else if(rgbColor == "plum") + setRGBColor(221, 160, 221); + else if(rgbColor == "powderblue") + setRGBColor(176, 224, 230); + else if(rgbColor == "purple") + setRGBColor(128, 0, 128); + else if(rgbColor == "red") + setRGBColor(255, 0, 0); + else if(rgbColor == "rosybrown") + setRGBColor(188, 143, 143); + else if(rgbColor == "royalblue") + setRGBColor(65, 105, 225); + else if(rgbColor == "saddlebrown") + setRGBColor(139, 69, 19); + else if(rgbColor == "salmon") + setRGBColor(250, 128, 114); + else if(rgbColor == "sandybrown") + setRGBColor(244, 164, 96); + else if(rgbColor == "seagreen") + setRGBColor(46, 139, 87); + else if(rgbColor == "seashell") + setRGBColor(255, 245, 238); + else if(rgbColor == "sienna") + setRGBColor(160, 82, 45); + else if(rgbColor == "silver") + setRGBColor(192, 192, 192); + else if(rgbColor == "skyblue") + setRGBColor(135, 206, 235); + else if(rgbColor == "slateblue") + setRGBColor(106, 90, 205); + else if(rgbColor == "slategray") + setRGBColor(112, 128, 144); + else if(rgbColor == "slategrey") + setRGBColor(112, 128, 144); + else if(rgbColor == "snow") + setRGBColor(255, 250, 250); + else if(rgbColor == "springgreen") + setRGBColor(0, 255, 127); + else if(rgbColor == "steelblue") + setRGBColor(70, 130, 180); + else if(rgbColor == "tan") + setRGBColor(210, 180, 140); + else if(rgbColor == "teal") + setRGBColor(0, 128, 128); + else if(rgbColor == "thistle") + setRGBColor(216, 191, 216); + else if(rgbColor == "tomato") + setRGBColor(255, 99, 71); + else if(rgbColor == "turquoise") + setRGBColor(64, 224, 208); + else if(rgbColor == "violet") + setRGBColor(238, 130, 238); + else if(rgbColor == "wheat") + setRGBColor(245, 222, 179); + else if(rgbColor == "white") + setRGBColor(255, 255, 255); + else if(rgbColor == "whitesmoke") + setRGBColor(245, 245, 245); + else if(rgbColor == "yellow") + setRGBColor(255, 255, 0); + else if(rgbColor == "yellowgreen") + setRGBColor(154, 205, 50); +} + +void SVGColorImpl::setRGBColorICCColor(const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) +{ + TQColor color; + + TQString content = iccColor.string().right(iccColor.string().length() - 10); + TQString iccTarget = content.mid(0, content.find(',')); + + TQStringList colors = TQStringList::split(',', content); + TQString r = colors[1]; + TQString g = colors[2]; + TQString b = colors[3].left(colors[3].length() - 1); + + iccTarget = SVGURIReferenceImpl::getTarget(iccTarget); + + SVGColorProfileElementImpl *handle = 0; + if(m_object) + handle = static_cast(dynamic_cast(m_object)->ownerDoc()->rootElement()->getElementById(iccTarget)); + + if(iccTarget.isEmpty() || !handle) + { + color.setNamedColor(rgbColor.string().stripWhiteSpace()); + setRGBColor(color); + } + else + { + color.setRgb(handle->correctPixel(r.toFloat() * 257, g.toFloat() * 257, b.toFloat() * 257)); + setRGBColor(color); + + m_colorType = SVG_COLORTYPE_RGBCOLOR_ICCCOLOR; + + if(!m_iccColor) + { + m_iccColor = new SVGICCColorImpl(); + m_iccColor->ref(); + } + + m_iccColor->setColorProfile(DOM::DOMString(content)); + + SVGNumberImpl *rnumber = SVGSVGElementImpl::createSVGNumber(); + rnumber->setValue(r.toFloat()); + + SVGNumberImpl *gnumber = SVGSVGElementImpl::createSVGNumber(); + gnumber->setValue(g.toFloat()); + + SVGNumberImpl *bnumber = SVGSVGElementImpl::createSVGNumber(); + bnumber->setValue(b.toFloat()); + + m_iccColor->colors()->clear(); + m_iccColor->colors()->appendItem(bnumber); + m_iccColor->colors()->appendItem(gnumber); + m_iccColor->colors()->appendItem(rnumber); + } +} + +void SVGColorImpl::setColor(unsigned short colorType, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) +{ + m_colorType = colorType; + + if(m_colorType == SVG_COLORTYPE_UNKNOWN || m_colorType == SVG_COLORTYPE_CURRENTCOLOR) + return; + + setRGBColorICCColor(rgbColor, iccColor); +} + +// Ecma stuff +/* +@namespace KSVG +@begin SVGColorImpl::s_hashTable 5 + colorType SVGColorImpl::ColorType DontDelete|ReadOnly + RGBColor SVGColorImpl::RGBColor DontDelete|ReadOnly + ICCColor SVGColorImpl::ICCColor DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGColorImplProto::s_hashTable 5 + setRGBColor SVGColorImpl::SetRGBColor DontDelete|Function 1 + setRGBColorICCColor SVGColorImpl::SetRGBColorICCColor DontDelete|Function 2 + setColor SVGColorImpl::SetColor DontDelete|Function 3 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGColor", SVGColorImplProto, SVGColorImplProtoFunc) + +Value SVGColorImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case ColorType: + return Number(colorType()); +#ifdef __GNUC__ +#warning FIXME bridge stuff +#endif + case RGBColor: + return Undefined(); + case ICCColor: + return m_iccColor->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGColorImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGColorImpl) + + switch(id) + { + case SVGColorImpl::SetRGBColor: + obj->setRGBColor(args[0].toString(exec).string()); + break; + case SVGColorImpl::SetRGBColorICCColor: + obj->setRGBColorICCColor(args[0].toString(exec).string(), args[1].toString(exec).string()); + break; + case SVGColorImpl::SetColor: + obj->setColor(static_cast(args[0].toNumber(exec)), args[1].toString(exec).string(), args[2].toString(exec).string()); + break; + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +/* +@namespace KSVG +@begin SVGColorImplConstructor::s_hashTable 5 + SVG_COLORTYPE_UNKNOWN KSVG::SVG_COLORTYPE_UNKNOWN DontDelete|ReadOnly + SVG_COLORTYPE_RGBCOLOR KSVG::SVG_COLORTYPE_RGBCOLOR DontDelete|ReadOnly + SVG_COLORTYPE_RGBCOLOR_ICCCOLOR KSVG::SVG_COLORTYPE_RGBCOLOR_ICCCOLOR DontDelete|ReadOnly + SVG_COLORTYPE_CURRENTCOLOR KSVG::SVG_COLORTYPE_CURRENTCOLOR DontDelete|ReadOnly +@end +*/ + +Value SVGColorImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGColorImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgcolor.constructor]]"); +} diff --git a/ksvg/impl/SVGColorProfileElementImpl.cc b/ksvg/impl/SVGColorProfileElementImpl.cc deleted file mode 100644 index 89770494..00000000 --- a/ksvg/impl/SVGColorProfileElementImpl.cc +++ /dev/null @@ -1,269 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include - -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" - -#include "SVGRenderingIntent.h" - -#include "SVGAnimatedStringImpl.h" -#include "SVGColorProfileElementImpl.h" - -using namespace KSVG; - -#include "SVGColorProfileElementImpl.lut.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGColorProfileElementImpl::SVGColorProfileElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl() -{ - KSVG_EMPTY_FLAGS - - m_loaded = false; - - // Spec: Default value 'auto', if not overwritten later - m_renderingIntent = RENDERING_INTENT_AUTO; -} - -SVGColorProfileElementImpl::~SVGColorProfileElementImpl() -{ - if(m_loaded) - closeColorProfile(); -} - -/* -@namespace KSVG -@begin SVGColorProfileElementImpl::s_hashTable 5 - name SVGColorProfileElementImpl::Name DontDelete|ReadOnly - href SVGColorProfileElementImpl::Href DontDelete|ReadOnly - rendering-intent SVGColorProfileElementImpl::RenderingIntent DontDelete|ReadOnly -@end -*/ - -Value SVGColorProfileElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case Name: - return String(m_name); - case Href: - return href()->cache(exec); - case RenderingIntent: - return Number(m_renderingIntent); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGColorProfileElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Name: - m_name = value.toString(exec).string(); - ownerDoc()->rootElement()->addToIdMap(m_name.string(), this); - break; - case Href: - href()->setBaseVal(value.toString(exec).string()); - break; - case RenderingIntent: - { - TQString compare = value.toString(exec).qstring().lower(); - - if(compare == "perceptual") - m_renderingIntent = RENDERING_INTENT_PERCEPTUAL; - else if(compare == "relative-colorimetric") - m_renderingIntent = RENDERING_INTENT_RELATIVE_COLORIMETRIC; - else if(compare == "saturation") - m_renderingIntent = RENDERING_INTENT_SATURATION; - else if(compare == "absolute-colorimetric") - m_renderingIntent = RENDERING_INTENT_ABSOLUTE_COLORIMETRIC; - else - m_renderingIntent = RENDERING_INTENT_AUTO; - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGColorProfileElementImpl::setLocal(const DOM::DOMString &local) -{ - m_local = local; -} - -DOM::DOMString SVGColorProfileElementImpl::local() const -{ - return m_local; -} - -void SVGColorProfileElementImpl::setName(const DOM::DOMString &name) -{ - m_name = name; -} - -DOM::DOMString SVGColorProfileElementImpl::name() const -{ - return m_name; -} - -void SVGColorProfileElementImpl::setRenderingIntent(unsigned short renderingIntent) -{ - m_renderingIntent = renderingIntent; -} - -unsigned short SVGColorProfileElementImpl::renderingIntent() const -{ - return m_renderingIntent; -} - -bool SVGColorProfileElementImpl::canLoad() -{ - TQString open; - bool temp; - return canLoad(false, temp, open, true); -} - -bool SVGColorProfileElementImpl::canLoad(bool remote, bool &tempFile, TQString &open, bool verbose) -{ - KURL file; - - if(!KURL::isRelativeURL(href()->baseVal().string())) - file = KURL(href()->baseVal().string()); - else - file = KURL(ownerDoc()->baseUrl(), href()->baseVal().string()); - - if(file.path().isEmpty()) - { - if(verbose) - kdDebug() << "Couldn't load color profile " << file.path() << "!" << endl; - - return false; - } - - if(file.isLocalFile()) - { - open = file.path(); - - if(!TQFile::exists(open)) - { - if(verbose) - kdDebug() << "Couldn't load color profile " << file.path() << "! It does not exist." << endl; - - return false; - } - } - else - { - if(remote) - { - if(TDEIO::NetAccess::download(file, open, 0)) - tempFile = true; - } - } - - return true; -} - -bool SVGColorProfileElementImpl::loadColorProfile() -{ - TQString open; - bool tempFile = false; - - if(!canLoad(true, tempFile, open, false)) - return false; - - m_hInput = cmsOpenProfileFromFile(open.latin1(), "r"); - m_hOutput = cmsCreate_sRGBProfile(); - - unsigned int dwIn = BYTES_SH(2) | CHANNELS_SH(cmsChannelsOf(m_inputColorSpace)); - unsigned int dwOut = BYTES_SH(2) | CHANNELS_SH(cmsChannelsOf(m_outputColorSpace)); - - if(m_renderingIntent != RENDERING_INTENT_AUTO) - m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, m_renderingIntent - 2, cmsFLAGS_NOOPTIMIZE); - else - m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, cmsGetHeaderRenderingIntent(m_hInput), cmsFLAGS_NOOPTIMIZE); - - m_inputColorSpace = cmsGetColorSpace(m_hInput); - m_outputColorSpace = cmsGetColorSpace(m_hOutput); - m_loaded = true; - - if(tempFile) - TDEIO::NetAccess::removeTempFile(open); - - return true; -} - -void SVGColorProfileElementImpl::closeColorProfile() -{ - cmsDeleteTransform(m_hTrans); - cmsCloseProfile(m_hInput); -} - -TQRgb SVGColorProfileElementImpl::correctPixel(float r, float g, float b) -{ - if(!m_loaded) - { - if(!loadColorProfile()) - return tqRgb(0, 0, 0); - } - - unsigned short input[cmsMAXCHANNELS], output[cmsMAXCHANNELS]; - - input[0] = ((unsigned int) r) * 257; - input[1] = ((unsigned int) g) * 257; - input[2] = ((unsigned int) b) * 257; - - cmsDoTransform(m_hTrans, input, output, 1); - - if(m_outputColorSpace == cmsSigRgbData) - return tqRgb(output[0] / 257, output[1] / 257, output[2] / 257); - - return tqRgb(0, 0, 0); -} - -TQImage *SVGColorProfileElementImpl::correctImage(TQImage *input) -{ - if(!canLoad()) - return input; - - for(int y = 0; y < input->height(); y++) - { - for(int x = 0; x < input->width(); x++) - { - TQRgb pixel = input->pixel(x, y); - input->setPixel(x, y, correctPixel(tqRed(pixel), tqGreen(pixel), tqBlue(pixel))); - } - } - - return input; -} diff --git a/ksvg/impl/SVGColorProfileElementImpl.cpp b/ksvg/impl/SVGColorProfileElementImpl.cpp new file mode 100644 index 00000000..89770494 --- /dev/null +++ b/ksvg/impl/SVGColorProfileElementImpl.cpp @@ -0,0 +1,269 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include + +#include + +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" + +#include "SVGRenderingIntent.h" + +#include "SVGAnimatedStringImpl.h" +#include "SVGColorProfileElementImpl.h" + +using namespace KSVG; + +#include "SVGColorProfileElementImpl.lut.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGColorProfileElementImpl::SVGColorProfileElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl() +{ + KSVG_EMPTY_FLAGS + + m_loaded = false; + + // Spec: Default value 'auto', if not overwritten later + m_renderingIntent = RENDERING_INTENT_AUTO; +} + +SVGColorProfileElementImpl::~SVGColorProfileElementImpl() +{ + if(m_loaded) + closeColorProfile(); +} + +/* +@namespace KSVG +@begin SVGColorProfileElementImpl::s_hashTable 5 + name SVGColorProfileElementImpl::Name DontDelete|ReadOnly + href SVGColorProfileElementImpl::Href DontDelete|ReadOnly + rendering-intent SVGColorProfileElementImpl::RenderingIntent DontDelete|ReadOnly +@end +*/ + +Value SVGColorProfileElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case Name: + return String(m_name); + case Href: + return href()->cache(exec); + case RenderingIntent: + return Number(m_renderingIntent); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGColorProfileElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Name: + m_name = value.toString(exec).string(); + ownerDoc()->rootElement()->addToIdMap(m_name.string(), this); + break; + case Href: + href()->setBaseVal(value.toString(exec).string()); + break; + case RenderingIntent: + { + TQString compare = value.toString(exec).qstring().lower(); + + if(compare == "perceptual") + m_renderingIntent = RENDERING_INTENT_PERCEPTUAL; + else if(compare == "relative-colorimetric") + m_renderingIntent = RENDERING_INTENT_RELATIVE_COLORIMETRIC; + else if(compare == "saturation") + m_renderingIntent = RENDERING_INTENT_SATURATION; + else if(compare == "absolute-colorimetric") + m_renderingIntent = RENDERING_INTENT_ABSOLUTE_COLORIMETRIC; + else + m_renderingIntent = RENDERING_INTENT_AUTO; + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGColorProfileElementImpl::setLocal(const DOM::DOMString &local) +{ + m_local = local; +} + +DOM::DOMString SVGColorProfileElementImpl::local() const +{ + return m_local; +} + +void SVGColorProfileElementImpl::setName(const DOM::DOMString &name) +{ + m_name = name; +} + +DOM::DOMString SVGColorProfileElementImpl::name() const +{ + return m_name; +} + +void SVGColorProfileElementImpl::setRenderingIntent(unsigned short renderingIntent) +{ + m_renderingIntent = renderingIntent; +} + +unsigned short SVGColorProfileElementImpl::renderingIntent() const +{ + return m_renderingIntent; +} + +bool SVGColorProfileElementImpl::canLoad() +{ + TQString open; + bool temp; + return canLoad(false, temp, open, true); +} + +bool SVGColorProfileElementImpl::canLoad(bool remote, bool &tempFile, TQString &open, bool verbose) +{ + KURL file; + + if(!KURL::isRelativeURL(href()->baseVal().string())) + file = KURL(href()->baseVal().string()); + else + file = KURL(ownerDoc()->baseUrl(), href()->baseVal().string()); + + if(file.path().isEmpty()) + { + if(verbose) + kdDebug() << "Couldn't load color profile " << file.path() << "!" << endl; + + return false; + } + + if(file.isLocalFile()) + { + open = file.path(); + + if(!TQFile::exists(open)) + { + if(verbose) + kdDebug() << "Couldn't load color profile " << file.path() << "! It does not exist." << endl; + + return false; + } + } + else + { + if(remote) + { + if(TDEIO::NetAccess::download(file, open, 0)) + tempFile = true; + } + } + + return true; +} + +bool SVGColorProfileElementImpl::loadColorProfile() +{ + TQString open; + bool tempFile = false; + + if(!canLoad(true, tempFile, open, false)) + return false; + + m_hInput = cmsOpenProfileFromFile(open.latin1(), "r"); + m_hOutput = cmsCreate_sRGBProfile(); + + unsigned int dwIn = BYTES_SH(2) | CHANNELS_SH(cmsChannelsOf(m_inputColorSpace)); + unsigned int dwOut = BYTES_SH(2) | CHANNELS_SH(cmsChannelsOf(m_outputColorSpace)); + + if(m_renderingIntent != RENDERING_INTENT_AUTO) + m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, m_renderingIntent - 2, cmsFLAGS_NOOPTIMIZE); + else + m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, cmsGetHeaderRenderingIntent(m_hInput), cmsFLAGS_NOOPTIMIZE); + + m_inputColorSpace = cmsGetColorSpace(m_hInput); + m_outputColorSpace = cmsGetColorSpace(m_hOutput); + m_loaded = true; + + if(tempFile) + TDEIO::NetAccess::removeTempFile(open); + + return true; +} + +void SVGColorProfileElementImpl::closeColorProfile() +{ + cmsDeleteTransform(m_hTrans); + cmsCloseProfile(m_hInput); +} + +TQRgb SVGColorProfileElementImpl::correctPixel(float r, float g, float b) +{ + if(!m_loaded) + { + if(!loadColorProfile()) + return tqRgb(0, 0, 0); + } + + unsigned short input[cmsMAXCHANNELS], output[cmsMAXCHANNELS]; + + input[0] = ((unsigned int) r) * 257; + input[1] = ((unsigned int) g) * 257; + input[2] = ((unsigned int) b) * 257; + + cmsDoTransform(m_hTrans, input, output, 1); + + if(m_outputColorSpace == cmsSigRgbData) + return tqRgb(output[0] / 257, output[1] / 257, output[2] / 257); + + return tqRgb(0, 0, 0); +} + +TQImage *SVGColorProfileElementImpl::correctImage(TQImage *input) +{ + if(!canLoad()) + return input; + + for(int y = 0; y < input->height(); y++) + { + for(int x = 0; x < input->width(); x++) + { + TQRgb pixel = input->pixel(x, y); + input->setPixel(x, y, correctPixel(tqRed(pixel), tqGreen(pixel), tqBlue(pixel))); + } + } + + return input; +} diff --git a/ksvg/impl/SVGColorProfileRuleImpl.cc b/ksvg/impl/SVGColorProfileRuleImpl.cc deleted file mode 100644 index 74fffb47..00000000 --- a/ksvg/impl/SVGColorProfileRuleImpl.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGColorProfileRuleImpl.h" - -using namespace KSVG; - -SVGColorProfileRuleImpl::SVGColorProfileRuleImpl() : SVGCSSRuleImpl() -{ -} - -SVGColorProfileRuleImpl::~SVGColorProfileRuleImpl() -{ -} - -void SVGColorProfileRuleImpl::setSrc(const DOM::DOMString &src) -{ - m_src = src; -} - -DOM::DOMString SVGColorProfileRuleImpl::src() const -{ - return m_src; -} - -void SVGColorProfileRuleImpl::setName(const DOM::DOMString &name) -{ - m_name = name; -} - -DOM::DOMString SVGColorProfileRuleImpl::name() const -{ - return m_name; -} - -void SVGColorProfileRuleImpl::setRenderingIntent(unsigned short renderingIntent) -{ - m_renderingIntent = renderingIntent; -} - -unsigned short SVGColorProfileRuleImpl::renderingIntent() const -{ - return m_renderingIntent; -} diff --git a/ksvg/impl/SVGColorProfileRuleImpl.cpp b/ksvg/impl/SVGColorProfileRuleImpl.cpp new file mode 100644 index 00000000..74fffb47 --- /dev/null +++ b/ksvg/impl/SVGColorProfileRuleImpl.cpp @@ -0,0 +1,61 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGColorProfileRuleImpl.h" + +using namespace KSVG; + +SVGColorProfileRuleImpl::SVGColorProfileRuleImpl() : SVGCSSRuleImpl() +{ +} + +SVGColorProfileRuleImpl::~SVGColorProfileRuleImpl() +{ +} + +void SVGColorProfileRuleImpl::setSrc(const DOM::DOMString &src) +{ + m_src = src; +} + +DOM::DOMString SVGColorProfileRuleImpl::src() const +{ + return m_src; +} + +void SVGColorProfileRuleImpl::setName(const DOM::DOMString &name) +{ + m_name = name; +} + +DOM::DOMString SVGColorProfileRuleImpl::name() const +{ + return m_name; +} + +void SVGColorProfileRuleImpl::setRenderingIntent(unsigned short renderingIntent) +{ + m_renderingIntent = renderingIntent; +} + +unsigned short SVGColorProfileRuleImpl::renderingIntent() const +{ + return m_renderingIntent; +} diff --git a/ksvg/impl/SVGComponentTransferFunctionElementImpl.cc b/ksvg/impl/SVGComponentTransferFunctionElementImpl.cc deleted file mode 100644 index 9407b2a6..00000000 --- a/ksvg/impl/SVGComponentTransferFunctionElementImpl.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberImpl.h" -#include "SVGAnimatedNumberListImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGComponentTransferFunctionElementImpl.h" - -using namespace KSVG; - -SVGComponentTransferFunctionElementImpl::SVGComponentTransferFunctionElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ - m_type = new SVGAnimatedEnumerationImpl(); - m_type->ref(); - - m_tableValues = new SVGAnimatedNumberListImpl(); - m_tableValues->ref(); - - m_slope = new SVGAnimatedNumberImpl(); - m_slope->ref(); - - m_intercept = new SVGAnimatedNumberImpl(); - m_intercept->ref(); - - m_amplitude = new SVGAnimatedNumberImpl(); - m_amplitude->ref(); - - m_exponent = new SVGAnimatedNumberImpl(); - m_exponent->ref(); - - m_offset = new SVGAnimatedNumberImpl(); - m_offset->ref(); -} - -SVGComponentTransferFunctionElementImpl::~SVGComponentTransferFunctionElementImpl() -{ - if(m_type) - m_type->deref(); - if(m_tableValues) - m_tableValues->deref(); - if(m_slope) - m_slope->deref(); - if(m_intercept) - m_intercept->deref(); - if(m_amplitude) - m_amplitude->deref(); - if(m_exponent) - m_exponent->deref(); - if(m_offset) - m_offset->deref(); -} - -SVGAnimatedEnumerationImpl *SVGComponentTransferFunctionElementImpl::type() const -{ - return m_type; -} - -SVGAnimatedNumberListImpl *SVGComponentTransferFunctionElementImpl::tableValues() const -{ - return m_tableValues; -} - -SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::slope() const -{ - return m_slope; -} - -SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::intercept() const -{ - return m_intercept; -} - -SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::amplitude() const -{ - return m_amplitude; -} - -SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::exponent() const -{ - return m_exponent; -} - -SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::offset() const -{ - return m_offset; -} diff --git a/ksvg/impl/SVGComponentTransferFunctionElementImpl.cpp b/ksvg/impl/SVGComponentTransferFunctionElementImpl.cpp new file mode 100644 index 00000000..9407b2a6 --- /dev/null +++ b/ksvg/impl/SVGComponentTransferFunctionElementImpl.cpp @@ -0,0 +1,103 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberImpl.h" +#include "SVGAnimatedNumberListImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGComponentTransferFunctionElementImpl.h" + +using namespace KSVG; + +SVGComponentTransferFunctionElementImpl::SVGComponentTransferFunctionElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ + m_type = new SVGAnimatedEnumerationImpl(); + m_type->ref(); + + m_tableValues = new SVGAnimatedNumberListImpl(); + m_tableValues->ref(); + + m_slope = new SVGAnimatedNumberImpl(); + m_slope->ref(); + + m_intercept = new SVGAnimatedNumberImpl(); + m_intercept->ref(); + + m_amplitude = new SVGAnimatedNumberImpl(); + m_amplitude->ref(); + + m_exponent = new SVGAnimatedNumberImpl(); + m_exponent->ref(); + + m_offset = new SVGAnimatedNumberImpl(); + m_offset->ref(); +} + +SVGComponentTransferFunctionElementImpl::~SVGComponentTransferFunctionElementImpl() +{ + if(m_type) + m_type->deref(); + if(m_tableValues) + m_tableValues->deref(); + if(m_slope) + m_slope->deref(); + if(m_intercept) + m_intercept->deref(); + if(m_amplitude) + m_amplitude->deref(); + if(m_exponent) + m_exponent->deref(); + if(m_offset) + m_offset->deref(); +} + +SVGAnimatedEnumerationImpl *SVGComponentTransferFunctionElementImpl::type() const +{ + return m_type; +} + +SVGAnimatedNumberListImpl *SVGComponentTransferFunctionElementImpl::tableValues() const +{ + return m_tableValues; +} + +SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::slope() const +{ + return m_slope; +} + +SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::intercept() const +{ + return m_intercept; +} + +SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::amplitude() const +{ + return m_amplitude; +} + +SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::exponent() const +{ + return m_exponent; +} + +SVGAnimatedNumberImpl *SVGComponentTransferFunctionElementImpl::offset() const +{ + return m_offset; +} diff --git a/ksvg/impl/SVGContainerImpl.cc b/ksvg/impl/SVGContainerImpl.cc deleted file mode 100644 index efaf62e8..00000000 --- a/ksvg/impl/SVGContainerImpl.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGRectImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGContainerImpl.h" -#include "SVGSVGElementImpl.h" -#include "kdebug.h" - -using namespace KSVG; - -SVGContainerImpl::SVGContainerImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl) -{ -} - -SVGContainerImpl::~SVGContainerImpl() -{ -} - -SVGRectImpl *SVGContainerImpl::getBBox() -{ - // just get the union of the children bboxes - TQRect rect; - DOM::Node node = firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *elem = ownerDoc()->getElementFromHandle(node.handle()); - SVGShapeImpl *shape = dynamic_cast(elem); - SVGTestsImpl *tests = dynamic_cast(elem); - SVGStylableImpl *style = dynamic_cast(elem); - - bool ok = tests ? tests->ok() : true; - - if(shape && style && ok && style->getVisible() && style->getDisplay()) - { - SVGRectImpl *current = shape->getBBox(); - rect = rect.unite(current->qrect()); - current->deref(); - } - } - - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - *ret = rect; - return ret; -} - -void SVGContainerImpl::createItem(KSVGCanvas *c) -{ - DOM::Node node = firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *elem = ownerDoc()->getElementFromHandle(node.handle()); - if(elem) - elem->createItem(c); - } -} - -void SVGContainerImpl::removeItem(KSVGCanvas *c) -{ - SVGShapeImpl::removeItem(c); - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *elem = ownerDoc()->getElementFromHandle(node.handle()); - if(elem) - elem->removeItem(c); - } -} - -void SVGContainerImpl::update(CanvasItemUpdate reason, int param1, int param2) -{ - SVGShapeImpl::update(reason, param1, param2); - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); - if(shape) - shape->update(reason, param1, param2); - } -} - -void SVGContainerImpl::invalidate(KSVGCanvas *c, bool recalc) -{ - SVGShapeImpl::invalidate(c, recalc); - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); - if(shape) - shape->invalidate(c, recalc); - } -} - -void SVGContainerImpl::setReferenced(bool referenced) -{ - SVGShapeImpl::setReferenced(referenced); - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); - if(shape) - shape->setReferenced(referenced); - } -} - -void SVGContainerImpl::draw() -{ - SVGShapeImpl::draw(); - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); - if(shape) - shape->draw(); - } -} diff --git a/ksvg/impl/SVGContainerImpl.cpp b/ksvg/impl/SVGContainerImpl.cpp new file mode 100644 index 00000000..efaf62e8 --- /dev/null +++ b/ksvg/impl/SVGContainerImpl.cpp @@ -0,0 +1,133 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGRectImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGContainerImpl.h" +#include "SVGSVGElementImpl.h" +#include "kdebug.h" + +using namespace KSVG; + +SVGContainerImpl::SVGContainerImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl) +{ +} + +SVGContainerImpl::~SVGContainerImpl() +{ +} + +SVGRectImpl *SVGContainerImpl::getBBox() +{ + // just get the union of the children bboxes + TQRect rect; + DOM::Node node = firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *elem = ownerDoc()->getElementFromHandle(node.handle()); + SVGShapeImpl *shape = dynamic_cast(elem); + SVGTestsImpl *tests = dynamic_cast(elem); + SVGStylableImpl *style = dynamic_cast(elem); + + bool ok = tests ? tests->ok() : true; + + if(shape && style && ok && style->getVisible() && style->getDisplay()) + { + SVGRectImpl *current = shape->getBBox(); + rect = rect.unite(current->qrect()); + current->deref(); + } + } + + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + *ret = rect; + return ret; +} + +void SVGContainerImpl::createItem(KSVGCanvas *c) +{ + DOM::Node node = firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *elem = ownerDoc()->getElementFromHandle(node.handle()); + if(elem) + elem->createItem(c); + } +} + +void SVGContainerImpl::removeItem(KSVGCanvas *c) +{ + SVGShapeImpl::removeItem(c); + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *elem = ownerDoc()->getElementFromHandle(node.handle()); + if(elem) + elem->removeItem(c); + } +} + +void SVGContainerImpl::update(CanvasItemUpdate reason, int param1, int param2) +{ + SVGShapeImpl::update(reason, param1, param2); + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); + if(shape) + shape->update(reason, param1, param2); + } +} + +void SVGContainerImpl::invalidate(KSVGCanvas *c, bool recalc) +{ + SVGShapeImpl::invalidate(c, recalc); + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); + if(shape) + shape->invalidate(c, recalc); + } +} + +void SVGContainerImpl::setReferenced(bool referenced) +{ + SVGShapeImpl::setReferenced(referenced); + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); + if(shape) + shape->setReferenced(referenced); + } +} + +void SVGContainerImpl::draw() +{ + SVGShapeImpl::draw(); + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGShapeImpl *shape = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); + if(shape) + shape->draw(); + } +} diff --git a/ksvg/impl/SVGCursorElementImpl.cc b/ksvg/impl/SVGCursorElementImpl.cc deleted file mode 100644 index a83afd73..00000000 --- a/ksvg/impl/SVGCursorElementImpl.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGCursorElementImpl.h" -#include "SVGAnimatedLengthImpl.h" - -using namespace KSVG; - -#include "SVGCursorElementImpl.lut.h" -#include "ksvg_bridge.h" - -SVGCursorElementImpl::SVGCursorElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGExternalResourcesRequiredImpl() -{ - KSVG_EMPTY_FLAGS - - m_x = new SVGAnimatedLengthImpl(); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(); - m_y->ref(); -} - -SVGCursorElementImpl::~SVGCursorElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); -} - -SVGAnimatedLengthImpl *SVGCursorElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGCursorElementImpl::y() const -{ - return m_y; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGCursorElementImpl::s_hashTable 3 - x SVGCursorElementImpl::X DontDelete|ReadOnly - y SVGCursorElementImpl::Y DontDelete|ReadOnly -@end -*/ - -Value SVGCursorElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case X: - return m_x->cache(exec); - case Y: - return m_y->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGCursorElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X: - x()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Y: - y()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGCursorElementImpl.cpp b/ksvg/impl/SVGCursorElementImpl.cpp new file mode 100644 index 00000000..a83afd73 --- /dev/null +++ b/ksvg/impl/SVGCursorElementImpl.cpp @@ -0,0 +1,102 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGCursorElementImpl.h" +#include "SVGAnimatedLengthImpl.h" + +using namespace KSVG; + +#include "SVGCursorElementImpl.lut.h" +#include "ksvg_bridge.h" + +SVGCursorElementImpl::SVGCursorElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGExternalResourcesRequiredImpl() +{ + KSVG_EMPTY_FLAGS + + m_x = new SVGAnimatedLengthImpl(); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(); + m_y->ref(); +} + +SVGCursorElementImpl::~SVGCursorElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); +} + +SVGAnimatedLengthImpl *SVGCursorElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGCursorElementImpl::y() const +{ + return m_y; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGCursorElementImpl::s_hashTable 3 + x SVGCursorElementImpl::X DontDelete|ReadOnly + y SVGCursorElementImpl::Y DontDelete|ReadOnly +@end +*/ + +Value SVGCursorElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case X: + return m_x->cache(exec); + case Y: + return m_y->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGCursorElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X: + x()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Y: + y()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGDefinitionSrcElementImpl.cc b/ksvg/impl/SVGDefinitionSrcElementImpl.cc deleted file mode 100644 index fdd5b159..00000000 --- a/ksvg/impl/SVGDefinitionSrcElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDefinitionSrcElementImpl.h" - -using namespace KSVG; - -SVGDefinitionSrcElementImpl::SVGDefinitionSrcElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGDefinitionSrcElementImpl::~SVGDefinitionSrcElementImpl() -{ -} diff --git a/ksvg/impl/SVGDefinitionSrcElementImpl.cpp b/ksvg/impl/SVGDefinitionSrcElementImpl.cpp new file mode 100644 index 00000000..fdd5b159 --- /dev/null +++ b/ksvg/impl/SVGDefinitionSrcElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDefinitionSrcElementImpl.h" + +using namespace KSVG; + +SVGDefinitionSrcElementImpl::SVGDefinitionSrcElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGDefinitionSrcElementImpl::~SVGDefinitionSrcElementImpl() +{ +} diff --git a/ksvg/impl/SVGDefsElementImpl.cc b/ksvg/impl/SVGDefsElementImpl.cc deleted file mode 100644 index f388e482..00000000 --- a/ksvg/impl/SVGDefsElementImpl.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDefsElementImpl.h" - -using namespace KSVG; - -SVGDefsElementImpl::SVGDefsElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - m_display = false; // implicit display=none -} - -SVGDefsElementImpl::~SVGDefsElementImpl() -{ -} diff --git a/ksvg/impl/SVGDefsElementImpl.cpp b/ksvg/impl/SVGDefsElementImpl.cpp new file mode 100644 index 00000000..f388e482 --- /dev/null +++ b/ksvg/impl/SVGDefsElementImpl.cpp @@ -0,0 +1,32 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDefsElementImpl.h" + +using namespace KSVG; + +SVGDefsElementImpl::SVGDefsElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + m_display = false; // implicit display=none +} + +SVGDefsElementImpl::~SVGDefsElementImpl() +{ +} diff --git a/ksvg/impl/SVGDescElementImpl.cc b/ksvg/impl/SVGDescElementImpl.cc deleted file mode 100644 index 9d8ceef2..00000000 --- a/ksvg/impl/SVGDescElementImpl.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDocumentImpl.h" -#include "SVGDescElementImpl.h" - -using namespace KSVG; - -SVGDescElementImpl::SVGDescElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGLangSpaceImpl(), SVGStylableImpl(this) -{ -} - -SVGDescElementImpl::~SVGDescElementImpl() -{ -} - -void SVGDescElementImpl::createItem(KSVGCanvas *) -{ - emit ownerDoc()->gotDescription(collectText()); -} diff --git a/ksvg/impl/SVGDescElementImpl.cpp b/ksvg/impl/SVGDescElementImpl.cpp new file mode 100644 index 00000000..9d8ceef2 --- /dev/null +++ b/ksvg/impl/SVGDescElementImpl.cpp @@ -0,0 +1,37 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDocumentImpl.h" +#include "SVGDescElementImpl.h" + +using namespace KSVG; + +SVGDescElementImpl::SVGDescElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGLangSpaceImpl(), SVGStylableImpl(this) +{ +} + +SVGDescElementImpl::~SVGDescElementImpl() +{ +} + +void SVGDescElementImpl::createItem(KSVGCanvas *) +{ + emit ownerDoc()->gotDescription(collectText()); +} diff --git a/ksvg/impl/SVGDocumentImpl.cc b/ksvg/impl/SVGDocumentImpl.cc deleted file mode 100644 index ce6de16e..00000000 --- a/ksvg/impl/SVGDocumentImpl.cc +++ /dev/null @@ -1,703 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#define USE_VALGRIND 0 - -#if USE_VALGRIND -#include -#endif - -#include "SVGEvent.h" -#include "SVGMatrixImpl.h" -#include "SVGWindowImpl.h" -#include "SVGElementImpl.h" -#include "SVGDocumentImpl.moc" -#include "SVGSVGElementImpl.h" -#include "SVGImageElementImpl.h" -#include "SVGScriptElementImpl.h" -#include "SVGTitleElementImpl.h" -#include "SVGAnimationElementImpl.h" - -#include "KSVGReader.h" -#include "KSVGLoader.h" -#include "KSVGCanvas.h" -#include "CanvasItem.h" - -#include - -using namespace KSVG; - -#include "SVGDocumentImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -// A sequence of prime numbers that sets the m_elemDict's hash table size as the -// number of elements in the dictionary passes each level. This keeps the lookup -// performance high as the number of elements grows. See the TQDict documentation. -unsigned int SVGDocumentImpl::elemDictHashSizes [] = -{ - 101, - 211, - 401, - 809, - 1601, - 3203, - 6421, - 12809, - 25601, - 51203, - 102407, - 204803, - 409609, - 819229 -}; - -const int SVGDocumentImpl::numElemDictHashSizes = sizeof(elemDictHashSizes) / sizeof(elemDictHashSizes[0]); - -SVGDocumentImpl::SVGDocumentImpl(bool anim, bool fit, SVGImageElementImpl *parentImage) : TQObject(), DOM::DomShared(), DOM::Document(), SVGDOMNodeBridge(static_cast(*this)) -{ - m_animations = anim; - - m_reader = 0; - m_loader = 0; - m_canvas = 0; - m_rootElement = 0; - m_lastTarget = 0; - m_window = 0; - - m_elemDictHashSizeIndex = 0; - m_elemDict.resize(elemDictHashSizes[m_elemDictHashSizeIndex]); - - m_timeScheduler = new SVGTimeScheduler(this); - m_ecmaEngine = new KSVGEcma(this); - m_ecmaEngine->setup(); - - m_finishedParsing = false; - m_finishedLoading = false; - m_resortZIndicesOnFinishedLoading = false; - m_fit = fit; - - m_parentImage = parentImage; - if(m_parentImage) - m_parentImage->ref(); -} - -SVGDocumentImpl::~SVGDocumentImpl() -{ - if(rootElement() && rootElement()->hasEventListener(SVGEvent::UNLOAD_EVENT, true)) - rootElement()->dispatchEvent(SVGEvent::UNLOAD_EVENT, false, false); - - TQPtrList killList; - - DOM::Node node = firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGShapeImpl *shape = dynamic_cast(getElementFromHandle(node.handle())); - if(shape) - killList.append(shape); - } - - SVGShapeImpl *rend = 0; - for(rend = killList.first(); rend; rend = killList.next()) - delete rend; - - delete m_timeScheduler; - delete m_ecmaEngine; - delete m_reader; - delete m_loader; - - if(m_window) - m_window->deref(); - - if(m_parentImage) - m_parentImage->deref(); -} - -SVGWindowImpl *SVGDocumentImpl::window() -{ - if(!m_window) - { - m_window = new SVGWindowImpl(const_cast(this)); - m_window->ref(); - } - - return m_window; -} - -float SVGDocumentImpl::screenPixelsPerMillimeterX() const -{ - if(canvas() && canvas()->drawWindow()) - { - TQPaintDeviceMetrics metrics(canvas()->drawWindow()); - return float(metrics.width()) / float(metrics.widthMM()); - } - else - return 90.0; -} - -float SVGDocumentImpl::screenPixelsPerMillimeterY() const -{ - if(canvas() && canvas()->drawWindow()) - { - TQPaintDeviceMetrics metrics(canvas()->drawWindow()); - return float(metrics.height()) / float(metrics.heightMM()); - } - else - return 90.0; -} - -DOM::DOMString SVGDocumentImpl::title() const -{ - DOM::Node n; - for(n = rootElement()->firstChild(); !n.isNull(); n = n.nextSibling()) - { - SVGElementImpl *elem = getElementFromHandle(n.handle()); - if(dynamic_cast(elem)) - return elem->collectText(); - } - return ""; -} - -DOM::DOMString SVGDocumentImpl::referrer() const -{ - return m_referrer; -} - -DOM::DOMString SVGDocumentImpl::domain() const -{ - return m_baseURL.host(); -} - -DOM::DOMString SVGDocumentImpl::URL() const -{ - return m_baseURL.prettyURL(); -} - -void SVGDocumentImpl::setReferrer(const DOM::DOMString &referrer) -{ - // TODO : better may be to request for referrer instead of storing it - m_referrer = referrer; -} - -void SVGDocumentImpl::setRootElement(SVGSVGElementImpl *elem) -{ - m_rootElement = elem; -} - -SVGSVGElementImpl *SVGDocumentImpl::rootElement() const -{ - return m_rootElement; -} - -SVGElementImpl *SVGDocumentImpl::createElement(const DOM::DOMString &name, DOM::Element impl, SVGDocumentImpl *doc) -{ - DOM::ElementImpl *handle = reinterpret_cast(impl.handle()); - SVGElementImpl *element = SVGElementImpl::Factory::self()->create(std::string(name.string().latin1()), handle); - - if(!element) - element = new SVGElementImpl(handle); - - element->setOwnerDoc(doc); - element->ref(); - return element; -} - -bool SVGDocumentImpl::open(const ::KURL &url) -{ - if(!url.prettyURL().isEmpty()) - { - m_baseURL = url; - - if(!m_loader) - m_loader = new KSVGLoader(); - - connect(m_loader, TQT_SIGNAL(gotResult(TQIODevice *)), this, TQT_SLOT(slotSVGContent(TQIODevice *))); - m_loader->getSVGContent(url); - } - else - return false; - - return true; -} - -void SVGDocumentImpl::slotSVGContent(TQIODevice *dev) -{ - TQXmlInputSource *inputSource = new TQXmlInputSource(dev); - - if(m_reader) - delete m_reader; - - KSVGReader::ParsingArgs args; - args.fit = m_fit; - args.getURLMode = false; - - TQString url = m_baseURL.prettyURL(); - int pos = url.find('#'); // url can become like this.svg#svgView(viewBox(63,226,74,74)), get part after '#' - if(pos > -1) - args.SVGFragmentId = url.mid(pos + 1); - - m_reader = new KSVGReader(this, m_canvas, args); - connect(m_reader, TQT_SIGNAL(finished(bool, const TQString &)), this, TQT_SLOT(slotFinishedParsing(bool, const TQString &))); - m_t.start(); - -#if USE_VALGRIND - CALLTREE_ZERO_STATS(); -#endif - - m_reader->parse(inputSource); - delete dev; -} - -void SVGDocumentImpl::parseSVG(TQXmlInputSource *inputSource, bool getURLMode) -{ - if(m_reader) - delete m_reader; - - KSVGReader::ParsingArgs args; - args.fit = m_fit; - args.getURLMode = getURLMode; - m_reader = new KSVGReader(this, 0, args); - connect(m_reader, TQT_SIGNAL(finished(bool, const TQString &)), this, TQT_SLOT(slotFinishedParsing(bool, const TQString &))); - -#if USE_VALGRIND - CALLTREE_ZERO_STATS(); -#endif - - m_reader->parse(inputSource); -} - -void SVGDocumentImpl::finishParsing(bool error, const TQString &errorDesc) -{ - if(m_reader) - m_reader->finishParsing(error, errorDesc); -} - -void SVGDocumentImpl::slotFinishedParsing(bool error, const TQString &errorDesc) -{ - kdDebug(26000) << k_funcinfo << "total time : " << m_t.elapsed() << endl; - -#if USE_VALGRIND - CALLTREE_DUMP_STATS(); -#endif - - if(m_animations) - m_timeScheduler->startAnimations(); - - if(m_canvas && !error && rootElement()) - executeScripts(); - - m_finishedParsing = true; - - emit finishedParsing(error, errorDesc); - if(!error) - emit finishedRendering(); - - checkFinishedLoading(); -} - -void SVGDocumentImpl::newImageJob(SVGImageElementImpl *image) -{ - kdDebug(26002) << "SVGDocumentImpl::newImageJob, " << image << endl; - m_loader->newImageJob(image, m_baseURL); -} - -void SVGDocumentImpl::notifyImageLoading(SVGImageElementImpl *image) -{ - m_imagesLoading.append(image); -} - -void SVGDocumentImpl::notifyImageLoaded(SVGImageElementImpl *image) -{ - m_imagesLoading.remove(image); - - if(m_imagesLoading.isEmpty()) - checkFinishedLoading(); -} - -void SVGDocumentImpl::checkFinishedLoading() -{ - if(m_finishedParsing && m_imagesLoading.isEmpty()) - { - m_finishedLoading = true; - - if(m_resortZIndicesOnFinishedLoading) - { - // Only resort if we're the 'outermost' document, i.e. we're not an svg image - // inside another document. We could resort as each image finishes loading, but it - // slows down the parsing phase. - if(m_parentImage == 0 && m_canvas && m_rootElement) - { - m_canvas->setElementItemZIndexRecursive(m_rootElement, 0); - m_canvas->update(); - } - } - - emit finishedLoading(); - } -} - -void SVGDocumentImpl::addForwardReferencingUseElement(SVGUseElementImpl *use) -{ - if(!m_forwardReferencingUseElements.contains(use)) - m_forwardReferencingUseElements.append(use); -} - -void SVGDocumentImpl::slotPaint() -{ - rerender(); -} - -void SVGDocumentImpl::rerender() -{ - m_canvas->update(); - emit finishedRendering(); -} - -void SVGDocumentImpl::attach(KSVG::KSVGCanvas *c) -{ - m_canvas = c; -} - -void SVGDocumentImpl::detach() -{ - m_canvas = 0; -} - -KSVG::KSVGCanvas *SVGDocumentImpl::canvas() const -{ - return m_canvas; -} - -void SVGDocumentImpl::syncCachedMatrices() -{ - if(rootElement()) - { - SVGMatrixImpl *parentMatrix = SVGSVGElementImpl::createSVGMatrix(); - rootElement()->checkCachedScreenCTM(parentMatrix); - parentMatrix->deref(); - } -} - -void SVGDocumentImpl::executeScriptsRecursive(DOM::Node start) -{ - DOM::Node node = start.firstChild(); - - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = getElementFromHandle(node.handle()); - - SVGContainerImpl *container = dynamic_cast(element); - if(container) - executeScriptsRecursive(node); - - SVGScriptElementImpl *script = dynamic_cast(element); - - if(script) - script->executeScript(DOM::Node()); - } -} - -bool SVGDocumentImpl::executeScriptsRecursiveCheck(DOM::Node start) -{ - bool test = true; - - DOM::Node node = start.firstChild(); - - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = getElementFromHandle(node.handle()); - - SVGContainerImpl *container = dynamic_cast(element); - if(container) - { - if(!executeScriptsRecursiveCheck(node)) - return false; - } - - SVGScriptElementImpl *script = dynamic_cast(element); - - if(script) - { - if(!script->canExecuteScript()) - { - test = false; - break; - } - } - } - - return test; -} - -void SVGDocumentImpl::executeScripts() -{ - bool test = executeScriptsRecursiveCheck(*rootElement()); - - if(!test) - TQTimer::singleShot(50, this, TQT_SLOT(executeScripts())); - else - { - executeScriptsRecursive(*rootElement()); - - // mop: only rerender if an loadevent has been found - if(dispatchRecursiveEvent(SVGEvent::LOAD_EVENT, lastChild())) - m_canvas->update(); - } -} - -// Dispatches a non-cancelable, non-bubbles event to every child -bool SVGDocumentImpl::dispatchRecursiveEvent(SVGEvent::EventId id, DOM::Node start) -{ - bool eventExecuted = false; - - // Iterate the tree, backwards, and dispatch the event to every child - DOM::Node node = start; - for(; !node.isNull(); node = node.previousSibling()) - { - SVGElementImpl *element = getElementFromHandle(node.handle()); - - if(element && element->hasChildNodes()) - { - // Dispatch to all children - eventExecuted = dispatchRecursiveEvent(id, element->lastChild()) ? true : eventExecuted; - - // Dispatch, locally - if(element->hasEventListener(id, true)) - { - element->dispatchEvent(id, false, false); - eventExecuted = true; - } - } - else if(element && element->hasEventListener(id, true)) - { - element->dispatchEvent(id, false, false); - eventExecuted = true; - } - } - - return eventExecuted; -} - -SVGEventListener *SVGDocumentImpl::createEventListener(DOM::DOMString type) -{ - return m_ecmaEngine->createEventListener(type); -} - -SVGElementImpl *SVGDocumentImpl::recursiveSearch(DOM::Node start, const DOM::DOMString &id) -{ - DOM::Node node = start.firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *test = getElementFromHandle(node.handle()); - - // Look in containers - SVGContainerImpl *container = dynamic_cast(test); - if(container) - { - SVGElementImpl *found = recursiveSearch(node, id); - if(found) - return found; - } - - // Look in SVGSVGElementImpl's - SVGSVGElementImpl *svgtest = dynamic_cast(test); - if(svgtest) - { - SVGElementImpl *element = svgtest->getElementById(id); - if(element) - return element; - } - } - - return 0; -} - -/* -@namespace KSVG -@begin SVGDocumentImpl::s_hashTable 9 - title SVGDocumentImpl::Title DontDelete|ReadOnly - referrer SVGDocumentImpl::Referrer DontDelete|ReadOnly - domain SVGDocumentImpl::Domain DontDelete|ReadOnly - URL SVGDocumentImpl::Url DontDelete|ReadOnly - doctype SVGDocumentImpl::DocType DontDelete|ReadOnly - implementation SVGDocumentImpl::Implementation DontDelete|ReadOnly - rootElement SVGDocumentImpl::RootElement DontDelete|ReadOnly - documentElement SVGDocumentImpl::DocumentElement DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGDocumentImplProto::s_hashTable 7 - createTextNode SVGDocumentImpl::CreateTextNode DontDelete|Function 1 - createElement SVGDocumentImpl::CreateElement DontDelete|Function 1 - createElementNS SVGDocumentImpl::CreateElementNS DontDelete|Function 2 - getElementById SVGDocumentImpl::GetElementById DontDelete|Function 1 - getElementsByTagName SVGDocumentImpl::GetElementsByTagName DontDelete|Function 1 - getElementsByTagNameNS SVGDocumentImpl::GetElementsByTagNameNS DontDelete|Function 2 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGDocument", SVGDocumentImplProto, SVGDocumentImplProtoFunc) - -Value SVGDocumentImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case Title: - return String(title().string()); - case Referrer: - return String(referrer().string()); - case Domain: - return String(domain().string()); - case Url: - return String(URL().string()); - case DocType: - return getDOMNode(exec, doctype()); - case Implementation: - return (new SVGDOMDOMImplementationBridge(implementation()))->cache(exec); - case RootElement: - case DocumentElement: - return m_rootElement->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGDocumentImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGDocumentImpl) - - switch(id) - { - case SVGDocumentImpl::CreateTextNode: - return getDOMNode(exec, obj->createTextNode(args[0].toString(exec).string())); - case SVGDocumentImpl::CreateElement: - case SVGDocumentImpl::CreateElementNS: - { - SVGElementImpl *newElement = 0; - - if(id == SVGDocumentImpl::CreateElement) - newElement = obj->createElement(args[0].toString(exec).qstring(), static_cast(obj)->createElement(args[0].toString(exec).string()), obj); - else if(id == SVGDocumentImpl::CreateElementNS) - newElement = obj->createElement(args[1].toString(exec).qstring(), static_cast(obj)->createElementNS(args[0].toString(exec).string(), args[1].toString(exec).string()), obj); - - newElement->setOwnerSVGElement(obj->rootElement()); // FIXME: Correct in all situations? - newElement->setViewportElement(obj->rootElement()); - newElement->setAttributes(); - - return getDOMNode(exec, *newElement); - } - case SVGDocumentImpl::GetElementById: - { - Value ret; - - SVGElementImpl *element = obj->rootElement()->getElementById(args[0].toString(exec).string()); - - if(element) - ret = getDOMNode(exec, *element); - else - { - element = obj->recursiveSearch(*obj, args[0].toString(exec).string()); - if(!element) - return Null(); - - ret = getDOMNode(exec, *element); - } - - return ret; - } - case SVGDocumentImpl::GetElementsByTagName: - return (new SVGDOMNodeListBridge(obj->getElementsByTagName(args[0].toString(exec).string())))->cache(exec); - case SVGDocumentImpl::GetElementsByTagNameNS: - return (new SVGDOMNodeListBridge(obj->getElementsByTagNameNS(args[0].toString(exec).string(), args[1].toString(exec).string())))->cache(exec); - default: - break; - } - - return KJS::Undefined(); -} - -SVGElementImpl *SVGDocumentImpl::getElementFromHandle(DOM::NodeImpl *handle) const -{ - return m_elemDict[handle]; -} - -void SVGDocumentImpl::addToElemDict(DOM::NodeImpl *handle, SVGElementImpl *obj) -{ - m_elemDict.insert(handle, obj); - - if(m_elemDict.count()>m_elemDict.size() && m_elemDictHashSizeIndexgetElementById(elementId); - - if(element) - return element; - } - - // #2 Search in all child SVGSVGElementImpl's - element = recursiveSearch(*this, elementId); - - if(element) - return element; - - // #3 Search in other documents - if(!dontSearch) - { - TQPtrDictIterator it(m_documentDict); - for(; it.current(); ++it) - { - SVGElementImpl *temp = it.current()->getElementByIdRecursive(0, elementId, true); - if(temp) - return temp; - } - } - - return element; -} diff --git a/ksvg/impl/SVGDocumentImpl.cpp b/ksvg/impl/SVGDocumentImpl.cpp new file mode 100644 index 00000000..ce6de16e --- /dev/null +++ b/ksvg/impl/SVGDocumentImpl.cpp @@ -0,0 +1,703 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#define USE_VALGRIND 0 + +#if USE_VALGRIND +#include +#endif + +#include "SVGEvent.h" +#include "SVGMatrixImpl.h" +#include "SVGWindowImpl.h" +#include "SVGElementImpl.h" +#include "SVGDocumentImpl.moc" +#include "SVGSVGElementImpl.h" +#include "SVGImageElementImpl.h" +#include "SVGScriptElementImpl.h" +#include "SVGTitleElementImpl.h" +#include "SVGAnimationElementImpl.h" + +#include "KSVGReader.h" +#include "KSVGLoader.h" +#include "KSVGCanvas.h" +#include "CanvasItem.h" + +#include + +using namespace KSVG; + +#include "SVGDocumentImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +// A sequence of prime numbers that sets the m_elemDict's hash table size as the +// number of elements in the dictionary passes each level. This keeps the lookup +// performance high as the number of elements grows. See the TQDict documentation. +unsigned int SVGDocumentImpl::elemDictHashSizes [] = +{ + 101, + 211, + 401, + 809, + 1601, + 3203, + 6421, + 12809, + 25601, + 51203, + 102407, + 204803, + 409609, + 819229 +}; + +const int SVGDocumentImpl::numElemDictHashSizes = sizeof(elemDictHashSizes) / sizeof(elemDictHashSizes[0]); + +SVGDocumentImpl::SVGDocumentImpl(bool anim, bool fit, SVGImageElementImpl *parentImage) : TQObject(), DOM::DomShared(), DOM::Document(), SVGDOMNodeBridge(static_cast(*this)) +{ + m_animations = anim; + + m_reader = 0; + m_loader = 0; + m_canvas = 0; + m_rootElement = 0; + m_lastTarget = 0; + m_window = 0; + + m_elemDictHashSizeIndex = 0; + m_elemDict.resize(elemDictHashSizes[m_elemDictHashSizeIndex]); + + m_timeScheduler = new SVGTimeScheduler(this); + m_ecmaEngine = new KSVGEcma(this); + m_ecmaEngine->setup(); + + m_finishedParsing = false; + m_finishedLoading = false; + m_resortZIndicesOnFinishedLoading = false; + m_fit = fit; + + m_parentImage = parentImage; + if(m_parentImage) + m_parentImage->ref(); +} + +SVGDocumentImpl::~SVGDocumentImpl() +{ + if(rootElement() && rootElement()->hasEventListener(SVGEvent::UNLOAD_EVENT, true)) + rootElement()->dispatchEvent(SVGEvent::UNLOAD_EVENT, false, false); + + TQPtrList killList; + + DOM::Node node = firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGShapeImpl *shape = dynamic_cast(getElementFromHandle(node.handle())); + if(shape) + killList.append(shape); + } + + SVGShapeImpl *rend = 0; + for(rend = killList.first(); rend; rend = killList.next()) + delete rend; + + delete m_timeScheduler; + delete m_ecmaEngine; + delete m_reader; + delete m_loader; + + if(m_window) + m_window->deref(); + + if(m_parentImage) + m_parentImage->deref(); +} + +SVGWindowImpl *SVGDocumentImpl::window() +{ + if(!m_window) + { + m_window = new SVGWindowImpl(const_cast(this)); + m_window->ref(); + } + + return m_window; +} + +float SVGDocumentImpl::screenPixelsPerMillimeterX() const +{ + if(canvas() && canvas()->drawWindow()) + { + TQPaintDeviceMetrics metrics(canvas()->drawWindow()); + return float(metrics.width()) / float(metrics.widthMM()); + } + else + return 90.0; +} + +float SVGDocumentImpl::screenPixelsPerMillimeterY() const +{ + if(canvas() && canvas()->drawWindow()) + { + TQPaintDeviceMetrics metrics(canvas()->drawWindow()); + return float(metrics.height()) / float(metrics.heightMM()); + } + else + return 90.0; +} + +DOM::DOMString SVGDocumentImpl::title() const +{ + DOM::Node n; + for(n = rootElement()->firstChild(); !n.isNull(); n = n.nextSibling()) + { + SVGElementImpl *elem = getElementFromHandle(n.handle()); + if(dynamic_cast(elem)) + return elem->collectText(); + } + return ""; +} + +DOM::DOMString SVGDocumentImpl::referrer() const +{ + return m_referrer; +} + +DOM::DOMString SVGDocumentImpl::domain() const +{ + return m_baseURL.host(); +} + +DOM::DOMString SVGDocumentImpl::URL() const +{ + return m_baseURL.prettyURL(); +} + +void SVGDocumentImpl::setReferrer(const DOM::DOMString &referrer) +{ + // TODO : better may be to request for referrer instead of storing it + m_referrer = referrer; +} + +void SVGDocumentImpl::setRootElement(SVGSVGElementImpl *elem) +{ + m_rootElement = elem; +} + +SVGSVGElementImpl *SVGDocumentImpl::rootElement() const +{ + return m_rootElement; +} + +SVGElementImpl *SVGDocumentImpl::createElement(const DOM::DOMString &name, DOM::Element impl, SVGDocumentImpl *doc) +{ + DOM::ElementImpl *handle = reinterpret_cast(impl.handle()); + SVGElementImpl *element = SVGElementImpl::Factory::self()->create(std::string(name.string().latin1()), handle); + + if(!element) + element = new SVGElementImpl(handle); + + element->setOwnerDoc(doc); + element->ref(); + return element; +} + +bool SVGDocumentImpl::open(const ::KURL &url) +{ + if(!url.prettyURL().isEmpty()) + { + m_baseURL = url; + + if(!m_loader) + m_loader = new KSVGLoader(); + + connect(m_loader, TQT_SIGNAL(gotResult(TQIODevice *)), this, TQT_SLOT(slotSVGContent(TQIODevice *))); + m_loader->getSVGContent(url); + } + else + return false; + + return true; +} + +void SVGDocumentImpl::slotSVGContent(TQIODevice *dev) +{ + TQXmlInputSource *inputSource = new TQXmlInputSource(dev); + + if(m_reader) + delete m_reader; + + KSVGReader::ParsingArgs args; + args.fit = m_fit; + args.getURLMode = false; + + TQString url = m_baseURL.prettyURL(); + int pos = url.find('#'); // url can become like this.svg#svgView(viewBox(63,226,74,74)), get part after '#' + if(pos > -1) + args.SVGFragmentId = url.mid(pos + 1); + + m_reader = new KSVGReader(this, m_canvas, args); + connect(m_reader, TQT_SIGNAL(finished(bool, const TQString &)), this, TQT_SLOT(slotFinishedParsing(bool, const TQString &))); + m_t.start(); + +#if USE_VALGRIND + CALLTREE_ZERO_STATS(); +#endif + + m_reader->parse(inputSource); + delete dev; +} + +void SVGDocumentImpl::parseSVG(TQXmlInputSource *inputSource, bool getURLMode) +{ + if(m_reader) + delete m_reader; + + KSVGReader::ParsingArgs args; + args.fit = m_fit; + args.getURLMode = getURLMode; + m_reader = new KSVGReader(this, 0, args); + connect(m_reader, TQT_SIGNAL(finished(bool, const TQString &)), this, TQT_SLOT(slotFinishedParsing(bool, const TQString &))); + +#if USE_VALGRIND + CALLTREE_ZERO_STATS(); +#endif + + m_reader->parse(inputSource); +} + +void SVGDocumentImpl::finishParsing(bool error, const TQString &errorDesc) +{ + if(m_reader) + m_reader->finishParsing(error, errorDesc); +} + +void SVGDocumentImpl::slotFinishedParsing(bool error, const TQString &errorDesc) +{ + kdDebug(26000) << k_funcinfo << "total time : " << m_t.elapsed() << endl; + +#if USE_VALGRIND + CALLTREE_DUMP_STATS(); +#endif + + if(m_animations) + m_timeScheduler->startAnimations(); + + if(m_canvas && !error && rootElement()) + executeScripts(); + + m_finishedParsing = true; + + emit finishedParsing(error, errorDesc); + if(!error) + emit finishedRendering(); + + checkFinishedLoading(); +} + +void SVGDocumentImpl::newImageJob(SVGImageElementImpl *image) +{ + kdDebug(26002) << "SVGDocumentImpl::newImageJob, " << image << endl; + m_loader->newImageJob(image, m_baseURL); +} + +void SVGDocumentImpl::notifyImageLoading(SVGImageElementImpl *image) +{ + m_imagesLoading.append(image); +} + +void SVGDocumentImpl::notifyImageLoaded(SVGImageElementImpl *image) +{ + m_imagesLoading.remove(image); + + if(m_imagesLoading.isEmpty()) + checkFinishedLoading(); +} + +void SVGDocumentImpl::checkFinishedLoading() +{ + if(m_finishedParsing && m_imagesLoading.isEmpty()) + { + m_finishedLoading = true; + + if(m_resortZIndicesOnFinishedLoading) + { + // Only resort if we're the 'outermost' document, i.e. we're not an svg image + // inside another document. We could resort as each image finishes loading, but it + // slows down the parsing phase. + if(m_parentImage == 0 && m_canvas && m_rootElement) + { + m_canvas->setElementItemZIndexRecursive(m_rootElement, 0); + m_canvas->update(); + } + } + + emit finishedLoading(); + } +} + +void SVGDocumentImpl::addForwardReferencingUseElement(SVGUseElementImpl *use) +{ + if(!m_forwardReferencingUseElements.contains(use)) + m_forwardReferencingUseElements.append(use); +} + +void SVGDocumentImpl::slotPaint() +{ + rerender(); +} + +void SVGDocumentImpl::rerender() +{ + m_canvas->update(); + emit finishedRendering(); +} + +void SVGDocumentImpl::attach(KSVG::KSVGCanvas *c) +{ + m_canvas = c; +} + +void SVGDocumentImpl::detach() +{ + m_canvas = 0; +} + +KSVG::KSVGCanvas *SVGDocumentImpl::canvas() const +{ + return m_canvas; +} + +void SVGDocumentImpl::syncCachedMatrices() +{ + if(rootElement()) + { + SVGMatrixImpl *parentMatrix = SVGSVGElementImpl::createSVGMatrix(); + rootElement()->checkCachedScreenCTM(parentMatrix); + parentMatrix->deref(); + } +} + +void SVGDocumentImpl::executeScriptsRecursive(DOM::Node start) +{ + DOM::Node node = start.firstChild(); + + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = getElementFromHandle(node.handle()); + + SVGContainerImpl *container = dynamic_cast(element); + if(container) + executeScriptsRecursive(node); + + SVGScriptElementImpl *script = dynamic_cast(element); + + if(script) + script->executeScript(DOM::Node()); + } +} + +bool SVGDocumentImpl::executeScriptsRecursiveCheck(DOM::Node start) +{ + bool test = true; + + DOM::Node node = start.firstChild(); + + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = getElementFromHandle(node.handle()); + + SVGContainerImpl *container = dynamic_cast(element); + if(container) + { + if(!executeScriptsRecursiveCheck(node)) + return false; + } + + SVGScriptElementImpl *script = dynamic_cast(element); + + if(script) + { + if(!script->canExecuteScript()) + { + test = false; + break; + } + } + } + + return test; +} + +void SVGDocumentImpl::executeScripts() +{ + bool test = executeScriptsRecursiveCheck(*rootElement()); + + if(!test) + TQTimer::singleShot(50, this, TQT_SLOT(executeScripts())); + else + { + executeScriptsRecursive(*rootElement()); + + // mop: only rerender if an loadevent has been found + if(dispatchRecursiveEvent(SVGEvent::LOAD_EVENT, lastChild())) + m_canvas->update(); + } +} + +// Dispatches a non-cancelable, non-bubbles event to every child +bool SVGDocumentImpl::dispatchRecursiveEvent(SVGEvent::EventId id, DOM::Node start) +{ + bool eventExecuted = false; + + // Iterate the tree, backwards, and dispatch the event to every child + DOM::Node node = start; + for(; !node.isNull(); node = node.previousSibling()) + { + SVGElementImpl *element = getElementFromHandle(node.handle()); + + if(element && element->hasChildNodes()) + { + // Dispatch to all children + eventExecuted = dispatchRecursiveEvent(id, element->lastChild()) ? true : eventExecuted; + + // Dispatch, locally + if(element->hasEventListener(id, true)) + { + element->dispatchEvent(id, false, false); + eventExecuted = true; + } + } + else if(element && element->hasEventListener(id, true)) + { + element->dispatchEvent(id, false, false); + eventExecuted = true; + } + } + + return eventExecuted; +} + +SVGEventListener *SVGDocumentImpl::createEventListener(DOM::DOMString type) +{ + return m_ecmaEngine->createEventListener(type); +} + +SVGElementImpl *SVGDocumentImpl::recursiveSearch(DOM::Node start, const DOM::DOMString &id) +{ + DOM::Node node = start.firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *test = getElementFromHandle(node.handle()); + + // Look in containers + SVGContainerImpl *container = dynamic_cast(test); + if(container) + { + SVGElementImpl *found = recursiveSearch(node, id); + if(found) + return found; + } + + // Look in SVGSVGElementImpl's + SVGSVGElementImpl *svgtest = dynamic_cast(test); + if(svgtest) + { + SVGElementImpl *element = svgtest->getElementById(id); + if(element) + return element; + } + } + + return 0; +} + +/* +@namespace KSVG +@begin SVGDocumentImpl::s_hashTable 9 + title SVGDocumentImpl::Title DontDelete|ReadOnly + referrer SVGDocumentImpl::Referrer DontDelete|ReadOnly + domain SVGDocumentImpl::Domain DontDelete|ReadOnly + URL SVGDocumentImpl::Url DontDelete|ReadOnly + doctype SVGDocumentImpl::DocType DontDelete|ReadOnly + implementation SVGDocumentImpl::Implementation DontDelete|ReadOnly + rootElement SVGDocumentImpl::RootElement DontDelete|ReadOnly + documentElement SVGDocumentImpl::DocumentElement DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGDocumentImplProto::s_hashTable 7 + createTextNode SVGDocumentImpl::CreateTextNode DontDelete|Function 1 + createElement SVGDocumentImpl::CreateElement DontDelete|Function 1 + createElementNS SVGDocumentImpl::CreateElementNS DontDelete|Function 2 + getElementById SVGDocumentImpl::GetElementById DontDelete|Function 1 + getElementsByTagName SVGDocumentImpl::GetElementsByTagName DontDelete|Function 1 + getElementsByTagNameNS SVGDocumentImpl::GetElementsByTagNameNS DontDelete|Function 2 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGDocument", SVGDocumentImplProto, SVGDocumentImplProtoFunc) + +Value SVGDocumentImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case Title: + return String(title().string()); + case Referrer: + return String(referrer().string()); + case Domain: + return String(domain().string()); + case Url: + return String(URL().string()); + case DocType: + return getDOMNode(exec, doctype()); + case Implementation: + return (new SVGDOMDOMImplementationBridge(implementation()))->cache(exec); + case RootElement: + case DocumentElement: + return m_rootElement->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGDocumentImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGDocumentImpl) + + switch(id) + { + case SVGDocumentImpl::CreateTextNode: + return getDOMNode(exec, obj->createTextNode(args[0].toString(exec).string())); + case SVGDocumentImpl::CreateElement: + case SVGDocumentImpl::CreateElementNS: + { + SVGElementImpl *newElement = 0; + + if(id == SVGDocumentImpl::CreateElement) + newElement = obj->createElement(args[0].toString(exec).qstring(), static_cast(obj)->createElement(args[0].toString(exec).string()), obj); + else if(id == SVGDocumentImpl::CreateElementNS) + newElement = obj->createElement(args[1].toString(exec).qstring(), static_cast(obj)->createElementNS(args[0].toString(exec).string(), args[1].toString(exec).string()), obj); + + newElement->setOwnerSVGElement(obj->rootElement()); // FIXME: Correct in all situations? + newElement->setViewportElement(obj->rootElement()); + newElement->setAttributes(); + + return getDOMNode(exec, *newElement); + } + case SVGDocumentImpl::GetElementById: + { + Value ret; + + SVGElementImpl *element = obj->rootElement()->getElementById(args[0].toString(exec).string()); + + if(element) + ret = getDOMNode(exec, *element); + else + { + element = obj->recursiveSearch(*obj, args[0].toString(exec).string()); + if(!element) + return Null(); + + ret = getDOMNode(exec, *element); + } + + return ret; + } + case SVGDocumentImpl::GetElementsByTagName: + return (new SVGDOMNodeListBridge(obj->getElementsByTagName(args[0].toString(exec).string())))->cache(exec); + case SVGDocumentImpl::GetElementsByTagNameNS: + return (new SVGDOMNodeListBridge(obj->getElementsByTagNameNS(args[0].toString(exec).string(), args[1].toString(exec).string())))->cache(exec); + default: + break; + } + + return KJS::Undefined(); +} + +SVGElementImpl *SVGDocumentImpl::getElementFromHandle(DOM::NodeImpl *handle) const +{ + return m_elemDict[handle]; +} + +void SVGDocumentImpl::addToElemDict(DOM::NodeImpl *handle, SVGElementImpl *obj) +{ + m_elemDict.insert(handle, obj); + + if(m_elemDict.count()>m_elemDict.size() && m_elemDictHashSizeIndexgetElementById(elementId); + + if(element) + return element; + } + + // #2 Search in all child SVGSVGElementImpl's + element = recursiveSearch(*this, elementId); + + if(element) + return element; + + // #3 Search in other documents + if(!dontSearch) + { + TQPtrDictIterator it(m_documentDict); + for(; it.current(); ++it) + { + SVGElementImpl *temp = it.current()->getElementByIdRecursive(0, elementId, true); + if(temp) + return temp; + } + } + + return element; +} diff --git a/ksvg/impl/SVGEcma.cc b/ksvg/impl/SVGEcma.cc deleted file mode 100644 index 5036f591..00000000 --- a/ksvg/impl/SVGEcma.cc +++ /dev/null @@ -1,842 +0,0 @@ -/* - Copyright (C) 2002-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -#include "SVGEcma.h" -#include "SVGShapeImpl.h" -#include "SVGHelperImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" - -using namespace KSVG; - -#include "SVGEcma.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_ecmaeventlistener.h" -#include "ksvg_window.h" -#include "ksvg_ecma.h" - -// SVGDOMNodeBridge - -/* -@namespace KSVG -@begin SVGDOMNodeBridge::s_hashTable 17 - nodeName SVGDOMNodeBridge::NodeName DontDelete|ReadOnly - nodeValue SVGDOMNodeBridge::NodeValue DontDelete - nodeType SVGDOMNodeBridge::NodeType DontDelete|ReadOnly - parentNode SVGDOMNodeBridge::ParentNode DontDelete|ReadOnly - childNodes SVGDOMNodeBridge::ChildNodes DontDelete|ReadOnly - firstChild SVGDOMNodeBridge::FirstChild DontDelete|ReadOnly - lastChild SVGDOMNodeBridge::LastChild DontDelete|ReadOnly - previousSibling SVGDOMNodeBridge::PreviousSibling DontDelete|ReadOnly - nextSibling SVGDOMNodeBridge::NextSibling DontDelete|ReadOnly - attributes SVGDOMNodeBridge::Attributes DontDelete|ReadOnly - namespaceURI SVGDOMNodeBridge::NamespaceURI DontDelete|ReadOnly - prefix SVGDOMNodeBridge::Prefix DontDelete - localName SVGDOMNodeBridge::LocalName DontDelete|ReadOnly - ownerDocument SVGDOMNodeBridge::OwnerDocument DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGDOMNodeBridgeProto::s_hashTable 29 - insertBefore SVGDOMNodeBridge::InsertBefore DontDelete|Function 2 - replaceChild SVGDOMNodeBridge::ReplaceChild DontDelete|Function 2 - removeChild SVGDOMNodeBridge::RemoveChild DontDelete|Function 1 - appendChild SVGDOMNodeBridge::AppendChild DontDelete|Function 1 - hasAttributes SVGDOMNodeBridge::HasAttributes DontDelete|Function 0 - hasChildNodes SVGDOMNodeBridge::HasChildNodes DontDelete|Function 0 - cloneNode SVGDOMNodeBridge::CloneNode DontDelete|Function 1 - normalize SVGDOMNodeBridge::Normalize DontDelete|Function 0 - isSupported SVGDOMNodeBridge::IsSupported DontDelete|Function 2 - addEventListener SVGDOMNodeBridge::AddEventListener DontDelete|Function 3 - removeEventListener SVGDOMNodeBridge::RemoveEventListener DontDelete|Function 3 - contains SVGDOMNodeBridge::Contains DontDelete|Function 1 - getNodeName SVGDOMNodeBridge::GetNodeName DontDelete|Function 0 - getNodeValue SVGDOMNodeBridge::GetNodeValue DontDelete|Function 0 - getNodeType SVGDOMNodeBridge::GetNodeType DontDelete|Function 0 - getParentNode SVGDOMNodeBridge::GetParentNode DontDelete|Function 0 - getChildNodes SVGDOMNodeBridge::GetChildNodes DontDelete|Function 0 - getFirstChild SVGDOMNodeBridge::GetFirstChild DontDelete|Function 0 - getLastChild SVGDOMNodeBridge::GetLastChild DontDelete|Function 0 - getPreviousSibling SVGDOMNodeBridge::GetPreviousSibling DontDelete|Function 0 - getNextSibling SVGDOMNodeBridge::GetNextSibling DontDelete|Function 0 - getAttributes SVGDOMNodeBridge::GetAttributes DontDelete|Function 0 - getNamespaceURI SVGDOMNodeBridge::GetNamespaceURI DontDelete|Function 0 - getPrefix SVGDOMNodeBridge::GetPrefix DontDelete|Function 0 - getLocalName SVGDOMNodeBridge::GetLocalName DontDelete|Function 0 - getOwnerDocument SVGDOMNodeBridge::GetOwnerDocument DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("DOMNode", SVGDOMNodeBridgeProto, SVGDOMNodeBridgeProtoFunc) - -Value SVGDOMNodeBridge::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case NodeName: - return getString(m_impl.nodeName()); - case NodeValue: - return getString(m_impl.nodeValue()); - case NodeType: - return Number(m_impl.nodeType()); - case ParentNode: - return getDOMNode(exec, m_impl.parentNode()); - case ChildNodes: - return (new SVGDOMNodeListBridge(m_impl.childNodes()))->cache(exec); - case FirstChild: - return getDOMNode(exec, m_impl.firstChild()); - case LastChild: - return getDOMNode(exec, m_impl.lastChild()); - case PreviousSibling: - return getDOMNode(exec, m_impl.previousSibling()); - case NextSibling: - return getDOMNode(exec, m_impl.nextSibling()); -// case Attributes: // TODO - case NamespaceURI: - return getString(m_impl.namespaceURI()); - case Prefix: - return getString(m_impl.prefix()); - case LocalName: - return getString(m_impl.localName()); - case OwnerDocument: - return getDOMNode(exec, m_impl.ownerDocument()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGDOMNodeBridge::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case NodeValue: - m_impl.setNodeValue(value.toString(exec).string()); - break; - case Prefix: - m_impl.setPrefix(value.toString(exec).string()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -// Special variantion to update the element, -// triggered by one of the child nodes -void updateTextItem(ExecState *exec, const DOM::Node node) -{ - DOM::Node parent; - while(!(parent = node.parentNode()).isNull()) - { - DOM::DOMString name = parent.nodeName(); - if(name == "text" || name == "tspan" || name == "tref") - { - SVGHelperImpl::updateItem(exec, parent); - break; - } - } -} - -// Remove item from canvas -void removeItem(ExecState *exec, DOM::Node &node) -{ - // Get document - SVGDocumentImpl *doc = KSVG::Window::retrieveActive(exec)->doc(); - - // Update canvas - SVGShapeImpl *shape = dynamic_cast(doc->getElementFromHandle(node.handle())); - if(shape && shape->item()) - doc->canvas()->removeItem(shape->item()); -} - -// parseXML + getURL() need all these 5 functions to work properly -void correctHandles(SVGElementImpl *main, DOM::Node &node) -{ - DOM::Element old(node.handle()); - DOM::Element *replace = static_cast(main->ownerDoc()->getElementFromHandle(node.handle())); - - if(replace && node.nodeType() == DOM::Node::ELEMENT_NODE) - *replace = old; - - if(node.hasChildNodes()) - { - for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) - correctHandles(main, iterate); - } -} - -void integrateTree(SVGElementImpl *main, DOM::Node &node, DOM::Node &newNode, SVGElementImpl *obj, SVGDocumentImpl *doc) -{ - if(!obj) - return; - - // Add to global element dicts - doc->addToElemDict(newNode.handle(), obj); - doc->addToElemDict(node.handle(), obj); - - if(node.hasChildNodes()) - { - DOM::Node iterate2 = newNode.firstChild(); - for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) - { - integrateTree(main, iterate, iterate2, obj->ownerDoc()->getElementFromHandle(iterate2.handle()), doc); - iterate2 = iterate2.nextSibling(); - } - } -} - -void correctDocument(SVGElementImpl *main, DOM::Node &node, SVGElementImpl *obj, SVGDocumentImpl *doc) -{ - if(!obj) - return; - - // Correct document - obj->setOwnerDoc(main->ownerDoc()); - - // Correct rootElement - if(!obj->ownerSVGElement()) - obj->setOwnerSVGElement(main->ownerSVGElement()); - - // Correct viewportElement - if(!obj->viewportElement()) - obj->setViewportElement(main->viewportElement()); - - // Properly (re-)register events in the current active document - obj->setupEventListeners(main->ownerDoc(), doc); - - if(node.hasChildNodes()) - { - for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) - correctDocument(main, iterate, doc->getElementFromHandle(iterate.handle()), doc); - } -} - -void registerAdditional(ExecState *exec, SVGDocumentImpl *doc, DOM::Node node) -{ - // Register ID in rootElement! - SVGElementImpl *resultElement = doc->getElementFromHandle(node.handle()); - if(resultElement && resultElement->hasAttribute("id")) - doc->rootElement()->addToIdMap(resultElement->getAttribute("id").string(), resultElement); - - if(node.hasChildNodes()) - { - for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) - registerAdditional(exec, doc, iterate); - } -} - -Value appendHelper(ExecState *exec, DOM::Node node, DOM::Node newNode) -{ - // This is quite tricky code by me (Niko) - // Don't even try to modify it. - if(!(node.ownerDocument() == newNode.ownerDocument())) - { - // Get document - SVGDocumentImpl *doc = KSVG::Window::retrieveActive(exec)->doc(); - - // Detect ownerDoc() of newNode - SVGDocumentImpl *newDoc = doc->getDocumentFromHandle(newNode.ownerDocument().handle()); - - // Get some SVGElementImpl's - SVGElementImpl *nodeElement = doc->getElementFromHandle(node.handle()); - SVGElementImpl *newNodeElement = newDoc->getElementFromHandle(newNode.handle()); - - // Import node into document - DOM::Node result = doc->importNode(newNode, true); - - // Associate the imported node 'result' with the - // 'newNodeElement' which belongs to 'newDoc' - integrateTree(nodeElement, result, newNode, newNodeElement, doc); - - // Correct handles in SVG* elements - correctHandles(nodeElement, result); - - // Correct ownerDoc() etc.. - correctDocument(nodeElement, newNode, newNodeElement, newDoc); - - // Register ID in global map - registerAdditional(exec, doc, result); - - // Recalc style - newNodeElement->setAttributes(); - - // Append + create + update element - Value retVal = getDOMNode(exec, node.appendChild(result)); - - doc->syncCachedMatrices(); - newNodeElement->createItem(doc->canvas()); - SVGHelperImpl::updateItem(exec, *newNodeElement); - - return retVal; - } - else - { - Value retVal = getDOMNode(exec, node.appendChild(newNode)); - - // Get document - SVGDocumentImpl *doc = KSVG::Window::retrieveActive(exec)->doc(); - doc->syncCachedMatrices(); - - // Get some SVGElementImpl's - SVGElementImpl *nodeElement = doc->getElementFromHandle(newNode.handle()); - // TODO : extra check needed to see if the new elements parent is already appended - // in the doc. Not really nice, should be some other way? (Rob) - if(nodeElement && !nodeElement->parentNode().parentNode().isNull()) - { - nodeElement->setAttributes(true); - nodeElement->createItem(); - SVGHelperImpl::updateItem(exec, newNode); - } - - return retVal; - } -} - -Value SVGDOMNodeBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGDOMNodeBridge) - DOM::Node node = obj->impl(); - - switch(id) - { - case SVGDOMNodeBridge::InsertBefore: - { - DOM::Node newChild = toNode(args[0]); - DOM::Node beforeChild = toNode(args[1]); - Value retVal = getDOMNode(exec, node.insertBefore(newChild, beforeChild)); - - // Get document - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - - // Get some SVGElementImpl's - SVGShapeImpl *newShape = dynamic_cast(doc->getElementFromHandle(newChild.handle())); - SVGElementImpl *newElement = doc->getElementFromHandle(newChild.handle()); - SVGShapeImpl *beforeElement = dynamic_cast(doc->getElementFromHandle(beforeChild.handle())); - if(newShape && beforeElement && beforeElement->item()) - { - int z = beforeElement->item()->zIndex(); - newElement->createItem(); - doc->canvas()->insert(newShape->item(), z); - } - SVGHelperImpl::updateItem(exec, newChild); - - return retVal; - } - case SVGDOMNodeBridge::ReplaceChild: - { - DOM::Node newChild = toNode(args[0]); - Value retVal = getDOMNode(exec, node.replaceChild(newChild, toNode(args[1]))); - SVGHelperImpl::updateItem(exec, newChild); - return retVal; - } - case SVGDOMNodeBridge::RemoveChild: - { - DOM::Node remove = toNode(args[0]); - if(remove.isNull()) - return Undefined(); - - // New removeChild logic: - // - remove from DOM tree - // - delete element (also deletes it's child element's) - removeItem(exec, remove); - Value retVal = getDOMNode(exec, node.removeChild(remove)); - return retVal; - } - case SVGDOMNodeBridge::AppendChild: - return appendHelper(exec, node, toNode(args[0])); - case SVGDOMNodeBridge::HasAttributes: - { - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(node.handle()); - - if(!element) - return Undefined(); - - return Boolean(element->hasAttributes()); - } - case SVGDOMNodeBridge::HasChildNodes: - return Boolean(node.hasChildNodes()); - case SVGDOMNodeBridge::CloneNode: - { - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(node.handle()); - SVGElementImpl *newElement = element->cloneNode(args[0].toBoolean(exec)); - - return getDOMNode(exec, *newElement); - } - case SVGDOMNodeBridge::Normalize: - { - node.normalize(); - return Undefined(); - } - case SVGDOMNodeBridge::IsSupported: - return Boolean(node.isSupported(args[0].toString(exec).string(), args[1].toString(exec).string())); - case SVGDOMNodeBridge::AddEventListener: - { - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(node.handle()); - - if(element) - { - SVGEvent::EventId eventId = SVGEvent::typeToId(args[0].toString(exec).string()); - if(eventId != SVGEvent::UNKNOWN_EVENT) - element->setEventListener(eventId, new KSVGEcmaEventListener(Object::dynamicCast(args[1]), TQString(), doc->ecmaEngine())); - } - return Undefined(); - } - case SVGDOMNodeBridge::RemoveEventListener: - { - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(node.handle()); - - if(element) - { - SVGEvent::EventId eventId = SVGEvent::typeToId(args[0].toString(exec).string()); - if(eventId != SVGEvent::UNKNOWN_EVENT) - element->removeEventListener((int) eventId); - } - return Undefined(); - } -// case SVGDOMNodeBridge::Contains: // TODO - case SVGDOMNodeBridge::GetNodeName: - return getString(node.nodeName()); - case SVGDOMNodeBridge::GetNodeValue: - return getString(node.nodeValue()); - case SVGDOMNodeBridge::GetNodeType: - return Number(node.nodeType()); - case SVGDOMNodeBridge::GetParentNode: - return getDOMNode(exec, node.parentNode()); - case SVGDOMNodeBridge::GetChildNodes: - return (new SVGDOMNodeListBridge(node.childNodes()))->cache(exec); - case SVGDOMNodeBridge::GetFirstChild: - return getDOMNode(exec, node.firstChild()); - case SVGDOMNodeBridge::GetLastChild: - return getDOMNode(exec, node.lastChild()); - case SVGDOMNodeBridge::GetPreviousSibling: - return getDOMNode(exec, node.previousSibling()); - case SVGDOMNodeBridge::GetNextSibling: - return getDOMNode(exec, node.nextSibling()); -// case SVGDOMNodeBridge::GetAttributes: // TODO - case SVGDOMNodeBridge::GetNamespaceURI: - return getString(node.namespaceURI()); - case SVGDOMNodeBridge::GetPrefix: - return getString(node.prefix()); - case SVGDOMNodeBridge::GetLocalName: - return getString(node.localName()); - case SVGDOMNodeBridge::GetOwnerDocument: - return getDOMNode(exec, node.ownerDocument()); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -// SVGDOMElementBridge - -/* -@namespace KSVG -@begin SVGDOMElementBridge::s_hashTable 2 - tagName SVGDOMElementBridge::TagName DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGDOMElementBridgeProto::s_hashTable 17 - getAttribute SVGDOMElementBridge::GetAttribute DontDelete|Function 1 - setAttribute SVGDOMElementBridge::SetAttribute DontDelete|Function 2 - removeAttribute SVGDOMElementBridge::RemoveAttribute DontDelete|Function 1 - getAttributeNode SVGDOMElementBridge::GetAttributeNode DontDelete|Function 1 - setAttributeNode SVGDOMElementBridge::SetAttributeNode DontDelete|Function 2 - removeAttributeNode SVGDOMElementBridge::RemoveAttributeNode DontDelete|Function 1 - getElementsByTagName SVGDOMElementBridge::GetElementsByTagName DontDelete|Function 1 - hasAttribute SVGDOMElementBridge::HasAttribute DontDelete|Function 1 - getAttributeNS SVGDOMElementBridge::GetAttributeNS DontDelete|Function 2 - setAttributeNS SVGDOMElementBridge::SetAttributeNS DontDelete|Function 3 - removeAttributeNS SVGDOMElementBridge::RemoveAttributeNS DontDelete|Function 2 - getAttributeNodeNS SVGDOMElementBridge::GetAttributeNodeNS DontDelete|Function 2 - setAttributeNodeNS SVGDOMElementBridge::SetAttributeNodeNS DontDelete|Function 1 - getElementByTagNameNS SVGDOMElementBridge::GetElementsByTagNameNS DontDelete|Function 2 - hasAttributeNS SVGDOMElementBridge::HasAttributeNS DontDelete|Function 2 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("DOMElement", SVGDOMElementBridgeProto, SVGDOMElementBridgeProtoFunc) - -Value SVGDOMElementBridge::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case TagName: - return getString(m_impl.tagName()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGDOMElementBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGDOMElementBridge) - DOM::Element elem = obj->impl(); - - switch(id) - { - case SVGDOMElementBridge::GetAttribute: - { - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); - if(element) - return String(element->getAttribute(args[0].toString(exec).string())); - else - return Undefined(); - } - case SVGDOMElementBridge::SetAttribute: - { - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); - if(element) - { - element->setAttribute(args[0].toString(exec).string(), args[1].toString(exec).string()); - element->setAttributeInternal(args[0].toString(exec).string(), args[1].toString(exec).string()); - - SVGHelperImpl::updateItem(exec, elem); - } - - return Undefined(); - } - case SVGDOMElementBridge::RemoveAttribute: - { - elem.removeAttribute(args[0].toString(exec).string()); - return Undefined(); - } - case SVGDOMElementBridge::GetAttributeNode: - return getDOMNode(exec, elem.getAttributeNode(args[0].toString(exec).string())); - case SVGDOMElementBridge::SetAttributeNode: // TODO: Correct? - return getDOMNode(exec, elem.setAttributeNode(toNode(args[0]))); - case SVGDOMElementBridge::RemoveAttributeNode: // TODO: Correct? - return getDOMNode(exec, elem.removeAttributeNode(toNode(args[0]))); - case SVGDOMElementBridge::GetElementsByTagName: - return (new SVGDOMNodeListBridge(elem.getElementsByTagName(args[0].toString(exec).string())))->cache(exec); - case SVGDOMElementBridge::GetAttributeNS: - { - // This just skips NS! (Rob) - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); - if(element) - return String(element->getAttribute(args[1].toString(exec).string())); - else - return Undefined(); - } - case SVGDOMElementBridge::SetAttributeNS: - { - // For now, we strip the NS part (Rob) - DOM::DOMString attr = args[1].toString(exec).string(); - int pos = attr.string().find(':'); - if(pos > -1) - attr = attr.string().mid(pos + 1); - - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); - if(element) - { - element->setAttribute(attr.string(), args[2].toString(exec).string()); - element->setAttributeInternal(attr.string(), args[2].toString(exec).string()); - - SVGHelperImpl::updateItem(exec, *element); - } - - return Undefined(); - } - case SVGDOMElementBridge::RemoveAttributeNS: - { - elem.removeAttributeNS(args[0].toString(exec).string(), args[1].toString(exec).string()); - return Undefined(); - } - case SVGDOMElementBridge::GetAttributeNodeNS: - return getDOMNode(exec, elem.getAttributeNodeNS(args[0].toString(exec).string(), args[1].toString(exec).string())); - case SVGDOMElementBridge::SetAttributeNodeNS: // TODO: Correct? - return getDOMNode(exec, elem.setAttributeNodeNS(toNode(args[0]))); - case SVGDOMElementBridge::GetElementsByTagNameNS: - return (new SVGDOMNodeListBridge(elem.getElementsByTagNameNS(args[0].toString(exec).string(), args[1].toString(exec).string())))->cache(exec); - case SVGDOMElementBridge::HasAttribute: - return Boolean(elem.hasAttribute(args[0].toString(exec).string())); - case SVGDOMElementBridge::HasAttributeNS: - return Boolean(elem.hasAttributeNS(args[0].toString(exec).string(), args[1].toString(exec).string())); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - - -// SVGDOMNodeListBridge - -/* -@namespace KSVG -@begin SVGDOMNodeListBridge::s_hashTable 2 - length SVGDOMNodeListBridge::Length DontDelete -@end -@namespace KSVG -@begin SVGDOMNodeListBridgeProto::s_hashTable 3 - getLength SVGDOMNodeListBridge::GetLength DontDelete|Function 0 - item SVGDOMNodeListBridge::Item DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("DOMNodeList", SVGDOMNodeListBridgeProto, SVGDOMNodeListBridgeProtoFunc) - -Value SVGDOMNodeListBridge::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Length: - return Number(m_impl.length()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGDOMNodeListBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGDOMNodeListBridge) - DOM::NodeList nodeList = obj->impl(); - - switch(id) - { - case SVGDOMNodeListBridge::GetLength: - return Number(nodeList.length()); - case SVGDOMNodeListBridge::Item: - return getDOMNode(exec, nodeList.item((unsigned long)args[0].toNumber(exec))); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -// SVGDOMCharacterDataBridge - -/* -@namespace KSVG -@begin SVGDOMCharacterDataBridge::s_hashTable 3 - data SVGDOMCharacterDataBridge::Data DontDelete - length SVGDOMCharacterDataBridge::Length DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGDOMCharacterDataBridgeProto::s_hashTable 11 - getData SVGDOMCharacterDataBridge::GetData DontDelete|Function 0 - setData SVGDOMCharacterDataBridge::SetData DontDelete|Function 1 - getLength SVGDOMCharacterDataBridge::GetLength DontDelete|Function 0 - substringData SVGDOMCharacterDataBridge::SubstringData DontDelete|Function 2 - appendData SVGDOMCharacterDataBridge::AppendData DontDelete|Function 1 - insertData SVGDOMCharacterDataBridge::InsertData DontDelete|Function 2 - deleteData SVGDOMCharacterDataBridge::DeleteData DontDelete|Function 2 - replaceData SVGDOMCharacterDataBridge::ReplaceData DontDelete|Function 2 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("DOMCharacterData", SVGDOMCharacterDataBridgeProto, SVGDOMCharacterDataBridgeProtoFunc) - -Value SVGDOMCharacterDataBridge::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Data: - return String(m_impl.data()); - case Length: - return Number(m_impl.length()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGDOMCharacterDataBridge::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case Data: - m_impl.setData(value.toString(exec).string()); - updateTextItem(exec, m_impl); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGDOMCharacterDataBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGDOMCharacterDataBridge) - DOM::CharacterData node = obj->impl(); - - switch(id) - { - case SVGDOMCharacterDataBridge::GetData: - return String(node.data()); - case SVGDOMCharacterDataBridge::SetData: - node.setData(args[0].toString(exec).string()); - updateTextItem(exec, node); - return Undefined(); - case SVGDOMCharacterDataBridge::GetLength: - return Number(node.length()); - case SVGDOMCharacterDataBridge::SubstringData: - { - DOM::DOMString ret = node.substringData(args[0].toInteger(exec), args[1].toInteger(exec)); - updateTextItem(exec, node); - return String(ret); - } - case SVGDOMCharacterDataBridge::AppendData: - node.appendData(args[0].toString(exec).string()); - updateTextItem(exec, node); - return Undefined(); - case SVGDOMCharacterDataBridge::InsertData: - node.insertData(args[0].toInteger(exec), args[1].toString(exec).string()); - updateTextItem(exec, node); - return Undefined(); - case SVGDOMCharacterDataBridge::DeleteData: - node.deleteData(args[0].toInteger(exec), args[1].toInteger(exec)); - updateTextItem(exec, node); - return Undefined(); - case SVGDOMCharacterDataBridge::ReplaceData: - node.replaceData(args[0].toInteger(exec), args[1].toInteger(exec), args[2].toString(exec).string()); - updateTextItem(exec, node); - return Undefined(); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -// SVGDOMTextBridge - -/* -@namespace KSVG -@begin SVGDOMTextBridge::s_hashTable 2 - dummy SVGDOMTextBridge::Dummy DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGDOMTextBridgeProto::s_hashTable 2 - splitText SVGDOMTextBridge::SplitText DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("DOMText", SVGDOMTextBridgeProto, SVGDOMTextBridgeProtoFunc) - -Value SVGDOMTextBridge::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGDOMTextBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGDOMTextBridge) - DOM::Text node = obj->impl(); - - switch(id) - { - case SVGDOMTextBridge::SplitText: - return getDOMNode(exec, node.splitText(args[0].toInteger(exec))); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -// SVGDOMDOMImplementationBridge - -/* -@namespace KSVG -@begin SVGDOMDOMImplementationBridge::s_hashTable 2 - dummy SVGDOMDOMImplementationBridge::Dummy DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGDOMDOMImplementationBridgeProto::s_hashTable 2 - hasFeature SVGDOMDOMImplementationBridge::HasFeature DontDelete|Function 2 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("DOMDOMImplementation", SVGDOMDOMImplementationBridgeProto, SVGDOMDOMImplementationBridgeProtoFunc) - -Value SVGDOMDOMImplementationBridge::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGDOMDOMImplementationBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGDOMDOMImplementationBridge) - DOM::DOMImplementation node = obj->impl(); - - switch(id) - { - case SVGDOMDOMImplementationBridge::HasFeature: - return Boolean(node.hasFeature(args[0].toString(exec).string(), args[1].toString(exec).string())); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -// SVGDOMDocumentFragmentBridge - -/* -@namespace KSVG -@begin SVGDOMDocumentFragmentBridge::s_hashTable 2 - dummy SVGDOMDocumentFragmentBridge::Dummy DontDelete|ReadOnly -@end -*/ - -Value SVGDOMDocumentFragmentBridge::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGEcma.cpp b/ksvg/impl/SVGEcma.cpp new file mode 100644 index 00000000..5036f591 --- /dev/null +++ b/ksvg/impl/SVGEcma.cpp @@ -0,0 +1,842 @@ +/* + Copyright (C) 2002-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +#include "SVGEcma.h" +#include "SVGShapeImpl.h" +#include "SVGHelperImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" + +using namespace KSVG; + +#include "SVGEcma.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_ecmaeventlistener.h" +#include "ksvg_window.h" +#include "ksvg_ecma.h" + +// SVGDOMNodeBridge + +/* +@namespace KSVG +@begin SVGDOMNodeBridge::s_hashTable 17 + nodeName SVGDOMNodeBridge::NodeName DontDelete|ReadOnly + nodeValue SVGDOMNodeBridge::NodeValue DontDelete + nodeType SVGDOMNodeBridge::NodeType DontDelete|ReadOnly + parentNode SVGDOMNodeBridge::ParentNode DontDelete|ReadOnly + childNodes SVGDOMNodeBridge::ChildNodes DontDelete|ReadOnly + firstChild SVGDOMNodeBridge::FirstChild DontDelete|ReadOnly + lastChild SVGDOMNodeBridge::LastChild DontDelete|ReadOnly + previousSibling SVGDOMNodeBridge::PreviousSibling DontDelete|ReadOnly + nextSibling SVGDOMNodeBridge::NextSibling DontDelete|ReadOnly + attributes SVGDOMNodeBridge::Attributes DontDelete|ReadOnly + namespaceURI SVGDOMNodeBridge::NamespaceURI DontDelete|ReadOnly + prefix SVGDOMNodeBridge::Prefix DontDelete + localName SVGDOMNodeBridge::LocalName DontDelete|ReadOnly + ownerDocument SVGDOMNodeBridge::OwnerDocument DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGDOMNodeBridgeProto::s_hashTable 29 + insertBefore SVGDOMNodeBridge::InsertBefore DontDelete|Function 2 + replaceChild SVGDOMNodeBridge::ReplaceChild DontDelete|Function 2 + removeChild SVGDOMNodeBridge::RemoveChild DontDelete|Function 1 + appendChild SVGDOMNodeBridge::AppendChild DontDelete|Function 1 + hasAttributes SVGDOMNodeBridge::HasAttributes DontDelete|Function 0 + hasChildNodes SVGDOMNodeBridge::HasChildNodes DontDelete|Function 0 + cloneNode SVGDOMNodeBridge::CloneNode DontDelete|Function 1 + normalize SVGDOMNodeBridge::Normalize DontDelete|Function 0 + isSupported SVGDOMNodeBridge::IsSupported DontDelete|Function 2 + addEventListener SVGDOMNodeBridge::AddEventListener DontDelete|Function 3 + removeEventListener SVGDOMNodeBridge::RemoveEventListener DontDelete|Function 3 + contains SVGDOMNodeBridge::Contains DontDelete|Function 1 + getNodeName SVGDOMNodeBridge::GetNodeName DontDelete|Function 0 + getNodeValue SVGDOMNodeBridge::GetNodeValue DontDelete|Function 0 + getNodeType SVGDOMNodeBridge::GetNodeType DontDelete|Function 0 + getParentNode SVGDOMNodeBridge::GetParentNode DontDelete|Function 0 + getChildNodes SVGDOMNodeBridge::GetChildNodes DontDelete|Function 0 + getFirstChild SVGDOMNodeBridge::GetFirstChild DontDelete|Function 0 + getLastChild SVGDOMNodeBridge::GetLastChild DontDelete|Function 0 + getPreviousSibling SVGDOMNodeBridge::GetPreviousSibling DontDelete|Function 0 + getNextSibling SVGDOMNodeBridge::GetNextSibling DontDelete|Function 0 + getAttributes SVGDOMNodeBridge::GetAttributes DontDelete|Function 0 + getNamespaceURI SVGDOMNodeBridge::GetNamespaceURI DontDelete|Function 0 + getPrefix SVGDOMNodeBridge::GetPrefix DontDelete|Function 0 + getLocalName SVGDOMNodeBridge::GetLocalName DontDelete|Function 0 + getOwnerDocument SVGDOMNodeBridge::GetOwnerDocument DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("DOMNode", SVGDOMNodeBridgeProto, SVGDOMNodeBridgeProtoFunc) + +Value SVGDOMNodeBridge::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case NodeName: + return getString(m_impl.nodeName()); + case NodeValue: + return getString(m_impl.nodeValue()); + case NodeType: + return Number(m_impl.nodeType()); + case ParentNode: + return getDOMNode(exec, m_impl.parentNode()); + case ChildNodes: + return (new SVGDOMNodeListBridge(m_impl.childNodes()))->cache(exec); + case FirstChild: + return getDOMNode(exec, m_impl.firstChild()); + case LastChild: + return getDOMNode(exec, m_impl.lastChild()); + case PreviousSibling: + return getDOMNode(exec, m_impl.previousSibling()); + case NextSibling: + return getDOMNode(exec, m_impl.nextSibling()); +// case Attributes: // TODO + case NamespaceURI: + return getString(m_impl.namespaceURI()); + case Prefix: + return getString(m_impl.prefix()); + case LocalName: + return getString(m_impl.localName()); + case OwnerDocument: + return getDOMNode(exec, m_impl.ownerDocument()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGDOMNodeBridge::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case NodeValue: + m_impl.setNodeValue(value.toString(exec).string()); + break; + case Prefix: + m_impl.setPrefix(value.toString(exec).string()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +// Special variantion to update the element, +// triggered by one of the child nodes +void updateTextItem(ExecState *exec, const DOM::Node node) +{ + DOM::Node parent; + while(!(parent = node.parentNode()).isNull()) + { + DOM::DOMString name = parent.nodeName(); + if(name == "text" || name == "tspan" || name == "tref") + { + SVGHelperImpl::updateItem(exec, parent); + break; + } + } +} + +// Remove item from canvas +void removeItem(ExecState *exec, DOM::Node &node) +{ + // Get document + SVGDocumentImpl *doc = KSVG::Window::retrieveActive(exec)->doc(); + + // Update canvas + SVGShapeImpl *shape = dynamic_cast(doc->getElementFromHandle(node.handle())); + if(shape && shape->item()) + doc->canvas()->removeItem(shape->item()); +} + +// parseXML + getURL() need all these 5 functions to work properly +void correctHandles(SVGElementImpl *main, DOM::Node &node) +{ + DOM::Element old(node.handle()); + DOM::Element *replace = static_cast(main->ownerDoc()->getElementFromHandle(node.handle())); + + if(replace && node.nodeType() == DOM::Node::ELEMENT_NODE) + *replace = old; + + if(node.hasChildNodes()) + { + for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) + correctHandles(main, iterate); + } +} + +void integrateTree(SVGElementImpl *main, DOM::Node &node, DOM::Node &newNode, SVGElementImpl *obj, SVGDocumentImpl *doc) +{ + if(!obj) + return; + + // Add to global element dicts + doc->addToElemDict(newNode.handle(), obj); + doc->addToElemDict(node.handle(), obj); + + if(node.hasChildNodes()) + { + DOM::Node iterate2 = newNode.firstChild(); + for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) + { + integrateTree(main, iterate, iterate2, obj->ownerDoc()->getElementFromHandle(iterate2.handle()), doc); + iterate2 = iterate2.nextSibling(); + } + } +} + +void correctDocument(SVGElementImpl *main, DOM::Node &node, SVGElementImpl *obj, SVGDocumentImpl *doc) +{ + if(!obj) + return; + + // Correct document + obj->setOwnerDoc(main->ownerDoc()); + + // Correct rootElement + if(!obj->ownerSVGElement()) + obj->setOwnerSVGElement(main->ownerSVGElement()); + + // Correct viewportElement + if(!obj->viewportElement()) + obj->setViewportElement(main->viewportElement()); + + // Properly (re-)register events in the current active document + obj->setupEventListeners(main->ownerDoc(), doc); + + if(node.hasChildNodes()) + { + for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) + correctDocument(main, iterate, doc->getElementFromHandle(iterate.handle()), doc); + } +} + +void registerAdditional(ExecState *exec, SVGDocumentImpl *doc, DOM::Node node) +{ + // Register ID in rootElement! + SVGElementImpl *resultElement = doc->getElementFromHandle(node.handle()); + if(resultElement && resultElement->hasAttribute("id")) + doc->rootElement()->addToIdMap(resultElement->getAttribute("id").string(), resultElement); + + if(node.hasChildNodes()) + { + for(DOM::Node iterate = node.firstChild(); !iterate.isNull(); iterate = iterate.nextSibling()) + registerAdditional(exec, doc, iterate); + } +} + +Value appendHelper(ExecState *exec, DOM::Node node, DOM::Node newNode) +{ + // This is quite tricky code by me (Niko) + // Don't even try to modify it. + if(!(node.ownerDocument() == newNode.ownerDocument())) + { + // Get document + SVGDocumentImpl *doc = KSVG::Window::retrieveActive(exec)->doc(); + + // Detect ownerDoc() of newNode + SVGDocumentImpl *newDoc = doc->getDocumentFromHandle(newNode.ownerDocument().handle()); + + // Get some SVGElementImpl's + SVGElementImpl *nodeElement = doc->getElementFromHandle(node.handle()); + SVGElementImpl *newNodeElement = newDoc->getElementFromHandle(newNode.handle()); + + // Import node into document + DOM::Node result = doc->importNode(newNode, true); + + // Associate the imported node 'result' with the + // 'newNodeElement' which belongs to 'newDoc' + integrateTree(nodeElement, result, newNode, newNodeElement, doc); + + // Correct handles in SVG* elements + correctHandles(nodeElement, result); + + // Correct ownerDoc() etc.. + correctDocument(nodeElement, newNode, newNodeElement, newDoc); + + // Register ID in global map + registerAdditional(exec, doc, result); + + // Recalc style + newNodeElement->setAttributes(); + + // Append + create + update element + Value retVal = getDOMNode(exec, node.appendChild(result)); + + doc->syncCachedMatrices(); + newNodeElement->createItem(doc->canvas()); + SVGHelperImpl::updateItem(exec, *newNodeElement); + + return retVal; + } + else + { + Value retVal = getDOMNode(exec, node.appendChild(newNode)); + + // Get document + SVGDocumentImpl *doc = KSVG::Window::retrieveActive(exec)->doc(); + doc->syncCachedMatrices(); + + // Get some SVGElementImpl's + SVGElementImpl *nodeElement = doc->getElementFromHandle(newNode.handle()); + // TODO : extra check needed to see if the new elements parent is already appended + // in the doc. Not really nice, should be some other way? (Rob) + if(nodeElement && !nodeElement->parentNode().parentNode().isNull()) + { + nodeElement->setAttributes(true); + nodeElement->createItem(); + SVGHelperImpl::updateItem(exec, newNode); + } + + return retVal; + } +} + +Value SVGDOMNodeBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGDOMNodeBridge) + DOM::Node node = obj->impl(); + + switch(id) + { + case SVGDOMNodeBridge::InsertBefore: + { + DOM::Node newChild = toNode(args[0]); + DOM::Node beforeChild = toNode(args[1]); + Value retVal = getDOMNode(exec, node.insertBefore(newChild, beforeChild)); + + // Get document + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + + // Get some SVGElementImpl's + SVGShapeImpl *newShape = dynamic_cast(doc->getElementFromHandle(newChild.handle())); + SVGElementImpl *newElement = doc->getElementFromHandle(newChild.handle()); + SVGShapeImpl *beforeElement = dynamic_cast(doc->getElementFromHandle(beforeChild.handle())); + if(newShape && beforeElement && beforeElement->item()) + { + int z = beforeElement->item()->zIndex(); + newElement->createItem(); + doc->canvas()->insert(newShape->item(), z); + } + SVGHelperImpl::updateItem(exec, newChild); + + return retVal; + } + case SVGDOMNodeBridge::ReplaceChild: + { + DOM::Node newChild = toNode(args[0]); + Value retVal = getDOMNode(exec, node.replaceChild(newChild, toNode(args[1]))); + SVGHelperImpl::updateItem(exec, newChild); + return retVal; + } + case SVGDOMNodeBridge::RemoveChild: + { + DOM::Node remove = toNode(args[0]); + if(remove.isNull()) + return Undefined(); + + // New removeChild logic: + // - remove from DOM tree + // - delete element (also deletes it's child element's) + removeItem(exec, remove); + Value retVal = getDOMNode(exec, node.removeChild(remove)); + return retVal; + } + case SVGDOMNodeBridge::AppendChild: + return appendHelper(exec, node, toNode(args[0])); + case SVGDOMNodeBridge::HasAttributes: + { + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(node.handle()); + + if(!element) + return Undefined(); + + return Boolean(element->hasAttributes()); + } + case SVGDOMNodeBridge::HasChildNodes: + return Boolean(node.hasChildNodes()); + case SVGDOMNodeBridge::CloneNode: + { + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(node.handle()); + SVGElementImpl *newElement = element->cloneNode(args[0].toBoolean(exec)); + + return getDOMNode(exec, *newElement); + } + case SVGDOMNodeBridge::Normalize: + { + node.normalize(); + return Undefined(); + } + case SVGDOMNodeBridge::IsSupported: + return Boolean(node.isSupported(args[0].toString(exec).string(), args[1].toString(exec).string())); + case SVGDOMNodeBridge::AddEventListener: + { + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(node.handle()); + + if(element) + { + SVGEvent::EventId eventId = SVGEvent::typeToId(args[0].toString(exec).string()); + if(eventId != SVGEvent::UNKNOWN_EVENT) + element->setEventListener(eventId, new KSVGEcmaEventListener(Object::dynamicCast(args[1]), TQString(), doc->ecmaEngine())); + } + return Undefined(); + } + case SVGDOMNodeBridge::RemoveEventListener: + { + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(node.handle()); + + if(element) + { + SVGEvent::EventId eventId = SVGEvent::typeToId(args[0].toString(exec).string()); + if(eventId != SVGEvent::UNKNOWN_EVENT) + element->removeEventListener((int) eventId); + } + return Undefined(); + } +// case SVGDOMNodeBridge::Contains: // TODO + case SVGDOMNodeBridge::GetNodeName: + return getString(node.nodeName()); + case SVGDOMNodeBridge::GetNodeValue: + return getString(node.nodeValue()); + case SVGDOMNodeBridge::GetNodeType: + return Number(node.nodeType()); + case SVGDOMNodeBridge::GetParentNode: + return getDOMNode(exec, node.parentNode()); + case SVGDOMNodeBridge::GetChildNodes: + return (new SVGDOMNodeListBridge(node.childNodes()))->cache(exec); + case SVGDOMNodeBridge::GetFirstChild: + return getDOMNode(exec, node.firstChild()); + case SVGDOMNodeBridge::GetLastChild: + return getDOMNode(exec, node.lastChild()); + case SVGDOMNodeBridge::GetPreviousSibling: + return getDOMNode(exec, node.previousSibling()); + case SVGDOMNodeBridge::GetNextSibling: + return getDOMNode(exec, node.nextSibling()); +// case SVGDOMNodeBridge::GetAttributes: // TODO + case SVGDOMNodeBridge::GetNamespaceURI: + return getString(node.namespaceURI()); + case SVGDOMNodeBridge::GetPrefix: + return getString(node.prefix()); + case SVGDOMNodeBridge::GetLocalName: + return getString(node.localName()); + case SVGDOMNodeBridge::GetOwnerDocument: + return getDOMNode(exec, node.ownerDocument()); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +// SVGDOMElementBridge + +/* +@namespace KSVG +@begin SVGDOMElementBridge::s_hashTable 2 + tagName SVGDOMElementBridge::TagName DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGDOMElementBridgeProto::s_hashTable 17 + getAttribute SVGDOMElementBridge::GetAttribute DontDelete|Function 1 + setAttribute SVGDOMElementBridge::SetAttribute DontDelete|Function 2 + removeAttribute SVGDOMElementBridge::RemoveAttribute DontDelete|Function 1 + getAttributeNode SVGDOMElementBridge::GetAttributeNode DontDelete|Function 1 + setAttributeNode SVGDOMElementBridge::SetAttributeNode DontDelete|Function 2 + removeAttributeNode SVGDOMElementBridge::RemoveAttributeNode DontDelete|Function 1 + getElementsByTagName SVGDOMElementBridge::GetElementsByTagName DontDelete|Function 1 + hasAttribute SVGDOMElementBridge::HasAttribute DontDelete|Function 1 + getAttributeNS SVGDOMElementBridge::GetAttributeNS DontDelete|Function 2 + setAttributeNS SVGDOMElementBridge::SetAttributeNS DontDelete|Function 3 + removeAttributeNS SVGDOMElementBridge::RemoveAttributeNS DontDelete|Function 2 + getAttributeNodeNS SVGDOMElementBridge::GetAttributeNodeNS DontDelete|Function 2 + setAttributeNodeNS SVGDOMElementBridge::SetAttributeNodeNS DontDelete|Function 1 + getElementByTagNameNS SVGDOMElementBridge::GetElementsByTagNameNS DontDelete|Function 2 + hasAttributeNS SVGDOMElementBridge::HasAttributeNS DontDelete|Function 2 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("DOMElement", SVGDOMElementBridgeProto, SVGDOMElementBridgeProtoFunc) + +Value SVGDOMElementBridge::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case TagName: + return getString(m_impl.tagName()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGDOMElementBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGDOMElementBridge) + DOM::Element elem = obj->impl(); + + switch(id) + { + case SVGDOMElementBridge::GetAttribute: + { + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); + if(element) + return String(element->getAttribute(args[0].toString(exec).string())); + else + return Undefined(); + } + case SVGDOMElementBridge::SetAttribute: + { + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); + if(element) + { + element->setAttribute(args[0].toString(exec).string(), args[1].toString(exec).string()); + element->setAttributeInternal(args[0].toString(exec).string(), args[1].toString(exec).string()); + + SVGHelperImpl::updateItem(exec, elem); + } + + return Undefined(); + } + case SVGDOMElementBridge::RemoveAttribute: + { + elem.removeAttribute(args[0].toString(exec).string()); + return Undefined(); + } + case SVGDOMElementBridge::GetAttributeNode: + return getDOMNode(exec, elem.getAttributeNode(args[0].toString(exec).string())); + case SVGDOMElementBridge::SetAttributeNode: // TODO: Correct? + return getDOMNode(exec, elem.setAttributeNode(toNode(args[0]))); + case SVGDOMElementBridge::RemoveAttributeNode: // TODO: Correct? + return getDOMNode(exec, elem.removeAttributeNode(toNode(args[0]))); + case SVGDOMElementBridge::GetElementsByTagName: + return (new SVGDOMNodeListBridge(elem.getElementsByTagName(args[0].toString(exec).string())))->cache(exec); + case SVGDOMElementBridge::GetAttributeNS: + { + // This just skips NS! (Rob) + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); + if(element) + return String(element->getAttribute(args[1].toString(exec).string())); + else + return Undefined(); + } + case SVGDOMElementBridge::SetAttributeNS: + { + // For now, we strip the NS part (Rob) + DOM::DOMString attr = args[1].toString(exec).string(); + int pos = attr.string().find(':'); + if(pos > -1) + attr = attr.string().mid(pos + 1); + + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + SVGElementImpl *element = doc->getElementFromHandle(elem.handle()); + if(element) + { + element->setAttribute(attr.string(), args[2].toString(exec).string()); + element->setAttributeInternal(attr.string(), args[2].toString(exec).string()); + + SVGHelperImpl::updateItem(exec, *element); + } + + return Undefined(); + } + case SVGDOMElementBridge::RemoveAttributeNS: + { + elem.removeAttributeNS(args[0].toString(exec).string(), args[1].toString(exec).string()); + return Undefined(); + } + case SVGDOMElementBridge::GetAttributeNodeNS: + return getDOMNode(exec, elem.getAttributeNodeNS(args[0].toString(exec).string(), args[1].toString(exec).string())); + case SVGDOMElementBridge::SetAttributeNodeNS: // TODO: Correct? + return getDOMNode(exec, elem.setAttributeNodeNS(toNode(args[0]))); + case SVGDOMElementBridge::GetElementsByTagNameNS: + return (new SVGDOMNodeListBridge(elem.getElementsByTagNameNS(args[0].toString(exec).string(), args[1].toString(exec).string())))->cache(exec); + case SVGDOMElementBridge::HasAttribute: + return Boolean(elem.hasAttribute(args[0].toString(exec).string())); + case SVGDOMElementBridge::HasAttributeNS: + return Boolean(elem.hasAttributeNS(args[0].toString(exec).string(), args[1].toString(exec).string())); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + + +// SVGDOMNodeListBridge + +/* +@namespace KSVG +@begin SVGDOMNodeListBridge::s_hashTable 2 + length SVGDOMNodeListBridge::Length DontDelete +@end +@namespace KSVG +@begin SVGDOMNodeListBridgeProto::s_hashTable 3 + getLength SVGDOMNodeListBridge::GetLength DontDelete|Function 0 + item SVGDOMNodeListBridge::Item DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("DOMNodeList", SVGDOMNodeListBridgeProto, SVGDOMNodeListBridgeProtoFunc) + +Value SVGDOMNodeListBridge::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Length: + return Number(m_impl.length()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGDOMNodeListBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGDOMNodeListBridge) + DOM::NodeList nodeList = obj->impl(); + + switch(id) + { + case SVGDOMNodeListBridge::GetLength: + return Number(nodeList.length()); + case SVGDOMNodeListBridge::Item: + return getDOMNode(exec, nodeList.item((unsigned long)args[0].toNumber(exec))); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +// SVGDOMCharacterDataBridge + +/* +@namespace KSVG +@begin SVGDOMCharacterDataBridge::s_hashTable 3 + data SVGDOMCharacterDataBridge::Data DontDelete + length SVGDOMCharacterDataBridge::Length DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGDOMCharacterDataBridgeProto::s_hashTable 11 + getData SVGDOMCharacterDataBridge::GetData DontDelete|Function 0 + setData SVGDOMCharacterDataBridge::SetData DontDelete|Function 1 + getLength SVGDOMCharacterDataBridge::GetLength DontDelete|Function 0 + substringData SVGDOMCharacterDataBridge::SubstringData DontDelete|Function 2 + appendData SVGDOMCharacterDataBridge::AppendData DontDelete|Function 1 + insertData SVGDOMCharacterDataBridge::InsertData DontDelete|Function 2 + deleteData SVGDOMCharacterDataBridge::DeleteData DontDelete|Function 2 + replaceData SVGDOMCharacterDataBridge::ReplaceData DontDelete|Function 2 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("DOMCharacterData", SVGDOMCharacterDataBridgeProto, SVGDOMCharacterDataBridgeProtoFunc) + +Value SVGDOMCharacterDataBridge::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Data: + return String(m_impl.data()); + case Length: + return Number(m_impl.length()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGDOMCharacterDataBridge::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case Data: + m_impl.setData(value.toString(exec).string()); + updateTextItem(exec, m_impl); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGDOMCharacterDataBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGDOMCharacterDataBridge) + DOM::CharacterData node = obj->impl(); + + switch(id) + { + case SVGDOMCharacterDataBridge::GetData: + return String(node.data()); + case SVGDOMCharacterDataBridge::SetData: + node.setData(args[0].toString(exec).string()); + updateTextItem(exec, node); + return Undefined(); + case SVGDOMCharacterDataBridge::GetLength: + return Number(node.length()); + case SVGDOMCharacterDataBridge::SubstringData: + { + DOM::DOMString ret = node.substringData(args[0].toInteger(exec), args[1].toInteger(exec)); + updateTextItem(exec, node); + return String(ret); + } + case SVGDOMCharacterDataBridge::AppendData: + node.appendData(args[0].toString(exec).string()); + updateTextItem(exec, node); + return Undefined(); + case SVGDOMCharacterDataBridge::InsertData: + node.insertData(args[0].toInteger(exec), args[1].toString(exec).string()); + updateTextItem(exec, node); + return Undefined(); + case SVGDOMCharacterDataBridge::DeleteData: + node.deleteData(args[0].toInteger(exec), args[1].toInteger(exec)); + updateTextItem(exec, node); + return Undefined(); + case SVGDOMCharacterDataBridge::ReplaceData: + node.replaceData(args[0].toInteger(exec), args[1].toInteger(exec), args[2].toString(exec).string()); + updateTextItem(exec, node); + return Undefined(); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +// SVGDOMTextBridge + +/* +@namespace KSVG +@begin SVGDOMTextBridge::s_hashTable 2 + dummy SVGDOMTextBridge::Dummy DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGDOMTextBridgeProto::s_hashTable 2 + splitText SVGDOMTextBridge::SplitText DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("DOMText", SVGDOMTextBridgeProto, SVGDOMTextBridgeProtoFunc) + +Value SVGDOMTextBridge::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGDOMTextBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGDOMTextBridge) + DOM::Text node = obj->impl(); + + switch(id) + { + case SVGDOMTextBridge::SplitText: + return getDOMNode(exec, node.splitText(args[0].toInteger(exec))); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +// SVGDOMDOMImplementationBridge + +/* +@namespace KSVG +@begin SVGDOMDOMImplementationBridge::s_hashTable 2 + dummy SVGDOMDOMImplementationBridge::Dummy DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGDOMDOMImplementationBridgeProto::s_hashTable 2 + hasFeature SVGDOMDOMImplementationBridge::HasFeature DontDelete|Function 2 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("DOMDOMImplementation", SVGDOMDOMImplementationBridgeProto, SVGDOMDOMImplementationBridgeProtoFunc) + +Value SVGDOMDOMImplementationBridge::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGDOMDOMImplementationBridgeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGDOMDOMImplementationBridge) + DOM::DOMImplementation node = obj->impl(); + + switch(id) + { + case SVGDOMDOMImplementationBridge::HasFeature: + return Boolean(node.hasFeature(args[0].toString(exec).string(), args[1].toString(exec).string())); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +// SVGDOMDocumentFragmentBridge + +/* +@namespace KSVG +@begin SVGDOMDocumentFragmentBridge::s_hashTable 2 + dummy SVGDOMDocumentFragmentBridge::Dummy DontDelete|ReadOnly +@end +*/ + +Value SVGDOMDocumentFragmentBridge::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGElementImpl.cc b/ksvg/impl/SVGElementImpl.cc deleted file mode 100644 index 523c5807..00000000 --- a/ksvg/impl/SVGElementImpl.cc +++ /dev/null @@ -1,711 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGEvent.h" -#include "SVGEventImpl.h" -#include "SVGHelperImpl.h" -#include "SVGElementImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" - -using namespace KSVG; - -#include "SVGElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_ecma.h" - -SVGElementImpl::Factory *SVGElementImpl::Factory::m_instance = 0; - -SVGElementImpl::SVGElementImpl(DOM::ElementImpl *impl) : DOM::DomShared(), DOM::Element(impl), SVGDOMElementBridge(static_cast(*this)) -{ - KSVG_EMPTY_FLAGS - - m_ownerSVGElement = 0; - m_viewportElement = 0; - m_ownerDoc = 0; - - m_mouseOver = false; - m_focus = false; - - m_eventListeners.setAutoDelete(true); - m_attributes.setAutoDelete(true); -} - -SVGElementImpl::~SVGElementImpl() -{ - if(m_ownerSVGElement) - m_ownerSVGElement->deref(); -} - -void SVGElementImpl::setEventListener(int id, SVGEventListener *listener) -{ - if(listener) - listener->ref(); - - removeEventListener(id); - - if(listener) - { - SVGRegisteredEventListener *rl = new SVGRegisteredEventListener(static_cast(id), listener, false); - m_eventListeners.append(rl); - - listener->deref(); - } -} - -int SVGElementImpl::getEventListeners(bool local) -{ - int events = 0; - - TQPtrListIterator it(m_eventListeners); - for(; it.current(); ++it) - events |= (1 << it.current()->id); - - if(local) - return events; - - for(DOM::Node node = parentNode(); !node.isNull(); node = node.parentNode()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - - if(element) - { - TQPtrListIterator it(element->m_eventListeners); - for(; it.current(); ++it) - events |= (1 << it.current()->id); - } - } - - return events; -} - -void SVGElementImpl::setupEventListeners(SVGDocumentImpl *doc, SVGDocumentImpl *newDoc) -{ - if(!doc || !newDoc) - return; - - // Changes the document where the eventlisteners are registered - // Needed for parseXML'ed elements with events, their listeners - // are created in the temporary document fragment and need to be - // registered in the main document (Niko) - TQPtrListIterator it(m_eventListeners); - for(; it.current(); ++it) - { - SVGRegisteredEventListener *current = it.current(); - - TQString valueOfCurrent = newDoc->ecmaEngine()->valueOfEventListener(current->listener); - setEventListener(current->id, doc->createEventListener(valueOfCurrent)); - } -} - -bool SVGElementImpl::hasEventListener(int id, bool local) -{ - // First check if we have the listener, locally - TQPtrListIterator it(m_eventListeners); - for(; it.current(); ++it) - { - if(it.current()->id == id) - return true; - } - - // We have no local listeners, if we are just interessted - // in those listeners, then return now... - if(local) - return false; - - // Check every parent element - for(DOM::Node node = parentNode(); !node.isNull(); node = node.parentNode()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - - if(element) - { - TQPtrListIterator it(element->m_eventListeners); - for(; it.current(); ++it) - { - if(it.current()->id == id) - return true; - } - } - } - - return false; -} - -void SVGElementImpl::removeEventListener(int id) -{ - TQPtrListIterator it(m_eventListeners); - for(; it.current(); ++it) - { - if(it.current()->id == id) - { - m_eventListeners.removeRef(it.current()); - break; - } - } -} - -void SVGElementImpl::handleLocalEvents(SVGEventImpl *evt, bool useCapture) -{ - TQPtrListIterator it(m_eventListeners); - for(; it.current(); ++it) - { - if(it.current()->id == evt->id() && it.current()->useCapture == useCapture) - { - it.current()->listener->handleEvent(evt); - break; - } - } -} - -void SVGElementImpl::defaultEventHandler(SVGEventImpl *) -{ -} - -/* -@namespace KSVG -@begin SVGElementImpl::s_hashTable 23 - id SVGElementImpl::ElementId DontDelete - ownerSVGElement SVGElementImpl::OwnerSvgElement DontDelete|ReadOnly - viewportElement SVGElementImpl::ViewportElement DontDelete|ReadOnly - xmlbase SVGElementImpl::XmlBase DontDelete - base SVGElementImpl::XmlBase DontDelete - onmouseup SVGElementImpl::OnMouseUp DontDelete - onmousedown SVGElementImpl::OnMouseDown DontDelete - onmousemove SVGElementImpl::OnMouseMove DontDelete - onmouseover SVGElementImpl::OnMouseOver DontDelete - onmouseout SVGElementImpl::OnMouseOut DontDelete - onclick SVGElementImpl::OnClick DontDelete - onmouseclick SVGElementImpl::OnClick DontDelete - onactivate SVGElementImpl::OnActivate DontDelete - onkeydown SVGElementImpl::OnKeyDown DontDelete - onkeyup SVGElementImpl::OnKeyUp DontDelete - onkeypress SVGElementImpl::OnKeyPress DontDelete - onload SVGElementImpl::OnLoad DontDelete - onfocusin SVGElementImpl::OnFocusIn DontDelete - onfocusout SVGElementImpl::OnFocusOut DontDelete - onerror SVGElementImpl::OnError DontDelete - onabort SVGElementImpl::OnAbort DontDelete -@end -@namespace KSVG -@begin SVGElementImplProto::s_hashTable 5 - getStyle SVGElementImpl::GetStyle DontDelete|Function 0 - setProperty SVGElementImpl::SetProperty DontDelete|Function 2 - getPropertyValue SVGElementImpl::GetPropertyValue DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGElement", SVGElementImplProto, SVGElementImplProtoFunc) - -Value SVGElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case ElementId: - return String(id().string()); - case XmlBase: - return String(xmlbase().string()); - case OwnerSvgElement: - return getDOMNode(exec, *ownerSVGElement()); - case ViewportElement: - return getDOMNode(exec, *viewportElement()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case ElementId: - setId(value.toString(exec).string()); - break; - case XmlBase: - setXmlbase(value.toString(exec).string()); - break; - case OnMouseUp: - setEventListener(SVGEvent::MOUSEUP_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnMouseDown: - setEventListener(SVGEvent::MOUSEDOWN_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnMouseMove: - setEventListener(SVGEvent::MOUSEMOVE_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnMouseOver: - setEventListener(SVGEvent::MOUSEOVER_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnMouseOut: - setEventListener(SVGEvent::MOUSEOUT_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnClick: - setEventListener(SVGEvent::CLICK_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnActivate: - setEventListener(SVGEvent::DOMACTIVATE_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnKeyDown: - setEventListener(SVGEvent::KEYDOWN_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnKeyUp: - setEventListener(SVGEvent::KEYUP_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnKeyPress: - setEventListener(SVGEvent::KEYPRESS_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnLoad: - setEventListener(SVGEvent::LOAD_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnFocusIn: - setEventListener(SVGEvent::DOMFOCUSIN_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnFocusOut: - setEventListener(SVGEvent::DOMFOCUSOUT_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnError: - setEventListener(SVGEvent::ERROR_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - case OnAbort: - setEventListener(SVGEvent::ABORT_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); - break; - default: - kdWarning() << k_funcinfo << "unhandled token " << token << endl; - } -} - -Value SVGElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGElementImpl) - - switch(id) - { - case SVGElementImpl::GetStyle: - return obj->cache(exec); - case SVGElementImpl::SetProperty: - { - DOM::DOMString attribute = args[0].toString(exec).qstring().lower(); - DOM::DOMString value = args[1].toString(exec).qstring(); - obj->setAttribute(attribute, value); - break; - } - case SVGElementImpl::GetPropertyValue: - return String(obj->getAttribute(args[0].toString(exec).qstring())); - default: - break; - } - - return Undefined(); -} - -TQDict &SVGElementImpl::attributes() -{ - return m_attributes; -} - -// tdehtml overrides -void SVGElementImpl::setAttribute(const DOM::DOMString &name, const DOM::DOMString &value) -{ - m_attributes.replace(name.string(), new DOM::DOMString(value)); -} - -// Changes internal value. This will have no effect on getAttribute(). -void SVGElementImpl::setAttributeInternal(const DOM::DOMString &name, const DOM::DOMString &value) -{ - ExecState *exec = ownerDoc()->ecmaEngine()->globalExec(); - - static_cast(exec->interpreter())->setAttributeSetMode(true); - bridge(exec)->put(exec, Identifier(UString(name)), String(value), KJS::Internal); - static_cast(exec->interpreter())->setAttributeSetMode(false); -} - -// This gets the actual attribute as set in the svg source -DOM::DOMString SVGElementImpl::getAttribute(const DOM::DOMString &name) const -{ - DOM::DOMString *result = m_attributes[name.string()]; - if(result) - return *result; - else - return DOM::DOMString(); -} - -// This gets the internal, real-time value. This means it can return a default value -// for an attribute even if its not explicitly set in the svg source. -DOM::DOMString SVGElementImpl::getAttributeInternal(const DOM::DOMString &name) -{ - ExecState *exec = ownerDoc()->ecmaEngine()->globalExec(); - - DOM::DOMString retVal; - - static_cast(exec->interpreter())->setAttributeGetMode(true); - retVal = bridge(exec)->get(exec, Identifier(UString(name))).toString(exec).string(); - static_cast(exec->interpreter())->setAttributeGetMode(false); - - return retVal; -} - -bool SVGElementImpl::hasAttribute(const DOM::DOMString &name) -{ - return m_attributes.find(name.string()) != 0; -} - -bool SVGElementImpl::hasAttributes() -{ - return m_attributes.count() > 0; -} - -void SVGElementImpl::setApplyAttribute(const TQString &name, const TQString &value) -{ - if(hasAttribute(name)) - { - TQString cur = getAttribute(name).string(); - cur = cur.simplifyWhiteSpace(); - - if(!cur.endsWith(";")) - cur += "; "; - - cur += value; - - setAttribute(name, cur); - } - else - setAttribute(name, value); -} - -void SVGElementImpl::setId(DOM::DOMString id) -{ - setAttribute("id", id); - - if(ownerDoc() && ownerDoc()->rootElement() && !id.isEmpty()) - ownerDoc()->rootElement()->addToIdMap(id.string(), this); - else if(m_ownerSVGElement && !id.isEmpty()) - m_ownerSVGElement->addToIdMap(id.string(), this); -} - -DOM::DOMString SVGElementImpl::id() const -{ - return getAttribute("id"); -} - -void SVGElementImpl::setXmlbase(DOM::DOMString xmlbase) -{ - setAttribute("xml:base", xmlbase); -} - -DOM::DOMString SVGElementImpl::xmlbase() const -{ - return getAttribute("xml:base"); -} - -void SVGElementImpl::setOwnerSVGElement(SVGSVGElementImpl *owner) -{ - if(m_ownerSVGElement) - m_ownerSVGElement->deref(); - - m_ownerSVGElement = owner; - - if(m_ownerSVGElement) - m_ownerSVGElement->ref(); -} - -void SVGElementImpl::setViewportElement(SVGElementImpl *viewport) -{ - if(m_viewportElement) - m_viewportElement->deref(); - - m_viewportElement = viewport; - - if(m_viewportElement) - m_viewportElement->ref(); -} - -SVGSVGElementImpl *SVGElementImpl::ownerSVGElement() const -{ - return m_ownerSVGElement; -} - -SVGElementImpl *SVGElementImpl::viewportElement() const -{ - return m_viewportElement; -} - -void SVGElementImpl::setAttributes(const TQXmlAttributes &attrs) -{ - for(int i = 0; i < attrs.length(); i++) - { - setAttribute(attrs.localName(i), attrs.value(i)); - setAttributeInternal(attrs.localName(i), attrs.value(i)); - } - - setAttributes(); -} - -void SVGElementImpl::setAttributes() -{ - // Finalize style - SVGStylableImpl *style = dynamic_cast(this); - - if(style) - style->processStyle(); -} - -void SVGElementImpl::setAttributes(bool deep) -{ - // Finalize style - SVGStylableImpl *style = dynamic_cast(this); - - if(style) - style->processStyle(); - - if(deep) - { - if(hasChildNodes()) - { - DOM::Node n; - for(n = firstChild(); !n.isNull(); n = n.nextSibling()) - { - SVGElementImpl *elem = ownerDoc()->getElementFromHandle(n.handle()); - if(elem) - elem->setAttributes(true); - } - } - } -} - -bool SVGElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &a, SVGMouseEventImpl *mev) -{ - SVGShapeImpl *shape = dynamic_cast(this); - if(shape) - return shape->prepareMouseEvent(p, a, mev); - - return false; -} - -bool SVGElementImpl::dispatchEvent(int id, bool canBubbleArg, bool cancelableArg) -{ - SVGEventImpl *evt = new SVGEventImpl(static_cast(id), canBubbleArg, cancelableArg); - - evt->ref(); - bool ret = dispatchEvent(evt, true); - evt->deref(); - - return ret; -} - -bool SVGElementImpl::dispatchEvent(SVGEventImpl *evt, bool tempEvent) -{ - evt->setTarget(this); - - // Find out, where to send to -> collect parent nodes - TQPtrList nodeChain; - - for(DOM::Element e = *this; !e.isNull(); e = e.parentNode()) - nodeChain.prepend(ownerDoc()->getElementFromHandle(e.handle())); - - // Trigger any capturing event handlers on our way down - evt->setEventPhase(DOM::Event::CAPTURING_PHASE); - - TQPtrListIterator it(nodeChain); - for(; it.current() && it.current() != this && !evt->propagationStopped(); ++it) - { - evt->setCurrentTarget(it.current()); - - if(it.current()) - it.current()->handleLocalEvents(evt, true); - } - - // Dispatch to the actual target node - it.toLast(); - if(!evt->propagationStopped()) - { - evt->setEventPhase(DOM::Event::AT_TARGET); - evt->setCurrentTarget(it.current()); - - if(it.current()) - it.current()->handleLocalEvents(evt, false); - } - - --it; - - // Bubble up again - if(evt->bubbles()) - { - evt->setEventPhase(DOM::Event::BUBBLING_PHASE); - for(; it.current() && !evt->propagationStopped(); --it) - { - evt->setCurrentTarget(it.current()); - - if(it.current()) - it.current()->handleLocalEvents(evt, false); - } - } - - evt->setCurrentTarget(0); - evt->setEventPhase(0); // I guess this is correct, the spec does not seem to say - // anything about the default event handler phase. - - if(evt->bubbles()) - { - // now we call all default event handlers (this is not part of DOM - it is internal to ksvg) - it.toLast(); - for(; it.current() && !evt->propagationStopped() && !evt->defaultPrevented() && !evt->defaultHandled(); --it) - it.current()->defaultEventHandler(evt); - } - - // If tempEvent is true, this means that the DOM implementation will not be storing a reference to the event, i.e. - // there is no way to retrieve it from javascript if a script does not already have a reference to it in a variable. - // So there is no need for the interpreter to keep the event in its cache - if(tempEvent) - ownerDoc()->ecmaEngine()->finishedWithEvent(evt); - - return !evt->defaultPrevented(); // ### what if defaultPrevented was called before dispatchEvent? -} - -bool SVGElementImpl::dispatchKeyEvent(TQKeyEvent *ke) -{ - DOM::AbstractView temp; - - SVGEvent::EventId evtId = SVGEvent::UNKNOWN_EVENT; - - if(ke->type() == TQEvent::KeyRelease && !ke->isAutoRepeat()) - evtId = SVGEvent::KEYUP_EVENT; - else if(ke->isAutoRepeat()) - evtId = SVGEvent::KEYPRESS_EVENT; - else if(ke->type() == TQEvent::KeyPress) - evtId = SVGEvent::KEYDOWN_EVENT; - - if(evtId == SVGEvent::KEYUP_EVENT && hasEventListener(SVGEvent::DOMACTIVATE_EVENT, false)) - dispatchEvent(SVGEvent::DOMACTIVATE_EVENT, true, true); - - if(!hasEventListener(evtId, false)) - return false; - - SVGEventImpl *evt = new SVGKeyEventImpl(ke, temp, evtId); - - evt->ref(); - bool ret = dispatchEvent(evt, true); - evt->deref(); - - // Rerender now! Once! (Niko) - ownerDoc()->rerender(); - - return ret; -} - -bool SVGElementImpl::dispatchMouseEvent(int id, bool canBubbleArg, bool cancelableArg, long detailArg, long screenXArg, long screenYArg, long clientXArg, long clientYArg, bool ctrlKeyArg, bool altKeyArg, bool shiftKeyArg, bool metaKeyArg, unsigned short buttonArg, SVGElementImpl *relatedTargetArg) -{ - DOM::AbstractView temp; - - SVGEventImpl *evt = new SVGMouseEventImpl(static_cast(id), - canBubbleArg, cancelableArg, temp, detailArg, - screenXArg, screenYArg, - clientXArg, clientYArg, - ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, - buttonArg, relatedTargetArg); - - evt->ref(); - bool ret = dispatchEvent(evt, true); - evt->deref(); - - return ret; -} - -void SVGElementImpl::setOwnerDoc(SVGDocumentImpl *doc) -{ - if(m_ownerDoc) - m_ownerDoc->removeFromElemDict(handle()); - - m_ownerDoc = doc; - - if(m_ownerDoc) - m_ownerDoc->addToElemDict(handle(), this); -} - -SVGDocumentImpl *SVGElementImpl::ownerDoc() const -{ - return m_ownerDoc; -} - -SVGElementImpl *SVGElementImpl::cloneNode(bool deep) -{ - DOM::Element impl = static_cast(ownerDoc())->createElementNS("", tagName()); - SVGElementImpl *newElement = SVGDocumentImpl::createElement(tagName(), impl.cloneNode(false), ownerDoc()); - newElement->setOwnerSVGElement(ownerSVGElement()); - newElement->setViewportElement(viewportElement()); - - SVGHelperImpl::copyAttributes(this, newElement); - - // Recalc style - //newElement->setAttributes(); - - if(deep) - cloneChildNodes(newElement); - - return newElement; -} - -void SVGElementImpl::cloneChildNodes(SVGElementImpl *clone) -{ - DOM::Node n; - for(n = firstChild(); !n.isNull(); n = n.nextSibling()) - { - SVGElementImpl *elem = ownerDoc()->getElementFromHandle(n.handle()); - if(elem) - clone->appendChild(*elem->cloneNode(true)); - else if(n.nodeType() == DOM::Node::TEXT_NODE) - clone->appendChild(n.cloneNode(true)); - } -} - -void SVGElementImpl::gotError(const TQString &errorDesc) -{ - if(ownerDoc()) - { - ownerDoc()->finishParsing(true, errorDesc); - if(hasEventListener(SVGEvent::ERROR_EVENT, true)) - dispatchEvent(SVGEvent::ERROR_EVENT, false, false); - } -} - -TQString SVGElementImpl::collectText() -{ - TQString text; - - if(hasChildNodes()) - { - DOM::Node node = firstChild(); - - for(; !node.isNull(); node = node.nextSibling()) - { - if(node.nodeType() == DOM::Node::TEXT_NODE) - { - DOM::Text textNode = node; - text += textNode.data().string(); - } - } - } - - return text; -} diff --git a/ksvg/impl/SVGElementImpl.cpp b/ksvg/impl/SVGElementImpl.cpp new file mode 100644 index 00000000..523c5807 --- /dev/null +++ b/ksvg/impl/SVGElementImpl.cpp @@ -0,0 +1,711 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGEvent.h" +#include "SVGEventImpl.h" +#include "SVGHelperImpl.h" +#include "SVGElementImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" + +using namespace KSVG; + +#include "SVGElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_ecma.h" + +SVGElementImpl::Factory *SVGElementImpl::Factory::m_instance = 0; + +SVGElementImpl::SVGElementImpl(DOM::ElementImpl *impl) : DOM::DomShared(), DOM::Element(impl), SVGDOMElementBridge(static_cast(*this)) +{ + KSVG_EMPTY_FLAGS + + m_ownerSVGElement = 0; + m_viewportElement = 0; + m_ownerDoc = 0; + + m_mouseOver = false; + m_focus = false; + + m_eventListeners.setAutoDelete(true); + m_attributes.setAutoDelete(true); +} + +SVGElementImpl::~SVGElementImpl() +{ + if(m_ownerSVGElement) + m_ownerSVGElement->deref(); +} + +void SVGElementImpl::setEventListener(int id, SVGEventListener *listener) +{ + if(listener) + listener->ref(); + + removeEventListener(id); + + if(listener) + { + SVGRegisteredEventListener *rl = new SVGRegisteredEventListener(static_cast(id), listener, false); + m_eventListeners.append(rl); + + listener->deref(); + } +} + +int SVGElementImpl::getEventListeners(bool local) +{ + int events = 0; + + TQPtrListIterator it(m_eventListeners); + for(; it.current(); ++it) + events |= (1 << it.current()->id); + + if(local) + return events; + + for(DOM::Node node = parentNode(); !node.isNull(); node = node.parentNode()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + + if(element) + { + TQPtrListIterator it(element->m_eventListeners); + for(; it.current(); ++it) + events |= (1 << it.current()->id); + } + } + + return events; +} + +void SVGElementImpl::setupEventListeners(SVGDocumentImpl *doc, SVGDocumentImpl *newDoc) +{ + if(!doc || !newDoc) + return; + + // Changes the document where the eventlisteners are registered + // Needed for parseXML'ed elements with events, their listeners + // are created in the temporary document fragment and need to be + // registered in the main document (Niko) + TQPtrListIterator it(m_eventListeners); + for(; it.current(); ++it) + { + SVGRegisteredEventListener *current = it.current(); + + TQString valueOfCurrent = newDoc->ecmaEngine()->valueOfEventListener(current->listener); + setEventListener(current->id, doc->createEventListener(valueOfCurrent)); + } +} + +bool SVGElementImpl::hasEventListener(int id, bool local) +{ + // First check if we have the listener, locally + TQPtrListIterator it(m_eventListeners); + for(; it.current(); ++it) + { + if(it.current()->id == id) + return true; + } + + // We have no local listeners, if we are just interessted + // in those listeners, then return now... + if(local) + return false; + + // Check every parent element + for(DOM::Node node = parentNode(); !node.isNull(); node = node.parentNode()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + + if(element) + { + TQPtrListIterator it(element->m_eventListeners); + for(; it.current(); ++it) + { + if(it.current()->id == id) + return true; + } + } + } + + return false; +} + +void SVGElementImpl::removeEventListener(int id) +{ + TQPtrListIterator it(m_eventListeners); + for(; it.current(); ++it) + { + if(it.current()->id == id) + { + m_eventListeners.removeRef(it.current()); + break; + } + } +} + +void SVGElementImpl::handleLocalEvents(SVGEventImpl *evt, bool useCapture) +{ + TQPtrListIterator it(m_eventListeners); + for(; it.current(); ++it) + { + if(it.current()->id == evt->id() && it.current()->useCapture == useCapture) + { + it.current()->listener->handleEvent(evt); + break; + } + } +} + +void SVGElementImpl::defaultEventHandler(SVGEventImpl *) +{ +} + +/* +@namespace KSVG +@begin SVGElementImpl::s_hashTable 23 + id SVGElementImpl::ElementId DontDelete + ownerSVGElement SVGElementImpl::OwnerSvgElement DontDelete|ReadOnly + viewportElement SVGElementImpl::ViewportElement DontDelete|ReadOnly + xmlbase SVGElementImpl::XmlBase DontDelete + base SVGElementImpl::XmlBase DontDelete + onmouseup SVGElementImpl::OnMouseUp DontDelete + onmousedown SVGElementImpl::OnMouseDown DontDelete + onmousemove SVGElementImpl::OnMouseMove DontDelete + onmouseover SVGElementImpl::OnMouseOver DontDelete + onmouseout SVGElementImpl::OnMouseOut DontDelete + onclick SVGElementImpl::OnClick DontDelete + onmouseclick SVGElementImpl::OnClick DontDelete + onactivate SVGElementImpl::OnActivate DontDelete + onkeydown SVGElementImpl::OnKeyDown DontDelete + onkeyup SVGElementImpl::OnKeyUp DontDelete + onkeypress SVGElementImpl::OnKeyPress DontDelete + onload SVGElementImpl::OnLoad DontDelete + onfocusin SVGElementImpl::OnFocusIn DontDelete + onfocusout SVGElementImpl::OnFocusOut DontDelete + onerror SVGElementImpl::OnError DontDelete + onabort SVGElementImpl::OnAbort DontDelete +@end +@namespace KSVG +@begin SVGElementImplProto::s_hashTable 5 + getStyle SVGElementImpl::GetStyle DontDelete|Function 0 + setProperty SVGElementImpl::SetProperty DontDelete|Function 2 + getPropertyValue SVGElementImpl::GetPropertyValue DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGElement", SVGElementImplProto, SVGElementImplProtoFunc) + +Value SVGElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case ElementId: + return String(id().string()); + case XmlBase: + return String(xmlbase().string()); + case OwnerSvgElement: + return getDOMNode(exec, *ownerSVGElement()); + case ViewportElement: + return getDOMNode(exec, *viewportElement()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case ElementId: + setId(value.toString(exec).string()); + break; + case XmlBase: + setXmlbase(value.toString(exec).string()); + break; + case OnMouseUp: + setEventListener(SVGEvent::MOUSEUP_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnMouseDown: + setEventListener(SVGEvent::MOUSEDOWN_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnMouseMove: + setEventListener(SVGEvent::MOUSEMOVE_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnMouseOver: + setEventListener(SVGEvent::MOUSEOVER_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnMouseOut: + setEventListener(SVGEvent::MOUSEOUT_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnClick: + setEventListener(SVGEvent::CLICK_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnActivate: + setEventListener(SVGEvent::DOMACTIVATE_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnKeyDown: + setEventListener(SVGEvent::KEYDOWN_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnKeyUp: + setEventListener(SVGEvent::KEYUP_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnKeyPress: + setEventListener(SVGEvent::KEYPRESS_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnLoad: + setEventListener(SVGEvent::LOAD_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnFocusIn: + setEventListener(SVGEvent::DOMFOCUSIN_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnFocusOut: + setEventListener(SVGEvent::DOMFOCUSOUT_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnError: + setEventListener(SVGEvent::ERROR_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + case OnAbort: + setEventListener(SVGEvent::ABORT_EVENT, m_ownerDoc->createEventListener(value.toString(exec).string())); + break; + default: + kdWarning() << k_funcinfo << "unhandled token " << token << endl; + } +} + +Value SVGElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGElementImpl) + + switch(id) + { + case SVGElementImpl::GetStyle: + return obj->cache(exec); + case SVGElementImpl::SetProperty: + { + DOM::DOMString attribute = args[0].toString(exec).qstring().lower(); + DOM::DOMString value = args[1].toString(exec).qstring(); + obj->setAttribute(attribute, value); + break; + } + case SVGElementImpl::GetPropertyValue: + return String(obj->getAttribute(args[0].toString(exec).qstring())); + default: + break; + } + + return Undefined(); +} + +TQDict &SVGElementImpl::attributes() +{ + return m_attributes; +} + +// tdehtml overrides +void SVGElementImpl::setAttribute(const DOM::DOMString &name, const DOM::DOMString &value) +{ + m_attributes.replace(name.string(), new DOM::DOMString(value)); +} + +// Changes internal value. This will have no effect on getAttribute(). +void SVGElementImpl::setAttributeInternal(const DOM::DOMString &name, const DOM::DOMString &value) +{ + ExecState *exec = ownerDoc()->ecmaEngine()->globalExec(); + + static_cast(exec->interpreter())->setAttributeSetMode(true); + bridge(exec)->put(exec, Identifier(UString(name)), String(value), KJS::Internal); + static_cast(exec->interpreter())->setAttributeSetMode(false); +} + +// This gets the actual attribute as set in the svg source +DOM::DOMString SVGElementImpl::getAttribute(const DOM::DOMString &name) const +{ + DOM::DOMString *result = m_attributes[name.string()]; + if(result) + return *result; + else + return DOM::DOMString(); +} + +// This gets the internal, real-time value. This means it can return a default value +// for an attribute even if its not explicitly set in the svg source. +DOM::DOMString SVGElementImpl::getAttributeInternal(const DOM::DOMString &name) +{ + ExecState *exec = ownerDoc()->ecmaEngine()->globalExec(); + + DOM::DOMString retVal; + + static_cast(exec->interpreter())->setAttributeGetMode(true); + retVal = bridge(exec)->get(exec, Identifier(UString(name))).toString(exec).string(); + static_cast(exec->interpreter())->setAttributeGetMode(false); + + return retVal; +} + +bool SVGElementImpl::hasAttribute(const DOM::DOMString &name) +{ + return m_attributes.find(name.string()) != 0; +} + +bool SVGElementImpl::hasAttributes() +{ + return m_attributes.count() > 0; +} + +void SVGElementImpl::setApplyAttribute(const TQString &name, const TQString &value) +{ + if(hasAttribute(name)) + { + TQString cur = getAttribute(name).string(); + cur = cur.simplifyWhiteSpace(); + + if(!cur.endsWith(";")) + cur += "; "; + + cur += value; + + setAttribute(name, cur); + } + else + setAttribute(name, value); +} + +void SVGElementImpl::setId(DOM::DOMString id) +{ + setAttribute("id", id); + + if(ownerDoc() && ownerDoc()->rootElement() && !id.isEmpty()) + ownerDoc()->rootElement()->addToIdMap(id.string(), this); + else if(m_ownerSVGElement && !id.isEmpty()) + m_ownerSVGElement->addToIdMap(id.string(), this); +} + +DOM::DOMString SVGElementImpl::id() const +{ + return getAttribute("id"); +} + +void SVGElementImpl::setXmlbase(DOM::DOMString xmlbase) +{ + setAttribute("xml:base", xmlbase); +} + +DOM::DOMString SVGElementImpl::xmlbase() const +{ + return getAttribute("xml:base"); +} + +void SVGElementImpl::setOwnerSVGElement(SVGSVGElementImpl *owner) +{ + if(m_ownerSVGElement) + m_ownerSVGElement->deref(); + + m_ownerSVGElement = owner; + + if(m_ownerSVGElement) + m_ownerSVGElement->ref(); +} + +void SVGElementImpl::setViewportElement(SVGElementImpl *viewport) +{ + if(m_viewportElement) + m_viewportElement->deref(); + + m_viewportElement = viewport; + + if(m_viewportElement) + m_viewportElement->ref(); +} + +SVGSVGElementImpl *SVGElementImpl::ownerSVGElement() const +{ + return m_ownerSVGElement; +} + +SVGElementImpl *SVGElementImpl::viewportElement() const +{ + return m_viewportElement; +} + +void SVGElementImpl::setAttributes(const TQXmlAttributes &attrs) +{ + for(int i = 0; i < attrs.length(); i++) + { + setAttribute(attrs.localName(i), attrs.value(i)); + setAttributeInternal(attrs.localName(i), attrs.value(i)); + } + + setAttributes(); +} + +void SVGElementImpl::setAttributes() +{ + // Finalize style + SVGStylableImpl *style = dynamic_cast(this); + + if(style) + style->processStyle(); +} + +void SVGElementImpl::setAttributes(bool deep) +{ + // Finalize style + SVGStylableImpl *style = dynamic_cast(this); + + if(style) + style->processStyle(); + + if(deep) + { + if(hasChildNodes()) + { + DOM::Node n; + for(n = firstChild(); !n.isNull(); n = n.nextSibling()) + { + SVGElementImpl *elem = ownerDoc()->getElementFromHandle(n.handle()); + if(elem) + elem->setAttributes(true); + } + } + } +} + +bool SVGElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &a, SVGMouseEventImpl *mev) +{ + SVGShapeImpl *shape = dynamic_cast(this); + if(shape) + return shape->prepareMouseEvent(p, a, mev); + + return false; +} + +bool SVGElementImpl::dispatchEvent(int id, bool canBubbleArg, bool cancelableArg) +{ + SVGEventImpl *evt = new SVGEventImpl(static_cast(id), canBubbleArg, cancelableArg); + + evt->ref(); + bool ret = dispatchEvent(evt, true); + evt->deref(); + + return ret; +} + +bool SVGElementImpl::dispatchEvent(SVGEventImpl *evt, bool tempEvent) +{ + evt->setTarget(this); + + // Find out, where to send to -> collect parent nodes + TQPtrList nodeChain; + + for(DOM::Element e = *this; !e.isNull(); e = e.parentNode()) + nodeChain.prepend(ownerDoc()->getElementFromHandle(e.handle())); + + // Trigger any capturing event handlers on our way down + evt->setEventPhase(DOM::Event::CAPTURING_PHASE); + + TQPtrListIterator it(nodeChain); + for(; it.current() && it.current() != this && !evt->propagationStopped(); ++it) + { + evt->setCurrentTarget(it.current()); + + if(it.current()) + it.current()->handleLocalEvents(evt, true); + } + + // Dispatch to the actual target node + it.toLast(); + if(!evt->propagationStopped()) + { + evt->setEventPhase(DOM::Event::AT_TARGET); + evt->setCurrentTarget(it.current()); + + if(it.current()) + it.current()->handleLocalEvents(evt, false); + } + + --it; + + // Bubble up again + if(evt->bubbles()) + { + evt->setEventPhase(DOM::Event::BUBBLING_PHASE); + for(; it.current() && !evt->propagationStopped(); --it) + { + evt->setCurrentTarget(it.current()); + + if(it.current()) + it.current()->handleLocalEvents(evt, false); + } + } + + evt->setCurrentTarget(0); + evt->setEventPhase(0); // I guess this is correct, the spec does not seem to say + // anything about the default event handler phase. + + if(evt->bubbles()) + { + // now we call all default event handlers (this is not part of DOM - it is internal to ksvg) + it.toLast(); + for(; it.current() && !evt->propagationStopped() && !evt->defaultPrevented() && !evt->defaultHandled(); --it) + it.current()->defaultEventHandler(evt); + } + + // If tempEvent is true, this means that the DOM implementation will not be storing a reference to the event, i.e. + // there is no way to retrieve it from javascript if a script does not already have a reference to it in a variable. + // So there is no need for the interpreter to keep the event in its cache + if(tempEvent) + ownerDoc()->ecmaEngine()->finishedWithEvent(evt); + + return !evt->defaultPrevented(); // ### what if defaultPrevented was called before dispatchEvent? +} + +bool SVGElementImpl::dispatchKeyEvent(TQKeyEvent *ke) +{ + DOM::AbstractView temp; + + SVGEvent::EventId evtId = SVGEvent::UNKNOWN_EVENT; + + if(ke->type() == TQEvent::KeyRelease && !ke->isAutoRepeat()) + evtId = SVGEvent::KEYUP_EVENT; + else if(ke->isAutoRepeat()) + evtId = SVGEvent::KEYPRESS_EVENT; + else if(ke->type() == TQEvent::KeyPress) + evtId = SVGEvent::KEYDOWN_EVENT; + + if(evtId == SVGEvent::KEYUP_EVENT && hasEventListener(SVGEvent::DOMACTIVATE_EVENT, false)) + dispatchEvent(SVGEvent::DOMACTIVATE_EVENT, true, true); + + if(!hasEventListener(evtId, false)) + return false; + + SVGEventImpl *evt = new SVGKeyEventImpl(ke, temp, evtId); + + evt->ref(); + bool ret = dispatchEvent(evt, true); + evt->deref(); + + // Rerender now! Once! (Niko) + ownerDoc()->rerender(); + + return ret; +} + +bool SVGElementImpl::dispatchMouseEvent(int id, bool canBubbleArg, bool cancelableArg, long detailArg, long screenXArg, long screenYArg, long clientXArg, long clientYArg, bool ctrlKeyArg, bool altKeyArg, bool shiftKeyArg, bool metaKeyArg, unsigned short buttonArg, SVGElementImpl *relatedTargetArg) +{ + DOM::AbstractView temp; + + SVGEventImpl *evt = new SVGMouseEventImpl(static_cast(id), + canBubbleArg, cancelableArg, temp, detailArg, + screenXArg, screenYArg, + clientXArg, clientYArg, + ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, + buttonArg, relatedTargetArg); + + evt->ref(); + bool ret = dispatchEvent(evt, true); + evt->deref(); + + return ret; +} + +void SVGElementImpl::setOwnerDoc(SVGDocumentImpl *doc) +{ + if(m_ownerDoc) + m_ownerDoc->removeFromElemDict(handle()); + + m_ownerDoc = doc; + + if(m_ownerDoc) + m_ownerDoc->addToElemDict(handle(), this); +} + +SVGDocumentImpl *SVGElementImpl::ownerDoc() const +{ + return m_ownerDoc; +} + +SVGElementImpl *SVGElementImpl::cloneNode(bool deep) +{ + DOM::Element impl = static_cast(ownerDoc())->createElementNS("", tagName()); + SVGElementImpl *newElement = SVGDocumentImpl::createElement(tagName(), impl.cloneNode(false), ownerDoc()); + newElement->setOwnerSVGElement(ownerSVGElement()); + newElement->setViewportElement(viewportElement()); + + SVGHelperImpl::copyAttributes(this, newElement); + + // Recalc style + //newElement->setAttributes(); + + if(deep) + cloneChildNodes(newElement); + + return newElement; +} + +void SVGElementImpl::cloneChildNodes(SVGElementImpl *clone) +{ + DOM::Node n; + for(n = firstChild(); !n.isNull(); n = n.nextSibling()) + { + SVGElementImpl *elem = ownerDoc()->getElementFromHandle(n.handle()); + if(elem) + clone->appendChild(*elem->cloneNode(true)); + else if(n.nodeType() == DOM::Node::TEXT_NODE) + clone->appendChild(n.cloneNode(true)); + } +} + +void SVGElementImpl::gotError(const TQString &errorDesc) +{ + if(ownerDoc()) + { + ownerDoc()->finishParsing(true, errorDesc); + if(hasEventListener(SVGEvent::ERROR_EVENT, true)) + dispatchEvent(SVGEvent::ERROR_EVENT, false, false); + } +} + +TQString SVGElementImpl::collectText() +{ + TQString text; + + if(hasChildNodes()) + { + DOM::Node node = firstChild(); + + for(; !node.isNull(); node = node.nextSibling()) + { + if(node.nodeType() == DOM::Node::TEXT_NODE) + { + DOM::Text textNode = node; + text += textNode.data().string(); + } + } + } + + return text; +} diff --git a/ksvg/impl/SVGElementInstanceImpl.cc b/ksvg/impl/SVGElementInstanceImpl.cc deleted file mode 100644 index bd1fc58d..00000000 --- a/ksvg/impl/SVGElementInstanceImpl.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGElementImpl.h" -#include "SVGUseElementImpl.h" -#include "SVGElementInstanceImpl.h" -#include "SVGElementInstanceListImpl.h" - -using namespace KSVG; - -SVGElementInstanceImpl::SVGElementInstanceImpl()//FIXME : events::EventTarget() -{ - m_correspondingElement = 0; - m_correspondingUseElement = 0; - m_parentNode = 0; - m_childNodes = 0; - m_firstChild = 0; - m_lastChild = 0; - m_previousSibling = 0; - m_nextSibling = 0; -} - -SVGElementInstanceImpl::~SVGElementInstanceImpl() -{ - if(m_correspondingElement) - m_correspondingElement->deref(); - if(m_correspondingUseElement) - m_correspondingUseElement->deref(); - if(m_parentNode) - m_parentNode->deref(); - if(m_childNodes) - m_childNodes->deref(); - if(m_firstChild) - m_firstChild->deref(); - if(m_lastChild) - m_lastChild->deref(); - if(m_previousSibling) - m_previousSibling->deref(); - if(m_nextSibling) - m_nextSibling->deref(); -} - -void SVGElementInstanceImpl::setCorrespondingElement(SVGElementImpl *corresponding) -{ - m_correspondingElement = corresponding; - - if(m_correspondingElement) - m_correspondingElement->ref(); -} - -SVGElementImpl *SVGElementInstanceImpl::correspondingElement() const -{ - return m_correspondingElement; -} - -SVGUseElementImpl *SVGElementInstanceImpl::correspondingUseElement() const -{ - return m_correspondingUseElement; -} - -SVGElementInstanceImpl *SVGElementInstanceImpl::parentNode() const -{ - return m_parentNode; -} - -SVGElementInstanceListImpl *SVGElementInstanceImpl::childNodes() const -{ - return m_childNodes; -} - -SVGElementInstanceImpl *SVGElementInstanceImpl::firstChild() const -{ - return m_firstChild; -} - -SVGElementInstanceImpl *SVGElementInstanceImpl::lastChild() const -{ - return m_lastChild; -} - -SVGElementInstanceImpl *SVGElementInstanceImpl::previousSibling() const -{ - return m_previousSibling; -} - -SVGElementInstanceImpl *SVGElementInstanceImpl::nextSibling() const -{ - return m_nextSibling; -} diff --git a/ksvg/impl/SVGElementInstanceImpl.cpp b/ksvg/impl/SVGElementInstanceImpl.cpp new file mode 100644 index 00000000..bd1fc58d --- /dev/null +++ b/ksvg/impl/SVGElementInstanceImpl.cpp @@ -0,0 +1,106 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGElementImpl.h" +#include "SVGUseElementImpl.h" +#include "SVGElementInstanceImpl.h" +#include "SVGElementInstanceListImpl.h" + +using namespace KSVG; + +SVGElementInstanceImpl::SVGElementInstanceImpl()//FIXME : events::EventTarget() +{ + m_correspondingElement = 0; + m_correspondingUseElement = 0; + m_parentNode = 0; + m_childNodes = 0; + m_firstChild = 0; + m_lastChild = 0; + m_previousSibling = 0; + m_nextSibling = 0; +} + +SVGElementInstanceImpl::~SVGElementInstanceImpl() +{ + if(m_correspondingElement) + m_correspondingElement->deref(); + if(m_correspondingUseElement) + m_correspondingUseElement->deref(); + if(m_parentNode) + m_parentNode->deref(); + if(m_childNodes) + m_childNodes->deref(); + if(m_firstChild) + m_firstChild->deref(); + if(m_lastChild) + m_lastChild->deref(); + if(m_previousSibling) + m_previousSibling->deref(); + if(m_nextSibling) + m_nextSibling->deref(); +} + +void SVGElementInstanceImpl::setCorrespondingElement(SVGElementImpl *corresponding) +{ + m_correspondingElement = corresponding; + + if(m_correspondingElement) + m_correspondingElement->ref(); +} + +SVGElementImpl *SVGElementInstanceImpl::correspondingElement() const +{ + return m_correspondingElement; +} + +SVGUseElementImpl *SVGElementInstanceImpl::correspondingUseElement() const +{ + return m_correspondingUseElement; +} + +SVGElementInstanceImpl *SVGElementInstanceImpl::parentNode() const +{ + return m_parentNode; +} + +SVGElementInstanceListImpl *SVGElementInstanceImpl::childNodes() const +{ + return m_childNodes; +} + +SVGElementInstanceImpl *SVGElementInstanceImpl::firstChild() const +{ + return m_firstChild; +} + +SVGElementInstanceImpl *SVGElementInstanceImpl::lastChild() const +{ + return m_lastChild; +} + +SVGElementInstanceImpl *SVGElementInstanceImpl::previousSibling() const +{ + return m_previousSibling; +} + +SVGElementInstanceImpl *SVGElementInstanceImpl::nextSibling() const +{ + return m_nextSibling; +} diff --git a/ksvg/impl/SVGElementInstanceListImpl.cc b/ksvg/impl/SVGElementInstanceListImpl.cc deleted file mode 100644 index c0748008..00000000 --- a/ksvg/impl/SVGElementInstanceListImpl.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGElementInstanceImpl.h" -#include "SVGElementInstanceListImpl.h" - -using namespace KSVG; - -SVGElementInstanceListImpl::SVGElementInstanceListImpl() -{ -} - -SVGElementInstanceListImpl::~SVGElementInstanceListImpl() -{ -} - -unsigned long SVGElementInstanceListImpl::length() const -{ - return m_length; -} - -SVGElementInstanceImpl *SVGElementInstanceListImpl::item(unsigned long /*index*/) -{ - return 0; -} diff --git a/ksvg/impl/SVGElementInstanceListImpl.cpp b/ksvg/impl/SVGElementInstanceListImpl.cpp new file mode 100644 index 00000000..c0748008 --- /dev/null +++ b/ksvg/impl/SVGElementInstanceListImpl.cpp @@ -0,0 +1,42 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGElementInstanceImpl.h" +#include "SVGElementInstanceListImpl.h" + +using namespace KSVG; + +SVGElementInstanceListImpl::SVGElementInstanceListImpl() +{ +} + +SVGElementInstanceListImpl::~SVGElementInstanceListImpl() +{ +} + +unsigned long SVGElementInstanceListImpl::length() const +{ + return m_length; +} + +SVGElementInstanceImpl *SVGElementInstanceListImpl::item(unsigned long /*index*/) +{ + return 0; +} diff --git a/ksvg/impl/SVGEllipseElementImpl.cc b/ksvg/impl/SVGEllipseElementImpl.cc deleted file mode 100644 index 1487d79b..00000000 --- a/ksvg/impl/SVGEllipseElementImpl.cc +++ /dev/null @@ -1,198 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -#include "SVGRectImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGEllipseElementImpl.h" -#include "SVGAnimatedLengthImpl.h" - -using namespace KSVG; - -#include "SVGEllipseElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGEllipseElementImpl::SVGEllipseElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - KSVG_EMPTY_FLAGS - - m_cx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_cx->ref(); - m_cx->baseVal()->setValueAsString("-1"); - - m_cy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_cy->ref(); - m_cy->baseVal()->setValueAsString("-1"); - - m_rx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_rx->ref(); - m_rx->baseVal()->setValueAsString("-1"); - - m_ry = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_ry->ref(); - m_ry->baseVal()->setValueAsString("-1"); -} - -SVGEllipseElementImpl::~SVGEllipseElementImpl() -{ - if(m_cx) - m_cx->deref(); - if(m_cy) - m_cy->deref(); - if(m_rx) - m_rx->deref(); - if(m_ry) - m_ry->deref(); -} - -SVGAnimatedLengthImpl *SVGEllipseElementImpl::cx() -{ - return m_cx; -} - -SVGAnimatedLengthImpl *SVGEllipseElementImpl::cy() -{ - return m_cy; -} - -SVGAnimatedLengthImpl *SVGEllipseElementImpl::rx() -{ - return m_rx; -} - -SVGAnimatedLengthImpl *SVGEllipseElementImpl::ry() -{ - return m_ry; -} - -/* -@namespace KSVG -@begin SVGEllipseElementImpl::s_hashTable 5 - cx SVGEllipseElementImpl::Cx DontDelete|ReadOnly - cy SVGEllipseElementImpl::Cy DontDelete|ReadOnly - rx SVGEllipseElementImpl::Rx DontDelete|ReadOnly - ry SVGEllipseElementImpl::Ry DontDelete|ReadOnly -@end -*/ - -Value SVGEllipseElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case Cx: - if(!attributeMode) - return m_cx->cache(exec); - else - return Number(m_cx->baseVal()->value()); - case Cy: - if(!attributeMode) - return m_cy->cache(exec); - else - return Number(m_cy->baseVal()->value()); - case Rx: - if(!attributeMode) - return m_rx->cache(exec); - else - return Number(m_rx->baseVal()->value()); - case Ry: - if(!attributeMode) - return m_ry->cache(exec); - else - return Number(m_ry->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGEllipseElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Cx: - cx()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Cy: - cy()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Rx: - rx()->baseVal()->setValueAsString(value.toString(exec).qstring()); - if(rx()->baseVal()->value() < 0) // A negative value is an error - gotError("Negative value for attribute rx of element is illegal"); - break; - case Ry: - ry()->baseVal()->setValueAsString(value.toString(exec).qstring()); - if(ry()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute ry of element is illegal")); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -SVGRectImpl *SVGEllipseElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - ret->setX(m_cx->baseVal()->value() - m_rx->baseVal()->value()); - ret->setY(m_cy->baseVal()->value() - m_ry->baseVal()->value()); - ret->setWidth(m_rx->baseVal()->value() * 2.0); - ret->setHeight(m_ry->baseVal()->value() * 2.0); - return ret; -} - -void SVGEllipseElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Cx)) - KSVG_SET_ALT_ATTRIBUTE(Cx, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Cy)) - KSVG_SET_ALT_ATTRIBUTE(Cy, "0") -} - -void SVGEllipseElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createEllipse(this); - c->insert(m_item); - } -} diff --git a/ksvg/impl/SVGEllipseElementImpl.cpp b/ksvg/impl/SVGEllipseElementImpl.cpp new file mode 100644 index 00000000..1487d79b --- /dev/null +++ b/ksvg/impl/SVGEllipseElementImpl.cpp @@ -0,0 +1,198 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +#include "SVGRectImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGEllipseElementImpl.h" +#include "SVGAnimatedLengthImpl.h" + +using namespace KSVG; + +#include "SVGEllipseElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGEllipseElementImpl::SVGEllipseElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + KSVG_EMPTY_FLAGS + + m_cx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_cx->ref(); + m_cx->baseVal()->setValueAsString("-1"); + + m_cy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_cy->ref(); + m_cy->baseVal()->setValueAsString("-1"); + + m_rx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_rx->ref(); + m_rx->baseVal()->setValueAsString("-1"); + + m_ry = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_ry->ref(); + m_ry->baseVal()->setValueAsString("-1"); +} + +SVGEllipseElementImpl::~SVGEllipseElementImpl() +{ + if(m_cx) + m_cx->deref(); + if(m_cy) + m_cy->deref(); + if(m_rx) + m_rx->deref(); + if(m_ry) + m_ry->deref(); +} + +SVGAnimatedLengthImpl *SVGEllipseElementImpl::cx() +{ + return m_cx; +} + +SVGAnimatedLengthImpl *SVGEllipseElementImpl::cy() +{ + return m_cy; +} + +SVGAnimatedLengthImpl *SVGEllipseElementImpl::rx() +{ + return m_rx; +} + +SVGAnimatedLengthImpl *SVGEllipseElementImpl::ry() +{ + return m_ry; +} + +/* +@namespace KSVG +@begin SVGEllipseElementImpl::s_hashTable 5 + cx SVGEllipseElementImpl::Cx DontDelete|ReadOnly + cy SVGEllipseElementImpl::Cy DontDelete|ReadOnly + rx SVGEllipseElementImpl::Rx DontDelete|ReadOnly + ry SVGEllipseElementImpl::Ry DontDelete|ReadOnly +@end +*/ + +Value SVGEllipseElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case Cx: + if(!attributeMode) + return m_cx->cache(exec); + else + return Number(m_cx->baseVal()->value()); + case Cy: + if(!attributeMode) + return m_cy->cache(exec); + else + return Number(m_cy->baseVal()->value()); + case Rx: + if(!attributeMode) + return m_rx->cache(exec); + else + return Number(m_rx->baseVal()->value()); + case Ry: + if(!attributeMode) + return m_ry->cache(exec); + else + return Number(m_ry->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGEllipseElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Cx: + cx()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Cy: + cy()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Rx: + rx()->baseVal()->setValueAsString(value.toString(exec).qstring()); + if(rx()->baseVal()->value() < 0) // A negative value is an error + gotError("Negative value for attribute rx of element is illegal"); + break; + case Ry: + ry()->baseVal()->setValueAsString(value.toString(exec).qstring()); + if(ry()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute ry of element is illegal")); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +SVGRectImpl *SVGEllipseElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + ret->setX(m_cx->baseVal()->value() - m_rx->baseVal()->value()); + ret->setY(m_cy->baseVal()->value() - m_ry->baseVal()->value()); + ret->setWidth(m_rx->baseVal()->value() * 2.0); + ret->setHeight(m_ry->baseVal()->value() * 2.0); + return ret; +} + +void SVGEllipseElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Cx)) + KSVG_SET_ALT_ATTRIBUTE(Cx, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Cy)) + KSVG_SET_ALT_ATTRIBUTE(Cy, "0") +} + +void SVGEllipseElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createEllipse(this); + c->insert(m_item); + } +} diff --git a/ksvg/impl/SVGEventImpl.cc b/ksvg/impl/SVGEventImpl.cc deleted file mode 100644 index 9ff61abc..00000000 --- a/ksvg/impl/SVGEventImpl.cc +++ /dev/null @@ -1,990 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - This file is part of the KDE project - - Additional copyright: - (C) 2001 Peter Kelly - (C) 2001 Tobias Anton - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDocumentImpl.h" -#include "SVGEventImpl.h" - -#include - -using namespace KSVG; - -#include "ksvg_scriptinterpreter.h" -#include "SVGEventImpl.lut.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGEventImpl::SVGEventImpl() -{ - m_canBubble = false; - m_cancelable = false; - - m_propagationStopped = false; - m_defaultPrevented = false; - m_id = SVGEvent::UNKNOWN_EVENT; - m_eventPhase = 0; - m_createTime = TQDateTime::currentDateTime(); - m_defaultHandled = false; - - m_target = 0; - m_currentTarget = 0; -} - -SVGEventImpl::SVGEventImpl(SVGEvent::EventId _id, bool canBubbleArg, bool cancelableArg) -{ - DOM::DOMString t = SVGEvent::idToType(_id); - m_type = t.implementation(); - - m_canBubble = canBubbleArg; - m_cancelable = cancelableArg; - - m_propagationStopped = false; - m_defaultPrevented = false; - m_id = _id; - m_eventPhase = 0; - m_createTime = TQDateTime::currentDateTime(); - m_defaultHandled = false; - - m_target = 0; - m_currentTarget = 0; -} - -SVGEventImpl::~SVGEventImpl() -{ -} - -DOM::DOMString SVGEventImpl::type() const -{ - return m_type; -} - -SVGElementImpl *SVGEventImpl::target() const -{ - return m_target; -} - -void SVGEventImpl::setTarget(SVGElementImpl *_target) -{ - m_target = _target; -} - -SVGElementImpl *SVGEventImpl::currentTarget() const -{ - return m_currentTarget; -} - -void SVGEventImpl::setCurrentTarget(SVGElementImpl *_currentTarget) -{ - m_currentTarget = _currentTarget; -} - -unsigned short SVGEventImpl::eventPhase() const -{ - return m_eventPhase; -} - -void SVGEventImpl::setEventPhase(unsigned short _eventPhase) -{ - m_eventPhase = _eventPhase; -} - -bool SVGEventImpl::bubbles() const -{ - return m_canBubble; -} - -bool SVGEventImpl::cancelable() const -{ - return m_cancelable; -} - -DOM::DOMTimeStamp SVGEventImpl::timeStamp() -{ - TQDateTime epoch(TQDate(1970, 1, 1), TQTime(0, 0)); - - // ### kjs does not yet support long long (?) so the value wraps around - return epoch.secsTo(m_createTime) * 1000 + m_createTime.time().msec(); -} - -void SVGEventImpl::stopPropagation() -{ - m_propagationStopped = true; -} - -void SVGEventImpl::preventDefault() -{ - if(m_cancelable) - m_defaultPrevented = true; -} - -void SVGEventImpl::initEvent(const DOM::DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg) -{ - // ### ensure this is not called after we have been dispatched (also for subclasses) - m_type = eventTypeArg.implementation(); - m_id = SVGEvent::typeToId(eventTypeArg); - - m_canBubble = canBubbleArg; - m_cancelable = cancelableArg; -} - -void SVGEventImpl::setDefaultHandled() -{ - m_defaultHandled = true; -} - -/* -@namespace KSVG -@begin SVGEventImpl::s_hashTable 11 - type SVGEventImpl::Type DontDelete|ReadOnly - target SVGEventImpl::Target DontDelete|ReadOnly - currentTarget SVGEventImpl::CurrentTarget DontDelete|ReadOnly - eventPhase SVGEventImpl::EventPhase DontDelete|ReadOnly - bubbles SVGEventImpl::Bubbles DontDelete|ReadOnly - cancelable SVGEventImpl::Cancelable DontDelete|ReadOnly - timeStamp SVGEventImpl::TimeStamp DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGEventImplProto::s_hashTable 13 - getType SVGEventImpl::GetType DontDelete|Function 0 - getTarget SVGEventImpl::GetTarget DontDelete|Function 0 - getCurrentTarget SVGEventImpl::GetCurrentTarget DontDelete|Function 0 - getCurrentNode SVGEventImpl::GetCurrentNode DontDelete|Function 0 - getEventphase SVGEventImpl::GetEventPhase DontDelete|Function 0 - getBubbles SVGEventImpl::GetBubbles DontDelete|Function 0 - getCancelable SVGEventImpl::GetCancelable DontDelete|Function 0 - getTimeStamp SVGEventImpl::GetTimeStamp DontDelete|Function 0 - stopPropagation SVGEventImpl::StopPropagation DontDelete|Function 0 - preventDefault SVGEventImpl::PreventDefault DontDelete|Function 0 - initEvent SVGEventImpl::InitEvent DontDelete|Function 3 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGEvent", SVGEventImplProto, SVGEventImplProtoFunc) - -Value SVGEventImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case Type: - return String(type()); - case Target: - return getDOMNode(exec, *target()); - case CurrentTarget: - return getDOMNode(exec, *currentTarget()); - case EventPhase: - return Number(eventPhase()); - case Bubbles: - return Boolean(bubbles()); - case Cancelable: - return Boolean(cancelable()); -// case TimeStamp: // TODO - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return KJS::Undefined(); - } -} - -Value SVGEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGEventImpl) - - switch(id) - { - case SVGEventImpl::GetType: - return String(obj->type()); - case SVGEventImpl::GetTarget: - return getDOMNode(exec, *obj->target()); - case SVGEventImpl::GetCurrentTarget: - case SVGEventImpl::GetCurrentNode: - return getDOMNode(exec, *obj->currentTarget()); - case SVGEventImpl::GetEventPhase: - return Number(obj->eventPhase()); - case SVGEventImpl::GetBubbles: - return Boolean(obj->bubbles()); - case SVGEventImpl::GetCancelable: - return Boolean(obj->cancelable()); -// case SVGEventImpl::GetTimeStamp: // TODO - case SVGEventImpl::StopPropagation: - { - obj->stopPropagation(); - return Undefined(); - } - case SVGEventImpl::PreventDefault: - { - obj->preventDefault(); - return Undefined(); - } - case SVGEventImpl::InitEvent: - { - obj->initEvent(args[0].toString(exec).string(), args[1].toBoolean(exec), args[2].toBoolean(exec)); - return Undefined(); - } - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - - - - - -SVGUIEventImpl::SVGUIEventImpl() : SVGEventImpl() -{ - m_detail = 0; -} - -SVGUIEventImpl::SVGUIEventImpl(SVGEvent::EventId _id, bool canBubbleArg, bool cancelableArg, DOM::AbstractView &viewArg, long detailArg) -: SVGEventImpl(_id, canBubbleArg, cancelableArg) -{ - m_view = viewArg; - m_detail = detailArg; -} - -SVGUIEventImpl::~SVGUIEventImpl() -{ -} - -DOM::AbstractView SVGUIEventImpl::view() const -{ - return m_view; -} - -long SVGUIEventImpl::detail() const -{ - return m_detail; -} - -void SVGUIEventImpl::initUIEvent(const DOM::DOMString &typeArg, - bool canBubbleArg, - bool cancelableArg, - const DOM::AbstractView &viewArg, - long detailArg) -{ - SVGEventImpl::initEvent(typeArg, canBubbleArg, cancelableArg); - - m_view = viewArg; - m_detail = detailArg; -} - -/* -@namespace KSVG -@begin SVGUIEventImpl::s_hashTable 3 - view SVGUIEventImpl::View DontDelete|ReadOnly - detail SVGUIEventImpl::Detail DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGUIEventImplProto::s_hashTable 5 - getView SVGUIEventImpl::GetView DontDelete|Function 0 - getDetail SVGUIEventImpl::GetDetail DontDelete|Function 0 - initUIEvent SVGUIEventImpl::InitUIEvent DontDelete|Function 5 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGUIEvent", SVGUIEventImplProto, SVGUIEventImplProtoFunc) - -Value SVGUIEventImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { -// case View: // TODO - case Detail: - return Number(detail()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return KJS::Undefined(); - } -} - -Value SVGUIEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) -{ - KSVG_CHECK_THIS(SVGUIEventImpl) - - switch(id) - { -// case SVGUIEventImpl::GetView: // TODO - case SVGUIEventImpl::GetDetail: - return Number(obj->detail()); -// case SVGUIEventImpl::InitUIEvent: // TODO - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -SVGKeyEventImpl::SVGKeyEventImpl() : SVGUIEventImpl() -{ - qKeyEvent = 0; -} - -SVGKeyEventImpl::SVGKeyEventImpl(TQKeyEvent *key, DOM::AbstractView &view, SVGEvent::EventId _id) : SVGUIEventImpl(_id, true, true, view, 0) -{ - qKeyEvent = new TQKeyEvent(key->type(), key->key(), key->ascii(), key->state(), key->text(), key->isAutoRepeat(), key->count()); - - // Events are supposed to be accepted by default in TQt! - // This line made TQLineEdit's keyevents be ignored, so they were sent to the tdehtmlview - // (and e.g. space would make it scroll down) - //qKeyEvent->ignore(); - - m_detail = key->count(); - - m_numPad = false; - m_keyVal = 0; - m_virtKeyVal = DOM_VK_UNDEFINED; - m_inputGenerated = true; - - switch(key->key()) - { - case TQt::Key_Enter: - m_numPad = true; - /* fall through */ - case TQt::Key_Return: - m_virtKeyVal = DOM_VK_ENTER; - break; - case TQt::Key_NumLock: - m_numPad = true; - m_virtKeyVal = DOM_VK_NUM_LOCK; - break; - case TQt::Key_Alt: - m_virtKeyVal = DOM_VK_RIGHT_ALT; - // ### DOM_VK_LEFT_ALT; - break; - case TQt::Key_Control: - m_virtKeyVal = DOM_VK_LEFT_CONTROL; - // ### DOM_VK_RIGHT_CONTROL - break; - case TQt::Key_Shift: - m_virtKeyVal = DOM_VK_LEFT_SHIFT; - // ### DOM_VK_RIGHT_SHIFT - break; - case TQt::Key_Meta: - m_virtKeyVal = DOM_VK_LEFT_META; - // ### DOM_VK_RIGHT_META - break; - case TQt::Key_CapsLock: - m_virtKeyVal = DOM_VK_CAPS_LOCK; - break; - case TQt::Key_Delete: - m_virtKeyVal = DOM_VK_DELETE; - break; - case TQt::Key_End: - m_virtKeyVal = DOM_VK_END; - break; - case TQt::Key_Escape: - m_virtKeyVal = DOM_VK_ESCAPE; - break; - case TQt::Key_Home: - m_virtKeyVal = DOM_VK_HOME; - break; - case TQt::Key_Insert: - m_virtKeyVal = DOM_VK_INSERT; - break; - case TQt::Key_Pause: - m_virtKeyVal = DOM_VK_PAUSE; - break; - case TQt::Key_Print: - m_virtKeyVal = DOM_VK_PRINTSCREEN; - break; - case TQt::Key_ScrollLock: - m_virtKeyVal = DOM_VK_SCROLL_LOCK; - break; - case TQt::Key_Left: - m_virtKeyVal = DOM_VK_LEFT; - break; - case TQt::Key_Right: - m_virtKeyVal = DOM_VK_RIGHT; - break; - case TQt::Key_Up: - m_virtKeyVal = DOM_VK_UP; - break; - case TQt::Key_Down: - m_virtKeyVal = DOM_VK_DOWN; - break; - case TQt::Key_Next: - m_virtKeyVal = DOM_VK_PAGE_DOWN; - break; - case TQt::Key_Prior: - m_virtKeyVal = DOM_VK_PAGE_UP; - break; - case TQt::Key_F1: - m_virtKeyVal = DOM_VK_F1; - break; - case TQt::Key_F2: - m_virtKeyVal = DOM_VK_F2; - break; - case TQt::Key_F3: - m_virtKeyVal = DOM_VK_F3; - break; - case TQt::Key_F4: - m_virtKeyVal = DOM_VK_F4; - break; - case TQt::Key_F5: - m_virtKeyVal = DOM_VK_F5; - break; - case TQt::Key_F6: - m_virtKeyVal = DOM_VK_F6; - break; - case TQt::Key_F7: - m_virtKeyVal = DOM_VK_F7; - break; - case TQt::Key_F8: - m_virtKeyVal = DOM_VK_F8; - break; - case TQt::Key_F9: - m_virtKeyVal = DOM_VK_F9; - break; - case TQt::Key_F10: - m_virtKeyVal = DOM_VK_F10; - break; - case TQt::Key_F11: - m_virtKeyVal = DOM_VK_F11; - break; - case TQt::Key_F12: - m_virtKeyVal = DOM_VK_F12; - break; - case TQt::Key_F13: - m_virtKeyVal = DOM_VK_F13; - break; - case TQt::Key_F14: - m_virtKeyVal = DOM_VK_F14; - break; - case TQt::Key_F15: - m_virtKeyVal = DOM_VK_F15; - break; - case TQt::Key_F16: - m_virtKeyVal = DOM_VK_F16; - break; - case TQt::Key_F17: - m_virtKeyVal = DOM_VK_F17; - break; - case TQt::Key_F18: - m_virtKeyVal = DOM_VK_F18; - break; - case TQt::Key_F19: - m_virtKeyVal = DOM_VK_F19; - break; - case TQt::Key_F20: - m_virtKeyVal = DOM_VK_F20; - break; - case TQt::Key_F21: - m_virtKeyVal = DOM_VK_F21; - break; - case TQt::Key_F22: - m_virtKeyVal = DOM_VK_F22; - break; - case TQt::Key_F23: - m_virtKeyVal = DOM_VK_F23; - break; - case TQt::Key_F24: - m_virtKeyVal = DOM_VK_F24; - break; - default: - m_virtKeyVal = DOM_VK_UNDEFINED; - break; - } - - // m_keyVal should contain the unicode value - // of the pressed key if available. - if (!key->text().isNull()) - m_keyVal = TQString(key->text()).unicode()[0]; - - // m_numPad = ??? - - // key->state returns enum ButtonState, which is ShiftButton, ControlButton and AltButton or'ed together. - m_modifier = key->state(); - - // key->text() returns the unicode sequence as a TQString - m_outputString = DOM::DOMString(key->text()); -} - -SVGKeyEventImpl::SVGKeyEventImpl(SVGEvent::EventId _id, - bool canBubbleArg, - bool cancelableArg, - DOM::AbstractView &viewArg, - unsigned short detailArg, - DOM::DOMString &outputStringArg, - unsigned long keyValArg, - unsigned long virtKeyValArg, - bool inputGeneratedArg, - bool numPadArg) -: SVGUIEventImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg) -{ - qKeyEvent = 0; - m_keyVal = keyValArg; - m_virtKeyVal = virtKeyValArg; - m_inputGenerated = inputGeneratedArg; - m_outputString = outputStringArg; - m_numPad = numPadArg; - m_modifier = 0; -} - -SVGKeyEventImpl::~SVGKeyEventImpl() -{ - delete qKeyEvent; -} - -bool SVGKeyEventImpl::checkModifier(unsigned long modifierArg) -{ - return ((m_modifier && modifierArg) == modifierArg); -} - -void SVGKeyEventImpl::initKeyEvent(DOM::DOMString &typeArg, - bool canBubbleArg, - bool cancelableArg, - const DOM::AbstractView &viewArg, - long detailArg, - DOM::DOMString &outputStringArg, - unsigned long keyValArg, - unsigned long virtKeyValArg, - bool inputGeneratedArg, - bool numPadArg) -{ - SVGUIEventImpl::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg); - - m_outputString = outputStringArg; - m_keyVal = keyValArg; - m_virtKeyVal = virtKeyValArg; - m_inputGenerated = inputGeneratedArg; - m_numPad = numPadArg; -} - -void SVGKeyEventImpl::initModifier(unsigned long modifierArg, bool valueArg) -{ - if(valueArg) - m_modifier |= modifierArg; - else - m_modifier &= (modifierArg ^ 0xFFFFFFFF); -} - -bool SVGKeyEventImpl::inputGenerated() const -{ - return m_inputGenerated; -} - -unsigned long SVGKeyEventImpl::keyVal() const -{ - return m_keyVal; -} - -DOM::DOMString SVGKeyEventImpl::outputString() const -{ - return m_outputString; -} - -/* -@namespace KSVG -@begin SVGKeyEventImpl::s_hashTable 7 - keyVal SVGKeyEventImpl::KeyVal DontDelete|ReadOnly - keyCode SVGKeyEventImpl::KeyVal DontDelete|ReadOnly - charCode SVGKeyEventImpl::KeyVal DontDelete|ReadOnly - outputString SVGKeyEventImpl::OutputString DontDelete|ReadOnly - virtKeyVal SVGKeyEventImpl::VirtKeyVal DontDelete|ReadOnly -# todo visibleOutputGenerated numPad -@end -@namespace KSVG -@begin SVGKeyEventImplProto::s_hashTable 7 - checkModifier SVGKeyEventImpl::CheckModifier DontDelete|Function 1 - getKeyCode SVGKeyEventImpl::GetKeyVal DontDelete|Function 0 - getCharCode SVGKeyEventImpl::GetKeyVal DontDelete|Function 0 - getKeyVal SVGKeyEventImpl::GetKeyVal DontDelete|Function 0 - getCharCode SVGKeyEventImpl::GetCharCode DontDelete|Function 0 -# todo initModifier -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGKeyEvent", SVGKeyEventImplProto, SVGKeyEventImplProtoFunc) - -Value SVGKeyEventImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case KeyVal: - return Number(keyVal()); - case VirtKeyVal: - return Number(virtKeyVal()); - case OutputString: - return String(outputString()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGKeyEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGKeyEventImpl) - - switch(id) - { - case SVGKeyEventImpl::CheckModifier: - return Boolean((static_cast *>(static_cast(thisObj.imp()))->impl())->checkModifier(args[0].toUInt32(exec))); - case SVGKeyEventImpl::GetKeyVal: - case SVGKeyEventImpl::GetCharCode: - return Number((static_cast *>(static_cast(thisObj.imp()))->impl())->keyVal()); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - - - -// ----------------------------------------------------------------------------- - -SVGMouseEventImpl::SVGMouseEventImpl() : SVGUIEventImpl() -{ - m_screenX = 0; - m_screenY = 0; - m_clientX = 0; - m_clientY = 0; - m_ctrlKey = false; - m_altKey = false; - m_shiftKey = false; - m_metaKey = false; - m_button = 0; -} - -SVGMouseEventImpl::SVGMouseEventImpl(SVGEvent::EventId _id, - bool canBubbleArg, - bool cancelableArg, - DOM::AbstractView &viewArg, - long detailArg, - long screenXArg, - long screenYArg, - long clientXArg, - long clientYArg, - bool ctrlKeyArg, - bool altKeyArg, - bool shiftKeyArg, - bool metaKeyArg, - unsigned short buttonArg, - SVGElementImpl *relatedTargetArg) -: SVGUIEventImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg) -{ - m_screenX = screenXArg; - m_screenY = screenYArg; - m_clientX = clientXArg; - m_clientY = clientYArg; - m_ctrlKey = ctrlKeyArg; - m_altKey = altKeyArg; - m_shiftKey = shiftKeyArg; - m_metaKey = metaKeyArg; - m_button = buttonArg; - m_relatedTarget = relatedTargetArg; -} - -SVGMouseEventImpl::~SVGMouseEventImpl() -{ -} - -long SVGMouseEventImpl::screenX() const -{ - return m_screenX; -} - -long SVGMouseEventImpl::screenY() const -{ - return m_screenY; -} - -long SVGMouseEventImpl::clientX() const -{ - return m_clientX; -} - -long SVGMouseEventImpl::clientY() const -{ - return m_clientY; -} - -bool SVGMouseEventImpl::ctrlKey() const -{ - return m_ctrlKey; -} - -bool SVGMouseEventImpl::shiftKey() const -{ - return m_shiftKey; -} - -bool SVGMouseEventImpl::altKey() const -{ - return m_altKey; -} - -bool SVGMouseEventImpl::metaKey() const -{ - return m_metaKey; -} - -unsigned short SVGMouseEventImpl::button() const -{ - return m_button; -} - -SVGElementImpl *SVGMouseEventImpl::relatedTarget() const -{ - return m_relatedTarget; -} - -DOM::DOMString SVGMouseEventImpl::url() const -{ - return m_url; -} - -void SVGMouseEventImpl::setURL(DOM::DOMString url) -{ - m_url = url; -} - -void SVGMouseEventImpl::initMouseEvent(const DOM::DOMString &typeArg, - bool canBubbleArg, - bool cancelableArg, - const DOM::AbstractView &viewArg, - long detailArg, - long screenXArg, - long screenYArg, - long clientXArg, - long clientYArg, - bool ctrlKeyArg, - bool altKeyArg, - bool shiftKeyArg, - bool metaKeyArg, - unsigned short buttonArg, - SVGElementImpl *relatedTargetArg) -{ - SVGUIEventImpl::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg); - - m_screenX = screenXArg; - m_screenY = screenYArg; - m_clientX = clientXArg; - m_clientY = clientYArg; - m_ctrlKey = ctrlKeyArg; - m_altKey = altKeyArg; - m_shiftKey = shiftKeyArg; - m_metaKey = metaKeyArg; - m_button = buttonArg; - m_relatedTarget = relatedTargetArg; -} - -/* -@namespace KSVG -@begin SVGMouseEventImpl::s_hashTable 11 - screenX SVGMouseEventImpl::ScreenX DontDelete|ReadOnly - screenY SVGMouseEventImpl::ScreenY DontDelete|ReadOnly - clientX SVGMouseEventImpl::ClientX DontDelete|ReadOnly - clientY SVGMouseEventImpl::ClientY DontDelete|ReadOnly - ctrlKey SVGMouseEventImpl::CtrlKey DontDelete|ReadOnly - shiftKey SVGMouseEventImpl::ShiftKey DontDelete|ReadOnly - altKey SVGMouseEventImpl::AltKey DontDelete|ReadOnly - metaKey SVGMouseEventImpl::MetaKey DontDelete|ReadOnly - button SVGMouseEventImpl::Button DontDelete|ReadOnly - relatedTarget SVGMouseEventImpl::RelatedTarget DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGMouseEventImplProto::s_hashTable 13 - getScreenX SVGMouseEventImpl::GetScreenX DontDelete|Function 0 - getScreenY SVGMouseEventImpl::GetScreenY DontDelete|Function 0 - getClientX SVGMouseEventImpl::GetClientX DontDelete|Function 0 - getClientY SVGMouseEventImpl::GetClientY DontDelete|Function 0 - getCtrlKey SVGMouseEventImpl::GetCtrlKey DontDelete|Function 0 - getShiftKey SVGMouseEventImpl::GetShiftKey DontDelete|Function 0 - getAltKey SVGMouseEventImpl::GetAltKey DontDelete|Function 0 - getMetaKey SVGMouseEventImpl::GetMetaKey DontDelete|Function 0 - getButton SVGMouseEventImpl::GetButton DontDelete|Function 0 - getRelatedTarget SVGMouseEventImpl::GetRelatedTarget DontDelete|Function 0 - initMouseEvent SVGMouseEventImpl::InitMouseEvent DontDelete|Function 15 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGMouseEvent", SVGMouseEventImplProto, SVGMouseEventImplProtoFunc) - -Value SVGMouseEventImpl::getValueProperty(ExecState *exec, int token) const -{ - kdDebug(26004) << k_funcinfo << endl; - switch(token) - { - case ScreenX: - return Number(screenX()); - case ScreenY: - return Number(screenY()); - case ClientX: - return Number(clientX()); - case ClientY: - return Number(clientY()); - case CtrlKey: - return Number(ctrlKey()); - case ShiftKey: - return Number(shiftKey()); - case AltKey: - return Number(altKey()); - case MetaKey: - return Number(metaKey()); - case Button: - return Number(button()); - case RelatedTarget: - return getDOMNode(exec, *relatedTarget()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return KJS::Undefined(); - } -} - -Value SVGMouseEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) -{ - kdDebug(26004) << k_funcinfo << endl; - KSVG_CHECK_THIS(SVGMouseEventImpl) - - switch(id) - { - case SVGMouseEventImpl::GetScreenX: - return Number(obj->screenX()); - case SVGMouseEventImpl::GetScreenY: - return Number(obj->screenY()); - case SVGMouseEventImpl::GetClientX: - return Number(obj->clientX()); - case SVGMouseEventImpl::GetClientY: - return Number(obj->clientY()); - case SVGMouseEventImpl::GetCtrlKey: - return Number(obj->ctrlKey()); - case SVGMouseEventImpl::GetShiftKey: - return Number(obj->shiftKey()); - case SVGMouseEventImpl::GetAltKey: - return Number(obj->altKey()); - case SVGMouseEventImpl::GetMetaKey: - return Number(obj->metaKey()); - case SVGMouseEventImpl::GetButton: - return Number(obj->button()); - case SVGMouseEventImpl::GetRelatedTarget: - return getDOMNode(exec, *obj->relatedTarget()); -// case SVGMouseEventImpl::InitMouseEvent: // TODO - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - - - - -SVGMutationEventImpl::SVGMutationEventImpl() : SVGEventImpl() -{ - m_attrChange = 0; -} - -SVGMutationEventImpl::SVGMutationEventImpl(SVGEvent::EventId _id, - bool canBubbleArg, - bool cancelableArg, - SVGElementImpl *relatedNodeArg, - const DOM::DOMString &prevValueArg, - const DOM::DOMString &newValueArg, - const DOM::DOMString &attrNameArg, - unsigned short attrChangeArg) -: SVGEventImpl(_id, canBubbleArg, cancelableArg) -{ - m_relatedNode = relatedNodeArg; - m_prevValue = prevValueArg.implementation(); - m_newValue = newValueArg.implementation(); - m_attrName = attrNameArg.implementation(); - m_attrChange = attrChangeArg; -} - -SVGMutationEventImpl::~SVGMutationEventImpl() -{ -} - -SVGElementImpl *SVGMutationEventImpl::relatedNode() const -{ - return m_relatedNode; -} - -DOM::DOMString SVGMutationEventImpl::prevValue() const -{ - return m_prevValue; -} - -DOM::DOMString SVGMutationEventImpl::newValue() const -{ - return m_newValue; -} - -DOM::DOMString SVGMutationEventImpl::attrName() const -{ - return m_attrName; -} - -unsigned short SVGMutationEventImpl::attrChange() const -{ - return m_attrChange; -} - -void SVGMutationEventImpl::initMutationEvent(const DOM::DOMString &typeArg, - bool canBubbleArg, - bool cancelableArg, - SVGElementImpl *relatedNodeArg, - const DOM::DOMString &prevValueArg, - const DOM::DOMString &newValueArg, - const DOM::DOMString &attrNameArg, - unsigned short attrChangeArg) -{ - SVGEventImpl::initEvent(typeArg, canBubbleArg, cancelableArg); - - m_relatedNode = relatedNodeArg; - m_prevValue = prevValueArg.implementation(); - m_newValue = newValueArg.implementation(); - m_attrName = attrNameArg.implementation(); - m_attrChange = attrChangeArg; -} - - - - - -SVGRegisteredEventListener::SVGRegisteredEventListener(SVGEvent::EventId _id, SVGEventListener *_listener, bool _useCapture) -{ - id = _id; - listener = _listener; - useCapture = _useCapture; - - listener->ref(); -} - -SVGRegisteredEventListener::~SVGRegisteredEventListener() -{ - listener->deref(); -} - -bool SVGRegisteredEventListener::operator==(const SVGRegisteredEventListener &other) -{ - return (id == other.id && - listener == other.listener && - useCapture == other.useCapture); -} diff --git a/ksvg/impl/SVGEventImpl.cpp b/ksvg/impl/SVGEventImpl.cpp new file mode 100644 index 00000000..9ff61abc --- /dev/null +++ b/ksvg/impl/SVGEventImpl.cpp @@ -0,0 +1,990 @@ +/* + Copyright (C) 2001-2003 KSVG Team + This file is part of the KDE project + + Additional copyright: + (C) 2001 Peter Kelly + (C) 2001 Tobias Anton + + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDocumentImpl.h" +#include "SVGEventImpl.h" + +#include + +using namespace KSVG; + +#include "ksvg_scriptinterpreter.h" +#include "SVGEventImpl.lut.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGEventImpl::SVGEventImpl() +{ + m_canBubble = false; + m_cancelable = false; + + m_propagationStopped = false; + m_defaultPrevented = false; + m_id = SVGEvent::UNKNOWN_EVENT; + m_eventPhase = 0; + m_createTime = TQDateTime::currentDateTime(); + m_defaultHandled = false; + + m_target = 0; + m_currentTarget = 0; +} + +SVGEventImpl::SVGEventImpl(SVGEvent::EventId _id, bool canBubbleArg, bool cancelableArg) +{ + DOM::DOMString t = SVGEvent::idToType(_id); + m_type = t.implementation(); + + m_canBubble = canBubbleArg; + m_cancelable = cancelableArg; + + m_propagationStopped = false; + m_defaultPrevented = false; + m_id = _id; + m_eventPhase = 0; + m_createTime = TQDateTime::currentDateTime(); + m_defaultHandled = false; + + m_target = 0; + m_currentTarget = 0; +} + +SVGEventImpl::~SVGEventImpl() +{ +} + +DOM::DOMString SVGEventImpl::type() const +{ + return m_type; +} + +SVGElementImpl *SVGEventImpl::target() const +{ + return m_target; +} + +void SVGEventImpl::setTarget(SVGElementImpl *_target) +{ + m_target = _target; +} + +SVGElementImpl *SVGEventImpl::currentTarget() const +{ + return m_currentTarget; +} + +void SVGEventImpl::setCurrentTarget(SVGElementImpl *_currentTarget) +{ + m_currentTarget = _currentTarget; +} + +unsigned short SVGEventImpl::eventPhase() const +{ + return m_eventPhase; +} + +void SVGEventImpl::setEventPhase(unsigned short _eventPhase) +{ + m_eventPhase = _eventPhase; +} + +bool SVGEventImpl::bubbles() const +{ + return m_canBubble; +} + +bool SVGEventImpl::cancelable() const +{ + return m_cancelable; +} + +DOM::DOMTimeStamp SVGEventImpl::timeStamp() +{ + TQDateTime epoch(TQDate(1970, 1, 1), TQTime(0, 0)); + + // ### kjs does not yet support long long (?) so the value wraps around + return epoch.secsTo(m_createTime) * 1000 + m_createTime.time().msec(); +} + +void SVGEventImpl::stopPropagation() +{ + m_propagationStopped = true; +} + +void SVGEventImpl::preventDefault() +{ + if(m_cancelable) + m_defaultPrevented = true; +} + +void SVGEventImpl::initEvent(const DOM::DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg) +{ + // ### ensure this is not called after we have been dispatched (also for subclasses) + m_type = eventTypeArg.implementation(); + m_id = SVGEvent::typeToId(eventTypeArg); + + m_canBubble = canBubbleArg; + m_cancelable = cancelableArg; +} + +void SVGEventImpl::setDefaultHandled() +{ + m_defaultHandled = true; +} + +/* +@namespace KSVG +@begin SVGEventImpl::s_hashTable 11 + type SVGEventImpl::Type DontDelete|ReadOnly + target SVGEventImpl::Target DontDelete|ReadOnly + currentTarget SVGEventImpl::CurrentTarget DontDelete|ReadOnly + eventPhase SVGEventImpl::EventPhase DontDelete|ReadOnly + bubbles SVGEventImpl::Bubbles DontDelete|ReadOnly + cancelable SVGEventImpl::Cancelable DontDelete|ReadOnly + timeStamp SVGEventImpl::TimeStamp DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGEventImplProto::s_hashTable 13 + getType SVGEventImpl::GetType DontDelete|Function 0 + getTarget SVGEventImpl::GetTarget DontDelete|Function 0 + getCurrentTarget SVGEventImpl::GetCurrentTarget DontDelete|Function 0 + getCurrentNode SVGEventImpl::GetCurrentNode DontDelete|Function 0 + getEventphase SVGEventImpl::GetEventPhase DontDelete|Function 0 + getBubbles SVGEventImpl::GetBubbles DontDelete|Function 0 + getCancelable SVGEventImpl::GetCancelable DontDelete|Function 0 + getTimeStamp SVGEventImpl::GetTimeStamp DontDelete|Function 0 + stopPropagation SVGEventImpl::StopPropagation DontDelete|Function 0 + preventDefault SVGEventImpl::PreventDefault DontDelete|Function 0 + initEvent SVGEventImpl::InitEvent DontDelete|Function 3 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGEvent", SVGEventImplProto, SVGEventImplProtoFunc) + +Value SVGEventImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case Type: + return String(type()); + case Target: + return getDOMNode(exec, *target()); + case CurrentTarget: + return getDOMNode(exec, *currentTarget()); + case EventPhase: + return Number(eventPhase()); + case Bubbles: + return Boolean(bubbles()); + case Cancelable: + return Boolean(cancelable()); +// case TimeStamp: // TODO + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return KJS::Undefined(); + } +} + +Value SVGEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGEventImpl) + + switch(id) + { + case SVGEventImpl::GetType: + return String(obj->type()); + case SVGEventImpl::GetTarget: + return getDOMNode(exec, *obj->target()); + case SVGEventImpl::GetCurrentTarget: + case SVGEventImpl::GetCurrentNode: + return getDOMNode(exec, *obj->currentTarget()); + case SVGEventImpl::GetEventPhase: + return Number(obj->eventPhase()); + case SVGEventImpl::GetBubbles: + return Boolean(obj->bubbles()); + case SVGEventImpl::GetCancelable: + return Boolean(obj->cancelable()); +// case SVGEventImpl::GetTimeStamp: // TODO + case SVGEventImpl::StopPropagation: + { + obj->stopPropagation(); + return Undefined(); + } + case SVGEventImpl::PreventDefault: + { + obj->preventDefault(); + return Undefined(); + } + case SVGEventImpl::InitEvent: + { + obj->initEvent(args[0].toString(exec).string(), args[1].toBoolean(exec), args[2].toBoolean(exec)); + return Undefined(); + } + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + + + + + +SVGUIEventImpl::SVGUIEventImpl() : SVGEventImpl() +{ + m_detail = 0; +} + +SVGUIEventImpl::SVGUIEventImpl(SVGEvent::EventId _id, bool canBubbleArg, bool cancelableArg, DOM::AbstractView &viewArg, long detailArg) +: SVGEventImpl(_id, canBubbleArg, cancelableArg) +{ + m_view = viewArg; + m_detail = detailArg; +} + +SVGUIEventImpl::~SVGUIEventImpl() +{ +} + +DOM::AbstractView SVGUIEventImpl::view() const +{ + return m_view; +} + +long SVGUIEventImpl::detail() const +{ + return m_detail; +} + +void SVGUIEventImpl::initUIEvent(const DOM::DOMString &typeArg, + bool canBubbleArg, + bool cancelableArg, + const DOM::AbstractView &viewArg, + long detailArg) +{ + SVGEventImpl::initEvent(typeArg, canBubbleArg, cancelableArg); + + m_view = viewArg; + m_detail = detailArg; +} + +/* +@namespace KSVG +@begin SVGUIEventImpl::s_hashTable 3 + view SVGUIEventImpl::View DontDelete|ReadOnly + detail SVGUIEventImpl::Detail DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGUIEventImplProto::s_hashTable 5 + getView SVGUIEventImpl::GetView DontDelete|Function 0 + getDetail SVGUIEventImpl::GetDetail DontDelete|Function 0 + initUIEvent SVGUIEventImpl::InitUIEvent DontDelete|Function 5 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGUIEvent", SVGUIEventImplProto, SVGUIEventImplProtoFunc) + +Value SVGUIEventImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { +// case View: // TODO + case Detail: + return Number(detail()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return KJS::Undefined(); + } +} + +Value SVGUIEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) +{ + KSVG_CHECK_THIS(SVGUIEventImpl) + + switch(id) + { +// case SVGUIEventImpl::GetView: // TODO + case SVGUIEventImpl::GetDetail: + return Number(obj->detail()); +// case SVGUIEventImpl::InitUIEvent: // TODO + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +SVGKeyEventImpl::SVGKeyEventImpl() : SVGUIEventImpl() +{ + qKeyEvent = 0; +} + +SVGKeyEventImpl::SVGKeyEventImpl(TQKeyEvent *key, DOM::AbstractView &view, SVGEvent::EventId _id) : SVGUIEventImpl(_id, true, true, view, 0) +{ + qKeyEvent = new TQKeyEvent(key->type(), key->key(), key->ascii(), key->state(), key->text(), key->isAutoRepeat(), key->count()); + + // Events are supposed to be accepted by default in TQt! + // This line made TQLineEdit's keyevents be ignored, so they were sent to the tdehtmlview + // (and e.g. space would make it scroll down) + //qKeyEvent->ignore(); + + m_detail = key->count(); + + m_numPad = false; + m_keyVal = 0; + m_virtKeyVal = DOM_VK_UNDEFINED; + m_inputGenerated = true; + + switch(key->key()) + { + case TQt::Key_Enter: + m_numPad = true; + /* fall through */ + case TQt::Key_Return: + m_virtKeyVal = DOM_VK_ENTER; + break; + case TQt::Key_NumLock: + m_numPad = true; + m_virtKeyVal = DOM_VK_NUM_LOCK; + break; + case TQt::Key_Alt: + m_virtKeyVal = DOM_VK_RIGHT_ALT; + // ### DOM_VK_LEFT_ALT; + break; + case TQt::Key_Control: + m_virtKeyVal = DOM_VK_LEFT_CONTROL; + // ### DOM_VK_RIGHT_CONTROL + break; + case TQt::Key_Shift: + m_virtKeyVal = DOM_VK_LEFT_SHIFT; + // ### DOM_VK_RIGHT_SHIFT + break; + case TQt::Key_Meta: + m_virtKeyVal = DOM_VK_LEFT_META; + // ### DOM_VK_RIGHT_META + break; + case TQt::Key_CapsLock: + m_virtKeyVal = DOM_VK_CAPS_LOCK; + break; + case TQt::Key_Delete: + m_virtKeyVal = DOM_VK_DELETE; + break; + case TQt::Key_End: + m_virtKeyVal = DOM_VK_END; + break; + case TQt::Key_Escape: + m_virtKeyVal = DOM_VK_ESCAPE; + break; + case TQt::Key_Home: + m_virtKeyVal = DOM_VK_HOME; + break; + case TQt::Key_Insert: + m_virtKeyVal = DOM_VK_INSERT; + break; + case TQt::Key_Pause: + m_virtKeyVal = DOM_VK_PAUSE; + break; + case TQt::Key_Print: + m_virtKeyVal = DOM_VK_PRINTSCREEN; + break; + case TQt::Key_ScrollLock: + m_virtKeyVal = DOM_VK_SCROLL_LOCK; + break; + case TQt::Key_Left: + m_virtKeyVal = DOM_VK_LEFT; + break; + case TQt::Key_Right: + m_virtKeyVal = DOM_VK_RIGHT; + break; + case TQt::Key_Up: + m_virtKeyVal = DOM_VK_UP; + break; + case TQt::Key_Down: + m_virtKeyVal = DOM_VK_DOWN; + break; + case TQt::Key_Next: + m_virtKeyVal = DOM_VK_PAGE_DOWN; + break; + case TQt::Key_Prior: + m_virtKeyVal = DOM_VK_PAGE_UP; + break; + case TQt::Key_F1: + m_virtKeyVal = DOM_VK_F1; + break; + case TQt::Key_F2: + m_virtKeyVal = DOM_VK_F2; + break; + case TQt::Key_F3: + m_virtKeyVal = DOM_VK_F3; + break; + case TQt::Key_F4: + m_virtKeyVal = DOM_VK_F4; + break; + case TQt::Key_F5: + m_virtKeyVal = DOM_VK_F5; + break; + case TQt::Key_F6: + m_virtKeyVal = DOM_VK_F6; + break; + case TQt::Key_F7: + m_virtKeyVal = DOM_VK_F7; + break; + case TQt::Key_F8: + m_virtKeyVal = DOM_VK_F8; + break; + case TQt::Key_F9: + m_virtKeyVal = DOM_VK_F9; + break; + case TQt::Key_F10: + m_virtKeyVal = DOM_VK_F10; + break; + case TQt::Key_F11: + m_virtKeyVal = DOM_VK_F11; + break; + case TQt::Key_F12: + m_virtKeyVal = DOM_VK_F12; + break; + case TQt::Key_F13: + m_virtKeyVal = DOM_VK_F13; + break; + case TQt::Key_F14: + m_virtKeyVal = DOM_VK_F14; + break; + case TQt::Key_F15: + m_virtKeyVal = DOM_VK_F15; + break; + case TQt::Key_F16: + m_virtKeyVal = DOM_VK_F16; + break; + case TQt::Key_F17: + m_virtKeyVal = DOM_VK_F17; + break; + case TQt::Key_F18: + m_virtKeyVal = DOM_VK_F18; + break; + case TQt::Key_F19: + m_virtKeyVal = DOM_VK_F19; + break; + case TQt::Key_F20: + m_virtKeyVal = DOM_VK_F20; + break; + case TQt::Key_F21: + m_virtKeyVal = DOM_VK_F21; + break; + case TQt::Key_F22: + m_virtKeyVal = DOM_VK_F22; + break; + case TQt::Key_F23: + m_virtKeyVal = DOM_VK_F23; + break; + case TQt::Key_F24: + m_virtKeyVal = DOM_VK_F24; + break; + default: + m_virtKeyVal = DOM_VK_UNDEFINED; + break; + } + + // m_keyVal should contain the unicode value + // of the pressed key if available. + if (!key->text().isNull()) + m_keyVal = TQString(key->text()).unicode()[0]; + + // m_numPad = ??? + + // key->state returns enum ButtonState, which is ShiftButton, ControlButton and AltButton or'ed together. + m_modifier = key->state(); + + // key->text() returns the unicode sequence as a TQString + m_outputString = DOM::DOMString(key->text()); +} + +SVGKeyEventImpl::SVGKeyEventImpl(SVGEvent::EventId _id, + bool canBubbleArg, + bool cancelableArg, + DOM::AbstractView &viewArg, + unsigned short detailArg, + DOM::DOMString &outputStringArg, + unsigned long keyValArg, + unsigned long virtKeyValArg, + bool inputGeneratedArg, + bool numPadArg) +: SVGUIEventImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg) +{ + qKeyEvent = 0; + m_keyVal = keyValArg; + m_virtKeyVal = virtKeyValArg; + m_inputGenerated = inputGeneratedArg; + m_outputString = outputStringArg; + m_numPad = numPadArg; + m_modifier = 0; +} + +SVGKeyEventImpl::~SVGKeyEventImpl() +{ + delete qKeyEvent; +} + +bool SVGKeyEventImpl::checkModifier(unsigned long modifierArg) +{ + return ((m_modifier && modifierArg) == modifierArg); +} + +void SVGKeyEventImpl::initKeyEvent(DOM::DOMString &typeArg, + bool canBubbleArg, + bool cancelableArg, + const DOM::AbstractView &viewArg, + long detailArg, + DOM::DOMString &outputStringArg, + unsigned long keyValArg, + unsigned long virtKeyValArg, + bool inputGeneratedArg, + bool numPadArg) +{ + SVGUIEventImpl::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg); + + m_outputString = outputStringArg; + m_keyVal = keyValArg; + m_virtKeyVal = virtKeyValArg; + m_inputGenerated = inputGeneratedArg; + m_numPad = numPadArg; +} + +void SVGKeyEventImpl::initModifier(unsigned long modifierArg, bool valueArg) +{ + if(valueArg) + m_modifier |= modifierArg; + else + m_modifier &= (modifierArg ^ 0xFFFFFFFF); +} + +bool SVGKeyEventImpl::inputGenerated() const +{ + return m_inputGenerated; +} + +unsigned long SVGKeyEventImpl::keyVal() const +{ + return m_keyVal; +} + +DOM::DOMString SVGKeyEventImpl::outputString() const +{ + return m_outputString; +} + +/* +@namespace KSVG +@begin SVGKeyEventImpl::s_hashTable 7 + keyVal SVGKeyEventImpl::KeyVal DontDelete|ReadOnly + keyCode SVGKeyEventImpl::KeyVal DontDelete|ReadOnly + charCode SVGKeyEventImpl::KeyVal DontDelete|ReadOnly + outputString SVGKeyEventImpl::OutputString DontDelete|ReadOnly + virtKeyVal SVGKeyEventImpl::VirtKeyVal DontDelete|ReadOnly +# todo visibleOutputGenerated numPad +@end +@namespace KSVG +@begin SVGKeyEventImplProto::s_hashTable 7 + checkModifier SVGKeyEventImpl::CheckModifier DontDelete|Function 1 + getKeyCode SVGKeyEventImpl::GetKeyVal DontDelete|Function 0 + getCharCode SVGKeyEventImpl::GetKeyVal DontDelete|Function 0 + getKeyVal SVGKeyEventImpl::GetKeyVal DontDelete|Function 0 + getCharCode SVGKeyEventImpl::GetCharCode DontDelete|Function 0 +# todo initModifier +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGKeyEvent", SVGKeyEventImplProto, SVGKeyEventImplProtoFunc) + +Value SVGKeyEventImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case KeyVal: + return Number(keyVal()); + case VirtKeyVal: + return Number(virtKeyVal()); + case OutputString: + return String(outputString()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGKeyEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGKeyEventImpl) + + switch(id) + { + case SVGKeyEventImpl::CheckModifier: + return Boolean((static_cast *>(static_cast(thisObj.imp()))->impl())->checkModifier(args[0].toUInt32(exec))); + case SVGKeyEventImpl::GetKeyVal: + case SVGKeyEventImpl::GetCharCode: + return Number((static_cast *>(static_cast(thisObj.imp()))->impl())->keyVal()); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + + + +// ----------------------------------------------------------------------------- + +SVGMouseEventImpl::SVGMouseEventImpl() : SVGUIEventImpl() +{ + m_screenX = 0; + m_screenY = 0; + m_clientX = 0; + m_clientY = 0; + m_ctrlKey = false; + m_altKey = false; + m_shiftKey = false; + m_metaKey = false; + m_button = 0; +} + +SVGMouseEventImpl::SVGMouseEventImpl(SVGEvent::EventId _id, + bool canBubbleArg, + bool cancelableArg, + DOM::AbstractView &viewArg, + long detailArg, + long screenXArg, + long screenYArg, + long clientXArg, + long clientYArg, + bool ctrlKeyArg, + bool altKeyArg, + bool shiftKeyArg, + bool metaKeyArg, + unsigned short buttonArg, + SVGElementImpl *relatedTargetArg) +: SVGUIEventImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg) +{ + m_screenX = screenXArg; + m_screenY = screenYArg; + m_clientX = clientXArg; + m_clientY = clientYArg; + m_ctrlKey = ctrlKeyArg; + m_altKey = altKeyArg; + m_shiftKey = shiftKeyArg; + m_metaKey = metaKeyArg; + m_button = buttonArg; + m_relatedTarget = relatedTargetArg; +} + +SVGMouseEventImpl::~SVGMouseEventImpl() +{ +} + +long SVGMouseEventImpl::screenX() const +{ + return m_screenX; +} + +long SVGMouseEventImpl::screenY() const +{ + return m_screenY; +} + +long SVGMouseEventImpl::clientX() const +{ + return m_clientX; +} + +long SVGMouseEventImpl::clientY() const +{ + return m_clientY; +} + +bool SVGMouseEventImpl::ctrlKey() const +{ + return m_ctrlKey; +} + +bool SVGMouseEventImpl::shiftKey() const +{ + return m_shiftKey; +} + +bool SVGMouseEventImpl::altKey() const +{ + return m_altKey; +} + +bool SVGMouseEventImpl::metaKey() const +{ + return m_metaKey; +} + +unsigned short SVGMouseEventImpl::button() const +{ + return m_button; +} + +SVGElementImpl *SVGMouseEventImpl::relatedTarget() const +{ + return m_relatedTarget; +} + +DOM::DOMString SVGMouseEventImpl::url() const +{ + return m_url; +} + +void SVGMouseEventImpl::setURL(DOM::DOMString url) +{ + m_url = url; +} + +void SVGMouseEventImpl::initMouseEvent(const DOM::DOMString &typeArg, + bool canBubbleArg, + bool cancelableArg, + const DOM::AbstractView &viewArg, + long detailArg, + long screenXArg, + long screenYArg, + long clientXArg, + long clientYArg, + bool ctrlKeyArg, + bool altKeyArg, + bool shiftKeyArg, + bool metaKeyArg, + unsigned short buttonArg, + SVGElementImpl *relatedTargetArg) +{ + SVGUIEventImpl::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg); + + m_screenX = screenXArg; + m_screenY = screenYArg; + m_clientX = clientXArg; + m_clientY = clientYArg; + m_ctrlKey = ctrlKeyArg; + m_altKey = altKeyArg; + m_shiftKey = shiftKeyArg; + m_metaKey = metaKeyArg; + m_button = buttonArg; + m_relatedTarget = relatedTargetArg; +} + +/* +@namespace KSVG +@begin SVGMouseEventImpl::s_hashTable 11 + screenX SVGMouseEventImpl::ScreenX DontDelete|ReadOnly + screenY SVGMouseEventImpl::ScreenY DontDelete|ReadOnly + clientX SVGMouseEventImpl::ClientX DontDelete|ReadOnly + clientY SVGMouseEventImpl::ClientY DontDelete|ReadOnly + ctrlKey SVGMouseEventImpl::CtrlKey DontDelete|ReadOnly + shiftKey SVGMouseEventImpl::ShiftKey DontDelete|ReadOnly + altKey SVGMouseEventImpl::AltKey DontDelete|ReadOnly + metaKey SVGMouseEventImpl::MetaKey DontDelete|ReadOnly + button SVGMouseEventImpl::Button DontDelete|ReadOnly + relatedTarget SVGMouseEventImpl::RelatedTarget DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGMouseEventImplProto::s_hashTable 13 + getScreenX SVGMouseEventImpl::GetScreenX DontDelete|Function 0 + getScreenY SVGMouseEventImpl::GetScreenY DontDelete|Function 0 + getClientX SVGMouseEventImpl::GetClientX DontDelete|Function 0 + getClientY SVGMouseEventImpl::GetClientY DontDelete|Function 0 + getCtrlKey SVGMouseEventImpl::GetCtrlKey DontDelete|Function 0 + getShiftKey SVGMouseEventImpl::GetShiftKey DontDelete|Function 0 + getAltKey SVGMouseEventImpl::GetAltKey DontDelete|Function 0 + getMetaKey SVGMouseEventImpl::GetMetaKey DontDelete|Function 0 + getButton SVGMouseEventImpl::GetButton DontDelete|Function 0 + getRelatedTarget SVGMouseEventImpl::GetRelatedTarget DontDelete|Function 0 + initMouseEvent SVGMouseEventImpl::InitMouseEvent DontDelete|Function 15 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGMouseEvent", SVGMouseEventImplProto, SVGMouseEventImplProtoFunc) + +Value SVGMouseEventImpl::getValueProperty(ExecState *exec, int token) const +{ + kdDebug(26004) << k_funcinfo << endl; + switch(token) + { + case ScreenX: + return Number(screenX()); + case ScreenY: + return Number(screenY()); + case ClientX: + return Number(clientX()); + case ClientY: + return Number(clientY()); + case CtrlKey: + return Number(ctrlKey()); + case ShiftKey: + return Number(shiftKey()); + case AltKey: + return Number(altKey()); + case MetaKey: + return Number(metaKey()); + case Button: + return Number(button()); + case RelatedTarget: + return getDOMNode(exec, *relatedTarget()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return KJS::Undefined(); + } +} + +Value SVGMouseEventImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) +{ + kdDebug(26004) << k_funcinfo << endl; + KSVG_CHECK_THIS(SVGMouseEventImpl) + + switch(id) + { + case SVGMouseEventImpl::GetScreenX: + return Number(obj->screenX()); + case SVGMouseEventImpl::GetScreenY: + return Number(obj->screenY()); + case SVGMouseEventImpl::GetClientX: + return Number(obj->clientX()); + case SVGMouseEventImpl::GetClientY: + return Number(obj->clientY()); + case SVGMouseEventImpl::GetCtrlKey: + return Number(obj->ctrlKey()); + case SVGMouseEventImpl::GetShiftKey: + return Number(obj->shiftKey()); + case SVGMouseEventImpl::GetAltKey: + return Number(obj->altKey()); + case SVGMouseEventImpl::GetMetaKey: + return Number(obj->metaKey()); + case SVGMouseEventImpl::GetButton: + return Number(obj->button()); + case SVGMouseEventImpl::GetRelatedTarget: + return getDOMNode(exec, *obj->relatedTarget()); +// case SVGMouseEventImpl::InitMouseEvent: // TODO + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + + + + +SVGMutationEventImpl::SVGMutationEventImpl() : SVGEventImpl() +{ + m_attrChange = 0; +} + +SVGMutationEventImpl::SVGMutationEventImpl(SVGEvent::EventId _id, + bool canBubbleArg, + bool cancelableArg, + SVGElementImpl *relatedNodeArg, + const DOM::DOMString &prevValueArg, + const DOM::DOMString &newValueArg, + const DOM::DOMString &attrNameArg, + unsigned short attrChangeArg) +: SVGEventImpl(_id, canBubbleArg, cancelableArg) +{ + m_relatedNode = relatedNodeArg; + m_prevValue = prevValueArg.implementation(); + m_newValue = newValueArg.implementation(); + m_attrName = attrNameArg.implementation(); + m_attrChange = attrChangeArg; +} + +SVGMutationEventImpl::~SVGMutationEventImpl() +{ +} + +SVGElementImpl *SVGMutationEventImpl::relatedNode() const +{ + return m_relatedNode; +} + +DOM::DOMString SVGMutationEventImpl::prevValue() const +{ + return m_prevValue; +} + +DOM::DOMString SVGMutationEventImpl::newValue() const +{ + return m_newValue; +} + +DOM::DOMString SVGMutationEventImpl::attrName() const +{ + return m_attrName; +} + +unsigned short SVGMutationEventImpl::attrChange() const +{ + return m_attrChange; +} + +void SVGMutationEventImpl::initMutationEvent(const DOM::DOMString &typeArg, + bool canBubbleArg, + bool cancelableArg, + SVGElementImpl *relatedNodeArg, + const DOM::DOMString &prevValueArg, + const DOM::DOMString &newValueArg, + const DOM::DOMString &attrNameArg, + unsigned short attrChangeArg) +{ + SVGEventImpl::initEvent(typeArg, canBubbleArg, cancelableArg); + + m_relatedNode = relatedNodeArg; + m_prevValue = prevValueArg.implementation(); + m_newValue = newValueArg.implementation(); + m_attrName = attrNameArg.implementation(); + m_attrChange = attrChangeArg; +} + + + + + +SVGRegisteredEventListener::SVGRegisteredEventListener(SVGEvent::EventId _id, SVGEventListener *_listener, bool _useCapture) +{ + id = _id; + listener = _listener; + useCapture = _useCapture; + + listener->ref(); +} + +SVGRegisteredEventListener::~SVGRegisteredEventListener() +{ + listener->deref(); +} + +bool SVGRegisteredEventListener::operator==(const SVGRegisteredEventListener &other) +{ + return (id == other.id && + listener == other.listener && + useCapture == other.useCapture); +} diff --git a/ksvg/impl/SVGExternalResourcesRequiredImpl.cc b/ksvg/impl/SVGExternalResourcesRequiredImpl.cc deleted file mode 100644 index 0303a75b..00000000 --- a/ksvg/impl/SVGExternalResourcesRequiredImpl.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGAnimatedBooleanImpl.h" -#include "SVGExternalResourcesRequiredImpl.h" - -using namespace KSVG; - -#include "SVGExternalResourcesRequiredImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGExternalResourcesRequiredImpl::SVGExternalResourcesRequiredImpl() -{ - KSVG_EMPTY_FLAGS - - m_externalResourcesRequired = new SVGAnimatedBooleanImpl(); - m_externalResourcesRequired->ref(); -} - -SVGExternalResourcesRequiredImpl::~SVGExternalResourcesRequiredImpl() -{ - if(m_externalResourcesRequired) - m_externalResourcesRequired->deref(); -} - -SVGAnimatedBooleanImpl *SVGExternalResourcesRequiredImpl::externalResourcesRequired() const -{ - return m_externalResourcesRequired; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGExternalResourcesRequiredImpl::s_hashTable 2 - externalResourcesRequired SVGExternalResourcesRequiredImpl::ExternalResourcesRequired DontDelete|ReadOnly -@end -*/ - -Value SVGExternalResourcesRequiredImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case ExternalResourcesRequired: - return m_externalResourcesRequired->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGExternalResourcesRequiredImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - switch(token) - { - case ExternalResourcesRequired: - m_externalResourcesRequired->setBaseVal(value.toBoolean(exec)); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGExternalResourcesRequiredImpl.cpp b/ksvg/impl/SVGExternalResourcesRequiredImpl.cpp new file mode 100644 index 00000000..0303a75b --- /dev/null +++ b/ksvg/impl/SVGExternalResourcesRequiredImpl.cpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGAnimatedBooleanImpl.h" +#include "SVGExternalResourcesRequiredImpl.h" + +using namespace KSVG; + +#include "SVGExternalResourcesRequiredImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGExternalResourcesRequiredImpl::SVGExternalResourcesRequiredImpl() +{ + KSVG_EMPTY_FLAGS + + m_externalResourcesRequired = new SVGAnimatedBooleanImpl(); + m_externalResourcesRequired->ref(); +} + +SVGExternalResourcesRequiredImpl::~SVGExternalResourcesRequiredImpl() +{ + if(m_externalResourcesRequired) + m_externalResourcesRequired->deref(); +} + +SVGAnimatedBooleanImpl *SVGExternalResourcesRequiredImpl::externalResourcesRequired() const +{ + return m_externalResourcesRequired; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGExternalResourcesRequiredImpl::s_hashTable 2 + externalResourcesRequired SVGExternalResourcesRequiredImpl::ExternalResourcesRequired DontDelete|ReadOnly +@end +*/ + +Value SVGExternalResourcesRequiredImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case ExternalResourcesRequired: + return m_externalResourcesRequired->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGExternalResourcesRequiredImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + switch(token) + { + case ExternalResourcesRequired: + m_externalResourcesRequired->setBaseVal(value.toBoolean(exec)); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGFEBlendElementImpl.cc b/ksvg/impl/SVGFEBlendElementImpl.cc deleted file mode 100644 index cec9cb88..00000000 --- a/ksvg/impl/SVGFEBlendElementImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEBlendElementImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedEnumerationImpl.h" - -using namespace KSVG; - -SVGFEBlendElementImpl::SVGFEBlendElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_in2 = new SVGAnimatedStringImpl(); - m_in2->ref(); - - m_mode = new SVGAnimatedEnumerationImpl(); - m_mode->ref(); -} - -SVGFEBlendElementImpl::~SVGFEBlendElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_in2) - m_in2->deref(); - if(m_mode) - m_mode->deref(); -} - -SVGAnimatedStringImpl *SVGFEBlendElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedStringImpl *SVGFEBlendElementImpl::in2() const -{ - return m_in2; -} - -SVGAnimatedEnumerationImpl *SVGFEBlendElementImpl::mode() const -{ - return m_mode; -} diff --git a/ksvg/impl/SVGFEBlendElementImpl.cpp b/ksvg/impl/SVGFEBlendElementImpl.cpp new file mode 100644 index 00000000..cec9cb88 --- /dev/null +++ b/ksvg/impl/SVGFEBlendElementImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEBlendElementImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedEnumerationImpl.h" + +using namespace KSVG; + +SVGFEBlendElementImpl::SVGFEBlendElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_in2 = new SVGAnimatedStringImpl(); + m_in2->ref(); + + m_mode = new SVGAnimatedEnumerationImpl(); + m_mode->ref(); +} + +SVGFEBlendElementImpl::~SVGFEBlendElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_in2) + m_in2->deref(); + if(m_mode) + m_mode->deref(); +} + +SVGAnimatedStringImpl *SVGFEBlendElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedStringImpl *SVGFEBlendElementImpl::in2() const +{ + return m_in2; +} + +SVGAnimatedEnumerationImpl *SVGFEBlendElementImpl::mode() const +{ + return m_mode; +} diff --git a/ksvg/impl/SVGFEColorMatrixElementImpl.cc b/ksvg/impl/SVGFEColorMatrixElementImpl.cc deleted file mode 100644 index 0bd0c542..00000000 --- a/ksvg/impl/SVGFEColorMatrixElementImpl.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedNumberListImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGFEColorMatrixElementImpl.h" - -using namespace KSVG; - -SVGFEColorMatrixElementImpl::SVGFEColorMatrixElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_type = new SVGAnimatedEnumerationImpl(); - m_type->ref(); - - m_values = new SVGAnimatedNumberListImpl(); - m_values->ref(); -} - -SVGFEColorMatrixElementImpl::~SVGFEColorMatrixElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_type) - m_type->deref(); - if(m_values) - m_values->deref(); -} - -SVGAnimatedStringImpl *SVGFEColorMatrixElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedEnumerationImpl *SVGFEColorMatrixElementImpl::type() const -{ - return m_type; -} - -SVGAnimatedNumberListImpl *SVGFEColorMatrixElementImpl::values() const -{ - return m_values; -} diff --git a/ksvg/impl/SVGFEColorMatrixElementImpl.cpp b/ksvg/impl/SVGFEColorMatrixElementImpl.cpp new file mode 100644 index 00000000..0bd0c542 --- /dev/null +++ b/ksvg/impl/SVGFEColorMatrixElementImpl.cpp @@ -0,0 +1,63 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedNumberListImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGFEColorMatrixElementImpl.h" + +using namespace KSVG; + +SVGFEColorMatrixElementImpl::SVGFEColorMatrixElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_type = new SVGAnimatedEnumerationImpl(); + m_type->ref(); + + m_values = new SVGAnimatedNumberListImpl(); + m_values->ref(); +} + +SVGFEColorMatrixElementImpl::~SVGFEColorMatrixElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_type) + m_type->deref(); + if(m_values) + m_values->deref(); +} + +SVGAnimatedStringImpl *SVGFEColorMatrixElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedEnumerationImpl *SVGFEColorMatrixElementImpl::type() const +{ + return m_type; +} + +SVGAnimatedNumberListImpl *SVGFEColorMatrixElementImpl::values() const +{ + return m_values; +} diff --git a/ksvg/impl/SVGFEComponentTransferElementImpl.cc b/ksvg/impl/SVGFEComponentTransferElementImpl.cc deleted file mode 100644 index cdc4a053..00000000 --- a/ksvg/impl/SVGFEComponentTransferElementImpl.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGFEComponentTransferElementImpl.h" - -using namespace KSVG; - -SVGFEComponentTransferElementImpl::SVGFEComponentTransferElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); -} - -SVGFEComponentTransferElementImpl::~SVGFEComponentTransferElementImpl() -{ - if(m_in1) - m_in1->deref(); -} - -SVGAnimatedStringImpl *SVGFEComponentTransferElementImpl::in1() const -{ - return m_in1; -} diff --git a/ksvg/impl/SVGFEComponentTransferElementImpl.cpp b/ksvg/impl/SVGFEComponentTransferElementImpl.cpp new file mode 100644 index 00000000..cdc4a053 --- /dev/null +++ b/ksvg/impl/SVGFEComponentTransferElementImpl.cpp @@ -0,0 +1,41 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGFEComponentTransferElementImpl.h" + +using namespace KSVG; + +SVGFEComponentTransferElementImpl::SVGFEComponentTransferElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); +} + +SVGFEComponentTransferElementImpl::~SVGFEComponentTransferElementImpl() +{ + if(m_in1) + m_in1->deref(); +} + +SVGAnimatedStringImpl *SVGFEComponentTransferElementImpl::in1() const +{ + return m_in1; +} diff --git a/ksvg/impl/SVGFECompositeElementImpl.cc b/ksvg/impl/SVGFECompositeElementImpl.cc deleted file mode 100644 index 0ddaed6e..00000000 --- a/ksvg/impl/SVGFECompositeElementImpl.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGFECompositeElementImpl.h" -#include "SVGAnimatedEnumerationImpl.h" - -using namespace KSVG; - -SVGFECompositeElementImpl::SVGFECompositeElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_in2 = new SVGAnimatedStringImpl(); - m_in2->ref(); - - m_operator = new SVGAnimatedEnumerationImpl(); - m_operator->ref(); - - m_k1 = new SVGAnimatedNumberImpl(); - m_k1->ref(); - - m_k2 = new SVGAnimatedNumberImpl(); - m_k2->ref(); - - m_k3 = new SVGAnimatedNumberImpl(); - m_k3->ref(); - - m_k4 = new SVGAnimatedNumberImpl(); - m_k4->ref(); -} - -SVGFECompositeElementImpl::~SVGFECompositeElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_in2) - m_in2->deref(); - if(m_operator) - m_operator->deref(); - if(m_k1) - m_k1->deref(); - if(m_k2) - m_k2->deref(); - if(m_k3) - m_k3->deref(); - if(m_k4) - m_k4->deref(); -} - -SVGAnimatedStringImpl *SVGFECompositeElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedStringImpl *SVGFECompositeElementImpl::in2() const -{ - return m_in2; -} - -SVGAnimatedEnumerationImpl *SVGFECompositeElementImpl::Operator() const -{ - return m_operator; -} - -SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k1() const -{ - return m_k1; -} - -SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k2() const -{ - return m_k2; -} - -SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k3() const -{ - return m_k3; -} - -SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k4() const -{ - return m_k4; -} diff --git a/ksvg/impl/SVGFECompositeElementImpl.cpp b/ksvg/impl/SVGFECompositeElementImpl.cpp new file mode 100644 index 00000000..0ddaed6e --- /dev/null +++ b/ksvg/impl/SVGFECompositeElementImpl.cpp @@ -0,0 +1,103 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGFECompositeElementImpl.h" +#include "SVGAnimatedEnumerationImpl.h" + +using namespace KSVG; + +SVGFECompositeElementImpl::SVGFECompositeElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_in2 = new SVGAnimatedStringImpl(); + m_in2->ref(); + + m_operator = new SVGAnimatedEnumerationImpl(); + m_operator->ref(); + + m_k1 = new SVGAnimatedNumberImpl(); + m_k1->ref(); + + m_k2 = new SVGAnimatedNumberImpl(); + m_k2->ref(); + + m_k3 = new SVGAnimatedNumberImpl(); + m_k3->ref(); + + m_k4 = new SVGAnimatedNumberImpl(); + m_k4->ref(); +} + +SVGFECompositeElementImpl::~SVGFECompositeElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_in2) + m_in2->deref(); + if(m_operator) + m_operator->deref(); + if(m_k1) + m_k1->deref(); + if(m_k2) + m_k2->deref(); + if(m_k3) + m_k3->deref(); + if(m_k4) + m_k4->deref(); +} + +SVGAnimatedStringImpl *SVGFECompositeElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedStringImpl *SVGFECompositeElementImpl::in2() const +{ + return m_in2; +} + +SVGAnimatedEnumerationImpl *SVGFECompositeElementImpl::Operator() const +{ + return m_operator; +} + +SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k1() const +{ + return m_k1; +} + +SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k2() const +{ + return m_k2; +} + +SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k3() const +{ + return m_k3; +} + +SVGAnimatedNumberImpl *SVGFECompositeElementImpl::k4() const +{ + return m_k4; +} diff --git a/ksvg/impl/SVGFEConvolveMatrixElementImpl.cc b/ksvg/impl/SVGFEConvolveMatrixElementImpl.cc deleted file mode 100644 index 4888eed7..00000000 --- a/ksvg/impl/SVGFEConvolveMatrixElementImpl.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedIntegerImpl.h" -#include "SVGAnimatedBooleanImpl.h" -#include "SVGAnimatedIntegerImpl.h" -#include "SVGAnimatedNumberListImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGFEConvolveMatrixElementImpl.h" - -using namespace KSVG; - -SVGFEConvolveMatrixElementImpl::SVGFEConvolveMatrixElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_orderX = new SVGAnimatedIntegerImpl(); - m_orderX->ref(); - - m_orderY = new SVGAnimatedIntegerImpl(); - m_orderY->ref(); - - m_kernelMatrix = new SVGAnimatedNumberListImpl(); - m_kernelMatrix->ref(); - - m_divisor = new SVGAnimatedNumberImpl(); - m_divisor->ref(); - - m_bias = new SVGAnimatedNumberImpl(); - m_bias->ref(); - - m_targetX = new SVGAnimatedIntegerImpl(); - m_targetX->ref(); - - m_targetY = new SVGAnimatedIntegerImpl(); - m_targetY->ref(); - - m_edgeMode = new SVGAnimatedEnumerationImpl(); - m_edgeMode->ref(); - - m_kernelUnitLengthX = new SVGAnimatedLengthImpl(); - m_kernelUnitLengthX->ref(); - - m_kernelUnitLengthY = new SVGAnimatedLengthImpl(); - m_kernelUnitLengthY->ref(); - - m_preserveAlpha = new SVGAnimatedBooleanImpl(); - m_preserveAlpha->ref(); -} - -SVGFEConvolveMatrixElementImpl::~SVGFEConvolveMatrixElementImpl() -{ - if(m_orderX) - m_orderX->deref(); - if(m_orderY) - m_orderY->deref(); - if(m_kernelMatrix) - m_kernelMatrix->deref(); - if(m_divisor) - m_divisor->deref(); - if(m_bias) - m_bias->deref(); - if(m_targetX) - m_targetX->deref(); - if(m_targetY) - m_targetY->deref(); - if(m_edgeMode) - m_edgeMode->deref(); - if(m_kernelUnitLengthX) - m_kernelUnitLengthX->deref(); - if(m_kernelUnitLengthY) - m_kernelUnitLengthY->deref(); - if(m_preserveAlpha) - m_preserveAlpha->deref(); -} - -SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::orderX() const -{ - return m_orderX; -} - -SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::orderY() const -{ - return m_orderY; -} - -SVGAnimatedNumberListImpl *SVGFEConvolveMatrixElementImpl::kernelMatrix() const -{ - return m_kernelMatrix; -} - -SVGAnimatedNumberImpl *SVGFEConvolveMatrixElementImpl::divisor() const -{ - return m_divisor; -} - -SVGAnimatedNumberImpl *SVGFEConvolveMatrixElementImpl::bias() const -{ - return m_bias; -} - -SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::targetX() const -{ - return m_targetX; -} - -SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::targetY() const -{ - return m_targetY; -} - -SVGAnimatedEnumerationImpl *SVGFEConvolveMatrixElementImpl::edgeMode() const -{ - return m_edgeMode; -} - -SVGAnimatedLengthImpl *SVGFEConvolveMatrixElementImpl::kernelUnitLengthX() const -{ - return m_kernelUnitLengthX; -} - -SVGAnimatedLengthImpl *SVGFEConvolveMatrixElementImpl::kernelUnitLengthY() const -{ - return m_kernelUnitLengthY; -} - -SVGAnimatedBooleanImpl *SVGFEConvolveMatrixElementImpl::preserveAlpha() const -{ - return m_preserveAlpha; -} diff --git a/ksvg/impl/SVGFEConvolveMatrixElementImpl.cpp b/ksvg/impl/SVGFEConvolveMatrixElementImpl.cpp new file mode 100644 index 00000000..4888eed7 --- /dev/null +++ b/ksvg/impl/SVGFEConvolveMatrixElementImpl.cpp @@ -0,0 +1,147 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedIntegerImpl.h" +#include "SVGAnimatedBooleanImpl.h" +#include "SVGAnimatedIntegerImpl.h" +#include "SVGAnimatedNumberListImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGFEConvolveMatrixElementImpl.h" + +using namespace KSVG; + +SVGFEConvolveMatrixElementImpl::SVGFEConvolveMatrixElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_orderX = new SVGAnimatedIntegerImpl(); + m_orderX->ref(); + + m_orderY = new SVGAnimatedIntegerImpl(); + m_orderY->ref(); + + m_kernelMatrix = new SVGAnimatedNumberListImpl(); + m_kernelMatrix->ref(); + + m_divisor = new SVGAnimatedNumberImpl(); + m_divisor->ref(); + + m_bias = new SVGAnimatedNumberImpl(); + m_bias->ref(); + + m_targetX = new SVGAnimatedIntegerImpl(); + m_targetX->ref(); + + m_targetY = new SVGAnimatedIntegerImpl(); + m_targetY->ref(); + + m_edgeMode = new SVGAnimatedEnumerationImpl(); + m_edgeMode->ref(); + + m_kernelUnitLengthX = new SVGAnimatedLengthImpl(); + m_kernelUnitLengthX->ref(); + + m_kernelUnitLengthY = new SVGAnimatedLengthImpl(); + m_kernelUnitLengthY->ref(); + + m_preserveAlpha = new SVGAnimatedBooleanImpl(); + m_preserveAlpha->ref(); +} + +SVGFEConvolveMatrixElementImpl::~SVGFEConvolveMatrixElementImpl() +{ + if(m_orderX) + m_orderX->deref(); + if(m_orderY) + m_orderY->deref(); + if(m_kernelMatrix) + m_kernelMatrix->deref(); + if(m_divisor) + m_divisor->deref(); + if(m_bias) + m_bias->deref(); + if(m_targetX) + m_targetX->deref(); + if(m_targetY) + m_targetY->deref(); + if(m_edgeMode) + m_edgeMode->deref(); + if(m_kernelUnitLengthX) + m_kernelUnitLengthX->deref(); + if(m_kernelUnitLengthY) + m_kernelUnitLengthY->deref(); + if(m_preserveAlpha) + m_preserveAlpha->deref(); +} + +SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::orderX() const +{ + return m_orderX; +} + +SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::orderY() const +{ + return m_orderY; +} + +SVGAnimatedNumberListImpl *SVGFEConvolveMatrixElementImpl::kernelMatrix() const +{ + return m_kernelMatrix; +} + +SVGAnimatedNumberImpl *SVGFEConvolveMatrixElementImpl::divisor() const +{ + return m_divisor; +} + +SVGAnimatedNumberImpl *SVGFEConvolveMatrixElementImpl::bias() const +{ + return m_bias; +} + +SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::targetX() const +{ + return m_targetX; +} + +SVGAnimatedIntegerImpl *SVGFEConvolveMatrixElementImpl::targetY() const +{ + return m_targetY; +} + +SVGAnimatedEnumerationImpl *SVGFEConvolveMatrixElementImpl::edgeMode() const +{ + return m_edgeMode; +} + +SVGAnimatedLengthImpl *SVGFEConvolveMatrixElementImpl::kernelUnitLengthX() const +{ + return m_kernelUnitLengthX; +} + +SVGAnimatedLengthImpl *SVGFEConvolveMatrixElementImpl::kernelUnitLengthY() const +{ + return m_kernelUnitLengthY; +} + +SVGAnimatedBooleanImpl *SVGFEConvolveMatrixElementImpl::preserveAlpha() const +{ + return m_preserveAlpha; +} diff --git a/ksvg/impl/SVGFEDiffuseLightingElementImpl.cc b/ksvg/impl/SVGFEDiffuseLightingElementImpl.cc deleted file mode 100644 index 151b02bf..00000000 --- a/ksvg/impl/SVGFEDiffuseLightingElementImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedNumberImpl.h" -#include "SVGFEDiffuseLightingElementImpl.h" - -using namespace KSVG; - -SVGFEDiffuseLightingElementImpl::SVGFEDiffuseLightingElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_surfaceScale = new SVGAnimatedNumberImpl(); - m_surfaceScale->ref(); - - m_diffuseConstant = new SVGAnimatedNumberImpl(); - m_diffuseConstant->ref(); -} - -SVGFEDiffuseLightingElementImpl::~SVGFEDiffuseLightingElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_surfaceScale) - m_surfaceScale->deref(); - if(m_diffuseConstant) - m_diffuseConstant->deref(); -} - -SVGAnimatedStringImpl *SVGFEDiffuseLightingElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::surfaceScale() const -{ - return m_surfaceScale; -} - -SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::diffuseConstant() const -{ - return m_diffuseConstant; -} diff --git a/ksvg/impl/SVGFEDiffuseLightingElementImpl.cpp b/ksvg/impl/SVGFEDiffuseLightingElementImpl.cpp new file mode 100644 index 00000000..151b02bf --- /dev/null +++ b/ksvg/impl/SVGFEDiffuseLightingElementImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedNumberImpl.h" +#include "SVGFEDiffuseLightingElementImpl.h" + +using namespace KSVG; + +SVGFEDiffuseLightingElementImpl::SVGFEDiffuseLightingElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_surfaceScale = new SVGAnimatedNumberImpl(); + m_surfaceScale->ref(); + + m_diffuseConstant = new SVGAnimatedNumberImpl(); + m_diffuseConstant->ref(); +} + +SVGFEDiffuseLightingElementImpl::~SVGFEDiffuseLightingElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_surfaceScale) + m_surfaceScale->deref(); + if(m_diffuseConstant) + m_diffuseConstant->deref(); +} + +SVGAnimatedStringImpl *SVGFEDiffuseLightingElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::surfaceScale() const +{ + return m_surfaceScale; +} + +SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::diffuseConstant() const +{ + return m_diffuseConstant; +} diff --git a/ksvg/impl/SVGFEDisplacementMapElementImpl.cc b/ksvg/impl/SVGFEDisplacementMapElementImpl.cc deleted file mode 100644 index 6bdd9aea..00000000 --- a/ksvg/impl/SVGFEDisplacementMapElementImpl.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedNumberImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGFEDisplacementMapElementImpl.h" - -using namespace KSVG; - -SVGFEDisplacementMapElementImpl::SVGFEDisplacementMapElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_in2 = new SVGAnimatedStringImpl(); - m_in2->ref(); - - m_scale = new SVGAnimatedNumberImpl(); - m_scale->ref(); - - m_xChannelSelector = new SVGAnimatedEnumerationImpl(); - m_xChannelSelector->ref(); - - m_yChannelSelector = new SVGAnimatedEnumerationImpl(); - m_yChannelSelector->ref(); -} - -SVGFEDisplacementMapElementImpl::~SVGFEDisplacementMapElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_in2) - m_in2->deref(); - if(m_scale) - m_scale->deref(); - if(m_xChannelSelector) - m_xChannelSelector->deref(); - if(m_yChannelSelector) - m_yChannelSelector->deref(); -} - -SVGAnimatedStringImpl *SVGFEDisplacementMapElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedStringImpl *SVGFEDisplacementMapElementImpl::in2() const -{ - return m_in2; -} - -SVGAnimatedNumberImpl *SVGFEDisplacementMapElementImpl::scale() const -{ - return m_scale; -} - -SVGAnimatedEnumerationImpl *SVGFEDisplacementMapElementImpl::xChannelSelector() const -{ - return m_xChannelSelector; -} - -SVGAnimatedEnumerationImpl *SVGFEDisplacementMapElementImpl::yChannelSelector() const -{ - return m_yChannelSelector; -} diff --git a/ksvg/impl/SVGFEDisplacementMapElementImpl.cpp b/ksvg/impl/SVGFEDisplacementMapElementImpl.cpp new file mode 100644 index 00000000..6bdd9aea --- /dev/null +++ b/ksvg/impl/SVGFEDisplacementMapElementImpl.cpp @@ -0,0 +1,83 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedNumberImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGFEDisplacementMapElementImpl.h" + +using namespace KSVG; + +SVGFEDisplacementMapElementImpl::SVGFEDisplacementMapElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_in2 = new SVGAnimatedStringImpl(); + m_in2->ref(); + + m_scale = new SVGAnimatedNumberImpl(); + m_scale->ref(); + + m_xChannelSelector = new SVGAnimatedEnumerationImpl(); + m_xChannelSelector->ref(); + + m_yChannelSelector = new SVGAnimatedEnumerationImpl(); + m_yChannelSelector->ref(); +} + +SVGFEDisplacementMapElementImpl::~SVGFEDisplacementMapElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_in2) + m_in2->deref(); + if(m_scale) + m_scale->deref(); + if(m_xChannelSelector) + m_xChannelSelector->deref(); + if(m_yChannelSelector) + m_yChannelSelector->deref(); +} + +SVGAnimatedStringImpl *SVGFEDisplacementMapElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedStringImpl *SVGFEDisplacementMapElementImpl::in2() const +{ + return m_in2; +} + +SVGAnimatedNumberImpl *SVGFEDisplacementMapElementImpl::scale() const +{ + return m_scale; +} + +SVGAnimatedEnumerationImpl *SVGFEDisplacementMapElementImpl::xChannelSelector() const +{ + return m_xChannelSelector; +} + +SVGAnimatedEnumerationImpl *SVGFEDisplacementMapElementImpl::yChannelSelector() const +{ + return m_yChannelSelector; +} diff --git a/ksvg/impl/SVGFEDistantLightElementImpl.cc b/ksvg/impl/SVGFEDistantLightElementImpl.cc deleted file mode 100644 index f9556ab1..00000000 --- a/ksvg/impl/SVGFEDistantLightElementImpl.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberImpl.h" -#include "SVGFEDistantLightElementImpl.h" - -using namespace KSVG; - -SVGFEDistantLightElementImpl::SVGFEDistantLightElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ - m_azimuth = new SVGAnimatedNumberImpl(); - m_azimuth->ref(); - - m_elevation = new SVGAnimatedNumberImpl(); - m_elevation->ref(); -} - -SVGFEDistantLightElementImpl::~SVGFEDistantLightElementImpl() -{ - if(m_azimuth) - m_azimuth->deref(); - if(m_elevation) - m_elevation->deref(); -} - -SVGAnimatedNumberImpl *SVGFEDistantLightElementImpl::azimuth() const -{ - return m_azimuth; -} - -SVGAnimatedNumberImpl *SVGFEDistantLightElementImpl::elevation() const -{ - return m_elevation; -} diff --git a/ksvg/impl/SVGFEDistantLightElementImpl.cpp b/ksvg/impl/SVGFEDistantLightElementImpl.cpp new file mode 100644 index 00000000..f9556ab1 --- /dev/null +++ b/ksvg/impl/SVGFEDistantLightElementImpl.cpp @@ -0,0 +1,51 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberImpl.h" +#include "SVGFEDistantLightElementImpl.h" + +using namespace KSVG; + +SVGFEDistantLightElementImpl::SVGFEDistantLightElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ + m_azimuth = new SVGAnimatedNumberImpl(); + m_azimuth->ref(); + + m_elevation = new SVGAnimatedNumberImpl(); + m_elevation->ref(); +} + +SVGFEDistantLightElementImpl::~SVGFEDistantLightElementImpl() +{ + if(m_azimuth) + m_azimuth->deref(); + if(m_elevation) + m_elevation->deref(); +} + +SVGAnimatedNumberImpl *SVGFEDistantLightElementImpl::azimuth() const +{ + return m_azimuth; +} + +SVGAnimatedNumberImpl *SVGFEDistantLightElementImpl::elevation() const +{ + return m_elevation; +} diff --git a/ksvg/impl/SVGFEFloodElementImpl.cc b/ksvg/impl/SVGFEFloodElementImpl.cc deleted file mode 100644 index 15d74945..00000000 --- a/ksvg/impl/SVGFEFloodElementImpl.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFloodElementImpl.h" -#include "SVGAnimatedStringImpl.h" - -using namespace KSVG; - -SVGFEFloodElementImpl::SVGFEFloodElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); -} - -SVGFEFloodElementImpl::~SVGFEFloodElementImpl() -{ - if(m_in1) - m_in1->deref(); -} - -SVGAnimatedStringImpl *SVGFEFloodElementImpl::in1() const -{ - return m_in1; -} diff --git a/ksvg/impl/SVGFEFloodElementImpl.cpp b/ksvg/impl/SVGFEFloodElementImpl.cpp new file mode 100644 index 00000000..15d74945 --- /dev/null +++ b/ksvg/impl/SVGFEFloodElementImpl.cpp @@ -0,0 +1,41 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFloodElementImpl.h" +#include "SVGAnimatedStringImpl.h" + +using namespace KSVG; + +SVGFEFloodElementImpl::SVGFEFloodElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); +} + +SVGFEFloodElementImpl::~SVGFEFloodElementImpl() +{ + if(m_in1) + m_in1->deref(); +} + +SVGAnimatedStringImpl *SVGFEFloodElementImpl::in1() const +{ + return m_in1; +} diff --git a/ksvg/impl/SVGFEFuncAElementImpl.cc b/ksvg/impl/SVGFEFuncAElementImpl.cc deleted file mode 100644 index 7afec020..00000000 --- a/ksvg/impl/SVGFEFuncAElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncAElementImpl.h" - -using namespace KSVG; - -SVGFEFuncAElementImpl::SVGFEFuncAElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) -{ -} - -SVGFEFuncAElementImpl::~SVGFEFuncAElementImpl() -{ -} diff --git a/ksvg/impl/SVGFEFuncAElementImpl.cpp b/ksvg/impl/SVGFEFuncAElementImpl.cpp new file mode 100644 index 00000000..7afec020 --- /dev/null +++ b/ksvg/impl/SVGFEFuncAElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncAElementImpl.h" + +using namespace KSVG; + +SVGFEFuncAElementImpl::SVGFEFuncAElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) +{ +} + +SVGFEFuncAElementImpl::~SVGFEFuncAElementImpl() +{ +} diff --git a/ksvg/impl/SVGFEFuncBElementImpl.cc b/ksvg/impl/SVGFEFuncBElementImpl.cc deleted file mode 100644 index 4c38afb6..00000000 --- a/ksvg/impl/SVGFEFuncBElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncBElementImpl.h" - -using namespace KSVG; - -SVGFEFuncBElementImpl::SVGFEFuncBElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) -{ -} - -SVGFEFuncBElementImpl::~SVGFEFuncBElementImpl() -{ -} diff --git a/ksvg/impl/SVGFEFuncBElementImpl.cpp b/ksvg/impl/SVGFEFuncBElementImpl.cpp new file mode 100644 index 00000000..4c38afb6 --- /dev/null +++ b/ksvg/impl/SVGFEFuncBElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncBElementImpl.h" + +using namespace KSVG; + +SVGFEFuncBElementImpl::SVGFEFuncBElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) +{ +} + +SVGFEFuncBElementImpl::~SVGFEFuncBElementImpl() +{ +} diff --git a/ksvg/impl/SVGFEFuncGElementImpl.cc b/ksvg/impl/SVGFEFuncGElementImpl.cc deleted file mode 100644 index 67712b9b..00000000 --- a/ksvg/impl/SVGFEFuncGElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncGElementImpl.h" - -using namespace KSVG; - -SVGFEFuncGElementImpl::SVGFEFuncGElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) -{ -} - -SVGFEFuncGElementImpl::~SVGFEFuncGElementImpl() -{ -} diff --git a/ksvg/impl/SVGFEFuncGElementImpl.cpp b/ksvg/impl/SVGFEFuncGElementImpl.cpp new file mode 100644 index 00000000..67712b9b --- /dev/null +++ b/ksvg/impl/SVGFEFuncGElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncGElementImpl.h" + +using namespace KSVG; + +SVGFEFuncGElementImpl::SVGFEFuncGElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) +{ +} + +SVGFEFuncGElementImpl::~SVGFEFuncGElementImpl() +{ +} diff --git a/ksvg/impl/SVGFEFuncRElementImpl.cc b/ksvg/impl/SVGFEFuncRElementImpl.cc deleted file mode 100644 index 703eae13..00000000 --- a/ksvg/impl/SVGFEFuncRElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEFuncRElementImpl.h" - -using namespace KSVG; - -SVGFEFuncRElementImpl::SVGFEFuncRElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) -{ -} - -SVGFEFuncRElementImpl::~SVGFEFuncRElementImpl() -{ -} diff --git a/ksvg/impl/SVGFEFuncRElementImpl.cpp b/ksvg/impl/SVGFEFuncRElementImpl.cpp new file mode 100644 index 00000000..703eae13 --- /dev/null +++ b/ksvg/impl/SVGFEFuncRElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEFuncRElementImpl.h" + +using namespace KSVG; + +SVGFEFuncRElementImpl::SVGFEFuncRElementImpl(DOM::ElementImpl *impl) : SVGComponentTransferFunctionElementImpl(impl) +{ +} + +SVGFEFuncRElementImpl::~SVGFEFuncRElementImpl() +{ +} diff --git a/ksvg/impl/SVGFEGaussianBlurElementImpl.cc b/ksvg/impl/SVGFEGaussianBlurElementImpl.cc deleted file mode 100644 index 1c10d564..00000000 --- a/ksvg/impl/SVGFEGaussianBlurElementImpl.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedNumberImpl.h" -#include "SVGFEGaussianBlurElementImpl.h" - -using namespace KSVG; - -SVGFEGaussianBlurElementImpl::SVGFEGaussianBlurElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_stdDeviationX = new SVGAnimatedNumberImpl(); - m_stdDeviationX->ref(); - - m_stdDeviationY = new SVGAnimatedNumberImpl(); - m_stdDeviationY->ref(); -} - -SVGFEGaussianBlurElementImpl::~SVGFEGaussianBlurElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_stdDeviationX) - m_stdDeviationX->deref(); - if(m_stdDeviationY) - m_stdDeviationY->deref(); -} - -SVGAnimatedStringImpl *SVGFEGaussianBlurElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedNumberImpl *SVGFEGaussianBlurElementImpl::stdDeviationX() const -{ - return m_stdDeviationX; -} - -SVGAnimatedNumberImpl *SVGFEGaussianBlurElementImpl::stdDeviationY() const -{ - return m_stdDeviationY; -} - -void SVGFEGaussianBlurElementImpl::setStdDeviation(float /*stdDeviationX*/, float /*stdDeviationY*/) -{ -} diff --git a/ksvg/impl/SVGFEGaussianBlurElementImpl.cpp b/ksvg/impl/SVGFEGaussianBlurElementImpl.cpp new file mode 100644 index 00000000..1c10d564 --- /dev/null +++ b/ksvg/impl/SVGFEGaussianBlurElementImpl.cpp @@ -0,0 +1,66 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedNumberImpl.h" +#include "SVGFEGaussianBlurElementImpl.h" + +using namespace KSVG; + +SVGFEGaussianBlurElementImpl::SVGFEGaussianBlurElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_stdDeviationX = new SVGAnimatedNumberImpl(); + m_stdDeviationX->ref(); + + m_stdDeviationY = new SVGAnimatedNumberImpl(); + m_stdDeviationY->ref(); +} + +SVGFEGaussianBlurElementImpl::~SVGFEGaussianBlurElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_stdDeviationX) + m_stdDeviationX->deref(); + if(m_stdDeviationY) + m_stdDeviationY->deref(); +} + +SVGAnimatedStringImpl *SVGFEGaussianBlurElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedNumberImpl *SVGFEGaussianBlurElementImpl::stdDeviationX() const +{ + return m_stdDeviationX; +} + +SVGAnimatedNumberImpl *SVGFEGaussianBlurElementImpl::stdDeviationY() const +{ + return m_stdDeviationY; +} + +void SVGFEGaussianBlurElementImpl::setStdDeviation(float /*stdDeviationX*/, float /*stdDeviationY*/) +{ +} diff --git a/ksvg/impl/SVGFEImageElementImpl.cc b/ksvg/impl/SVGFEImageElementImpl.cc deleted file mode 100644 index 4bcd64ed..00000000 --- a/ksvg/impl/SVGFEImageElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEImageElementImpl.h" - -using namespace KSVG; - -SVGFEImageElementImpl::SVGFEImageElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFilterPrimitiveStandardAttributesImpl() -{ -} - -SVGFEImageElementImpl::~SVGFEImageElementImpl() -{ -} diff --git a/ksvg/impl/SVGFEImageElementImpl.cpp b/ksvg/impl/SVGFEImageElementImpl.cpp new file mode 100644 index 00000000..4bcd64ed --- /dev/null +++ b/ksvg/impl/SVGFEImageElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEImageElementImpl.h" + +using namespace KSVG; + +SVGFEImageElementImpl::SVGFEImageElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFilterPrimitiveStandardAttributesImpl() +{ +} + +SVGFEImageElementImpl::~SVGFEImageElementImpl() +{ +} diff --git a/ksvg/impl/SVGFEMergeElementImpl.cc b/ksvg/impl/SVGFEMergeElementImpl.cc deleted file mode 100644 index fb188bae..00000000 --- a/ksvg/impl/SVGFEMergeElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFEMergeElementImpl.h" - -using namespace KSVG; - -SVGFEMergeElementImpl::SVGFEMergeElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ -} - -SVGFEMergeElementImpl::~SVGFEMergeElementImpl() -{ -} diff --git a/ksvg/impl/SVGFEMergeElementImpl.cpp b/ksvg/impl/SVGFEMergeElementImpl.cpp new file mode 100644 index 00000000..fb188bae --- /dev/null +++ b/ksvg/impl/SVGFEMergeElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFEMergeElementImpl.h" + +using namespace KSVG; + +SVGFEMergeElementImpl::SVGFEMergeElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ +} + +SVGFEMergeElementImpl::~SVGFEMergeElementImpl() +{ +} diff --git a/ksvg/impl/SVGFEMergeNodeElementImpl.cc b/ksvg/impl/SVGFEMergeNodeElementImpl.cc deleted file mode 100644 index 13f6eefe..00000000 --- a/ksvg/impl/SVGFEMergeNodeElementImpl.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGFEMergeNodeElementImpl.h" - -using namespace KSVG; - -SVGFEMergeNodeElementImpl::SVGFEMergeNodeElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); -} - -SVGFEMergeNodeElementImpl::~SVGFEMergeNodeElementImpl() -{ - if(m_in1) - m_in1->deref(); -} - -SVGAnimatedStringImpl *SVGFEMergeNodeElementImpl::in1() const -{ - return m_in1; -} diff --git a/ksvg/impl/SVGFEMergeNodeElementImpl.cpp b/ksvg/impl/SVGFEMergeNodeElementImpl.cpp new file mode 100644 index 00000000..13f6eefe --- /dev/null +++ b/ksvg/impl/SVGFEMergeNodeElementImpl.cpp @@ -0,0 +1,41 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGFEMergeNodeElementImpl.h" + +using namespace KSVG; + +SVGFEMergeNodeElementImpl::SVGFEMergeNodeElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); +} + +SVGFEMergeNodeElementImpl::~SVGFEMergeNodeElementImpl() +{ + if(m_in1) + m_in1->deref(); +} + +SVGAnimatedStringImpl *SVGFEMergeNodeElementImpl::in1() const +{ + return m_in1; +} diff --git a/ksvg/impl/SVGFEMorphologyElementImpl.cc b/ksvg/impl/SVGFEMorphologyElementImpl.cc deleted file mode 100644 index 373d0b08..00000000 --- a/ksvg/impl/SVGFEMorphologyElementImpl.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGFEMorphologyElementImpl.h" - -using namespace KSVG; - -SVGFEMorphologyElementImpl::SVGFEMorphologyElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_operator = new SVGAnimatedEnumerationImpl(); - m_operator->ref(); - - m_radiusX = new SVGAnimatedLengthImpl(); - m_radiusX->ref(); - - m_radiusY = new SVGAnimatedLengthImpl(); - m_radiusY->ref(); -} - -SVGFEMorphologyElementImpl::~SVGFEMorphologyElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_operator) - m_operator->deref(); - if(m_radiusX) - m_radiusX->deref(); - if(m_radiusY) - m_radiusY->deref(); -} - -SVGAnimatedStringImpl *SVGFEMorphologyElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedEnumerationImpl *SVGFEMorphologyElementImpl::Operator() const -{ - return m_operator; -} - -SVGAnimatedLengthImpl *SVGFEMorphologyElementImpl::radiusX() const -{ - return m_radiusX; -} - -SVGAnimatedLengthImpl *SVGFEMorphologyElementImpl::radiusY() const -{ - return m_radiusY; -} diff --git a/ksvg/impl/SVGFEMorphologyElementImpl.cpp b/ksvg/impl/SVGFEMorphologyElementImpl.cpp new file mode 100644 index 00000000..373d0b08 --- /dev/null +++ b/ksvg/impl/SVGFEMorphologyElementImpl.cpp @@ -0,0 +1,73 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGFEMorphologyElementImpl.h" + +using namespace KSVG; + +SVGFEMorphologyElementImpl::SVGFEMorphologyElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_operator = new SVGAnimatedEnumerationImpl(); + m_operator->ref(); + + m_radiusX = new SVGAnimatedLengthImpl(); + m_radiusX->ref(); + + m_radiusY = new SVGAnimatedLengthImpl(); + m_radiusY->ref(); +} + +SVGFEMorphologyElementImpl::~SVGFEMorphologyElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_operator) + m_operator->deref(); + if(m_radiusX) + m_radiusX->deref(); + if(m_radiusY) + m_radiusY->deref(); +} + +SVGAnimatedStringImpl *SVGFEMorphologyElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedEnumerationImpl *SVGFEMorphologyElementImpl::Operator() const +{ + return m_operator; +} + +SVGAnimatedLengthImpl *SVGFEMorphologyElementImpl::radiusX() const +{ + return m_radiusX; +} + +SVGAnimatedLengthImpl *SVGFEMorphologyElementImpl::radiusY() const +{ + return m_radiusY; +} diff --git a/ksvg/impl/SVGFEOffsetElementImpl.cc b/ksvg/impl/SVGFEOffsetElementImpl.cc deleted file mode 100644 index b402fbc0..00000000 --- a/ksvg/impl/SVGFEOffsetElementImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedNumberImpl.h" -#include "SVGFEOffsetElementImpl.h" - -using namespace KSVG; - -SVGFEOffsetElementImpl::SVGFEOffsetElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_dx = new SVGAnimatedNumberImpl(); - m_dx->ref(); - - m_dy = new SVGAnimatedNumberImpl(); - m_dy->ref(); -} - -SVGFEOffsetElementImpl::~SVGFEOffsetElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_dx) - m_dx->deref(); - if(m_dy) - m_dy->deref(); -} - -SVGAnimatedStringImpl *SVGFEOffsetElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedNumberImpl *SVGFEOffsetElementImpl::dx() const -{ - return m_dx; -} - -SVGAnimatedNumberImpl *SVGFEOffsetElementImpl::dy() const -{ - return m_dy; -} diff --git a/ksvg/impl/SVGFEOffsetElementImpl.cpp b/ksvg/impl/SVGFEOffsetElementImpl.cpp new file mode 100644 index 00000000..b402fbc0 --- /dev/null +++ b/ksvg/impl/SVGFEOffsetElementImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedNumberImpl.h" +#include "SVGFEOffsetElementImpl.h" + +using namespace KSVG; + +SVGFEOffsetElementImpl::SVGFEOffsetElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_dx = new SVGAnimatedNumberImpl(); + m_dx->ref(); + + m_dy = new SVGAnimatedNumberImpl(); + m_dy->ref(); +} + +SVGFEOffsetElementImpl::~SVGFEOffsetElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_dx) + m_dx->deref(); + if(m_dy) + m_dy->deref(); +} + +SVGAnimatedStringImpl *SVGFEOffsetElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedNumberImpl *SVGFEOffsetElementImpl::dx() const +{ + return m_dx; +} + +SVGAnimatedNumberImpl *SVGFEOffsetElementImpl::dy() const +{ + return m_dy; +} diff --git a/ksvg/impl/SVGFEPointLightElementImpl.cc b/ksvg/impl/SVGFEPointLightElementImpl.cc deleted file mode 100644 index 1a705f43..00000000 --- a/ksvg/impl/SVGFEPointLightElementImpl.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberImpl.h" -#include "SVGFEPointLightElementImpl.h" - -using namespace KSVG; - -SVGFEPointLightElementImpl::SVGFEPointLightElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ - m_x = new SVGAnimatedNumberImpl(); - m_x->ref(); - - m_y = new SVGAnimatedNumberImpl(); - m_y->ref(); - - m_z = new SVGAnimatedNumberImpl(); - m_z->ref(); -} - -SVGFEPointLightElementImpl::~SVGFEPointLightElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_z) - m_z->deref(); -} - -SVGAnimatedNumberImpl *SVGFEPointLightElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedNumberImpl *SVGFEPointLightElementImpl::y() const -{ - return m_y; -} - -SVGAnimatedNumberImpl *SVGFEPointLightElementImpl::z() const -{ - return m_z; -} diff --git a/ksvg/impl/SVGFEPointLightElementImpl.cpp b/ksvg/impl/SVGFEPointLightElementImpl.cpp new file mode 100644 index 00000000..1a705f43 --- /dev/null +++ b/ksvg/impl/SVGFEPointLightElementImpl.cpp @@ -0,0 +1,61 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberImpl.h" +#include "SVGFEPointLightElementImpl.h" + +using namespace KSVG; + +SVGFEPointLightElementImpl::SVGFEPointLightElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ + m_x = new SVGAnimatedNumberImpl(); + m_x->ref(); + + m_y = new SVGAnimatedNumberImpl(); + m_y->ref(); + + m_z = new SVGAnimatedNumberImpl(); + m_z->ref(); +} + +SVGFEPointLightElementImpl::~SVGFEPointLightElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_z) + m_z->deref(); +} + +SVGAnimatedNumberImpl *SVGFEPointLightElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedNumberImpl *SVGFEPointLightElementImpl::y() const +{ + return m_y; +} + +SVGAnimatedNumberImpl *SVGFEPointLightElementImpl::z() const +{ + return m_z; +} diff --git a/ksvg/impl/SVGFESpecularLightingElementImpl.cc b/ksvg/impl/SVGFESpecularLightingElementImpl.cc deleted file mode 100644 index 188dc0bd..00000000 --- a/ksvg/impl/SVGFESpecularLightingElementImpl.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedNumberImpl.h" -#include "SVGFESpecularLightingElementImpl.h" - -using namespace KSVG; - -SVGFESpecularLightingElementImpl::SVGFESpecularLightingElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); - - m_surfaceScale = new SVGAnimatedNumberImpl(); - m_surfaceScale->ref(); - - m_specularConstant = new SVGAnimatedNumberImpl(); - m_specularConstant->ref(); - - m_specularExponent = new SVGAnimatedNumberImpl(); - m_specularExponent->ref(); -} - -SVGFESpecularLightingElementImpl::~SVGFESpecularLightingElementImpl() -{ - if(m_in1) - m_in1->deref(); - if(m_surfaceScale) - m_surfaceScale->deref(); - if(m_specularConstant) - m_specularConstant->deref(); - if(m_specularExponent) - m_specularExponent->deref(); -} - -SVGAnimatedStringImpl *SVGFESpecularLightingElementImpl::in1() const -{ - return m_in1; -} - -SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::surfaceScale() const -{ - return m_surfaceScale; -} - -SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::specularConstant() const -{ - return m_specularConstant; -} - -SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::specularExponent() const -{ - return m_specularExponent; -} diff --git a/ksvg/impl/SVGFESpecularLightingElementImpl.cpp b/ksvg/impl/SVGFESpecularLightingElementImpl.cpp new file mode 100644 index 00000000..188dc0bd --- /dev/null +++ b/ksvg/impl/SVGFESpecularLightingElementImpl.cpp @@ -0,0 +1,72 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedNumberImpl.h" +#include "SVGFESpecularLightingElementImpl.h" + +using namespace KSVG; + +SVGFESpecularLightingElementImpl::SVGFESpecularLightingElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); + + m_surfaceScale = new SVGAnimatedNumberImpl(); + m_surfaceScale->ref(); + + m_specularConstant = new SVGAnimatedNumberImpl(); + m_specularConstant->ref(); + + m_specularExponent = new SVGAnimatedNumberImpl(); + m_specularExponent->ref(); +} + +SVGFESpecularLightingElementImpl::~SVGFESpecularLightingElementImpl() +{ + if(m_in1) + m_in1->deref(); + if(m_surfaceScale) + m_surfaceScale->deref(); + if(m_specularConstant) + m_specularConstant->deref(); + if(m_specularExponent) + m_specularExponent->deref(); +} + +SVGAnimatedStringImpl *SVGFESpecularLightingElementImpl::in1() const +{ + return m_in1; +} + +SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::surfaceScale() const +{ + return m_surfaceScale; +} + +SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::specularConstant() const +{ + return m_specularConstant; +} + +SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::specularExponent() const +{ + return m_specularExponent; +} diff --git a/ksvg/impl/SVGFESpotLightElementImpl.cc b/ksvg/impl/SVGFESpotLightElementImpl.cc deleted file mode 100644 index f92b4ccd..00000000 --- a/ksvg/impl/SVGFESpotLightElementImpl.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberImpl.h" -#include "SVGFESpotLightElementImpl.h" - -using namespace KSVG; - -SVGFESpotLightElementImpl::SVGFESpotLightElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ - m_x = new SVGAnimatedNumberImpl(); - m_x->ref(); - - m_y = new SVGAnimatedNumberImpl(); - m_y->ref(); - - m_z = new SVGAnimatedNumberImpl(); - m_z->ref(); - - m_pointsAtX = new SVGAnimatedNumberImpl(); - m_pointsAtX->ref(); - - m_pointsAtY = new SVGAnimatedNumberImpl(); - m_pointsAtY->ref(); - - m_pointsAtZ = new SVGAnimatedNumberImpl(); - m_pointsAtZ->ref(); - - m_specularExponent = new SVGAnimatedNumberImpl(); - m_specularExponent->ref(); - - m_limitingConeAngle = new SVGAnimatedNumberImpl(); - m_limitingConeAngle->ref(); -} - -SVGFESpotLightElementImpl::~SVGFESpotLightElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_z) - m_z->deref(); - if(m_pointsAtX) - m_pointsAtX->deref(); - if(m_pointsAtY) - m_pointsAtY->deref(); - if(m_pointsAtZ) - m_pointsAtZ->deref(); - if(m_specularExponent) - m_specularExponent->deref(); - if(m_limitingConeAngle) - m_limitingConeAngle->deref(); -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::y() const -{ - return m_y; -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::z() const -{ - return m_z; -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::pointsAtX() const -{ - return m_pointsAtX; -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::pointsAtY() const -{ - return m_pointsAtY; -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::pointsAtZ() const -{ - return m_pointsAtZ; -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::specularExponent() const -{ - return m_specularExponent; -} - -SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::limitingConeAngle() const -{ - return m_limitingConeAngle; -} diff --git a/ksvg/impl/SVGFESpotLightElementImpl.cpp b/ksvg/impl/SVGFESpotLightElementImpl.cpp new file mode 100644 index 00000000..f92b4ccd --- /dev/null +++ b/ksvg/impl/SVGFESpotLightElementImpl.cpp @@ -0,0 +1,111 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberImpl.h" +#include "SVGFESpotLightElementImpl.h" + +using namespace KSVG; + +SVGFESpotLightElementImpl::SVGFESpotLightElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ + m_x = new SVGAnimatedNumberImpl(); + m_x->ref(); + + m_y = new SVGAnimatedNumberImpl(); + m_y->ref(); + + m_z = new SVGAnimatedNumberImpl(); + m_z->ref(); + + m_pointsAtX = new SVGAnimatedNumberImpl(); + m_pointsAtX->ref(); + + m_pointsAtY = new SVGAnimatedNumberImpl(); + m_pointsAtY->ref(); + + m_pointsAtZ = new SVGAnimatedNumberImpl(); + m_pointsAtZ->ref(); + + m_specularExponent = new SVGAnimatedNumberImpl(); + m_specularExponent->ref(); + + m_limitingConeAngle = new SVGAnimatedNumberImpl(); + m_limitingConeAngle->ref(); +} + +SVGFESpotLightElementImpl::~SVGFESpotLightElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_z) + m_z->deref(); + if(m_pointsAtX) + m_pointsAtX->deref(); + if(m_pointsAtY) + m_pointsAtY->deref(); + if(m_pointsAtZ) + m_pointsAtZ->deref(); + if(m_specularExponent) + m_specularExponent->deref(); + if(m_limitingConeAngle) + m_limitingConeAngle->deref(); +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::y() const +{ + return m_y; +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::z() const +{ + return m_z; +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::pointsAtX() const +{ + return m_pointsAtX; +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::pointsAtY() const +{ + return m_pointsAtY; +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::pointsAtZ() const +{ + return m_pointsAtZ; +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::specularExponent() const +{ + return m_specularExponent; +} + +SVGAnimatedNumberImpl *SVGFESpotLightElementImpl::limitingConeAngle() const +{ + return m_limitingConeAngle; +} diff --git a/ksvg/impl/SVGFETileElementImpl.cc b/ksvg/impl/SVGFETileElementImpl.cc deleted file mode 100644 index 2ca931a2..00000000 --- a/ksvg/impl/SVGFETileElementImpl.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFETileElementImpl.h" -#include "SVGAnimatedStringImpl.h" - -using namespace KSVG; - -SVGFETileElementImpl::SVGFETileElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_in1 = new SVGAnimatedStringImpl(); - m_in1->ref(); -} - -SVGFETileElementImpl::~SVGFETileElementImpl() -{ - if(m_in1) - m_in1->deref(); -} - -SVGAnimatedStringImpl *SVGFETileElementImpl::in1() const -{ - return m_in1; -} diff --git a/ksvg/impl/SVGFETileElementImpl.cpp b/ksvg/impl/SVGFETileElementImpl.cpp new file mode 100644 index 00000000..2ca931a2 --- /dev/null +++ b/ksvg/impl/SVGFETileElementImpl.cpp @@ -0,0 +1,41 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFETileElementImpl.h" +#include "SVGAnimatedStringImpl.h" + +using namespace KSVG; + +SVGFETileElementImpl::SVGFETileElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_in1 = new SVGAnimatedStringImpl(); + m_in1->ref(); +} + +SVGFETileElementImpl::~SVGFETileElementImpl() +{ + if(m_in1) + m_in1->deref(); +} + +SVGAnimatedStringImpl *SVGFETileElementImpl::in1() const +{ + return m_in1; +} diff --git a/ksvg/impl/SVGFETurbulenceElementImpl.cc b/ksvg/impl/SVGFETurbulenceElementImpl.cc deleted file mode 100644 index 7c6638ef..00000000 --- a/ksvg/impl/SVGFETurbulenceElementImpl.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedNumberImpl.h" -#include "SVGAnimatedIntegerImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGFETurbulenceElementImpl.h" - -using namespace KSVG; - -SVGFETurbulenceElementImpl::SVGFETurbulenceElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() -{ - m_baseFrequencyX = new SVGAnimatedNumberImpl(); - m_baseFrequencyX->ref(); - - m_baseFrequencyY = new SVGAnimatedNumberImpl(); - m_baseFrequencyY->ref(); - - m_numOctaves = new SVGAnimatedIntegerImpl(); - m_numOctaves->ref(); - - m_seed = new SVGAnimatedNumberImpl(); - m_seed->ref(); - - m_stitchTiles = new SVGAnimatedEnumerationImpl(); - m_stitchTiles->ref(); - - m_type = new SVGAnimatedEnumerationImpl(); - m_type->ref(); -} - -SVGFETurbulenceElementImpl::~SVGFETurbulenceElementImpl() -{ - if(m_baseFrequencyX) - m_baseFrequencyX->deref(); - - if(m_baseFrequencyY) - m_baseFrequencyY->deref(); - - if(m_numOctaves) - m_numOctaves->deref(); - - if(m_seed) - m_seed->deref(); - - if(m_stitchTiles) - m_stitchTiles->deref(); - - if(m_type) - m_type->deref(); -} - -SVGAnimatedNumberImpl *SVGFETurbulenceElementImpl::baseFrequencyX() const -{ - return m_baseFrequencyX; -} - -SVGAnimatedNumberImpl *SVGFETurbulenceElementImpl::baseFrequencyY() const -{ - return m_baseFrequencyY; -} - -SVGAnimatedIntegerImpl *SVGFETurbulenceElementImpl::numOctaves() const -{ - return m_numOctaves; -} - -SVGAnimatedNumberImpl *SVGFETurbulenceElementImpl::seed() const -{ - return m_seed; -} - -SVGAnimatedEnumerationImpl *SVGFETurbulenceElementImpl::stitchTiles() const -{ - return m_stitchTiles; -} - -SVGAnimatedEnumerationImpl *SVGFETurbulenceElementImpl::type() const -{ - return m_type; -} diff --git a/ksvg/impl/SVGFETurbulenceElementImpl.cpp b/ksvg/impl/SVGFETurbulenceElementImpl.cpp new file mode 100644 index 00000000..7c6638ef --- /dev/null +++ b/ksvg/impl/SVGFETurbulenceElementImpl.cpp @@ -0,0 +1,98 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedNumberImpl.h" +#include "SVGAnimatedIntegerImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGFETurbulenceElementImpl.h" + +using namespace KSVG; + +SVGFETurbulenceElementImpl::SVGFETurbulenceElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGFilterPrimitiveStandardAttributesImpl() +{ + m_baseFrequencyX = new SVGAnimatedNumberImpl(); + m_baseFrequencyX->ref(); + + m_baseFrequencyY = new SVGAnimatedNumberImpl(); + m_baseFrequencyY->ref(); + + m_numOctaves = new SVGAnimatedIntegerImpl(); + m_numOctaves->ref(); + + m_seed = new SVGAnimatedNumberImpl(); + m_seed->ref(); + + m_stitchTiles = new SVGAnimatedEnumerationImpl(); + m_stitchTiles->ref(); + + m_type = new SVGAnimatedEnumerationImpl(); + m_type->ref(); +} + +SVGFETurbulenceElementImpl::~SVGFETurbulenceElementImpl() +{ + if(m_baseFrequencyX) + m_baseFrequencyX->deref(); + + if(m_baseFrequencyY) + m_baseFrequencyY->deref(); + + if(m_numOctaves) + m_numOctaves->deref(); + + if(m_seed) + m_seed->deref(); + + if(m_stitchTiles) + m_stitchTiles->deref(); + + if(m_type) + m_type->deref(); +} + +SVGAnimatedNumberImpl *SVGFETurbulenceElementImpl::baseFrequencyX() const +{ + return m_baseFrequencyX; +} + +SVGAnimatedNumberImpl *SVGFETurbulenceElementImpl::baseFrequencyY() const +{ + return m_baseFrequencyY; +} + +SVGAnimatedIntegerImpl *SVGFETurbulenceElementImpl::numOctaves() const +{ + return m_numOctaves; +} + +SVGAnimatedNumberImpl *SVGFETurbulenceElementImpl::seed() const +{ + return m_seed; +} + +SVGAnimatedEnumerationImpl *SVGFETurbulenceElementImpl::stitchTiles() const +{ + return m_stitchTiles; +} + +SVGAnimatedEnumerationImpl *SVGFETurbulenceElementImpl::type() const +{ + return m_type; +} diff --git a/ksvg/impl/SVGFilterElementImpl.cc b/ksvg/impl/SVGFilterElementImpl.cc deleted file mode 100644 index 5ed2dd8c..00000000 --- a/ksvg/impl/SVGFilterElementImpl.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFilterElementImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedIntegerImpl.h" -#include "SVGAnimatedEnumerationImpl.h" - -using namespace KSVG; - -SVGFilterElementImpl::SVGFilterElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this) -{ - m_filterUnits = new SVGAnimatedEnumerationImpl(); - m_filterUnits->ref(); - - m_primitiveUnits = new SVGAnimatedEnumerationImpl(); - m_primitiveUnits->ref(); - - m_x = new SVGAnimatedLengthImpl(); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(); - m_y->ref(); - - m_width = new SVGAnimatedLengthImpl(); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(); - m_height->ref(); - - m_filterResX = new SVGAnimatedIntegerImpl(); - m_filterResX->ref(); - - m_filterResY = new SVGAnimatedIntegerImpl(); - m_filterResY->ref(); -} - -SVGFilterElementImpl::~SVGFilterElementImpl() -{ - if(m_filterUnits) - m_filterUnits->deref(); - if(m_primitiveUnits) - m_primitiveUnits->deref(); - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - if(m_filterResX) - m_filterResX->deref(); - if(m_filterResY) - m_filterResY->deref(); -} - -SVGAnimatedEnumerationImpl *SVGFilterElementImpl::filterUnits() const -{ - return m_filterUnits; -} - -SVGAnimatedEnumerationImpl *SVGFilterElementImpl::primitiveUnits() const -{ - return m_primitiveUnits; -} - -SVGAnimatedLengthImpl *SVGFilterElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGFilterElementImpl::y() const -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGFilterElementImpl::width() const -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGFilterElementImpl::height() const -{ - return m_height; -} - -SVGAnimatedIntegerImpl *SVGFilterElementImpl::filterResX() const -{ - return m_filterResX; -} - -SVGAnimatedIntegerImpl *SVGFilterElementImpl::filterResY() const -{ - return m_filterResY; -} - -void SVGFilterElementImpl::setFilterRes(unsigned long /*filterResX*/, unsigned long /*filterResY*/) -{ -} diff --git a/ksvg/impl/SVGFilterElementImpl.cpp b/ksvg/impl/SVGFilterElementImpl.cpp new file mode 100644 index 00000000..5ed2dd8c --- /dev/null +++ b/ksvg/impl/SVGFilterElementImpl.cpp @@ -0,0 +1,117 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFilterElementImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedIntegerImpl.h" +#include "SVGAnimatedEnumerationImpl.h" + +using namespace KSVG; + +SVGFilterElementImpl::SVGFilterElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this) +{ + m_filterUnits = new SVGAnimatedEnumerationImpl(); + m_filterUnits->ref(); + + m_primitiveUnits = new SVGAnimatedEnumerationImpl(); + m_primitiveUnits->ref(); + + m_x = new SVGAnimatedLengthImpl(); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(); + m_y->ref(); + + m_width = new SVGAnimatedLengthImpl(); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(); + m_height->ref(); + + m_filterResX = new SVGAnimatedIntegerImpl(); + m_filterResX->ref(); + + m_filterResY = new SVGAnimatedIntegerImpl(); + m_filterResY->ref(); +} + +SVGFilterElementImpl::~SVGFilterElementImpl() +{ + if(m_filterUnits) + m_filterUnits->deref(); + if(m_primitiveUnits) + m_primitiveUnits->deref(); + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + if(m_filterResX) + m_filterResX->deref(); + if(m_filterResY) + m_filterResY->deref(); +} + +SVGAnimatedEnumerationImpl *SVGFilterElementImpl::filterUnits() const +{ + return m_filterUnits; +} + +SVGAnimatedEnumerationImpl *SVGFilterElementImpl::primitiveUnits() const +{ + return m_primitiveUnits; +} + +SVGAnimatedLengthImpl *SVGFilterElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGFilterElementImpl::y() const +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGFilterElementImpl::width() const +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGFilterElementImpl::height() const +{ + return m_height; +} + +SVGAnimatedIntegerImpl *SVGFilterElementImpl::filterResX() const +{ + return m_filterResX; +} + +SVGAnimatedIntegerImpl *SVGFilterElementImpl::filterResY() const +{ + return m_filterResY; +} + +void SVGFilterElementImpl::setFilterRes(unsigned long /*filterResX*/, unsigned long /*filterResY*/) +{ +} diff --git a/ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cc b/ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cc deleted file mode 100644 index 07517afd..00000000 --- a/ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGFilterPrimitiveStandardAttributesImpl.h" - -using namespace KSVG; - -SVGFilterPrimitiveStandardAttributesImpl::SVGFilterPrimitiveStandardAttributesImpl() -{ - m_x = new SVGAnimatedLengthImpl(); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(); - m_y->ref(); - - m_width = new SVGAnimatedLengthImpl(); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(); - m_height->ref(); - - m_result = new SVGAnimatedStringImpl(); - m_result->ref(); -} - -SVGFilterPrimitiveStandardAttributesImpl::~SVGFilterPrimitiveStandardAttributesImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - if(m_result) - m_result->deref(); -} - -SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::x() const -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::y() const -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::width() const -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::height() const -{ - return m_height; -} - -SVGAnimatedStringImpl *SVGFilterPrimitiveStandardAttributesImpl::result() const -{ - return m_result; -} diff --git a/ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cpp b/ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cpp new file mode 100644 index 00000000..07517afd --- /dev/null +++ b/ksvg/impl/SVGFilterPrimitiveStandardAttributesImpl.cpp @@ -0,0 +1,82 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGFilterPrimitiveStandardAttributesImpl.h" + +using namespace KSVG; + +SVGFilterPrimitiveStandardAttributesImpl::SVGFilterPrimitiveStandardAttributesImpl() +{ + m_x = new SVGAnimatedLengthImpl(); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(); + m_y->ref(); + + m_width = new SVGAnimatedLengthImpl(); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(); + m_height->ref(); + + m_result = new SVGAnimatedStringImpl(); + m_result->ref(); +} + +SVGFilterPrimitiveStandardAttributesImpl::~SVGFilterPrimitiveStandardAttributesImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + if(m_result) + m_result->deref(); +} + +SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::x() const +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::y() const +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::width() const +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::height() const +{ + return m_height; +} + +SVGAnimatedStringImpl *SVGFilterPrimitiveStandardAttributesImpl::result() const +{ + return m_result; +} diff --git a/ksvg/impl/SVGFitToViewBoxImpl.cc b/ksvg/impl/SVGFitToViewBoxImpl.cc deleted file mode 100644 index a33bc0fc..00000000 --- a/ksvg/impl/SVGFitToViewBoxImpl.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include -#include - -#include "SVGPreserveAspectRatio.h" - -#include "SVGRectImpl.h" -#include "SVGFitToViewBoxImpl.h" -#include "SVGAnimatedRectImpl.h" -#include "SVGPreserveAspectRatioImpl.h" -#include "SVGAnimatedPreserveAspectRatioImpl.h" -#include "SVGSVGElementImpl.h" - -using namespace KSVG; - -#include "SVGFitToViewBoxImpl.lut.h" - -SVGFitToViewBoxImpl::SVGFitToViewBoxImpl() -{ - KSVG_EMPTY_FLAGS - - m_viewBox = new SVGAnimatedRectImpl(); - m_viewBox->ref(); - - m_preserveAspectRatio = new SVGAnimatedPreserveAspectRatioImpl(); - m_preserveAspectRatio->ref(); -} - -SVGFitToViewBoxImpl::~SVGFitToViewBoxImpl() -{ - if(m_viewBox) - m_viewBox->deref(); - if(m_preserveAspectRatio) - m_preserveAspectRatio->deref(); -} - -SVGAnimatedRectImpl *SVGFitToViewBoxImpl::viewBox() const -{ - return m_viewBox; -} - -SVGAnimatedPreserveAspectRatioImpl *SVGFitToViewBoxImpl::preserveAspectRatio() const -{ - return m_preserveAspectRatio; -} - -void SVGFitToViewBoxImpl::parseViewBox(const TQString &s) -{ - // Set default if preserveAspectRatio wasnt parsed earlier (Rob) - if(m_preserveAspectRatio->baseVal()->align() == SVG_PRESERVEASPECTRATIO_UNKNOWN) - m_preserveAspectRatio->baseVal()->setAlign(SVG_PRESERVEASPECTRATIO_XMIDYMID); - if(m_preserveAspectRatio->baseVal()->meetOrSlice() == SVG_MEETORSLICE_UNKNOWN) - m_preserveAspectRatio->baseVal()->setMeetOrSlice(SVG_MEETORSLICE_MEET); - - // allow for viewbox def with ',' or whitespace - TQString viewbox(s); - TQStringList points = TQStringList::split(' ', viewbox.replace(',', ' ').simplifyWhiteSpace()); - - viewBox()->baseVal()->setX(points[0].toFloat()); - viewBox()->baseVal()->setY(points[1].toFloat()); - viewBox()->baseVal()->setWidth(points[2].toFloat()); - viewBox()->baseVal()->setHeight(points[3].toFloat()); -} - -SVGMatrixImpl *SVGFitToViewBoxImpl::viewBoxToViewTransform(float viewWidth, float viewHeight) const -{ - if(viewBox()->baseVal()->width() == 0 || viewBox()->baseVal()->height() == 0) - return SVGSVGElementImpl::createSVGMatrix(); - else - return preserveAspectRatio()->baseVal()->getCTM(viewBox()->baseVal()->x(), - viewBox()->baseVal()->y(), viewBox()->baseVal()->width(), viewBox()->baseVal()->height(), - 0, 0, viewWidth, viewHeight); -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGFitToViewBoxImpl::s_hashTable 3 - viewBox SVGFitToViewBoxImpl::ViewBox DontDelete - preserveAspectRatio SVGFitToViewBoxImpl::PreserveAspectRatio DontDelete -@end -*/ - -Value SVGFitToViewBoxImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case ViewBox: - return m_viewBox->cache(exec); - case PreserveAspectRatio: - return m_preserveAspectRatio->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGFitToViewBoxImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case ViewBox: - parseViewBox(value.toString(exec).qstring()); - break; - case PreserveAspectRatio: - if(preserveAspectRatio()) - preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGFitToViewBoxImpl.cpp b/ksvg/impl/SVGFitToViewBoxImpl.cpp new file mode 100644 index 00000000..a33bc0fc --- /dev/null +++ b/ksvg/impl/SVGFitToViewBoxImpl.cpp @@ -0,0 +1,139 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include + +#include "SVGPreserveAspectRatio.h" + +#include "SVGRectImpl.h" +#include "SVGFitToViewBoxImpl.h" +#include "SVGAnimatedRectImpl.h" +#include "SVGPreserveAspectRatioImpl.h" +#include "SVGAnimatedPreserveAspectRatioImpl.h" +#include "SVGSVGElementImpl.h" + +using namespace KSVG; + +#include "SVGFitToViewBoxImpl.lut.h" + +SVGFitToViewBoxImpl::SVGFitToViewBoxImpl() +{ + KSVG_EMPTY_FLAGS + + m_viewBox = new SVGAnimatedRectImpl(); + m_viewBox->ref(); + + m_preserveAspectRatio = new SVGAnimatedPreserveAspectRatioImpl(); + m_preserveAspectRatio->ref(); +} + +SVGFitToViewBoxImpl::~SVGFitToViewBoxImpl() +{ + if(m_viewBox) + m_viewBox->deref(); + if(m_preserveAspectRatio) + m_preserveAspectRatio->deref(); +} + +SVGAnimatedRectImpl *SVGFitToViewBoxImpl::viewBox() const +{ + return m_viewBox; +} + +SVGAnimatedPreserveAspectRatioImpl *SVGFitToViewBoxImpl::preserveAspectRatio() const +{ + return m_preserveAspectRatio; +} + +void SVGFitToViewBoxImpl::parseViewBox(const TQString &s) +{ + // Set default if preserveAspectRatio wasnt parsed earlier (Rob) + if(m_preserveAspectRatio->baseVal()->align() == SVG_PRESERVEASPECTRATIO_UNKNOWN) + m_preserveAspectRatio->baseVal()->setAlign(SVG_PRESERVEASPECTRATIO_XMIDYMID); + if(m_preserveAspectRatio->baseVal()->meetOrSlice() == SVG_MEETORSLICE_UNKNOWN) + m_preserveAspectRatio->baseVal()->setMeetOrSlice(SVG_MEETORSLICE_MEET); + + // allow for viewbox def with ',' or whitespace + TQString viewbox(s); + TQStringList points = TQStringList::split(' ', viewbox.replace(',', ' ').simplifyWhiteSpace()); + + viewBox()->baseVal()->setX(points[0].toFloat()); + viewBox()->baseVal()->setY(points[1].toFloat()); + viewBox()->baseVal()->setWidth(points[2].toFloat()); + viewBox()->baseVal()->setHeight(points[3].toFloat()); +} + +SVGMatrixImpl *SVGFitToViewBoxImpl::viewBoxToViewTransform(float viewWidth, float viewHeight) const +{ + if(viewBox()->baseVal()->width() == 0 || viewBox()->baseVal()->height() == 0) + return SVGSVGElementImpl::createSVGMatrix(); + else + return preserveAspectRatio()->baseVal()->getCTM(viewBox()->baseVal()->x(), + viewBox()->baseVal()->y(), viewBox()->baseVal()->width(), viewBox()->baseVal()->height(), + 0, 0, viewWidth, viewHeight); +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGFitToViewBoxImpl::s_hashTable 3 + viewBox SVGFitToViewBoxImpl::ViewBox DontDelete + preserveAspectRatio SVGFitToViewBoxImpl::PreserveAspectRatio DontDelete +@end +*/ + +Value SVGFitToViewBoxImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case ViewBox: + return m_viewBox->cache(exec); + case PreserveAspectRatio: + return m_preserveAspectRatio->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGFitToViewBoxImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case ViewBox: + parseViewBox(value.toString(exec).qstring()); + break; + case PreserveAspectRatio: + if(preserveAspectRatio()) + preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGFontElementImpl.cc b/ksvg/impl/SVGFontElementImpl.cc deleted file mode 100644 index 49ed035c..00000000 --- a/ksvg/impl/SVGFontElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontElementImpl.h" - -using namespace KSVG; - -SVGFontElementImpl::SVGFontElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this) -{ -} - -SVGFontElementImpl::~SVGFontElementImpl() -{ -} diff --git a/ksvg/impl/SVGFontElementImpl.cpp b/ksvg/impl/SVGFontElementImpl.cpp new file mode 100644 index 00000000..49ed035c --- /dev/null +++ b/ksvg/impl/SVGFontElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontElementImpl.h" + +using namespace KSVG; + +SVGFontElementImpl::SVGFontElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this) +{ +} + +SVGFontElementImpl::~SVGFontElementImpl() +{ +} diff --git a/ksvg/impl/SVGFontFaceElementImpl.cc b/ksvg/impl/SVGFontFaceElementImpl.cc deleted file mode 100644 index b8ee49e1..00000000 --- a/ksvg/impl/SVGFontFaceElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceElementImpl.h" - -using namespace KSVG; - -SVGFontFaceElementImpl::SVGFontFaceElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGFontFaceElementImpl::~SVGFontFaceElementImpl() -{ -} diff --git a/ksvg/impl/SVGFontFaceElementImpl.cpp b/ksvg/impl/SVGFontFaceElementImpl.cpp new file mode 100644 index 00000000..b8ee49e1 --- /dev/null +++ b/ksvg/impl/SVGFontFaceElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceElementImpl.h" + +using namespace KSVG; + +SVGFontFaceElementImpl::SVGFontFaceElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGFontFaceElementImpl::~SVGFontFaceElementImpl() +{ +} diff --git a/ksvg/impl/SVGFontFaceFormatElementImpl.cc b/ksvg/impl/SVGFontFaceFormatElementImpl.cc deleted file mode 100644 index aecf957c..00000000 --- a/ksvg/impl/SVGFontFaceFormatElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceFormatElementImpl.h" - -using namespace KSVG; - -SVGFontFaceFormatElementImpl::SVGFontFaceFormatElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGFontFaceFormatElementImpl::~SVGFontFaceFormatElementImpl() -{ -} diff --git a/ksvg/impl/SVGFontFaceFormatElementImpl.cpp b/ksvg/impl/SVGFontFaceFormatElementImpl.cpp new file mode 100644 index 00000000..aecf957c --- /dev/null +++ b/ksvg/impl/SVGFontFaceFormatElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceFormatElementImpl.h" + +using namespace KSVG; + +SVGFontFaceFormatElementImpl::SVGFontFaceFormatElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGFontFaceFormatElementImpl::~SVGFontFaceFormatElementImpl() +{ +} diff --git a/ksvg/impl/SVGFontFaceNameElementImpl.cc b/ksvg/impl/SVGFontFaceNameElementImpl.cc deleted file mode 100644 index c4a295fc..00000000 --- a/ksvg/impl/SVGFontFaceNameElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceNameElementImpl.h" - -using namespace KSVG; - -SVGFontFaceNameElementImpl::SVGFontFaceNameElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGFontFaceNameElementImpl::~SVGFontFaceNameElementImpl() -{ -} diff --git a/ksvg/impl/SVGFontFaceNameElementImpl.cpp b/ksvg/impl/SVGFontFaceNameElementImpl.cpp new file mode 100644 index 00000000..c4a295fc --- /dev/null +++ b/ksvg/impl/SVGFontFaceNameElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceNameElementImpl.h" + +using namespace KSVG; + +SVGFontFaceNameElementImpl::SVGFontFaceNameElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGFontFaceNameElementImpl::~SVGFontFaceNameElementImpl() +{ +} diff --git a/ksvg/impl/SVGFontFaceSrcElementImpl.cc b/ksvg/impl/SVGFontFaceSrcElementImpl.cc deleted file mode 100644 index 9a2bd71e..00000000 --- a/ksvg/impl/SVGFontFaceSrcElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceSrcElementImpl.h" - -using namespace KSVG; - -SVGFontFaceSrcElementImpl::SVGFontFaceSrcElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGFontFaceSrcElementImpl::~SVGFontFaceSrcElementImpl() -{ -} diff --git a/ksvg/impl/SVGFontFaceSrcElementImpl.cpp b/ksvg/impl/SVGFontFaceSrcElementImpl.cpp new file mode 100644 index 00000000..9a2bd71e --- /dev/null +++ b/ksvg/impl/SVGFontFaceSrcElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceSrcElementImpl.h" + +using namespace KSVG; + +SVGFontFaceSrcElementImpl::SVGFontFaceSrcElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGFontFaceSrcElementImpl::~SVGFontFaceSrcElementImpl() +{ +} diff --git a/ksvg/impl/SVGFontFaceUriElementImpl.cc b/ksvg/impl/SVGFontFaceUriElementImpl.cc deleted file mode 100644 index 4a4153ae..00000000 --- a/ksvg/impl/SVGFontFaceUriElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGFontFaceUriElementImpl.h" - -using namespace KSVG; - -SVGFontFaceUriElementImpl::SVGFontFaceUriElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGFontFaceUriElementImpl::~SVGFontFaceUriElementImpl() -{ -} diff --git a/ksvg/impl/SVGFontFaceUriElementImpl.cpp b/ksvg/impl/SVGFontFaceUriElementImpl.cpp new file mode 100644 index 00000000..4a4153ae --- /dev/null +++ b/ksvg/impl/SVGFontFaceUriElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGFontFaceUriElementImpl.h" + +using namespace KSVG; + +SVGFontFaceUriElementImpl::SVGFontFaceUriElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGFontFaceUriElementImpl::~SVGFontFaceUriElementImpl() +{ +} diff --git a/ksvg/impl/SVGForeignObjectElementImpl.cc b/ksvg/impl/SVGForeignObjectElementImpl.cc deleted file mode 100644 index bf6b3c7a..00000000 --- a/ksvg/impl/SVGForeignObjectElementImpl.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2001-20032 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGRectImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGForeignObjectElementImpl.h" - -using namespace KSVG; - -#include "SVGForeignObjectElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGForeignObjectElementImpl::SVGForeignObjectElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - m_x = new SVGAnimatedLengthImpl(); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(); - m_y->ref(); - - m_width = new SVGAnimatedLengthImpl(); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(); - m_height->ref(); -} - -SVGForeignObjectElementImpl::~SVGForeignObjectElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); -} - -SVGRectImpl *SVGForeignObjectElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - ret->setX(m_x->baseVal()->value()); - ret->setY(m_y->baseVal()->value()); - ret->setWidth(m_width->baseVal()->value()); - ret->setHeight(m_height->baseVal()->value()); - return ret; -} - -SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::y() const -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::width() const -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::height() const -{ - return m_height; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGForeignObjectElementImpl::s_hashTable 5 - x SVGForeignObjectElementImpl::X DontDelete|ReadOnly - y SVGForeignObjectElementImpl::Y DontDelete|ReadOnly - width SVGForeignObjectElementImpl::Width DontDelete|ReadOnly - height SVGForeignObjectElementImpl::Height DontDelete|ReadOnly -@end -*/ - -Value SVGForeignObjectElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case X: - return m_x->cache(exec); - case Y: - return m_y->cache(exec); - case Width: - return m_width->cache(exec); - case Height: - return m_height->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGForeignObjectElementImpl.cpp b/ksvg/impl/SVGForeignObjectElementImpl.cpp new file mode 100644 index 00000000..bf6b3c7a --- /dev/null +++ b/ksvg/impl/SVGForeignObjectElementImpl.cpp @@ -0,0 +1,119 @@ +/* + Copyright (C) 2001-20032 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGRectImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGForeignObjectElementImpl.h" + +using namespace KSVG; + +#include "SVGForeignObjectElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGForeignObjectElementImpl::SVGForeignObjectElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + m_x = new SVGAnimatedLengthImpl(); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(); + m_y->ref(); + + m_width = new SVGAnimatedLengthImpl(); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(); + m_height->ref(); +} + +SVGForeignObjectElementImpl::~SVGForeignObjectElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); +} + +SVGRectImpl *SVGForeignObjectElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + ret->setX(m_x->baseVal()->value()); + ret->setY(m_y->baseVal()->value()); + ret->setWidth(m_width->baseVal()->value()); + ret->setHeight(m_height->baseVal()->value()); + return ret; +} + +SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::y() const +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::width() const +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGForeignObjectElementImpl::height() const +{ + return m_height; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGForeignObjectElementImpl::s_hashTable 5 + x SVGForeignObjectElementImpl::X DontDelete|ReadOnly + y SVGForeignObjectElementImpl::Y DontDelete|ReadOnly + width SVGForeignObjectElementImpl::Width DontDelete|ReadOnly + height SVGForeignObjectElementImpl::Height DontDelete|ReadOnly +@end +*/ + +Value SVGForeignObjectElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case X: + return m_x->cache(exec); + case Y: + return m_y->cache(exec); + case Width: + return m_width->cache(exec); + case Height: + return m_height->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/SVGGElementImpl.cc b/ksvg/impl/SVGGElementImpl.cc deleted file mode 100644 index 5cba29a3..00000000 --- a/ksvg/impl/SVGGElementImpl.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGElementImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGAElementImpl.h" -#include "SVGAnimatedStringImpl.h" - -using namespace KSVG; - -SVGGElementImpl::SVGGElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ -} - -SVGGElementImpl::~SVGGElementImpl() -{ -} diff --git a/ksvg/impl/SVGGElementImpl.cpp b/ksvg/impl/SVGGElementImpl.cpp new file mode 100644 index 00000000..5cba29a3 --- /dev/null +++ b/ksvg/impl/SVGGElementImpl.cpp @@ -0,0 +1,34 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGElementImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGAElementImpl.h" +#include "SVGAnimatedStringImpl.h" + +using namespace KSVG; + +SVGGElementImpl::SVGGElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ +} + +SVGGElementImpl::~SVGGElementImpl() +{ +} diff --git a/ksvg/impl/SVGGlyphElementImpl.cc b/ksvg/impl/SVGGlyphElementImpl.cc deleted file mode 100644 index 9b909960..00000000 --- a/ksvg/impl/SVGGlyphElementImpl.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGGlyphElementImpl.h" - -using namespace KSVG; - -#include "SVGGlyphElementImpl.lut.h" - -SVGGlyphElementImpl::SVGGlyphElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this) -{ - KSVG_EMPTY_FLAGS -} - -SVGGlyphElementImpl::~SVGGlyphElementImpl() -{ -} - -TQString SVGGlyphElementImpl::d() const -{ - return m_d; -} - -/* -@namespace KSVG -@begin SVGGlyphElementImpl::s_hashTable 11 - unicode SVGGlyphElementImpl::Unicode DontDelete|ReadOnly - glyph-name SVGGlyphElementImpl::GlyphName DontDelete|ReadOnly - d SVGGlyphElementImpl::D DontDelete|ReadOnly - orientation SVGGlyphElementImpl::Qt::Orientation DontDelete|ReadOnly - arabic-form SVGGlyphElementImpl::ArabicForm DontDelete|ReadOnly - lang SVGGlyphElementImpl::Lang DontDelete|ReadOnly - horiz-adv-x SVGGlyphElementImpl::HorizAdvX DontDelete|ReadOnly - vert-origin-x SVGGlyphElementImpl::VertOriginX DontDelete|ReadOnly - vert-origin-y SVGGlyphElementImpl::VertOriginY DontDelete|ReadOnly - vert-adv-y SVGGlyphElementImpl::VertAdvY DontDelete|ReadOnly -@end -*/ - -Value SVGGlyphElementImpl::getValueProperty(ExecState *, int token) const -{ - //KSVG_CHECK_ATTRIBUTE - - switch(token) - { - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGGlyphElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case D: - m_d = value.toString(exec).qstring(); - break; - case Unicode: - case GlyphName: - case Orientation: - case ArabicForm: - case Lang: - case HorizAdvX: - case VertOriginX: - case VertOriginY: - case VertAdvY: - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGGlyphElementImpl.cpp b/ksvg/impl/SVGGlyphElementImpl.cpp new file mode 100644 index 00000000..9b909960 --- /dev/null +++ b/ksvg/impl/SVGGlyphElementImpl.cpp @@ -0,0 +1,96 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGGlyphElementImpl.h" + +using namespace KSVG; + +#include "SVGGlyphElementImpl.lut.h" + +SVGGlyphElementImpl::SVGGlyphElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this) +{ + KSVG_EMPTY_FLAGS +} + +SVGGlyphElementImpl::~SVGGlyphElementImpl() +{ +} + +TQString SVGGlyphElementImpl::d() const +{ + return m_d; +} + +/* +@namespace KSVG +@begin SVGGlyphElementImpl::s_hashTable 11 + unicode SVGGlyphElementImpl::Unicode DontDelete|ReadOnly + glyph-name SVGGlyphElementImpl::GlyphName DontDelete|ReadOnly + d SVGGlyphElementImpl::D DontDelete|ReadOnly + orientation SVGGlyphElementImpl::Qt::Orientation DontDelete|ReadOnly + arabic-form SVGGlyphElementImpl::ArabicForm DontDelete|ReadOnly + lang SVGGlyphElementImpl::Lang DontDelete|ReadOnly + horiz-adv-x SVGGlyphElementImpl::HorizAdvX DontDelete|ReadOnly + vert-origin-x SVGGlyphElementImpl::VertOriginX DontDelete|ReadOnly + vert-origin-y SVGGlyphElementImpl::VertOriginY DontDelete|ReadOnly + vert-adv-y SVGGlyphElementImpl::VertAdvY DontDelete|ReadOnly +@end +*/ + +Value SVGGlyphElementImpl::getValueProperty(ExecState *, int token) const +{ + //KSVG_CHECK_ATTRIBUTE + + switch(token) + { + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGGlyphElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case D: + m_d = value.toString(exec).qstring(); + break; + case Unicode: + case GlyphName: + case Orientation: + case ArabicForm: + case Lang: + case HorizAdvX: + case VertOriginX: + case VertOriginY: + case VertAdvY: + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGGlyphRefElementImpl.cc b/ksvg/impl/SVGGlyphRefElementImpl.cc deleted file mode 100644 index 10366dd9..00000000 --- a/ksvg/impl/SVGGlyphRefElementImpl.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGSVGElementImpl.h" -#include "SVGGlyphRefElementImpl.h" - -using namespace KSVG; - -#include "SVGGlyphRefElementImpl.lut.h" -#include "ksvg_lookup.h" - -SVGGlyphRefElementImpl::SVGGlyphRefElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGStylableImpl(this) -{ -} - -SVGGlyphRefElementImpl::~SVGGlyphRefElementImpl() -{ -} - -void SVGGlyphRefElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); -} - -DOM::DOMString SVGGlyphRefElementImpl::format() -{ - return ""; -} - -DOM::DOMString SVGGlyphRefElementImpl::glyphRef() -{ - return ""; -} - -float SVGGlyphRefElementImpl::x() const -{ - return m_x; -} - -float SVGGlyphRefElementImpl::y() const -{ - return m_y; -} - -float SVGGlyphRefElementImpl::dx() const -{ - return m_dx; -} - -float SVGGlyphRefElementImpl::dy() const -{ - return m_dy; -} - -/* -@namespace KSVG -@begin SVGGlyphRefElementImpl::s_hashTable 7 - glyphRef SVGGlyphRefElementImpl::GlyphRef DontDelete|ReadOnly - format SVGGlyphRefElementImpl::Format DontDelete|ReadOnly - x SVGGlyphRefElementImpl::X DontDelete|ReadOnly - y SVGGlyphRefElementImpl::Y DontDelete|ReadOnly - dx SVGGlyphRefElementImpl::Dx DontDelete|ReadOnly - dy SVGGlyphRefElementImpl::Dy DontDelete|ReadOnly -@end -*/ - -Value SVGGlyphRefElementImpl::getValueProperty(ExecState *, int token) const -{ - //KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case GlyphRef: return String(m_glyphRef); - case Format: return String(m_format); - case X: return Number(m_x); - case Y: return Number(m_y); - case Dx: return Number(m_dx); - case Dy: return Number(m_dy); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGGlyphRefElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case GlyphRef: - m_glyphRef = value.toString(exec).string(); - break; - case Format: - m_format = value.toString(exec).string(); - break; - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case Dx: - m_dx = value.toNumber(exec); - break; - case Dy: - m_dy = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGGlyphRefElementImpl.cpp b/ksvg/impl/SVGGlyphRefElementImpl.cpp new file mode 100644 index 00000000..10366dd9 --- /dev/null +++ b/ksvg/impl/SVGGlyphRefElementImpl.cpp @@ -0,0 +1,132 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGSVGElementImpl.h" +#include "SVGGlyphRefElementImpl.h" + +using namespace KSVG; + +#include "SVGGlyphRefElementImpl.lut.h" +#include "ksvg_lookup.h" + +SVGGlyphRefElementImpl::SVGGlyphRefElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGStylableImpl(this) +{ +} + +SVGGlyphRefElementImpl::~SVGGlyphRefElementImpl() +{ +} + +void SVGGlyphRefElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); +} + +DOM::DOMString SVGGlyphRefElementImpl::format() +{ + return ""; +} + +DOM::DOMString SVGGlyphRefElementImpl::glyphRef() +{ + return ""; +} + +float SVGGlyphRefElementImpl::x() const +{ + return m_x; +} + +float SVGGlyphRefElementImpl::y() const +{ + return m_y; +} + +float SVGGlyphRefElementImpl::dx() const +{ + return m_dx; +} + +float SVGGlyphRefElementImpl::dy() const +{ + return m_dy; +} + +/* +@namespace KSVG +@begin SVGGlyphRefElementImpl::s_hashTable 7 + glyphRef SVGGlyphRefElementImpl::GlyphRef DontDelete|ReadOnly + format SVGGlyphRefElementImpl::Format DontDelete|ReadOnly + x SVGGlyphRefElementImpl::X DontDelete|ReadOnly + y SVGGlyphRefElementImpl::Y DontDelete|ReadOnly + dx SVGGlyphRefElementImpl::Dx DontDelete|ReadOnly + dy SVGGlyphRefElementImpl::Dy DontDelete|ReadOnly +@end +*/ + +Value SVGGlyphRefElementImpl::getValueProperty(ExecState *, int token) const +{ + //KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case GlyphRef: return String(m_glyphRef); + case Format: return String(m_format); + case X: return Number(m_x); + case Y: return Number(m_y); + case Dx: return Number(m_dx); + case Dy: return Number(m_dy); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGGlyphRefElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case GlyphRef: + m_glyphRef = value.toString(exec).string(); + break; + case Format: + m_format = value.toString(exec).string(); + break; + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case Dx: + m_dx = value.toNumber(exec); + break; + case Dy: + m_dy = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGGradientElementImpl.cc b/ksvg/impl/SVGGradientElementImpl.cc deleted file mode 100644 index b59679e2..00000000 --- a/ksvg/impl/SVGGradientElementImpl.cc +++ /dev/null @@ -1,262 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGradientElement.h" -#include "SVGGradientElementImpl.h" -#include "SVGStopElementImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGSVGElementImpl.h" - -#include "KSVGCanvas.h" -#include "CanvasItems.h" -#include "SVGHelperImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGAnimatedTransformListImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGUnitConverter.h" - -using namespace KSVG; - -#include "SVGGradientElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" -#include "ksvg_cacheimpl.h" - -SVGGradientElementImpl::SVGGradientElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGPaintServerImpl() -{ - KSVG_EMPTY_FLAGS - - m_gradientUnits = new SVGAnimatedEnumerationImpl(); - m_gradientUnits->ref(); - - m_gradientTransform = new SVGAnimatedTransformListImpl(); - m_gradientTransform->ref(); - - m_spreadMethod = new SVGAnimatedEnumerationImpl(); - m_spreadMethod->ref(); - - m_converter = new SVGUnitConverter(); -} - -SVGGradientElementImpl::~SVGGradientElementImpl() -{ - if(m_gradientUnits) - m_gradientUnits->deref(); - if(m_gradientTransform) - m_gradientTransform->deref(); - if(m_spreadMethod) - m_spreadMethod->deref(); - delete m_converter; -} - -SVGAnimatedEnumerationImpl *SVGGradientElementImpl::gradientUnits() const -{ - return m_gradientUnits; -} - -SVGAnimatedTransformListImpl *SVGGradientElementImpl::gradientTransform() const -{ - return m_gradientTransform; -} - -SVGAnimatedEnumerationImpl *SVGGradientElementImpl::spreadMethod() const -{ - return m_spreadMethod; -} - -/* -@namespace KSVG -@begin SVGGradientElementImpl::s_hashTable 5 - gradientUnits SVGGradientElementImpl::GradientUnits DontDelete|ReadOnly - gradientTransform SVGGradientElementImpl::GradientTransform DontDelete|ReadOnly - spreadMethod SVGGradientElementImpl::SpreadMethod DontDelete|ReadOnly -@end -*/ - -Value SVGGradientElementImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case GradientUnits: - return m_gradientUnits->cache(exec); - case GradientTransform: - return m_gradientTransform->cache(exec); - case SpreadMethod: - return m_spreadMethod->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGGradientElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case GradientUnits: - if(value.toString(exec).qstring() == "userSpaceOnUse") - m_gradientUnits->setBaseVal(SVGGradientElement::SVG_UNIT_TYPE_USERSPACEONUSE); - else - m_gradientUnits->setBaseVal(SVGGradientElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); - break; - case GradientTransform: - m_gradientTransform->baseVal()->clear(); - SVGHelperImpl::parseTransformAttribute(m_gradientTransform->baseVal(), value.toString(exec).qstring()); - break; - case SpreadMethod: - { - TQString spreadMethod = value.toString(exec).qstring(); - - if(spreadMethod == "repeat") - m_spreadMethod->setBaseVal(SVG_SPREADMETHOD_REPEAT); - else if(spreadMethod == "reflect") - m_spreadMethod->setBaseVal(SVG_SPREADMETHOD_REFLECT); - else - m_spreadMethod->setBaseVal(SVG_SPREADMETHOD_PAD); - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGGradientElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - setAttributesFromHref(); - - // Spec: if attribute not specified, use "pad" - if(KSVG_TOKEN_NOT_PARSED(SpreadMethod)) - KSVG_SET_ALT_ATTRIBUTE(SpreadMethod, "pad") - - // Spec: if attribute not specified, use objectBoundingBox - if(KSVG_TOKEN_NOT_PARSED(GradientUnits)) - KSVG_SET_ALT_ATTRIBUTE(GradientUnits, "objectBoundingBox") -} - -void SVGGradientElementImpl::setAttributesFromHref() -{ - TQString _href = SVGURIReferenceImpl::getTarget(href()->baseVal().string()); - - if(!_href.isEmpty()) - { - SVGGradientElementImpl *refGradient = dynamic_cast(ownerSVGElement()->getElementById(_href)); - - if(refGradient) - { - TQMap refAttributes = refGradient->gradientAttributes(); - TQMap::iterator it; - - for(it = refAttributes.begin(); it != refAttributes.end(); ++it) - { - TQString name = it.key(); - DOM::DOMString value = it.data(); - - if(!hasAttribute(name)) - { - setAttribute(name, value); - setAttributeInternal(name, value); - } - } - } - } -} - -SVGGradientElementImpl *SVGGradientElementImpl::stopsSource() -{ - // Spec: - // If this element has no defined gradient stops, and the referenced element does - // (possibly due to its own href attribute), then this element inherits the gradient stop from the referenced element. - // Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attribute or gradient stops - // due to its own href attribute, then the current element can inherit those attributes or gradient stops. (mop) - bool haveStops = false; - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGStopElementImpl *stop = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); - - if(stop) - { - haveStops = true; - break; - } - } - - SVGGradientElementImpl *source = this; - - if(!haveStops) - { - TQString _href = SVGURIReferenceImpl::getTarget(href()->baseVal().string()); - - if(!_href.isEmpty()) - { - SVGGradientElementImpl *refGradient = dynamic_cast(ownerSVGElement()->getElementById(_href)); - - if(refGradient) - source = refGradient->stopsSource(); - } - } - - return source; -} - -void SVGGradientElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_paintServer) - m_paintServer = c->createPaintServer(this); -} - -void SVGGradientElementImpl::removeItem(KSVGCanvas *) -{ - delete m_paintServer; - m_paintServer = 0; -} - -/* -@namespace KSVG -@begin SVGGradientElementImplConstructor::s_hashTable 5 - SVG_SPREADMETHOD_UNKNOWN KSVG::SVG_SPREADMETHOD_UNKNOWN DontDelete|ReadOnly - SVG_SPREADMETHOD_PAD KSVG::SVG_SPREADMETHOD_PAD DontDelete|ReadOnly - SVG_SPREADMETHOD_REFLECT KSVG::SVG_SPREADMETHOD_REFLECT DontDelete|ReadOnly - SVG_SPREADMETHOD_REPEAT KSVG::SVG_SPREADMETHOD_REPEAT DontDelete|ReadOnly -@end -*/ - -using namespace KJS; - -Value SVGGradientElementImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGGradientElementImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svggradientelement.constructor]]"); -} diff --git a/ksvg/impl/SVGGradientElementImpl.cpp b/ksvg/impl/SVGGradientElementImpl.cpp new file mode 100644 index 00000000..b59679e2 --- /dev/null +++ b/ksvg/impl/SVGGradientElementImpl.cpp @@ -0,0 +1,262 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGradientElement.h" +#include "SVGGradientElementImpl.h" +#include "SVGStopElementImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGSVGElementImpl.h" + +#include "KSVGCanvas.h" +#include "CanvasItems.h" +#include "SVGHelperImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGAnimatedTransformListImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGUnitConverter.h" + +using namespace KSVG; + +#include "SVGGradientElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" +#include "ksvg_cacheimpl.h" + +SVGGradientElementImpl::SVGGradientElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGPaintServerImpl() +{ + KSVG_EMPTY_FLAGS + + m_gradientUnits = new SVGAnimatedEnumerationImpl(); + m_gradientUnits->ref(); + + m_gradientTransform = new SVGAnimatedTransformListImpl(); + m_gradientTransform->ref(); + + m_spreadMethod = new SVGAnimatedEnumerationImpl(); + m_spreadMethod->ref(); + + m_converter = new SVGUnitConverter(); +} + +SVGGradientElementImpl::~SVGGradientElementImpl() +{ + if(m_gradientUnits) + m_gradientUnits->deref(); + if(m_gradientTransform) + m_gradientTransform->deref(); + if(m_spreadMethod) + m_spreadMethod->deref(); + delete m_converter; +} + +SVGAnimatedEnumerationImpl *SVGGradientElementImpl::gradientUnits() const +{ + return m_gradientUnits; +} + +SVGAnimatedTransformListImpl *SVGGradientElementImpl::gradientTransform() const +{ + return m_gradientTransform; +} + +SVGAnimatedEnumerationImpl *SVGGradientElementImpl::spreadMethod() const +{ + return m_spreadMethod; +} + +/* +@namespace KSVG +@begin SVGGradientElementImpl::s_hashTable 5 + gradientUnits SVGGradientElementImpl::GradientUnits DontDelete|ReadOnly + gradientTransform SVGGradientElementImpl::GradientTransform DontDelete|ReadOnly + spreadMethod SVGGradientElementImpl::SpreadMethod DontDelete|ReadOnly +@end +*/ + +Value SVGGradientElementImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case GradientUnits: + return m_gradientUnits->cache(exec); + case GradientTransform: + return m_gradientTransform->cache(exec); + case SpreadMethod: + return m_spreadMethod->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGGradientElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case GradientUnits: + if(value.toString(exec).qstring() == "userSpaceOnUse") + m_gradientUnits->setBaseVal(SVGGradientElement::SVG_UNIT_TYPE_USERSPACEONUSE); + else + m_gradientUnits->setBaseVal(SVGGradientElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); + break; + case GradientTransform: + m_gradientTransform->baseVal()->clear(); + SVGHelperImpl::parseTransformAttribute(m_gradientTransform->baseVal(), value.toString(exec).qstring()); + break; + case SpreadMethod: + { + TQString spreadMethod = value.toString(exec).qstring(); + + if(spreadMethod == "repeat") + m_spreadMethod->setBaseVal(SVG_SPREADMETHOD_REPEAT); + else if(spreadMethod == "reflect") + m_spreadMethod->setBaseVal(SVG_SPREADMETHOD_REFLECT); + else + m_spreadMethod->setBaseVal(SVG_SPREADMETHOD_PAD); + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGGradientElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + setAttributesFromHref(); + + // Spec: if attribute not specified, use "pad" + if(KSVG_TOKEN_NOT_PARSED(SpreadMethod)) + KSVG_SET_ALT_ATTRIBUTE(SpreadMethod, "pad") + + // Spec: if attribute not specified, use objectBoundingBox + if(KSVG_TOKEN_NOT_PARSED(GradientUnits)) + KSVG_SET_ALT_ATTRIBUTE(GradientUnits, "objectBoundingBox") +} + +void SVGGradientElementImpl::setAttributesFromHref() +{ + TQString _href = SVGURIReferenceImpl::getTarget(href()->baseVal().string()); + + if(!_href.isEmpty()) + { + SVGGradientElementImpl *refGradient = dynamic_cast(ownerSVGElement()->getElementById(_href)); + + if(refGradient) + { + TQMap refAttributes = refGradient->gradientAttributes(); + TQMap::iterator it; + + for(it = refAttributes.begin(); it != refAttributes.end(); ++it) + { + TQString name = it.key(); + DOM::DOMString value = it.data(); + + if(!hasAttribute(name)) + { + setAttribute(name, value); + setAttributeInternal(name, value); + } + } + } + } +} + +SVGGradientElementImpl *SVGGradientElementImpl::stopsSource() +{ + // Spec: + // If this element has no defined gradient stops, and the referenced element does + // (possibly due to its own href attribute), then this element inherits the gradient stop from the referenced element. + // Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attribute or gradient stops + // due to its own href attribute, then the current element can inherit those attributes or gradient stops. (mop) + bool haveStops = false; + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGStopElementImpl *stop = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); + + if(stop) + { + haveStops = true; + break; + } + } + + SVGGradientElementImpl *source = this; + + if(!haveStops) + { + TQString _href = SVGURIReferenceImpl::getTarget(href()->baseVal().string()); + + if(!_href.isEmpty()) + { + SVGGradientElementImpl *refGradient = dynamic_cast(ownerSVGElement()->getElementById(_href)); + + if(refGradient) + source = refGradient->stopsSource(); + } + } + + return source; +} + +void SVGGradientElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_paintServer) + m_paintServer = c->createPaintServer(this); +} + +void SVGGradientElementImpl::removeItem(KSVGCanvas *) +{ + delete m_paintServer; + m_paintServer = 0; +} + +/* +@namespace KSVG +@begin SVGGradientElementImplConstructor::s_hashTable 5 + SVG_SPREADMETHOD_UNKNOWN KSVG::SVG_SPREADMETHOD_UNKNOWN DontDelete|ReadOnly + SVG_SPREADMETHOD_PAD KSVG::SVG_SPREADMETHOD_PAD DontDelete|ReadOnly + SVG_SPREADMETHOD_REFLECT KSVG::SVG_SPREADMETHOD_REFLECT DontDelete|ReadOnly + SVG_SPREADMETHOD_REPEAT KSVG::SVG_SPREADMETHOD_REPEAT DontDelete|ReadOnly +@end +*/ + +using namespace KJS; + +Value SVGGradientElementImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGGradientElementImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svggradientelement.constructor]]"); +} diff --git a/ksvg/impl/SVGHKernElementImpl.cc b/ksvg/impl/SVGHKernElementImpl.cc deleted file mode 100644 index 64efce26..00000000 --- a/ksvg/impl/SVGHKernElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGHKernElementImpl.h" - -using namespace KSVG; - -SVGHKernElementImpl::SVGHKernElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGHKernElementImpl::~SVGHKernElementImpl() -{ -} diff --git a/ksvg/impl/SVGHKernElementImpl.cpp b/ksvg/impl/SVGHKernElementImpl.cpp new file mode 100644 index 00000000..64efce26 --- /dev/null +++ b/ksvg/impl/SVGHKernElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGHKernElementImpl.h" + +using namespace KSVG; + +SVGHKernElementImpl::SVGHKernElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGHKernElementImpl::~SVGHKernElementImpl() +{ +} diff --git a/ksvg/impl/SVGHelperImpl.cc b/ksvg/impl/SVGHelperImpl.cc deleted file mode 100644 index fb546fbe..00000000 --- a/ksvg/impl/SVGHelperImpl.cc +++ /dev/null @@ -1,228 +0,0 @@ -/* - Copyright (C) 2002-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGRectImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGHelperImpl.h" -#include "SVGElementImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGStylableImpl.h" -#include "SVGTransformImpl.h" -#include "SVGStringListImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGTransformableImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedLengthListImpl.h" - -#include "KSVGCanvas.h" -#include "CanvasItem.h" - -using namespace KSVG; - -#include "ksvg_ecma.h" -#include "ksvg_window.h" - -SVGHelperImpl::SVGHelperImpl() -{ -} - -SVGHelperImpl::~SVGHelperImpl() -{ -} - -void SVGHelperImpl::updateItem(KJS::ExecState *exec, const DOM::Node node) -{ - // Get document - SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); - - // Update canvas, recursively if needed - SVGShapeImpl *shape = dynamic_cast(doc->getElementFromHandle(node.handle())); - - if(shape && shape->item()) - { - shape->item()->update(UPDATE_TRANSFORM); - shape->item()->draw(); - shape->blit(doc->canvas()); - } - - if(const_cast(node).hasChildNodes()) - { - DOM::Node iterate = node.firstChild(); - for(; !iterate.isNull(); iterate = iterate.nextSibling()) - updateItem(exec, iterate); - } -} - -void SVGHelperImpl::copyAttributes(SVGElementImpl *src, SVGElementImpl *dst) -{ - TQDictIterator it(src->attributes()); - for(; it.current(); ++it) - { - DOM::DOMString name = it.currentKey(); - DOM::DOMString value = it.current()->string(); - - if(name != "id" && !dst->hasAttribute(name)) - { - dst->setAttribute(name, value); - dst->setAttributeInternal(name, value); - } - } -} - -void SVGHelperImpl::parseList(SVGStringListImpl *list, char seperator, const TQString &data) -{ - // TODO : more error checking/reporting - list->clear(); - - TQStringList substrings = TQStringList::split(seperator, data); - TQStringList::ConstIterator it = substrings.begin(); - TQStringList::ConstIterator end = substrings.end(); - for(; it != end; ++it) - { - SharedString *string = new SharedString(*it); - string->ref(); - - list->appendItem(string); - } -} - -void SVGHelperImpl::parseLengthList(SVGAnimatedLengthListImpl *list, const TQString &lengths, LengthMode mode, SVGElementImpl *object) -{ - // get either comma or space delimited lists - // TODO : more error checking/reporting - TQStringList sublengths = TQStringList::split(TQRegExp("[, ]"), lengths); - TQStringList::ConstIterator it = sublengths.begin(); - TQStringList::ConstIterator end = sublengths.end(); - - SVGLengthImpl *lengthImpl = 0; - for(; it != end; ++it) - { - lengthImpl = new SVGLengthImpl(mode, object); - lengthImpl->ref(); - - lengthImpl->setValueAsString(*it); - list->baseVal()->appendItem(lengthImpl); - } -} - -void SVGHelperImpl::parseCommaSeperatedList(SVGStringListImpl *list, const TQString &data) -{ - parseList(list, ',', data); -} - -void SVGHelperImpl::parseSemicolonSeperatedList(SVGStringListImpl *list, const TQString &data) -{ - parseList(list, ';', data); -} - -void SVGHelperImpl::parseTransformAttribute(SVGTransformListImpl *list, const TQString &transform) -{ - // Split string for handling 1 transform statement at a time - TQStringList subtransforms = TQStringList::split(')', transform); - TQStringList::ConstIterator it = subtransforms.begin(); - TQStringList::ConstIterator end = subtransforms.end(); - for(; it != end; ++it) - { - TQStringList subtransform = TQStringList::split('(', (*it)); - - subtransform[0] = subtransform[0].stripWhiteSpace().lower(); - subtransform[1] = subtransform[1].simplifyWhiteSpace(); - TQRegExp reg("([-]?\\d*\\.?\\d+(?:e[-]?\\d+)?)"); - - int pos = 0; - TQStringList params; - - while(pos >= 0) - { - pos = reg.search(subtransform[1], pos); - if(pos != -1) - { - params += reg.cap(1); - pos += reg.matchedLength(); - } - } - - if(subtransform[0].startsWith(";") || subtransform[0].startsWith(",")) - subtransform[0] = subtransform[0].right(subtransform[0].length() - 1); - - SVGTransformImpl *t = SVGSVGElementImpl::createSVGTransform(); - - if(subtransform[0] == "rotate") - { - if(params.count() == 3) - t->setRotate(params[0].toDouble(), - params[1].toDouble(), - params[2].toDouble()); - else - t->setRotate(params[0].toDouble(), 0, 0); - } - else if(subtransform[0] == "translate") - { - if(params.count() == 2) - t->setTranslate(params[0].toDouble(), params[1].toDouble()); - else // Spec : if only one param given, assume 2nd param to be 0 - t->setTranslate(params[0].toDouble(), 0); - } - else if(subtransform[0] == "scale") - { - if(params.count() == 2) - t->setScale(params[0].toDouble(), params[1].toDouble()); - else // Spec : if only one param given, assume uniform scaling - t->setScale(params[0].toDouble(), params[0].toDouble()); - } - else if(subtransform[0] == "skewx") - t->setSkewX(params[0].toDouble()); - else if(subtransform[0] == "skewy") - t->setSkewY(params[0].toDouble()); - else if(subtransform[0] == "matrix") - { - if(params.count() >= 6) - { - SVGMatrixImpl *ret = new SVGMatrixImpl(params[0].toDouble(), - params[1].toDouble(), - params[2].toDouble(), - params[3].toDouble(), - params[4].toDouble(), - params[5].toDouble()); - t->setMatrix(ret); - } - } - - list->appendItem(t); - } -} - -/// convert from user space to "real" pixels on rendering area -TQRect SVGHelperImpl::fromUserspace(SVGElementImpl *obj, const TQRect &r) -{ - TQRect sr; - - SVGLocatableImpl *locate = dynamic_cast(obj); - - if(locate) - sr = locate->screenCTM()->qmatrix().mapRect(r); - - return sr; -} diff --git a/ksvg/impl/SVGHelperImpl.cpp b/ksvg/impl/SVGHelperImpl.cpp new file mode 100644 index 00000000..fb546fbe --- /dev/null +++ b/ksvg/impl/SVGHelperImpl.cpp @@ -0,0 +1,228 @@ +/* + Copyright (C) 2002-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGRectImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGHelperImpl.h" +#include "SVGElementImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGStylableImpl.h" +#include "SVGTransformImpl.h" +#include "SVGStringListImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGTransformableImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedLengthListImpl.h" + +#include "KSVGCanvas.h" +#include "CanvasItem.h" + +using namespace KSVG; + +#include "ksvg_ecma.h" +#include "ksvg_window.h" + +SVGHelperImpl::SVGHelperImpl() +{ +} + +SVGHelperImpl::~SVGHelperImpl() +{ +} + +void SVGHelperImpl::updateItem(KJS::ExecState *exec, const DOM::Node node) +{ + // Get document + SVGDocumentImpl *doc = Window::retrieveActive(exec)->doc(); + + // Update canvas, recursively if needed + SVGShapeImpl *shape = dynamic_cast(doc->getElementFromHandle(node.handle())); + + if(shape && shape->item()) + { + shape->item()->update(UPDATE_TRANSFORM); + shape->item()->draw(); + shape->blit(doc->canvas()); + } + + if(const_cast(node).hasChildNodes()) + { + DOM::Node iterate = node.firstChild(); + for(; !iterate.isNull(); iterate = iterate.nextSibling()) + updateItem(exec, iterate); + } +} + +void SVGHelperImpl::copyAttributes(SVGElementImpl *src, SVGElementImpl *dst) +{ + TQDictIterator it(src->attributes()); + for(; it.current(); ++it) + { + DOM::DOMString name = it.currentKey(); + DOM::DOMString value = it.current()->string(); + + if(name != "id" && !dst->hasAttribute(name)) + { + dst->setAttribute(name, value); + dst->setAttributeInternal(name, value); + } + } +} + +void SVGHelperImpl::parseList(SVGStringListImpl *list, char seperator, const TQString &data) +{ + // TODO : more error checking/reporting + list->clear(); + + TQStringList substrings = TQStringList::split(seperator, data); + TQStringList::ConstIterator it = substrings.begin(); + TQStringList::ConstIterator end = substrings.end(); + for(; it != end; ++it) + { + SharedString *string = new SharedString(*it); + string->ref(); + + list->appendItem(string); + } +} + +void SVGHelperImpl::parseLengthList(SVGAnimatedLengthListImpl *list, const TQString &lengths, LengthMode mode, SVGElementImpl *object) +{ + // get either comma or space delimited lists + // TODO : more error checking/reporting + TQStringList sublengths = TQStringList::split(TQRegExp("[, ]"), lengths); + TQStringList::ConstIterator it = sublengths.begin(); + TQStringList::ConstIterator end = sublengths.end(); + + SVGLengthImpl *lengthImpl = 0; + for(; it != end; ++it) + { + lengthImpl = new SVGLengthImpl(mode, object); + lengthImpl->ref(); + + lengthImpl->setValueAsString(*it); + list->baseVal()->appendItem(lengthImpl); + } +} + +void SVGHelperImpl::parseCommaSeperatedList(SVGStringListImpl *list, const TQString &data) +{ + parseList(list, ',', data); +} + +void SVGHelperImpl::parseSemicolonSeperatedList(SVGStringListImpl *list, const TQString &data) +{ + parseList(list, ';', data); +} + +void SVGHelperImpl::parseTransformAttribute(SVGTransformListImpl *list, const TQString &transform) +{ + // Split string for handling 1 transform statement at a time + TQStringList subtransforms = TQStringList::split(')', transform); + TQStringList::ConstIterator it = subtransforms.begin(); + TQStringList::ConstIterator end = subtransforms.end(); + for(; it != end; ++it) + { + TQStringList subtransform = TQStringList::split('(', (*it)); + + subtransform[0] = subtransform[0].stripWhiteSpace().lower(); + subtransform[1] = subtransform[1].simplifyWhiteSpace(); + TQRegExp reg("([-]?\\d*\\.?\\d+(?:e[-]?\\d+)?)"); + + int pos = 0; + TQStringList params; + + while(pos >= 0) + { + pos = reg.search(subtransform[1], pos); + if(pos != -1) + { + params += reg.cap(1); + pos += reg.matchedLength(); + } + } + + if(subtransform[0].startsWith(";") || subtransform[0].startsWith(",")) + subtransform[0] = subtransform[0].right(subtransform[0].length() - 1); + + SVGTransformImpl *t = SVGSVGElementImpl::createSVGTransform(); + + if(subtransform[0] == "rotate") + { + if(params.count() == 3) + t->setRotate(params[0].toDouble(), + params[1].toDouble(), + params[2].toDouble()); + else + t->setRotate(params[0].toDouble(), 0, 0); + } + else if(subtransform[0] == "translate") + { + if(params.count() == 2) + t->setTranslate(params[0].toDouble(), params[1].toDouble()); + else // Spec : if only one param given, assume 2nd param to be 0 + t->setTranslate(params[0].toDouble(), 0); + } + else if(subtransform[0] == "scale") + { + if(params.count() == 2) + t->setScale(params[0].toDouble(), params[1].toDouble()); + else // Spec : if only one param given, assume uniform scaling + t->setScale(params[0].toDouble(), params[0].toDouble()); + } + else if(subtransform[0] == "skewx") + t->setSkewX(params[0].toDouble()); + else if(subtransform[0] == "skewy") + t->setSkewY(params[0].toDouble()); + else if(subtransform[0] == "matrix") + { + if(params.count() >= 6) + { + SVGMatrixImpl *ret = new SVGMatrixImpl(params[0].toDouble(), + params[1].toDouble(), + params[2].toDouble(), + params[3].toDouble(), + params[4].toDouble(), + params[5].toDouble()); + t->setMatrix(ret); + } + } + + list->appendItem(t); + } +} + +/// convert from user space to "real" pixels on rendering area +TQRect SVGHelperImpl::fromUserspace(SVGElementImpl *obj, const TQRect &r) +{ + TQRect sr; + + SVGLocatableImpl *locate = dynamic_cast(obj); + + if(locate) + sr = locate->screenCTM()->qmatrix().mapRect(r); + + return sr; +} diff --git a/ksvg/impl/SVGICCColorImpl.cc b/ksvg/impl/SVGICCColorImpl.cc deleted file mode 100644 index 50af51c9..00000000 --- a/ksvg/impl/SVGICCColorImpl.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGICCColorImpl.h" -#include "SVGNumberListImpl.h" - -using namespace KSVG; - -#include "SVGICCColorImpl.lut.h" -#include "ksvg_bridge.h" - -SVGICCColorImpl::SVGICCColorImpl() : DOM::DomShared() -{ - m_colors = new SVGNumberListImpl(); - m_colors->ref(); -} - -SVGICCColorImpl::SVGICCColorImpl(const SVGICCColorImpl &other) : DOM::DomShared() -{ - (*this) = other; -} - -SVGICCColorImpl::~SVGICCColorImpl() -{ - if(m_colors) - m_colors->deref(); -} - -SVGICCColorImpl &SVGICCColorImpl::operator=(const SVGICCColorImpl &other) -{ - m_colorProfile = other.m_colorProfile; - *m_colors = *(other.m_colors); - - return *this; -} - -DOM::DOMString SVGICCColorImpl::colorProfile() const -{ - return m_colorProfile; -} - -void SVGICCColorImpl::setColorProfile(const DOM::DOMString &colorProfile) -{ - m_colorProfile = colorProfile; -} - -SVGNumberListImpl *SVGICCColorImpl::colors() const -{ - return m_colors; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGICCColorImpl::s_hashTable 3 - colorProfile SVGICCColorImpl::ColorProfile DontDelete - colors SVGICCColorImpl::Colors DontDelete|ReadOnly -@end -*/ - -Value SVGICCColorImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case ColorProfile: - return String(m_colorProfile.string()); - case Colors: - return m_colors->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGICCColorImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case ColorProfile: - m_colorProfile = value.toString(exec).string(); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGICCColorImpl.cpp b/ksvg/impl/SVGICCColorImpl.cpp new file mode 100644 index 00000000..50af51c9 --- /dev/null +++ b/ksvg/impl/SVGICCColorImpl.cpp @@ -0,0 +1,105 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGICCColorImpl.h" +#include "SVGNumberListImpl.h" + +using namespace KSVG; + +#include "SVGICCColorImpl.lut.h" +#include "ksvg_bridge.h" + +SVGICCColorImpl::SVGICCColorImpl() : DOM::DomShared() +{ + m_colors = new SVGNumberListImpl(); + m_colors->ref(); +} + +SVGICCColorImpl::SVGICCColorImpl(const SVGICCColorImpl &other) : DOM::DomShared() +{ + (*this) = other; +} + +SVGICCColorImpl::~SVGICCColorImpl() +{ + if(m_colors) + m_colors->deref(); +} + +SVGICCColorImpl &SVGICCColorImpl::operator=(const SVGICCColorImpl &other) +{ + m_colorProfile = other.m_colorProfile; + *m_colors = *(other.m_colors); + + return *this; +} + +DOM::DOMString SVGICCColorImpl::colorProfile() const +{ + return m_colorProfile; +} + +void SVGICCColorImpl::setColorProfile(const DOM::DOMString &colorProfile) +{ + m_colorProfile = colorProfile; +} + +SVGNumberListImpl *SVGICCColorImpl::colors() const +{ + return m_colors; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGICCColorImpl::s_hashTable 3 + colorProfile SVGICCColorImpl::ColorProfile DontDelete + colors SVGICCColorImpl::Colors DontDelete|ReadOnly +@end +*/ + +Value SVGICCColorImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case ColorProfile: + return String(m_colorProfile.string()); + case Colors: + return m_colors->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGICCColorImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case ColorProfile: + m_colorProfile = value.toString(exec).string(); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGImageElementImpl.cc b/ksvg/impl/SVGImageElementImpl.cc deleted file mode 100644 index 65c678d2..00000000 --- a/ksvg/impl/SVGImageElementImpl.cc +++ /dev/null @@ -1,520 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include - -#include "CanvasItem.h" -#include "KSVGCanvas.h" -#include "KSVGHelper.h" - -#include "SVGRectImpl.h" -#include "SVGEventImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGHelperImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGTransformImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGImageElementImpl.moc" -#include "SVGColorProfileElementImpl.h" -#include "SVGPreserveAspectRatioImpl.h" -#include "SVGAnimatedTransformListImpl.h" -#include "SVGAnimatedPreserveAspectRatioImpl.h" -#include "SVGPatternElementImpl.h" - -using namespace KSVG; - -#include "SVGImageElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGImageElementImpl::SVGImageElementImpl(DOM::ElementImpl *impl) : TQObject(), SVGShapeImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - KSVG_EMPTY_FLAGS - - m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x->ref(); - m_x->baseVal()->setValueAsString("-1"); - - m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y->ref(); - m_y->baseVal()->setValueAsString("-1"); - - m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_width->ref(); - m_width->baseVal()->setValueAsString("-1"); - - m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_height->ref(); - m_height->baseVal()->setValueAsString("-1"); - - m_preserveAspectRatio = 0; - - m_doc = 0; - m_image = 0; - m_svgRoot = 0; - m_colorProfile = 0; - m_colorProfileApplied = false; -} - -SVGImageElementImpl::~SVGImageElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - if(m_preserveAspectRatio) - m_preserveAspectRatio->deref(); - if(m_doc) - m_doc->deref(); - - delete m_image; -} - -SVGAnimatedLengthImpl *SVGImageElementImpl::x() -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGImageElementImpl::y() -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGImageElementImpl::width() -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGImageElementImpl::height() -{ - return m_height; -} - -SVGAnimatedPreserveAspectRatioImpl *SVGImageElementImpl::preserveAspectRatio() const -{ - return m_preserveAspectRatio; -} - -/* -@namespace KSVG -@namespace KSVG -@begin SVGImageElementImpl::s_hashTable 7 - x SVGImageElementImpl::X DontDelete|ReadOnly - y SVGImageElementImpl::Y DontDelete|ReadOnly - width SVGImageElementImpl::Width DontDelete|ReadOnly - height SVGImageElementImpl::Height DontDelete|ReadOnly - preserveAspectRatio SVGImageElementImpl::PreserveAspectRatio DontDelete|ReadOnly - href SVGImageElementImpl::Href DontDelete|ReadOnly -@end -*/ - -Value SVGImageElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X: - if(!attributeMode) - return m_x->cache(exec); - else - return Number(m_x->baseVal()->value()); - case Y: - if(!attributeMode) - return m_y->cache(exec); - else - return Number(m_y->baseVal()->value()); - case Width: - if(!attributeMode) - return m_width->cache(exec); - else - return Number(m_width->baseVal()->value()); - case Height: - if(!attributeMode) - return m_height->cache(exec); - else - return Number(m_height->baseVal()->value()); - case PreserveAspectRatio: - if(m_preserveAspectRatio) - return m_preserveAspectRatio->cache(exec); - else - return Undefined(); - case Href: - SVGURIReferenceImpl::getValueProperty(exec, token); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGImageElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X: - x()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Y: - y()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Width: - width()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Height: - height()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case PreserveAspectRatio: - if(!preserveAspectRatio()) - { - m_preserveAspectRatio = new SVGAnimatedPreserveAspectRatioImpl(); - m_preserveAspectRatio->ref(); - } - - preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(value.toString(exec).qstring()); - break; - case Href: - SVGURIReferenceImpl::putValueProperty(exec, SVGURIReferenceImpl::Href, value, attr); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -SVGRectImpl *SVGImageElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - ret->setX(m_x->baseVal()->value()); - ret->setY(m_y->baseVal()->value()); - ret->setWidth(m_width->baseVal()->value()); - ret->setHeight(m_height->baseVal()->value()); - return ret; -} - -void SVGImageElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - if(KSVG_TOKEN_NOT_PARSED(X)) - KSVG_SET_ALT_ATTRIBUTE(X, "0") - - if(KSVG_TOKEN_NOT_PARSED(Y)) - KSVG_SET_ALT_ATTRIBUTE(Y, "0") - - if(KSVG_TOKEN_NOT_PARSED(PreserveAspectRatio)) - { - setAttribute("preserveAspectRatio", "xMidYMid meet"); - KSVG_SET_ALT_ATTRIBUTE(PreserveAspectRatio, "xMidYMid meet") - } -} - -void SVGImageElementImpl::slotParsingFinished(bool error, const TQString &errorDesc) -{ - if(error) - kdDebug(26003) << "Finished with error : " << errorDesc << endl; - else - kdDebug(26003) << "Finished without errors!" << endl; - - m_svgRoot = m_doc->rootElement(); -} - -void SVGImageElementImpl::slotLoadingFinished() -{ - ownerDoc()->notifyImageLoaded(this); -} - -void SVGImageElementImpl::createItem(KSVGCanvas *c) -{ - if(!m_item) - { - if(!c) - c = ownerDoc()->canvas(); - - m_item = c->createImage(this); - c->insert(m_item); - - if(href()->baseVal().string().endsWith(".svg") || href()->baseVal().string().endsWith(".svgz")) - { - if(!m_svgRoot) - { - m_doc = new SVGDocumentImpl(true, false, this); - m_doc->ref(); - m_doc->attach(c); - - connect(m_doc, TQT_SIGNAL(finishedParsing(bool, const TQString &)), this, TQT_SLOT(slotParsingFinished(bool, const TQString &))); - connect(m_doc, TQT_SIGNAL(finishedLoading()), this, TQT_SLOT(slotLoadingFinished())); - - KURL file; - - if(!KURL::isRelativeURL(href()->baseVal().string())) - file = KURL(href()->baseVal().string()); - else - file = KURL(ownerDoc()->baseUrl(), href()->baseVal().string()); - - m_doc->open(file); - - // The svg image will add items to the canvas in parallel with the main - // document, so the z-order will not be correct. Get it to fix this when everything's - // finished loading. - ownerDoc()->resortZIndicesOnFinishedLoading(); - ownerDoc()->notifyImageLoading(this); - } - else - m_svgRoot->createItem(c); - } - else - { - if(!m_image) - { - ownerDoc()->newImageJob(this); - ownerDoc()->notifyImageLoading(this); - } - } - } -} - -void SVGImageElementImpl::removeItem(KSVGCanvas *c) -{ - if(m_item && c) - { - if(m_svgRoot) - m_svgRoot->removeItem(c); - - c->removeItem(m_item); - m_item = 0; - } -} - -void SVGImageElementImpl::setupSVGElement(SVGSVGElementImpl *svg) -{ - // Set up the root svg for an svg image. - svg->setAttributeInternal("x", TQString("%1").arg(x()->baseVal()->value())); - svg->setAttributeInternal("y", TQString("%1").arg(y()->baseVal()->value())); - svg->setAttributeInternal("width", TQString("%1").arg(width()->baseVal()->value())); - svg->setAttributeInternal("height", TQString("%1").arg(height()->baseVal()->value())); - - TQString par = getAttribute("preserveAspectRatio").string().stripWhiteSpace(); - - if(par.startsWith("defer")) - { - if(svg->getAttribute("preserveAspectRatio").isEmpty()) - { - par.remove("defer"); - svg->setAttribute("preserveAspectRatio", par); - svg->setAttributeInternal("preserveAspectRatio", par); - } - } - else - { - svg->setAttribute("preserveAspectRatio", par); - svg->setAttributeInternal("preserveAspectRatio", par); - } - - svg->setAttributes(); - svg->setRootParentScreenCTM(getScreenCTM()); -} - -void SVGImageElementImpl::onScreenCTMUpdated() -{ - if(m_svgRoot) - { - SVGMatrixImpl *ctm = getScreenCTM(); - - m_svgRoot->setRootParentScreenCTM(ctm); - m_svgRoot->invalidateCachedMatrices(); - m_svgRoot->ownerDoc()->syncCachedMatrices(); - } -} - -bool SVGImageElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &, SVGMouseEventImpl *mev) -{ - // TODO : pointer-events should be stored here, not in SVGStylableImpl. - SVGStylableImpl *style = dynamic_cast(this); - if(!style || style->getPointerEvents() == PE_NONE) - return false; - bool test = true; - switch(style->getPointerEvents()) - { - case PE_VISIBLE: - case PE_VISIBLE_PAINTED: - case PE_VISIBLE_FILL: - case PE_VISIBLE_STROKE: test = style->getVisible(); break; - case PE_PAINTED: - case PE_FILL: - case PE_STROKE: - case PE_ALL: break; - default: test = false; - }; - - if(test && m_item) - { - if(m_item->bbox().contains(p)) - { - mev->setTarget(dynamic_cast(this)); - return true; - } - } - - return false; -} - -void SVGImageElementImpl::setImage(TQImage *image) -{ - m_image = image; - - if(m_image) - { - *m_image = m_image->convertDepth(32); - - if(m_colorProfile != 0 && !m_colorProfileApplied) - { - m_colorProfileApplied = true; - applyColorProfile(); - } - - SVGPatternElementImpl::flushCachedTiles(); - - if(m_item) - { - ownerDoc()->canvas()->invalidate(m_item, false); - ownerDoc()->rerender(); - } - } - - ownerDoc()->notifyImageLoaded(this); -} - -TQImage SVGImageElementImpl::scaledImage() -{ - SVGMatrixImpl *matrix = imageMatrix(); - double sx, sy; - - matrix->removeScale(&sx, &sy); - matrix->deref(); - - TQImage img; - - if(sx != 1 || sy != 1) - { - int scaledWidth = static_cast(m_image->width() * sx + 0.5); - int scaledHeight = static_cast(m_image->height() * sy + 0.5); - - img = m_image->smoothScale(scaledWidth, scaledHeight); - } - else - img = *m_image; - - return img; -} - -SVGMatrixImpl *SVGImageElementImpl::imageMatrix() -{ - SVGMatrixImpl *ctm = getScreenCTM(); - - ctm->translate(x()->baseVal()->value(), y()->baseVal()->value()); - - SVGMatrixImpl *viewboxMatrix = preserveAspectRatio()->baseVal()->getCTM(0, 0, image()->width(), image()->height(), 0, 0, width()->baseVal()->value(), height()->baseVal()->value()); - - ctm->multiply(viewboxMatrix); - viewboxMatrix->deref(); - - return ctm; -} - -SVGMatrixImpl *SVGImageElementImpl::scaledImageMatrix() -{ - SVGMatrixImpl *matrix = imageMatrix(); - double sx, sy; - - matrix->removeScale(&sx, &sy); - - if(sx != 1 || sy != 1) - { - int imageWidth = static_cast(m_image->width() * sx + 0.5); - int imageHeight = static_cast(m_image->height() * sy + 0.5); - - double trueWidth = m_image->width() * sx; - double trueHeight = m_image->height() * sy; - - matrix->scaleNonUniform(trueWidth / imageWidth, trueHeight / imageHeight); - } - - return matrix; -} - -KSVGPolygon SVGImageElementImpl::clippingShape() -{ - KSVGRectangle viewport(0, 0, width()->baseVal()->value(), height()->baseVal()->value()); - SVGMatrixImpl *matrix = preserveAspectRatio()->baseVal()->getCTM(0, 0, image()->width(), image()->height(), 0, 0, width()->baseVal()->value(), height()->baseVal()->value()); - KSVGPolygon p = matrix->inverseMap(viewport); - matrix->deref(); - - matrix = imageMatrix(); - p = matrix->map(p); - matrix->deref(); - - return p; -} - -TQString SVGImageElementImpl::fileName() const -{ - return href()->baseVal().string(); -} - -void SVGImageElementImpl::applyColorProfile() -{ - m_image = m_colorProfile->correctImage(m_image); -} - -void SVGImageElementImpl::applyColorProfile(SVGColorProfileElementImpl *profile, SVGImageElementImpl *image) -{ - // Only apply once, if it's the same (Niko) - if(image->m_colorProfile == profile) - return; - - image->m_colorProfile = profile; - - if(image->m_image) - { - // Image is already painted, we apply the color profile and repaint it - image->applyColorProfile(); - - if(image->item()) - { - image->ownerDoc()->canvas()->invalidate(image->item(), false); - image->ownerDoc()->rerender(); - } - } -} diff --git a/ksvg/impl/SVGImageElementImpl.cpp b/ksvg/impl/SVGImageElementImpl.cpp new file mode 100644 index 00000000..65c678d2 --- /dev/null +++ b/ksvg/impl/SVGImageElementImpl.cpp @@ -0,0 +1,520 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include + +#include "CanvasItem.h" +#include "KSVGCanvas.h" +#include "KSVGHelper.h" + +#include "SVGRectImpl.h" +#include "SVGEventImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGHelperImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGTransformImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGImageElementImpl.moc" +#include "SVGColorProfileElementImpl.h" +#include "SVGPreserveAspectRatioImpl.h" +#include "SVGAnimatedTransformListImpl.h" +#include "SVGAnimatedPreserveAspectRatioImpl.h" +#include "SVGPatternElementImpl.h" + +using namespace KSVG; + +#include "SVGImageElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGImageElementImpl::SVGImageElementImpl(DOM::ElementImpl *impl) : TQObject(), SVGShapeImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + KSVG_EMPTY_FLAGS + + m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x->ref(); + m_x->baseVal()->setValueAsString("-1"); + + m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y->ref(); + m_y->baseVal()->setValueAsString("-1"); + + m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_width->ref(); + m_width->baseVal()->setValueAsString("-1"); + + m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_height->ref(); + m_height->baseVal()->setValueAsString("-1"); + + m_preserveAspectRatio = 0; + + m_doc = 0; + m_image = 0; + m_svgRoot = 0; + m_colorProfile = 0; + m_colorProfileApplied = false; +} + +SVGImageElementImpl::~SVGImageElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + if(m_preserveAspectRatio) + m_preserveAspectRatio->deref(); + if(m_doc) + m_doc->deref(); + + delete m_image; +} + +SVGAnimatedLengthImpl *SVGImageElementImpl::x() +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGImageElementImpl::y() +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGImageElementImpl::width() +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGImageElementImpl::height() +{ + return m_height; +} + +SVGAnimatedPreserveAspectRatioImpl *SVGImageElementImpl::preserveAspectRatio() const +{ + return m_preserveAspectRatio; +} + +/* +@namespace KSVG +@namespace KSVG +@begin SVGImageElementImpl::s_hashTable 7 + x SVGImageElementImpl::X DontDelete|ReadOnly + y SVGImageElementImpl::Y DontDelete|ReadOnly + width SVGImageElementImpl::Width DontDelete|ReadOnly + height SVGImageElementImpl::Height DontDelete|ReadOnly + preserveAspectRatio SVGImageElementImpl::PreserveAspectRatio DontDelete|ReadOnly + href SVGImageElementImpl::Href DontDelete|ReadOnly +@end +*/ + +Value SVGImageElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X: + if(!attributeMode) + return m_x->cache(exec); + else + return Number(m_x->baseVal()->value()); + case Y: + if(!attributeMode) + return m_y->cache(exec); + else + return Number(m_y->baseVal()->value()); + case Width: + if(!attributeMode) + return m_width->cache(exec); + else + return Number(m_width->baseVal()->value()); + case Height: + if(!attributeMode) + return m_height->cache(exec); + else + return Number(m_height->baseVal()->value()); + case PreserveAspectRatio: + if(m_preserveAspectRatio) + return m_preserveAspectRatio->cache(exec); + else + return Undefined(); + case Href: + SVGURIReferenceImpl::getValueProperty(exec, token); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGImageElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X: + x()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Y: + y()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Width: + width()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Height: + height()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case PreserveAspectRatio: + if(!preserveAspectRatio()) + { + m_preserveAspectRatio = new SVGAnimatedPreserveAspectRatioImpl(); + m_preserveAspectRatio->ref(); + } + + preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(value.toString(exec).qstring()); + break; + case Href: + SVGURIReferenceImpl::putValueProperty(exec, SVGURIReferenceImpl::Href, value, attr); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +SVGRectImpl *SVGImageElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + ret->setX(m_x->baseVal()->value()); + ret->setY(m_y->baseVal()->value()); + ret->setWidth(m_width->baseVal()->value()); + ret->setHeight(m_height->baseVal()->value()); + return ret; +} + +void SVGImageElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + if(KSVG_TOKEN_NOT_PARSED(X)) + KSVG_SET_ALT_ATTRIBUTE(X, "0") + + if(KSVG_TOKEN_NOT_PARSED(Y)) + KSVG_SET_ALT_ATTRIBUTE(Y, "0") + + if(KSVG_TOKEN_NOT_PARSED(PreserveAspectRatio)) + { + setAttribute("preserveAspectRatio", "xMidYMid meet"); + KSVG_SET_ALT_ATTRIBUTE(PreserveAspectRatio, "xMidYMid meet") + } +} + +void SVGImageElementImpl::slotParsingFinished(bool error, const TQString &errorDesc) +{ + if(error) + kdDebug(26003) << "Finished with error : " << errorDesc << endl; + else + kdDebug(26003) << "Finished without errors!" << endl; + + m_svgRoot = m_doc->rootElement(); +} + +void SVGImageElementImpl::slotLoadingFinished() +{ + ownerDoc()->notifyImageLoaded(this); +} + +void SVGImageElementImpl::createItem(KSVGCanvas *c) +{ + if(!m_item) + { + if(!c) + c = ownerDoc()->canvas(); + + m_item = c->createImage(this); + c->insert(m_item); + + if(href()->baseVal().string().endsWith(".svg") || href()->baseVal().string().endsWith(".svgz")) + { + if(!m_svgRoot) + { + m_doc = new SVGDocumentImpl(true, false, this); + m_doc->ref(); + m_doc->attach(c); + + connect(m_doc, TQT_SIGNAL(finishedParsing(bool, const TQString &)), this, TQT_SLOT(slotParsingFinished(bool, const TQString &))); + connect(m_doc, TQT_SIGNAL(finishedLoading()), this, TQT_SLOT(slotLoadingFinished())); + + KURL file; + + if(!KURL::isRelativeURL(href()->baseVal().string())) + file = KURL(href()->baseVal().string()); + else + file = KURL(ownerDoc()->baseUrl(), href()->baseVal().string()); + + m_doc->open(file); + + // The svg image will add items to the canvas in parallel with the main + // document, so the z-order will not be correct. Get it to fix this when everything's + // finished loading. + ownerDoc()->resortZIndicesOnFinishedLoading(); + ownerDoc()->notifyImageLoading(this); + } + else + m_svgRoot->createItem(c); + } + else + { + if(!m_image) + { + ownerDoc()->newImageJob(this); + ownerDoc()->notifyImageLoading(this); + } + } + } +} + +void SVGImageElementImpl::removeItem(KSVGCanvas *c) +{ + if(m_item && c) + { + if(m_svgRoot) + m_svgRoot->removeItem(c); + + c->removeItem(m_item); + m_item = 0; + } +} + +void SVGImageElementImpl::setupSVGElement(SVGSVGElementImpl *svg) +{ + // Set up the root svg for an svg image. + svg->setAttributeInternal("x", TQString("%1").arg(x()->baseVal()->value())); + svg->setAttributeInternal("y", TQString("%1").arg(y()->baseVal()->value())); + svg->setAttributeInternal("width", TQString("%1").arg(width()->baseVal()->value())); + svg->setAttributeInternal("height", TQString("%1").arg(height()->baseVal()->value())); + + TQString par = getAttribute("preserveAspectRatio").string().stripWhiteSpace(); + + if(par.startsWith("defer")) + { + if(svg->getAttribute("preserveAspectRatio").isEmpty()) + { + par.remove("defer"); + svg->setAttribute("preserveAspectRatio", par); + svg->setAttributeInternal("preserveAspectRatio", par); + } + } + else + { + svg->setAttribute("preserveAspectRatio", par); + svg->setAttributeInternal("preserveAspectRatio", par); + } + + svg->setAttributes(); + svg->setRootParentScreenCTM(getScreenCTM()); +} + +void SVGImageElementImpl::onScreenCTMUpdated() +{ + if(m_svgRoot) + { + SVGMatrixImpl *ctm = getScreenCTM(); + + m_svgRoot->setRootParentScreenCTM(ctm); + m_svgRoot->invalidateCachedMatrices(); + m_svgRoot->ownerDoc()->syncCachedMatrices(); + } +} + +bool SVGImageElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &, SVGMouseEventImpl *mev) +{ + // TODO : pointer-events should be stored here, not in SVGStylableImpl. + SVGStylableImpl *style = dynamic_cast(this); + if(!style || style->getPointerEvents() == PE_NONE) + return false; + bool test = true; + switch(style->getPointerEvents()) + { + case PE_VISIBLE: + case PE_VISIBLE_PAINTED: + case PE_VISIBLE_FILL: + case PE_VISIBLE_STROKE: test = style->getVisible(); break; + case PE_PAINTED: + case PE_FILL: + case PE_STROKE: + case PE_ALL: break; + default: test = false; + }; + + if(test && m_item) + { + if(m_item->bbox().contains(p)) + { + mev->setTarget(dynamic_cast(this)); + return true; + } + } + + return false; +} + +void SVGImageElementImpl::setImage(TQImage *image) +{ + m_image = image; + + if(m_image) + { + *m_image = m_image->convertDepth(32); + + if(m_colorProfile != 0 && !m_colorProfileApplied) + { + m_colorProfileApplied = true; + applyColorProfile(); + } + + SVGPatternElementImpl::flushCachedTiles(); + + if(m_item) + { + ownerDoc()->canvas()->invalidate(m_item, false); + ownerDoc()->rerender(); + } + } + + ownerDoc()->notifyImageLoaded(this); +} + +TQImage SVGImageElementImpl::scaledImage() +{ + SVGMatrixImpl *matrix = imageMatrix(); + double sx, sy; + + matrix->removeScale(&sx, &sy); + matrix->deref(); + + TQImage img; + + if(sx != 1 || sy != 1) + { + int scaledWidth = static_cast(m_image->width() * sx + 0.5); + int scaledHeight = static_cast(m_image->height() * sy + 0.5); + + img = m_image->smoothScale(scaledWidth, scaledHeight); + } + else + img = *m_image; + + return img; +} + +SVGMatrixImpl *SVGImageElementImpl::imageMatrix() +{ + SVGMatrixImpl *ctm = getScreenCTM(); + + ctm->translate(x()->baseVal()->value(), y()->baseVal()->value()); + + SVGMatrixImpl *viewboxMatrix = preserveAspectRatio()->baseVal()->getCTM(0, 0, image()->width(), image()->height(), 0, 0, width()->baseVal()->value(), height()->baseVal()->value()); + + ctm->multiply(viewboxMatrix); + viewboxMatrix->deref(); + + return ctm; +} + +SVGMatrixImpl *SVGImageElementImpl::scaledImageMatrix() +{ + SVGMatrixImpl *matrix = imageMatrix(); + double sx, sy; + + matrix->removeScale(&sx, &sy); + + if(sx != 1 || sy != 1) + { + int imageWidth = static_cast(m_image->width() * sx + 0.5); + int imageHeight = static_cast(m_image->height() * sy + 0.5); + + double trueWidth = m_image->width() * sx; + double trueHeight = m_image->height() * sy; + + matrix->scaleNonUniform(trueWidth / imageWidth, trueHeight / imageHeight); + } + + return matrix; +} + +KSVGPolygon SVGImageElementImpl::clippingShape() +{ + KSVGRectangle viewport(0, 0, width()->baseVal()->value(), height()->baseVal()->value()); + SVGMatrixImpl *matrix = preserveAspectRatio()->baseVal()->getCTM(0, 0, image()->width(), image()->height(), 0, 0, width()->baseVal()->value(), height()->baseVal()->value()); + KSVGPolygon p = matrix->inverseMap(viewport); + matrix->deref(); + + matrix = imageMatrix(); + p = matrix->map(p); + matrix->deref(); + + return p; +} + +TQString SVGImageElementImpl::fileName() const +{ + return href()->baseVal().string(); +} + +void SVGImageElementImpl::applyColorProfile() +{ + m_image = m_colorProfile->correctImage(m_image); +} + +void SVGImageElementImpl::applyColorProfile(SVGColorProfileElementImpl *profile, SVGImageElementImpl *image) +{ + // Only apply once, if it's the same (Niko) + if(image->m_colorProfile == profile) + return; + + image->m_colorProfile = profile; + + if(image->m_image) + { + // Image is already painted, we apply the color profile and repaint it + image->applyColorProfile(); + + if(image->item()) + { + image->ownerDoc()->canvas()->invalidate(image->item(), false); + image->ownerDoc()->rerender(); + } + } +} diff --git a/ksvg/impl/SVGLangSpaceImpl.cc b/ksvg/impl/SVGLangSpaceImpl.cc deleted file mode 100644 index f6081401..00000000 --- a/ksvg/impl/SVGLangSpaceImpl.cc +++ /dev/null @@ -1,128 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGLangSpaceImpl.h" - -using namespace KSVG; - -#include "SVGLangSpaceImpl.lut.h" -#include "ksvg_bridge.h" - -SVGLangSpaceImpl::SVGLangSpaceImpl() -{ - KSVG_EMPTY_FLAGS - - // Spec: default for xml:space is "default" - setXmlspace("default"); -} - -SVGLangSpaceImpl::~SVGLangSpaceImpl() -{ -} - -void SVGLangSpaceImpl::setXmllang(const DOM::DOMString &xmllang) -{ - m_xmllang = xmllang; -} - -DOM::DOMString SVGLangSpaceImpl::xmllang() const -{ - return m_xmllang; -} - -void SVGLangSpaceImpl::setXmlspace(const DOM::DOMString &xmlspace) -{ - m_xmlspace = xmlspace; -} - -DOM::DOMString SVGLangSpaceImpl::xmlspace() const -{ - return m_xmlspace; -} - -TQString SVGLangSpaceImpl::handleText(const TQString &data) const -{ - TQString result = data; - - if(xmlspace() == "preserve") - { - // Spec: What to do here? - // It will convert all newline and tab characters into space characters - result.replace("\n\r", TQString(" ")); - result.replace("\r\n", TQString(" ")); - result.replace('\t', ' '); - } - else if(xmlspace() == "default") - { - // Spec: What to do here? - // First, it will remove all newline characters (replace) - // Then it will convert all tab characters into space characters (simplifyWhiteSpace) - // Then, it will strip off all leading and trailing space characters (stripWhiteSpace) - // Then, all contiguous space characters will be consolidated. (simplifyWhiteSpace) - result.replace('\n', TQString()); - result.replace('\r', TQString()); - result = result.stripWhiteSpace().simplifyWhiteSpace(); - } - - return result; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGLangSpaceImpl::s_hashTable 5 - xmllang SVGLangSpaceImpl::XmlLang DontDelete - xmlspace SVGLangSpaceImpl::XmlSpace DontDelete - lang SVGLangSpaceImpl::XmlLang DontDelete - space SVGLangSpaceImpl::XmlSpace DontDelete -@end -*/ - -Value SVGLangSpaceImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case XmlLang: - return String(m_xmllang.string()); - case XmlSpace: - return String(m_xmlspace.string()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGLangSpaceImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int /*attr*/) -{ - switch(token) - { - case XmlLang: - m_xmllang = value.toString(exec).string(); - break; - case XmlSpace: - m_xmlspace = value.toString(exec).string(); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGLangSpaceImpl.cpp b/ksvg/impl/SVGLangSpaceImpl.cpp new file mode 100644 index 00000000..f6081401 --- /dev/null +++ b/ksvg/impl/SVGLangSpaceImpl.cpp @@ -0,0 +1,128 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGLangSpaceImpl.h" + +using namespace KSVG; + +#include "SVGLangSpaceImpl.lut.h" +#include "ksvg_bridge.h" + +SVGLangSpaceImpl::SVGLangSpaceImpl() +{ + KSVG_EMPTY_FLAGS + + // Spec: default for xml:space is "default" + setXmlspace("default"); +} + +SVGLangSpaceImpl::~SVGLangSpaceImpl() +{ +} + +void SVGLangSpaceImpl::setXmllang(const DOM::DOMString &xmllang) +{ + m_xmllang = xmllang; +} + +DOM::DOMString SVGLangSpaceImpl::xmllang() const +{ + return m_xmllang; +} + +void SVGLangSpaceImpl::setXmlspace(const DOM::DOMString &xmlspace) +{ + m_xmlspace = xmlspace; +} + +DOM::DOMString SVGLangSpaceImpl::xmlspace() const +{ + return m_xmlspace; +} + +TQString SVGLangSpaceImpl::handleText(const TQString &data) const +{ + TQString result = data; + + if(xmlspace() == "preserve") + { + // Spec: What to do here? + // It will convert all newline and tab characters into space characters + result.replace("\n\r", TQString(" ")); + result.replace("\r\n", TQString(" ")); + result.replace('\t', ' '); + } + else if(xmlspace() == "default") + { + // Spec: What to do here? + // First, it will remove all newline characters (replace) + // Then it will convert all tab characters into space characters (simplifyWhiteSpace) + // Then, it will strip off all leading and trailing space characters (stripWhiteSpace) + // Then, all contiguous space characters will be consolidated. (simplifyWhiteSpace) + result.replace('\n', TQString()); + result.replace('\r', TQString()); + result = result.stripWhiteSpace().simplifyWhiteSpace(); + } + + return result; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGLangSpaceImpl::s_hashTable 5 + xmllang SVGLangSpaceImpl::XmlLang DontDelete + xmlspace SVGLangSpaceImpl::XmlSpace DontDelete + lang SVGLangSpaceImpl::XmlLang DontDelete + space SVGLangSpaceImpl::XmlSpace DontDelete +@end +*/ + +Value SVGLangSpaceImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case XmlLang: + return String(m_xmllang.string()); + case XmlSpace: + return String(m_xmlspace.string()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGLangSpaceImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int /*attr*/) +{ + switch(token) + { + case XmlLang: + m_xmllang = value.toString(exec).string(); + break; + case XmlSpace: + m_xmlspace = value.toString(exec).string(); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGLengthImpl.cc b/ksvg/impl/SVGLengthImpl.cc deleted file mode 100644 index 36789ffe..00000000 --- a/ksvg/impl/SVGLengthImpl.cc +++ /dev/null @@ -1,508 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include -#include -#include -#include - -#include "SVGLength.h" - -#include "SVGRectImpl.h" -#include "SVGLengthImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGHelperImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGStringListImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedRectImpl.h" -#include "svgpathparser.h" - -#include "KSVGCanvas.h" - -using namespace KSVG; - -#include "SVGLengthImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_cacheimpl.h" - -// keep track of textual description of the unit type -TQString UnitText[] = -{ - "", "", "%", "em", "ex", "px", "cm", "mm", "in", "pt", "pc" -}; - -SVGLengthImpl::SVGLengthImpl(LengthMode mode, SVGElementImpl *context) : DOM::DomShared(), m_mode(mode), m_context(context) -{ - KSVG_EMPTY_FLAGS - - m_unitType = SVG_LENGTHTYPE_UNKNOWN; - m_value = 0; - m_valueInSpecifiedUnits = 0; - m_bboxContext = 0; -} - -SVGLengthImpl::SVGLengthImpl(const SVGLengthImpl &other) : DOM::DomShared() -{ - (*this) = other; -} - -SVGLengthImpl::~SVGLengthImpl() -{ -} - -double SVGLengthImpl::dpi() -{ - if(m_context && m_context->ownerDoc()) - { - if(m_mode == LENGTHMODE_WIDTH) - return 25.4 * m_context->ownerDoc()->screenPixelsPerMillimeterX(); - else if(m_mode == LENGTHMODE_HEIGHT) - return 25.4 * m_context->ownerDoc()->screenPixelsPerMillimeterY(); - else if(m_mode == LENGTHMODE_OTHER) - return 25.4 * m_context->ownerDoc()->screenPixelsPerMillimeterX(); - } - return 90.0; -} - -SVGLengthImpl &SVGLengthImpl::operator=(const SVGLengthImpl &other) -{ - m_unitType = other.m_unitType; - m_value = other.m_value; - m_valueInSpecifiedUnits = other.m_valueInSpecifiedUnits; - m_bboxContext = other.m_bboxContext; - m_mode = other.m_mode; - m_context = other.m_context; - - return *this; -} - -unsigned short SVGLengthImpl::unitType() const -{ - return m_unitType; -} - -void SVGLengthImpl::setValue(float value) -{ - m_value = value; - getValFromPx(); -} - -float SVGLengthImpl::value() -{ - if(m_unitType == SVG_LENGTHTYPE_PERCENTAGE) - { - float value = m_valueInSpecifiedUnits / 100.0; - SVGRectImpl *bbox = 0; - if(m_bboxContext && (bbox = m_bboxContext->getBBox())) - { - float result = 0; - if(m_mode == LENGTHMODE_WIDTH) - result = value * bbox->width(); - else if(m_mode == LENGTHMODE_HEIGHT) - result = value * bbox->height(); - else if(m_mode == LENGTHMODE_OTHER) - result = value * sqrt(pow(bbox->width(), 2) + pow(bbox->height(), 2)) / sqrt(2.0); - - bbox->deref(); - return result; - } - else - return percentageOfViewport(); - } - else - return m_value; -} - -void SVGLengthImpl::setValueInSpecifiedUnits(float valueInSpecifiedUnits) -{ - m_valueInSpecifiedUnits = valueInSpecifiedUnits; - convertNumToPx(); -} - -float SVGLengthImpl::valueInSpecifiedUnits() const -{ - return m_valueInSpecifiedUnits; -} - -void SVGLengthImpl::setValueAsString(const DOM::DOMString &valueAsString) -{ - convertStringToPx(valueAsString.string()); -} - -DOM::DOMString SVGLengthImpl::valueAsString() const -{ - DOM::DOMString valueAsString = TQString::number(m_valueInSpecifiedUnits); - valueAsString += UnitText[m_unitType]; - return valueAsString; -} - -void SVGLengthImpl::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) -{ - m_valueInSpecifiedUnits = valueInSpecifiedUnits; - m_unitType = unitType; - convertNumToPx(); -} - -void SVGLengthImpl::convertToSpecifiedUnits(unsigned short unitType) -{ - m_unitType = unitType; - getValFromPx(); -} - -SVGLengthImpl::operator float() -{ - return valueInSpecifiedUnits(); -} - -bool SVGLengthImpl::getValFromPx() -{ - if(m_unitType == SVG_LENGTHTYPE_UNKNOWN) - return false; - - switch(m_unitType) - { - // case SVG_LENGTHTYPE_PERCENTAGE: TODO - // case SVG_LENGTHTYPE_EMS: TODO - // case SVG_LENGTHTYPE_EXS: TODO - //break; - case SVG_LENGTHTYPE_PX: - m_valueInSpecifiedUnits = m_value; - break; - case SVG_LENGTHTYPE_CM: - m_valueInSpecifiedUnits = m_value / dpi() * 2.54; - break; - case SVG_LENGTHTYPE_MM: - m_valueInSpecifiedUnits = m_value / dpi() * 25.4; - break; - case SVG_LENGTHTYPE_IN: - m_valueInSpecifiedUnits = m_value / dpi(); - break; - case SVG_LENGTHTYPE_PT: - m_valueInSpecifiedUnits = m_value / dpi() * 72.0; - break; - case SVG_LENGTHTYPE_PC: - m_valueInSpecifiedUnits = m_value / dpi() * 6.0; - break; - }; - return true; -} - -void SVGLengthImpl::convertStringToPx(TQString s) -{ - if(s.isEmpty()) - return; - - double convNum = 0; - const char *start = s.latin1(); - const char *end = getNumber(start, convNum); - m_valueInSpecifiedUnits = convNum; - - if(uint(end - start) < s.length()) - { - if(s.endsWith(UnitText[SVG_LENGTHTYPE_PX])) - m_unitType = SVG_LENGTHTYPE_PX; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_CM])) - m_unitType = SVG_LENGTHTYPE_CM; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_PC])) - m_unitType = SVG_LENGTHTYPE_PC; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_MM])) - m_unitType = SVG_LENGTHTYPE_MM; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_IN])) - m_unitType = SVG_LENGTHTYPE_IN; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_PT])) - m_unitType = SVG_LENGTHTYPE_PT; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_PERCENTAGE])) - m_unitType = SVG_LENGTHTYPE_PERCENTAGE; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_EMS])) - m_unitType = SVG_LENGTHTYPE_EMS; - else if(s.endsWith(UnitText[SVG_LENGTHTYPE_EXS])) - m_unitType = SVG_LENGTHTYPE_EXS; - else if(s.isEmpty()) - m_unitType = SVG_LENGTHTYPE_NUMBER; - else - m_unitType = SVG_LENGTHTYPE_UNKNOWN; - } - else - m_unitType = SVG_LENGTHTYPE_PX; - convertNumToPx(); -} - -void SVGLengthImpl::convertNumToPx() -{ - switch(m_unitType) - { - case SVG_LENGTHTYPE_PX: - m_value = m_valueInSpecifiedUnits; - break; - case SVG_LENGTHTYPE_CM: - m_value = (m_valueInSpecifiedUnits / 2.54) * dpi(); - break; - case SVG_LENGTHTYPE_MM: - m_value = (m_valueInSpecifiedUnits / 25.4) * dpi(); - break; - case SVG_LENGTHTYPE_IN: - m_value = m_valueInSpecifiedUnits * dpi(); - break; - case SVG_LENGTHTYPE_PT: - m_value = (m_valueInSpecifiedUnits / 72.0) * dpi(); - break; - case SVG_LENGTHTYPE_PC: - m_value = (m_valueInSpecifiedUnits / 6.0) * dpi(); - break; - case SVG_LENGTHTYPE_EMS: // Be careful here, always recheck coords-units-BE-01.svg after touching (Niko) - case SVG_LENGTHTYPE_EXS: - if(m_context) - { - SVGStylableImpl *style = dynamic_cast(m_context); - if(!style) - break; - - bool sizeLocal = (style->getFontSize() != -1); - bool familyLocal = (style->getFontFamily() && style->getFontFamily()->getFirst()); - - SVGStylableImpl *parentStyle = 0; - if((!sizeLocal || !familyLocal) && m_context) - parentStyle = dynamic_cast(m_context->ownerDoc()->getElementFromHandle(m_context->parentNode().handle())); - - // Look up font-size in a SAFE way, because at this place - // processStyle() has NOT yet been called, so we need - // a different solution (Niko) - TQString useFont = "Arial"; - double useSize = 12; - - if(sizeLocal) - useSize = style->getFontSize(); - else if(parentStyle && parentStyle->getFontSize() != -1) - useSize = parentStyle->getFontSize(); - - if(familyLocal) - useFont = style->getFontFamily()->getFirst()->string(); - else if(parentStyle && parentStyle->getFontFamily() && parentStyle->getFontFamily()->getFirst()) - useFont = parentStyle->getFontFamily()->getFirst()->string(); - - if(m_unitType == SVG_LENGTHTYPE_EMS) - m_value = m_valueInSpecifiedUnits * useSize; - else - { - // Easiest way, use qfont (Niko) - TQFont font(useFont); - font.setPixelSize(static_cast(useSize)); - - TQFontMetrics fm(font); - m_value = m_valueInSpecifiedUnits * fm.boundingRect('x').height(); - } - } - break; - }; -} - -void SVGLengthImpl::convertPercentageToFloat(const TQString &perc, float &result) -{ - // TODO : more error checking ? - if(perc.endsWith("%")) - result = perc.left(perc.length() - 1).toFloat() / 100.0; - else - result = perc.toFloat(); -} - -TQString SVGLengthImpl::convertValToPercentage(const TQString &val, float benchmark) -{ - if(val.endsWith("%")) - return val; - - TQString result; - float temp = val.toFloat(); - - temp = (temp / benchmark) * 100.0; - result.setNum(temp); - result.append("%"); - - return result; -} - -SVGElementImpl *SVGLengthImpl::context() const -{ - return m_context; -} - -void SVGLengthImpl::setContext(SVGElementImpl *context) -{ - m_context = context; -} - -void SVGLengthImpl::setBBoxContext(SVGShapeImpl *bbox) -{ - m_bboxContext = bbox; - convertNumToPx(); -} - -float SVGLengthImpl::percentageOfViewport() -{ - float width = 0, height = 0; - float value = m_valueInSpecifiedUnits / 100.0; - if(m_context->viewportElement()) - { - SVGSVGElementImpl *svg = dynamic_cast(m_context->viewportElement()); - if(svg) - { - // Calculate against viewBox, otherwise svg width/height - width = svg->viewBox()->baseVal()->width(); - if(width == 0) - width = svg->width()->baseVal()->value(); - height = svg->viewBox()->baseVal()->height(); - if(height == 0) - height = svg->height()->baseVal()->value(); - } - - if(m_mode == LENGTHMODE_WIDTH) - return value * width; - else if(m_mode == LENGTHMODE_HEIGHT) - return value * height; - else if(m_mode == LENGTHMODE_OTHER) - return value * sqrt(pow(width, 2) + pow(height, 2)) / sqrt(2.0); - } - else if(m_context == m_context->ownerDoc()->rootElement()) - { - if(!m_context->ownerDoc()->canvas()) // Happens when parsing with printnodetest - return 0.0; - - TQPaintDeviceMetrics metrics(m_context->ownerDoc()->canvas()->drawWindow()); - - if(m_mode == LENGTHMODE_WIDTH) - return value * metrics.width(); - else if(m_mode == LENGTHMODE_HEIGHT) - return value * metrics.height(); - else if(m_mode == LENGTHMODE_OTHER) - return value * sqrt(pow(metrics.width(), 2) + pow(metrics.height(), 2)) / sqrt(2.0); - } - - return 0; -} - -// Ecma stuff -// -/* -@namespace KSVG -@begin SVGLengthImpl::s_hashTable 5 - unitType SVGLengthImpl::UnitType DontDelete|ReadOnly - value SVGLengthImpl::Value DontDelete - valueAsString SVGLengthImpl::ValueAsString DontDelete - valueInSpecifiedUnits SVGLengthImpl::ValueInSpecifiedUnits DontDelete -@end -@namespace KSVG -@begin SVGLengthImplProto::s_hashTable 3 - newValueSpecifiedUnits SVGLengthImpl::NewValueSpecifiedUnits DontDelete|Function 2 - convertToSpecifiedUnits SVGLengthImpl::ConvertToSpecifiedUnits DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGLength", SVGLengthImplProto, SVGLengthImplProtoFunc) - -Value SVGLengthImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case UnitType: - return Number(unitType()); - case Value: - return Number(m_value); - case ValueAsString: - return String(valueAsString().string()); - case ValueInSpecifiedUnits: - return Number(valueInSpecifiedUnits()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return KJS::Undefined(); - } -} - -void SVGLengthImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case Value: - setValue(value.toNumber(exec)); - SVGHelperImpl::updateItem(exec, *m_context); - break; - case ValueAsString: - setValueAsString(value.toString(exec).string()); - SVGHelperImpl::updateItem(exec, *m_context); - break; - case ValueInSpecifiedUnits: - setValueInSpecifiedUnits(value.toNumber(exec)); - SVGHelperImpl::updateItem(exec, *m_context); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGLengthImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGLengthImpl) - - switch(id) - { - case SVGLengthImpl::NewValueSpecifiedUnits: - obj->newValueSpecifiedUnits(static_cast(args[0].toNumber(exec)), args[1].toNumber(exec)); - SVGHelperImpl::updateItem(exec, *obj->context()); - return Undefined(); - case SVGLengthImpl::ConvertToSpecifiedUnits: - obj->convertToSpecifiedUnits(static_cast(args[0].toNumber(exec))); - SVGHelperImpl::updateItem(exec, *obj->context()); - return Undefined(); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -/* -@namespace KSVG -@begin SVGLengthImplConstructor::s_hashTable 11 - SVG_LENGTHTYPE_UNKNOWN KSVG::SVG_LENGTHTYPE_UNKNOWN DontDelete|ReadOnly - SVG_LENGTHTYPE_NUMBER KSVG::SVG_LENGTHTYPE_NUMBER DontDelete|ReadOnly - SVG_LENGTHTYPE_PERCENTAGE KSVG::SVG_LENGTHTYPE_PERCENTAGE DontDelete|ReadOnly - SVG_LENGTHTYPE_EMS KSVG::SVG_LENGTHTYPE_EMS DontDelete|ReadOnly - SVG_LENGTHTYPE_EXS KSVG::SVG_LENGTHTYPE_EXS DontDelete|ReadOnly - SVG_LENGTHTYPE_PX KSVG::SVG_LENGTHTYPE_PX DontDelete|ReadOnly - SVG_LENGTHTYPE_CM KSVG::SVG_LENGTHTYPE_CM DontDelete|ReadOnly - SVG_LENGTHTYPE_MM KSVG::SVG_LENGTHTYPE_MM DontDelete|ReadOnly - SVG_LENGTHTYPE_PT KSVG::SVG_LENGTHTYPE_PT DontDelete|ReadOnly - SVG_LENGTHTYPE_PC KSVG::SVG_LENGTHTYPE_PC DontDelete|ReadOnly -@end -*/ - -Value SVGLengthImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGLengthImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svglength.constructor]]"); -} diff --git a/ksvg/impl/SVGLengthImpl.cpp b/ksvg/impl/SVGLengthImpl.cpp new file mode 100644 index 00000000..36789ffe --- /dev/null +++ b/ksvg/impl/SVGLengthImpl.cpp @@ -0,0 +1,508 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include +#include +#include + +#include "SVGLength.h" + +#include "SVGRectImpl.h" +#include "SVGLengthImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGHelperImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGStringListImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedRectImpl.h" +#include "svgpathparser.h" + +#include "KSVGCanvas.h" + +using namespace KSVG; + +#include "SVGLengthImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_cacheimpl.h" + +// keep track of textual description of the unit type +TQString UnitText[] = +{ + "", "", "%", "em", "ex", "px", "cm", "mm", "in", "pt", "pc" +}; + +SVGLengthImpl::SVGLengthImpl(LengthMode mode, SVGElementImpl *context) : DOM::DomShared(), m_mode(mode), m_context(context) +{ + KSVG_EMPTY_FLAGS + + m_unitType = SVG_LENGTHTYPE_UNKNOWN; + m_value = 0; + m_valueInSpecifiedUnits = 0; + m_bboxContext = 0; +} + +SVGLengthImpl::SVGLengthImpl(const SVGLengthImpl &other) : DOM::DomShared() +{ + (*this) = other; +} + +SVGLengthImpl::~SVGLengthImpl() +{ +} + +double SVGLengthImpl::dpi() +{ + if(m_context && m_context->ownerDoc()) + { + if(m_mode == LENGTHMODE_WIDTH) + return 25.4 * m_context->ownerDoc()->screenPixelsPerMillimeterX(); + else if(m_mode == LENGTHMODE_HEIGHT) + return 25.4 * m_context->ownerDoc()->screenPixelsPerMillimeterY(); + else if(m_mode == LENGTHMODE_OTHER) + return 25.4 * m_context->ownerDoc()->screenPixelsPerMillimeterX(); + } + return 90.0; +} + +SVGLengthImpl &SVGLengthImpl::operator=(const SVGLengthImpl &other) +{ + m_unitType = other.m_unitType; + m_value = other.m_value; + m_valueInSpecifiedUnits = other.m_valueInSpecifiedUnits; + m_bboxContext = other.m_bboxContext; + m_mode = other.m_mode; + m_context = other.m_context; + + return *this; +} + +unsigned short SVGLengthImpl::unitType() const +{ + return m_unitType; +} + +void SVGLengthImpl::setValue(float value) +{ + m_value = value; + getValFromPx(); +} + +float SVGLengthImpl::value() +{ + if(m_unitType == SVG_LENGTHTYPE_PERCENTAGE) + { + float value = m_valueInSpecifiedUnits / 100.0; + SVGRectImpl *bbox = 0; + if(m_bboxContext && (bbox = m_bboxContext->getBBox())) + { + float result = 0; + if(m_mode == LENGTHMODE_WIDTH) + result = value * bbox->width(); + else if(m_mode == LENGTHMODE_HEIGHT) + result = value * bbox->height(); + else if(m_mode == LENGTHMODE_OTHER) + result = value * sqrt(pow(bbox->width(), 2) + pow(bbox->height(), 2)) / sqrt(2.0); + + bbox->deref(); + return result; + } + else + return percentageOfViewport(); + } + else + return m_value; +} + +void SVGLengthImpl::setValueInSpecifiedUnits(float valueInSpecifiedUnits) +{ + m_valueInSpecifiedUnits = valueInSpecifiedUnits; + convertNumToPx(); +} + +float SVGLengthImpl::valueInSpecifiedUnits() const +{ + return m_valueInSpecifiedUnits; +} + +void SVGLengthImpl::setValueAsString(const DOM::DOMString &valueAsString) +{ + convertStringToPx(valueAsString.string()); +} + +DOM::DOMString SVGLengthImpl::valueAsString() const +{ + DOM::DOMString valueAsString = TQString::number(m_valueInSpecifiedUnits); + valueAsString += UnitText[m_unitType]; + return valueAsString; +} + +void SVGLengthImpl::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits) +{ + m_valueInSpecifiedUnits = valueInSpecifiedUnits; + m_unitType = unitType; + convertNumToPx(); +} + +void SVGLengthImpl::convertToSpecifiedUnits(unsigned short unitType) +{ + m_unitType = unitType; + getValFromPx(); +} + +SVGLengthImpl::operator float() +{ + return valueInSpecifiedUnits(); +} + +bool SVGLengthImpl::getValFromPx() +{ + if(m_unitType == SVG_LENGTHTYPE_UNKNOWN) + return false; + + switch(m_unitType) + { + // case SVG_LENGTHTYPE_PERCENTAGE: TODO + // case SVG_LENGTHTYPE_EMS: TODO + // case SVG_LENGTHTYPE_EXS: TODO + //break; + case SVG_LENGTHTYPE_PX: + m_valueInSpecifiedUnits = m_value; + break; + case SVG_LENGTHTYPE_CM: + m_valueInSpecifiedUnits = m_value / dpi() * 2.54; + break; + case SVG_LENGTHTYPE_MM: + m_valueInSpecifiedUnits = m_value / dpi() * 25.4; + break; + case SVG_LENGTHTYPE_IN: + m_valueInSpecifiedUnits = m_value / dpi(); + break; + case SVG_LENGTHTYPE_PT: + m_valueInSpecifiedUnits = m_value / dpi() * 72.0; + break; + case SVG_LENGTHTYPE_PC: + m_valueInSpecifiedUnits = m_value / dpi() * 6.0; + break; + }; + return true; +} + +void SVGLengthImpl::convertStringToPx(TQString s) +{ + if(s.isEmpty()) + return; + + double convNum = 0; + const char *start = s.latin1(); + const char *end = getNumber(start, convNum); + m_valueInSpecifiedUnits = convNum; + + if(uint(end - start) < s.length()) + { + if(s.endsWith(UnitText[SVG_LENGTHTYPE_PX])) + m_unitType = SVG_LENGTHTYPE_PX; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_CM])) + m_unitType = SVG_LENGTHTYPE_CM; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_PC])) + m_unitType = SVG_LENGTHTYPE_PC; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_MM])) + m_unitType = SVG_LENGTHTYPE_MM; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_IN])) + m_unitType = SVG_LENGTHTYPE_IN; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_PT])) + m_unitType = SVG_LENGTHTYPE_PT; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_PERCENTAGE])) + m_unitType = SVG_LENGTHTYPE_PERCENTAGE; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_EMS])) + m_unitType = SVG_LENGTHTYPE_EMS; + else if(s.endsWith(UnitText[SVG_LENGTHTYPE_EXS])) + m_unitType = SVG_LENGTHTYPE_EXS; + else if(s.isEmpty()) + m_unitType = SVG_LENGTHTYPE_NUMBER; + else + m_unitType = SVG_LENGTHTYPE_UNKNOWN; + } + else + m_unitType = SVG_LENGTHTYPE_PX; + convertNumToPx(); +} + +void SVGLengthImpl::convertNumToPx() +{ + switch(m_unitType) + { + case SVG_LENGTHTYPE_PX: + m_value = m_valueInSpecifiedUnits; + break; + case SVG_LENGTHTYPE_CM: + m_value = (m_valueInSpecifiedUnits / 2.54) * dpi(); + break; + case SVG_LENGTHTYPE_MM: + m_value = (m_valueInSpecifiedUnits / 25.4) * dpi(); + break; + case SVG_LENGTHTYPE_IN: + m_value = m_valueInSpecifiedUnits * dpi(); + break; + case SVG_LENGTHTYPE_PT: + m_value = (m_valueInSpecifiedUnits / 72.0) * dpi(); + break; + case SVG_LENGTHTYPE_PC: + m_value = (m_valueInSpecifiedUnits / 6.0) * dpi(); + break; + case SVG_LENGTHTYPE_EMS: // Be careful here, always recheck coords-units-BE-01.svg after touching (Niko) + case SVG_LENGTHTYPE_EXS: + if(m_context) + { + SVGStylableImpl *style = dynamic_cast(m_context); + if(!style) + break; + + bool sizeLocal = (style->getFontSize() != -1); + bool familyLocal = (style->getFontFamily() && style->getFontFamily()->getFirst()); + + SVGStylableImpl *parentStyle = 0; + if((!sizeLocal || !familyLocal) && m_context) + parentStyle = dynamic_cast(m_context->ownerDoc()->getElementFromHandle(m_context->parentNode().handle())); + + // Look up font-size in a SAFE way, because at this place + // processStyle() has NOT yet been called, so we need + // a different solution (Niko) + TQString useFont = "Arial"; + double useSize = 12; + + if(sizeLocal) + useSize = style->getFontSize(); + else if(parentStyle && parentStyle->getFontSize() != -1) + useSize = parentStyle->getFontSize(); + + if(familyLocal) + useFont = style->getFontFamily()->getFirst()->string(); + else if(parentStyle && parentStyle->getFontFamily() && parentStyle->getFontFamily()->getFirst()) + useFont = parentStyle->getFontFamily()->getFirst()->string(); + + if(m_unitType == SVG_LENGTHTYPE_EMS) + m_value = m_valueInSpecifiedUnits * useSize; + else + { + // Easiest way, use qfont (Niko) + TQFont font(useFont); + font.setPixelSize(static_cast(useSize)); + + TQFontMetrics fm(font); + m_value = m_valueInSpecifiedUnits * fm.boundingRect('x').height(); + } + } + break; + }; +} + +void SVGLengthImpl::convertPercentageToFloat(const TQString &perc, float &result) +{ + // TODO : more error checking ? + if(perc.endsWith("%")) + result = perc.left(perc.length() - 1).toFloat() / 100.0; + else + result = perc.toFloat(); +} + +TQString SVGLengthImpl::convertValToPercentage(const TQString &val, float benchmark) +{ + if(val.endsWith("%")) + return val; + + TQString result; + float temp = val.toFloat(); + + temp = (temp / benchmark) * 100.0; + result.setNum(temp); + result.append("%"); + + return result; +} + +SVGElementImpl *SVGLengthImpl::context() const +{ + return m_context; +} + +void SVGLengthImpl::setContext(SVGElementImpl *context) +{ + m_context = context; +} + +void SVGLengthImpl::setBBoxContext(SVGShapeImpl *bbox) +{ + m_bboxContext = bbox; + convertNumToPx(); +} + +float SVGLengthImpl::percentageOfViewport() +{ + float width = 0, height = 0; + float value = m_valueInSpecifiedUnits / 100.0; + if(m_context->viewportElement()) + { + SVGSVGElementImpl *svg = dynamic_cast(m_context->viewportElement()); + if(svg) + { + // Calculate against viewBox, otherwise svg width/height + width = svg->viewBox()->baseVal()->width(); + if(width == 0) + width = svg->width()->baseVal()->value(); + height = svg->viewBox()->baseVal()->height(); + if(height == 0) + height = svg->height()->baseVal()->value(); + } + + if(m_mode == LENGTHMODE_WIDTH) + return value * width; + else if(m_mode == LENGTHMODE_HEIGHT) + return value * height; + else if(m_mode == LENGTHMODE_OTHER) + return value * sqrt(pow(width, 2) + pow(height, 2)) / sqrt(2.0); + } + else if(m_context == m_context->ownerDoc()->rootElement()) + { + if(!m_context->ownerDoc()->canvas()) // Happens when parsing with printnodetest + return 0.0; + + TQPaintDeviceMetrics metrics(m_context->ownerDoc()->canvas()->drawWindow()); + + if(m_mode == LENGTHMODE_WIDTH) + return value * metrics.width(); + else if(m_mode == LENGTHMODE_HEIGHT) + return value * metrics.height(); + else if(m_mode == LENGTHMODE_OTHER) + return value * sqrt(pow(metrics.width(), 2) + pow(metrics.height(), 2)) / sqrt(2.0); + } + + return 0; +} + +// Ecma stuff +// +/* +@namespace KSVG +@begin SVGLengthImpl::s_hashTable 5 + unitType SVGLengthImpl::UnitType DontDelete|ReadOnly + value SVGLengthImpl::Value DontDelete + valueAsString SVGLengthImpl::ValueAsString DontDelete + valueInSpecifiedUnits SVGLengthImpl::ValueInSpecifiedUnits DontDelete +@end +@namespace KSVG +@begin SVGLengthImplProto::s_hashTable 3 + newValueSpecifiedUnits SVGLengthImpl::NewValueSpecifiedUnits DontDelete|Function 2 + convertToSpecifiedUnits SVGLengthImpl::ConvertToSpecifiedUnits DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGLength", SVGLengthImplProto, SVGLengthImplProtoFunc) + +Value SVGLengthImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case UnitType: + return Number(unitType()); + case Value: + return Number(m_value); + case ValueAsString: + return String(valueAsString().string()); + case ValueInSpecifiedUnits: + return Number(valueInSpecifiedUnits()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return KJS::Undefined(); + } +} + +void SVGLengthImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case Value: + setValue(value.toNumber(exec)); + SVGHelperImpl::updateItem(exec, *m_context); + break; + case ValueAsString: + setValueAsString(value.toString(exec).string()); + SVGHelperImpl::updateItem(exec, *m_context); + break; + case ValueInSpecifiedUnits: + setValueInSpecifiedUnits(value.toNumber(exec)); + SVGHelperImpl::updateItem(exec, *m_context); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGLengthImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGLengthImpl) + + switch(id) + { + case SVGLengthImpl::NewValueSpecifiedUnits: + obj->newValueSpecifiedUnits(static_cast(args[0].toNumber(exec)), args[1].toNumber(exec)); + SVGHelperImpl::updateItem(exec, *obj->context()); + return Undefined(); + case SVGLengthImpl::ConvertToSpecifiedUnits: + obj->convertToSpecifiedUnits(static_cast(args[0].toNumber(exec))); + SVGHelperImpl::updateItem(exec, *obj->context()); + return Undefined(); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +/* +@namespace KSVG +@begin SVGLengthImplConstructor::s_hashTable 11 + SVG_LENGTHTYPE_UNKNOWN KSVG::SVG_LENGTHTYPE_UNKNOWN DontDelete|ReadOnly + SVG_LENGTHTYPE_NUMBER KSVG::SVG_LENGTHTYPE_NUMBER DontDelete|ReadOnly + SVG_LENGTHTYPE_PERCENTAGE KSVG::SVG_LENGTHTYPE_PERCENTAGE DontDelete|ReadOnly + SVG_LENGTHTYPE_EMS KSVG::SVG_LENGTHTYPE_EMS DontDelete|ReadOnly + SVG_LENGTHTYPE_EXS KSVG::SVG_LENGTHTYPE_EXS DontDelete|ReadOnly + SVG_LENGTHTYPE_PX KSVG::SVG_LENGTHTYPE_PX DontDelete|ReadOnly + SVG_LENGTHTYPE_CM KSVG::SVG_LENGTHTYPE_CM DontDelete|ReadOnly + SVG_LENGTHTYPE_MM KSVG::SVG_LENGTHTYPE_MM DontDelete|ReadOnly + SVG_LENGTHTYPE_PT KSVG::SVG_LENGTHTYPE_PT DontDelete|ReadOnly + SVG_LENGTHTYPE_PC KSVG::SVG_LENGTHTYPE_PC DontDelete|ReadOnly +@end +*/ + +Value SVGLengthImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGLengthImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svglength.constructor]]"); +} diff --git a/ksvg/impl/SVGLengthListImpl.cc b/ksvg/impl/SVGLengthListImpl.cc deleted file mode 100644 index 2966dec8..00000000 --- a/ksvg/impl/SVGLengthListImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGLengthListImpl.h" - -using namespace KSVG; - -#include "SVGLengthListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGLengthListImpl::s_hashTable 2 - numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGLengthListImplProto::s_hashTable 11 - getItem SVGListDefs::GetItem DontDelete|Function 1 - removeItem SVGListDefs::RemoveItem DontDelete|Function 1 - appendItem SVGListDefs::AppendItem DontDelete|Function 1 - initialize SVGListDefs::Initialize DontDelete|Function 1 - insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 - replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 - clear SVGListDefs::Clear DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGLengthList", SVGLengthListImplProto, SVGLengthListImplProtoFunc) - -Value SVGLengthListImpl::getValueProperty(ExecState *exec, int token) const -{ - return SVGList::getValueProperty(exec, token); -} - -Value SVGLengthListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGLengthListImpl) - - return obj->call(exec, static_cast *>(obj), args, id); -} diff --git a/ksvg/impl/SVGLengthListImpl.cpp b/ksvg/impl/SVGLengthListImpl.cpp new file mode 100644 index 00000000..2966dec8 --- /dev/null +++ b/ksvg/impl/SVGLengthListImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGLengthListImpl.h" + +using namespace KSVG; + +#include "SVGLengthListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGLengthListImpl::s_hashTable 2 + numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGLengthListImplProto::s_hashTable 11 + getItem SVGListDefs::GetItem DontDelete|Function 1 + removeItem SVGListDefs::RemoveItem DontDelete|Function 1 + appendItem SVGListDefs::AppendItem DontDelete|Function 1 + initialize SVGListDefs::Initialize DontDelete|Function 1 + insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 + replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 + clear SVGListDefs::Clear DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGLengthList", SVGLengthListImplProto, SVGLengthListImplProtoFunc) + +Value SVGLengthListImpl::getValueProperty(ExecState *exec, int token) const +{ + return SVGList::getValueProperty(exec, token); +} + +Value SVGLengthListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGLengthListImpl) + + return obj->call(exec, static_cast *>(obj), args, id); +} diff --git a/ksvg/impl/SVGLineElementImpl.cc b/ksvg/impl/SVGLineElementImpl.cc deleted file mode 100644 index eee19d06..00000000 --- a/ksvg/impl/SVGLineElementImpl.cc +++ /dev/null @@ -1,211 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -#include "SVGRectImpl.h" -#include "SVGAngleImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGLineElementImpl.h" -#include "SVGAnimatedLengthImpl.h" - -using namespace KSVG; - -#include "SVGLineElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGLineElementImpl::SVGLineElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - KSVG_EMPTY_FLAGS - - m_x1 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x1->ref(); - m_x1->baseVal()->setValueAsString("-1"); - - m_y1 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y1->ref(); - m_y1->baseVal()->setValueAsString("-1"); - - m_x2 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x2->ref(); - m_x2->baseVal()->setValueAsString("-1"); - - m_y2 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y2->ref(); - m_y2->baseVal()->setValueAsString("-1"); -} - -SVGLineElementImpl::~SVGLineElementImpl() -{ - if(m_x1) - m_x1->deref(); - if(m_x2) - m_x2->deref(); - if(m_y1) - m_y1->deref(); - if(m_y2) - m_y2->deref(); -} - -SVGAnimatedLengthImpl *SVGLineElementImpl::x1() -{ - return m_x1; -} - -SVGAnimatedLengthImpl *SVGLineElementImpl::y1() -{ - return m_y1; -} - -SVGAnimatedLengthImpl *SVGLineElementImpl::x2() -{ - return m_x2; -} - -SVGAnimatedLengthImpl *SVGLineElementImpl::y2() -{ - return m_y2; -} - -/* -@namespace KSVG -@begin SVGLineElementImpl::s_hashTable 5 - x1 SVGLineElementImpl::X1 DontDelete|ReadOnly - y1 SVGLineElementImpl::Y1 DontDelete|ReadOnly - x2 SVGLineElementImpl::X2 DontDelete|ReadOnly - y2 SVGLineElementImpl::Y2 DontDelete|ReadOnly -@end -*/ - -Value SVGLineElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X1: - if(!attributeMode) - return m_x1->cache(exec); - else - return Number(m_x1->baseVal()->value()); - case Y1: - if(!attributeMode) - return m_y1->cache(exec); - else - return Number(m_y1->baseVal()->value()); - case X2: - if(!attributeMode) - return m_x2->cache(exec); - else - return Number(m_x2->baseVal()->value()); - case Y2: - if(!attributeMode) - return m_y2->cache(exec); - else - return Number(m_y2->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGLineElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X1: - x1()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Y1: - y1()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case X2: - x2()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Y2: - y2()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -SVGRectImpl *SVGLineElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - - float minx = kMin(m_x1->baseVal()->value(), m_x2->baseVal()->value()); - float miny = kMin(m_y1->baseVal()->value(), m_y2->baseVal()->value()); - float maxx = kMax(m_x1->baseVal()->value(), m_x2->baseVal()->value()); - float maxy = kMax(m_y1->baseVal()->value(), m_y2->baseVal()->value()); - ret->setX(minx); - ret->setY(miny); - ret->setWidth(maxx - minx); - ret->setHeight(maxy - miny); - - return ret; -} - -void SVGLineElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(X1)) - KSVG_SET_ALT_ATTRIBUTE(X1, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Y1)) - KSVG_SET_ALT_ATTRIBUTE(Y1, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(X2)) - KSVG_SET_ALT_ATTRIBUTE(X2, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Y2)) - KSVG_SET_ALT_ATTRIBUTE(Y2, "0") -} - -void SVGLineElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createLine(this); - c->insert(m_item); - } -} diff --git a/ksvg/impl/SVGLineElementImpl.cpp b/ksvg/impl/SVGLineElementImpl.cpp new file mode 100644 index 00000000..eee19d06 --- /dev/null +++ b/ksvg/impl/SVGLineElementImpl.cpp @@ -0,0 +1,211 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +#include "SVGRectImpl.h" +#include "SVGAngleImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGLineElementImpl.h" +#include "SVGAnimatedLengthImpl.h" + +using namespace KSVG; + +#include "SVGLineElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGLineElementImpl::SVGLineElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + KSVG_EMPTY_FLAGS + + m_x1 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x1->ref(); + m_x1->baseVal()->setValueAsString("-1"); + + m_y1 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y1->ref(); + m_y1->baseVal()->setValueAsString("-1"); + + m_x2 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x2->ref(); + m_x2->baseVal()->setValueAsString("-1"); + + m_y2 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y2->ref(); + m_y2->baseVal()->setValueAsString("-1"); +} + +SVGLineElementImpl::~SVGLineElementImpl() +{ + if(m_x1) + m_x1->deref(); + if(m_x2) + m_x2->deref(); + if(m_y1) + m_y1->deref(); + if(m_y2) + m_y2->deref(); +} + +SVGAnimatedLengthImpl *SVGLineElementImpl::x1() +{ + return m_x1; +} + +SVGAnimatedLengthImpl *SVGLineElementImpl::y1() +{ + return m_y1; +} + +SVGAnimatedLengthImpl *SVGLineElementImpl::x2() +{ + return m_x2; +} + +SVGAnimatedLengthImpl *SVGLineElementImpl::y2() +{ + return m_y2; +} + +/* +@namespace KSVG +@begin SVGLineElementImpl::s_hashTable 5 + x1 SVGLineElementImpl::X1 DontDelete|ReadOnly + y1 SVGLineElementImpl::Y1 DontDelete|ReadOnly + x2 SVGLineElementImpl::X2 DontDelete|ReadOnly + y2 SVGLineElementImpl::Y2 DontDelete|ReadOnly +@end +*/ + +Value SVGLineElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X1: + if(!attributeMode) + return m_x1->cache(exec); + else + return Number(m_x1->baseVal()->value()); + case Y1: + if(!attributeMode) + return m_y1->cache(exec); + else + return Number(m_y1->baseVal()->value()); + case X2: + if(!attributeMode) + return m_x2->cache(exec); + else + return Number(m_x2->baseVal()->value()); + case Y2: + if(!attributeMode) + return m_y2->cache(exec); + else + return Number(m_y2->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGLineElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X1: + x1()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Y1: + y1()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case X2: + x2()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Y2: + y2()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +SVGRectImpl *SVGLineElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + + float minx = kMin(m_x1->baseVal()->value(), m_x2->baseVal()->value()); + float miny = kMin(m_y1->baseVal()->value(), m_y2->baseVal()->value()); + float maxx = kMax(m_x1->baseVal()->value(), m_x2->baseVal()->value()); + float maxy = kMax(m_y1->baseVal()->value(), m_y2->baseVal()->value()); + ret->setX(minx); + ret->setY(miny); + ret->setWidth(maxx - minx); + ret->setHeight(maxy - miny); + + return ret; +} + +void SVGLineElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(X1)) + KSVG_SET_ALT_ATTRIBUTE(X1, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Y1)) + KSVG_SET_ALT_ATTRIBUTE(Y1, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(X2)) + KSVG_SET_ALT_ATTRIBUTE(X2, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Y2)) + KSVG_SET_ALT_ATTRIBUTE(Y2, "0") +} + +void SVGLineElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createLine(this); + c->insert(m_item); + } +} diff --git a/ksvg/impl/SVGLinearGradientElementImpl.cc b/ksvg/impl/SVGLinearGradientElementImpl.cc deleted file mode 100644 index 0a01a748..00000000 --- a/ksvg/impl/SVGLinearGradientElementImpl.cc +++ /dev/null @@ -1,199 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGradientElement.h" -#include "SVGLinearGradientElementImpl.h" - -#include "SVGDocumentImpl.h" -#include "KSVGCanvas.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGLengthImpl.h" -#include "SVGUnitConverter.h" - -using namespace KSVG; - -#include "SVGLinearGradientElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGLinearGradientElementImpl::SVGLinearGradientElementImpl(DOM::ElementImpl *impl) : SVGGradientElementImpl(impl) -{ - KSVG_EMPTY_FLAGS - - m_x1 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x1->ref(); - - m_y1 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y1->ref(); - - m_x2 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x2->ref(); - - m_y2 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y2->ref(); - - converter()->add(m_x1); - converter()->add(m_y1); - converter()->add(m_x2); - converter()->add(m_y2); -} - -SVGLinearGradientElementImpl::~SVGLinearGradientElementImpl() -{ - if(m_x1) - m_x1->deref(); - if(m_y1) - m_y1->deref(); - if(m_x2) - m_x2->deref(); - if(m_y2) - m_y2->deref(); -} - -SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::x1() const -{ - return m_x1; -} - -SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::y1() const -{ - return m_y1; -} - -SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::x2() const -{ - return m_x2; -} - -SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::y2() const -{ - return m_y2; -} - -/* -@namespace KSVG -@begin SVGLinearGradientElementImpl::s_hashTable 5 - x1 SVGLinearGradientElementImpl::X1 DontDelete|ReadOnly - y1 SVGLinearGradientElementImpl::Y1 DontDelete|ReadOnly - x2 SVGLinearGradientElementImpl::X2 DontDelete|ReadOnly - y2 SVGLinearGradientElementImpl::Y2 DontDelete|ReadOnly -@end -*/ - -Value SVGLinearGradientElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X1: - if(!attributeMode) - return m_x1->cache(exec); - else - return Number(m_x1->baseVal()->value()); - case Y1: - if(!attributeMode) - return m_y1->cache(exec); - else - return Number(m_y1->baseVal()->value()); - case X2: - if(!attributeMode) - return m_x2->cache(exec); - else - return Number(m_x2->baseVal()->value()); - case Y2: - if(!attributeMode) - return m_y2->cache(exec); - else - return Number(m_y2->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGLinearGradientElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X1: - converter()->modify(x1(), value.toString(exec).qstring()); - break; - case Y1: - converter()->modify(y1(), value.toString(exec).qstring()); - break; - case X2: - converter()->modify(x2(), value.toString(exec).qstring()); - break; - case Y2: - converter()->modify(y2(), value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGLinearGradientElementImpl::setAttributes() -{ - SVGGradientElementImpl::setAttributes(); - - // Spec: no attribute, effect is af value 0% is specified - if(KSVG_TOKEN_NOT_PARSED(X1)) - KSVG_SET_ALT_ATTRIBUTE(X1, "0") - - // Spec: no attribute, effect is af value 0% is specified - if(KSVG_TOKEN_NOT_PARSED(Y1)) - KSVG_SET_ALT_ATTRIBUTE(Y1, "0") - - // Spec: no attribute, effect is af value 100% is specified - if(KSVG_TOKEN_NOT_PARSED(X2)) - KSVG_SET_ALT_ATTRIBUTE(X2, "100%") - - // Spec: no attribute, effect is af value 0% is specified - if(KSVG_TOKEN_NOT_PARSED(Y2)) - KSVG_SET_ALT_ATTRIBUTE(Y2, "0") -} - -TQMap SVGLinearGradientElementImpl::gradientAttributes() -{ - setAttributes(); - - TQMap gradAttributes; - TQDictIterator it(attributes()); - - for(; it.current(); ++it) - { - DOM::DOMString name = it.currentKey(); - DOM::DOMString value = it.current()->string(); - - if(name == "gradientUnits" || name == "gradientTransform" || name == "spreadMethod" || name == "x1" || name == "x2" || name == "y1" || name == "y2") - { - gradAttributes.insert(name.string(), value.copy()); - } - } - - return gradAttributes; -} diff --git a/ksvg/impl/SVGLinearGradientElementImpl.cpp b/ksvg/impl/SVGLinearGradientElementImpl.cpp new file mode 100644 index 00000000..0a01a748 --- /dev/null +++ b/ksvg/impl/SVGLinearGradientElementImpl.cpp @@ -0,0 +1,199 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGradientElement.h" +#include "SVGLinearGradientElementImpl.h" + +#include "SVGDocumentImpl.h" +#include "KSVGCanvas.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGLengthImpl.h" +#include "SVGUnitConverter.h" + +using namespace KSVG; + +#include "SVGLinearGradientElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGLinearGradientElementImpl::SVGLinearGradientElementImpl(DOM::ElementImpl *impl) : SVGGradientElementImpl(impl) +{ + KSVG_EMPTY_FLAGS + + m_x1 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x1->ref(); + + m_y1 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y1->ref(); + + m_x2 = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x2->ref(); + + m_y2 = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y2->ref(); + + converter()->add(m_x1); + converter()->add(m_y1); + converter()->add(m_x2); + converter()->add(m_y2); +} + +SVGLinearGradientElementImpl::~SVGLinearGradientElementImpl() +{ + if(m_x1) + m_x1->deref(); + if(m_y1) + m_y1->deref(); + if(m_x2) + m_x2->deref(); + if(m_y2) + m_y2->deref(); +} + +SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::x1() const +{ + return m_x1; +} + +SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::y1() const +{ + return m_y1; +} + +SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::x2() const +{ + return m_x2; +} + +SVGAnimatedLengthImpl *SVGLinearGradientElementImpl::y2() const +{ + return m_y2; +} + +/* +@namespace KSVG +@begin SVGLinearGradientElementImpl::s_hashTable 5 + x1 SVGLinearGradientElementImpl::X1 DontDelete|ReadOnly + y1 SVGLinearGradientElementImpl::Y1 DontDelete|ReadOnly + x2 SVGLinearGradientElementImpl::X2 DontDelete|ReadOnly + y2 SVGLinearGradientElementImpl::Y2 DontDelete|ReadOnly +@end +*/ + +Value SVGLinearGradientElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X1: + if(!attributeMode) + return m_x1->cache(exec); + else + return Number(m_x1->baseVal()->value()); + case Y1: + if(!attributeMode) + return m_y1->cache(exec); + else + return Number(m_y1->baseVal()->value()); + case X2: + if(!attributeMode) + return m_x2->cache(exec); + else + return Number(m_x2->baseVal()->value()); + case Y2: + if(!attributeMode) + return m_y2->cache(exec); + else + return Number(m_y2->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGLinearGradientElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X1: + converter()->modify(x1(), value.toString(exec).qstring()); + break; + case Y1: + converter()->modify(y1(), value.toString(exec).qstring()); + break; + case X2: + converter()->modify(x2(), value.toString(exec).qstring()); + break; + case Y2: + converter()->modify(y2(), value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGLinearGradientElementImpl::setAttributes() +{ + SVGGradientElementImpl::setAttributes(); + + // Spec: no attribute, effect is af value 0% is specified + if(KSVG_TOKEN_NOT_PARSED(X1)) + KSVG_SET_ALT_ATTRIBUTE(X1, "0") + + // Spec: no attribute, effect is af value 0% is specified + if(KSVG_TOKEN_NOT_PARSED(Y1)) + KSVG_SET_ALT_ATTRIBUTE(Y1, "0") + + // Spec: no attribute, effect is af value 100% is specified + if(KSVG_TOKEN_NOT_PARSED(X2)) + KSVG_SET_ALT_ATTRIBUTE(X2, "100%") + + // Spec: no attribute, effect is af value 0% is specified + if(KSVG_TOKEN_NOT_PARSED(Y2)) + KSVG_SET_ALT_ATTRIBUTE(Y2, "0") +} + +TQMap SVGLinearGradientElementImpl::gradientAttributes() +{ + setAttributes(); + + TQMap gradAttributes; + TQDictIterator it(attributes()); + + for(; it.current(); ++it) + { + DOM::DOMString name = it.currentKey(); + DOM::DOMString value = it.current()->string(); + + if(name == "gradientUnits" || name == "gradientTransform" || name == "spreadMethod" || name == "x1" || name == "x2" || name == "y1" || name == "y2") + { + gradAttributes.insert(name.string(), value.copy()); + } + } + + return gradAttributes; +} diff --git a/ksvg/impl/SVGLocatableImpl.cc b/ksvg/impl/SVGLocatableImpl.cc deleted file mode 100644 index 1bf17fb6..00000000 --- a/ksvg/impl/SVGLocatableImpl.cc +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGRectImpl.h" -#include "SVGShapeImpl.h" -#include "SVGContainerImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGElementImpl.h" -#include "SVGLocatableImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGDocumentImpl.h" - -using namespace KSVG; - -#include "SVGLocatableImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGLocatableImpl::SVGLocatableImpl() -{ - m_nearestViewportElement = 0; - m_farthestViewportElement = 0; - m_cachedScreenCTM = SVGSVGElementImpl::createSVGMatrix(); - m_cachedScreenCTMIsValid = false; -} - -SVGLocatableImpl::~SVGLocatableImpl() -{ - if(m_nearestViewportElement) - m_nearestViewportElement->deref(); - if(m_farthestViewportElement) - m_farthestViewportElement->deref(); - if(m_cachedScreenCTM) - m_cachedScreenCTM->deref(); -} - -SVGRectImpl *SVGLocatableImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - return ret; -} - -SVGMatrixImpl *SVGLocatableImpl::getCTM() -{ - SVGMatrixImpl *ret = SVGSVGElementImpl::createSVGMatrix(); - return ret; -} - -SVGMatrixImpl *SVGLocatableImpl::getScreenCTM() -{ - SVGMatrixImpl *ret = SVGSVGElementImpl::createSVGMatrix(); - ret->copy(m_cachedScreenCTM); - - return ret; -} - -SVGMatrixImpl *SVGLocatableImpl::getTransformToElement(SVGElementImpl *) -{ - SVGMatrixImpl *ret = SVGSVGElementImpl::createSVGMatrix(); - return ret; -} - -void SVGLocatableImpl::updateCachedScreenCTM(const SVGMatrixImpl *parentScreenCTM) -{ - m_cachedScreenCTM->copy(parentScreenCTM); - - const SVGMatrixImpl *local = localMatrix(); - - if(local) - m_cachedScreenCTM->multiply(local); - m_cachedScreenCTMIsValid = true; - - // Notify the element - onScreenCTMUpdated(); - - SVGShapeImpl *shape = dynamic_cast(this); - - if(shape) - { - // TODO: Update due to matrix animations - //if(shape->item()) - // shape->item()->update(updateReason); - - SVGElementImpl *element = dynamic_cast(this); - - DOM::Node node = element->firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *child = element->ownerDoc()->getElementFromHandle(node.handle()); - SVGLocatableImpl *locatable = dynamic_cast(child); - - if(child && locatable) - locatable->updateCachedScreenCTM(m_cachedScreenCTM); - } - } -} - -void SVGLocatableImpl::checkCachedScreenCTM(const SVGMatrixImpl *parentScreenCTM) -{ - if(m_cachedScreenCTMIsValid) - { - SVGElementImpl *element = dynamic_cast(this); - SVGShapeImpl *shape = dynamic_cast(this); - - if(shape) - { - DOM::Node node = element->firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *child = element->ownerDoc()->getElementFromHandle(node.handle()); - SVGLocatableImpl *locatable = dynamic_cast(child); - - if(child && locatable) - locatable->checkCachedScreenCTM(m_cachedScreenCTM); - } - } - } - else - updateCachedScreenCTM(parentScreenCTM); -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGLocatableImpl::s_hashTable 3 - nearestViewportElement SVGLocatableImpl::NearestViewportElement DontDelete - farthestViewportElement SVGLocatableImpl::FarthestViewportElement DontDelete -@end -@namespace KSVG -@begin SVGLocatableImplProto::s_hashTable 5 - getBBox SVGLocatableImpl::GetBBox DontDelete|Function 0 - getCTM SVGLocatableImpl::GetCTM DontDelete|Function 0 - getScreenCTM SVGLocatableImpl::GetScreenCTM DontDelete|Function 0 - getTransformToElement SVGLocatableImpl::GetTransformToElement DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGLocatable", SVGLocatableImplProto, SVGLocatableImplProtoFunc) - -Value SVGLocatableImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case NearestViewportElement: - return nearestViewportElement() ? nearestViewportElement()->cache(exec) : Undefined(); - case FarthestViewportElement: - return farthestViewportElement() ? farthestViewportElement()->cache(exec) : Undefined(); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGLocatableImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGLocatableImpl) - - switch(id) - { - case SVGLocatableImpl::GetBBox: - { - SVGContainerImpl *container = dynamic_cast(obj); - if(container) - return container->getBBox()->cache(exec); - else - { - SVGShapeImpl *shape = dynamic_cast(obj); - if(shape) - return shape->getBBox()->cache(exec); - else - return obj->getBBox()->cache(exec); - } - } - case SVGLocatableImpl::GetCTM: - return obj->getCTM()->cache(exec); - case SVGLocatableImpl::GetScreenCTM: - return obj->getScreenCTM()->cache(exec); - case SVGLocatableImpl::GetTransformToElement: - return obj->getTransformToElement(static_cast *>(args[0].imp())->impl())->cache(exec); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} diff --git a/ksvg/impl/SVGLocatableImpl.cpp b/ksvg/impl/SVGLocatableImpl.cpp new file mode 100644 index 00000000..1bf17fb6 --- /dev/null +++ b/ksvg/impl/SVGLocatableImpl.cpp @@ -0,0 +1,206 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGRectImpl.h" +#include "SVGShapeImpl.h" +#include "SVGContainerImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGElementImpl.h" +#include "SVGLocatableImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGDocumentImpl.h" + +using namespace KSVG; + +#include "SVGLocatableImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGLocatableImpl::SVGLocatableImpl() +{ + m_nearestViewportElement = 0; + m_farthestViewportElement = 0; + m_cachedScreenCTM = SVGSVGElementImpl::createSVGMatrix(); + m_cachedScreenCTMIsValid = false; +} + +SVGLocatableImpl::~SVGLocatableImpl() +{ + if(m_nearestViewportElement) + m_nearestViewportElement->deref(); + if(m_farthestViewportElement) + m_farthestViewportElement->deref(); + if(m_cachedScreenCTM) + m_cachedScreenCTM->deref(); +} + +SVGRectImpl *SVGLocatableImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + return ret; +} + +SVGMatrixImpl *SVGLocatableImpl::getCTM() +{ + SVGMatrixImpl *ret = SVGSVGElementImpl::createSVGMatrix(); + return ret; +} + +SVGMatrixImpl *SVGLocatableImpl::getScreenCTM() +{ + SVGMatrixImpl *ret = SVGSVGElementImpl::createSVGMatrix(); + ret->copy(m_cachedScreenCTM); + + return ret; +} + +SVGMatrixImpl *SVGLocatableImpl::getTransformToElement(SVGElementImpl *) +{ + SVGMatrixImpl *ret = SVGSVGElementImpl::createSVGMatrix(); + return ret; +} + +void SVGLocatableImpl::updateCachedScreenCTM(const SVGMatrixImpl *parentScreenCTM) +{ + m_cachedScreenCTM->copy(parentScreenCTM); + + const SVGMatrixImpl *local = localMatrix(); + + if(local) + m_cachedScreenCTM->multiply(local); + m_cachedScreenCTMIsValid = true; + + // Notify the element + onScreenCTMUpdated(); + + SVGShapeImpl *shape = dynamic_cast(this); + + if(shape) + { + // TODO: Update due to matrix animations + //if(shape->item()) + // shape->item()->update(updateReason); + + SVGElementImpl *element = dynamic_cast(this); + + DOM::Node node = element->firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *child = element->ownerDoc()->getElementFromHandle(node.handle()); + SVGLocatableImpl *locatable = dynamic_cast(child); + + if(child && locatable) + locatable->updateCachedScreenCTM(m_cachedScreenCTM); + } + } +} + +void SVGLocatableImpl::checkCachedScreenCTM(const SVGMatrixImpl *parentScreenCTM) +{ + if(m_cachedScreenCTMIsValid) + { + SVGElementImpl *element = dynamic_cast(this); + SVGShapeImpl *shape = dynamic_cast(this); + + if(shape) + { + DOM::Node node = element->firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *child = element->ownerDoc()->getElementFromHandle(node.handle()); + SVGLocatableImpl *locatable = dynamic_cast(child); + + if(child && locatable) + locatable->checkCachedScreenCTM(m_cachedScreenCTM); + } + } + } + else + updateCachedScreenCTM(parentScreenCTM); +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGLocatableImpl::s_hashTable 3 + nearestViewportElement SVGLocatableImpl::NearestViewportElement DontDelete + farthestViewportElement SVGLocatableImpl::FarthestViewportElement DontDelete +@end +@namespace KSVG +@begin SVGLocatableImplProto::s_hashTable 5 + getBBox SVGLocatableImpl::GetBBox DontDelete|Function 0 + getCTM SVGLocatableImpl::GetCTM DontDelete|Function 0 + getScreenCTM SVGLocatableImpl::GetScreenCTM DontDelete|Function 0 + getTransformToElement SVGLocatableImpl::GetTransformToElement DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGLocatable", SVGLocatableImplProto, SVGLocatableImplProtoFunc) + +Value SVGLocatableImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case NearestViewportElement: + return nearestViewportElement() ? nearestViewportElement()->cache(exec) : Undefined(); + case FarthestViewportElement: + return farthestViewportElement() ? farthestViewportElement()->cache(exec) : Undefined(); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGLocatableImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGLocatableImpl) + + switch(id) + { + case SVGLocatableImpl::GetBBox: + { + SVGContainerImpl *container = dynamic_cast(obj); + if(container) + return container->getBBox()->cache(exec); + else + { + SVGShapeImpl *shape = dynamic_cast(obj); + if(shape) + return shape->getBBox()->cache(exec); + else + return obj->getBBox()->cache(exec); + } + } + case SVGLocatableImpl::GetCTM: + return obj->getCTM()->cache(exec); + case SVGLocatableImpl::GetScreenCTM: + return obj->getScreenCTM()->cache(exec); + case SVGLocatableImpl::GetTransformToElement: + return obj->getTransformToElement(static_cast *>(args[0].imp())->impl())->cache(exec); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} diff --git a/ksvg/impl/SVGMPathElementImpl.cc b/ksvg/impl/SVGMPathElementImpl.cc deleted file mode 100644 index 8348e07a..00000000 --- a/ksvg/impl/SVGMPathElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMPathElementImpl.h" - -using namespace KSVG; - -SVGMPathElementImpl::SVGMPathElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGExternalResourcesRequiredImpl() -{ -} - -SVGMPathElementImpl::~SVGMPathElementImpl() -{ -} diff --git a/ksvg/impl/SVGMPathElementImpl.cpp b/ksvg/impl/SVGMPathElementImpl.cpp new file mode 100644 index 00000000..8348e07a --- /dev/null +++ b/ksvg/impl/SVGMPathElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMPathElementImpl.h" + +using namespace KSVG; + +SVGMPathElementImpl::SVGMPathElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGExternalResourcesRequiredImpl() +{ +} + +SVGMPathElementImpl::~SVGMPathElementImpl() +{ +} diff --git a/ksvg/impl/SVGMarkerElementImpl.cc b/ksvg/impl/SVGMarkerElementImpl.cc deleted file mode 100644 index 554f56b7..00000000 --- a/ksvg/impl/SVGMarkerElementImpl.cc +++ /dev/null @@ -1,422 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGMarkerElement.h" - -#include "SVGRectImpl.h" -#include "SVGAngleImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGTransformImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedRectImpl.h" -#include "SVGMarkerElementImpl.h" -#include "SVGAnimatedAngleImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGPreserveAspectRatioImpl.h" -#include "SVGAnimatedPreserveAspectRatioImpl.h" - -#include "KSVGCanvas.h" - -using namespace KSVG; - -#include "SVGMarkerElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" -#include "ksvg_cacheimpl.h" - -SVGMarkerElementImpl::SVGMarkerElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFitToViewBoxImpl() -{ - KSVG_EMPTY_FLAGS - - m_refX = new SVGAnimatedLengthImpl(); - m_refX->ref(); - - m_refY = new SVGAnimatedLengthImpl(); - m_refY->ref(); - - m_markerUnits = new SVGAnimatedEnumerationImpl(); - m_markerUnits->ref(); - - m_markerWidth = new SVGAnimatedLengthImpl(); - m_markerWidth->ref(); - - m_markerHeight = new SVGAnimatedLengthImpl(); - m_markerHeight->ref(); - - m_orientType = new SVGAnimatedEnumerationImpl(); - m_orientType->ref(); - - m_orientAngle = new SVGAnimatedAngleImpl(); - m_orientAngle->ref(); -} - -SVGMarkerElementImpl::~SVGMarkerElementImpl() -{ - if(m_refX) - m_refX->deref(); - if(m_refY) - m_refY->deref(); - if(m_markerUnits) - m_markerUnits->deref(); - if(m_markerWidth) - m_markerWidth->deref(); - if(m_markerHeight) - m_markerHeight->deref(); - if(m_orientType) - m_orientType->deref(); - if(m_orientAngle) - m_orientAngle->deref(); -} - -SVGAnimatedLengthImpl *SVGMarkerElementImpl::refX() const -{ - return m_refX; -} - -SVGAnimatedLengthImpl *SVGMarkerElementImpl::refY() const -{ - return m_refY; -} - -SVGAnimatedEnumerationImpl *SVGMarkerElementImpl::markerUnits() const -{ - return m_markerUnits; -} - -SVGAnimatedLengthImpl *SVGMarkerElementImpl::markerWidth() const -{ - return m_markerWidth; -} - -SVGAnimatedLengthImpl *SVGMarkerElementImpl::markerHeight() const -{ - return m_markerHeight; -} - -SVGAnimatedEnumerationImpl *SVGMarkerElementImpl::orientType() const -{ - return m_orientType; -} - -SVGAnimatedAngleImpl *SVGMarkerElementImpl::orientAngle() const -{ - return m_orientAngle; -} - -void SVGMarkerElementImpl::setOrientToAuto() -{ - orientType()->setBaseVal(SVG_MARKER_ORIENT_AUTO); -} - -void SVGMarkerElementImpl::setOrientToAngle(SVGAngleImpl *angle) -{ - m_orientAngle->baseVal()->setValue(angle->value()); -} - -void SVGMarkerElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(RefX)) - KSVG_SET_ALT_ATTRIBUTE(RefX, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(RefY)) - KSVG_SET_ALT_ATTRIBUTE(RefY, "0") - - // Spec: if not specified, effect is as if a value of "3" were specified - if(KSVG_TOKEN_NOT_PARSED(MarkerWidth)) - KSVG_SET_ALT_ATTRIBUTE(MarkerWidth, "3") - - // Spec: if not specified, effect is as if a value of "3" were specified - if(KSVG_TOKEN_NOT_PARSED(MarkerHeight)) - KSVG_SET_ALT_ATTRIBUTE(MarkerHeight, "3") - - // Spec: if attribute not specified, use strokeWidth - if(KSVG_TOKEN_NOT_PARSED(MarkerUnits)) - KSVG_SET_ALT_ATTRIBUTE(MarkerUnits, "strokeWidth") - - // Spec: if attribute not specified, use angle - if(KSVG_TOKEN_NOT_PARSED(Orient)) - KSVG_SET_ALT_ATTRIBUTE(Orient, "angle") -} - -void SVGMarkerElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createCanvasMarker(this); - c->insert(m_item); - } -} - -void SVGMarkerElementImpl::draw(SVGShapeImpl *referencingElement, double x, double y, double lwidth, double angle) -{ - SVGMatrixImpl *mtx = dynamic_cast(referencingElement)->getScreenCTM(); - - // move to dest - mtx->translate(x, y); - - // scale by linewidth if marker units == strokewidth - if(markerUnits()->baseVal() == SVG_MARKERUNITS_STROKEWIDTH) - mtx->scale(lwidth); - - // select appropriate rotation - if(orientType()->baseVal() == SVG_MARKER_ORIENT_AUTO) - mtx->rotate(angle); - else - mtx->rotate(orientAngle()->baseVal()->value()); - - SVGRectImpl *viewBoxRect = viewBox()->baseVal(); - SVGMatrixImpl *pres = preserveAspectRatio()->baseVal()->getCTM(viewBoxRect->x(), viewBoxRect->y(), - viewBoxRect->width(), viewBoxRect->height(), - 0, 0, markerWidth()->baseVal()->value(), - markerHeight()->baseVal()->value()); - - // viewbox stuff - mtx->multiply(pres); - - // Get the vertex position in viewbox coordinates. The vertex is at (0, 0) in viewport coordinates. - double vertexX, vertexY; - pres->qmatrix().invert().map(0, 0, &vertexX, &vertexY); - - // Translate so that the vertex is at (refX, refY) in viewbox coordinates. - mtx->translate(vertexX - refX()->baseVal()->value(), vertexY - refY()->baseVal()->value()); - - if(getOverflow()) - m_clipShape.clear(); - else - { - KSVGRectangle viewport; - - if(hasAttribute("viewBox")) - { - // Get the viewport ((0, 0) - (markerWidth, markerHeight)) in viewbox coordinates. - double w, h; - pres->qmatrix().invert().map(markerWidth()->baseVal()->value(), markerHeight()->baseVal()->value(), &w, &h); - - viewport = KSVGRectangle(vertexX, vertexY, w - vertexX, h - vertexY); - } - else - viewport = KSVGRectangle(0, 0, markerWidth()->baseVal()->value(), markerHeight()->baseVal()->value()); - - // Transform to screen coordinates. - m_clipShape = mtx->map(viewport); - } - - pres->deref(); - - DOM::Node node = firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - SVGShapeImpl *shape = dynamic_cast(element); - SVGTestsImpl *tests = dynamic_cast(element); - SVGStylableImpl *style = dynamic_cast(element); - - bool ok = tests ? tests->ok() : true; - if(element && shape && style && ok && style->getVisible() && style->getDisplay()) - { - SVGLocatableImpl *locatable = dynamic_cast(element); - if(locatable) - locatable->updateCachedScreenCTM(mtx); - - shape->update(UPDATE_TRANSFORM); - shape->setReferenced(true); - shape->draw(); - shape->setReferenced(false); - } - } - - mtx->deref(); -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGMarkerElementImpl::s_hashTable 11 - refX SVGMarkerElementImpl::RefX DontDelete|ReadOnly - refY SVGMarkerElementImpl::RefY DontDelete|ReadOnly - markerUnits SVGMarkerElementImpl::MarkerUnits DontDelete|ReadOnly - markerWidth SVGMarkerElementImpl::MarkerWidth DontDelete|ReadOnly - markerHeight SVGMarkerElementImpl::MarkerHeight DontDelete|ReadOnly - orientType SVGMarkerElementImpl::OrientType DontDelete|ReadOnly - orientAngle SVGMarkerElementImpl::OrientAngle DontDelete|ReadOnly - orient SVGMarkerElementImpl::Orient DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGMarkerElementImplProto::s_hashTable 3 - setOrientToAuto SVGMarkerElementImpl::SetOrientToAuto DontDelete|Function 0 - setOrientToAngle SVGMarkerElementImpl::SetOrientToAngle DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGMarkerElement", SVGMarkerElementImplProto, SVGMarkerElementImplProtoFunc) - -Value SVGMarkerElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case RefX: - if(!attributeMode) - return m_refX->cache(exec); - else - return Number(m_refX->baseVal()->value()); - case RefY: - if(!attributeMode) - return m_refY->cache(exec); - else - return Number(m_refY->baseVal()->value()); - case MarkerUnits: - if(!attributeMode) - return m_markerUnits->cache(exec); - else - return Number(m_markerUnits->baseVal()); - case MarkerWidth: - if(!attributeMode) - return m_markerWidth->cache(exec); - else - return Number(m_markerWidth->baseVal()->value()); - case MarkerHeight: - if(!attributeMode) - return m_markerHeight->cache(exec); - else - return Number(m_markerHeight->baseVal()->value()); - case OrientType: - if(!attributeMode) - return m_orientType->cache(exec); - else - return Number(m_orientType->baseVal()); - case OrientAngle: - if(!attributeMode) - return m_orientAngle->cache(exec); - else - return Number(m_orientAngle->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGMarkerElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case RefX: - refX()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case RefY: - refY()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case MarkerWidth: - markerWidth()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case MarkerHeight: - markerHeight()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case MarkerUnits: - if(value.toString(exec).qstring() == "userSpaceOnUse") - markerUnits()->setBaseVal(SVG_MARKERUNITS_USERSPACEONUSE); - else - markerUnits()->setBaseVal(SVG_MARKERUNITS_STROKEWIDTH); - break; - case Orient: - { - TQString param = value.toString(exec).qstring(); - - if(param == "auto") - orientType()->setBaseVal(SVG_MARKER_ORIENT_AUTO); - else - { - orientType()->setBaseVal(SVG_MARKER_ORIENT_ANGLE); - m_orientAngle->baseVal()->setValueAsString(param); - } - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGMarkerElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGMarkerElementImpl) - - switch(id) - { - case SVGMarkerElementImpl::SetOrientToAuto: - obj->setOrientToAuto(); - return Undefined(); -#ifdef __GNUC__ -#warning FIXME cache stuff -#endif - case SVGMarkerElementImpl::SetOrientToAngle: - obj->setOrientToAngle(static_cast *>(args[0].imp())->impl()); - return Undefined(); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -// CONSTANTS - -/* -@namespace KSVG -@begin SVGMarkerElementImplConstructor::s_hashTable 7 - SVG_MARKERUNITS_UNKNOWN KSVG::SVG_MARKERUNITS_UNKNOWN DontDelete|ReadOnly - SVG_MARKERUNITS_USERSPACEONUSE KSVG::SVG_MARKERUNITS_USERSPACEONUSE DontDelete|ReadOnly - SVG_MARKERUNITS_STROKEWIDTH KSVG::SVG_MARKERUNITS_STROKEWIDTH DontDelete|ReadOnly - SVG_MARKER_ORIENT_UNKNOWN KSVG::SVG_MARKER_ORIENT_UNKNOWN DontDelete|ReadOnly - SVG_MARKER_ORIENT_AUTO KSVG::SVG_MARKER_ORIENT_AUTO DontDelete|ReadOnly - SVG_MARKER_ORIENT_ANGLE KSVG::SVG_MARKER_ORIENT_ANGLE DontDelete|ReadOnly -@end -*/ - -using namespace KJS; - -Value SVGMarkerElementImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGMarkerElementImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgmarkerelement.constructor]]"); -} diff --git a/ksvg/impl/SVGMarkerElementImpl.cpp b/ksvg/impl/SVGMarkerElementImpl.cpp new file mode 100644 index 00000000..554f56b7 --- /dev/null +++ b/ksvg/impl/SVGMarkerElementImpl.cpp @@ -0,0 +1,422 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGMarkerElement.h" + +#include "SVGRectImpl.h" +#include "SVGAngleImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGTransformImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedRectImpl.h" +#include "SVGMarkerElementImpl.h" +#include "SVGAnimatedAngleImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGPreserveAspectRatioImpl.h" +#include "SVGAnimatedPreserveAspectRatioImpl.h" + +#include "KSVGCanvas.h" + +using namespace KSVG; + +#include "SVGMarkerElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" +#include "ksvg_cacheimpl.h" + +SVGMarkerElementImpl::SVGMarkerElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFitToViewBoxImpl() +{ + KSVG_EMPTY_FLAGS + + m_refX = new SVGAnimatedLengthImpl(); + m_refX->ref(); + + m_refY = new SVGAnimatedLengthImpl(); + m_refY->ref(); + + m_markerUnits = new SVGAnimatedEnumerationImpl(); + m_markerUnits->ref(); + + m_markerWidth = new SVGAnimatedLengthImpl(); + m_markerWidth->ref(); + + m_markerHeight = new SVGAnimatedLengthImpl(); + m_markerHeight->ref(); + + m_orientType = new SVGAnimatedEnumerationImpl(); + m_orientType->ref(); + + m_orientAngle = new SVGAnimatedAngleImpl(); + m_orientAngle->ref(); +} + +SVGMarkerElementImpl::~SVGMarkerElementImpl() +{ + if(m_refX) + m_refX->deref(); + if(m_refY) + m_refY->deref(); + if(m_markerUnits) + m_markerUnits->deref(); + if(m_markerWidth) + m_markerWidth->deref(); + if(m_markerHeight) + m_markerHeight->deref(); + if(m_orientType) + m_orientType->deref(); + if(m_orientAngle) + m_orientAngle->deref(); +} + +SVGAnimatedLengthImpl *SVGMarkerElementImpl::refX() const +{ + return m_refX; +} + +SVGAnimatedLengthImpl *SVGMarkerElementImpl::refY() const +{ + return m_refY; +} + +SVGAnimatedEnumerationImpl *SVGMarkerElementImpl::markerUnits() const +{ + return m_markerUnits; +} + +SVGAnimatedLengthImpl *SVGMarkerElementImpl::markerWidth() const +{ + return m_markerWidth; +} + +SVGAnimatedLengthImpl *SVGMarkerElementImpl::markerHeight() const +{ + return m_markerHeight; +} + +SVGAnimatedEnumerationImpl *SVGMarkerElementImpl::orientType() const +{ + return m_orientType; +} + +SVGAnimatedAngleImpl *SVGMarkerElementImpl::orientAngle() const +{ + return m_orientAngle; +} + +void SVGMarkerElementImpl::setOrientToAuto() +{ + orientType()->setBaseVal(SVG_MARKER_ORIENT_AUTO); +} + +void SVGMarkerElementImpl::setOrientToAngle(SVGAngleImpl *angle) +{ + m_orientAngle->baseVal()->setValue(angle->value()); +} + +void SVGMarkerElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(RefX)) + KSVG_SET_ALT_ATTRIBUTE(RefX, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(RefY)) + KSVG_SET_ALT_ATTRIBUTE(RefY, "0") + + // Spec: if not specified, effect is as if a value of "3" were specified + if(KSVG_TOKEN_NOT_PARSED(MarkerWidth)) + KSVG_SET_ALT_ATTRIBUTE(MarkerWidth, "3") + + // Spec: if not specified, effect is as if a value of "3" were specified + if(KSVG_TOKEN_NOT_PARSED(MarkerHeight)) + KSVG_SET_ALT_ATTRIBUTE(MarkerHeight, "3") + + // Spec: if attribute not specified, use strokeWidth + if(KSVG_TOKEN_NOT_PARSED(MarkerUnits)) + KSVG_SET_ALT_ATTRIBUTE(MarkerUnits, "strokeWidth") + + // Spec: if attribute not specified, use angle + if(KSVG_TOKEN_NOT_PARSED(Orient)) + KSVG_SET_ALT_ATTRIBUTE(Orient, "angle") +} + +void SVGMarkerElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createCanvasMarker(this); + c->insert(m_item); + } +} + +void SVGMarkerElementImpl::draw(SVGShapeImpl *referencingElement, double x, double y, double lwidth, double angle) +{ + SVGMatrixImpl *mtx = dynamic_cast(referencingElement)->getScreenCTM(); + + // move to dest + mtx->translate(x, y); + + // scale by linewidth if marker units == strokewidth + if(markerUnits()->baseVal() == SVG_MARKERUNITS_STROKEWIDTH) + mtx->scale(lwidth); + + // select appropriate rotation + if(orientType()->baseVal() == SVG_MARKER_ORIENT_AUTO) + mtx->rotate(angle); + else + mtx->rotate(orientAngle()->baseVal()->value()); + + SVGRectImpl *viewBoxRect = viewBox()->baseVal(); + SVGMatrixImpl *pres = preserveAspectRatio()->baseVal()->getCTM(viewBoxRect->x(), viewBoxRect->y(), + viewBoxRect->width(), viewBoxRect->height(), + 0, 0, markerWidth()->baseVal()->value(), + markerHeight()->baseVal()->value()); + + // viewbox stuff + mtx->multiply(pres); + + // Get the vertex position in viewbox coordinates. The vertex is at (0, 0) in viewport coordinates. + double vertexX, vertexY; + pres->qmatrix().invert().map(0, 0, &vertexX, &vertexY); + + // Translate so that the vertex is at (refX, refY) in viewbox coordinates. + mtx->translate(vertexX - refX()->baseVal()->value(), vertexY - refY()->baseVal()->value()); + + if(getOverflow()) + m_clipShape.clear(); + else + { + KSVGRectangle viewport; + + if(hasAttribute("viewBox")) + { + // Get the viewport ((0, 0) - (markerWidth, markerHeight)) in viewbox coordinates. + double w, h; + pres->qmatrix().invert().map(markerWidth()->baseVal()->value(), markerHeight()->baseVal()->value(), &w, &h); + + viewport = KSVGRectangle(vertexX, vertexY, w - vertexX, h - vertexY); + } + else + viewport = KSVGRectangle(0, 0, markerWidth()->baseVal()->value(), markerHeight()->baseVal()->value()); + + // Transform to screen coordinates. + m_clipShape = mtx->map(viewport); + } + + pres->deref(); + + DOM::Node node = firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + SVGShapeImpl *shape = dynamic_cast(element); + SVGTestsImpl *tests = dynamic_cast(element); + SVGStylableImpl *style = dynamic_cast(element); + + bool ok = tests ? tests->ok() : true; + if(element && shape && style && ok && style->getVisible() && style->getDisplay()) + { + SVGLocatableImpl *locatable = dynamic_cast(element); + if(locatable) + locatable->updateCachedScreenCTM(mtx); + + shape->update(UPDATE_TRANSFORM); + shape->setReferenced(true); + shape->draw(); + shape->setReferenced(false); + } + } + + mtx->deref(); +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGMarkerElementImpl::s_hashTable 11 + refX SVGMarkerElementImpl::RefX DontDelete|ReadOnly + refY SVGMarkerElementImpl::RefY DontDelete|ReadOnly + markerUnits SVGMarkerElementImpl::MarkerUnits DontDelete|ReadOnly + markerWidth SVGMarkerElementImpl::MarkerWidth DontDelete|ReadOnly + markerHeight SVGMarkerElementImpl::MarkerHeight DontDelete|ReadOnly + orientType SVGMarkerElementImpl::OrientType DontDelete|ReadOnly + orientAngle SVGMarkerElementImpl::OrientAngle DontDelete|ReadOnly + orient SVGMarkerElementImpl::Orient DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGMarkerElementImplProto::s_hashTable 3 + setOrientToAuto SVGMarkerElementImpl::SetOrientToAuto DontDelete|Function 0 + setOrientToAngle SVGMarkerElementImpl::SetOrientToAngle DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGMarkerElement", SVGMarkerElementImplProto, SVGMarkerElementImplProtoFunc) + +Value SVGMarkerElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case RefX: + if(!attributeMode) + return m_refX->cache(exec); + else + return Number(m_refX->baseVal()->value()); + case RefY: + if(!attributeMode) + return m_refY->cache(exec); + else + return Number(m_refY->baseVal()->value()); + case MarkerUnits: + if(!attributeMode) + return m_markerUnits->cache(exec); + else + return Number(m_markerUnits->baseVal()); + case MarkerWidth: + if(!attributeMode) + return m_markerWidth->cache(exec); + else + return Number(m_markerWidth->baseVal()->value()); + case MarkerHeight: + if(!attributeMode) + return m_markerHeight->cache(exec); + else + return Number(m_markerHeight->baseVal()->value()); + case OrientType: + if(!attributeMode) + return m_orientType->cache(exec); + else + return Number(m_orientType->baseVal()); + case OrientAngle: + if(!attributeMode) + return m_orientAngle->cache(exec); + else + return Number(m_orientAngle->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGMarkerElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case RefX: + refX()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case RefY: + refY()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case MarkerWidth: + markerWidth()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case MarkerHeight: + markerHeight()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case MarkerUnits: + if(value.toString(exec).qstring() == "userSpaceOnUse") + markerUnits()->setBaseVal(SVG_MARKERUNITS_USERSPACEONUSE); + else + markerUnits()->setBaseVal(SVG_MARKERUNITS_STROKEWIDTH); + break; + case Orient: + { + TQString param = value.toString(exec).qstring(); + + if(param == "auto") + orientType()->setBaseVal(SVG_MARKER_ORIENT_AUTO); + else + { + orientType()->setBaseVal(SVG_MARKER_ORIENT_ANGLE); + m_orientAngle->baseVal()->setValueAsString(param); + } + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGMarkerElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGMarkerElementImpl) + + switch(id) + { + case SVGMarkerElementImpl::SetOrientToAuto: + obj->setOrientToAuto(); + return Undefined(); +#ifdef __GNUC__ +#warning FIXME cache stuff +#endif + case SVGMarkerElementImpl::SetOrientToAngle: + obj->setOrientToAngle(static_cast *>(args[0].imp())->impl()); + return Undefined(); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +// CONSTANTS + +/* +@namespace KSVG +@begin SVGMarkerElementImplConstructor::s_hashTable 7 + SVG_MARKERUNITS_UNKNOWN KSVG::SVG_MARKERUNITS_UNKNOWN DontDelete|ReadOnly + SVG_MARKERUNITS_USERSPACEONUSE KSVG::SVG_MARKERUNITS_USERSPACEONUSE DontDelete|ReadOnly + SVG_MARKERUNITS_STROKEWIDTH KSVG::SVG_MARKERUNITS_STROKEWIDTH DontDelete|ReadOnly + SVG_MARKER_ORIENT_UNKNOWN KSVG::SVG_MARKER_ORIENT_UNKNOWN DontDelete|ReadOnly + SVG_MARKER_ORIENT_AUTO KSVG::SVG_MARKER_ORIENT_AUTO DontDelete|ReadOnly + SVG_MARKER_ORIENT_ANGLE KSVG::SVG_MARKER_ORIENT_ANGLE DontDelete|ReadOnly +@end +*/ + +using namespace KJS; + +Value SVGMarkerElementImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGMarkerElementImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgmarkerelement.constructor]]"); +} diff --git a/ksvg/impl/SVGMaskElementImpl.cc b/ksvg/impl/SVGMaskElementImpl.cc deleted file mode 100644 index d3947ff4..00000000 --- a/ksvg/impl/SVGMaskElementImpl.cc +++ /dev/null @@ -1,540 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include -#include - -#include "SVGMaskElement.h" - -#include "SVGRectImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGMaskElementImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGUnitConverter.h" -#include "SVGShapeImpl.h" -#include "SVGMatrixImpl.h" -#include "KSVGCanvas.h" -#include "CanvasItems.h" -#include "CanvasFactory.h" -#include "KSVGHelper.h" - -#include - -using namespace KSVG; - -#include "SVGMaskElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_ecma.h" - -SVGMaskElementImpl::SVGMaskElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGBBoxTarget() -{ - KSVG_EMPTY_FLAGS - - m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y->ref(); - - m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_height->ref(); - - m_maskUnits = new SVGAnimatedEnumerationImpl(); - m_maskUnits->ref(); - - m_maskContentUnits = new SVGAnimatedEnumerationImpl(); - m_maskContentUnits->ref(); - - m_converter = new SVGUnitConverter(); - m_converter->add(m_x); - m_converter->add(m_y); - m_converter->add(m_width); - m_converter->add(m_height); - - m_canvas = 0; - - m_maskCache.setMaxTotalCost(1024 * 1024); -} - -SVGMaskElementImpl::~SVGMaskElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - if(m_maskUnits) - m_maskContentUnits->deref(); - if(m_maskUnits) - m_maskContentUnits->deref(); - delete m_converter; - if(m_canvas) - delete m_canvas; -} - -SVGAnimatedEnumerationImpl *SVGMaskElementImpl::maskUnits() const -{ - return m_maskUnits; -} - -SVGAnimatedEnumerationImpl *SVGMaskElementImpl::maskContentUnits() const -{ - return m_maskContentUnits; -} - -SVGAnimatedLengthImpl *SVGMaskElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGMaskElementImpl::y() const -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGMaskElementImpl::width() const -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGMaskElementImpl::height() const -{ - return m_height; -} - -/* -@namespace KSVG -@begin SVGMaskElementImpl::s_hashTable 7 - maskUnits SVGMaskElementImpl::MaskUnits DontDelete|ReadOnly - maskContentUnits SVGMaskElementImpl::MaskContentUnits DontDelete|ReadOnly - x SVGMaskElementImpl::X DontDelete|ReadOnly - y SVGMaskElementImpl::Y DontDelete|ReadOnly - width SVGMaskElementImpl::Width DontDelete|ReadOnly - height SVGMaskElementImpl::Height DontDelete|ReadOnly -@end -*/ -Value SVGMaskElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case MaskUnits: - if(!attributeMode) - return m_maskUnits->cache(exec); - else - return Number(m_maskUnits->baseVal()); - case MaskContentUnits: - if(!attributeMode) - return m_maskContentUnits->cache(exec); - else - return Number(m_maskContentUnits->baseVal()); - case X: - if(!attributeMode) - return m_x->cache(exec); - else - return Number(m_x->baseVal()->value()); - case Y: - if(!attributeMode) - return m_y->cache(exec); - else - return Number(m_y->baseVal()->value()); - case Width: - if(!attributeMode) - return m_width->cache(exec); - else - return Number(m_width->baseVal()->value()); - - case Height: - if(!attributeMode) - return m_height->cache(exec); - else - return Number(m_height->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGMaskElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case MaskUnits: - if(value.toString(exec).qstring() == "objectBoundingBox") - m_maskUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); - else - m_maskUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_USERSPACEONUSE); - break; - case MaskContentUnits: - if(value.toString(exec).qstring() == "objectBoundingBox") - m_maskContentUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); - else - m_maskContentUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_USERSPACEONUSE); - break; - case X: - converter()->modify(x(), value.toString(exec).qstring()); - break; - case Y: - converter()->modify(y(), value.toString(exec).qstring()); - break; - case Width: - converter()->modify(width(), value.toString(exec).qstring()); - break; - case Height: - converter()->modify(height(), value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -SVGRectImpl *SVGMaskElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - ret->setX(m_x->baseVal()->value()); - ret->setY(m_y->baseVal()->value()); - ret->setWidth(m_width->baseVal()->value()); - ret->setHeight(m_height->baseVal()->value()); - return ret; -} - -void SVGMaskElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if attribute not specified, use objectBoundingBox - if(KSVG_TOKEN_NOT_PARSED(MaskUnits)) - KSVG_SET_ALT_ATTRIBUTE(MaskUnits, "objectBoundingBox") - - // Spec: if attribute not specified, use userSpaceOnUse - if(KSVG_TOKEN_NOT_PARSED(MaskContentUnits)) - KSVG_SET_ALT_ATTRIBUTE(MaskContentUnits, "userSpaceOnUse") - - // Spec: if attribute not specified, use "-10%" - if(KSVG_TOKEN_NOT_PARSED(X)) - KSVG_SET_ALT_ATTRIBUTE(X, "-10%"); - - // Spec: if attribute not specified, use "-10%" - if(KSVG_TOKEN_NOT_PARSED(Y)) - KSVG_SET_ALT_ATTRIBUTE(Y, "-10%"); - - // Spec: if attribute not specified, use "120%" - if(KSVG_TOKEN_NOT_PARSED(Width)) - KSVG_SET_ALT_ATTRIBUTE(Width, "120%"); - - // Spec: if attribute not specified, use "120%" - if(KSVG_TOKEN_NOT_PARSED(Height)) - KSVG_SET_ALT_ATTRIBUTE(Height, "120%"); -} - -SVGMaskElementImpl::Mask SVGMaskElementImpl::createMask(SVGShapeImpl *referencingElement, int imageWidth, int imageHeight) -{ - converter()->finalize(referencingElement, ownerSVGElement(), maskUnits()->baseVal()); - - TQ_UINT32 *imageBits = new TQ_UINT32[imageWidth * imageHeight]; - - if(m_canvas == 0) - m_canvas = CanvasFactory::self()->loadCanvas(imageWidth, imageHeight); - - m_canvas->setup(reinterpret_cast(imageBits), imageWidth, imageHeight); - m_canvas->setBackgroundColor(tqRgba(0, 0, 0, 0)); - - SVGMatrixImpl *baseMatrix = SVGSVGElementImpl::createSVGMatrix(); - - // Set the scale to map the mask onto the image - double xScale = static_cast(imageWidth) / width()->baseVal()->value(); - double yScale = static_cast(imageHeight) / height()->baseVal()->value(); - - baseMatrix->scaleNonUniform(xScale, yScale); - - SVGRectImpl *bbox = referencingElement->getBBox(); - - if(maskUnits()->baseVal() == SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) - baseMatrix->translate(-(bbox->x() + x()->baseVal()->value()), -(bbox->y() + y()->baseVal()->value())); - else - baseMatrix->translate(-x()->baseVal()->value(), -y()->baseVal()->value()); - - if(maskContentUnits()->baseVal() == SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) - { - baseMatrix->translate(bbox->x(), bbox->y()); - baseMatrix->scaleNonUniform(bbox->width(), bbox->height()); - } - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - SVGShapeImpl *shape = dynamic_cast(element); - SVGTestsImpl *tests = dynamic_cast(element); - SVGStylableImpl *style = dynamic_cast(element); - - bool ok = tests ? tests->ok() : true; - if(element && shape && style && ok && style->getVisible() && style->getDisplay()) - { - SVGLocatableImpl *locatable = dynamic_cast(element); - if(locatable) - locatable->updateCachedScreenCTM(baseMatrix); - - element->createItem(m_canvas); - if(shape->item()) - { - shape->item()->setReferenced(true); - m_canvas->invalidate(shape->item(), true); - } - } - } - - m_canvas->update(float(1)); - - for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - SVGShapeImpl *shape = dynamic_cast(element); - SVGTestsImpl *tests = dynamic_cast(element); - SVGStylableImpl *style = dynamic_cast(element); - - bool ok = tests ? tests->ok() : true; - if(element && shape && style && ok && style->getVisible() && style->getDisplay()) - { - if(shape) - shape->removeItem(m_canvas); - } - } - - - { - // Note: r and b reversed - //TQImage maskImage(reinterpret_cast(imageBits), imageWidth, imageHeight, 32, 0, 0, TQImage::IgnoreEndian); - //maskImage.setAlphaBuffer(true); - //maskImage.save("mask.png", "PNG"); - } - - TQByteArray maskData(imageWidth * imageHeight); - const double epsilon = DBL_EPSILON; - - // Convert the rgba image into an 8-bit mask, according to the specs. - for(int i = 0; i < imageWidth * imageHeight; i++) - { - TQ_UINT32 rgba = imageBits[i]; - -#if X_BYTE_ORDER == X_LITTLE_ENDIAN - double r = (rgba & 0xff) / 255.0; - double g = ((rgba >> 8) & 0xff) / 255.0; - double b = ((rgba >> 16) & 0xff) / 255.0; - double a = ((rgba >> 24) & 0xff) / 255.0; -#else - double a = (rgba & 0xff) / 255.0; - double b = ((rgba >> 8) & 0xff) / 255.0; - double g = ((rgba >> 16) & 0xff) / 255.0; - double r = ((rgba >> 24) & 0xff) / 255.0; -#endif - - // Remove pre-multiplication by alpha. - if(a > epsilon) - { - r /= a; - g /= a; - b /= a; - } - - // Convert to linear RGB - r = KSVGHelper::linearRGBFromsRGB(int(r * 255 + 0.5)) / 255.0; - g = KSVGHelper::linearRGBFromsRGB(int(g * 255 + 0.5)) / 255.0; - b = KSVGHelper::linearRGBFromsRGB(int(b * 255 + 0.5)) / 255.0; - - // Convert 'luminance to alpha' - double luminanceAlpha = 0.2125 * r + 0.7154 * g + 0.0721 * b; - - // Multiply by alpha. - double maskValue = luminanceAlpha * a; - - maskData[i] = static_cast(maskValue * 255 + 0.5); - } - - delete [] imageBits; - - baseMatrix->deref(); - bbox->deref(); - - // The screenToMask matrix is calculated each time the mask is used so we don't - // need to set it here. - TQWMatrix tempMatrix; - - return Mask(maskData, tempMatrix, imageWidth, imageHeight); -} - -SVGMaskElementImpl::Mask SVGMaskElementImpl::createMask(SVGShapeImpl *referencingElement) -{ - converter()->finalize(referencingElement, ownerSVGElement(), maskUnits()->baseVal()); - - SVGMatrixImpl *refCTM = 0; - SVGLocatableImpl *locatableRef = dynamic_cast(referencingElement); - if(locatableRef) - refCTM = locatableRef->getScreenCTM(); - else - refCTM = SVGSVGElementImpl::createSVGMatrix(); - - double xScale, yScale; - - refCTM->removeScale(&xScale, &yScale); - refCTM->deref(); - - int imageWidth = static_cast(width()->baseVal()->value() * xScale + 0.5); - int imageHeight = static_cast(height()->baseVal()->value() * yScale + 0.5); - - Mask mask; - - if(imageWidth > 0 && imageHeight > 0) - { - CacheKey key(referencingElement, imageWidth, imageHeight); - - if(!m_maskCache.find(key, mask)) - { - mask = createMask(referencingElement, imageWidth, imageHeight); - m_maskCache.insert(key, mask, imageWidth * imageHeight); - } - - // Generate a mask-coordinates to screen-coordinates matrix - SVGMatrixImpl *matrix = 0; - if(locatableRef) - matrix = locatableRef->getScreenCTM(); - else - matrix = SVGSVGElementImpl::createSVGMatrix(); - - if(maskUnits()->baseVal() == SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) - { - SVGRectImpl *bbox = referencingElement->getBBox(); - matrix->translate(bbox->x() + x()->baseVal()->value(), bbox->y() + y()->baseVal()->value()); - bbox->deref(); - } - else - matrix->translate(x()->baseVal()->value(), y()->baseVal()->value()); - - matrix->scaleNonUniform(1 / xScale, 1 / yScale); - - TQWMatrix screenToMask = matrix->qmatrix().invert(); - matrix->deref(); - - mask.setScreenToMask(screenToMask); - } - - return mask; -} - -TQByteArray SVGMaskElementImpl::maskRectangle(SVGShapeImpl *shape, const TQRect& screenRectangle) -{ - TQByteArray cumulativeMask; - - do - { - SVGStylableImpl *style = dynamic_cast(shape); - - if(style && style->hasMask()) - { - SVGElementImpl *element = shape->ownerDoc()->rootElement()->getElementById(style->getMask()); - - if(element) - { - SVGMaskElementImpl *maskElement = dynamic_cast(element); - - if(maskElement) - { - SVGMaskElementImpl::Mask mask = maskElement->createMask(shape); - - if(!mask.isEmpty()) - { - TQByteArray maskData = mask.rectangle(screenRectangle); - - if(cumulativeMask.size() == 0) - cumulativeMask = maskData; - else - { - int size = cumulativeMask.size(); - - // Multiply into the cumulative mask (using fast divide by 255) - for(int i = 0; i < size; i++) - { - int tmp = maskData[i] * cumulativeMask[i] + 0x80; - cumulativeMask[i] = (tmp + (tmp >> 8)) >> 8; - } - } - } - } - } - } - - DOM::Node parentNode = shape->parentNode(); - - if(!parentNode.isNull()) - { - SVGElementImpl *parent = shape->ownerDoc()->getElementFromHandle(parentNode.handle()); - - if(parent) - shape = dynamic_cast(parent); - else - shape = 0; - } - else - shape = 0; - - } while(shape); - - return cumulativeMask; -} - -SVGMaskElementImpl::Mask::Mask(const TQByteArray& mask, const TQWMatrix& screenToMask, int width, int height) - : m_width(width), m_height(height), m_mask(mask), m_screenToMask(screenToMask) -{ -} - -TQByteArray SVGMaskElementImpl::Mask::rectangle(int screenX, int screenY, int width, int height) -{ - TQByteArray rect(width * height); - - for(int x = 0; x < width; x++) - { - for(int y = 0; y < height; y++) - { - rect[x + y * width] = value(screenX + x, screenY + y); - } - } - - return rect; -} - -TQByteArray SVGMaskElementImpl::Mask::rectangle(const TQRect& rect) -{ - return rectangle(rect.x(), rect.y(), rect.width(), rect.height()); -} diff --git a/ksvg/impl/SVGMaskElementImpl.cpp b/ksvg/impl/SVGMaskElementImpl.cpp new file mode 100644 index 00000000..d3947ff4 --- /dev/null +++ b/ksvg/impl/SVGMaskElementImpl.cpp @@ -0,0 +1,540 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include + +#include "SVGMaskElement.h" + +#include "SVGRectImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGMaskElementImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGUnitConverter.h" +#include "SVGShapeImpl.h" +#include "SVGMatrixImpl.h" +#include "KSVGCanvas.h" +#include "CanvasItems.h" +#include "CanvasFactory.h" +#include "KSVGHelper.h" + +#include + +using namespace KSVG; + +#include "SVGMaskElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_ecma.h" + +SVGMaskElementImpl::SVGMaskElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGBBoxTarget() +{ + KSVG_EMPTY_FLAGS + + m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y->ref(); + + m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_height->ref(); + + m_maskUnits = new SVGAnimatedEnumerationImpl(); + m_maskUnits->ref(); + + m_maskContentUnits = new SVGAnimatedEnumerationImpl(); + m_maskContentUnits->ref(); + + m_converter = new SVGUnitConverter(); + m_converter->add(m_x); + m_converter->add(m_y); + m_converter->add(m_width); + m_converter->add(m_height); + + m_canvas = 0; + + m_maskCache.setMaxTotalCost(1024 * 1024); +} + +SVGMaskElementImpl::~SVGMaskElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + if(m_maskUnits) + m_maskContentUnits->deref(); + if(m_maskUnits) + m_maskContentUnits->deref(); + delete m_converter; + if(m_canvas) + delete m_canvas; +} + +SVGAnimatedEnumerationImpl *SVGMaskElementImpl::maskUnits() const +{ + return m_maskUnits; +} + +SVGAnimatedEnumerationImpl *SVGMaskElementImpl::maskContentUnits() const +{ + return m_maskContentUnits; +} + +SVGAnimatedLengthImpl *SVGMaskElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGMaskElementImpl::y() const +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGMaskElementImpl::width() const +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGMaskElementImpl::height() const +{ + return m_height; +} + +/* +@namespace KSVG +@begin SVGMaskElementImpl::s_hashTable 7 + maskUnits SVGMaskElementImpl::MaskUnits DontDelete|ReadOnly + maskContentUnits SVGMaskElementImpl::MaskContentUnits DontDelete|ReadOnly + x SVGMaskElementImpl::X DontDelete|ReadOnly + y SVGMaskElementImpl::Y DontDelete|ReadOnly + width SVGMaskElementImpl::Width DontDelete|ReadOnly + height SVGMaskElementImpl::Height DontDelete|ReadOnly +@end +*/ +Value SVGMaskElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case MaskUnits: + if(!attributeMode) + return m_maskUnits->cache(exec); + else + return Number(m_maskUnits->baseVal()); + case MaskContentUnits: + if(!attributeMode) + return m_maskContentUnits->cache(exec); + else + return Number(m_maskContentUnits->baseVal()); + case X: + if(!attributeMode) + return m_x->cache(exec); + else + return Number(m_x->baseVal()->value()); + case Y: + if(!attributeMode) + return m_y->cache(exec); + else + return Number(m_y->baseVal()->value()); + case Width: + if(!attributeMode) + return m_width->cache(exec); + else + return Number(m_width->baseVal()->value()); + + case Height: + if(!attributeMode) + return m_height->cache(exec); + else + return Number(m_height->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGMaskElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case MaskUnits: + if(value.toString(exec).qstring() == "objectBoundingBox") + m_maskUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); + else + m_maskUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_USERSPACEONUSE); + break; + case MaskContentUnits: + if(value.toString(exec).qstring() == "objectBoundingBox") + m_maskContentUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); + else + m_maskContentUnits->setBaseVal(SVGMaskElement::SVG_UNIT_TYPE_USERSPACEONUSE); + break; + case X: + converter()->modify(x(), value.toString(exec).qstring()); + break; + case Y: + converter()->modify(y(), value.toString(exec).qstring()); + break; + case Width: + converter()->modify(width(), value.toString(exec).qstring()); + break; + case Height: + converter()->modify(height(), value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +SVGRectImpl *SVGMaskElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + ret->setX(m_x->baseVal()->value()); + ret->setY(m_y->baseVal()->value()); + ret->setWidth(m_width->baseVal()->value()); + ret->setHeight(m_height->baseVal()->value()); + return ret; +} + +void SVGMaskElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if attribute not specified, use objectBoundingBox + if(KSVG_TOKEN_NOT_PARSED(MaskUnits)) + KSVG_SET_ALT_ATTRIBUTE(MaskUnits, "objectBoundingBox") + + // Spec: if attribute not specified, use userSpaceOnUse + if(KSVG_TOKEN_NOT_PARSED(MaskContentUnits)) + KSVG_SET_ALT_ATTRIBUTE(MaskContentUnits, "userSpaceOnUse") + + // Spec: if attribute not specified, use "-10%" + if(KSVG_TOKEN_NOT_PARSED(X)) + KSVG_SET_ALT_ATTRIBUTE(X, "-10%"); + + // Spec: if attribute not specified, use "-10%" + if(KSVG_TOKEN_NOT_PARSED(Y)) + KSVG_SET_ALT_ATTRIBUTE(Y, "-10%"); + + // Spec: if attribute not specified, use "120%" + if(KSVG_TOKEN_NOT_PARSED(Width)) + KSVG_SET_ALT_ATTRIBUTE(Width, "120%"); + + // Spec: if attribute not specified, use "120%" + if(KSVG_TOKEN_NOT_PARSED(Height)) + KSVG_SET_ALT_ATTRIBUTE(Height, "120%"); +} + +SVGMaskElementImpl::Mask SVGMaskElementImpl::createMask(SVGShapeImpl *referencingElement, int imageWidth, int imageHeight) +{ + converter()->finalize(referencingElement, ownerSVGElement(), maskUnits()->baseVal()); + + TQ_UINT32 *imageBits = new TQ_UINT32[imageWidth * imageHeight]; + + if(m_canvas == 0) + m_canvas = CanvasFactory::self()->loadCanvas(imageWidth, imageHeight); + + m_canvas->setup(reinterpret_cast(imageBits), imageWidth, imageHeight); + m_canvas->setBackgroundColor(tqRgba(0, 0, 0, 0)); + + SVGMatrixImpl *baseMatrix = SVGSVGElementImpl::createSVGMatrix(); + + // Set the scale to map the mask onto the image + double xScale = static_cast(imageWidth) / width()->baseVal()->value(); + double yScale = static_cast(imageHeight) / height()->baseVal()->value(); + + baseMatrix->scaleNonUniform(xScale, yScale); + + SVGRectImpl *bbox = referencingElement->getBBox(); + + if(maskUnits()->baseVal() == SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) + baseMatrix->translate(-(bbox->x() + x()->baseVal()->value()), -(bbox->y() + y()->baseVal()->value())); + else + baseMatrix->translate(-x()->baseVal()->value(), -y()->baseVal()->value()); + + if(maskContentUnits()->baseVal() == SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) + { + baseMatrix->translate(bbox->x(), bbox->y()); + baseMatrix->scaleNonUniform(bbox->width(), bbox->height()); + } + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + SVGShapeImpl *shape = dynamic_cast(element); + SVGTestsImpl *tests = dynamic_cast(element); + SVGStylableImpl *style = dynamic_cast(element); + + bool ok = tests ? tests->ok() : true; + if(element && shape && style && ok && style->getVisible() && style->getDisplay()) + { + SVGLocatableImpl *locatable = dynamic_cast(element); + if(locatable) + locatable->updateCachedScreenCTM(baseMatrix); + + element->createItem(m_canvas); + if(shape->item()) + { + shape->item()->setReferenced(true); + m_canvas->invalidate(shape->item(), true); + } + } + } + + m_canvas->update(float(1)); + + for(DOM::Node node = firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + SVGShapeImpl *shape = dynamic_cast(element); + SVGTestsImpl *tests = dynamic_cast(element); + SVGStylableImpl *style = dynamic_cast(element); + + bool ok = tests ? tests->ok() : true; + if(element && shape && style && ok && style->getVisible() && style->getDisplay()) + { + if(shape) + shape->removeItem(m_canvas); + } + } + + + { + // Note: r and b reversed + //TQImage maskImage(reinterpret_cast(imageBits), imageWidth, imageHeight, 32, 0, 0, TQImage::IgnoreEndian); + //maskImage.setAlphaBuffer(true); + //maskImage.save("mask.png", "PNG"); + } + + TQByteArray maskData(imageWidth * imageHeight); + const double epsilon = DBL_EPSILON; + + // Convert the rgba image into an 8-bit mask, according to the specs. + for(int i = 0; i < imageWidth * imageHeight; i++) + { + TQ_UINT32 rgba = imageBits[i]; + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + double r = (rgba & 0xff) / 255.0; + double g = ((rgba >> 8) & 0xff) / 255.0; + double b = ((rgba >> 16) & 0xff) / 255.0; + double a = ((rgba >> 24) & 0xff) / 255.0; +#else + double a = (rgba & 0xff) / 255.0; + double b = ((rgba >> 8) & 0xff) / 255.0; + double g = ((rgba >> 16) & 0xff) / 255.0; + double r = ((rgba >> 24) & 0xff) / 255.0; +#endif + + // Remove pre-multiplication by alpha. + if(a > epsilon) + { + r /= a; + g /= a; + b /= a; + } + + // Convert to linear RGB + r = KSVGHelper::linearRGBFromsRGB(int(r * 255 + 0.5)) / 255.0; + g = KSVGHelper::linearRGBFromsRGB(int(g * 255 + 0.5)) / 255.0; + b = KSVGHelper::linearRGBFromsRGB(int(b * 255 + 0.5)) / 255.0; + + // Convert 'luminance to alpha' + double luminanceAlpha = 0.2125 * r + 0.7154 * g + 0.0721 * b; + + // Multiply by alpha. + double maskValue = luminanceAlpha * a; + + maskData[i] = static_cast(maskValue * 255 + 0.5); + } + + delete [] imageBits; + + baseMatrix->deref(); + bbox->deref(); + + // The screenToMask matrix is calculated each time the mask is used so we don't + // need to set it here. + TQWMatrix tempMatrix; + + return Mask(maskData, tempMatrix, imageWidth, imageHeight); +} + +SVGMaskElementImpl::Mask SVGMaskElementImpl::createMask(SVGShapeImpl *referencingElement) +{ + converter()->finalize(referencingElement, ownerSVGElement(), maskUnits()->baseVal()); + + SVGMatrixImpl *refCTM = 0; + SVGLocatableImpl *locatableRef = dynamic_cast(referencingElement); + if(locatableRef) + refCTM = locatableRef->getScreenCTM(); + else + refCTM = SVGSVGElementImpl::createSVGMatrix(); + + double xScale, yScale; + + refCTM->removeScale(&xScale, &yScale); + refCTM->deref(); + + int imageWidth = static_cast(width()->baseVal()->value() * xScale + 0.5); + int imageHeight = static_cast(height()->baseVal()->value() * yScale + 0.5); + + Mask mask; + + if(imageWidth > 0 && imageHeight > 0) + { + CacheKey key(referencingElement, imageWidth, imageHeight); + + if(!m_maskCache.find(key, mask)) + { + mask = createMask(referencingElement, imageWidth, imageHeight); + m_maskCache.insert(key, mask, imageWidth * imageHeight); + } + + // Generate a mask-coordinates to screen-coordinates matrix + SVGMatrixImpl *matrix = 0; + if(locatableRef) + matrix = locatableRef->getScreenCTM(); + else + matrix = SVGSVGElementImpl::createSVGMatrix(); + + if(maskUnits()->baseVal() == SVGMaskElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) + { + SVGRectImpl *bbox = referencingElement->getBBox(); + matrix->translate(bbox->x() + x()->baseVal()->value(), bbox->y() + y()->baseVal()->value()); + bbox->deref(); + } + else + matrix->translate(x()->baseVal()->value(), y()->baseVal()->value()); + + matrix->scaleNonUniform(1 / xScale, 1 / yScale); + + TQWMatrix screenToMask = matrix->qmatrix().invert(); + matrix->deref(); + + mask.setScreenToMask(screenToMask); + } + + return mask; +} + +TQByteArray SVGMaskElementImpl::maskRectangle(SVGShapeImpl *shape, const TQRect& screenRectangle) +{ + TQByteArray cumulativeMask; + + do + { + SVGStylableImpl *style = dynamic_cast(shape); + + if(style && style->hasMask()) + { + SVGElementImpl *element = shape->ownerDoc()->rootElement()->getElementById(style->getMask()); + + if(element) + { + SVGMaskElementImpl *maskElement = dynamic_cast(element); + + if(maskElement) + { + SVGMaskElementImpl::Mask mask = maskElement->createMask(shape); + + if(!mask.isEmpty()) + { + TQByteArray maskData = mask.rectangle(screenRectangle); + + if(cumulativeMask.size() == 0) + cumulativeMask = maskData; + else + { + int size = cumulativeMask.size(); + + // Multiply into the cumulative mask (using fast divide by 255) + for(int i = 0; i < size; i++) + { + int tmp = maskData[i] * cumulativeMask[i] + 0x80; + cumulativeMask[i] = (tmp + (tmp >> 8)) >> 8; + } + } + } + } + } + } + + DOM::Node parentNode = shape->parentNode(); + + if(!parentNode.isNull()) + { + SVGElementImpl *parent = shape->ownerDoc()->getElementFromHandle(parentNode.handle()); + + if(parent) + shape = dynamic_cast(parent); + else + shape = 0; + } + else + shape = 0; + + } while(shape); + + return cumulativeMask; +} + +SVGMaskElementImpl::Mask::Mask(const TQByteArray& mask, const TQWMatrix& screenToMask, int width, int height) + : m_width(width), m_height(height), m_mask(mask), m_screenToMask(screenToMask) +{ +} + +TQByteArray SVGMaskElementImpl::Mask::rectangle(int screenX, int screenY, int width, int height) +{ + TQByteArray rect(width * height); + + for(int x = 0; x < width; x++) + { + for(int y = 0; y < height; y++) + { + rect[x + y * width] = value(screenX + x, screenY + y); + } + } + + return rect; +} + +TQByteArray SVGMaskElementImpl::Mask::rectangle(const TQRect& rect) +{ + return rectangle(rect.x(), rect.y(), rect.width(), rect.height()); +} diff --git a/ksvg/impl/SVGMatrixImpl.cc b/ksvg/impl/SVGMatrixImpl.cc deleted file mode 100644 index 1f48848d..00000000 --- a/ksvg/impl/SVGMatrixImpl.cc +++ /dev/null @@ -1,458 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGAngleImpl.h" -#include "SVGMatrixImpl.h" -#include "KSVGHelper.h" - -using namespace KSVG; - -#include "SVGMatrixImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGMatrixImpl::SVGMatrixImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGMatrixImpl::SVGMatrixImpl(TQWMatrix mat) -{ - m_mat = mat; -} - -SVGMatrixImpl::SVGMatrixImpl(double a, double b, double c, double d, double e, double f) -{ - m_mat.setMatrix(a, b, c, d, e, f); -} - -SVGMatrixImpl::~SVGMatrixImpl() -{ -} - -void SVGMatrixImpl::setA(const double &a) -{ - m_mat.setMatrix(a, m_mat.m12(), m_mat.m21(), m_mat.m22(), m_mat.dx(), m_mat.dy()); -} - -double SVGMatrixImpl::a() const -{ - return m_mat.m11(); -} - -void SVGMatrixImpl::setB(const double &b) -{ - m_mat.setMatrix(m_mat.m11(), b, m_mat.m21(), m_mat.m22(), m_mat.dx(), m_mat.dy()); -} - -double SVGMatrixImpl::b() const -{ - return m_mat.m12(); -} - -void SVGMatrixImpl::setC(const double &c) -{ - m_mat.setMatrix(m_mat.m11(), m_mat.m12(), c, m_mat.m22(), m_mat.dx(), m_mat.dy()); -} - -double SVGMatrixImpl::c() const -{ - return m_mat.m21(); -} - -void SVGMatrixImpl::setD(const double &d) -{ - m_mat.setMatrix(m_mat.m11(), m_mat.m12(), m_mat.m21(), d, m_mat.dx(), m_mat.dy()); -} - -double SVGMatrixImpl::d() const -{ - return m_mat.m22(); -} - -void SVGMatrixImpl::setE(const double &e) -{ - m_mat.setMatrix(m_mat.m11(), m_mat.m12(), m_mat.m21(), m_mat.m22(), e, m_mat.dy()); -} - -double SVGMatrixImpl::e() const -{ - return m_mat.dx(); -} - -void SVGMatrixImpl::setF(const double &f) -{ - m_mat.setMatrix(m_mat.m11(), m_mat.m12(), m_mat.m21(), m_mat.m22(), m_mat.dx(), f); -} - -double SVGMatrixImpl::f() const -{ - return m_mat.dy(); -} - -void SVGMatrixImpl::copy(const SVGMatrixImpl *other) -{ - m_mat.setMatrix(other->m_mat.m11(), other->m_mat.m12(), other->m_mat.m21(), other->m_mat.m22(), other->m_mat.dx(), other->m_mat.dy()); -} - -SVGMatrixImpl *SVGMatrixImpl::postMultiply(const SVGMatrixImpl *secondMatrix) -{ - TQWMatrix temp(secondMatrix->a(), secondMatrix->b(), secondMatrix->c(), secondMatrix->d(), secondMatrix->e(), secondMatrix->f()); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::inverse() -{ - m_mat = m_mat.invert(); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postTranslate(const double &x, const double &y) -{ - // Could optimise these. - TQWMatrix temp; - temp.translate(x, y); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postScale(const double &scaleFactor) -{ - TQWMatrix temp; - temp.scale(scaleFactor, scaleFactor); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postScaleNonUniform(const double &scaleFactorX, const double &scaleFactorY) -{ - TQWMatrix temp; - temp.scale(scaleFactorX, scaleFactorY); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postRotate(const double &angle) -{ - TQWMatrix temp; - temp.rotate(angle); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postRotateFromVector(const double &x, const double &y) -{ - TQWMatrix temp; - temp.rotate(SVGAngleImpl::todeg(atan2(y, x))); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postFlipX() -{ - TQWMatrix temp(-1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postFlipY() -{ - TQWMatrix temp(1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postSkewX(const double &angle) -{ - TQWMatrix temp; - temp.shear(tan(SVGAngleImpl::torad(angle)), 0.0F); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::postSkewY(const double &angle) -{ - TQWMatrix temp; - temp.shear(0.0F, tan(SVGAngleImpl::torad(angle))); - m_mat *= temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::multiply(const SVGMatrixImpl *secondMatrix) -{ - TQWMatrix temp(secondMatrix->a(), secondMatrix->b(), secondMatrix->c(), secondMatrix->d(), secondMatrix->e(), secondMatrix->f()); - temp *= m_mat; - m_mat = temp; - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::translate(const double &x, const double &y) -{ - m_mat.translate(x, y); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::scale(const double &scaleFactor) -{ - m_mat.scale(scaleFactor, scaleFactor); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::scaleNonUniform(const double &scaleFactorX, const double &scaleFactorY) -{ - m_mat.scale(scaleFactorX, scaleFactorY); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::rotate(const double &angle) -{ - m_mat.rotate(angle); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::rotateFromVector(const double &x, const double &y) -{ - m_mat.rotate(SVGAngleImpl::todeg(atan2(y, x))); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::flipX() -{ - m_mat.scale(-1.0f, 1.0f); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::flipY() -{ - m_mat.scale(1.0f, -1.0f); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::skewX(const double &angle) -{ - m_mat.shear(tan(SVGAngleImpl::torad(angle)), 0.0F); - return this; -} - -SVGMatrixImpl *SVGMatrixImpl::skewY(const double &angle) -{ - m_mat.shear(0.0F, tan(SVGAngleImpl::torad(angle))); - return this; -} - -void SVGMatrixImpl::setMatrix(TQWMatrix mat) -{ - m_mat = mat; -} - -TQWMatrix &SVGMatrixImpl::qmatrix() -{ - return m_mat; -} - -const TQWMatrix &SVGMatrixImpl::qmatrix() const -{ - return m_mat; -} - -void SVGMatrixImpl::reset() -{ - m_mat.reset(); -} - -void SVGMatrixImpl::removeScale(double *xScale, double *yScale) -{ - double sx = sqrt(a()*a() + b()*b()); - double sy = sqrt(c()*c() + d()*d()); - - // Remove the scaling from the matrix. - - setA(a()/sx); - setB(b()/sx); - setC(c()/sy); - setD(d()/sy); - - *xScale = sx; - *yScale = sy; -} - -KSVGPolygon SVGMatrixImpl::map(const KSVGPolygon& polygon) const -{ - KSVGPolygon mapped; - - for(unsigned int i = 0; i < polygon.numPoints(); i++) - { - double x, y; - - m_mat.map(polygon.point(i).x(), polygon.point(i).y(), &x, &y); - mapped.addPoint(x, y); - } - - return mapped; -} - -KSVGPolygon SVGMatrixImpl::inverseMap(const KSVGPolygon& polygon) const -{ - TQWMatrix inverse = m_mat.invert(); - KSVGPolygon mapped; - - for(unsigned int i = 0; i < polygon.numPoints(); i++) - { - double x, y; - - inverse.map(polygon.point(i).x(), polygon.point(i).y(), &x, &y); - mapped.addPoint(x, y); - } - - return mapped; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGMatrixImpl::s_hashTable 7 - a SVGMatrixImpl::A DontDelete - b SVGMatrixImpl::B DontDelete - c SVGMatrixImpl::C DontDelete - d SVGMatrixImpl::D DontDelete - e SVGMatrixImpl::E DontDelete - f SVGMatrixImpl::F DontDelete -@end -@namespace KSVG -@begin SVGMatrixImplProto::s_hashTable 13 - inverse SVGMatrixImpl::Inverse DontDelete|Function 0 - multiply SVGMatrixImpl::Multiply DontDelete|Function 1 - translate SVGMatrixImpl::Translate DontDelete|Function 2 - scale SVGMatrixImpl::Scale DontDelete|Function 1 - rotate SVGMatrixImpl::Rotate DontDelete|Function 1 - rotateFromVector SVGMatrixImpl::RotateFromVector DontDelete|Function 2 - scaleNonUniform SVGMatrixImpl::ScaleNonUniform DontDelete|Function 2 - flipX SVGMatrixImpl::FlipX DontDelete|Function 0 - flipY SVGMatrixImpl::FlipY DontDelete|Function 0 - skewX SVGMatrixImpl::SkewX DontDelete|Function 1 - skewY SVGMatrixImpl::SkewY DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGMatrix", SVGMatrixImplProto, SVGMatrixImplProtoFunc) - -Value SVGMatrixImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case A: - return Number(a()); - case B: - return Number(b()); - case C: - return Number(c()); - case D: - return Number(d()); - case E: - return Number(e()); - case F: - return Number(f()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return KJS::Undefined(); - } -} - - -void SVGMatrixImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case A: - setA(value.toNumber(exec)); - break; - case B: - setB(value.toNumber(exec)); - break; - case C: - setC(value.toNumber(exec)); - break; - case D: - setD(value.toNumber(exec)); - break; - case E: - setE(value.toNumber(exec)); - break; - case F: - setF(value.toNumber(exec)); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - break; - } -} - -Value SVGMatrixImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGMatrixImpl) - - switch(id) - { - case SVGMatrixImpl::Inverse: - return obj->inverse()->cache(exec); - break; - case SVGMatrixImpl::Multiply: - return obj->multiply(static_cast *>(args[0].imp())->impl())->cache(exec); - break; - case SVGMatrixImpl::Translate: - return obj->translate(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - break; - case SVGMatrixImpl::Scale: - return obj->scale(args[0].toNumber(exec))->cache(exec); - break; - case SVGMatrixImpl::Rotate: - return obj->rotate(args[0].toNumber(exec))->cache(exec); - break; - case SVGMatrixImpl::RotateFromVector: - return obj->rotateFromVector(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - break; - case SVGMatrixImpl::ScaleNonUniform: - return obj->scaleNonUniform(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - break; - case SVGMatrixImpl::FlipX: - return obj->flipX()->cache(exec); - break; - case SVGMatrixImpl::FlipY: - return obj->flipY()->cache(exec); - break; - case SVGMatrixImpl::SkewX: - return obj->skewX(args[0].toNumber(exec))->cache(exec); - break; - case SVGMatrixImpl::SkewY: - return obj->skewY(args[0].toNumber(exec))->cache(exec);; - break; - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} diff --git a/ksvg/impl/SVGMatrixImpl.cpp b/ksvg/impl/SVGMatrixImpl.cpp new file mode 100644 index 00000000..1f48848d --- /dev/null +++ b/ksvg/impl/SVGMatrixImpl.cpp @@ -0,0 +1,458 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGAngleImpl.h" +#include "SVGMatrixImpl.h" +#include "KSVGHelper.h" + +using namespace KSVG; + +#include "SVGMatrixImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGMatrixImpl::SVGMatrixImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGMatrixImpl::SVGMatrixImpl(TQWMatrix mat) +{ + m_mat = mat; +} + +SVGMatrixImpl::SVGMatrixImpl(double a, double b, double c, double d, double e, double f) +{ + m_mat.setMatrix(a, b, c, d, e, f); +} + +SVGMatrixImpl::~SVGMatrixImpl() +{ +} + +void SVGMatrixImpl::setA(const double &a) +{ + m_mat.setMatrix(a, m_mat.m12(), m_mat.m21(), m_mat.m22(), m_mat.dx(), m_mat.dy()); +} + +double SVGMatrixImpl::a() const +{ + return m_mat.m11(); +} + +void SVGMatrixImpl::setB(const double &b) +{ + m_mat.setMatrix(m_mat.m11(), b, m_mat.m21(), m_mat.m22(), m_mat.dx(), m_mat.dy()); +} + +double SVGMatrixImpl::b() const +{ + return m_mat.m12(); +} + +void SVGMatrixImpl::setC(const double &c) +{ + m_mat.setMatrix(m_mat.m11(), m_mat.m12(), c, m_mat.m22(), m_mat.dx(), m_mat.dy()); +} + +double SVGMatrixImpl::c() const +{ + return m_mat.m21(); +} + +void SVGMatrixImpl::setD(const double &d) +{ + m_mat.setMatrix(m_mat.m11(), m_mat.m12(), m_mat.m21(), d, m_mat.dx(), m_mat.dy()); +} + +double SVGMatrixImpl::d() const +{ + return m_mat.m22(); +} + +void SVGMatrixImpl::setE(const double &e) +{ + m_mat.setMatrix(m_mat.m11(), m_mat.m12(), m_mat.m21(), m_mat.m22(), e, m_mat.dy()); +} + +double SVGMatrixImpl::e() const +{ + return m_mat.dx(); +} + +void SVGMatrixImpl::setF(const double &f) +{ + m_mat.setMatrix(m_mat.m11(), m_mat.m12(), m_mat.m21(), m_mat.m22(), m_mat.dx(), f); +} + +double SVGMatrixImpl::f() const +{ + return m_mat.dy(); +} + +void SVGMatrixImpl::copy(const SVGMatrixImpl *other) +{ + m_mat.setMatrix(other->m_mat.m11(), other->m_mat.m12(), other->m_mat.m21(), other->m_mat.m22(), other->m_mat.dx(), other->m_mat.dy()); +} + +SVGMatrixImpl *SVGMatrixImpl::postMultiply(const SVGMatrixImpl *secondMatrix) +{ + TQWMatrix temp(secondMatrix->a(), secondMatrix->b(), secondMatrix->c(), secondMatrix->d(), secondMatrix->e(), secondMatrix->f()); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::inverse() +{ + m_mat = m_mat.invert(); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postTranslate(const double &x, const double &y) +{ + // Could optimise these. + TQWMatrix temp; + temp.translate(x, y); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postScale(const double &scaleFactor) +{ + TQWMatrix temp; + temp.scale(scaleFactor, scaleFactor); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postScaleNonUniform(const double &scaleFactorX, const double &scaleFactorY) +{ + TQWMatrix temp; + temp.scale(scaleFactorX, scaleFactorY); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postRotate(const double &angle) +{ + TQWMatrix temp; + temp.rotate(angle); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postRotateFromVector(const double &x, const double &y) +{ + TQWMatrix temp; + temp.rotate(SVGAngleImpl::todeg(atan2(y, x))); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postFlipX() +{ + TQWMatrix temp(-1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postFlipY() +{ + TQWMatrix temp(1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postSkewX(const double &angle) +{ + TQWMatrix temp; + temp.shear(tan(SVGAngleImpl::torad(angle)), 0.0F); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::postSkewY(const double &angle) +{ + TQWMatrix temp; + temp.shear(0.0F, tan(SVGAngleImpl::torad(angle))); + m_mat *= temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::multiply(const SVGMatrixImpl *secondMatrix) +{ + TQWMatrix temp(secondMatrix->a(), secondMatrix->b(), secondMatrix->c(), secondMatrix->d(), secondMatrix->e(), secondMatrix->f()); + temp *= m_mat; + m_mat = temp; + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::translate(const double &x, const double &y) +{ + m_mat.translate(x, y); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::scale(const double &scaleFactor) +{ + m_mat.scale(scaleFactor, scaleFactor); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::scaleNonUniform(const double &scaleFactorX, const double &scaleFactorY) +{ + m_mat.scale(scaleFactorX, scaleFactorY); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::rotate(const double &angle) +{ + m_mat.rotate(angle); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::rotateFromVector(const double &x, const double &y) +{ + m_mat.rotate(SVGAngleImpl::todeg(atan2(y, x))); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::flipX() +{ + m_mat.scale(-1.0f, 1.0f); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::flipY() +{ + m_mat.scale(1.0f, -1.0f); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::skewX(const double &angle) +{ + m_mat.shear(tan(SVGAngleImpl::torad(angle)), 0.0F); + return this; +} + +SVGMatrixImpl *SVGMatrixImpl::skewY(const double &angle) +{ + m_mat.shear(0.0F, tan(SVGAngleImpl::torad(angle))); + return this; +} + +void SVGMatrixImpl::setMatrix(TQWMatrix mat) +{ + m_mat = mat; +} + +TQWMatrix &SVGMatrixImpl::qmatrix() +{ + return m_mat; +} + +const TQWMatrix &SVGMatrixImpl::qmatrix() const +{ + return m_mat; +} + +void SVGMatrixImpl::reset() +{ + m_mat.reset(); +} + +void SVGMatrixImpl::removeScale(double *xScale, double *yScale) +{ + double sx = sqrt(a()*a() + b()*b()); + double sy = sqrt(c()*c() + d()*d()); + + // Remove the scaling from the matrix. + + setA(a()/sx); + setB(b()/sx); + setC(c()/sy); + setD(d()/sy); + + *xScale = sx; + *yScale = sy; +} + +KSVGPolygon SVGMatrixImpl::map(const KSVGPolygon& polygon) const +{ + KSVGPolygon mapped; + + for(unsigned int i = 0; i < polygon.numPoints(); i++) + { + double x, y; + + m_mat.map(polygon.point(i).x(), polygon.point(i).y(), &x, &y); + mapped.addPoint(x, y); + } + + return mapped; +} + +KSVGPolygon SVGMatrixImpl::inverseMap(const KSVGPolygon& polygon) const +{ + TQWMatrix inverse = m_mat.invert(); + KSVGPolygon mapped; + + for(unsigned int i = 0; i < polygon.numPoints(); i++) + { + double x, y; + + inverse.map(polygon.point(i).x(), polygon.point(i).y(), &x, &y); + mapped.addPoint(x, y); + } + + return mapped; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGMatrixImpl::s_hashTable 7 + a SVGMatrixImpl::A DontDelete + b SVGMatrixImpl::B DontDelete + c SVGMatrixImpl::C DontDelete + d SVGMatrixImpl::D DontDelete + e SVGMatrixImpl::E DontDelete + f SVGMatrixImpl::F DontDelete +@end +@namespace KSVG +@begin SVGMatrixImplProto::s_hashTable 13 + inverse SVGMatrixImpl::Inverse DontDelete|Function 0 + multiply SVGMatrixImpl::Multiply DontDelete|Function 1 + translate SVGMatrixImpl::Translate DontDelete|Function 2 + scale SVGMatrixImpl::Scale DontDelete|Function 1 + rotate SVGMatrixImpl::Rotate DontDelete|Function 1 + rotateFromVector SVGMatrixImpl::RotateFromVector DontDelete|Function 2 + scaleNonUniform SVGMatrixImpl::ScaleNonUniform DontDelete|Function 2 + flipX SVGMatrixImpl::FlipX DontDelete|Function 0 + flipY SVGMatrixImpl::FlipY DontDelete|Function 0 + skewX SVGMatrixImpl::SkewX DontDelete|Function 1 + skewY SVGMatrixImpl::SkewY DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGMatrix", SVGMatrixImplProto, SVGMatrixImplProtoFunc) + +Value SVGMatrixImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case A: + return Number(a()); + case B: + return Number(b()); + case C: + return Number(c()); + case D: + return Number(d()); + case E: + return Number(e()); + case F: + return Number(f()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return KJS::Undefined(); + } +} + + +void SVGMatrixImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case A: + setA(value.toNumber(exec)); + break; + case B: + setB(value.toNumber(exec)); + break; + case C: + setC(value.toNumber(exec)); + break; + case D: + setD(value.toNumber(exec)); + break; + case E: + setE(value.toNumber(exec)); + break; + case F: + setF(value.toNumber(exec)); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + break; + } +} + +Value SVGMatrixImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGMatrixImpl) + + switch(id) + { + case SVGMatrixImpl::Inverse: + return obj->inverse()->cache(exec); + break; + case SVGMatrixImpl::Multiply: + return obj->multiply(static_cast *>(args[0].imp())->impl())->cache(exec); + break; + case SVGMatrixImpl::Translate: + return obj->translate(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + break; + case SVGMatrixImpl::Scale: + return obj->scale(args[0].toNumber(exec))->cache(exec); + break; + case SVGMatrixImpl::Rotate: + return obj->rotate(args[0].toNumber(exec))->cache(exec); + break; + case SVGMatrixImpl::RotateFromVector: + return obj->rotateFromVector(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + break; + case SVGMatrixImpl::ScaleNonUniform: + return obj->scaleNonUniform(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + break; + case SVGMatrixImpl::FlipX: + return obj->flipX()->cache(exec); + break; + case SVGMatrixImpl::FlipY: + return obj->flipY()->cache(exec); + break; + case SVGMatrixImpl::SkewX: + return obj->skewX(args[0].toNumber(exec))->cache(exec); + break; + case SVGMatrixImpl::SkewY: + return obj->skewY(args[0].toNumber(exec))->cache(exec);; + break; + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} diff --git a/ksvg/impl/SVGMetadataElementImpl.cc b/ksvg/impl/SVGMetadataElementImpl.cc deleted file mode 100644 index 9fa245bf..00000000 --- a/ksvg/impl/SVGMetadataElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMetadataElementImpl.h" - -using namespace KSVG; - -SVGMetadataElementImpl::SVGMetadataElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGMetadataElementImpl::~SVGMetadataElementImpl() -{ -} diff --git a/ksvg/impl/SVGMetadataElementImpl.cpp b/ksvg/impl/SVGMetadataElementImpl.cpp new file mode 100644 index 00000000..9fa245bf --- /dev/null +++ b/ksvg/impl/SVGMetadataElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMetadataElementImpl.h" + +using namespace KSVG; + +SVGMetadataElementImpl::SVGMetadataElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGMetadataElementImpl::~SVGMetadataElementImpl() +{ +} diff --git a/ksvg/impl/SVGMissingGlyphElementImpl.cc b/ksvg/impl/SVGMissingGlyphElementImpl.cc deleted file mode 100644 index f522dff6..00000000 --- a/ksvg/impl/SVGMissingGlyphElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGMissingGlyphElementImpl.h" - -using namespace KSVG; - -SVGMissingGlyphElementImpl::SVGMissingGlyphElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this) -{ -} - -SVGMissingGlyphElementImpl::~SVGMissingGlyphElementImpl() -{ -} diff --git a/ksvg/impl/SVGMissingGlyphElementImpl.cpp b/ksvg/impl/SVGMissingGlyphElementImpl.cpp new file mode 100644 index 00000000..f522dff6 --- /dev/null +++ b/ksvg/impl/SVGMissingGlyphElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGMissingGlyphElementImpl.h" + +using namespace KSVG; + +SVGMissingGlyphElementImpl::SVGMissingGlyphElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this) +{ +} + +SVGMissingGlyphElementImpl::~SVGMissingGlyphElementImpl() +{ +} diff --git a/ksvg/impl/SVGNumberImpl.cc b/ksvg/impl/SVGNumberImpl.cc deleted file mode 100644 index b1ec38b6..00000000 --- a/ksvg/impl/SVGNumberImpl.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGNumberImpl.h" - -using namespace KSVG; - -#include "SVGNumberImpl.lut.h" -#include "ksvg_bridge.h" - -SVGNumberImpl::SVGNumberImpl() -{ - KSVG_EMPTY_FLAGS - - m_value = 0; -} - -SVGNumberImpl::~SVGNumberImpl() -{ -} - -void SVGNumberImpl::setValue(float value) -{ - m_value = value; -} - -float SVGNumberImpl::value() -{ - return m_value; -} - -/* -@namespace KSVG -@begin SVGNumberImpl::s_hashTable 2 - value SVGNumberImpl::Value DontDelete -@end -*/ - -Value SVGNumberImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Value: - return Number(m_value); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } - - return Undefined(); -} - -void SVGNumberImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case Value: - m_value = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGNumberImpl.cpp b/ksvg/impl/SVGNumberImpl.cpp new file mode 100644 index 00000000..b1ec38b6 --- /dev/null +++ b/ksvg/impl/SVGNumberImpl.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGNumberImpl.h" + +using namespace KSVG; + +#include "SVGNumberImpl.lut.h" +#include "ksvg_bridge.h" + +SVGNumberImpl::SVGNumberImpl() +{ + KSVG_EMPTY_FLAGS + + m_value = 0; +} + +SVGNumberImpl::~SVGNumberImpl() +{ +} + +void SVGNumberImpl::setValue(float value) +{ + m_value = value; +} + +float SVGNumberImpl::value() +{ + return m_value; +} + +/* +@namespace KSVG +@begin SVGNumberImpl::s_hashTable 2 + value SVGNumberImpl::Value DontDelete +@end +*/ + +Value SVGNumberImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Value: + return Number(m_value); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } + + return Undefined(); +} + +void SVGNumberImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case Value: + m_value = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGNumberListImpl.cc b/ksvg/impl/SVGNumberListImpl.cc deleted file mode 100644 index a528b474..00000000 --- a/ksvg/impl/SVGNumberListImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGNumberListImpl.h" - -using namespace KSVG; - -#include "SVGNumberListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGNumberListImpl::s_hashTable 2 - numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGNumberListImplProto::s_hashTable 11 - getItem SVGListDefs::GetItem DontDelete|Function 1 - removeItem SVGListDefs::RemoveItem DontDelete|Function 1 - appendItem SVGListDefs::AppendItem DontDelete|Function 1 - initialize SVGListDefs::Initialize DontDelete|Function 1 - insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 - replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 - clear SVGListDefs::Clear DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGNumberList", SVGNumberListImplProto, SVGNumberListImplProtoFunc) - -Value SVGNumberListImpl::getValueProperty(ExecState *exec, int token) const -{ - return SVGList::getValueProperty(exec, token); -} - -Value SVGNumberListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGNumberListImpl) - - return obj->call(exec, static_cast *>(obj), args, id); -} diff --git a/ksvg/impl/SVGNumberListImpl.cpp b/ksvg/impl/SVGNumberListImpl.cpp new file mode 100644 index 00000000..a528b474 --- /dev/null +++ b/ksvg/impl/SVGNumberListImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGNumberListImpl.h" + +using namespace KSVG; + +#include "SVGNumberListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGNumberListImpl::s_hashTable 2 + numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGNumberListImplProto::s_hashTable 11 + getItem SVGListDefs::GetItem DontDelete|Function 1 + removeItem SVGListDefs::RemoveItem DontDelete|Function 1 + appendItem SVGListDefs::AppendItem DontDelete|Function 1 + initialize SVGListDefs::Initialize DontDelete|Function 1 + insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 + replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 + clear SVGListDefs::Clear DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGNumberList", SVGNumberListImplProto, SVGNumberListImplProtoFunc) + +Value SVGNumberListImpl::getValueProperty(ExecState *exec, int token) const +{ + return SVGList::getValueProperty(exec, token); +} + +Value SVGNumberListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGNumberListImpl) + + return obj->call(exec, static_cast *>(obj), args, id); +} diff --git a/ksvg/impl/SVGPaintImpl.cc b/ksvg/impl/SVGPaintImpl.cc deleted file mode 100644 index 8e56baae..00000000 --- a/ksvg/impl/SVGPaintImpl.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPaint.h" -#include "SVGColor.h" - -#include "SVGPaintImpl.h" - -using namespace KSVG; - -#include "SVGPaintImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_cacheimpl.h" - -SVGPaintImpl::SVGPaintImpl(SVGElementImpl *object) : SVGColorImpl(object) -{ - m_paintType = SVG_PAINTTYPE_UNKNOWN; -} - -SVGPaintImpl::SVGPaintImpl(const SVGPaintImpl &other) : SVGColorImpl(other) -{ - (*this) = other; -} - -SVGPaintImpl::~SVGPaintImpl() -{ -} - -SVGPaintImpl &SVGPaintImpl::operator=(const SVGPaintImpl &other) -{ - m_uri = other.m_uri; - m_paintType = other.m_paintType; - - *(static_cast(this)) = other; - - return *this; -} - -unsigned short SVGPaintImpl::paintType() const -{ - return m_paintType; -} - -DOM::DOMString SVGPaintImpl::uri() const -{ - return m_uri; -} - -void SVGPaintImpl::setUri(const DOM::DOMString &uri) -{ - m_uri = uri; - m_paintType = SVG_PAINTTYPE_URI; -} - -void SVGPaintImpl::setPaint(unsigned short paintType, const DOM::DOMString &/*uri*/, const DOM::DOMString &/*rgbColor*/, const DOM::DOMString &/*iccColor*/) -{ - m_paintType = paintType; -} - -void SVGPaintImpl::setRGBColor(TQColor color) -{ - m_paintType = SVG_PAINTTYPE_RGBCOLOR; - SVGColorImpl::setRGBColor(color); -} - -void SVGPaintImpl::setRGBColor(int r, int g, int b) -{ - m_paintType = SVG_PAINTTYPE_RGBCOLOR; - SVGColorImpl::setRGBColor(r, g, b); -} - -void SVGPaintImpl::setRGBColor(const DOM::DOMString &rgbColor) -{ - m_paintType = SVG_PAINTTYPE_RGBCOLOR; - SVGColorImpl::setRGBColor(rgbColor); -} - -void SVGPaintImpl::setRGBColorICCColor(const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) -{ - m_paintType = SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR; - SVGColorImpl::setRGBColorICCColor(rgbColor, iccColor); -} - -void SVGPaintImpl::setColor(unsigned short colorType, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) -{ - SVGColorImpl::setColor(colorType, rgbColor, iccColor); - - switch(colorType) - { - case SVG_COLORTYPE_CURRENTCOLOR: - m_paintType = SVG_PAINTTYPE_CURRENTCOLOR; - break; - case SVG_COLORTYPE_RGBCOLOR: - m_paintType = SVG_PAINTTYPE_CURRENTCOLOR; - break; - case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: - m_paintType = SVG_PAINTTYPE_CURRENTCOLOR; - break; - case SVG_COLORTYPE_UNKNOWN: - m_paintType = SVG_PAINTTYPE_UNKNOWN; - break; - } -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPaintImpl::s_hashTable 3 - paintType SVGPaintImpl::PaintType DontDelete - uri SVGPaintImpl::URI DontDelete -@end -*/ - -Value SVGPaintImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case PaintType: - return Number(paintType()); - case URI: - return String(uri().string()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -/* -@namespace KSVG -@begin SVGPaintImplConstructor::s_hashTable 11 -SVG_PAINTTYPE_UNKNOWN KSVG::SVG_PAINTTYPE_UNKNOWN DontDelete|ReadOnly -SVG_PAINTTYPE_CURRENTCOLOR KSVG::SVG_PAINTTYPE_CURRENTCOLOR DontDelete|ReadOnly -SVG_PAINTTYPE_RGBCOLOR KSVG::SVG_PAINTTYPE_RGBCOLOR DontDelete|ReadOnly -SVG_PAINTTYPE_RGBCOLOR KSVG::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR DontDelete|ReadOnly -SVG_PAINTTYPE_NONE KSVG::SVG_PAINTTYPE_NONE DontDelete|ReadOnly -SVG_PAINTTYPE_URI_NONE KSVG::SVG_PAINTTYPE_URI_NONE DontDelete|ReadOnly -SVG_PAINTTYPE_URI_RGBCOLOR KSVG::SVG_PAINTTYPE_URI_RGBCOLOR DontDelete|ReadOnly -SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR KSVG::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR DontDelete|ReadOnly -SVG_PAINTTYPE_URI_CURRENTCOLOR KSVG::SVG_PAINTTYPE_URI_CURRENTCOLOR DontDelete|ReadOnly -SVG_PAINTTYPE_URI KSVG::SVG_PAINTTYPE_URI DontDelete|ReadOnly -@end -*/ - -Value SVGPaintImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGPaintImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgpaint.constructor]]"); -} diff --git a/ksvg/impl/SVGPaintImpl.cpp b/ksvg/impl/SVGPaintImpl.cpp new file mode 100644 index 00000000..8e56baae --- /dev/null +++ b/ksvg/impl/SVGPaintImpl.cpp @@ -0,0 +1,173 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPaint.h" +#include "SVGColor.h" + +#include "SVGPaintImpl.h" + +using namespace KSVG; + +#include "SVGPaintImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_cacheimpl.h" + +SVGPaintImpl::SVGPaintImpl(SVGElementImpl *object) : SVGColorImpl(object) +{ + m_paintType = SVG_PAINTTYPE_UNKNOWN; +} + +SVGPaintImpl::SVGPaintImpl(const SVGPaintImpl &other) : SVGColorImpl(other) +{ + (*this) = other; +} + +SVGPaintImpl::~SVGPaintImpl() +{ +} + +SVGPaintImpl &SVGPaintImpl::operator=(const SVGPaintImpl &other) +{ + m_uri = other.m_uri; + m_paintType = other.m_paintType; + + *(static_cast(this)) = other; + + return *this; +} + +unsigned short SVGPaintImpl::paintType() const +{ + return m_paintType; +} + +DOM::DOMString SVGPaintImpl::uri() const +{ + return m_uri; +} + +void SVGPaintImpl::setUri(const DOM::DOMString &uri) +{ + m_uri = uri; + m_paintType = SVG_PAINTTYPE_URI; +} + +void SVGPaintImpl::setPaint(unsigned short paintType, const DOM::DOMString &/*uri*/, const DOM::DOMString &/*rgbColor*/, const DOM::DOMString &/*iccColor*/) +{ + m_paintType = paintType; +} + +void SVGPaintImpl::setRGBColor(TQColor color) +{ + m_paintType = SVG_PAINTTYPE_RGBCOLOR; + SVGColorImpl::setRGBColor(color); +} + +void SVGPaintImpl::setRGBColor(int r, int g, int b) +{ + m_paintType = SVG_PAINTTYPE_RGBCOLOR; + SVGColorImpl::setRGBColor(r, g, b); +} + +void SVGPaintImpl::setRGBColor(const DOM::DOMString &rgbColor) +{ + m_paintType = SVG_PAINTTYPE_RGBCOLOR; + SVGColorImpl::setRGBColor(rgbColor); +} + +void SVGPaintImpl::setRGBColorICCColor(const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) +{ + m_paintType = SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR; + SVGColorImpl::setRGBColorICCColor(rgbColor, iccColor); +} + +void SVGPaintImpl::setColor(unsigned short colorType, const DOM::DOMString &rgbColor, const DOM::DOMString &iccColor) +{ + SVGColorImpl::setColor(colorType, rgbColor, iccColor); + + switch(colorType) + { + case SVG_COLORTYPE_CURRENTCOLOR: + m_paintType = SVG_PAINTTYPE_CURRENTCOLOR; + break; + case SVG_COLORTYPE_RGBCOLOR: + m_paintType = SVG_PAINTTYPE_CURRENTCOLOR; + break; + case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: + m_paintType = SVG_PAINTTYPE_CURRENTCOLOR; + break; + case SVG_COLORTYPE_UNKNOWN: + m_paintType = SVG_PAINTTYPE_UNKNOWN; + break; + } +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPaintImpl::s_hashTable 3 + paintType SVGPaintImpl::PaintType DontDelete + uri SVGPaintImpl::URI DontDelete +@end +*/ + +Value SVGPaintImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case PaintType: + return Number(paintType()); + case URI: + return String(uri().string()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +/* +@namespace KSVG +@begin SVGPaintImplConstructor::s_hashTable 11 +SVG_PAINTTYPE_UNKNOWN KSVG::SVG_PAINTTYPE_UNKNOWN DontDelete|ReadOnly +SVG_PAINTTYPE_CURRENTCOLOR KSVG::SVG_PAINTTYPE_CURRENTCOLOR DontDelete|ReadOnly +SVG_PAINTTYPE_RGBCOLOR KSVG::SVG_PAINTTYPE_RGBCOLOR DontDelete|ReadOnly +SVG_PAINTTYPE_RGBCOLOR KSVG::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR DontDelete|ReadOnly +SVG_PAINTTYPE_NONE KSVG::SVG_PAINTTYPE_NONE DontDelete|ReadOnly +SVG_PAINTTYPE_URI_NONE KSVG::SVG_PAINTTYPE_URI_NONE DontDelete|ReadOnly +SVG_PAINTTYPE_URI_RGBCOLOR KSVG::SVG_PAINTTYPE_URI_RGBCOLOR DontDelete|ReadOnly +SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR KSVG::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR DontDelete|ReadOnly +SVG_PAINTTYPE_URI_CURRENTCOLOR KSVG::SVG_PAINTTYPE_URI_CURRENTCOLOR DontDelete|ReadOnly +SVG_PAINTTYPE_URI KSVG::SVG_PAINTTYPE_URI DontDelete|ReadOnly +@end +*/ + +Value SVGPaintImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGPaintImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgpaint.constructor]]"); +} diff --git a/ksvg/impl/SVGPaintServerImpl.cc b/ksvg/impl/SVGPaintServerImpl.cc deleted file mode 100644 index 006ba853..00000000 --- a/ksvg/impl/SVGPaintServerImpl.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPaintServerImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" - -using namespace KSVG; - -SVGPaintServerImpl::SVGPaintServerImpl() -{ - m_paintServer = 0; -} - -SVGPaintServerImpl::~SVGPaintServerImpl() -{ -} - -CanvasPaintServer *SVGPaintServerImpl::paintServer(SVGDocumentImpl *doc, const TQString& id) -{ - CanvasPaintServer *pserver = 0; - SVGElementImpl *element = doc->rootElement()->getElementById(id); - - if(element) - { - SVGPaintServerImpl *paintServerElement = dynamic_cast(element); - - if(paintServerElement) - pserver = paintServerElement->paintServer(); - } - - return pserver; -} diff --git a/ksvg/impl/SVGPaintServerImpl.cpp b/ksvg/impl/SVGPaintServerImpl.cpp new file mode 100644 index 00000000..006ba853 --- /dev/null +++ b/ksvg/impl/SVGPaintServerImpl.cpp @@ -0,0 +1,52 @@ +/* + Copyright (C) 2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPaintServerImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" + +using namespace KSVG; + +SVGPaintServerImpl::SVGPaintServerImpl() +{ + m_paintServer = 0; +} + +SVGPaintServerImpl::~SVGPaintServerImpl() +{ +} + +CanvasPaintServer *SVGPaintServerImpl::paintServer(SVGDocumentImpl *doc, const TQString& id) +{ + CanvasPaintServer *pserver = 0; + SVGElementImpl *element = doc->rootElement()->getElementById(id); + + if(element) + { + SVGPaintServerImpl *paintServerElement = dynamic_cast(element); + + if(paintServerElement) + pserver = paintServerElement->paintServer(); + } + + return pserver; +} diff --git a/ksvg/impl/SVGPathElementImpl.cc b/ksvg/impl/SVGPathElementImpl.cc deleted file mode 100644 index d64aede3..00000000 --- a/ksvg/impl/SVGPathElementImpl.cc +++ /dev/null @@ -1,866 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include -#include - -#include "SVGRectImpl.h" -#include "SVGPaintImpl.h" -#include "SVGPointImpl.h" -#include "SVGAngleImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGPathSegArcImpl.h" -#include "SVGPathSegListImpl.h" -#include "SVGPathElementImpl.h" -#include "SVGPathSegLinetoImpl.h" -#include "SVGPathSegMovetoImpl.h" -#include "SVGAnimatedNumberImpl.h" -#include "SVGPathSegClosePathImpl.h" -#include "SVGPathSegCurvetoCubicImpl.h" -#include "SVGPathSegLinetoVerticalImpl.h" -#include "SVGPathSegLinetoHorizontalImpl.h" -#include "SVGPathSegCurvetoQuadraticImpl.h" -#include "SVGPathSegCurvetoCubicSmoothImpl.h" -#include "SVGPathSegCurvetoQuadraticSmoothImpl.h" - -#include "SVGPaint.h" - -#include "CanvasItem.h" -#include "KSVGCanvas.h" -#include "BezierPath.h" -#include "Point.h" - -using namespace KSVG; - -#include "SVGPathElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGPathElementImpl::SVGPathElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl(), SVGAnimatedPathDataImpl(), SVGPathParser() -{ - KSVG_EMPTY_FLAGS - - m_pathLength = new SVGAnimatedNumberImpl(); - m_pathLength->ref(); - - m_pathLength->setBaseVal(0); -} - -SVGPathElementImpl::~SVGPathElementImpl() -{ - pathSegList()->clear(); - - if(m_pathLength) - m_pathLength->deref(); -} - -SVGAnimatedNumberImpl *SVGPathElementImpl::pathLength() const -{ - return m_pathLength; -} - -double SVGPathElementImpl::getTotalLength() -{ - T2P::BezierPath *path = ownerDoc()->canvas()->toBezierPath(m_item); - if(path) - return path->length(); - - return 0; -} - -SVGPointImpl *SVGPathElementImpl::getPointAtLength(double distance) -{ - SVGPointImpl *ret = SVGSVGElementImpl::createSVGPoint(); - double totalDistance = getTotalLength(); - T2P::BezierPath *path = ownerDoc()->canvas()->toBezierPath(m_item); - if(path) - { - T2P::Point p; - path->pointTangentNormalAt(distance / totalDistance, &p); - ret->setX(p.x()); - ret->setY(p.y()); - } - - return ret; -} - -unsigned long SVGPathElementImpl::getPathSegAtLength(double) -{ - return 0; -} - -SVGPathSegClosePathImpl *SVGPathElementImpl::createSVGPathSegClosePath() -{ - SVGPathSegClosePathImpl *temp = new SVGPathSegClosePathImpl(); - temp->ref(); - - return temp; -} - -SVGPathSegMovetoAbsImpl *SVGPathElementImpl::createSVGPathSegMovetoAbs(double x, double y) -{ - SVGPathSegMovetoAbsImpl *temp = new SVGPathSegMovetoAbsImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - return temp; -} - -SVGPathSegMovetoRelImpl *SVGPathElementImpl::createSVGPathSegMovetoRel(double x, double y) -{ - SVGPathSegMovetoRelImpl *temp = new SVGPathSegMovetoRelImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - return temp; -} - -SVGPathSegLinetoAbsImpl *SVGPathElementImpl::createSVGPathSegLinetoAbs(double x, double y) -{ - SVGPathSegLinetoAbsImpl *temp = new SVGPathSegLinetoAbsImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - return temp; -} - -SVGPathSegLinetoRelImpl *SVGPathElementImpl::createSVGPathSegLinetoRel(double x, double y) -{ - SVGPathSegLinetoRelImpl *temp = new SVGPathSegLinetoRelImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - return temp; -} - -SVGPathSegCurvetoCubicAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicAbs(double x, double y, double x1, double y1, double x2, double y2) -{ - SVGPathSegCurvetoCubicAbsImpl *temp = new SVGPathSegCurvetoCubicAbsImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setX1(x1); - temp->setY1(y1); - temp->setX2(x2); - temp->setY2(y2); - return temp; -} - -SVGPathSegCurvetoCubicRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicRel(double x, double y, double x1, double y1, double x2, double y2) -{ - SVGPathSegCurvetoCubicRelImpl *temp = new SVGPathSegCurvetoCubicRelImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setX1(x1); - temp->setY1(y1); - temp->setX2(x2); - temp->setY2(y2); - return temp; -} - -SVGPathSegCurvetoQuadraticAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticAbs(double x, double y, double x1, double y1) -{ - SVGPathSegCurvetoQuadraticAbsImpl *temp = new SVGPathSegCurvetoQuadraticAbsImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setX1(x1); - temp->setY1(y1); - return temp; -} - -SVGPathSegCurvetoQuadraticRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticRel(double x, double y, double x1, double y1) -{ - SVGPathSegCurvetoQuadraticRelImpl *temp = new SVGPathSegCurvetoQuadraticRelImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setX1(x1); - temp->setY1(y1); - return temp; -} - -SVGPathSegArcAbsImpl *SVGPathElementImpl::createSVGPathSegArcAbs(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag) -{ - SVGPathSegArcAbsImpl *temp = new SVGPathSegArcAbsImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setR1(r1); - temp->setR2(r2); - temp->setAngle(angle); - temp->setLargeArcFlag(largeArcFlag); - temp->setSweepFlag(sweepFlag); - return temp; -} - -SVGPathSegArcRelImpl *SVGPathElementImpl::createSVGPathSegArcRel(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag) -{ - SVGPathSegArcRelImpl *temp = new SVGPathSegArcRelImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setR1(r1); - temp->setR2(r2); - temp->setAngle(angle); - temp->setLargeArcFlag(largeArcFlag); - temp->setSweepFlag(sweepFlag); - return temp; -} - -SVGPathSegLinetoHorizontalAbsImpl *SVGPathElementImpl::createSVGPathSegLinetoHorizontalAbs(double x) -{ - SVGPathSegLinetoHorizontalAbsImpl *temp = new SVGPathSegLinetoHorizontalAbsImpl(); - temp->ref(); - - temp->setX(x); - return temp; -} - -SVGPathSegLinetoHorizontalRelImpl *SVGPathElementImpl::createSVGPathSegLinetoHorizontalRel(double x) -{ - SVGPathSegLinetoHorizontalRelImpl *temp = new SVGPathSegLinetoHorizontalRelImpl(); - temp->ref(); - - temp->setX(x); - return temp; -} - -SVGPathSegLinetoVerticalAbsImpl *SVGPathElementImpl::createSVGPathSegLinetoVerticalAbs(double y) -{ - SVGPathSegLinetoVerticalAbsImpl *temp = new SVGPathSegLinetoVerticalAbsImpl(); - temp->ref(); - - temp->setY(y); - return temp; -} - -SVGPathSegLinetoVerticalRelImpl *SVGPathElementImpl::createSVGPathSegLinetoVerticalRel(double y) -{ - SVGPathSegLinetoVerticalRelImpl *temp = new SVGPathSegLinetoVerticalRelImpl(); - temp->ref(); - - temp->setY(y); - return temp; -} - -SVGPathSegCurvetoCubicSmoothAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicSmoothAbs(double x, double y, double x2, double y2) -{ - SVGPathSegCurvetoCubicSmoothAbsImpl *temp = new SVGPathSegCurvetoCubicSmoothAbsImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setX2(x2); - temp->setY2(y2); - return temp; -} - -SVGPathSegCurvetoCubicSmoothRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicSmoothRel(double x, double y, double x2, double y2) -{ - SVGPathSegCurvetoCubicSmoothRelImpl *temp = new SVGPathSegCurvetoCubicSmoothRelImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - temp->setX2(x2); - temp->setY2(y2); - return temp; -} - -SVGPathSegCurvetoQuadraticSmoothAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticSmoothAbs(double x, double y) -{ - SVGPathSegCurvetoQuadraticSmoothAbsImpl *temp = new SVGPathSegCurvetoQuadraticSmoothAbsImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - return temp; -} - -SVGPathSegCurvetoQuadraticSmoothRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticSmoothRel(double x, double y) -{ - SVGPathSegCurvetoQuadraticSmoothRelImpl *temp = new SVGPathSegCurvetoQuadraticSmoothRelImpl(); - temp->ref(); - - temp->setX(x); - temp->setY(y); - return temp; -} - -void SVGPathElementImpl::svgMoveTo(double x1, double y1, bool, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegMovetoAbs(x1, y1)); - else - pathSegList()->appendItem(createSVGPathSegMovetoRel(x1, y1)); -} - -void SVGPathElementImpl::svgLineTo(double x1, double y1, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegLinetoAbs(x1, y1)); - else - pathSegList()->appendItem(createSVGPathSegLinetoRel(x1, y1)); -} - -void SVGPathElementImpl::svgLineToHorizontal(double x, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegLinetoHorizontalAbs(x)); - else - pathSegList()->appendItem(createSVGPathSegLinetoHorizontalRel(x)); -} - -void SVGPathElementImpl::svgLineToVertical(double y, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegLinetoVerticalAbs(y)); - else - pathSegList()->appendItem(createSVGPathSegLinetoVerticalRel(y)); -} - -void SVGPathElementImpl::svgCurveToCubic(double x1, double y1, double x2, double y2, double x, double y, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2)); - else - pathSegList()->appendItem(createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2)); -} - -void SVGPathElementImpl::svgCurveToCubicSmooth(double x, double y, double x2, double y2, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegCurvetoCubicSmoothAbs(x2, y2, x, y)); - else - pathSegList()->appendItem(createSVGPathSegCurvetoCubicSmoothRel(x2, y2, x, y)); -} - -void SVGPathElementImpl::svgCurveToQuadratic(double x, double y, double x1, double y1, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticAbs(x1, y1, x, y)); - else - pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticRel(x1, y1, x, y)); -} - -void SVGPathElementImpl::svgCurveToQuadraticSmooth(double x, double y, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticSmoothAbs(x, y)); - else - pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticSmoothRel(x, y)); -} - -void SVGPathElementImpl::svgArcTo(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, bool abs) -{ - if(abs) - pathSegList()->appendItem(createSVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); - else - pathSegList()->appendItem(createSVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); -} - -void SVGPathElementImpl::svgClosePath() -{ - pathSegList()->appendItem(createSVGPathSegClosePath()); -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathElementImpl::s_hashTable 3 - d SVGPathElementImpl::D DontDelete|ReadOnly - pathLength SVGPathElementImpl::PathLength DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGPathElementImplProto::s_hashTable 23 - getTotalLength SVGPathElementImpl::GetTotalLength DontDelete|Function 0 - getPointAtLength SVGPathElementImpl::GetPointAtLength DontDelete|Function 1 - getPathSegAtLength SVGPathElementImpl::GetPathSegAtLength DontDelete|Function 1 - createSVGPathSegClosePath SVGPathElementImpl::CreateSVGPathSegClosePath DontDelete|Function 0 - createSVGPathSegMovetoAbs SVGPathElementImpl::CreateSVGPathSegMovetoAbs DontDelete|Function 2 - createSVGPathSegMovetoRel SVGPathElementImpl::CreateSVGPathSegMovetoRel DontDelete|Function 2 - createSVGPathSegLinetoAbs SVGPathElementImpl::CreateSVGPathSegLinetoAbs DontDelete|Function 2 - createSVGPathSegLinetoRel SVGPathElementImpl::CreateSVGPathSegLinetoRel DontDelete|Function 2 - createSVGPathSegArcAbs SVGPathElementImpl::CreateSVGPathSegArcAbs DontDelete|Function 7 - createSVGPathSegArcRel SVGPathElementImpl::CreateSVGPathSegArcRel DontDelete|Function 7 - createSVGPathSegCurvetoCubicAbs SVGPathElementImpl::CreateSVGPathSegCurvetoCubicAbs DontDelete|Function 6 - createSVGPathSegCurvetoCubicRel SVGPathElementImpl::CreateSVGPathSegCurvetoCubicRel DontDelete|Function 6 - createSVGPathSegCurvetoQuadraticAbs SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticAbs DontDelete|Function 4 - createSVGPathSegCurvetoQuadraticRel SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticRel DontDelete|Function 4 - createSVGPathSegLinetoHorizontalAbs SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalAbs DontDelete|Function 1 - createSVGPathSegLinetoHorizontalRel SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalRel DontDelete|Function 1 - createSVGPathSegLinetoVerticalAbs SVGPathElementImpl::CreateSVGPathSegLinetoVerticalAbs DontDelete|Function 1 - createSVGPathSegLinetoVerticalRel SVGPathElementImpl::CreateSVGPathSegLinetoVerticalRel DontDelete|Function 1 - createSVGPathSegCurvetoCubicAbs SVGPathElementImpl::CreateSVGPathSegCurvetoCubicAbs DontDelete|Function 4 - createSVGPathSegCurvetoCubicRel SVGPathElementImpl::CreateSVGPathSegCurvetoCubicRel DontDelete|Function 4 - createSVGPathSegCurvetoQuadraticAbs SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticAbs DontDelete|Function 2 - createSVGPathSegCurvetoQuadraticRel SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticRel DontDelete|Function 2 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGPathElementImpl", SVGPathElementImplProto, SVGPathElementImplProtoFunc) - -Value SVGPathElementImpl::getValueProperty(ExecState *exec, int token) const -{ - //KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case PathLength: - return m_pathLength->cache(exec); - case D: -// if(!attributeMode) - { - TQString d; - unsigned int nrSegs = pathSegList()->numberOfItems(); - SVGPathSegImpl *curseg = 0; - for(unsigned int i = 0; i < nrSegs; i++) - { - curseg = pathSegList()->getItem(i); - if(curseg) - d += curseg->toString() + " "; - } - return String(d); - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case D: - { - pathSegList()->clear(); - TQString d = value.toString(exec).qstring(); - parseSVG(d, false); - if(hasMarkers()) - m_markerData = MarkerData(pathSegList()); - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGPathElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGPathElementImpl) - - switch(id) - { - case SVGPathElementImpl::GetTotalLength: - return Number(obj->getTotalLength()); - case SVGPathElementImpl::GetPointAtLength: - return obj->getPointAtLength(args[0].toNumber(exec))->cache(exec); - case SVGPathElementImpl::GetPathSegAtLength: - return Number(obj->getPathSegAtLength(args[0].toNumber(exec))); - case SVGPathElementImpl::CreateSVGPathSegClosePath: - return obj->createSVGPathSegClosePath()->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegMovetoAbs: - return obj->createSVGPathSegMovetoAbs(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegMovetoRel: - return obj->createSVGPathSegMovetoRel(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegLinetoAbs: - return obj->createSVGPathSegLinetoAbs(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegLinetoRel: - return obj->createSVGPathSegLinetoRel(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicAbs: - return obj->createSVGPathSegCurvetoCubicAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicRel: - return obj->createSVGPathSegCurvetoCubicRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticAbs: - return obj->createSVGPathSegCurvetoQuadraticAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticRel: - return obj->createSVGPathSegCurvetoQuadraticRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegArcAbs: - return obj->createSVGPathSegArcAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toBoolean(exec), args[6].toBoolean(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegArcRel: - return obj->createSVGPathSegArcRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toBoolean(exec), args[6].toBoolean(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalAbs: - return obj->createSVGPathSegLinetoHorizontalAbs(args[0].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalRel: - return obj->createSVGPathSegLinetoHorizontalRel(args[0].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegLinetoVerticalAbs: - return obj->createSVGPathSegLinetoVerticalAbs(args[0].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegLinetoVerticalRel: - return obj->createSVGPathSegLinetoVerticalRel(args[0].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicSmoothAbs: - return obj->createSVGPathSegCurvetoCubicSmoothAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicSmoothRel: - return obj->createSVGPathSegCurvetoCubicSmoothRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticSmoothAbs: - return obj->createSVGPathSegCurvetoQuadraticSmoothAbs(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticSmoothRel: - return obj->createSVGPathSegCurvetoQuadraticSmoothRel(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -SVGRectImpl *SVGPathElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - - if(m_item) - { - T2P::BezierPath *path = ownerDoc()->canvas()->toBezierPath(m_item); - if(path) - { - T2P::Point topLeft; - T2P::Point bottomRight; - - path->boundingBox(&topLeft, &bottomRight); - - ret->setX(topLeft.x()); - ret->setY(topLeft.y()); - ret->setWidth(bottomRight.x() - topLeft.x()); - ret->setHeight(bottomRight.y() - topLeft.y()); - } - } - return ret; -} - -void SVGPathElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - // TODO : this is a quick fix for this problem: - // d attribute encountered before marker attributes. - // Try to process the attributes in the right order, ie. - // d attr processing should be last. - if(hasMarkers() && m_markerData.numMarkers() == 0) - m_markerData = MarkerData(pathSegList()); - m_item = c->createPath(this); - c->insert(m_item); - } -} - -SVGPathElementImpl::MarkerData::MarkerData(SVGPathSegListImpl *path) -{ - unsigned int numSegments = path->numberOfItems(); - double curx = 0; - double cury = 0; - int currentSubpathStartIndex = -1; - double previousQuadraticX1 = 0; - double previousQuadraticY1 = 0; - double previousCubicX2 = 0; - double previousCubicY2 = 0; - - TQValueVector pathSegmentData(numSegments); - - for(unsigned int i = 0; i < numSegments; i++) - { - SVGPathSegImpl *segment = path->getItem(i); - struct SegmentData data; - - data.type = segment->pathSegType(); - - if(segment->pathSegType() == PATHSEG_MOVETO_ABS || segment->pathSegType() == PATHSEG_MOVETO_REL) - { - if(currentSubpathStartIndex >= 0) - { - // Finish the previous subpath. - for(unsigned int j = currentSubpathStartIndex; j < i; j++) - { - pathSegmentData[j].subpathStartIndex = currentSubpathStartIndex; - pathSegmentData[j].subpathEndIndex = i - 1; - pathSegmentData[j].subpathIsClosed = false; - } - } - - currentSubpathStartIndex = i; - } - else if(segment->pathSegType() == PATHSEG_CLOSEPATH) - { - if(currentSubpathStartIndex >= 0) - { - SVGPathSegClosePathImpl *s = static_cast(segment); - - s->setX(pathSegmentData[currentSubpathStartIndex].startx + pathSegmentData[currentSubpathStartIndex].dx); - s->setY(pathSegmentData[currentSubpathStartIndex].starty + pathSegmentData[currentSubpathStartIndex].dy); - - for(unsigned int j = currentSubpathStartIndex; j < i; j++) - { - pathSegmentData[j].subpathStartIndex = currentSubpathStartIndex; - pathSegmentData[j].subpathEndIndex = i; - pathSegmentData[j].subpathIsClosed = true; - } - - data.subpathStartIndex = currentSubpathStartIndex; - data.subpathEndIndex = i; - data.subpathIsClosed = true; - } - - currentSubpathStartIndex = i + 1; - } - - switch(segment->pathSegType()) - { - case PATHSEG_CURVETO_CUBIC_ABS: - { - SVGPathSegCurvetoCubicAbsImpl *s = static_cast(segment); - previousCubicX2 = s->x2(); - previousCubicY2 = s->y2(); - break; - } - case PATHSEG_CURVETO_CUBIC_REL: - { - SVGPathSegCurvetoCubicRelImpl *s = static_cast(segment); - previousCubicX2 = curx + s->x2(); - previousCubicY2 = cury + s->y2(); - break; - } - case PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: - { - SVGPathSegCurvetoCubicSmoothAbsImpl *s = static_cast(segment); - s->setPreviousX2(previousCubicX2); - s->setPreviousY2(previousCubicY2); - previousCubicX2 = s->x2(); - previousCubicY2 = s->y2(); - break; - } - case PATHSEG_CURVETO_CUBIC_SMOOTH_REL: - { - SVGPathSegCurvetoCubicSmoothRelImpl *s = static_cast(segment); - s->setPreviousAbsX2(previousCubicX2); - s->setPreviousAbsY2(previousCubicY2); - previousCubicX2 = curx + s->x2(); - previousCubicY2 = cury + s->y2(); - break; - } - case PATHSEG_CURVETO_QUADRATIC_ABS: - { - SVGPathSegCurvetoQuadraticAbsImpl *s = static_cast(segment); - previousQuadraticX1 = s->x1(); - previousQuadraticY1 = s->y1(); - break; - } - case PATHSEG_CURVETO_QUADRATIC_REL: - { - SVGPathSegCurvetoQuadraticRelImpl *s = static_cast(segment); - previousQuadraticX1 = curx + s->x1(); - previousQuadraticY1 = cury + s->y1(); - break; - } - case PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: - { - SVGPathSegCurvetoQuadraticSmoothAbsImpl *s = static_cast(segment); - s->setPreviousX1(previousQuadraticX1); - s->setPreviousY1(previousQuadraticY1); - previousQuadraticX1 = s->x1(curx); - previousQuadraticY1 = s->y1(cury); - break; - } - case PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: - { - SVGPathSegCurvetoQuadraticSmoothRelImpl *s = static_cast(segment); - s->setPreviousAbsX1(previousQuadraticX1); - s->setPreviousAbsY1(previousQuadraticY1); - previousQuadraticX1 = s->absX1(curx); - previousQuadraticY1 = s->absY1(cury); - break; - } - default: - previousCubicX2 = curx; - previousCubicY2 = cury; - previousQuadraticX1 = curx; - previousQuadraticY1 = cury; - break; - } - - data.startx = curx; - data.starty = cury; - - segment->getDeltasAndSlopes(curx, cury, &data.dx, &data.dy, &data.startSlope, &data.endSlope); - - pathSegmentData[i] = data; - - curx += data.dx; - cury += data.dy; - } - - if(currentSubpathStartIndex >= 0) - { - // Finish the previous subpath. - for(unsigned int j = currentSubpathStartIndex; j < numSegments; j++) - { - pathSegmentData[j].subpathStartIndex = currentSubpathStartIndex; - pathSegmentData[j].subpathEndIndex = numSegments - 1; - pathSegmentData[j].subpathIsClosed = false; - } - } - - m_markers.resize(numSegments); - - for(unsigned int i = 0; i < numSegments; i++) - { - struct Marker marker; - - marker.x = pathSegmentData[i].startx + pathSegmentData[i].dx; - marker.y = pathSegmentData[i].starty + pathSegmentData[i].dy; - - double inSlope; - double outSlope; - bool haveInSlope = false; - bool haveOutSlope = false; - - if(pathSegmentData[i].subpathStartIndex == i && pathSegmentData[i].subpathIsClosed) - { - // Spec: For closed subpaths, the marker for the initial vertex uses the end direction - // of the corresponding closepath for its incoming slope and the first segment's - // start slope for its outgoing slope. - haveInSlope = getEndSlope(pathSegmentData, pathSegmentData[i].subpathEndIndex, &inSlope); - haveOutSlope = getStartSlope(pathSegmentData, i + 1, &outSlope); - } - else if(pathSegmentData[i].type == PATHSEG_CLOSEPATH) - { - haveInSlope = getEndSlope(pathSegmentData, i, &inSlope); - - // Spec: If the segment following a closepath is other than a moveto, the marker - // for the closepath uses the following segment's start direction as its - // outgoing direction. - if(i + 1 < numSegments && (pathSegmentData[i + 1].type != PATHSEG_MOVETO_ABS && pathSegmentData[i + 1].type != PATHSEG_MOVETO_REL)) - haveOutSlope = getStartSlope(pathSegmentData, i + 1, &outSlope); - else - haveOutSlope = getStartSlope(pathSegmentData, pathSegmentData[i].subpathStartIndex, &outSlope); - } - else - { - haveOutSlope = getStartSlope(pathSegmentData, i + 1, &outSlope); - haveInSlope = getEndSlope(pathSegmentData, i, &inSlope); - } - - if(!haveInSlope && !haveOutSlope) - { - outSlope = 0; - inSlope = 0; - } - else if(haveInSlope && !haveOutSlope) - outSlope = inSlope; - else if(!haveInSlope && haveOutSlope) - inSlope = outSlope; - - double bisector = SVGAngleImpl::shortestArcBisector(inSlope, outSlope); - marker.angle = bisector; - - m_markers[i] = marker; - } -} - -bool SVGPathElementImpl::MarkerData::getStartSlope(TQValueVector segments, unsigned int i, double *pStartSlope) -{ - if(i > segments.count() - 1 || segments[i].type == PATHSEG_MOVETO_ABS || segments[i].type == PATHSEG_MOVETO_REL) - return false; - else - { - const double epsilon = DBL_EPSILON; - - if(fabs(segments[i].dx) > epsilon || fabs(segments[i].dy) > epsilon) - { - *pStartSlope = segments[i].startSlope; - return true; - } - else - { - int subpathStartIndex = segments[i].subpathStartIndex; - - for(int j = i - 1; j >= subpathStartIndex; j--) - { - if(segments[j].type == PATHSEG_MOVETO_ABS || segments[j].type == PATHSEG_MOVETO_REL) - return false; - - if(fabs(segments[j].dx) > epsilon || fabs(segments[j].dy) > epsilon) - { - *pStartSlope = segments[j].endSlope; - return true; - } - } - - return false; - } - } -} - -bool SVGPathElementImpl::MarkerData::getEndSlope(TQValueVector segments, unsigned int i, double *pEndSlope) -{ - if(i > segments.count() - 1 || segments[i].type == PATHSEG_MOVETO_ABS || segments[i].type == PATHSEG_MOVETO_REL) - return false; - else - { - const double epsilon = DBL_EPSILON; - - if(fabs(segments[i].dx) > epsilon || fabs(segments[i].dy) > epsilon) - { - *pEndSlope = segments[i].endSlope; - return true; - } - else - { - int subpathEndIndex = segments[i].subpathEndIndex; - - for(int j = i + 1; j <= subpathEndIndex; j++) - { - if(segments[j].type == PATHSEG_MOVETO_ABS || segments[j].type == PATHSEG_MOVETO_REL) - return false; - - if(fabs(segments[j].dx) > epsilon || fabs(segments[j].dy) > epsilon) - { - *pEndSlope = segments[j].startSlope; - return true; - } - } - - return false; - } - } -} diff --git a/ksvg/impl/SVGPathElementImpl.cpp b/ksvg/impl/SVGPathElementImpl.cpp new file mode 100644 index 00000000..d64aede3 --- /dev/null +++ b/ksvg/impl/SVGPathElementImpl.cpp @@ -0,0 +1,866 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include +#include + +#include "SVGRectImpl.h" +#include "SVGPaintImpl.h" +#include "SVGPointImpl.h" +#include "SVGAngleImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGPathSegArcImpl.h" +#include "SVGPathSegListImpl.h" +#include "SVGPathElementImpl.h" +#include "SVGPathSegLinetoImpl.h" +#include "SVGPathSegMovetoImpl.h" +#include "SVGAnimatedNumberImpl.h" +#include "SVGPathSegClosePathImpl.h" +#include "SVGPathSegCurvetoCubicImpl.h" +#include "SVGPathSegLinetoVerticalImpl.h" +#include "SVGPathSegLinetoHorizontalImpl.h" +#include "SVGPathSegCurvetoQuadraticImpl.h" +#include "SVGPathSegCurvetoCubicSmoothImpl.h" +#include "SVGPathSegCurvetoQuadraticSmoothImpl.h" + +#include "SVGPaint.h" + +#include "CanvasItem.h" +#include "KSVGCanvas.h" +#include "BezierPath.h" +#include "Point.h" + +using namespace KSVG; + +#include "SVGPathElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGPathElementImpl::SVGPathElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl(), SVGAnimatedPathDataImpl(), SVGPathParser() +{ + KSVG_EMPTY_FLAGS + + m_pathLength = new SVGAnimatedNumberImpl(); + m_pathLength->ref(); + + m_pathLength->setBaseVal(0); +} + +SVGPathElementImpl::~SVGPathElementImpl() +{ + pathSegList()->clear(); + + if(m_pathLength) + m_pathLength->deref(); +} + +SVGAnimatedNumberImpl *SVGPathElementImpl::pathLength() const +{ + return m_pathLength; +} + +double SVGPathElementImpl::getTotalLength() +{ + T2P::BezierPath *path = ownerDoc()->canvas()->toBezierPath(m_item); + if(path) + return path->length(); + + return 0; +} + +SVGPointImpl *SVGPathElementImpl::getPointAtLength(double distance) +{ + SVGPointImpl *ret = SVGSVGElementImpl::createSVGPoint(); + double totalDistance = getTotalLength(); + T2P::BezierPath *path = ownerDoc()->canvas()->toBezierPath(m_item); + if(path) + { + T2P::Point p; + path->pointTangentNormalAt(distance / totalDistance, &p); + ret->setX(p.x()); + ret->setY(p.y()); + } + + return ret; +} + +unsigned long SVGPathElementImpl::getPathSegAtLength(double) +{ + return 0; +} + +SVGPathSegClosePathImpl *SVGPathElementImpl::createSVGPathSegClosePath() +{ + SVGPathSegClosePathImpl *temp = new SVGPathSegClosePathImpl(); + temp->ref(); + + return temp; +} + +SVGPathSegMovetoAbsImpl *SVGPathElementImpl::createSVGPathSegMovetoAbs(double x, double y) +{ + SVGPathSegMovetoAbsImpl *temp = new SVGPathSegMovetoAbsImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + return temp; +} + +SVGPathSegMovetoRelImpl *SVGPathElementImpl::createSVGPathSegMovetoRel(double x, double y) +{ + SVGPathSegMovetoRelImpl *temp = new SVGPathSegMovetoRelImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + return temp; +} + +SVGPathSegLinetoAbsImpl *SVGPathElementImpl::createSVGPathSegLinetoAbs(double x, double y) +{ + SVGPathSegLinetoAbsImpl *temp = new SVGPathSegLinetoAbsImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + return temp; +} + +SVGPathSegLinetoRelImpl *SVGPathElementImpl::createSVGPathSegLinetoRel(double x, double y) +{ + SVGPathSegLinetoRelImpl *temp = new SVGPathSegLinetoRelImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + return temp; +} + +SVGPathSegCurvetoCubicAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicAbs(double x, double y, double x1, double y1, double x2, double y2) +{ + SVGPathSegCurvetoCubicAbsImpl *temp = new SVGPathSegCurvetoCubicAbsImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setX1(x1); + temp->setY1(y1); + temp->setX2(x2); + temp->setY2(y2); + return temp; +} + +SVGPathSegCurvetoCubicRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicRel(double x, double y, double x1, double y1, double x2, double y2) +{ + SVGPathSegCurvetoCubicRelImpl *temp = new SVGPathSegCurvetoCubicRelImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setX1(x1); + temp->setY1(y1); + temp->setX2(x2); + temp->setY2(y2); + return temp; +} + +SVGPathSegCurvetoQuadraticAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticAbs(double x, double y, double x1, double y1) +{ + SVGPathSegCurvetoQuadraticAbsImpl *temp = new SVGPathSegCurvetoQuadraticAbsImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setX1(x1); + temp->setY1(y1); + return temp; +} + +SVGPathSegCurvetoQuadraticRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticRel(double x, double y, double x1, double y1) +{ + SVGPathSegCurvetoQuadraticRelImpl *temp = new SVGPathSegCurvetoQuadraticRelImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setX1(x1); + temp->setY1(y1); + return temp; +} + +SVGPathSegArcAbsImpl *SVGPathElementImpl::createSVGPathSegArcAbs(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag) +{ + SVGPathSegArcAbsImpl *temp = new SVGPathSegArcAbsImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setR1(r1); + temp->setR2(r2); + temp->setAngle(angle); + temp->setLargeArcFlag(largeArcFlag); + temp->setSweepFlag(sweepFlag); + return temp; +} + +SVGPathSegArcRelImpl *SVGPathElementImpl::createSVGPathSegArcRel(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag) +{ + SVGPathSegArcRelImpl *temp = new SVGPathSegArcRelImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setR1(r1); + temp->setR2(r2); + temp->setAngle(angle); + temp->setLargeArcFlag(largeArcFlag); + temp->setSweepFlag(sweepFlag); + return temp; +} + +SVGPathSegLinetoHorizontalAbsImpl *SVGPathElementImpl::createSVGPathSegLinetoHorizontalAbs(double x) +{ + SVGPathSegLinetoHorizontalAbsImpl *temp = new SVGPathSegLinetoHorizontalAbsImpl(); + temp->ref(); + + temp->setX(x); + return temp; +} + +SVGPathSegLinetoHorizontalRelImpl *SVGPathElementImpl::createSVGPathSegLinetoHorizontalRel(double x) +{ + SVGPathSegLinetoHorizontalRelImpl *temp = new SVGPathSegLinetoHorizontalRelImpl(); + temp->ref(); + + temp->setX(x); + return temp; +} + +SVGPathSegLinetoVerticalAbsImpl *SVGPathElementImpl::createSVGPathSegLinetoVerticalAbs(double y) +{ + SVGPathSegLinetoVerticalAbsImpl *temp = new SVGPathSegLinetoVerticalAbsImpl(); + temp->ref(); + + temp->setY(y); + return temp; +} + +SVGPathSegLinetoVerticalRelImpl *SVGPathElementImpl::createSVGPathSegLinetoVerticalRel(double y) +{ + SVGPathSegLinetoVerticalRelImpl *temp = new SVGPathSegLinetoVerticalRelImpl(); + temp->ref(); + + temp->setY(y); + return temp; +} + +SVGPathSegCurvetoCubicSmoothAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicSmoothAbs(double x, double y, double x2, double y2) +{ + SVGPathSegCurvetoCubicSmoothAbsImpl *temp = new SVGPathSegCurvetoCubicSmoothAbsImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setX2(x2); + temp->setY2(y2); + return temp; +} + +SVGPathSegCurvetoCubicSmoothRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoCubicSmoothRel(double x, double y, double x2, double y2) +{ + SVGPathSegCurvetoCubicSmoothRelImpl *temp = new SVGPathSegCurvetoCubicSmoothRelImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + temp->setX2(x2); + temp->setY2(y2); + return temp; +} + +SVGPathSegCurvetoQuadraticSmoothAbsImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticSmoothAbs(double x, double y) +{ + SVGPathSegCurvetoQuadraticSmoothAbsImpl *temp = new SVGPathSegCurvetoQuadraticSmoothAbsImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + return temp; +} + +SVGPathSegCurvetoQuadraticSmoothRelImpl *SVGPathElementImpl::createSVGPathSegCurvetoQuadraticSmoothRel(double x, double y) +{ + SVGPathSegCurvetoQuadraticSmoothRelImpl *temp = new SVGPathSegCurvetoQuadraticSmoothRelImpl(); + temp->ref(); + + temp->setX(x); + temp->setY(y); + return temp; +} + +void SVGPathElementImpl::svgMoveTo(double x1, double y1, bool, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegMovetoAbs(x1, y1)); + else + pathSegList()->appendItem(createSVGPathSegMovetoRel(x1, y1)); +} + +void SVGPathElementImpl::svgLineTo(double x1, double y1, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegLinetoAbs(x1, y1)); + else + pathSegList()->appendItem(createSVGPathSegLinetoRel(x1, y1)); +} + +void SVGPathElementImpl::svgLineToHorizontal(double x, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegLinetoHorizontalAbs(x)); + else + pathSegList()->appendItem(createSVGPathSegLinetoHorizontalRel(x)); +} + +void SVGPathElementImpl::svgLineToVertical(double y, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegLinetoVerticalAbs(y)); + else + pathSegList()->appendItem(createSVGPathSegLinetoVerticalRel(y)); +} + +void SVGPathElementImpl::svgCurveToCubic(double x1, double y1, double x2, double y2, double x, double y, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2)); + else + pathSegList()->appendItem(createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2)); +} + +void SVGPathElementImpl::svgCurveToCubicSmooth(double x, double y, double x2, double y2, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegCurvetoCubicSmoothAbs(x2, y2, x, y)); + else + pathSegList()->appendItem(createSVGPathSegCurvetoCubicSmoothRel(x2, y2, x, y)); +} + +void SVGPathElementImpl::svgCurveToQuadratic(double x, double y, double x1, double y1, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticAbs(x1, y1, x, y)); + else + pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticRel(x1, y1, x, y)); +} + +void SVGPathElementImpl::svgCurveToQuadraticSmooth(double x, double y, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticSmoothAbs(x, y)); + else + pathSegList()->appendItem(createSVGPathSegCurvetoQuadraticSmoothRel(x, y)); +} + +void SVGPathElementImpl::svgArcTo(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, bool abs) +{ + if(abs) + pathSegList()->appendItem(createSVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); + else + pathSegList()->appendItem(createSVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag)); +} + +void SVGPathElementImpl::svgClosePath() +{ + pathSegList()->appendItem(createSVGPathSegClosePath()); +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathElementImpl::s_hashTable 3 + d SVGPathElementImpl::D DontDelete|ReadOnly + pathLength SVGPathElementImpl::PathLength DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGPathElementImplProto::s_hashTable 23 + getTotalLength SVGPathElementImpl::GetTotalLength DontDelete|Function 0 + getPointAtLength SVGPathElementImpl::GetPointAtLength DontDelete|Function 1 + getPathSegAtLength SVGPathElementImpl::GetPathSegAtLength DontDelete|Function 1 + createSVGPathSegClosePath SVGPathElementImpl::CreateSVGPathSegClosePath DontDelete|Function 0 + createSVGPathSegMovetoAbs SVGPathElementImpl::CreateSVGPathSegMovetoAbs DontDelete|Function 2 + createSVGPathSegMovetoRel SVGPathElementImpl::CreateSVGPathSegMovetoRel DontDelete|Function 2 + createSVGPathSegLinetoAbs SVGPathElementImpl::CreateSVGPathSegLinetoAbs DontDelete|Function 2 + createSVGPathSegLinetoRel SVGPathElementImpl::CreateSVGPathSegLinetoRel DontDelete|Function 2 + createSVGPathSegArcAbs SVGPathElementImpl::CreateSVGPathSegArcAbs DontDelete|Function 7 + createSVGPathSegArcRel SVGPathElementImpl::CreateSVGPathSegArcRel DontDelete|Function 7 + createSVGPathSegCurvetoCubicAbs SVGPathElementImpl::CreateSVGPathSegCurvetoCubicAbs DontDelete|Function 6 + createSVGPathSegCurvetoCubicRel SVGPathElementImpl::CreateSVGPathSegCurvetoCubicRel DontDelete|Function 6 + createSVGPathSegCurvetoQuadraticAbs SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticAbs DontDelete|Function 4 + createSVGPathSegCurvetoQuadraticRel SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticRel DontDelete|Function 4 + createSVGPathSegLinetoHorizontalAbs SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalAbs DontDelete|Function 1 + createSVGPathSegLinetoHorizontalRel SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalRel DontDelete|Function 1 + createSVGPathSegLinetoVerticalAbs SVGPathElementImpl::CreateSVGPathSegLinetoVerticalAbs DontDelete|Function 1 + createSVGPathSegLinetoVerticalRel SVGPathElementImpl::CreateSVGPathSegLinetoVerticalRel DontDelete|Function 1 + createSVGPathSegCurvetoCubicAbs SVGPathElementImpl::CreateSVGPathSegCurvetoCubicAbs DontDelete|Function 4 + createSVGPathSegCurvetoCubicRel SVGPathElementImpl::CreateSVGPathSegCurvetoCubicRel DontDelete|Function 4 + createSVGPathSegCurvetoQuadraticAbs SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticAbs DontDelete|Function 2 + createSVGPathSegCurvetoQuadraticRel SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticRel DontDelete|Function 2 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGPathElementImpl", SVGPathElementImplProto, SVGPathElementImplProtoFunc) + +Value SVGPathElementImpl::getValueProperty(ExecState *exec, int token) const +{ + //KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case PathLength: + return m_pathLength->cache(exec); + case D: +// if(!attributeMode) + { + TQString d; + unsigned int nrSegs = pathSegList()->numberOfItems(); + SVGPathSegImpl *curseg = 0; + for(unsigned int i = 0; i < nrSegs; i++) + { + curseg = pathSegList()->getItem(i); + if(curseg) + d += curseg->toString() + " "; + } + return String(d); + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case D: + { + pathSegList()->clear(); + TQString d = value.toString(exec).qstring(); + parseSVG(d, false); + if(hasMarkers()) + m_markerData = MarkerData(pathSegList()); + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGPathElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGPathElementImpl) + + switch(id) + { + case SVGPathElementImpl::GetTotalLength: + return Number(obj->getTotalLength()); + case SVGPathElementImpl::GetPointAtLength: + return obj->getPointAtLength(args[0].toNumber(exec))->cache(exec); + case SVGPathElementImpl::GetPathSegAtLength: + return Number(obj->getPathSegAtLength(args[0].toNumber(exec))); + case SVGPathElementImpl::CreateSVGPathSegClosePath: + return obj->createSVGPathSegClosePath()->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegMovetoAbs: + return obj->createSVGPathSegMovetoAbs(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegMovetoRel: + return obj->createSVGPathSegMovetoRel(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegLinetoAbs: + return obj->createSVGPathSegLinetoAbs(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegLinetoRel: + return obj->createSVGPathSegLinetoRel(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicAbs: + return obj->createSVGPathSegCurvetoCubicAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicRel: + return obj->createSVGPathSegCurvetoCubicRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticAbs: + return obj->createSVGPathSegCurvetoQuadraticAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticRel: + return obj->createSVGPathSegCurvetoQuadraticRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegArcAbs: + return obj->createSVGPathSegArcAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toBoolean(exec), args[6].toBoolean(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegArcRel: + return obj->createSVGPathSegArcRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec), args[4].toNumber(exec), args[5].toBoolean(exec), args[6].toBoolean(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalAbs: + return obj->createSVGPathSegLinetoHorizontalAbs(args[0].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegLinetoHorizontalRel: + return obj->createSVGPathSegLinetoHorizontalRel(args[0].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegLinetoVerticalAbs: + return obj->createSVGPathSegLinetoVerticalAbs(args[0].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegLinetoVerticalRel: + return obj->createSVGPathSegLinetoVerticalRel(args[0].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicSmoothAbs: + return obj->createSVGPathSegCurvetoCubicSmoothAbs(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoCubicSmoothRel: + return obj->createSVGPathSegCurvetoCubicSmoothRel(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec), args[3].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticSmoothAbs: + return obj->createSVGPathSegCurvetoQuadraticSmoothAbs(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + case SVGPathElementImpl::CreateSVGPathSegCurvetoQuadraticSmoothRel: + return obj->createSVGPathSegCurvetoQuadraticSmoothRel(args[0].toNumber(exec), args[1].toNumber(exec))->cache(exec); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +SVGRectImpl *SVGPathElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + + if(m_item) + { + T2P::BezierPath *path = ownerDoc()->canvas()->toBezierPath(m_item); + if(path) + { + T2P::Point topLeft; + T2P::Point bottomRight; + + path->boundingBox(&topLeft, &bottomRight); + + ret->setX(topLeft.x()); + ret->setY(topLeft.y()); + ret->setWidth(bottomRight.x() - topLeft.x()); + ret->setHeight(bottomRight.y() - topLeft.y()); + } + } + return ret; +} + +void SVGPathElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + // TODO : this is a quick fix for this problem: + // d attribute encountered before marker attributes. + // Try to process the attributes in the right order, ie. + // d attr processing should be last. + if(hasMarkers() && m_markerData.numMarkers() == 0) + m_markerData = MarkerData(pathSegList()); + m_item = c->createPath(this); + c->insert(m_item); + } +} + +SVGPathElementImpl::MarkerData::MarkerData(SVGPathSegListImpl *path) +{ + unsigned int numSegments = path->numberOfItems(); + double curx = 0; + double cury = 0; + int currentSubpathStartIndex = -1; + double previousQuadraticX1 = 0; + double previousQuadraticY1 = 0; + double previousCubicX2 = 0; + double previousCubicY2 = 0; + + TQValueVector pathSegmentData(numSegments); + + for(unsigned int i = 0; i < numSegments; i++) + { + SVGPathSegImpl *segment = path->getItem(i); + struct SegmentData data; + + data.type = segment->pathSegType(); + + if(segment->pathSegType() == PATHSEG_MOVETO_ABS || segment->pathSegType() == PATHSEG_MOVETO_REL) + { + if(currentSubpathStartIndex >= 0) + { + // Finish the previous subpath. + for(unsigned int j = currentSubpathStartIndex; j < i; j++) + { + pathSegmentData[j].subpathStartIndex = currentSubpathStartIndex; + pathSegmentData[j].subpathEndIndex = i - 1; + pathSegmentData[j].subpathIsClosed = false; + } + } + + currentSubpathStartIndex = i; + } + else if(segment->pathSegType() == PATHSEG_CLOSEPATH) + { + if(currentSubpathStartIndex >= 0) + { + SVGPathSegClosePathImpl *s = static_cast(segment); + + s->setX(pathSegmentData[currentSubpathStartIndex].startx + pathSegmentData[currentSubpathStartIndex].dx); + s->setY(pathSegmentData[currentSubpathStartIndex].starty + pathSegmentData[currentSubpathStartIndex].dy); + + for(unsigned int j = currentSubpathStartIndex; j < i; j++) + { + pathSegmentData[j].subpathStartIndex = currentSubpathStartIndex; + pathSegmentData[j].subpathEndIndex = i; + pathSegmentData[j].subpathIsClosed = true; + } + + data.subpathStartIndex = currentSubpathStartIndex; + data.subpathEndIndex = i; + data.subpathIsClosed = true; + } + + currentSubpathStartIndex = i + 1; + } + + switch(segment->pathSegType()) + { + case PATHSEG_CURVETO_CUBIC_ABS: + { + SVGPathSegCurvetoCubicAbsImpl *s = static_cast(segment); + previousCubicX2 = s->x2(); + previousCubicY2 = s->y2(); + break; + } + case PATHSEG_CURVETO_CUBIC_REL: + { + SVGPathSegCurvetoCubicRelImpl *s = static_cast(segment); + previousCubicX2 = curx + s->x2(); + previousCubicY2 = cury + s->y2(); + break; + } + case PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: + { + SVGPathSegCurvetoCubicSmoothAbsImpl *s = static_cast(segment); + s->setPreviousX2(previousCubicX2); + s->setPreviousY2(previousCubicY2); + previousCubicX2 = s->x2(); + previousCubicY2 = s->y2(); + break; + } + case PATHSEG_CURVETO_CUBIC_SMOOTH_REL: + { + SVGPathSegCurvetoCubicSmoothRelImpl *s = static_cast(segment); + s->setPreviousAbsX2(previousCubicX2); + s->setPreviousAbsY2(previousCubicY2); + previousCubicX2 = curx + s->x2(); + previousCubicY2 = cury + s->y2(); + break; + } + case PATHSEG_CURVETO_QUADRATIC_ABS: + { + SVGPathSegCurvetoQuadraticAbsImpl *s = static_cast(segment); + previousQuadraticX1 = s->x1(); + previousQuadraticY1 = s->y1(); + break; + } + case PATHSEG_CURVETO_QUADRATIC_REL: + { + SVGPathSegCurvetoQuadraticRelImpl *s = static_cast(segment); + previousQuadraticX1 = curx + s->x1(); + previousQuadraticY1 = cury + s->y1(); + break; + } + case PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: + { + SVGPathSegCurvetoQuadraticSmoothAbsImpl *s = static_cast(segment); + s->setPreviousX1(previousQuadraticX1); + s->setPreviousY1(previousQuadraticY1); + previousQuadraticX1 = s->x1(curx); + previousQuadraticY1 = s->y1(cury); + break; + } + case PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: + { + SVGPathSegCurvetoQuadraticSmoothRelImpl *s = static_cast(segment); + s->setPreviousAbsX1(previousQuadraticX1); + s->setPreviousAbsY1(previousQuadraticY1); + previousQuadraticX1 = s->absX1(curx); + previousQuadraticY1 = s->absY1(cury); + break; + } + default: + previousCubicX2 = curx; + previousCubicY2 = cury; + previousQuadraticX1 = curx; + previousQuadraticY1 = cury; + break; + } + + data.startx = curx; + data.starty = cury; + + segment->getDeltasAndSlopes(curx, cury, &data.dx, &data.dy, &data.startSlope, &data.endSlope); + + pathSegmentData[i] = data; + + curx += data.dx; + cury += data.dy; + } + + if(currentSubpathStartIndex >= 0) + { + // Finish the previous subpath. + for(unsigned int j = currentSubpathStartIndex; j < numSegments; j++) + { + pathSegmentData[j].subpathStartIndex = currentSubpathStartIndex; + pathSegmentData[j].subpathEndIndex = numSegments - 1; + pathSegmentData[j].subpathIsClosed = false; + } + } + + m_markers.resize(numSegments); + + for(unsigned int i = 0; i < numSegments; i++) + { + struct Marker marker; + + marker.x = pathSegmentData[i].startx + pathSegmentData[i].dx; + marker.y = pathSegmentData[i].starty + pathSegmentData[i].dy; + + double inSlope; + double outSlope; + bool haveInSlope = false; + bool haveOutSlope = false; + + if(pathSegmentData[i].subpathStartIndex == i && pathSegmentData[i].subpathIsClosed) + { + // Spec: For closed subpaths, the marker for the initial vertex uses the end direction + // of the corresponding closepath for its incoming slope and the first segment's + // start slope for its outgoing slope. + haveInSlope = getEndSlope(pathSegmentData, pathSegmentData[i].subpathEndIndex, &inSlope); + haveOutSlope = getStartSlope(pathSegmentData, i + 1, &outSlope); + } + else if(pathSegmentData[i].type == PATHSEG_CLOSEPATH) + { + haveInSlope = getEndSlope(pathSegmentData, i, &inSlope); + + // Spec: If the segment following a closepath is other than a moveto, the marker + // for the closepath uses the following segment's start direction as its + // outgoing direction. + if(i + 1 < numSegments && (pathSegmentData[i + 1].type != PATHSEG_MOVETO_ABS && pathSegmentData[i + 1].type != PATHSEG_MOVETO_REL)) + haveOutSlope = getStartSlope(pathSegmentData, i + 1, &outSlope); + else + haveOutSlope = getStartSlope(pathSegmentData, pathSegmentData[i].subpathStartIndex, &outSlope); + } + else + { + haveOutSlope = getStartSlope(pathSegmentData, i + 1, &outSlope); + haveInSlope = getEndSlope(pathSegmentData, i, &inSlope); + } + + if(!haveInSlope && !haveOutSlope) + { + outSlope = 0; + inSlope = 0; + } + else if(haveInSlope && !haveOutSlope) + outSlope = inSlope; + else if(!haveInSlope && haveOutSlope) + inSlope = outSlope; + + double bisector = SVGAngleImpl::shortestArcBisector(inSlope, outSlope); + marker.angle = bisector; + + m_markers[i] = marker; + } +} + +bool SVGPathElementImpl::MarkerData::getStartSlope(TQValueVector segments, unsigned int i, double *pStartSlope) +{ + if(i > segments.count() - 1 || segments[i].type == PATHSEG_MOVETO_ABS || segments[i].type == PATHSEG_MOVETO_REL) + return false; + else + { + const double epsilon = DBL_EPSILON; + + if(fabs(segments[i].dx) > epsilon || fabs(segments[i].dy) > epsilon) + { + *pStartSlope = segments[i].startSlope; + return true; + } + else + { + int subpathStartIndex = segments[i].subpathStartIndex; + + for(int j = i - 1; j >= subpathStartIndex; j--) + { + if(segments[j].type == PATHSEG_MOVETO_ABS || segments[j].type == PATHSEG_MOVETO_REL) + return false; + + if(fabs(segments[j].dx) > epsilon || fabs(segments[j].dy) > epsilon) + { + *pStartSlope = segments[j].endSlope; + return true; + } + } + + return false; + } + } +} + +bool SVGPathElementImpl::MarkerData::getEndSlope(TQValueVector segments, unsigned int i, double *pEndSlope) +{ + if(i > segments.count() - 1 || segments[i].type == PATHSEG_MOVETO_ABS || segments[i].type == PATHSEG_MOVETO_REL) + return false; + else + { + const double epsilon = DBL_EPSILON; + + if(fabs(segments[i].dx) > epsilon || fabs(segments[i].dy) > epsilon) + { + *pEndSlope = segments[i].endSlope; + return true; + } + else + { + int subpathEndIndex = segments[i].subpathEndIndex; + + for(int j = i + 1; j <= subpathEndIndex; j++) + { + if(segments[j].type == PATHSEG_MOVETO_ABS || segments[j].type == PATHSEG_MOVETO_REL) + return false; + + if(fabs(segments[j].dx) > epsilon || fabs(segments[j].dy) > epsilon) + { + *pEndSlope = segments[j].startSlope; + return true; + } + } + + return false; + } + } +} diff --git a/ksvg/impl/SVGPathSegArcImpl.cc b/ksvg/impl/SVGPathSegArcImpl.cc deleted file mode 100644 index 9d5cc76a..00000000 --- a/ksvg/impl/SVGPathSegArcImpl.cc +++ /dev/null @@ -1,493 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGPathSegArcImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegArcImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -static void getArcSlopes(bool relative, double curx, double cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag, double *pStartSlope, double *pEndSlope) -{ - double sin_th, cos_th; - double a00, a01, a10, a11; - double x0, y0, x1, y1, xc, yc; - double d, sfactor, sfactor_sq; - double th0, th1, th_arc; - int i, n_segs; - - sin_th = sin(angle * (M_PI / 180.0)); - cos_th = cos(angle * (M_PI / 180.0)); - - double dx; - - if(!relative) - dx = (curx - x) / 2.0; - else - dx = -x / 2.0; - - double dy; - - if(!relative) - dy = (cury - y) / 2.0; - else - dy = -y / 2.0; - - double _x1 = cos_th * dx + sin_th * dy; - double _y1 = -sin_th * dx + cos_th * dy; - double Pr1 = r1 * r1; - double Pr2 = r2 * r2; - double Px = _x1 * _x1; - double Py = _y1 * _y1; - - // Spec : check if radii are large enough - double check = Px / Pr1 + Py / Pr2; - if(check > 1) - { - r1 = r1 * sqrt(check); - r2 = r2 * sqrt(check); - } - - a00 = cos_th / r1; - a01 = sin_th / r1; - a10 = -sin_th / r2; - a11 = cos_th / r2; - - x0 = a00 * curx + a01 * cury; - y0 = a10 * curx + a11 * cury; - - if(!relative) - x1 = a00 * x + a01 * y; - else - x1 = a00 * (curx + x) + a01 * (cury + y); - - if(!relative) - y1 = a10 * x + a11 * y; - else - y1 = a10 * (curx + x) + a11 * (cury + y); - - /* (x0, y0) is current point in transformed coordinate space. - (x1, y1) is new point in transformed coordinate space. - - The arc fits a unit-radius circle in this space. - */ - - d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - - sfactor_sq = 1.0 / d - 0.25; - - if(sfactor_sq < 0) - sfactor_sq = 0; - - sfactor = sqrt(sfactor_sq); - - if(sweepFlag == largeArcFlag) - sfactor = -sfactor; - - xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - - /* (xc, yc) is center of the circle. */ - th0 = atan2(y0 - yc, x0 - xc); - th1 = atan2(y1 - yc, x1 - xc); - - th_arc = th1 - th0; - if(th_arc < 0 && sweepFlag) - th_arc += 2 * M_PI; - else if(th_arc > 0 && !sweepFlag) - th_arc -= 2 * M_PI; - - n_segs = (int) (int) ceil(fabs(th_arc / (M_PI * 0.5 + 0.001))); - - for(int step = 0; step < 2; step++) - { - i = step == 0 ? 0 : n_segs - 1; - - double sin_th, cos_th; - double a00, a01, a10, a11; - double x1, y1, x2, y2, x3, y3; - double t; - double th_half; - - double _th0 = th0 + i * th_arc / n_segs; - double _th1 = th0 + (i + 1) * th_arc / n_segs; - - sin_th = sin(angle * (M_PI / 180.0)); - cos_th = cos(angle * (M_PI / 180.0)); - - /* inverse transform compared with rsvg_path_arc */ - a00 = cos_th * r1; - a01 = -sin_th * r2; - a10 = sin_th * r1; - a11 = cos_th * r2; - - th_half = 0.5 * (_th1 - _th0); - t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half); - x1 = xc + cos(_th0) - t * sin(_th0); - y1 = yc + sin(_th0) + t * cos(_th0); - x3 = xc + cos(_th1); - y3 = yc + sin(_th1); - x2 = x3 + t * sin(_th1); - y2 = y3 - t * cos(_th1); - - double bezX1 = a00 * x1 + a01 * y1; - double bezY1 = a10 * x1 + a11 * y1; - double bezX2 = a00 * x2 + a01 * y2; - double bezY2 = a10 * x2 + a11 * y2; - double bezX = a00 * x3 + a01 * y3; - double bezY = a10 * x3 + a11 * y3; - - if(step == 0) - *pStartSlope = SVGAngleImpl::todeg(atan2(bezY1 - cury, bezX1 - curx)); - else - *pEndSlope = SVGAngleImpl::todeg(atan2(bezY - bezY2, bezX - bezX2)); - } -} - -SVGPathSegArcAbsImpl::SVGPathSegArcAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegArcAbsImpl::~SVGPathSegArcAbsImpl() -{ -} - -void SVGPathSegArcAbsImpl::setX(double x) -{ - m_x = x; -} - -double SVGPathSegArcAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegArcAbsImpl::setY(double y) -{ - m_y = y; -} - -double SVGPathSegArcAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegArcAbsImpl::setR1(double r1) -{ - m_r1 = r1; -} - -double SVGPathSegArcAbsImpl::r1() const -{ - return m_r1; -} - -void SVGPathSegArcAbsImpl::setR2(double r2) -{ - m_r2 = r2; -} - -double SVGPathSegArcAbsImpl::r2() const -{ - return m_r2; -} - -void SVGPathSegArcAbsImpl::setAngle(double angle) -{ - m_angle = angle; -} - -double SVGPathSegArcAbsImpl::angle() const -{ - return m_angle; -} - -void SVGPathSegArcAbsImpl::setLargeArcFlag(bool largeArcFlag) -{ - m_largeArcFlag = largeArcFlag; -} - -bool SVGPathSegArcAbsImpl::largeArcFlag() const -{ - return m_largeArcFlag; -} - -void SVGPathSegArcAbsImpl::setSweepFlag(bool sweepFlag) -{ - m_sweepFlag = sweepFlag; -} - -bool SVGPathSegArcAbsImpl::sweepFlag() const -{ - return m_sweepFlag; -} - -void SVGPathSegArcAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope; - double endSlope; - getArcSlopes(false, curx, cury, angle(), x(), y(), r1(), r2(), largeArcFlag(), sweepFlag(), &startSlope, &endSlope); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegArcAbsImpl::s_hashTable 11 - x SVGPathSegArcAbsImpl::X DontDelete - y SVGPathSegArcAbsImpl::Y DontDelete - r1 SVGPathSegArcAbsImpl::R1 DontDelete - r2 SVGPathSegArcAbsImpl::R2 DontDelete - angle SVGPathSegArcAbsImpl::Angle DontDelete - largeArcFlag SVGPathSegArcAbsImpl::LargeArcFlag DontDelete - sweepFlag SVGPathSegArcAbsImpl::SweepFlag DontDelete -@end -*/ - -Value SVGPathSegArcAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case R1: - return Number(r1()); - case R2: - return Number(r2()); - case Angle: - return Number(angle()); - case LargeArcFlag: - return Boolean(largeArcFlag()); - case SweepFlag: - return Boolean(sweepFlag()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegArcAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case R1: - m_r1 = value.toNumber(exec); - break; - case R2: - m_r2 = value.toNumber(exec); - break; - case Angle: - m_angle = value.toNumber(exec); - break; - case LargeArcFlag: - m_largeArcFlag = value.toBoolean(exec); - break; - case SweepFlag: - m_sweepFlag = value.toBoolean(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - -SVGPathSegArcRelImpl::SVGPathSegArcRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegArcRelImpl::~SVGPathSegArcRelImpl() -{ -} - -void SVGPathSegArcRelImpl::setX(double x) -{ - m_x = x; -} - -double SVGPathSegArcRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegArcRelImpl::setY(double y) -{ - m_y = y; -} - -double SVGPathSegArcRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegArcRelImpl::setR1(double r1) -{ - m_r1 = r1; -} - -double SVGPathSegArcRelImpl::r1() const -{ - return m_r1; -} - -void SVGPathSegArcRelImpl::setR2(double r2) -{ - m_r2 = r2; -} - -double SVGPathSegArcRelImpl::r2() const -{ - return m_r2; -} - -void SVGPathSegArcRelImpl::setAngle(double angle) -{ - m_angle = angle; -} - -double SVGPathSegArcRelImpl::angle() const -{ - return m_angle; -} - -void SVGPathSegArcRelImpl::setLargeArcFlag(bool largeArcFlag) -{ - m_largeArcFlag = largeArcFlag; -} - -bool SVGPathSegArcRelImpl::largeArcFlag() const -{ - return m_largeArcFlag; -} - -void SVGPathSegArcRelImpl::setSweepFlag(bool sweepFlag) -{ - m_sweepFlag = sweepFlag; -} - -bool SVGPathSegArcRelImpl::sweepFlag() const -{ - return m_sweepFlag; -} - -void SVGPathSegArcRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x(); - double dy = y(); - double startSlope; - double endSlope; - getArcSlopes(true, curx, cury, angle(), x(), y(), r1(), r2(), largeArcFlag(), sweepFlag(), &startSlope, &endSlope); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegArcRelImpl::s_hashTable 11 - x SVGPathSegArcRelImpl::X DontDelete - y SVGPathSegArcRelImpl::Y DontDelete - r1 SVGPathSegArcRelImpl::R1 DontDelete - r2 SVGPathSegArcRelImpl::R2 DontDelete - angle SVGPathSegArcRelImpl::Angle DontDelete - largeArcFlag SVGPathSegArcRelImpl::LargeArcFlag DontDelete - sweepFlag SVGPathSegArcRelImpl::SweepFlag DontDelete -@end -*/ - -Value SVGPathSegArcRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case R1: - return Number(r1()); - case R2: - return Number(r2()); - case Angle: - return Number(angle()); - case LargeArcFlag: - return Boolean(largeArcFlag()); - case SweepFlag: - return Boolean(sweepFlag()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegArcRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case R1: - m_r1 = value.toNumber(exec); - break; - case R2: - m_r2 = value.toNumber(exec); - break; - case Angle: - m_angle = value.toNumber(exec); - break; - case LargeArcFlag: - m_largeArcFlag = value.toBoolean(exec); - break; - case SweepFlag: - m_sweepFlag = value.toBoolean(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegArcImpl.cpp b/ksvg/impl/SVGPathSegArcImpl.cpp new file mode 100644 index 00000000..9d5cc76a --- /dev/null +++ b/ksvg/impl/SVGPathSegArcImpl.cpp @@ -0,0 +1,493 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGPathSegArcImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegArcImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +static void getArcSlopes(bool relative, double curx, double cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag, double *pStartSlope, double *pEndSlope) +{ + double sin_th, cos_th; + double a00, a01, a10, a11; + double x0, y0, x1, y1, xc, yc; + double d, sfactor, sfactor_sq; + double th0, th1, th_arc; + int i, n_segs; + + sin_th = sin(angle * (M_PI / 180.0)); + cos_th = cos(angle * (M_PI / 180.0)); + + double dx; + + if(!relative) + dx = (curx - x) / 2.0; + else + dx = -x / 2.0; + + double dy; + + if(!relative) + dy = (cury - y) / 2.0; + else + dy = -y / 2.0; + + double _x1 = cos_th * dx + sin_th * dy; + double _y1 = -sin_th * dx + cos_th * dy; + double Pr1 = r1 * r1; + double Pr2 = r2 * r2; + double Px = _x1 * _x1; + double Py = _y1 * _y1; + + // Spec : check if radii are large enough + double check = Px / Pr1 + Py / Pr2; + if(check > 1) + { + r1 = r1 * sqrt(check); + r2 = r2 * sqrt(check); + } + + a00 = cos_th / r1; + a01 = sin_th / r1; + a10 = -sin_th / r2; + a11 = cos_th / r2; + + x0 = a00 * curx + a01 * cury; + y0 = a10 * curx + a11 * cury; + + if(!relative) + x1 = a00 * x + a01 * y; + else + x1 = a00 * (curx + x) + a01 * (cury + y); + + if(!relative) + y1 = a10 * x + a11 * y; + else + y1 = a10 * (curx + x) + a11 * (cury + y); + + /* (x0, y0) is current point in transformed coordinate space. + (x1, y1) is new point in transformed coordinate space. + + The arc fits a unit-radius circle in this space. + */ + + d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); + + sfactor_sq = 1.0 / d - 0.25; + + if(sfactor_sq < 0) + sfactor_sq = 0; + + sfactor = sqrt(sfactor_sq); + + if(sweepFlag == largeArcFlag) + sfactor = -sfactor; + + xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); + yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); + + /* (xc, yc) is center of the circle. */ + th0 = atan2(y0 - yc, x0 - xc); + th1 = atan2(y1 - yc, x1 - xc); + + th_arc = th1 - th0; + if(th_arc < 0 && sweepFlag) + th_arc += 2 * M_PI; + else if(th_arc > 0 && !sweepFlag) + th_arc -= 2 * M_PI; + + n_segs = (int) (int) ceil(fabs(th_arc / (M_PI * 0.5 + 0.001))); + + for(int step = 0; step < 2; step++) + { + i = step == 0 ? 0 : n_segs - 1; + + double sin_th, cos_th; + double a00, a01, a10, a11; + double x1, y1, x2, y2, x3, y3; + double t; + double th_half; + + double _th0 = th0 + i * th_arc / n_segs; + double _th1 = th0 + (i + 1) * th_arc / n_segs; + + sin_th = sin(angle * (M_PI / 180.0)); + cos_th = cos(angle * (M_PI / 180.0)); + + /* inverse transform compared with rsvg_path_arc */ + a00 = cos_th * r1; + a01 = -sin_th * r2; + a10 = sin_th * r1; + a11 = cos_th * r2; + + th_half = 0.5 * (_th1 - _th0); + t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half); + x1 = xc + cos(_th0) - t * sin(_th0); + y1 = yc + sin(_th0) + t * cos(_th0); + x3 = xc + cos(_th1); + y3 = yc + sin(_th1); + x2 = x3 + t * sin(_th1); + y2 = y3 - t * cos(_th1); + + double bezX1 = a00 * x1 + a01 * y1; + double bezY1 = a10 * x1 + a11 * y1; + double bezX2 = a00 * x2 + a01 * y2; + double bezY2 = a10 * x2 + a11 * y2; + double bezX = a00 * x3 + a01 * y3; + double bezY = a10 * x3 + a11 * y3; + + if(step == 0) + *pStartSlope = SVGAngleImpl::todeg(atan2(bezY1 - cury, bezX1 - curx)); + else + *pEndSlope = SVGAngleImpl::todeg(atan2(bezY - bezY2, bezX - bezX2)); + } +} + +SVGPathSegArcAbsImpl::SVGPathSegArcAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegArcAbsImpl::~SVGPathSegArcAbsImpl() +{ +} + +void SVGPathSegArcAbsImpl::setX(double x) +{ + m_x = x; +} + +double SVGPathSegArcAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegArcAbsImpl::setY(double y) +{ + m_y = y; +} + +double SVGPathSegArcAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegArcAbsImpl::setR1(double r1) +{ + m_r1 = r1; +} + +double SVGPathSegArcAbsImpl::r1() const +{ + return m_r1; +} + +void SVGPathSegArcAbsImpl::setR2(double r2) +{ + m_r2 = r2; +} + +double SVGPathSegArcAbsImpl::r2() const +{ + return m_r2; +} + +void SVGPathSegArcAbsImpl::setAngle(double angle) +{ + m_angle = angle; +} + +double SVGPathSegArcAbsImpl::angle() const +{ + return m_angle; +} + +void SVGPathSegArcAbsImpl::setLargeArcFlag(bool largeArcFlag) +{ + m_largeArcFlag = largeArcFlag; +} + +bool SVGPathSegArcAbsImpl::largeArcFlag() const +{ + return m_largeArcFlag; +} + +void SVGPathSegArcAbsImpl::setSweepFlag(bool sweepFlag) +{ + m_sweepFlag = sweepFlag; +} + +bool SVGPathSegArcAbsImpl::sweepFlag() const +{ + return m_sweepFlag; +} + +void SVGPathSegArcAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope; + double endSlope; + getArcSlopes(false, curx, cury, angle(), x(), y(), r1(), r2(), largeArcFlag(), sweepFlag(), &startSlope, &endSlope); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegArcAbsImpl::s_hashTable 11 + x SVGPathSegArcAbsImpl::X DontDelete + y SVGPathSegArcAbsImpl::Y DontDelete + r1 SVGPathSegArcAbsImpl::R1 DontDelete + r2 SVGPathSegArcAbsImpl::R2 DontDelete + angle SVGPathSegArcAbsImpl::Angle DontDelete + largeArcFlag SVGPathSegArcAbsImpl::LargeArcFlag DontDelete + sweepFlag SVGPathSegArcAbsImpl::SweepFlag DontDelete +@end +*/ + +Value SVGPathSegArcAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case R1: + return Number(r1()); + case R2: + return Number(r2()); + case Angle: + return Number(angle()); + case LargeArcFlag: + return Boolean(largeArcFlag()); + case SweepFlag: + return Boolean(sweepFlag()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegArcAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case R1: + m_r1 = value.toNumber(exec); + break; + case R2: + m_r2 = value.toNumber(exec); + break; + case Angle: + m_angle = value.toNumber(exec); + break; + case LargeArcFlag: + m_largeArcFlag = value.toBoolean(exec); + break; + case SweepFlag: + m_sweepFlag = value.toBoolean(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + +SVGPathSegArcRelImpl::SVGPathSegArcRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegArcRelImpl::~SVGPathSegArcRelImpl() +{ +} + +void SVGPathSegArcRelImpl::setX(double x) +{ + m_x = x; +} + +double SVGPathSegArcRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegArcRelImpl::setY(double y) +{ + m_y = y; +} + +double SVGPathSegArcRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegArcRelImpl::setR1(double r1) +{ + m_r1 = r1; +} + +double SVGPathSegArcRelImpl::r1() const +{ + return m_r1; +} + +void SVGPathSegArcRelImpl::setR2(double r2) +{ + m_r2 = r2; +} + +double SVGPathSegArcRelImpl::r2() const +{ + return m_r2; +} + +void SVGPathSegArcRelImpl::setAngle(double angle) +{ + m_angle = angle; +} + +double SVGPathSegArcRelImpl::angle() const +{ + return m_angle; +} + +void SVGPathSegArcRelImpl::setLargeArcFlag(bool largeArcFlag) +{ + m_largeArcFlag = largeArcFlag; +} + +bool SVGPathSegArcRelImpl::largeArcFlag() const +{ + return m_largeArcFlag; +} + +void SVGPathSegArcRelImpl::setSweepFlag(bool sweepFlag) +{ + m_sweepFlag = sweepFlag; +} + +bool SVGPathSegArcRelImpl::sweepFlag() const +{ + return m_sweepFlag; +} + +void SVGPathSegArcRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x(); + double dy = y(); + double startSlope; + double endSlope; + getArcSlopes(true, curx, cury, angle(), x(), y(), r1(), r2(), largeArcFlag(), sweepFlag(), &startSlope, &endSlope); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegArcRelImpl::s_hashTable 11 + x SVGPathSegArcRelImpl::X DontDelete + y SVGPathSegArcRelImpl::Y DontDelete + r1 SVGPathSegArcRelImpl::R1 DontDelete + r2 SVGPathSegArcRelImpl::R2 DontDelete + angle SVGPathSegArcRelImpl::Angle DontDelete + largeArcFlag SVGPathSegArcRelImpl::LargeArcFlag DontDelete + sweepFlag SVGPathSegArcRelImpl::SweepFlag DontDelete +@end +*/ + +Value SVGPathSegArcRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case R1: + return Number(r1()); + case R2: + return Number(r2()); + case Angle: + return Number(angle()); + case LargeArcFlag: + return Boolean(largeArcFlag()); + case SweepFlag: + return Boolean(sweepFlag()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegArcRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case R1: + m_r1 = value.toNumber(exec); + break; + case R2: + m_r2 = value.toNumber(exec); + break; + case Angle: + m_angle = value.toNumber(exec); + break; + case LargeArcFlag: + m_largeArcFlag = value.toBoolean(exec); + break; + case SweepFlag: + m_sweepFlag = value.toBoolean(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegClosePathImpl.cc b/ksvg/impl/SVGPathSegClosePathImpl.cc deleted file mode 100644 index f5e15f88..00000000 --- a/ksvg/impl/SVGPathSegClosePathImpl.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPathSegClosePathImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -SVGPathSegClosePathImpl::SVGPathSegClosePathImpl() : SVGPathSegImpl() -{ -} - -SVGPathSegClosePathImpl::~SVGPathSegClosePathImpl() -{ -} - -void SVGPathSegClosePathImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); - double endSlope = startSlope; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} diff --git a/ksvg/impl/SVGPathSegClosePathImpl.cpp b/ksvg/impl/SVGPathSegClosePathImpl.cpp new file mode 100644 index 00000000..f5e15f88 --- /dev/null +++ b/ksvg/impl/SVGPathSegClosePathImpl.cpp @@ -0,0 +1,44 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPathSegClosePathImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +SVGPathSegClosePathImpl::SVGPathSegClosePathImpl() : SVGPathSegImpl() +{ +} + +SVGPathSegClosePathImpl::~SVGPathSegClosePathImpl() +{ +} + +void SVGPathSegClosePathImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); + double endSlope = startSlope; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} diff --git a/ksvg/impl/SVGPathSegCurvetoCubicImpl.cc b/ksvg/impl/SVGPathSegCurvetoCubicImpl.cc deleted file mode 100644 index 597b5bdc..00000000 --- a/ksvg/impl/SVGPathSegCurvetoCubicImpl.cc +++ /dev/null @@ -1,323 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegCurvetoCubicImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegCurvetoCubicImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegCurvetoCubicAbsImpl::SVGPathSegCurvetoCubicAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoCubicAbsImpl::~SVGPathSegCurvetoCubicAbsImpl() -{ -} - -void SVGPathSegCurvetoCubicAbsImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoCubicAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoCubicAbsImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoCubicAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoCubicAbsImpl::setX1(const double &x1) -{ - m_x1 = x1; -} - -double SVGPathSegCurvetoCubicAbsImpl::x1() const -{ - return m_x1; -} - -void SVGPathSegCurvetoCubicAbsImpl::setY1(const double &y1) -{ - m_y1 = y1; -} - -double SVGPathSegCurvetoCubicAbsImpl::y1() const -{ - return m_y1; -} - -void SVGPathSegCurvetoCubicAbsImpl::setX2(const double &x2) -{ - m_x2 = x2; -} - -double SVGPathSegCurvetoCubicAbsImpl::x2() const -{ - return m_x2; -} - -void SVGPathSegCurvetoCubicAbsImpl::setY2(const double &y2) -{ - m_y2 = y2; -} - -double SVGPathSegCurvetoCubicAbsImpl::y2() const -{ - return m_y2; -} - -void SVGPathSegCurvetoCubicAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope = SVGAngleImpl::todeg(atan2(y1() - cury, x1() - curx)); - double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoCubicAbsImpl::s_hashTable 7 - x SVGPathSegCurvetoCubicAbsImpl::X DontDelete - y SVGPathSegCurvetoCubicAbsImpl::Y DontDelete - x1 SVGPathSegCurvetoCubicAbsImpl::X1 DontDelete - y1 SVGPathSegCurvetoCubicAbsImpl::Y1 DontDelete - x2 SVGPathSegCurvetoCubicAbsImpl::X2 DontDelete - y2 SVGPathSegCurvetoCubicAbsImpl::Y2 DontDelete -@end -*/ - -Value SVGPathSegCurvetoCubicAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case X1: - return Number(x1()); - case Y1: - return Number(y1()); - case X2: - return Number(x2()); - case Y2: - return Number(y2()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoCubicAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case X1: - m_x1 = value.toNumber(exec); - break; - case Y1: - m_y1 = value.toNumber(exec); - break; - case X2: - m_x2 = value.toNumber(exec); - break; - case Y2: - m_y2 = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - - -SVGPathSegCurvetoCubicRelImpl::SVGPathSegCurvetoCubicRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoCubicRelImpl::~SVGPathSegCurvetoCubicRelImpl() -{ -} - -void SVGPathSegCurvetoCubicRelImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoCubicRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoCubicRelImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoCubicRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoCubicRelImpl::setX1(const double &x1) -{ - m_x1 = x1; -} - -double SVGPathSegCurvetoCubicRelImpl::x1() const -{ - return m_x1; -} - -void SVGPathSegCurvetoCubicRelImpl::setY1(const double &y1) -{ - m_y1 = y1; -} - -double SVGPathSegCurvetoCubicRelImpl::y1() const -{ - return m_y1; -} - -void SVGPathSegCurvetoCubicRelImpl::setX2(const double &x2) -{ - m_x2 = x2; -} - -double SVGPathSegCurvetoCubicRelImpl::x2() const -{ - return m_x2; -} - -void SVGPathSegCurvetoCubicRelImpl::setY2(const double &y2) -{ - m_y2 = y2; -} - -double SVGPathSegCurvetoCubicRelImpl::y2() const -{ - return m_y2; -} - -void SVGPathSegCurvetoCubicRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - Q_UNUSED(curx); - Q_UNUSED(cury); - double dx = x(); - double dy = y(); - double startSlope = SVGAngleImpl::todeg(atan2(y1(), x1())); - double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoCubicRelImpl::s_hashTable 7 - x SVGPathSegCurvetoCubicRelImpl::X DontDelete - y SVGPathSegCurvetoCubicRelImpl::Y DontDelete - x1 SVGPathSegCurvetoCubicRelImpl::X1 DontDelete - y1 SVGPathSegCurvetoCubicRelImpl::Y1 DontDelete - x2 SVGPathSegCurvetoCubicRelImpl::X2 DontDelete - y2 SVGPathSegCurvetoCubicRelImpl::Y2 DontDelete -@end -*/ - -Value SVGPathSegCurvetoCubicRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case X1: - return Number(x1()); - case Y1: - return Number(y1()); - case X2: - return Number(x2()); - case Y2: - return Number(y2()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoCubicRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case X1: - m_x1 = value.toNumber(exec); - break; - case Y1: - m_y1 = value.toNumber(exec); - break; - case X2: - m_x2 = value.toNumber(exec); - break; - case Y2: - m_y2 = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegCurvetoCubicImpl.cpp b/ksvg/impl/SVGPathSegCurvetoCubicImpl.cpp new file mode 100644 index 00000000..597b5bdc --- /dev/null +++ b/ksvg/impl/SVGPathSegCurvetoCubicImpl.cpp @@ -0,0 +1,323 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegCurvetoCubicImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegCurvetoCubicImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegCurvetoCubicAbsImpl::SVGPathSegCurvetoCubicAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoCubicAbsImpl::~SVGPathSegCurvetoCubicAbsImpl() +{ +} + +void SVGPathSegCurvetoCubicAbsImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoCubicAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoCubicAbsImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoCubicAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoCubicAbsImpl::setX1(const double &x1) +{ + m_x1 = x1; +} + +double SVGPathSegCurvetoCubicAbsImpl::x1() const +{ + return m_x1; +} + +void SVGPathSegCurvetoCubicAbsImpl::setY1(const double &y1) +{ + m_y1 = y1; +} + +double SVGPathSegCurvetoCubicAbsImpl::y1() const +{ + return m_y1; +} + +void SVGPathSegCurvetoCubicAbsImpl::setX2(const double &x2) +{ + m_x2 = x2; +} + +double SVGPathSegCurvetoCubicAbsImpl::x2() const +{ + return m_x2; +} + +void SVGPathSegCurvetoCubicAbsImpl::setY2(const double &y2) +{ + m_y2 = y2; +} + +double SVGPathSegCurvetoCubicAbsImpl::y2() const +{ + return m_y2; +} + +void SVGPathSegCurvetoCubicAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope = SVGAngleImpl::todeg(atan2(y1() - cury, x1() - curx)); + double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoCubicAbsImpl::s_hashTable 7 + x SVGPathSegCurvetoCubicAbsImpl::X DontDelete + y SVGPathSegCurvetoCubicAbsImpl::Y DontDelete + x1 SVGPathSegCurvetoCubicAbsImpl::X1 DontDelete + y1 SVGPathSegCurvetoCubicAbsImpl::Y1 DontDelete + x2 SVGPathSegCurvetoCubicAbsImpl::X2 DontDelete + y2 SVGPathSegCurvetoCubicAbsImpl::Y2 DontDelete +@end +*/ + +Value SVGPathSegCurvetoCubicAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case X1: + return Number(x1()); + case Y1: + return Number(y1()); + case X2: + return Number(x2()); + case Y2: + return Number(y2()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoCubicAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case X1: + m_x1 = value.toNumber(exec); + break; + case Y1: + m_y1 = value.toNumber(exec); + break; + case X2: + m_x2 = value.toNumber(exec); + break; + case Y2: + m_y2 = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + + +SVGPathSegCurvetoCubicRelImpl::SVGPathSegCurvetoCubicRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoCubicRelImpl::~SVGPathSegCurvetoCubicRelImpl() +{ +} + +void SVGPathSegCurvetoCubicRelImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoCubicRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoCubicRelImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoCubicRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoCubicRelImpl::setX1(const double &x1) +{ + m_x1 = x1; +} + +double SVGPathSegCurvetoCubicRelImpl::x1() const +{ + return m_x1; +} + +void SVGPathSegCurvetoCubicRelImpl::setY1(const double &y1) +{ + m_y1 = y1; +} + +double SVGPathSegCurvetoCubicRelImpl::y1() const +{ + return m_y1; +} + +void SVGPathSegCurvetoCubicRelImpl::setX2(const double &x2) +{ + m_x2 = x2; +} + +double SVGPathSegCurvetoCubicRelImpl::x2() const +{ + return m_x2; +} + +void SVGPathSegCurvetoCubicRelImpl::setY2(const double &y2) +{ + m_y2 = y2; +} + +double SVGPathSegCurvetoCubicRelImpl::y2() const +{ + return m_y2; +} + +void SVGPathSegCurvetoCubicRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + Q_UNUSED(curx); + Q_UNUSED(cury); + double dx = x(); + double dy = y(); + double startSlope = SVGAngleImpl::todeg(atan2(y1(), x1())); + double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoCubicRelImpl::s_hashTable 7 + x SVGPathSegCurvetoCubicRelImpl::X DontDelete + y SVGPathSegCurvetoCubicRelImpl::Y DontDelete + x1 SVGPathSegCurvetoCubicRelImpl::X1 DontDelete + y1 SVGPathSegCurvetoCubicRelImpl::Y1 DontDelete + x2 SVGPathSegCurvetoCubicRelImpl::X2 DontDelete + y2 SVGPathSegCurvetoCubicRelImpl::Y2 DontDelete +@end +*/ + +Value SVGPathSegCurvetoCubicRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case X1: + return Number(x1()); + case Y1: + return Number(y1()); + case X2: + return Number(x2()); + case Y2: + return Number(y2()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoCubicRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case X1: + m_x1 = value.toNumber(exec); + break; + case Y1: + m_y1 = value.toNumber(exec); + break; + case X2: + m_x2 = value.toNumber(exec); + break; + case Y2: + m_y2 = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cc b/ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cc deleted file mode 100644 index 8bc5460e..00000000 --- a/ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cc +++ /dev/null @@ -1,296 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegCurvetoCubicSmoothImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegCurvetoCubicSmoothImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegCurvetoCubicSmoothAbsImpl::SVGPathSegCurvetoCubicSmoothAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoCubicSmoothAbsImpl::~SVGPathSegCurvetoCubicSmoothAbsImpl() -{ -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoCubicSmoothAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoCubicSmoothAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::setX2(const double &x2) -{ - m_x2 = x2; -} - -double SVGPathSegCurvetoCubicSmoothAbsImpl::x2() const -{ - return m_x2; -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::setY2(const double &y2) -{ - m_y2 = y2; -} - -double SVGPathSegCurvetoCubicSmoothAbsImpl::y2() const -{ - return m_y2; -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::setPreviousX2(double x2) -{ - m_previousX2 = x2; -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::setPreviousY2(double y2) -{ - m_previousY2 = y2; -} - -double SVGPathSegCurvetoCubicSmoothAbsImpl::x1(double curx) const -{ - return curx - (m_previousX2 - curx); -} - -double SVGPathSegCurvetoCubicSmoothAbsImpl::y1(double cury) const -{ - return cury - (m_previousY2 - cury); -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope = SVGAngleImpl::todeg(atan2(y1(cury) - cury, x1(curx) - curx)); - double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoCubicSmoothAbsImpl::s_hashTable 5 - x SVGPathSegCurvetoCubicSmoothAbsImpl::X DontDelete - y SVGPathSegCurvetoCubicSmoothAbsImpl::Y DontDelete - x2 SVGPathSegCurvetoCubicSmoothAbsImpl::X2 DontDelete - y2 SVGPathSegCurvetoCubicSmoothAbsImpl::Y2 DontDelete -@end -*/ - -Value SVGPathSegCurvetoCubicSmoothAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case X2: - return Number(x2()); - case Y2: - return Number(y2()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoCubicSmoothAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case X2: - m_x2 = value.toNumber(exec); - break; - case Y2: - m_y2 = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - -SVGPathSegCurvetoCubicSmoothRelImpl::SVGPathSegCurvetoCubicSmoothRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoCubicSmoothRelImpl::~SVGPathSegCurvetoCubicSmoothRelImpl() -{ -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoCubicSmoothRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoCubicSmoothRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::setX2(const double &x2) -{ - m_x2 = x2; -} - -double SVGPathSegCurvetoCubicSmoothRelImpl::x2() const -{ - return m_x2; -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::setY2(const double &y2) -{ - m_y2 = y2; -} - -double SVGPathSegCurvetoCubicSmoothRelImpl::y2() const -{ - return m_y2; -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::setPreviousAbsX2(double x2) -{ - m_previousAbsX2 = x2; -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::setPreviousAbsY2(double y2) -{ - m_previousAbsY2 = y2; -} - -double SVGPathSegCurvetoCubicSmoothRelImpl::absX1(double curx) const -{ - return curx - (m_previousAbsX2 - curx); -} - -double SVGPathSegCurvetoCubicSmoothRelImpl::absY1(double cury) const -{ - return cury - (m_previousAbsY2 - cury); -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x(); - double dy = y(); - double startSlope = SVGAngleImpl::todeg(atan2(absY1(cury) - cury, absX1(curx) - curx)); - double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoCubicSmoothRelImpl::s_hashTable 5 - x SVGPathSegCurvetoCubicSmoothRelImpl::X DontDelete - y SVGPathSegCurvetoCubicSmoothRelImpl::Y DontDelete - x2 SVGPathSegCurvetoCubicSmoothRelImpl::X2 DontDelete - y2 SVGPathSegCurvetoCubicSmoothRelImpl::Y2 DontDelete -@end -*/ - -Value SVGPathSegCurvetoCubicSmoothRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case X2: - return Number(x2()); - case Y2: - return Number(y2()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoCubicSmoothRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case X2: - m_x2 = value.toNumber(exec); - break; - case Y2: - m_y2 = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cpp b/ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cpp new file mode 100644 index 00000000..8bc5460e --- /dev/null +++ b/ksvg/impl/SVGPathSegCurvetoCubicSmoothImpl.cpp @@ -0,0 +1,296 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegCurvetoCubicSmoothImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegCurvetoCubicSmoothImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegCurvetoCubicSmoothAbsImpl::SVGPathSegCurvetoCubicSmoothAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoCubicSmoothAbsImpl::~SVGPathSegCurvetoCubicSmoothAbsImpl() +{ +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoCubicSmoothAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoCubicSmoothAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::setX2(const double &x2) +{ + m_x2 = x2; +} + +double SVGPathSegCurvetoCubicSmoothAbsImpl::x2() const +{ + return m_x2; +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::setY2(const double &y2) +{ + m_y2 = y2; +} + +double SVGPathSegCurvetoCubicSmoothAbsImpl::y2() const +{ + return m_y2; +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::setPreviousX2(double x2) +{ + m_previousX2 = x2; +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::setPreviousY2(double y2) +{ + m_previousY2 = y2; +} + +double SVGPathSegCurvetoCubicSmoothAbsImpl::x1(double curx) const +{ + return curx - (m_previousX2 - curx); +} + +double SVGPathSegCurvetoCubicSmoothAbsImpl::y1(double cury) const +{ + return cury - (m_previousY2 - cury); +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope = SVGAngleImpl::todeg(atan2(y1(cury) - cury, x1(curx) - curx)); + double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoCubicSmoothAbsImpl::s_hashTable 5 + x SVGPathSegCurvetoCubicSmoothAbsImpl::X DontDelete + y SVGPathSegCurvetoCubicSmoothAbsImpl::Y DontDelete + x2 SVGPathSegCurvetoCubicSmoothAbsImpl::X2 DontDelete + y2 SVGPathSegCurvetoCubicSmoothAbsImpl::Y2 DontDelete +@end +*/ + +Value SVGPathSegCurvetoCubicSmoothAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case X2: + return Number(x2()); + case Y2: + return Number(y2()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoCubicSmoothAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case X2: + m_x2 = value.toNumber(exec); + break; + case Y2: + m_y2 = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + +SVGPathSegCurvetoCubicSmoothRelImpl::SVGPathSegCurvetoCubicSmoothRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoCubicSmoothRelImpl::~SVGPathSegCurvetoCubicSmoothRelImpl() +{ +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoCubicSmoothRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoCubicSmoothRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::setX2(const double &x2) +{ + m_x2 = x2; +} + +double SVGPathSegCurvetoCubicSmoothRelImpl::x2() const +{ + return m_x2; +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::setY2(const double &y2) +{ + m_y2 = y2; +} + +double SVGPathSegCurvetoCubicSmoothRelImpl::y2() const +{ + return m_y2; +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::setPreviousAbsX2(double x2) +{ + m_previousAbsX2 = x2; +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::setPreviousAbsY2(double y2) +{ + m_previousAbsY2 = y2; +} + +double SVGPathSegCurvetoCubicSmoothRelImpl::absX1(double curx) const +{ + return curx - (m_previousAbsX2 - curx); +} + +double SVGPathSegCurvetoCubicSmoothRelImpl::absY1(double cury) const +{ + return cury - (m_previousAbsY2 - cury); +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x(); + double dy = y(); + double startSlope = SVGAngleImpl::todeg(atan2(absY1(cury) - cury, absX1(curx) - curx)); + double endSlope = SVGAngleImpl::todeg(atan2(y() - y2(), x() - x2())); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoCubicSmoothRelImpl::s_hashTable 5 + x SVGPathSegCurvetoCubicSmoothRelImpl::X DontDelete + y SVGPathSegCurvetoCubicSmoothRelImpl::Y DontDelete + x2 SVGPathSegCurvetoCubicSmoothRelImpl::X2 DontDelete + y2 SVGPathSegCurvetoCubicSmoothRelImpl::Y2 DontDelete +@end +*/ + +Value SVGPathSegCurvetoCubicSmoothRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case X2: + return Number(x2()); + case Y2: + return Number(y2()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoCubicSmoothRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case X2: + m_x2 = value.toNumber(exec); + break; + case Y2: + m_y2 = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cc b/ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cc deleted file mode 100644 index fa78804f..00000000 --- a/ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cc +++ /dev/null @@ -1,258 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegCurvetoQuadraticImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegCurvetoQuadraticImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegCurvetoQuadraticAbsImpl::SVGPathSegCurvetoQuadraticAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoQuadraticAbsImpl::~SVGPathSegCurvetoQuadraticAbsImpl() -{ -} - -void SVGPathSegCurvetoQuadraticAbsImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoQuadraticAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoQuadraticAbsImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoQuadraticAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoQuadraticAbsImpl::setX1(const double &x1) -{ - m_x1 = x1; -} - -double SVGPathSegCurvetoQuadraticAbsImpl::x1() const -{ - return m_x1; -} - -void SVGPathSegCurvetoQuadraticAbsImpl::setY1(const double &y1) -{ - m_y1 = y1; -} - -double SVGPathSegCurvetoQuadraticAbsImpl::y1() const -{ - return m_y1; -} - -void SVGPathSegCurvetoQuadraticAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope = SVGAngleImpl::todeg(atan2(y1() - cury, x1() - curx)); - double endSlope = SVGAngleImpl::todeg(atan2(y() - y1(), x() - x1())); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoQuadraticAbsImpl::s_hashTable 5 - x SVGPathSegCurvetoQuadraticAbsImpl::X DontDelete - y SVGPathSegCurvetoQuadraticAbsImpl::Y DontDelete - x1 SVGPathSegCurvetoQuadraticAbsImpl::X1 DontDelete - y1 SVGPathSegCurvetoQuadraticAbsImpl::Y1 DontDelete -@end -*/ - -Value SVGPathSegCurvetoQuadraticAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case X1: - return Number(x1()); - case Y1: - return Number(y1()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoQuadraticAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case X1: - m_x1 = value.toNumber(exec); - break; - case Y1: - m_y1 = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - -SVGPathSegCurvetoQuadraticRelImpl::SVGPathSegCurvetoQuadraticRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoQuadraticRelImpl::~SVGPathSegCurvetoQuadraticRelImpl() -{ -} - -void SVGPathSegCurvetoQuadraticRelImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoQuadraticRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoQuadraticRelImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoQuadraticRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoQuadraticRelImpl::setX1(const double &x1) -{ - m_x1 = x1; -} - -double SVGPathSegCurvetoQuadraticRelImpl::x1() const -{ - return m_x1; -} - -void SVGPathSegCurvetoQuadraticRelImpl::setY1(const double &y1) -{ - m_y1 = y1; -} - -double SVGPathSegCurvetoQuadraticRelImpl::y1() const -{ - return m_y1; -} - -void SVGPathSegCurvetoQuadraticRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - Q_UNUSED(curx); - Q_UNUSED(cury); - double dx = x(); - double dy = y(); - double startSlope = SVGAngleImpl::todeg(atan2(y1(), x1())); - double endSlope = SVGAngleImpl::todeg(atan2(y() - y1(), x() - x1())); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoQuadraticRelImpl::s_hashTable 5 - x SVGPathSegCurvetoQuadraticRelImpl::X DontDelete - y SVGPathSegCurvetoQuadraticRelImpl::Y DontDelete - x1 SVGPathSegCurvetoQuadraticRelImpl::X1 DontDelete - y1 SVGPathSegCurvetoQuadraticRelImpl::Y1 DontDelete -@end -*/ - -Value SVGPathSegCurvetoQuadraticRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - case X1: - return Number(x1()); - case Y1: - return Number(y1()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoQuadraticRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case X1: - m_x1 = value.toNumber(exec); - break; - case Y1: - m_y1 = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cpp b/ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cpp new file mode 100644 index 00000000..fa78804f --- /dev/null +++ b/ksvg/impl/SVGPathSegCurvetoQuadraticImpl.cpp @@ -0,0 +1,258 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegCurvetoQuadraticImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegCurvetoQuadraticImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegCurvetoQuadraticAbsImpl::SVGPathSegCurvetoQuadraticAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoQuadraticAbsImpl::~SVGPathSegCurvetoQuadraticAbsImpl() +{ +} + +void SVGPathSegCurvetoQuadraticAbsImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoQuadraticAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoQuadraticAbsImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoQuadraticAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoQuadraticAbsImpl::setX1(const double &x1) +{ + m_x1 = x1; +} + +double SVGPathSegCurvetoQuadraticAbsImpl::x1() const +{ + return m_x1; +} + +void SVGPathSegCurvetoQuadraticAbsImpl::setY1(const double &y1) +{ + m_y1 = y1; +} + +double SVGPathSegCurvetoQuadraticAbsImpl::y1() const +{ + return m_y1; +} + +void SVGPathSegCurvetoQuadraticAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope = SVGAngleImpl::todeg(atan2(y1() - cury, x1() - curx)); + double endSlope = SVGAngleImpl::todeg(atan2(y() - y1(), x() - x1())); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoQuadraticAbsImpl::s_hashTable 5 + x SVGPathSegCurvetoQuadraticAbsImpl::X DontDelete + y SVGPathSegCurvetoQuadraticAbsImpl::Y DontDelete + x1 SVGPathSegCurvetoQuadraticAbsImpl::X1 DontDelete + y1 SVGPathSegCurvetoQuadraticAbsImpl::Y1 DontDelete +@end +*/ + +Value SVGPathSegCurvetoQuadraticAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case X1: + return Number(x1()); + case Y1: + return Number(y1()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoQuadraticAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case X1: + m_x1 = value.toNumber(exec); + break; + case Y1: + m_y1 = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + +SVGPathSegCurvetoQuadraticRelImpl::SVGPathSegCurvetoQuadraticRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoQuadraticRelImpl::~SVGPathSegCurvetoQuadraticRelImpl() +{ +} + +void SVGPathSegCurvetoQuadraticRelImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoQuadraticRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoQuadraticRelImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoQuadraticRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoQuadraticRelImpl::setX1(const double &x1) +{ + m_x1 = x1; +} + +double SVGPathSegCurvetoQuadraticRelImpl::x1() const +{ + return m_x1; +} + +void SVGPathSegCurvetoQuadraticRelImpl::setY1(const double &y1) +{ + m_y1 = y1; +} + +double SVGPathSegCurvetoQuadraticRelImpl::y1() const +{ + return m_y1; +} + +void SVGPathSegCurvetoQuadraticRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + Q_UNUSED(curx); + Q_UNUSED(cury); + double dx = x(); + double dy = y(); + double startSlope = SVGAngleImpl::todeg(atan2(y1(), x1())); + double endSlope = SVGAngleImpl::todeg(atan2(y() - y1(), x() - x1())); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoQuadraticRelImpl::s_hashTable 5 + x SVGPathSegCurvetoQuadraticRelImpl::X DontDelete + y SVGPathSegCurvetoQuadraticRelImpl::Y DontDelete + x1 SVGPathSegCurvetoQuadraticRelImpl::X1 DontDelete + y1 SVGPathSegCurvetoQuadraticRelImpl::Y1 DontDelete +@end +*/ + +Value SVGPathSegCurvetoQuadraticRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + case X1: + return Number(x1()); + case Y1: + return Number(y1()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoQuadraticRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case X1: + m_x1 = value.toNumber(exec); + break; + case Y1: + m_y1 = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cc b/ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cc deleted file mode 100644 index a6cb362f..00000000 --- a/ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cc +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegCurvetoQuadraticSmoothImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegCurvetoQuadraticSmoothImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegCurvetoQuadraticSmoothAbsImpl::SVGPathSegCurvetoQuadraticSmoothAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoQuadraticSmoothAbsImpl::~SVGPathSegCurvetoQuadraticSmoothAbsImpl() -{ -} - -void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoQuadraticSmoothAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoQuadraticSmoothAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setPreviousX1(double x1) -{ - m_previousX1 = x1; -} - -void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setPreviousY1(double y1) -{ - m_previousY1 = y1; -} - -double SVGPathSegCurvetoQuadraticSmoothAbsImpl::x1(double curx) const -{ - return curx - (m_previousX1 - curx); -} - -double SVGPathSegCurvetoQuadraticSmoothAbsImpl::y1(double cury) const -{ - return cury - (m_previousY1 - cury); -} - -void SVGPathSegCurvetoQuadraticSmoothAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope = SVGAngleImpl::todeg(atan2(y1(cury) - cury, x1(curx) - curx)); - double endSlope = SVGAngleImpl::todeg(atan2(y() - y1(cury), x() - x1(curx))); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoQuadraticSmoothAbsImpl::s_hashTable 3 - x SVGPathSegCurvetoQuadraticSmoothAbsImpl::X DontDelete - y SVGPathSegCurvetoQuadraticSmoothAbsImpl::Y DontDelete -@end -*/ - -Value SVGPathSegCurvetoQuadraticSmoothAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoQuadraticSmoothAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - - -SVGPathSegCurvetoQuadraticSmoothRelImpl::SVGPathSegCurvetoQuadraticSmoothRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegCurvetoQuadraticSmoothRelImpl::~SVGPathSegCurvetoQuadraticSmoothRelImpl() -{ -} - -void SVGPathSegCurvetoQuadraticSmoothRelImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegCurvetoQuadraticSmoothRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegCurvetoQuadraticSmoothRelImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegCurvetoQuadraticSmoothRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegCurvetoQuadraticSmoothRelImpl::setPreviousAbsX1(double x1) -{ - m_previousAbsX1 = x1; -} - -void SVGPathSegCurvetoQuadraticSmoothRelImpl::setPreviousAbsY1(double y1) -{ - m_previousAbsY1 = y1; -} - -double SVGPathSegCurvetoQuadraticSmoothRelImpl::absX1(double curx) const -{ - return curx - (m_previousAbsX1 - curx); -} - -double SVGPathSegCurvetoQuadraticSmoothRelImpl::absY1(double cury) const -{ - return cury - (m_previousAbsY1 - cury); -} - -void SVGPathSegCurvetoQuadraticSmoothRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const -{ - double dx = x(); - double dy = y(); - double startSlope = SVGAngleImpl::todeg(atan2(absY1(cury) - cury, absX1(curx) - curx)); - double endSlope = SVGAngleImpl::todeg(atan2(cury + y() - absY1(cury), curx + x() - absX1(curx))); - *pDx = dx; - *pDy = dy; - *pStartSlope = startSlope; - *pEndSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegCurvetoQuadraticSmoothRelImpl::s_hashTable 3 - x SVGPathSegCurvetoQuadraticSmoothRelImpl::X DontDelete - y SVGPathSegCurvetoQuadraticSmoothRelImpl::Y DontDelete -@end -*/ - -Value SVGPathSegCurvetoQuadraticSmoothRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegCurvetoQuadraticSmoothRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cpp b/ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cpp new file mode 100644 index 00000000..a6cb362f --- /dev/null +++ b/ksvg/impl/SVGPathSegCurvetoQuadraticSmoothImpl.cpp @@ -0,0 +1,233 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegCurvetoQuadraticSmoothImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegCurvetoQuadraticSmoothImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegCurvetoQuadraticSmoothAbsImpl::SVGPathSegCurvetoQuadraticSmoothAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoQuadraticSmoothAbsImpl::~SVGPathSegCurvetoQuadraticSmoothAbsImpl() +{ +} + +void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoQuadraticSmoothAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoQuadraticSmoothAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setPreviousX1(double x1) +{ + m_previousX1 = x1; +} + +void SVGPathSegCurvetoQuadraticSmoothAbsImpl::setPreviousY1(double y1) +{ + m_previousY1 = y1; +} + +double SVGPathSegCurvetoQuadraticSmoothAbsImpl::x1(double curx) const +{ + return curx - (m_previousX1 - curx); +} + +double SVGPathSegCurvetoQuadraticSmoothAbsImpl::y1(double cury) const +{ + return cury - (m_previousY1 - cury); +} + +void SVGPathSegCurvetoQuadraticSmoothAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope = SVGAngleImpl::todeg(atan2(y1(cury) - cury, x1(curx) - curx)); + double endSlope = SVGAngleImpl::todeg(atan2(y() - y1(cury), x() - x1(curx))); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoQuadraticSmoothAbsImpl::s_hashTable 3 + x SVGPathSegCurvetoQuadraticSmoothAbsImpl::X DontDelete + y SVGPathSegCurvetoQuadraticSmoothAbsImpl::Y DontDelete +@end +*/ + +Value SVGPathSegCurvetoQuadraticSmoothAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoQuadraticSmoothAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + + +SVGPathSegCurvetoQuadraticSmoothRelImpl::SVGPathSegCurvetoQuadraticSmoothRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegCurvetoQuadraticSmoothRelImpl::~SVGPathSegCurvetoQuadraticSmoothRelImpl() +{ +} + +void SVGPathSegCurvetoQuadraticSmoothRelImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegCurvetoQuadraticSmoothRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegCurvetoQuadraticSmoothRelImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegCurvetoQuadraticSmoothRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegCurvetoQuadraticSmoothRelImpl::setPreviousAbsX1(double x1) +{ + m_previousAbsX1 = x1; +} + +void SVGPathSegCurvetoQuadraticSmoothRelImpl::setPreviousAbsY1(double y1) +{ + m_previousAbsY1 = y1; +} + +double SVGPathSegCurvetoQuadraticSmoothRelImpl::absX1(double curx) const +{ + return curx - (m_previousAbsX1 - curx); +} + +double SVGPathSegCurvetoQuadraticSmoothRelImpl::absY1(double cury) const +{ + return cury - (m_previousAbsY1 - cury); +} + +void SVGPathSegCurvetoQuadraticSmoothRelImpl::getDeltasAndSlopes(double curx, double cury, double *pDx, double *pDy, double *pStartSlope, double *pEndSlope) const +{ + double dx = x(); + double dy = y(); + double startSlope = SVGAngleImpl::todeg(atan2(absY1(cury) - cury, absX1(curx) - curx)); + double endSlope = SVGAngleImpl::todeg(atan2(cury + y() - absY1(cury), curx + x() - absX1(curx))); + *pDx = dx; + *pDy = dy; + *pStartSlope = startSlope; + *pEndSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegCurvetoQuadraticSmoothRelImpl::s_hashTable 3 + x SVGPathSegCurvetoQuadraticSmoothRelImpl::X DontDelete + y SVGPathSegCurvetoQuadraticSmoothRelImpl::Y DontDelete +@end +*/ + +Value SVGPathSegCurvetoQuadraticSmoothRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegCurvetoQuadraticSmoothRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegImpl.cc b/ksvg/impl/SVGPathSegImpl.cc deleted file mode 100644 index 3ad83d35..00000000 --- a/ksvg/impl/SVGPathSegImpl.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegImpl.h" - -using namespace KSVG; - -#include "SVGPathSegImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_cacheimpl.h" - -SVGPathSegImpl::SVGPathSegImpl() -{ -} - -SVGPathSegImpl::~SVGPathSegImpl() -{ -} - -void SVGPathSegImpl::getDeltasAndSlopes(double, double, double *dx, double *dy, double *startSlope, double *endSlope) const -{ - *dx = 0; - *dy = 0; - *startSlope = 0; - *endSlope = 0; -} - -// Exma stuff - -/* -@namespace KSVG -@begin SVGPathSegImpl::s_hashTable 3 - pathSegType SVGPathSegImpl::PathSegType DontDelete|ReadOnly - pathSegTypeAsLetter SVGPathSegImpl::PathSegTypeAsLetter DontDelete|ReadOnly -@end -*/ - -Value SVGPathSegImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case PathSegType: - return Number(pathSegType()); - case PathSegTypeAsLetter: - return String(pathSegTypeAsLetter().string()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -/* -@namespace KSVG -@begin SVGPathSegImplConstructor::s_hashTable 23 - PATHSEG_UNKNOWN KSVG::PATHSEG_UNKNOWN DontDelete|ReadOnly - PATHSEG_CLOSEPATH KSVG::PATHSEG_CLOSEPATH DontDelete|ReadOnly - PATHSEG_MOVETO_ABS KSVG::PATHSEG_MOVETO_ABS DontDelete|ReadOnly - PATHSEG_MOVETO_REL KSVG::PATHSEG_MOVETO_REL DontDelete|ReadOnly - PATHSEG_LINETO_ABS KSVG::PATHSEG_LINETO_ABS DontDelete|ReadOnly - PATHSEG_LINETO_REL KSVG::PATHSEG_LINETO_REL DontDelete|ReadOnly - PATHSEG_CURVETO_CUBIC_ABS KSVG::PATHSEG_CURVETO_CUBIC_ABS DontDelete|ReadOnly - PATHSEG_CURVETO_CUBIC_REL KSVG::PATHSEG_CURVETO_CUBIC_REL DontDelete|ReadOnly - PATHSEG_CURVETO_QUADRATIC_ABS KSVG::PATHSEG_CURVETO_QUADRATIC_ABS DontDelete|ReadOnly - PATHSEG_CURVETO_QUADRATIC_REL KSVG::PATHSEG_CURVETO_QUADRATIC_REL DontDelete|ReadOnly - PATHSEG_ARC_ABS KSVG::PATHSEG_ARC_ABS DontDelete|ReadOnly - PATHSEG_ARC_REL KSVG::PATHSEG_ARC_REL DontDelete|ReadOnly - PATHSEG_LINETO_HORIZONTAL_ABS KSVG::PATHSEG_LINETO_HORIZONTAL_ABS DontDelete|ReadOnly - PATHSEG_LINETO_HORIZONTAL_REL KSVG::PATHSEG_LINETO_HORIZONTAL_REL DontDelete|ReadOnly - PATHSEG_LINETO_VERTICAL_ABS KSVG::PATHSEG_LINETO_VERTICAL_ABS DontDelete|ReadOnly - PATHSEG_LINETO_VERTICAL_REL KSVG::PATHSEG_LINETO_VERTICAL_REL DontDelete|ReadOnly - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS KSVG::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS DontDelete|ReadOnly - PATHSEG_CURVETO_CUBIC_SMOOTH_REL KSVG::PATHSEG_CURVETO_CUBIC_SMOOTH_REL DontDelete|ReadOnly - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS KSVG::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS DontDelete|ReadOnly - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL KSVG::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL DontDelete|ReadOnly -@end -*/ - -Value SVGPathSegImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGPathSegImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgpathseg.constructor]]"); -} diff --git a/ksvg/impl/SVGPathSegImpl.cpp b/ksvg/impl/SVGPathSegImpl.cpp new file mode 100644 index 00000000..3ad83d35 --- /dev/null +++ b/ksvg/impl/SVGPathSegImpl.cpp @@ -0,0 +1,105 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegImpl.h" + +using namespace KSVG; + +#include "SVGPathSegImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_cacheimpl.h" + +SVGPathSegImpl::SVGPathSegImpl() +{ +} + +SVGPathSegImpl::~SVGPathSegImpl() +{ +} + +void SVGPathSegImpl::getDeltasAndSlopes(double, double, double *dx, double *dy, double *startSlope, double *endSlope) const +{ + *dx = 0; + *dy = 0; + *startSlope = 0; + *endSlope = 0; +} + +// Exma stuff + +/* +@namespace KSVG +@begin SVGPathSegImpl::s_hashTable 3 + pathSegType SVGPathSegImpl::PathSegType DontDelete|ReadOnly + pathSegTypeAsLetter SVGPathSegImpl::PathSegTypeAsLetter DontDelete|ReadOnly +@end +*/ + +Value SVGPathSegImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case PathSegType: + return Number(pathSegType()); + case PathSegTypeAsLetter: + return String(pathSegTypeAsLetter().string()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +/* +@namespace KSVG +@begin SVGPathSegImplConstructor::s_hashTable 23 + PATHSEG_UNKNOWN KSVG::PATHSEG_UNKNOWN DontDelete|ReadOnly + PATHSEG_CLOSEPATH KSVG::PATHSEG_CLOSEPATH DontDelete|ReadOnly + PATHSEG_MOVETO_ABS KSVG::PATHSEG_MOVETO_ABS DontDelete|ReadOnly + PATHSEG_MOVETO_REL KSVG::PATHSEG_MOVETO_REL DontDelete|ReadOnly + PATHSEG_LINETO_ABS KSVG::PATHSEG_LINETO_ABS DontDelete|ReadOnly + PATHSEG_LINETO_REL KSVG::PATHSEG_LINETO_REL DontDelete|ReadOnly + PATHSEG_CURVETO_CUBIC_ABS KSVG::PATHSEG_CURVETO_CUBIC_ABS DontDelete|ReadOnly + PATHSEG_CURVETO_CUBIC_REL KSVG::PATHSEG_CURVETO_CUBIC_REL DontDelete|ReadOnly + PATHSEG_CURVETO_QUADRATIC_ABS KSVG::PATHSEG_CURVETO_QUADRATIC_ABS DontDelete|ReadOnly + PATHSEG_CURVETO_QUADRATIC_REL KSVG::PATHSEG_CURVETO_QUADRATIC_REL DontDelete|ReadOnly + PATHSEG_ARC_ABS KSVG::PATHSEG_ARC_ABS DontDelete|ReadOnly + PATHSEG_ARC_REL KSVG::PATHSEG_ARC_REL DontDelete|ReadOnly + PATHSEG_LINETO_HORIZONTAL_ABS KSVG::PATHSEG_LINETO_HORIZONTAL_ABS DontDelete|ReadOnly + PATHSEG_LINETO_HORIZONTAL_REL KSVG::PATHSEG_LINETO_HORIZONTAL_REL DontDelete|ReadOnly + PATHSEG_LINETO_VERTICAL_ABS KSVG::PATHSEG_LINETO_VERTICAL_ABS DontDelete|ReadOnly + PATHSEG_LINETO_VERTICAL_REL KSVG::PATHSEG_LINETO_VERTICAL_REL DontDelete|ReadOnly + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS KSVG::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS DontDelete|ReadOnly + PATHSEG_CURVETO_CUBIC_SMOOTH_REL KSVG::PATHSEG_CURVETO_CUBIC_SMOOTH_REL DontDelete|ReadOnly + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS KSVG::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS DontDelete|ReadOnly + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL KSVG::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL DontDelete|ReadOnly +@end +*/ + +Value SVGPathSegImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGPathSegImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgpathseg.constructor]]"); +} diff --git a/ksvg/impl/SVGPathSegLinetoHorizontalImpl.cc b/ksvg/impl/SVGPathSegLinetoHorizontalImpl.cc deleted file mode 100644 index a0f11829..00000000 --- a/ksvg/impl/SVGPathSegLinetoHorizontalImpl.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegLinetoHorizontalImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegLinetoHorizontalImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegLinetoHorizontalAbsImpl::SVGPathSegLinetoHorizontalAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegLinetoHorizontalAbsImpl::~SVGPathSegLinetoHorizontalAbsImpl() -{ -} - -void SVGPathSegLinetoHorizontalAbsImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegLinetoHorizontalAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegLinetoHorizontalAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - Q_UNUSED(cury); - double dx = x() - curx; - double dy = 0; - double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); - double endSlope = startSlope; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegLinetoHorizontalAbsImpl::s_hashTable 2 - x SVGPathSegLinetoHorizontalAbsImpl::X DontDelete -@end -*/ - -Value SVGPathSegLinetoHorizontalAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegLinetoHorizontalAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - - - -SVGPathSegLinetoHorizontalRelImpl::SVGPathSegLinetoHorizontalRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegLinetoHorizontalRelImpl::~SVGPathSegLinetoHorizontalRelImpl() -{ -} - -void SVGPathSegLinetoHorizontalRelImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegLinetoHorizontalRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegLinetoHorizontalRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - Q_UNUSED(curx); - Q_UNUSED(cury); - double dx = x(); - double dy = 0; - double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); - double endSlope = startSlope; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegLinetoHorizontalRelImpl::s_hashTable 2 - x SVGPathSegLinetoHorizontalRelImpl::X DontDelete -@end -*/ - -Value SVGPathSegLinetoHorizontalRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegLinetoHorizontalRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegLinetoHorizontalImpl.cpp b/ksvg/impl/SVGPathSegLinetoHorizontalImpl.cpp new file mode 100644 index 00000000..a0f11829 --- /dev/null +++ b/ksvg/impl/SVGPathSegLinetoHorizontalImpl.cpp @@ -0,0 +1,165 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegLinetoHorizontalImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegLinetoHorizontalImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegLinetoHorizontalAbsImpl::SVGPathSegLinetoHorizontalAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegLinetoHorizontalAbsImpl::~SVGPathSegLinetoHorizontalAbsImpl() +{ +} + +void SVGPathSegLinetoHorizontalAbsImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegLinetoHorizontalAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegLinetoHorizontalAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + Q_UNUSED(cury); + double dx = x() - curx; + double dy = 0; + double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); + double endSlope = startSlope; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegLinetoHorizontalAbsImpl::s_hashTable 2 + x SVGPathSegLinetoHorizontalAbsImpl::X DontDelete +@end +*/ + +Value SVGPathSegLinetoHorizontalAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegLinetoHorizontalAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + + + +SVGPathSegLinetoHorizontalRelImpl::SVGPathSegLinetoHorizontalRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegLinetoHorizontalRelImpl::~SVGPathSegLinetoHorizontalRelImpl() +{ +} + +void SVGPathSegLinetoHorizontalRelImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegLinetoHorizontalRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegLinetoHorizontalRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + Q_UNUSED(curx); + Q_UNUSED(cury); + double dx = x(); + double dy = 0; + double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); + double endSlope = startSlope; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegLinetoHorizontalRelImpl::s_hashTable 2 + x SVGPathSegLinetoHorizontalRelImpl::X DontDelete +@end +*/ + +Value SVGPathSegLinetoHorizontalRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegLinetoHorizontalRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegLinetoImpl.cc b/ksvg/impl/SVGPathSegLinetoImpl.cc deleted file mode 100644 index c47b6fcc..00000000 --- a/ksvg/impl/SVGPathSegLinetoImpl.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegLinetoImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegLinetoImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegLinetoAbsImpl::SVGPathSegLinetoAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegLinetoAbsImpl::~SVGPathSegLinetoAbsImpl() -{ -} - -void SVGPathSegLinetoAbsImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegLinetoAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegLinetoAbsImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegLinetoAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegLinetoAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); - double endSlope = startSlope; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegLinetoAbsImpl::s_hashTable 3 - x SVGPathSegLinetoAbsImpl::X DontDelete - y SVGPathSegLinetoAbsImpl::Y DontDelete -@end -*/ - -Value SVGPathSegLinetoAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegLinetoAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - -SVGPathSegLinetoRelImpl::SVGPathSegLinetoRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegLinetoRelImpl::~SVGPathSegLinetoRelImpl() -{ -} - -void SVGPathSegLinetoRelImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegLinetoRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegLinetoRelImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegLinetoRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegLinetoRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - Q_UNUSED(curx); - Q_UNUSED(cury); - double dx = x(); - double dy = y(); - double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); - double endSlope = startSlope; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegLinetoRelImpl::s_hashTable 3 - x SVGPathSegLinetoRelImpl::X DontDelete - y SVGPathSegLinetoRelImpl::Y DontDelete -@end -*/ - -Value SVGPathSegLinetoRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegLinetoRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegLinetoImpl.cpp b/ksvg/impl/SVGPathSegLinetoImpl.cpp new file mode 100644 index 00000000..c47b6fcc --- /dev/null +++ b/ksvg/impl/SVGPathSegLinetoImpl.cpp @@ -0,0 +1,194 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegLinetoImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegLinetoImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegLinetoAbsImpl::SVGPathSegLinetoAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegLinetoAbsImpl::~SVGPathSegLinetoAbsImpl() +{ +} + +void SVGPathSegLinetoAbsImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegLinetoAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegLinetoAbsImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegLinetoAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegLinetoAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); + double endSlope = startSlope; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegLinetoAbsImpl::s_hashTable 3 + x SVGPathSegLinetoAbsImpl::X DontDelete + y SVGPathSegLinetoAbsImpl::Y DontDelete +@end +*/ + +Value SVGPathSegLinetoAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegLinetoAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + +SVGPathSegLinetoRelImpl::SVGPathSegLinetoRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegLinetoRelImpl::~SVGPathSegLinetoRelImpl() +{ +} + +void SVGPathSegLinetoRelImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegLinetoRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegLinetoRelImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegLinetoRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegLinetoRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + Q_UNUSED(curx); + Q_UNUSED(cury); + double dx = x(); + double dy = y(); + double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); + double endSlope = startSlope; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegLinetoRelImpl::s_hashTable 3 + x SVGPathSegLinetoRelImpl::X DontDelete + y SVGPathSegLinetoRelImpl::Y DontDelete +@end +*/ + +Value SVGPathSegLinetoRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegLinetoRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegLinetoVerticalImpl.cc b/ksvg/impl/SVGPathSegLinetoVerticalImpl.cc deleted file mode 100644 index 47ced875..00000000 --- a/ksvg/impl/SVGPathSegLinetoVerticalImpl.cc +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegLinetoVerticalImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegLinetoVerticalImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegLinetoVerticalAbsImpl::SVGPathSegLinetoVerticalAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegLinetoVerticalAbsImpl::~SVGPathSegLinetoVerticalAbsImpl() -{ -} - -void SVGPathSegLinetoVerticalAbsImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegLinetoVerticalAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegLinetoVerticalAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - Q_UNUSED(curx); - double dx = 0; - double dy = y() - cury; - double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); - double endSlope = startSlope; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegLinetoVerticalAbsImpl::s_hashTable 2 - y SVGPathSegLinetoVerticalAbsImpl::Y DontDelete -@end -*/ - -Value SVGPathSegLinetoVerticalAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegLinetoVerticalAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - -SVGPathSegLinetoVerticalRelImpl::SVGPathSegLinetoVerticalRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegLinetoVerticalRelImpl::~SVGPathSegLinetoVerticalRelImpl() -{ -} - -void SVGPathSegLinetoVerticalRelImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegLinetoVerticalRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegLinetoVerticalRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - Q_UNUSED(curx); - Q_UNUSED(cury); - double dx = 0; - double dy = y(); - double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); - double endSlope = startSlope; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegLinetoVerticalRelImpl::s_hashTable 2 - y SVGPathSegLinetoVerticalRelImpl::Y DontDelete -@end -*/ - -Value SVGPathSegLinetoVerticalRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegLinetoVerticalRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegLinetoVerticalImpl.cpp b/ksvg/impl/SVGPathSegLinetoVerticalImpl.cpp new file mode 100644 index 00000000..47ced875 --- /dev/null +++ b/ksvg/impl/SVGPathSegLinetoVerticalImpl.cpp @@ -0,0 +1,163 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegLinetoVerticalImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegLinetoVerticalImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegLinetoVerticalAbsImpl::SVGPathSegLinetoVerticalAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegLinetoVerticalAbsImpl::~SVGPathSegLinetoVerticalAbsImpl() +{ +} + +void SVGPathSegLinetoVerticalAbsImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegLinetoVerticalAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegLinetoVerticalAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + Q_UNUSED(curx); + double dx = 0; + double dy = y() - cury; + double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); + double endSlope = startSlope; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegLinetoVerticalAbsImpl::s_hashTable 2 + y SVGPathSegLinetoVerticalAbsImpl::Y DontDelete +@end +*/ + +Value SVGPathSegLinetoVerticalAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegLinetoVerticalAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + +SVGPathSegLinetoVerticalRelImpl::SVGPathSegLinetoVerticalRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegLinetoVerticalRelImpl::~SVGPathSegLinetoVerticalRelImpl() +{ +} + +void SVGPathSegLinetoVerticalRelImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegLinetoVerticalRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegLinetoVerticalRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + Q_UNUSED(curx); + Q_UNUSED(cury); + double dx = 0; + double dy = y(); + double startSlope = SVGAngleImpl::todeg(atan2(dy, dx)); + double endSlope = startSlope; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegLinetoVerticalRelImpl::s_hashTable 2 + y SVGPathSegLinetoVerticalRelImpl::Y DontDelete +@end +*/ + +Value SVGPathSegLinetoVerticalRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegLinetoVerticalRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPathSegListImpl.cc b/ksvg/impl/SVGPathSegListImpl.cc deleted file mode 100644 index 7e3ff83e..00000000 --- a/ksvg/impl/SVGPathSegListImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegListImpl.h" - -using namespace KSVG; - -#include "SVGPathSegListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegListImpl::s_hashTable 2 - numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGPathSegListImplProto::s_hashTable 11 - getItem SVGListDefs::GetItem DontDelete|Function 1 - removeItem SVGListDefs::RemoveItem DontDelete|Function 1 - appendItem SVGListDefs::AppendItem DontDelete|Function 1 - initialize SVGListDefs::Initialize DontDelete|Function 1 - insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 - replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 - clear SVGListDefs::Clear DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGPathSegList", SVGPathSegListImplProto, SVGPathSegListImplProtoFunc) - -Value SVGPathSegListImpl::getValueProperty(ExecState *exec, int token) const -{ - return SVGList::getValueProperty(exec, token); -} - -Value SVGPathSegListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGPathSegListImpl) - - return obj->call(exec, static_cast *>(obj), args, id); -} diff --git a/ksvg/impl/SVGPathSegListImpl.cpp b/ksvg/impl/SVGPathSegListImpl.cpp new file mode 100644 index 00000000..7e3ff83e --- /dev/null +++ b/ksvg/impl/SVGPathSegListImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegListImpl.h" + +using namespace KSVG; + +#include "SVGPathSegListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegListImpl::s_hashTable 2 + numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGPathSegListImplProto::s_hashTable 11 + getItem SVGListDefs::GetItem DontDelete|Function 1 + removeItem SVGListDefs::RemoveItem DontDelete|Function 1 + appendItem SVGListDefs::AppendItem DontDelete|Function 1 + initialize SVGListDefs::Initialize DontDelete|Function 1 + insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 + replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 + clear SVGListDefs::Clear DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGPathSegList", SVGPathSegListImplProto, SVGPathSegListImplProtoFunc) + +Value SVGPathSegListImpl::getValueProperty(ExecState *exec, int token) const +{ + return SVGList::getValueProperty(exec, token); +} + +Value SVGPathSegListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGPathSegListImpl) + + return obj->call(exec, static_cast *>(obj), args, id); +} diff --git a/ksvg/impl/SVGPathSegMovetoImpl.cc b/ksvg/impl/SVGPathSegMovetoImpl.cc deleted file mode 100644 index 0cafbc25..00000000 --- a/ksvg/impl/SVGPathSegMovetoImpl.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPathSegMovetoImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -#include "SVGPathSegMovetoImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGPathSegMovetoAbsImpl::SVGPathSegMovetoAbsImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegMovetoAbsImpl::~SVGPathSegMovetoAbsImpl() -{ -} - -void SVGPathSegMovetoAbsImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegMovetoAbsImpl::x() const -{ - return m_x; -} - -void SVGPathSegMovetoAbsImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegMovetoAbsImpl::y() const -{ - return m_y; -} - -void SVGPathSegMovetoAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - double dx = x() - curx; - double dy = y() - cury; - double startSlope = 0; - double endSlope = 0; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegMovetoAbsImpl::s_hashTable 3 - x SVGPathSegMovetoAbsImpl::X DontDelete - y SVGPathSegMovetoAbsImpl::Y DontDelete -@end -*/ - -Value SVGPathSegMovetoAbsImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegMovetoAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - - - -SVGPathSegMovetoRelImpl::SVGPathSegMovetoRelImpl() : SVGPathSegImpl() -{ - KSVG_EMPTY_FLAGS -} - -SVGPathSegMovetoRelImpl::~SVGPathSegMovetoRelImpl() -{ -} - -void SVGPathSegMovetoRelImpl::setX(const double &x) -{ - m_x = x; -} - -double SVGPathSegMovetoRelImpl::x() const -{ - return m_x; -} - -void SVGPathSegMovetoRelImpl::setY(const double &y) -{ - m_y = y; -} - -double SVGPathSegMovetoRelImpl::y() const -{ - return m_y; -} - -void SVGPathSegMovetoRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const -{ - Q_UNUSED(curx); - Q_UNUSED(cury); - double dx = x(); - double dy = y(); - double startSlope = 0; - double endSlope = 0; - *pdx = dx; - *pdy = dy; - *pstartSlope = startSlope; - *pendSlope = endSlope; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPathSegMovetoRelImpl::s_hashTable 3 - x SVGPathSegMovetoRelImpl::X DontDelete - y SVGPathSegMovetoRelImpl::Y DontDelete -@end -*/ - -Value SVGPathSegMovetoRelImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPathSegMovetoRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPathSegMovetoImpl.cpp b/ksvg/impl/SVGPathSegMovetoImpl.cpp new file mode 100644 index 00000000..0cafbc25 --- /dev/null +++ b/ksvg/impl/SVGPathSegMovetoImpl.cpp @@ -0,0 +1,194 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPathSegMovetoImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +#include "SVGPathSegMovetoImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGPathSegMovetoAbsImpl::SVGPathSegMovetoAbsImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegMovetoAbsImpl::~SVGPathSegMovetoAbsImpl() +{ +} + +void SVGPathSegMovetoAbsImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegMovetoAbsImpl::x() const +{ + return m_x; +} + +void SVGPathSegMovetoAbsImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegMovetoAbsImpl::y() const +{ + return m_y; +} + +void SVGPathSegMovetoAbsImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + double dx = x() - curx; + double dy = y() - cury; + double startSlope = 0; + double endSlope = 0; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegMovetoAbsImpl::s_hashTable 3 + x SVGPathSegMovetoAbsImpl::X DontDelete + y SVGPathSegMovetoAbsImpl::Y DontDelete +@end +*/ + +Value SVGPathSegMovetoAbsImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegMovetoAbsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + + + +SVGPathSegMovetoRelImpl::SVGPathSegMovetoRelImpl() : SVGPathSegImpl() +{ + KSVG_EMPTY_FLAGS +} + +SVGPathSegMovetoRelImpl::~SVGPathSegMovetoRelImpl() +{ +} + +void SVGPathSegMovetoRelImpl::setX(const double &x) +{ + m_x = x; +} + +double SVGPathSegMovetoRelImpl::x() const +{ + return m_x; +} + +void SVGPathSegMovetoRelImpl::setY(const double &y) +{ + m_y = y; +} + +double SVGPathSegMovetoRelImpl::y() const +{ + return m_y; +} + +void SVGPathSegMovetoRelImpl::getDeltasAndSlopes(double curx, double cury, double *pdx, double *pdy, double *pstartSlope, double *pendSlope) const +{ + Q_UNUSED(curx); + Q_UNUSED(cury); + double dx = x(); + double dy = y(); + double startSlope = 0; + double endSlope = 0; + *pdx = dx; + *pdy = dy; + *pstartSlope = startSlope; + *pendSlope = endSlope; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPathSegMovetoRelImpl::s_hashTable 3 + x SVGPathSegMovetoRelImpl::X DontDelete + y SVGPathSegMovetoRelImpl::Y DontDelete +@end +*/ + +Value SVGPathSegMovetoRelImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPathSegMovetoRelImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPatternElementImpl.cc b/ksvg/impl/SVGPatternElementImpl.cc deleted file mode 100644 index 37825869..00000000 --- a/ksvg/impl/SVGPatternElementImpl.cc +++ /dev/null @@ -1,509 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "SVGPatternElement.h" -#include "SVGPatternElementImpl.h" - -#include "CanvasFactory.h" -#include "KSVGCanvas.h" -#include "CanvasItems.h" -#include "SVGHelperImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGAnimatedTransformListImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGUnitConverter.h" -#include "SVGShapeImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGRectImpl.h" - -using namespace KSVG; - -#include "SVGPatternElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -TQValueList SVGPatternElementImpl::m_patternElements; - -SVGPatternElementImpl::SVGPatternElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFitToViewBoxImpl(), SVGPaintServerImpl() -{ - KSVG_EMPTY_FLAGS - - m_patternUnits = new SVGAnimatedEnumerationImpl(); - m_patternUnits->ref(); - - m_patternContentUnits = new SVGAnimatedEnumerationImpl(); - m_patternContentUnits->ref(); - - m_patternTransform = new SVGAnimatedTransformListImpl(); - m_patternTransform->ref(); - - m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y->ref(); - - m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_height->ref(); - - m_converter = new SVGUnitConverter(); - m_converter->add(m_x); - m_converter->add(m_y); - m_converter->add(m_width); - m_converter->add(m_height); - - m_patternElements.append(this); - - m_canvas = 0; - m_location = this; - - m_tileCache.setMaxTotalCost(1024 * 1024); -} - -SVGPatternElementImpl::~SVGPatternElementImpl() -{ - if(m_patternUnits) - m_patternUnits->deref(); - if(m_patternContentUnits) - m_patternContentUnits->deref(); - if(m_patternTransform) - m_patternTransform->deref(); - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - delete m_converter; - m_patternElements.remove(this); -} - -SVGAnimatedEnumerationImpl *SVGPatternElementImpl::patternUnits() const -{ - return m_patternUnits; -} - -SVGAnimatedEnumerationImpl *SVGPatternElementImpl::patternContentUnits() const -{ - return m_patternContentUnits; -} - -SVGAnimatedTransformListImpl *SVGPatternElementImpl::patternTransform() const -{ - return m_patternTransform; -} - -SVGAnimatedLengthImpl *SVGPatternElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGPatternElementImpl::y() const -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGPatternElementImpl::width() const -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGPatternElementImpl::height() const -{ - return m_height; -} - -void SVGPatternElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_paintServer) - m_paintServer = c->createPaintServer(this); -} - -void SVGPatternElementImpl::removeItem(KSVGCanvas *) -{ - delete m_paintServer; - m_paintServer = 0; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPatternElementImpl::s_hashTable 11 - x SVGPatternElementImpl::X DontDelete|ReadOnly - y SVGPatternElementImpl::Y DontDelete|ReadOnly - width SVGPatternElementImpl::Width DontDelete|ReadOnly - height SVGPatternElementImpl::Height DontDelete|ReadOnly - patternUnits SVGPatternElementImpl::PatternUnits DontDelete|ReadOnly - patternContentUnits SVGPatternElementImpl::PatternContentUnits DontDelete|ReadOnly - patternTransform SVGPatternElementImpl::PatternTransform DontDelete|ReadOnly -@end -*/ - -Value SVGPatternElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X: - if(!attributeMode) - return m_x->cache(exec); - else - return Number(m_x->baseVal()->value()); - case Y: - if(!attributeMode) - return m_y->cache(exec); - else - return Number(m_y->baseVal()->value()); - case Width: - if(!attributeMode) - return m_width->cache(exec); - else - return Number(m_width->baseVal()->value()); - case Height: - if(!attributeMode) - return m_height->cache(exec); - else - return Number(m_height->baseVal()->value()); - case PatternUnits: - if(!attributeMode) - return m_patternUnits->cache(exec); - else - return Number(m_patternUnits->baseVal()); - case PatternContentUnits: - if(!attributeMode) - return m_patternContentUnits->cache(exec); - else - return Number(m_patternContentUnits->baseVal()); - case PatternTransform: - //if(!attributeMode) - return m_patternTransform->cache(exec); - //else - // return Number(m_patternTransform->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPatternElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X: - converter()->modify(x(), value.toString(exec).qstring()); - break; - case Y: - converter()->modify(y(), value.toString(exec).qstring()); - break; - case Width: - converter()->modify(width(), value.toString(exec).qstring()); - if(width()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute width of element is illegal")); - break; - case Height: - converter()->modify(height(), value.toString(exec).qstring()); - if(height()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute height of element is illegal")); - break; - case PatternUnits: - if(value.toString(exec).qstring() == "userSpaceOnUse") - m_patternUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); - else - m_patternUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); - break; - case PatternContentUnits: - if(value.toString(exec).qstring() == "userSpaceOnUse") - m_patternContentUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); - else - m_patternContentUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); - break; - case PatternTransform: - m_patternTransform->baseVal()->clear(); - SVGHelperImpl::parseTransformAttribute(m_patternTransform->baseVal(), value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGPatternElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if attribute not specified, use a value of 0 - if(KSVG_TOKEN_NOT_PARSED(X)) - KSVG_SET_ALT_ATTRIBUTE(X, "0") - - // Spec: if attribute not specified, use a value of 0 - if(KSVG_TOKEN_NOT_PARSED(Y)) - KSVG_SET_ALT_ATTRIBUTE(Y, "0") - - // Spec: if attribute not specified, use objectBoundingBox - if(KSVG_TOKEN_NOT_PARSED(PatternUnits)) - KSVG_SET_ALT_ATTRIBUTE(PatternUnits, "objectBoundingBox") - - // Spec: If attribute not specified, use userSpaceOnUse - if(KSVG_TOKEN_NOT_PARSED(PatternContentUnits)) - KSVG_SET_ALT_ATTRIBUTE(PatternContentUnits, "userSpaceOnUse") - - // Spec: default value - if(KSVG_TOKEN_NOT_PARSED(PreserveAspectRatio)) - KSVG_SET_ALT_ATTRIBUTE(PreserveAspectRatio, "xMidYMid meet") -} - -void SVGPatternElementImpl::flushCachedTiles() -{ - TQValueList::iterator it; - - for(it = m_patternElements.begin(); it != m_patternElements.end(); it++) - { - SVGPatternElementImpl *pattern = *it; - - if(pattern->paintServer()) - pattern->paintServer()->resetFinalized(); - } -} - -TQImage SVGPatternElementImpl::createTile(SVGShapeImpl *referencingElement, int imageWidth, int imageHeight) -{ - converter()->finalize(referencingElement, ownerSVGElement(), patternUnits()->baseVal()); - - TQImage image(imageWidth, imageHeight, 32); - image.setAlphaBuffer(true); - - if(m_canvas == 0) - { - m_canvas = CanvasFactory::self()->loadCanvas(image.width(), image.height()); - m_canvas->setBackgroundColor(tqRgba(0, 0, 0, 0)); - } - - m_canvas->setup(image.bits(), image.width(), image.height()); - - SVGMatrixImpl *baseMatrix = SVGSVGElementImpl::createSVGMatrix(); - - // Set the scale to map the tile onto the integral sized image - double xScale = static_cast(imageWidth) / width()->baseVal()->value(); - double yScale = static_cast(imageHeight) / height()->baseVal()->value(); - - baseMatrix->scaleNonUniform(xScale, yScale); - - if(hasAttribute("viewBox")) - { - SVGMatrixImpl *viewboxMatrix = viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value()); - - baseMatrix->multiply(viewboxMatrix); - viewboxMatrix->deref(); - } - else - { - if(patternContentUnits()->baseVal() == SVGPatternElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) - { - // Get local coordinate bounding box - SVGRectImpl *rect = referencingElement->getBBox(); - - baseMatrix->translate(rect->qrect().x(), rect->qrect().y()); - baseMatrix->scaleNonUniform(rect->qrect().width(), rect->qrect().height()); - rect->deref(); - } - } - - for(DOM::Node node = m_location->firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - SVGShapeImpl *shape = dynamic_cast(element); - SVGTestsImpl *tests = dynamic_cast(element); - SVGStylableImpl *style = dynamic_cast(element); - - bool ok = tests ? tests->ok() : true; - if(element && shape && style && ok && style->getVisible() && style->getDisplay()) - { - SVGLocatableImpl *locatable = dynamic_cast(element); - if(locatable) - locatable->updateCachedScreenCTM(baseMatrix); - - element->createItem(m_canvas); - if(shape->item()) - { - shape->item()->setReferenced(true); - m_canvas->invalidate(shape->item(), true); - } - } - } - - baseMatrix->deref(); - - m_canvas->update(float(1)); - - if(getOverflow()) - { - TQPtrList items = m_canvas->allItems(); - TQRect allItemsBBox; - - TQPtrListIterator it(items); - CanvasItem *item; - - while((item = *it) != 0) - { - TQRect bbox = item->bbox(); - allItemsBBox |= bbox; - ++it; - } - - if(allItemsBBox.left() < 0 || allItemsBBox.right() >= imageWidth || allItemsBBox.top() < 0 || allItemsBBox.bottom() >= imageHeight) - { - // Get the range in whole-tile units that covers the bounding box, where (0, 0) is the - // usual tile position. - int tileLeft = (allItemsBBox.left() - (imageWidth - 1)) / imageWidth; - int tileRight = allItemsBBox.right() / imageWidth; - int tileTop = (allItemsBBox.top() - (imageHeight - 1)) / imageHeight; - int tileBottom = allItemsBBox.bottom() / imageHeight; - - for(int tileX = tileLeft; tileX <= tileRight; tileX++) - { - for(int tileY = tileTop; tileY <= tileBottom; tileY++) - { - if(tileX != 0 || tileY !=0) - { - TQPoint panPoint(-(tileX * imageWidth), -(tileY * imageHeight)); - m_canvas->update(panPoint, false); - } - } - } - } - } - - for(DOM::Node node = m_location->firstChild(); !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - - if(element) - element->removeItem(m_canvas); - } - - return image; -} - -void SVGPatternElementImpl::reference(const TQString &href) -{ - // Copy attributes - SVGElementImpl *src = ownerSVGElement()->getElementById(href); - - if(src) - { - SVGHelperImpl::copyAttributes(src, this); - - // Spec: Change location to referenced element so we - // can take the children elements to render from there - if(m_location == this) - m_location = src; - } -} - -void SVGPatternElementImpl::finalizePaintServer() -{ - // Clear out any cached tiles since we may be being refinalised after an image - // inside a pattern has finished loading. - m_tileCache.clear(); - - TQString _href = SVGURIReferenceImpl::getTarget(href()->baseVal().string()); - if(!_href.isEmpty()) - reference(_href); -} - -SVGPatternElementImpl::Tile SVGPatternElementImpl::createTile(SVGShapeImpl *referencingElement) -{ - converter()->finalize(referencingElement, ownerSVGElement(), patternUnits()->baseVal()); - - SVGTransformableImpl *transformable = dynamic_cast(referencingElement); - SVGMatrixImpl *matrix = 0; - if(transformable) - matrix = transformable->getScreenCTM(); - else - matrix = SVGSVGElementImpl::createSVGMatrix(); - - matrix->translate(x()->baseVal()->value(), y()->baseVal()->value()); - - SVGMatrixImpl *patTransform = patternTransform()->baseVal()->concatenate(); - if(patTransform) - { - matrix->multiply(patTransform); - patTransform->deref(); - } - - double xScale, yScale; - matrix->removeScale(&xScale, &yScale); - - double tileWidth = width()->baseVal()->value() * xScale; - double tileHeight = height()->baseVal()->value() * yScale; - - int imageWidth = static_cast(tileWidth + 0.5); - int imageHeight = static_cast(tileHeight + 0.5); - - Tile tile; - - if(imageWidth > 0 && imageHeight > 0) - { - TQSize size(imageWidth, imageHeight); - TQImage image; - - if(!m_tileCache.find(size, image)) - { - image = createTile(referencingElement, imageWidth, imageHeight); - m_tileCache.insert(size, image, image.width() * image.height() * 4); - } - - // Map integral tile dimensions onto its true size - double adjustXScale = tileWidth / imageWidth; - double adjustYScale = tileHeight / imageHeight; - - matrix->scaleNonUniform(adjustXScale, adjustYScale); - TQWMatrix screenToTile = matrix->qmatrix().invert(); - - tile = Tile(image, screenToTile); - } - - matrix->deref(); - - return tile; -} - diff --git a/ksvg/impl/SVGPatternElementImpl.cpp b/ksvg/impl/SVGPatternElementImpl.cpp new file mode 100644 index 00000000..37825869 --- /dev/null +++ b/ksvg/impl/SVGPatternElementImpl.cpp @@ -0,0 +1,509 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "SVGPatternElement.h" +#include "SVGPatternElementImpl.h" + +#include "CanvasFactory.h" +#include "KSVGCanvas.h" +#include "CanvasItems.h" +#include "SVGHelperImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGAnimatedTransformListImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGUnitConverter.h" +#include "SVGShapeImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGRectImpl.h" + +using namespace KSVG; + +#include "SVGPatternElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +TQValueList SVGPatternElementImpl::m_patternElements; + +SVGPatternElementImpl::SVGPatternElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFitToViewBoxImpl(), SVGPaintServerImpl() +{ + KSVG_EMPTY_FLAGS + + m_patternUnits = new SVGAnimatedEnumerationImpl(); + m_patternUnits->ref(); + + m_patternContentUnits = new SVGAnimatedEnumerationImpl(); + m_patternContentUnits->ref(); + + m_patternTransform = new SVGAnimatedTransformListImpl(); + m_patternTransform->ref(); + + m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y->ref(); + + m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_height->ref(); + + m_converter = new SVGUnitConverter(); + m_converter->add(m_x); + m_converter->add(m_y); + m_converter->add(m_width); + m_converter->add(m_height); + + m_patternElements.append(this); + + m_canvas = 0; + m_location = this; + + m_tileCache.setMaxTotalCost(1024 * 1024); +} + +SVGPatternElementImpl::~SVGPatternElementImpl() +{ + if(m_patternUnits) + m_patternUnits->deref(); + if(m_patternContentUnits) + m_patternContentUnits->deref(); + if(m_patternTransform) + m_patternTransform->deref(); + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + delete m_converter; + m_patternElements.remove(this); +} + +SVGAnimatedEnumerationImpl *SVGPatternElementImpl::patternUnits() const +{ + return m_patternUnits; +} + +SVGAnimatedEnumerationImpl *SVGPatternElementImpl::patternContentUnits() const +{ + return m_patternContentUnits; +} + +SVGAnimatedTransformListImpl *SVGPatternElementImpl::patternTransform() const +{ + return m_patternTransform; +} + +SVGAnimatedLengthImpl *SVGPatternElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGPatternElementImpl::y() const +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGPatternElementImpl::width() const +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGPatternElementImpl::height() const +{ + return m_height; +} + +void SVGPatternElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_paintServer) + m_paintServer = c->createPaintServer(this); +} + +void SVGPatternElementImpl::removeItem(KSVGCanvas *) +{ + delete m_paintServer; + m_paintServer = 0; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPatternElementImpl::s_hashTable 11 + x SVGPatternElementImpl::X DontDelete|ReadOnly + y SVGPatternElementImpl::Y DontDelete|ReadOnly + width SVGPatternElementImpl::Width DontDelete|ReadOnly + height SVGPatternElementImpl::Height DontDelete|ReadOnly + patternUnits SVGPatternElementImpl::PatternUnits DontDelete|ReadOnly + patternContentUnits SVGPatternElementImpl::PatternContentUnits DontDelete|ReadOnly + patternTransform SVGPatternElementImpl::PatternTransform DontDelete|ReadOnly +@end +*/ + +Value SVGPatternElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X: + if(!attributeMode) + return m_x->cache(exec); + else + return Number(m_x->baseVal()->value()); + case Y: + if(!attributeMode) + return m_y->cache(exec); + else + return Number(m_y->baseVal()->value()); + case Width: + if(!attributeMode) + return m_width->cache(exec); + else + return Number(m_width->baseVal()->value()); + case Height: + if(!attributeMode) + return m_height->cache(exec); + else + return Number(m_height->baseVal()->value()); + case PatternUnits: + if(!attributeMode) + return m_patternUnits->cache(exec); + else + return Number(m_patternUnits->baseVal()); + case PatternContentUnits: + if(!attributeMode) + return m_patternContentUnits->cache(exec); + else + return Number(m_patternContentUnits->baseVal()); + case PatternTransform: + //if(!attributeMode) + return m_patternTransform->cache(exec); + //else + // return Number(m_patternTransform->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPatternElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X: + converter()->modify(x(), value.toString(exec).qstring()); + break; + case Y: + converter()->modify(y(), value.toString(exec).qstring()); + break; + case Width: + converter()->modify(width(), value.toString(exec).qstring()); + if(width()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute width of element is illegal")); + break; + case Height: + converter()->modify(height(), value.toString(exec).qstring()); + if(height()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute height of element is illegal")); + break; + case PatternUnits: + if(value.toString(exec).qstring() == "userSpaceOnUse") + m_patternUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); + else + m_patternUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); + break; + case PatternContentUnits: + if(value.toString(exec).qstring() == "userSpaceOnUse") + m_patternContentUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); + else + m_patternContentUnits->setBaseVal(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); + break; + case PatternTransform: + m_patternTransform->baseVal()->clear(); + SVGHelperImpl::parseTransformAttribute(m_patternTransform->baseVal(), value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGPatternElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if attribute not specified, use a value of 0 + if(KSVG_TOKEN_NOT_PARSED(X)) + KSVG_SET_ALT_ATTRIBUTE(X, "0") + + // Spec: if attribute not specified, use a value of 0 + if(KSVG_TOKEN_NOT_PARSED(Y)) + KSVG_SET_ALT_ATTRIBUTE(Y, "0") + + // Spec: if attribute not specified, use objectBoundingBox + if(KSVG_TOKEN_NOT_PARSED(PatternUnits)) + KSVG_SET_ALT_ATTRIBUTE(PatternUnits, "objectBoundingBox") + + // Spec: If attribute not specified, use userSpaceOnUse + if(KSVG_TOKEN_NOT_PARSED(PatternContentUnits)) + KSVG_SET_ALT_ATTRIBUTE(PatternContentUnits, "userSpaceOnUse") + + // Spec: default value + if(KSVG_TOKEN_NOT_PARSED(PreserveAspectRatio)) + KSVG_SET_ALT_ATTRIBUTE(PreserveAspectRatio, "xMidYMid meet") +} + +void SVGPatternElementImpl::flushCachedTiles() +{ + TQValueList::iterator it; + + for(it = m_patternElements.begin(); it != m_patternElements.end(); it++) + { + SVGPatternElementImpl *pattern = *it; + + if(pattern->paintServer()) + pattern->paintServer()->resetFinalized(); + } +} + +TQImage SVGPatternElementImpl::createTile(SVGShapeImpl *referencingElement, int imageWidth, int imageHeight) +{ + converter()->finalize(referencingElement, ownerSVGElement(), patternUnits()->baseVal()); + + TQImage image(imageWidth, imageHeight, 32); + image.setAlphaBuffer(true); + + if(m_canvas == 0) + { + m_canvas = CanvasFactory::self()->loadCanvas(image.width(), image.height()); + m_canvas->setBackgroundColor(tqRgba(0, 0, 0, 0)); + } + + m_canvas->setup(image.bits(), image.width(), image.height()); + + SVGMatrixImpl *baseMatrix = SVGSVGElementImpl::createSVGMatrix(); + + // Set the scale to map the tile onto the integral sized image + double xScale = static_cast(imageWidth) / width()->baseVal()->value(); + double yScale = static_cast(imageHeight) / height()->baseVal()->value(); + + baseMatrix->scaleNonUniform(xScale, yScale); + + if(hasAttribute("viewBox")) + { + SVGMatrixImpl *viewboxMatrix = viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value()); + + baseMatrix->multiply(viewboxMatrix); + viewboxMatrix->deref(); + } + else + { + if(patternContentUnits()->baseVal() == SVGPatternElement::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) + { + // Get local coordinate bounding box + SVGRectImpl *rect = referencingElement->getBBox(); + + baseMatrix->translate(rect->qrect().x(), rect->qrect().y()); + baseMatrix->scaleNonUniform(rect->qrect().width(), rect->qrect().height()); + rect->deref(); + } + } + + for(DOM::Node node = m_location->firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + SVGShapeImpl *shape = dynamic_cast(element); + SVGTestsImpl *tests = dynamic_cast(element); + SVGStylableImpl *style = dynamic_cast(element); + + bool ok = tests ? tests->ok() : true; + if(element && shape && style && ok && style->getVisible() && style->getDisplay()) + { + SVGLocatableImpl *locatable = dynamic_cast(element); + if(locatable) + locatable->updateCachedScreenCTM(baseMatrix); + + element->createItem(m_canvas); + if(shape->item()) + { + shape->item()->setReferenced(true); + m_canvas->invalidate(shape->item(), true); + } + } + } + + baseMatrix->deref(); + + m_canvas->update(float(1)); + + if(getOverflow()) + { + TQPtrList items = m_canvas->allItems(); + TQRect allItemsBBox; + + TQPtrListIterator it(items); + CanvasItem *item; + + while((item = *it) != 0) + { + TQRect bbox = item->bbox(); + allItemsBBox |= bbox; + ++it; + } + + if(allItemsBBox.left() < 0 || allItemsBBox.right() >= imageWidth || allItemsBBox.top() < 0 || allItemsBBox.bottom() >= imageHeight) + { + // Get the range in whole-tile units that covers the bounding box, where (0, 0) is the + // usual tile position. + int tileLeft = (allItemsBBox.left() - (imageWidth - 1)) / imageWidth; + int tileRight = allItemsBBox.right() / imageWidth; + int tileTop = (allItemsBBox.top() - (imageHeight - 1)) / imageHeight; + int tileBottom = allItemsBBox.bottom() / imageHeight; + + for(int tileX = tileLeft; tileX <= tileRight; tileX++) + { + for(int tileY = tileTop; tileY <= tileBottom; tileY++) + { + if(tileX != 0 || tileY !=0) + { + TQPoint panPoint(-(tileX * imageWidth), -(tileY * imageHeight)); + m_canvas->update(panPoint, false); + } + } + } + } + } + + for(DOM::Node node = m_location->firstChild(); !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + + if(element) + element->removeItem(m_canvas); + } + + return image; +} + +void SVGPatternElementImpl::reference(const TQString &href) +{ + // Copy attributes + SVGElementImpl *src = ownerSVGElement()->getElementById(href); + + if(src) + { + SVGHelperImpl::copyAttributes(src, this); + + // Spec: Change location to referenced element so we + // can take the children elements to render from there + if(m_location == this) + m_location = src; + } +} + +void SVGPatternElementImpl::finalizePaintServer() +{ + // Clear out any cached tiles since we may be being refinalised after an image + // inside a pattern has finished loading. + m_tileCache.clear(); + + TQString _href = SVGURIReferenceImpl::getTarget(href()->baseVal().string()); + if(!_href.isEmpty()) + reference(_href); +} + +SVGPatternElementImpl::Tile SVGPatternElementImpl::createTile(SVGShapeImpl *referencingElement) +{ + converter()->finalize(referencingElement, ownerSVGElement(), patternUnits()->baseVal()); + + SVGTransformableImpl *transformable = dynamic_cast(referencingElement); + SVGMatrixImpl *matrix = 0; + if(transformable) + matrix = transformable->getScreenCTM(); + else + matrix = SVGSVGElementImpl::createSVGMatrix(); + + matrix->translate(x()->baseVal()->value(), y()->baseVal()->value()); + + SVGMatrixImpl *patTransform = patternTransform()->baseVal()->concatenate(); + if(patTransform) + { + matrix->multiply(patTransform); + patTransform->deref(); + } + + double xScale, yScale; + matrix->removeScale(&xScale, &yScale); + + double tileWidth = width()->baseVal()->value() * xScale; + double tileHeight = height()->baseVal()->value() * yScale; + + int imageWidth = static_cast(tileWidth + 0.5); + int imageHeight = static_cast(tileHeight + 0.5); + + Tile tile; + + if(imageWidth > 0 && imageHeight > 0) + { + TQSize size(imageWidth, imageHeight); + TQImage image; + + if(!m_tileCache.find(size, image)) + { + image = createTile(referencingElement, imageWidth, imageHeight); + m_tileCache.insert(size, image, image.width() * image.height() * 4); + } + + // Map integral tile dimensions onto its true size + double adjustXScale = tileWidth / imageWidth; + double adjustYScale = tileHeight / imageHeight; + + matrix->scaleNonUniform(adjustXScale, adjustYScale); + TQWMatrix screenToTile = matrix->qmatrix().invert(); + + tile = Tile(image, screenToTile); + } + + matrix->deref(); + + return tile; +} + diff --git a/ksvg/impl/SVGPointImpl.cc b/ksvg/impl/SVGPointImpl.cc deleted file mode 100644 index ebce509a..00000000 --- a/ksvg/impl/SVGPointImpl.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPointImpl.h" -#include "SVGSVGElementImpl.h" - -using namespace KSVG; - -#include "SVGPointImpl.lut.h" -#include "ksvg_bridge.h" - -SVGPointImpl::SVGPointImpl() : DOM::DomShared() -{ - KSVG_EMPTY_FLAGS - - m_x = 0; - m_y = 0; -} - -SVGPointImpl::~SVGPointImpl() -{ -} - -void SVGPointImpl::setX(float x) -{ - m_x = x; -} - -float SVGPointImpl::x() const -{ - return m_x; -} - -void SVGPointImpl::setY(float y) -{ - m_y = y; -} - -float SVGPointImpl::y() const -{ - return m_y; -} - -SVGPointImpl *SVGPointImpl::matrixTransform(const SVGMatrixImpl &) -{ - SVGPointImpl *ret = SVGSVGElementImpl::createSVGPoint(); - return ret; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPointImpl::s_hashTable 3 - x SVGPointImpl::X DontDelete - y SVGPointImpl::Y DontDelete -@end -*/ - -Value SVGPointImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(x()); - case Y: - return Number(y()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGPointImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGPointImpl.cpp b/ksvg/impl/SVGPointImpl.cpp new file mode 100644 index 00000000..ebce509a --- /dev/null +++ b/ksvg/impl/SVGPointImpl.cpp @@ -0,0 +1,106 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPointImpl.h" +#include "SVGSVGElementImpl.h" + +using namespace KSVG; + +#include "SVGPointImpl.lut.h" +#include "ksvg_bridge.h" + +SVGPointImpl::SVGPointImpl() : DOM::DomShared() +{ + KSVG_EMPTY_FLAGS + + m_x = 0; + m_y = 0; +} + +SVGPointImpl::~SVGPointImpl() +{ +} + +void SVGPointImpl::setX(float x) +{ + m_x = x; +} + +float SVGPointImpl::x() const +{ + return m_x; +} + +void SVGPointImpl::setY(float y) +{ + m_y = y; +} + +float SVGPointImpl::y() const +{ + return m_y; +} + +SVGPointImpl *SVGPointImpl::matrixTransform(const SVGMatrixImpl &) +{ + SVGPointImpl *ret = SVGSVGElementImpl::createSVGPoint(); + return ret; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPointImpl::s_hashTable 3 + x SVGPointImpl::X DontDelete + y SVGPointImpl::Y DontDelete +@end +*/ + +Value SVGPointImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(x()); + case Y: + return Number(y()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGPointImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGPointListImpl.cc b/ksvg/impl/SVGPointListImpl.cc deleted file mode 100644 index ba492c32..00000000 --- a/ksvg/impl/SVGPointListImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPointListImpl.h" - -using namespace KSVG; - -#include "SVGPointListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPointListImpl::s_hashTable 2 - numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGPointListImplProto::s_hashTable 11 - getItem SVGListDefs::GetItem DontDelete|Function 1 - removeItem SVGListDefs::RemoveItem DontDelete|Function 1 - appendItem SVGListDefs::AppendItem DontDelete|Function 1 - initialize SVGListDefs::Initialize DontDelete|Function 1 - insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 - replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 - clear SVGListDefs::Clear DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGPointList", SVGPointListImplProto, SVGPointListImplProtoFunc) - -Value SVGPointListImpl::getValueProperty(ExecState *exec, int token) const -{ - return SVGList::getValueProperty(exec, token); -} - -Value SVGPointListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGPointListImpl) - - return obj->call(exec, static_cast *>(obj), args, id); -} diff --git a/ksvg/impl/SVGPointListImpl.cpp b/ksvg/impl/SVGPointListImpl.cpp new file mode 100644 index 00000000..ba492c32 --- /dev/null +++ b/ksvg/impl/SVGPointListImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPointListImpl.h" + +using namespace KSVG; + +#include "SVGPointListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPointListImpl::s_hashTable 2 + numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGPointListImplProto::s_hashTable 11 + getItem SVGListDefs::GetItem DontDelete|Function 1 + removeItem SVGListDefs::RemoveItem DontDelete|Function 1 + appendItem SVGListDefs::AppendItem DontDelete|Function 1 + initialize SVGListDefs::Initialize DontDelete|Function 1 + insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 + replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 + clear SVGListDefs::Clear DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGPointList", SVGPointListImplProto, SVGPointListImplProtoFunc) + +Value SVGPointListImpl::getValueProperty(ExecState *exec, int token) const +{ + return SVGList::getValueProperty(exec, token); +} + +Value SVGPointListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGPointListImpl) + + return obj->call(exec, static_cast *>(obj), args, id); +} diff --git a/ksvg/impl/SVGPolyElementImpl.cc b/ksvg/impl/SVGPolyElementImpl.cc deleted file mode 100644 index b1557aa3..00000000 --- a/ksvg/impl/SVGPolyElementImpl.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include - -#include "SVGRectImpl.h" -#include "SVGPointListImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGPolyElementImpl.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -SVGPolyElementImpl::SVGPolyElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl(), SVGAnimatedPointsImpl() -{ -} - -SVGPolyElementImpl::~SVGPolyElementImpl() -{ -} - -SVGRectImpl *SVGPolyElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - - unsigned int nrPoints = points()->numberOfItems(); - float minx, miny, maxx, maxy, tempx, tempy; - minx = points()->getItem(0)->x(); - miny = points()->getItem(0)->y(); - maxx = points()->getItem(0)->x(); - maxy = points()->getItem(0)->y(); - - for(unsigned int i = 1; i < nrPoints; ++i) - { - tempx = points()->getItem(i)->x(); - tempy = points()->getItem(i)->y(); - - if(tempx < minx) - minx = tempx; - if(tempx > maxx) - maxx = tempx; - if(tempy < miny) - miny = tempy; - if(tempy > maxy) - maxy = tempy; - } - - ret->setX(minx); - ret->setY(miny); - ret->setWidth(maxx - minx); - ret->setHeight(maxy - miny); - return ret; -} - -bool SVGPolyElementImpl::findOutSlope(unsigned int point, double *outSlope) const -{ - unsigned int nextPoint; - - if(point == points()->numberOfItems() - 1) - { - if(m_isOpenPath) - return false; - else - nextPoint = 0; - } - else - nextPoint = point + 1; - - if(point == nextPoint) - return false; - - double x = points()->getItem(point)->x(); - double y = points()->getItem(point)->y(); - double nextX = points()->getItem(nextPoint)->x(); - double nextY = points()->getItem(nextPoint)->y(); - const double epsilon = DBL_EPSILON; - - if(fabs(x - nextX) < epsilon && fabs(y - nextY) < epsilon) - return findOutSlope(nextPoint, outSlope); - else - { - double slope = SVGAngleImpl::todeg(atan2(nextY - y, nextX - x)); - *outSlope = slope; - return true; - } -} - -bool SVGPolyElementImpl::findInSlope(unsigned int point, double *inSlope) const -{ - unsigned int prevPoint; - - if(point == 0) - { - if(m_isOpenPath) - return false; - else - prevPoint = points()->numberOfItems() - 1; - } - else - prevPoint = point - 1; - - if(point == prevPoint) - return false; - - double x = points()->getItem(point)->x(); - double y = points()->getItem(point)->y(); - double prevX = points()->getItem(prevPoint)->x(); - double prevY = points()->getItem(prevPoint)->y(); - const double epsilon = DBL_EPSILON; - - if(fabs(x - prevX) < epsilon && fabs(y - prevY) < epsilon) - return findInSlope(prevPoint, inSlope); - else - { - double slope = SVGAngleImpl::todeg(atan2(y - prevY, x - prevX)); - *inSlope = slope; - return true; - } -} diff --git a/ksvg/impl/SVGPolyElementImpl.cpp b/ksvg/impl/SVGPolyElementImpl.cpp new file mode 100644 index 00000000..b1557aa3 --- /dev/null +++ b/ksvg/impl/SVGPolyElementImpl.cpp @@ -0,0 +1,139 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include + +#include "SVGRectImpl.h" +#include "SVGPointListImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGPolyElementImpl.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +SVGPolyElementImpl::SVGPolyElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl(), SVGAnimatedPointsImpl() +{ +} + +SVGPolyElementImpl::~SVGPolyElementImpl() +{ +} + +SVGRectImpl *SVGPolyElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + + unsigned int nrPoints = points()->numberOfItems(); + float minx, miny, maxx, maxy, tempx, tempy; + minx = points()->getItem(0)->x(); + miny = points()->getItem(0)->y(); + maxx = points()->getItem(0)->x(); + maxy = points()->getItem(0)->y(); + + for(unsigned int i = 1; i < nrPoints; ++i) + { + tempx = points()->getItem(i)->x(); + tempy = points()->getItem(i)->y(); + + if(tempx < minx) + minx = tempx; + if(tempx > maxx) + maxx = tempx; + if(tempy < miny) + miny = tempy; + if(tempy > maxy) + maxy = tempy; + } + + ret->setX(minx); + ret->setY(miny); + ret->setWidth(maxx - minx); + ret->setHeight(maxy - miny); + return ret; +} + +bool SVGPolyElementImpl::findOutSlope(unsigned int point, double *outSlope) const +{ + unsigned int nextPoint; + + if(point == points()->numberOfItems() - 1) + { + if(m_isOpenPath) + return false; + else + nextPoint = 0; + } + else + nextPoint = point + 1; + + if(point == nextPoint) + return false; + + double x = points()->getItem(point)->x(); + double y = points()->getItem(point)->y(); + double nextX = points()->getItem(nextPoint)->x(); + double nextY = points()->getItem(nextPoint)->y(); + const double epsilon = DBL_EPSILON; + + if(fabs(x - nextX) < epsilon && fabs(y - nextY) < epsilon) + return findOutSlope(nextPoint, outSlope); + else + { + double slope = SVGAngleImpl::todeg(atan2(nextY - y, nextX - x)); + *outSlope = slope; + return true; + } +} + +bool SVGPolyElementImpl::findInSlope(unsigned int point, double *inSlope) const +{ + unsigned int prevPoint; + + if(point == 0) + { + if(m_isOpenPath) + return false; + else + prevPoint = points()->numberOfItems() - 1; + } + else + prevPoint = point - 1; + + if(point == prevPoint) + return false; + + double x = points()->getItem(point)->x(); + double y = points()->getItem(point)->y(); + double prevX = points()->getItem(prevPoint)->x(); + double prevY = points()->getItem(prevPoint)->y(); + const double epsilon = DBL_EPSILON; + + if(fabs(x - prevX) < epsilon && fabs(y - prevY) < epsilon) + return findInSlope(prevPoint, inSlope); + else + { + double slope = SVGAngleImpl::todeg(atan2(y - prevY, x - prevX)); + *inSlope = slope; + return true; + } +} diff --git a/ksvg/impl/SVGPolygonElementImpl.cc b/ksvg/impl/SVGPolygonElementImpl.cc deleted file mode 100644 index 0187ce43..00000000 --- a/ksvg/impl/SVGPolygonElementImpl.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPointListImpl.h" -#include "SVGPolygonElementImpl.h" -#include "SVGDocumentImpl.h" -#include "KSVGCanvas.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -SVGPolygonElementImpl::SVGPolygonElementImpl(DOM::ElementImpl *impl) : SVGPolyElementImpl(impl) -{ - m_isOpenPath = false; -} - -void SVGPolygonElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createPolygon(this); - c->insert(m_item); - } -} - -void SVGPolygonElementImpl::drawMarkers() -{ - SVGPointListImpl *pts = points(); - unsigned int nrPoints = pts->numberOfItems(); - - if(nrPoints > 0 && hasMarkers()) - { - for(unsigned int i = 0; i < nrPoints; ++i) - { - double inSlope; - double outSlope; - bool haveInSlope = findInSlope(i, &inSlope); - bool haveOutSlope = findOutSlope(i, &outSlope); - - if(!haveInSlope && haveOutSlope) - inSlope = outSlope; - else if(haveInSlope && !haveOutSlope) - outSlope = inSlope; - else if(!haveInSlope && !haveOutSlope) - { - inSlope = 0; - outSlope = 0; - } - - double bisector = SVGAngleImpl::shortestArcBisector(inSlope, outSlope); - - if(i == 0) - { - if(hasStartMarker()) - doStartMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); - if(hasEndMarker()) - doEndMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); - } - else - { - if(hasMidMarker()) - doMidMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); - } - } - } -} diff --git a/ksvg/impl/SVGPolygonElementImpl.cpp b/ksvg/impl/SVGPolygonElementImpl.cpp new file mode 100644 index 00000000..0187ce43 --- /dev/null +++ b/ksvg/impl/SVGPolygonElementImpl.cpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPointListImpl.h" +#include "SVGPolygonElementImpl.h" +#include "SVGDocumentImpl.h" +#include "KSVGCanvas.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +SVGPolygonElementImpl::SVGPolygonElementImpl(DOM::ElementImpl *impl) : SVGPolyElementImpl(impl) +{ + m_isOpenPath = false; +} + +void SVGPolygonElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createPolygon(this); + c->insert(m_item); + } +} + +void SVGPolygonElementImpl::drawMarkers() +{ + SVGPointListImpl *pts = points(); + unsigned int nrPoints = pts->numberOfItems(); + + if(nrPoints > 0 && hasMarkers()) + { + for(unsigned int i = 0; i < nrPoints; ++i) + { + double inSlope; + double outSlope; + bool haveInSlope = findInSlope(i, &inSlope); + bool haveOutSlope = findOutSlope(i, &outSlope); + + if(!haveInSlope && haveOutSlope) + inSlope = outSlope; + else if(haveInSlope && !haveOutSlope) + outSlope = inSlope; + else if(!haveInSlope && !haveOutSlope) + { + inSlope = 0; + outSlope = 0; + } + + double bisector = SVGAngleImpl::shortestArcBisector(inSlope, outSlope); + + if(i == 0) + { + if(hasStartMarker()) + doStartMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); + if(hasEndMarker()) + doEndMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); + } + else + { + if(hasMidMarker()) + doMidMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); + } + } + } +} diff --git a/ksvg/impl/SVGPolylineElementImpl.cc b/ksvg/impl/SVGPolylineElementImpl.cc deleted file mode 100644 index 487f2630..00000000 --- a/ksvg/impl/SVGPolylineElementImpl.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGPointListImpl.h" -#include "SVGPolylineElementImpl.h" -#include "SVGDocumentImpl.h" -#include "KSVGCanvas.h" -#include "SVGAngleImpl.h" - -using namespace KSVG; - -SVGPolylineElementImpl::SVGPolylineElementImpl(DOM::ElementImpl *impl) : SVGPolyElementImpl(impl) -{ - m_isOpenPath = true; -} - -void SVGPolylineElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createPolyline(this); - c->insert(m_item); - } -} - -void SVGPolylineElementImpl::drawMarkers() -{ - SVGPointListImpl *pts = points(); - unsigned int nrPoints = pts->numberOfItems(); - - if(nrPoints > 0 && hasMarkers()) - { - if(hasStartMarker()) - { - double outSlope; - - if(!findOutSlope(0, &outSlope)) - outSlope = 0; - - doStartMarker(this, this, pts->getItem(0)->x(), pts->getItem(0)->y(), outSlope); - } - - if(hasMidMarker()) - { - for(unsigned int i = 1; i < nrPoints - 1; ++i) - { - double inSlope; - double outSlope; - bool haveInSlope = findInSlope(i, &inSlope); - bool haveOutSlope = findOutSlope(i, &outSlope); - - if(!haveInSlope && haveOutSlope) - inSlope = outSlope; - else if(haveInSlope && !haveOutSlope) - outSlope = inSlope; - else if(!haveInSlope && !haveOutSlope) - { - inSlope = 0; - outSlope = 0; - } - - double bisector = SVGAngleImpl::shortestArcBisector(inSlope, outSlope); - - doMidMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); - } - } - - if(hasEndMarker()) - { - double inSlope; - - if(!findInSlope(nrPoints - 1, &inSlope)) - inSlope = 0; - - doEndMarker(this, this, pts->getItem(nrPoints - 1)->x(), pts->getItem(nrPoints - 1)->y(), inSlope); - } - } -} diff --git a/ksvg/impl/SVGPolylineElementImpl.cpp b/ksvg/impl/SVGPolylineElementImpl.cpp new file mode 100644 index 00000000..487f2630 --- /dev/null +++ b/ksvg/impl/SVGPolylineElementImpl.cpp @@ -0,0 +1,98 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGPointListImpl.h" +#include "SVGPolylineElementImpl.h" +#include "SVGDocumentImpl.h" +#include "KSVGCanvas.h" +#include "SVGAngleImpl.h" + +using namespace KSVG; + +SVGPolylineElementImpl::SVGPolylineElementImpl(DOM::ElementImpl *impl) : SVGPolyElementImpl(impl) +{ + m_isOpenPath = true; +} + +void SVGPolylineElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createPolyline(this); + c->insert(m_item); + } +} + +void SVGPolylineElementImpl::drawMarkers() +{ + SVGPointListImpl *pts = points(); + unsigned int nrPoints = pts->numberOfItems(); + + if(nrPoints > 0 && hasMarkers()) + { + if(hasStartMarker()) + { + double outSlope; + + if(!findOutSlope(0, &outSlope)) + outSlope = 0; + + doStartMarker(this, this, pts->getItem(0)->x(), pts->getItem(0)->y(), outSlope); + } + + if(hasMidMarker()) + { + for(unsigned int i = 1; i < nrPoints - 1; ++i) + { + double inSlope; + double outSlope; + bool haveInSlope = findInSlope(i, &inSlope); + bool haveOutSlope = findOutSlope(i, &outSlope); + + if(!haveInSlope && haveOutSlope) + inSlope = outSlope; + else if(haveInSlope && !haveOutSlope) + outSlope = inSlope; + else if(!haveInSlope && !haveOutSlope) + { + inSlope = 0; + outSlope = 0; + } + + double bisector = SVGAngleImpl::shortestArcBisector(inSlope, outSlope); + + doMidMarker(this, this, pts->getItem(i)->x(), pts->getItem(i)->y(), bisector); + } + } + + if(hasEndMarker()) + { + double inSlope; + + if(!findInSlope(nrPoints - 1, &inSlope)) + inSlope = 0; + + doEndMarker(this, this, pts->getItem(nrPoints - 1)->x(), pts->getItem(nrPoints - 1)->y(), inSlope); + } + } +} diff --git a/ksvg/impl/SVGPreserveAspectRatioImpl.cc b/ksvg/impl/SVGPreserveAspectRatioImpl.cc deleted file mode 100644 index bce71948..00000000 --- a/ksvg/impl/SVGPreserveAspectRatioImpl.cc +++ /dev/null @@ -1,215 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include -#include - -#include "SVGPreserveAspectRatio.h" - -#include "SVGMatrixImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGPreserveAspectRatioImpl.h" - -using namespace KSVG; - -#include "SVGPreserveAspectRatioImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_cacheimpl.h" - -SVGPreserveAspectRatioImpl::SVGPreserveAspectRatioImpl() -{ - KSVG_EMPTY_FLAGS - - m_meetOrSlice = SVG_MEETORSLICE_UNKNOWN; - m_align = SVG_PRESERVEASPECTRATIO_UNKNOWN; -} - -SVGPreserveAspectRatioImpl::~SVGPreserveAspectRatioImpl() -{ -} - -void SVGPreserveAspectRatioImpl::setAlign(unsigned short align) -{ - m_align = align; -} - -unsigned short SVGPreserveAspectRatioImpl::align() const -{ - return m_align; -} - -void SVGPreserveAspectRatioImpl::setMeetOrSlice(unsigned short meetOrSlice) -{ - m_meetOrSlice = meetOrSlice; -} - -unsigned short SVGPreserveAspectRatioImpl::meetOrSlice() const -{ - return m_meetOrSlice; -} - -void SVGPreserveAspectRatioImpl::parsePreserveAspectRatio(const TQString &str) -{ - // Spec: set the defaults - setAlign(SVG_PRESERVEASPECTRATIO_NONE); - setMeetOrSlice(SVG_MEETORSLICE_MEET); - - TQStringList params = TQStringList::split(' ', str.simplifyWhiteSpace()); - - if(params[0].compare("none") == 0) - m_align = SVG_PRESERVEASPECTRATIO_NONE; - else if(params[0].compare("xMinYMin") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMINYMIN; - else if(params[0].compare("xMidYMin") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMIDYMIN; - else if(params[0].compare("xMaxYMin") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMAXYMIN; - else if(params[0].compare("xMinYMid") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMINYMID; - else if(params[0].compare("xMidYMid") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMIDYMID; - else if(params[0].compare("xMaxYMid") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMAXYMID; - else if(params[0].compare("xMinYMax") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMINYMAX; - else if(params[0].compare("xMidYMax") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMIDYMAX; - else if(params[0].compare("xMaxYMax") == 0) - m_align = SVG_PRESERVEASPECTRATIO_XMAXYMAX; - - if(params[1].compare("slice") == 0) - m_meetOrSlice = SVG_MEETORSLICE_SLICE; - else - m_meetOrSlice = SVG_MEETORSLICE_MEET; -} - -SVGMatrixImpl *SVGPreserveAspectRatioImpl::getCTM(float logicX, float logicY, float logicWidth, float logicHeight, - float /*physX*/, float /*physY*/, float physWidth, float physHeight) -{ - SVGMatrixImpl *temp = SVGSVGElementImpl::createSVGMatrix(); - - if(align() == SVG_PRESERVEASPECTRATIO_UNKNOWN) - return temp; - - float vpar = logicWidth / logicHeight; - float svgar = physWidth / physHeight; - - if(align() == SVG_PRESERVEASPECTRATIO_NONE) - { - temp->scaleNonUniform(physWidth / logicWidth, physHeight / logicHeight); - temp->translate(-logicX, -logicY); - } - else if(vpar < svgar && (meetOrSlice() == SVG_MEETORSLICE_MEET) || vpar >= svgar && (meetOrSlice() == SVG_MEETORSLICE_SLICE)) - { - temp->scale(physHeight / logicHeight); - - if(align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMINYMAX) - temp->translate(-logicX, -logicY); - else if(align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMAX) - temp->translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight) / 2, -logicY); - else - temp->translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight), -logicY); - } - else - { - temp->scale(physWidth / logicWidth); - - if(align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMAXYMIN) - temp->translate(-logicX, -logicY); - else if(align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMAXYMID) - temp->translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth) / 2); - else - temp->translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth)); - } - - return temp; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGPreserveAspectRatioImpl::s_hashTable 3 - align SVGPreserveAspectRatioImpl::Align DontDelete - meetOrSlice SVGPreserveAspectRatioImpl::MeetOrSlice DontDelete -@end -*/ - -Value SVGPreserveAspectRatioImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Align: - return Number(align()); - case MeetOrSlice: - return Number(meetOrSlice()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return KJS::Undefined(); - } -} - -void SVGPreserveAspectRatioImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case Align: - m_align = static_cast(value.toNumber(exec)); - break; - case MeetOrSlice: - m_meetOrSlice = static_cast(value.toNumber(exec)); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -/* -@namespace KSVG -@begin SVGPreserveAspectRatioImplConstructor::s_hashTable 17 - SVG_PRESERVEASPECTRATIO_UNKNOWN KSVG::SVG_PRESERVEASPECTRATIO_UNKNOWN DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_NONE KSVG::SVG_PRESERVEASPECTRATIO_NONE DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMINYMIN KSVG::SVG_PRESERVEASPECTRATIO_XMINYMIN DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMIDYMIN KSVG::SVG_PRESERVEASPECTRATIO_XMIDYMIN DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMAXYMIN KSVG::SVG_PRESERVEASPECTRATIO_XMAXYMIN DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMINYMID KSVG::SVG_PRESERVEASPECTRATIO_XMINYMID DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMIDYMID KSVG::SVG_PRESERVEASPECTRATIO_XMIDYMID DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMAXYMID KSVG::SVG_PRESERVEASPECTRATIO_XMAXYMID DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMINYMAX KSVG::SVG_PRESERVEASPECTRATIO_XMINYMAX DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMIDYMAX KSVG::SVG_PRESERVEASPECTRATIO_XMIDYMAX DontDelete|ReadOnly - SVG_PRESERVEASPECTRATIO_XMAXYMAX KSVG::SVG_PRESERVEASPECTRATIO_XMAXYMAX DontDelete|ReadOnly - SVG_MEETORSLICE_UNKNOWN KSVG::SVG_MEETORSLICE_UNKNOWN DontDelete|ReadOnly - SVG_MEETORSLICE_MEET KSVG::SVG_MEETORSLICE_MEET DontDelete|ReadOnly - SVG_MEETORSLICE_SLICE KSVG::SVG_MEETORSLICE_SLICE DontDelete|ReadOnly -@end -*/ - -Value SVGPreserveAspectRatioImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token > SVG_PRESERVEASPECTRATIO_XMAXYMAX ? token - SVG_MEETORSLICE_UNKNOWN : token); -} - -Value KSVG::getSVGPreserveAspectRatioImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgpreserveaspectratio.constructor]]"); -} diff --git a/ksvg/impl/SVGPreserveAspectRatioImpl.cpp b/ksvg/impl/SVGPreserveAspectRatioImpl.cpp new file mode 100644 index 00000000..bce71948 --- /dev/null +++ b/ksvg/impl/SVGPreserveAspectRatioImpl.cpp @@ -0,0 +1,215 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include + +#include "SVGPreserveAspectRatio.h" + +#include "SVGMatrixImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGPreserveAspectRatioImpl.h" + +using namespace KSVG; + +#include "SVGPreserveAspectRatioImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_cacheimpl.h" + +SVGPreserveAspectRatioImpl::SVGPreserveAspectRatioImpl() +{ + KSVG_EMPTY_FLAGS + + m_meetOrSlice = SVG_MEETORSLICE_UNKNOWN; + m_align = SVG_PRESERVEASPECTRATIO_UNKNOWN; +} + +SVGPreserveAspectRatioImpl::~SVGPreserveAspectRatioImpl() +{ +} + +void SVGPreserveAspectRatioImpl::setAlign(unsigned short align) +{ + m_align = align; +} + +unsigned short SVGPreserveAspectRatioImpl::align() const +{ + return m_align; +} + +void SVGPreserveAspectRatioImpl::setMeetOrSlice(unsigned short meetOrSlice) +{ + m_meetOrSlice = meetOrSlice; +} + +unsigned short SVGPreserveAspectRatioImpl::meetOrSlice() const +{ + return m_meetOrSlice; +} + +void SVGPreserveAspectRatioImpl::parsePreserveAspectRatio(const TQString &str) +{ + // Spec: set the defaults + setAlign(SVG_PRESERVEASPECTRATIO_NONE); + setMeetOrSlice(SVG_MEETORSLICE_MEET); + + TQStringList params = TQStringList::split(' ', str.simplifyWhiteSpace()); + + if(params[0].compare("none") == 0) + m_align = SVG_PRESERVEASPECTRATIO_NONE; + else if(params[0].compare("xMinYMin") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMINYMIN; + else if(params[0].compare("xMidYMin") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMIDYMIN; + else if(params[0].compare("xMaxYMin") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMAXYMIN; + else if(params[0].compare("xMinYMid") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMINYMID; + else if(params[0].compare("xMidYMid") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMIDYMID; + else if(params[0].compare("xMaxYMid") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMAXYMID; + else if(params[0].compare("xMinYMax") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMINYMAX; + else if(params[0].compare("xMidYMax") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMIDYMAX; + else if(params[0].compare("xMaxYMax") == 0) + m_align = SVG_PRESERVEASPECTRATIO_XMAXYMAX; + + if(params[1].compare("slice") == 0) + m_meetOrSlice = SVG_MEETORSLICE_SLICE; + else + m_meetOrSlice = SVG_MEETORSLICE_MEET; +} + +SVGMatrixImpl *SVGPreserveAspectRatioImpl::getCTM(float logicX, float logicY, float logicWidth, float logicHeight, + float /*physX*/, float /*physY*/, float physWidth, float physHeight) +{ + SVGMatrixImpl *temp = SVGSVGElementImpl::createSVGMatrix(); + + if(align() == SVG_PRESERVEASPECTRATIO_UNKNOWN) + return temp; + + float vpar = logicWidth / logicHeight; + float svgar = physWidth / physHeight; + + if(align() == SVG_PRESERVEASPECTRATIO_NONE) + { + temp->scaleNonUniform(physWidth / logicWidth, physHeight / logicHeight); + temp->translate(-logicX, -logicY); + } + else if(vpar < svgar && (meetOrSlice() == SVG_MEETORSLICE_MEET) || vpar >= svgar && (meetOrSlice() == SVG_MEETORSLICE_SLICE)) + { + temp->scale(physHeight / logicHeight); + + if(align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMINYMAX) + temp->translate(-logicX, -logicY); + else if(align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMAX) + temp->translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight) / 2, -logicY); + else + temp->translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight), -logicY); + } + else + { + temp->scale(physWidth / logicWidth); + + if(align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMAXYMIN) + temp->translate(-logicX, -logicY); + else if(align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMAXYMID) + temp->translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth) / 2); + else + temp->translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth)); + } + + return temp; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGPreserveAspectRatioImpl::s_hashTable 3 + align SVGPreserveAspectRatioImpl::Align DontDelete + meetOrSlice SVGPreserveAspectRatioImpl::MeetOrSlice DontDelete +@end +*/ + +Value SVGPreserveAspectRatioImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Align: + return Number(align()); + case MeetOrSlice: + return Number(meetOrSlice()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return KJS::Undefined(); + } +} + +void SVGPreserveAspectRatioImpl::putValueProperty(ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case Align: + m_align = static_cast(value.toNumber(exec)); + break; + case MeetOrSlice: + m_meetOrSlice = static_cast(value.toNumber(exec)); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +/* +@namespace KSVG +@begin SVGPreserveAspectRatioImplConstructor::s_hashTable 17 + SVG_PRESERVEASPECTRATIO_UNKNOWN KSVG::SVG_PRESERVEASPECTRATIO_UNKNOWN DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_NONE KSVG::SVG_PRESERVEASPECTRATIO_NONE DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMINYMIN KSVG::SVG_PRESERVEASPECTRATIO_XMINYMIN DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMIDYMIN KSVG::SVG_PRESERVEASPECTRATIO_XMIDYMIN DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMAXYMIN KSVG::SVG_PRESERVEASPECTRATIO_XMAXYMIN DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMINYMID KSVG::SVG_PRESERVEASPECTRATIO_XMINYMID DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMIDYMID KSVG::SVG_PRESERVEASPECTRATIO_XMIDYMID DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMAXYMID KSVG::SVG_PRESERVEASPECTRATIO_XMAXYMID DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMINYMAX KSVG::SVG_PRESERVEASPECTRATIO_XMINYMAX DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMIDYMAX KSVG::SVG_PRESERVEASPECTRATIO_XMIDYMAX DontDelete|ReadOnly + SVG_PRESERVEASPECTRATIO_XMAXYMAX KSVG::SVG_PRESERVEASPECTRATIO_XMAXYMAX DontDelete|ReadOnly + SVG_MEETORSLICE_UNKNOWN KSVG::SVG_MEETORSLICE_UNKNOWN DontDelete|ReadOnly + SVG_MEETORSLICE_MEET KSVG::SVG_MEETORSLICE_MEET DontDelete|ReadOnly + SVG_MEETORSLICE_SLICE KSVG::SVG_MEETORSLICE_SLICE DontDelete|ReadOnly +@end +*/ + +Value SVGPreserveAspectRatioImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token > SVG_PRESERVEASPECTRATIO_XMAXYMAX ? token - SVG_MEETORSLICE_UNKNOWN : token); +} + +Value KSVG::getSVGPreserveAspectRatioImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgpreserveaspectratio.constructor]]"); +} diff --git a/ksvg/impl/SVGRadialGradientElementImpl.cc b/ksvg/impl/SVGRadialGradientElementImpl.cc deleted file mode 100644 index 6a52ab68..00000000 --- a/ksvg/impl/SVGRadialGradientElementImpl.cc +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGGradientElement.h" -#include "SVGRadialGradientElementImpl.h" - -#include "SVGDocumentImpl.h" -#include "KSVGCanvas.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGUnitConverter.h" - -using namespace KSVG; - -#include "SVGRadialGradientElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGRadialGradientElementImpl::SVGRadialGradientElementImpl(DOM::ElementImpl *impl) : SVGGradientElementImpl(impl) -{ - KSVG_EMPTY_FLAGS - - m_cx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_cx->ref(); - - m_cy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_cy->ref(); - - m_r = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, this); - m_r->ref(); - - m_fx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_fx->ref(); - - m_fy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_fy->ref(); - - converter()->add(m_cx); - converter()->add(m_cy); - converter()->add(m_r); - converter()->add(m_fx); - converter()->add(m_fy); -} - -SVGRadialGradientElementImpl::~SVGRadialGradientElementImpl() -{ - if(m_cx) - m_cx->deref(); - if(m_cy) - m_cy->deref(); - if(m_r) - m_r->deref(); - if(m_fx) - m_fx->deref(); - if(m_fy) - m_fy->deref(); -} - -SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::cx() const -{ - return m_cx; -} - -SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::cy() const -{ - return m_cy; -} - -SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::r() const -{ - return m_r; -} - -SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::fx() const -{ - return m_fx; -} - -SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::fy() const -{ - return m_fy; -} - -/* -@namespace KSVG -@begin SVGRadialGradientElementImpl::s_hashTable 7 - cx SVGRadialGradientElementImpl::Cx DontDelete|ReadOnly - cy SVGRadialGradientElementImpl::Cy DontDelete|ReadOnly - r SVGRadialGradientElementImpl::R DontDelete|ReadOnly - fx SVGRadialGradientElementImpl::Fx DontDelete|ReadOnly - fy SVGRadialGradientElementImpl::Fy DontDelete|ReadOnly -@end -*/ - -Value SVGRadialGradientElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case Cx: - if(!attributeMode) - return m_cx->cache(exec); - else - return Number(m_cx->baseVal()->value()); - case Cy: - if(!attributeMode) - return m_cy->cache(exec); - else - return Number(m_cy->baseVal()->value()); - case R: - if(!attributeMode) - return m_r->cache(exec); - else - return Number(m_r->baseVal()->value()); - case Fx: - if(!attributeMode) - return m_fx->cache(exec); - else - return Number(m_fx->baseVal()->value()); - case Fy: - if(!attributeMode) - return m_fy->cache(exec); - else - return Number(m_fy->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGRadialGradientElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Cx: - converter()->modify(cx(), value.toString(exec).qstring()); - break; - case Cy: - converter()->modify(cy(), value.toString(exec).qstring()); - break; - case R: - converter()->modify(r(), value.toString(exec).qstring()); - break; - case Fx: - converter()->modify(fx(), value.toString(exec).qstring()); - break; - case Fy: - converter()->modify(fy(), value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGRadialGradientElementImpl::setAttributes() -{ - SVGGradientElementImpl::setAttributes(); - - // Spec: no attribute, effect is af value 50% is specified - if(KSVG_TOKEN_NOT_PARSED(Cx)) - KSVG_SET_ALT_ATTRIBUTE(Cx, "50%") - - // Spec: no attribute, effect is af value 50% is specified - if(KSVG_TOKEN_NOT_PARSED(Cy)) - KSVG_SET_ALT_ATTRIBUTE(Cy, "50%") - - // Spec: no attribute, effect is af value 50% is specified - if(KSVG_TOKEN_NOT_PARSED(R)) - KSVG_SET_ALT_ATTRIBUTE(R, "50%") -} - -TQMap SVGRadialGradientElementImpl::gradientAttributes() -{ - setAttributes(); - - TQMap gradAttributes; - TQDictIterator it(attributes()); - - for(; it.current(); ++it) - { - DOM::DOMString name = it.currentKey(); - DOM::DOMString value = it.current()->string(); - - if(name == "gradientUnits" || name == "gradientTransform" || name == "spreadMethod" || name == "cx" || name == "cy" || name == "r" || name == "fx" || name == "fy") - { - gradAttributes.insert(name.string(), value.copy()); - } - } - - return gradAttributes; -} diff --git a/ksvg/impl/SVGRadialGradientElementImpl.cpp b/ksvg/impl/SVGRadialGradientElementImpl.cpp new file mode 100644 index 00000000..6a52ab68 --- /dev/null +++ b/ksvg/impl/SVGRadialGradientElementImpl.cpp @@ -0,0 +1,214 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGGradientElement.h" +#include "SVGRadialGradientElementImpl.h" + +#include "SVGDocumentImpl.h" +#include "KSVGCanvas.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGUnitConverter.h" + +using namespace KSVG; + +#include "SVGRadialGradientElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGRadialGradientElementImpl::SVGRadialGradientElementImpl(DOM::ElementImpl *impl) : SVGGradientElementImpl(impl) +{ + KSVG_EMPTY_FLAGS + + m_cx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_cx->ref(); + + m_cy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_cy->ref(); + + m_r = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, this); + m_r->ref(); + + m_fx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_fx->ref(); + + m_fy = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_fy->ref(); + + converter()->add(m_cx); + converter()->add(m_cy); + converter()->add(m_r); + converter()->add(m_fx); + converter()->add(m_fy); +} + +SVGRadialGradientElementImpl::~SVGRadialGradientElementImpl() +{ + if(m_cx) + m_cx->deref(); + if(m_cy) + m_cy->deref(); + if(m_r) + m_r->deref(); + if(m_fx) + m_fx->deref(); + if(m_fy) + m_fy->deref(); +} + +SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::cx() const +{ + return m_cx; +} + +SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::cy() const +{ + return m_cy; +} + +SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::r() const +{ + return m_r; +} + +SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::fx() const +{ + return m_fx; +} + +SVGAnimatedLengthImpl *SVGRadialGradientElementImpl::fy() const +{ + return m_fy; +} + +/* +@namespace KSVG +@begin SVGRadialGradientElementImpl::s_hashTable 7 + cx SVGRadialGradientElementImpl::Cx DontDelete|ReadOnly + cy SVGRadialGradientElementImpl::Cy DontDelete|ReadOnly + r SVGRadialGradientElementImpl::R DontDelete|ReadOnly + fx SVGRadialGradientElementImpl::Fx DontDelete|ReadOnly + fy SVGRadialGradientElementImpl::Fy DontDelete|ReadOnly +@end +*/ + +Value SVGRadialGradientElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case Cx: + if(!attributeMode) + return m_cx->cache(exec); + else + return Number(m_cx->baseVal()->value()); + case Cy: + if(!attributeMode) + return m_cy->cache(exec); + else + return Number(m_cy->baseVal()->value()); + case R: + if(!attributeMode) + return m_r->cache(exec); + else + return Number(m_r->baseVal()->value()); + case Fx: + if(!attributeMode) + return m_fx->cache(exec); + else + return Number(m_fx->baseVal()->value()); + case Fy: + if(!attributeMode) + return m_fy->cache(exec); + else + return Number(m_fy->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGRadialGradientElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Cx: + converter()->modify(cx(), value.toString(exec).qstring()); + break; + case Cy: + converter()->modify(cy(), value.toString(exec).qstring()); + break; + case R: + converter()->modify(r(), value.toString(exec).qstring()); + break; + case Fx: + converter()->modify(fx(), value.toString(exec).qstring()); + break; + case Fy: + converter()->modify(fy(), value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGRadialGradientElementImpl::setAttributes() +{ + SVGGradientElementImpl::setAttributes(); + + // Spec: no attribute, effect is af value 50% is specified + if(KSVG_TOKEN_NOT_PARSED(Cx)) + KSVG_SET_ALT_ATTRIBUTE(Cx, "50%") + + // Spec: no attribute, effect is af value 50% is specified + if(KSVG_TOKEN_NOT_PARSED(Cy)) + KSVG_SET_ALT_ATTRIBUTE(Cy, "50%") + + // Spec: no attribute, effect is af value 50% is specified + if(KSVG_TOKEN_NOT_PARSED(R)) + KSVG_SET_ALT_ATTRIBUTE(R, "50%") +} + +TQMap SVGRadialGradientElementImpl::gradientAttributes() +{ + setAttributes(); + + TQMap gradAttributes; + TQDictIterator it(attributes()); + + for(; it.current(); ++it) + { + DOM::DOMString name = it.currentKey(); + DOM::DOMString value = it.current()->string(); + + if(name == "gradientUnits" || name == "gradientTransform" || name == "spreadMethod" || name == "cx" || name == "cy" || name == "r" || name == "fx" || name == "fy") + { + gradAttributes.insert(name.string(), value.copy()); + } + } + + return gradAttributes; +} diff --git a/ksvg/impl/SVGRectElementImpl.cc b/ksvg/impl/SVGRectElementImpl.cc deleted file mode 100644 index 30a527ca..00000000 --- a/ksvg/impl/SVGRectElementImpl.cc +++ /dev/null @@ -1,242 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "SVGRectImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGRectElementImpl.h" -#include "SVGAnimatedLengthImpl.h" - -#include "KSVGCanvas.h" -#include "CanvasItem.h" - -using namespace KSVG; - -#include "SVGRectElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGRectElementImpl::SVGRectElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - KSVG_EMPTY_FLAGS - - m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x->ref(); - m_x->baseVal()->setValueAsString("-1"); - - m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y->ref(); - m_y->baseVal()->setValueAsString("-1"); - - m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_width->ref(); - m_width->baseVal()->setValueAsString("-1"); - - m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_height->ref(); - m_height->baseVal()->setValueAsString("-1"); - - m_rx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_rx->ref(); - m_rx->baseVal()->setValueAsString("-1"); - - m_ry = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_ry->ref(); - m_ry->baseVal()->setValueAsString("-1"); -} - -SVGRectElementImpl::~SVGRectElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - if(m_rx) - m_rx->deref(); - if(m_ry) - m_ry->deref(); -} - -SVGAnimatedLengthImpl *SVGRectElementImpl::x() -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGRectElementImpl::y() -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGRectElementImpl::width() -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGRectElementImpl::height() -{ - return m_height; -} - -SVGAnimatedLengthImpl *SVGRectElementImpl::rx() -{ - return m_rx; -} - -SVGAnimatedLengthImpl *SVGRectElementImpl::ry() -{ - return m_ry; -} - -/* -@namespace KSVG -@begin SVGRectElementImpl::s_hashTable 7 - x SVGRectElementImpl::X DontDelete|ReadOnly - y SVGRectElementImpl::Y DontDelete|ReadOnly - width SVGRectElementImpl::Width DontDelete|ReadOnly - height SVGRectElementImpl::Height DontDelete|ReadOnly - rx SVGRectElementImpl::Rx DontDelete|ReadOnly - ry SVGRectElementImpl::Ry DontDelete|ReadOnly -@end -*/ - -Value SVGRectElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X: - if(!attributeMode) - return m_x->cache(exec); - else - return Number(m_x->baseVal()->value()); - case Y: - if(!attributeMode) - return m_y->cache(exec); - else - return Number(m_y->baseVal()->value()); - case Width: - if(!attributeMode) - return m_width->cache(exec); - else - return Number(m_width->baseVal()->value()); - case Height: - if(!attributeMode) - return m_height->cache(exec); - else - return Number(m_height->baseVal()->value()); - case Rx: - if(!attributeMode) - return m_rx->cache(exec); - else - return Number(m_rx->baseVal()->value()); - case Ry: - if(!attributeMode) - return m_ry->cache(exec); - else - return Number(m_ry->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGRectElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X: - x()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Y: - y()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Width: - width()->baseVal()->setValueAsString(value.toString(exec).qstring()); - if(width()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute width of element is illegal")); - break; - case Height: - height()->baseVal()->setValueAsString(value.toString(exec).qstring()); - if(height()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute height of element is illegal")); - break; - case Rx: - rx()->baseVal()->setValueAsString(value.toString(exec).qstring()); - if(rx()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute rx of element is illegal")); - break; - case Ry: - ry()->baseVal()->setValueAsString(value.toString(exec).qstring()); - if(ry()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute ry of element is illegal")); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -SVGRectImpl *SVGRectElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - ret->setX(m_x->baseVal()->value()); - ret->setY(m_y->baseVal()->value()); - ret->setWidth(m_width->baseVal()->value()); - ret->setHeight(m_height->baseVal()->value()); - return ret; -} - -void SVGRectElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(X)) - KSVG_SET_ALT_ATTRIBUTE(X, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Y)) - KSVG_SET_ALT_ATTRIBUTE(Y, "0") -} - -void SVGRectElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createRectangle(this); - c->insert(m_item); - } -} diff --git a/ksvg/impl/SVGRectElementImpl.cpp b/ksvg/impl/SVGRectElementImpl.cpp new file mode 100644 index 00000000..30a527ca --- /dev/null +++ b/ksvg/impl/SVGRectElementImpl.cpp @@ -0,0 +1,242 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "SVGRectImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGRectElementImpl.h" +#include "SVGAnimatedLengthImpl.h" + +#include "KSVGCanvas.h" +#include "CanvasItem.h" + +using namespace KSVG; + +#include "SVGRectElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGRectElementImpl::SVGRectElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + KSVG_EMPTY_FLAGS + + m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x->ref(); + m_x->baseVal()->setValueAsString("-1"); + + m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y->ref(); + m_y->baseVal()->setValueAsString("-1"); + + m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_width->ref(); + m_width->baseVal()->setValueAsString("-1"); + + m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_height->ref(); + m_height->baseVal()->setValueAsString("-1"); + + m_rx = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_rx->ref(); + m_rx->baseVal()->setValueAsString("-1"); + + m_ry = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_ry->ref(); + m_ry->baseVal()->setValueAsString("-1"); +} + +SVGRectElementImpl::~SVGRectElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + if(m_rx) + m_rx->deref(); + if(m_ry) + m_ry->deref(); +} + +SVGAnimatedLengthImpl *SVGRectElementImpl::x() +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGRectElementImpl::y() +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGRectElementImpl::width() +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGRectElementImpl::height() +{ + return m_height; +} + +SVGAnimatedLengthImpl *SVGRectElementImpl::rx() +{ + return m_rx; +} + +SVGAnimatedLengthImpl *SVGRectElementImpl::ry() +{ + return m_ry; +} + +/* +@namespace KSVG +@begin SVGRectElementImpl::s_hashTable 7 + x SVGRectElementImpl::X DontDelete|ReadOnly + y SVGRectElementImpl::Y DontDelete|ReadOnly + width SVGRectElementImpl::Width DontDelete|ReadOnly + height SVGRectElementImpl::Height DontDelete|ReadOnly + rx SVGRectElementImpl::Rx DontDelete|ReadOnly + ry SVGRectElementImpl::Ry DontDelete|ReadOnly +@end +*/ + +Value SVGRectElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X: + if(!attributeMode) + return m_x->cache(exec); + else + return Number(m_x->baseVal()->value()); + case Y: + if(!attributeMode) + return m_y->cache(exec); + else + return Number(m_y->baseVal()->value()); + case Width: + if(!attributeMode) + return m_width->cache(exec); + else + return Number(m_width->baseVal()->value()); + case Height: + if(!attributeMode) + return m_height->cache(exec); + else + return Number(m_height->baseVal()->value()); + case Rx: + if(!attributeMode) + return m_rx->cache(exec); + else + return Number(m_rx->baseVal()->value()); + case Ry: + if(!attributeMode) + return m_ry->cache(exec); + else + return Number(m_ry->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGRectElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X: + x()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Y: + y()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Width: + width()->baseVal()->setValueAsString(value.toString(exec).qstring()); + if(width()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute width of element is illegal")); + break; + case Height: + height()->baseVal()->setValueAsString(value.toString(exec).qstring()); + if(height()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute height of element is illegal")); + break; + case Rx: + rx()->baseVal()->setValueAsString(value.toString(exec).qstring()); + if(rx()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute rx of element is illegal")); + break; + case Ry: + ry()->baseVal()->setValueAsString(value.toString(exec).qstring()); + if(ry()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute ry of element is illegal")); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +SVGRectImpl *SVGRectElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + ret->setX(m_x->baseVal()->value()); + ret->setY(m_y->baseVal()->value()); + ret->setWidth(m_width->baseVal()->value()); + ret->setHeight(m_height->baseVal()->value()); + return ret; +} + +void SVGRectElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(X)) + KSVG_SET_ALT_ATTRIBUTE(X, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Y)) + KSVG_SET_ALT_ATTRIBUTE(Y, "0") +} + +void SVGRectElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createRectangle(this); + c->insert(m_item); + } +} diff --git a/ksvg/impl/SVGRectImpl.cc b/ksvg/impl/SVGRectImpl.cc deleted file mode 100644 index f02b5a4d..00000000 --- a/ksvg/impl/SVGRectImpl.cc +++ /dev/null @@ -1,155 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGRectImpl.h" - -using namespace KSVG; - -#include "SVGRectImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGRectImpl::SVGRectImpl() -{ - KSVG_EMPTY_FLAGS - - m_x = 0; - m_y = 0; - m_width = 0; - m_height = 0; -} - -SVGRectImpl::SVGRectImpl(const TQRect &other) -{ - (*this) = other; -} - -SVGRectImpl::~SVGRectImpl() -{ -} - -void SVGRectImpl::setX(float x) -{ - m_x = x; -} - -float SVGRectImpl::x() const -{ - return m_x; -} - -void SVGRectImpl::setY(float y) -{ - m_y = y; -} - -float SVGRectImpl::y() const -{ - return m_y; -} - -void SVGRectImpl::setWidth(float width) -{ - m_width = width; -} - -float SVGRectImpl::width() const -{ - return m_width; -} - -void SVGRectImpl::setHeight(float height) -{ - m_height = height; -} - -float SVGRectImpl::height() const -{ - return m_height; -} - -TQRect SVGRectImpl::qrect() const -{ - // ceil() so the integer rectangle contains the whole real one. - return TQRect(int(m_x), int(m_y), int(ceil(m_width)), int(ceil(m_height))); -} - -SVGRectImpl &SVGRectImpl::operator=(const TQRect &other) -{ - m_x = other.x(); - m_y = other.y(); - m_width = other.width(); - m_height = other.height(); - - return *this; -} - -/* -@namespace KSVG -@begin SVGRectImpl::s_hashTable 5 - x SVGRectImpl::X DontDelete - y SVGRectImpl::Y DontDelete - width SVGRectImpl::Width DontDelete - height SVGRectImpl::Height DontDelete -@end -*/ - -Value SVGRectImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case X: - return Number(m_x); - case Y: - return Number(m_y); - case Width: - return Number(m_width); - case Height: - return Number(m_height); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGRectImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case X: - m_x = value.toNumber(exec); - break; - case Y: - m_y = value.toNumber(exec); - break; - case Width: - m_width = value.toNumber(exec); - break; - case Height: - m_height = value.toNumber(exec); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGRectImpl.cpp b/ksvg/impl/SVGRectImpl.cpp new file mode 100644 index 00000000..f02b5a4d --- /dev/null +++ b/ksvg/impl/SVGRectImpl.cpp @@ -0,0 +1,155 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGRectImpl.h" + +using namespace KSVG; + +#include "SVGRectImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGRectImpl::SVGRectImpl() +{ + KSVG_EMPTY_FLAGS + + m_x = 0; + m_y = 0; + m_width = 0; + m_height = 0; +} + +SVGRectImpl::SVGRectImpl(const TQRect &other) +{ + (*this) = other; +} + +SVGRectImpl::~SVGRectImpl() +{ +} + +void SVGRectImpl::setX(float x) +{ + m_x = x; +} + +float SVGRectImpl::x() const +{ + return m_x; +} + +void SVGRectImpl::setY(float y) +{ + m_y = y; +} + +float SVGRectImpl::y() const +{ + return m_y; +} + +void SVGRectImpl::setWidth(float width) +{ + m_width = width; +} + +float SVGRectImpl::width() const +{ + return m_width; +} + +void SVGRectImpl::setHeight(float height) +{ + m_height = height; +} + +float SVGRectImpl::height() const +{ + return m_height; +} + +TQRect SVGRectImpl::qrect() const +{ + // ceil() so the integer rectangle contains the whole real one. + return TQRect(int(m_x), int(m_y), int(ceil(m_width)), int(ceil(m_height))); +} + +SVGRectImpl &SVGRectImpl::operator=(const TQRect &other) +{ + m_x = other.x(); + m_y = other.y(); + m_width = other.width(); + m_height = other.height(); + + return *this; +} + +/* +@namespace KSVG +@begin SVGRectImpl::s_hashTable 5 + x SVGRectImpl::X DontDelete + y SVGRectImpl::Y DontDelete + width SVGRectImpl::Width DontDelete + height SVGRectImpl::Height DontDelete +@end +*/ + +Value SVGRectImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case X: + return Number(m_x); + case Y: + return Number(m_y); + case Width: + return Number(m_width); + case Height: + return Number(m_height); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGRectImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case X: + m_x = value.toNumber(exec); + break; + case Y: + m_y = value.toNumber(exec); + break; + case Width: + m_width = value.toNumber(exec); + break; + case Height: + m_height = value.toNumber(exec); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGSVGElementImpl.cc b/ksvg/impl/SVGSVGElementImpl.cc deleted file mode 100644 index 98106d7c..00000000 --- a/ksvg/impl/SVGSVGElementImpl.cc +++ /dev/null @@ -1,980 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include -#include -#include - -#define USE_VALGRIND 0 - -#if USE_VALGRIND -#include -#endif - -#include "SVGLength.h" - -#include "SVGRectImpl.h" -#include "SVGAngleImpl.h" -#include "SVGShapeImpl.h" -#include "SVGPointImpl.h" -#include "SVGNumberImpl.h" -#include "SVGMatrixImpl.h" - -#include "SVGEventImpl.h" -#include "SVGAElementImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGViewSpecImpl.h" -#include "SVGTransformImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedRectImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGPreserveAspectRatioImpl.h" -#include "SVGAnimatedTransformListImpl.h" -#include "SVGAnimatedPreserveAspectRatioImpl.h" - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -using namespace KSVG; - -#include "SVGSVGElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGSVGElementImpl::SVGSVGElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGLocatableImpl(), SVGFitToViewBoxImpl(), SVGZoomAndPanImpl() -{ - KSVG_EMPTY_FLAGS - - m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_y->ref(); - - m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_height->ref(); - - m_viewport = SVGSVGElementImpl::createSVGRect(); - - m_currentTranslate = SVGSVGElementImpl::createSVGPoint(); - - m_currentView = new SVGViewSpecImpl(); - m_currentView->ref(); - - m_currentScale = 1.0; - - m_useCurrentView = false; - - m_clip[0] = 0; - m_clip[1] = 0; - m_clip[2] = 0; - m_clip[3] = 0; - - m_rootParentScreenCTM = 0; - - m_localMatrix = SVGSVGElementImpl::createSVGMatrix(); -} - -SVGSVGElementImpl::~SVGSVGElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - if(m_viewport) - m_viewport->deref(); - if(m_currentTranslate) - m_currentTranslate->deref(); - if(m_currentView) - m_currentView->deref(); - if(m_rootParentScreenCTM) - m_rootParentScreenCTM->deref(); - if(m_localMatrix) - m_localMatrix->deref(); -} - -bool SVGSVGElementImpl::isRootElement() const -{ - return ownerDoc()->rootElement() == this; -} - -void SVGSVGElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(X)) - KSVG_SET_ALT_ATTRIBUTE(X, "0") - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(Y)) - KSVG_SET_ALT_ATTRIBUTE(Y, "0") - - // Spec: If the attribute is not specified, the effect is as if a value of "100%" were specified. - if(KSVG_TOKEN_NOT_PARSED(Width)) - KSVG_SET_ALT_ATTRIBUTE(Width, "100%") - - // Spec: If the attribute is not specified, the effect is as if a value of "100%" were specified. - if(KSVG_TOKEN_NOT_PARSED(Height)) - KSVG_SET_ALT_ATTRIBUTE(Height, "100%") - - // Spec: The contentScriptType should default to "text/ecmascript". - if(KSVG_TOKEN_NOT_PARSED(ContentScriptType)) - KSVG_SET_ALT_ATTRIBUTE(ContentScriptType, "text/ecmascript") - - // Spec: The contentStyleType should default to "text/css". - if(KSVG_TOKEN_NOT_PARSED(ContentStyleType)) - KSVG_SET_ALT_ATTRIBUTE(ContentStyleType, "text/css") - - if(m_useCurrentView) - { - parseViewBox(m_currentView->viewBoxString().string()); - preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(m_currentView->preserveAspectRatioString().string()); - } - - m_viewport->setX(x()->baseVal()->value()); - m_viewport->setY(y()->baseVal()->value()); - m_viewport->setWidth(width()->baseVal()->value()); - m_viewport->setHeight(height()->baseVal()->value()); - - if(isRootElement() && ownerDoc()->parentImage() == 0) - { - if(ownerDoc()->canvas()) - ownerDoc()->canvas()->setViewportDimension(int(ceil(width()->baseVal()->value() * currentScale())), int(ceil(height()->baseVal()->value() * currentScale()))); - - // Special case for outermost svg element: - // We need to register our id manually, because - // m_ownerSVGElement is 0 in SVGElementImpl::setAttributes (Niko) - if(!id().isNull()) - addToIdMap(id().string(), this); - } -} - -SVGAnimatedLengthImpl *SVGSVGElementImpl::x() -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGSVGElementImpl::y() -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGSVGElementImpl::width() -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGSVGElementImpl::height() -{ - return m_height; -} - -void SVGSVGElementImpl::setContentScriptType(const DOM::DOMString &contentScriptType) -{ - setAttribute("contentScriptType", contentScriptType); -} - -DOM::DOMString SVGSVGElementImpl::contentScriptType() const -{ - return getAttribute("contentScriptType"); -} - -void SVGSVGElementImpl::setContentStyleType(const DOM::DOMString &contentStyleType) -{ - setAttribute("contentStyleType", contentStyleType); -} - -DOM::DOMString SVGSVGElementImpl::contentStyleType() const -{ - return getAttribute("contentStyleType"); -} - -SVGRectImpl *SVGSVGElementImpl::viewport() -{ - return m_viewport; -} - -SVGRectImpl *SVGSVGElementImpl::getBBox() -{ - SVGRectImpl *ret = new SVGRectImpl(getCTM()->qmatrix().invert().map(m_viewport->qrect())); - ret->ref(); - return ret; -} - -float SVGSVGElementImpl::pixelUnitToMillimeterX() const -{ - return ownerDoc()->screenPixelsPerMillimeterX(); -} - -float SVGSVGElementImpl::pixelUnitToMillimeterY() const -{ - return ownerDoc()->screenPixelsPerMillimeterY(); -} - -float SVGSVGElementImpl::screenPixelToMillimeterX() const -{ - return pixelUnitToMillimeterX(); -} - -float SVGSVGElementImpl::screenPixelToMillimeterY() const -{ - return pixelUnitToMillimeterY(); -} - -void SVGSVGElementImpl::setUseCurrentView(bool useCurrentView) -{ - m_useCurrentView = useCurrentView; -} - -bool SVGSVGElementImpl::useCurrentView() const -{ - return m_useCurrentView; -} - -SVGViewSpecImpl *SVGSVGElementImpl::currentView() const -{ - return m_currentView; -} - -void SVGSVGElementImpl::setCurrentScale(float currentScale) -{ - if( m_currentScale != currentScale ) - { - m_currentScale = currentScale; - invalidateCachedMatrices(); - - if(hasEventListener(SVGEvent::ZOOM_EVENT, true)) - dispatchEvent(SVGEvent::ZOOM_EVENT, false, false); - } -} - -float SVGSVGElementImpl::currentScale() const -{ - return m_currentScale; -} - -void SVGSVGElementImpl::setCurrentTranslate(const TQPoint &p) -{ - if(m_currentTranslate->x() != p.x() || m_currentTranslate->y() != p.y()) - { - m_currentTranslate->setX(p.x()); - m_currentTranslate->setY(p.y()); - invalidateCachedMatrices(); - if(hasEventListener(SVGEvent::SCROLL_EVENT, true)) - dispatchEvent(SVGEvent::SCROLL_EVENT, false, false); - } -} - -SVGPointImpl *SVGSVGElementImpl::currentTranslate() -{ - return m_currentTranslate; -} - -unsigned long SVGSVGElementImpl::suspendRedraw(unsigned long) -{ - return 0; -} - -void SVGSVGElementImpl::unsuspendRedraw(unsigned long) -{ -} - -void SVGSVGElementImpl::unsuspendRedrawAll() -{ -} - -void SVGSVGElementImpl::forceRedraw() -{ -#if USE_VALGRIND - CALLTREE_ZERO_STATS(); -#endif - - TQTime timer; - timer.start(); - - if(ownerDoc() && ownerDoc()->canvas()) - ownerDoc()->canvas()->update(); - - kdDebug(26000) << "forceRedraw in " << timer.elapsed()/1000.0 << " seconds" << endl; - -#if USE_VALGRIND - CALLTREE_DUMP_STATS(); -#endif -} - -void SVGSVGElementImpl::pauseAnimations() -{ - if(!ownerDoc()->timeScheduler()->animationsPaused()) - ownerDoc()->timeScheduler()->toggleAnimations(); -} - -void SVGSVGElementImpl::unpauseAnimations() -{ - if(ownerDoc()->timeScheduler()->animationsPaused()) - ownerDoc()->timeScheduler()->toggleAnimations(); -} - -bool SVGSVGElementImpl::animationsPaused() -{ - return ownerDoc()->timeScheduler()->animationsPaused(); -} - -float SVGSVGElementImpl::getCurrentTime() const -{ - return ownerDoc()->timeScheduler()->elapsed(); -} - -void SVGSVGElementImpl::setCurrentTime(float) -{ -} - -DOM::NodeList SVGSVGElementImpl::getIntersectionList(SVGRectImpl *, SVGElementImpl *) -{ - // TODO : implement me - return DOM::NodeList(); -} - -DOM::NodeList SVGSVGElementImpl::getEnclosureList(SVGRectImpl *rect, SVGElementImpl */*referenceElement*/) -{ - DOM::NodeList list; - - DOM::Node node = firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - SVGShapeImpl *shape = dynamic_cast(element); - if(shape) - { - if(shape->isContainer()) - // TODO : pass it on to container::getEnclosureList() which should return a NodeList - kdDebug() << "!shape" << endl; - else - { - // TODO : add the shape to list if the test succeeds - SVGRectImpl *current = shape->getBBox(); - if(rect->qrect().contains(current->qrect(), true)) - kdDebug() << "shape : " << element->nodeName().string() << " is fully enclosed" << endl; - - current->deref(); - } - } - } - - return list; -} - -bool SVGSVGElementImpl::checkIntersection(SVGElementImpl *element, SVGRectImpl *rect) -{ - SVGShapeImpl *shape = dynamic_cast(element); - if(!shape) - return false; - - SVGRectImpl *current = shape->getBBox(); - bool result = rect->qrect().intersects(current->qrect()); - current->deref(); - return result; -} - -bool SVGSVGElementImpl::checkEnclosure(SVGElementImpl *element, SVGRectImpl *rect) -{ - SVGShapeImpl *shape = dynamic_cast(element); - if(!shape) - return false; - - SVGRectImpl *current = shape->getBBox(); - bool result = rect->qrect().contains(current->qrect()); - current->deref(); - return result; -} - -void SVGSVGElementImpl::deSelectAll() -{ -} - -SVGNumberImpl *SVGSVGElementImpl::createSVGNumber() -{ - // Spec: Creates an SVGNumber object outside of any document - // trees. The object is initialized to a value of zero. - SVGNumberImpl *ret = new SVGNumberImpl(); - ret->ref(); - return ret; -} - -SVGLengthImpl *SVGSVGElementImpl::createSVGLength() -{ - // Spec: Creates an SVGLength object outside of any document - // trees. The object is initialized to the value of 0 user units. - SVGLengthImpl *ret = new SVGLengthImpl(); - ret->ref(); - return ret; -} - -SVGAngleImpl *SVGSVGElementImpl::createSVGAngle() -{ - // Spec: Creates an SVGAngle object outside of any document - // trees. The object is initialized to the value 0 degrees (unitless). - SVGAngleImpl *ret = new SVGAngleImpl(); - ret->ref(); - return ret; -} - -SVGPointImpl *SVGSVGElementImpl::createSVGPoint() -{ - // Spec: Creates an SVGPoint object outside of any document - // trees. The object is initialized to the point (0,0) in the user coordinate system. - SVGPointImpl *ret = new SVGPointImpl(); - ret->ref(); - return ret; -} - -SVGMatrixImpl *SVGSVGElementImpl::createSVGMatrix() -{ - // Spec: Creates an SVGMatrix object outside of any document - // trees. The object is initialized to the identity matrix. - SVGMatrixImpl *ret = new SVGMatrixImpl(TQWMatrix(1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F)); - ret->ref(); - return ret; -} - -SVGRectImpl *SVGSVGElementImpl::createSVGRect() -{ - // Spec: Creates an SVGRect object outside of any document - // trees. The object is initialized such that all values are set to 0 user units. - SVGRectImpl *ret = new SVGRectImpl(); - ret->ref(); - return ret; -} - -SVGTransformImpl *SVGSVGElementImpl::createSVGTransform() -{ - // Spec: Creates an SVGTransform object outside of any document - // trees. The object is initialized to an identity matrix transform (SVG_TRANSFORM_MATRIX). - SVGTransformImpl *transform = createSVGTransformFromMatrix(createSVGMatrix()); - - // createSVGMatrix already ref's the matrix, the SVGTransformImpl->setMatrix - // call also does this, prevent non deleting of the object by deref'ing (Niko) - transform->matrix()->deref(); - - return transform; -} - -SVGTransformImpl *SVGSVGElementImpl::createSVGTransformFromMatrix(SVGMatrixImpl *mat) -{ - // Spec: Creates an SVGTransform object outside of any document - // trees. The object is initialized to the given matrix transform (i.e., SVG_TRANSFORM_MATRIX). - SVGTransformImpl *ret = new SVGTransformImpl(); - ret->setMatrix(mat); - ret->ref(); - return ret; -} - -SVGElementImpl *SVGSVGElementImpl::getElementById(const DOM::DOMString &elementId) -{ - return m_map[elementId.string()]; -} - -void SVGSVGElementImpl::addToIdMap(const TQString &id, SVGElementImpl *obj) -{ - m_map.insert(id, obj); -} - -SVGMatrixImpl *SVGSVGElementImpl::getCTM() -{ - return viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value()); -} - -const SVGMatrixImpl *SVGSVGElementImpl::localMatrix() -{ - // TODO: only update the matrix when needed and just return m_localMatrix - - m_localMatrix->reset(); - - if(ownerSVGElement() == 0) - { - if(m_rootParentScreenCTM != 0) - m_localMatrix->copy(m_rootParentScreenCTM); - - // We're the outermost svg element. - // Put the zoom scale and translate into the matrix. - m_localMatrix->translate(currentTranslate()->x(), currentTranslate()->y()); - m_localMatrix->scale(currentScale()); - } - - // Apply viewport translation. - m_localMatrix->translate(x()->baseVal()->value(), y()->baseVal()->value()); - - // And viewbox. - SVGMatrixImpl *viewboxMatrix = viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value()); - - m_localMatrix->multiply(viewboxMatrix); - viewboxMatrix->deref(); - - return m_localMatrix; -} - -void SVGSVGElementImpl::setClip(const TQString &clip) -{ - // TODO : this routine should probably be shared between all classes that establish new viewports (Rob) - if(!clip.startsWith("rect(") || !clip.endsWith(")")) - return; - - TQString work = clip.mid(5, clip.length() - 6); - TQStringList substrings = TQStringList::split(',', clip); - TQStringList::ConstIterator it = substrings.begin(); - - if(m_clip[0]) - m_clip[0]->deref(); - m_clip[0] = SVGSVGElementImpl::createSVGLength(); - - if(*it != "auto") - m_clip[0]->setValueAsString(*it); - ++it; - - if(m_clip[1]) - m_clip[1]->deref(); - m_clip[1] = SVGSVGElementImpl::createSVGLength(); - - if(*it != "auto") - m_clip[1]->setValueAsString(*it); - ++it; - - if(m_clip[2]) - m_clip[2]->deref(); - m_clip[2] = SVGSVGElementImpl::createSVGLength(); - - if(*it != "auto") - m_clip[2]->setValueAsString(*it); - ++it; - - if(m_clip[3]) - m_clip[3]->deref(); - m_clip[3] = SVGSVGElementImpl::createSVGLength(); - - if(*it != "auto") - m_clip[3]->setValueAsString(*it); -} - -TQRect SVGSVGElementImpl::clip() -{ - // Get viewport in user coordinates. - TQRect v(0, 0, m_viewport->qrect().width(), m_viewport->qrect().height()); - - SVGMatrixImpl *ctm = getCTM(); - TQRect r = ctm->qmatrix().invert().mapRect(v); - ctm->deref(); - - if(m_clip[0]) - r.setTop(static_cast(r.top() + m_clip[0]->value())); - if(m_clip[1]) - r.setRight(static_cast(r.right() - m_clip[1]->value())); - if(m_clip[2]) - r.setBottom(static_cast(r.bottom() - m_clip[2]->value())); - if(m_clip[3]) - r.setLeft(static_cast(r.left() + m_clip[3]->value())); - - return r; -} - -void SVGSVGElementImpl::setRootParentScreenCTM(SVGMatrixImpl *screenCTM) -{ - if(m_rootParentScreenCTM != 0) - m_rootParentScreenCTM->deref(); - - m_rootParentScreenCTM = screenCTM; - screenCTM->ref(); -} - -bool SVGSVGElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &a, SVGMouseEventImpl *mev) -{ - // mop: central bool var which turns to true once the current "mouseover" element has been found - bool ret = false, dorerender = false; - SVGElementImpl *elem = 0; - - SVGMatrixImpl *ctm = getCTM(); - TQPoint userA = ctm->qmatrix().invert().map(a); - ctm->deref(); - - // Just check the lastTarget once (mop) - if(ownerDoc()->lastTarget()) - { - elem = ownerDoc()->lastTarget(); - ret = elem->prepareMouseEvent(p, userA, mev); - - // mop: only proceed if element is not the current element anymore. rest is done in the lower part - if(!ret) - { - if(elem->hasEventListener(SVGEvent::MOUSEOUT_EVENT, false)) - { - dorerender = true; - elem->setMouseOver(false); - elem->dispatchMouseEvent(SVGEvent::MOUSEOUT_EVENT, true, true, 0, mev->screenX(), mev->screenY(), mev->clientX(), mev->clientY(), mev->ctrlKey(), mev->altKey(), mev->shiftKey(), mev->metaKey(), mev->button(), elem); - } - - if(elem->hasEventListener(SVGEvent::DOMFOCUSOUT_EVENT, false) && elem->focus()) - { - dorerender = true; - elem->setFocus(false); - elem->dispatchEvent(SVGEvent::DOMFOCUSOUT_EVENT, true, true); - } - - // mop: unset last target once we left it - ownerDoc()->setLastTarget(0); - } - } - - // mop: DAMN...logic doesn't work :( - // we cant use the results of the above check because something like this - // _________ - // | ____ | - // ||____| | - // |_________| - // - // wouldn't work because even if the mousepointer would be in the inner rect it would still be inside the bbox - // of the outer (assuming that the outer is the lastTarget). :( - ret = false; - - // mop: just check for a node until the element where the mouse is over is found - // mop: "ret" can be set from the above stuff too... - // find the element here and do the event stuff in the lower part..much cleaner - CanvasItemList hits = ownerDoc()->canvas()->collisions(p, true); - for(CanvasItemList::Iterator it = hits.begin(); it != hits.end(); ++it) - { - elem = (*it)->element(); - if(elem) - { - // Check if mouse is over a certain shape... - // mop: once an element has been found check eventlisteners and leave immediately - ret = elem->prepareMouseEvent(p, userA, mev); - if(ret) break; - } - } - - // mop: has an element been found? - if(ret) - { - int events = mev->target()->getEventListeners(false); - - // Dispatch mousemove, mousedown, mouseup and mouseclick events - bool cancel = (mev->id() != SVGEvent::MOUSEMOVE_EVENT); - - if(events & 1 << mev->id()) - { - mev->target()->dispatchMouseEvent(mev->id(), true, cancel, 0, mev->screenX(), mev->screenY(), mev->clientX(), mev->clientY(), mev->ctrlKey(), mev->altKey(), mev->shiftKey(), mev->metaKey(), mev->button(), elem); - dorerender = true; // mop: if it has the event then rerender - } - - // If a mouse "moves" over a shape, it's also "over" the shape - if(mev->id() == SVGEvent::MOUSEMOVE_EVENT) - { - mev->target()->setMouseOver(true); - if(events & 1 << SVGEvent::MOUSEOVER_EVENT) - { - mev->target()->dispatchMouseEvent(SVGEvent::MOUSEOVER_EVENT, true, cancel, 0, mev->screenX(), mev->screenY(), mev->clientX(), mev->clientY(), mev->ctrlKey(), mev->altKey(), mev->shiftKey(), mev->metaKey(), mev->button(), elem); - dorerender = true; - } - - } - - // Also send an domactivate + focusin event on mouseup - bool dolinktest = true; - if(mev->id() == SVGEvent::MOUSEUP_EVENT) - { - mev->target()->setFocus(true); - - if(events & 1 << SVGEvent::CLICK_EVENT) - { - dolinktest = mev->target()->dispatchEvent(SVGEvent::CLICK_EVENT, true, true); - dorerender = true; - } - - if(events & 1 << SVGEvent::DOMACTIVATE_EVENT) - { - mev->target()->dispatchEvent(SVGEvent::DOMACTIVATE_EVENT, true, true); - dorerender = true; - } - - if(events & 1 << SVGEvent::DOMFOCUSIN_EVENT) - { - mev->target()->dispatchEvent(SVGEvent::DOMFOCUSIN_EVENT, true, true); - dorerender = true; - } - } - - // Hyperlink support - SVGAElementImpl* link=0; - if(dolinktest && !mev->defaultPrevented()) - { - link = SVGAElementImpl::getLink(elem); - if(link) - { - mev->setURL(link->href()->baseVal()); - emit ownerDoc()->gotURL(link->target()->baseVal().string()); - } - } - - // The mouse is over a shape, so we have a target..we need to register that for a mouseout - ownerDoc()->setLastTarget(mev->target()); - } - - // mop: all events may trigger changed style, add elements etc. this is definately needed :( - if(dorerender) - ownerDoc()->rerender(); - - return dorerender; // mop: some kind of event has been found and executed -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGSVGElementImpl::s_hashTable 23 - x SVGSVGElementImpl::X DontDelete|ReadOnly - y SVGSVGElementImpl::Y DontDelete|ReadOnly - width SVGSVGElementImpl::Width DontDelete|ReadOnly - height SVGSVGElementImpl::Height DontDelete|ReadOnly - viewport SVGSVGElementImpl::Viewport DontDelete|ReadOnly - contentScriptType SVGSVGElementImpl::ContentScriptType DontDelete - contentStyleType SVGSVGElementImpl::ContentStyleType DontDelete - pixelUnitToMillimeterX SVGSVGElementImpl::PixelUnitToMillimeterX DontDelete|ReadOnly - pixelUnitToMillimeterY SVGSVGElementImpl::PixelUnitToMillimeterY DontDelete|ReadOnly - screenPixelToMillimeterX SVGSVGElementImpl::ScreenPixelToMillimeterX DontDelete|ReadOnly - screenPixelToMillimeterY SVGSVGElementImpl::ScreenPixelToMillimeterY DontDelete|ReadOnly - useCurrentView SVGSVGElementImpl::UseCurrentView DontDelete - currentScale SVGSVGElementImpl::CurrentScale DontDelete - currentTranslate SVGSVGElementImpl::CurrentTranslate DontDelete|ReadOnly - onunload SVGSVGElementImpl::OnUnload DontDelete - onerror SVGSVGElementImpl::OnError DontDelete - onresize SVGSVGElementImpl::OnResize DontDelete - onzoom SVGSVGElementImpl::OnZoom DontDelete - onscroll SVGSVGElementImpl::OnScroll DontDelete -@end -@namespace KSVG -@begin SVGSVGElementImplProto::s_hashTable 29 - createSVGNumber SVGSVGElementImpl::CreateSVGNumber DontDelete|Function 0 - createSVGLength SVGSVGElementImpl::CreateSVGLength DontDelete|Function 0 - createSVGAngle SVGSVGElementImpl::CreateSVGAngle DontDelete|Function 0 - createSVGPoint SVGSVGElementImpl::CreateSVGPoint DontDelete|Function 0 - createSVGMatrix SVGSVGElementImpl::CreateSVGMatrix DontDelete|Function 0 - createSVGRect SVGSVGElementImpl::CreateSVGRect DontDelete|Function 0 - createSVGTransform SVGSVGElementImpl::CreateSVGTransform DontDelete|Function 0 - createSVGTransformFromMatrix SVGSVGElementImpl::CreateSVGTransformFromMatrix DontDelete|Function 1 - suspendRedraw SVGSVGElementImpl::SuspendRedraw DontDelete|Function 1 - unsuspendRedraw SVGSVGElementImpl::UnsuspendRedraw DontDelete|Function 1 - unsuspendRedrawAll SVGSVGElementImpl::UnsuspendRedrawAll DontDelete|Function 0 - forceRedraw SVGSVGElementImpl::ForceRedraw DontDelete|Function 0 - pauseAnimations SVGSVGElementImpl::PauseAnimations DontDelete|Function 0 - unpauseAnimations SVGSVGElementImpl::UnpauseAnimations DontDelete|Function 0 - animationsPaused SVGSVGElementImpl::AnimationsPaused DontDelete|Function 0 - getCurrentTime SVGSVGElementImpl::GetCurrentTime DontDelete|Function 0 - setCurrentTime SVGSVGElementImpl::SetCurrentTime DontDelete|Function 1 - getIntersectionList SVGSVGElementImpl::GetIntersectionList DontDelete|Function 2 - getEnclosureList SVGSVGElementImpl::GetEnclosureList DontDelete|Function 2 - checkIntersection SVGSVGElementImpl::CheckIntersection DontDelete|Function 2 - checkEnclosure SVGSVGElementImpl::CheckEnclosure DontDelete|Function 2 - deselectAll SVGSVGElementImpl::DeselectAll DontDelete|Function 0 - getElementById SVGSVGElementImpl::GetElementById DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGSVGElement", SVGSVGElementImplProto, SVGSVGElementImplProtoFunc) - -Value SVGSVGElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X: - if(!attributeMode) - return m_x->cache(exec); - else - return Number(m_x->baseVal()->value()); - case Y: - if(!attributeMode) - return m_y->cache(exec); - else - return Number(m_y->baseVal()->value()); - case Width: - if(!attributeMode) - return m_width->cache(exec); - else - return Number(m_width->baseVal()->value()); - case Height: - if(!attributeMode) - return m_height->cache(exec); - else - return Number(m_height->baseVal()->value()); - case Viewport: - return m_viewport->cache(exec); - case ContentScriptType: - return String(contentScriptType().string()); - case ContentStyleType: - return String(contentStyleType().string()); - case PixelUnitToMillimeterX: - return Number(pixelUnitToMillimeterX()); - case PixelUnitToMillimeterY: - return Number(pixelUnitToMillimeterY()); - case ScreenPixelToMillimeterX: - return Number(screenPixelToMillimeterX()); - case ScreenPixelToMillimeterY: - return Number(screenPixelToMillimeterY()); - case UseCurrentView: - return Boolean(useCurrentView()); - case CurrentScale: - return Number(currentScale()); - case CurrentTranslate: - return m_currentTranslate->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGSVGElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) -{ - switch(token) - { - case ContentScriptType: - setContentScriptType(value.toString(exec).string()); - break; - case ContentStyleType: - setContentStyleType(value.toString(exec).string()); - break; - case CurrentScale: - m_currentScale = value.toNumber(exec); - break; - case X: - x()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Y: - y()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Width: - width()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Height: - height()->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case OnUnload: - // Spec: only applicable to outermost 'svg' elements - if(isRootElement()) - setEventListener(SVGEvent::UNLOAD_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); - break; - case OnError: - setEventListener(SVGEvent::ERROR_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); - break; - case OnResize: - // Spec: only applicable to outermost 'svg' elements - if(isRootElement()) - setEventListener(SVGEvent::RESIZE_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); - break; - case OnZoom: - // Spec: only applicable to outermost 'svg' elements - if(isRootElement()) - setEventListener(SVGEvent::ZOOM_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); - break; - case OnScroll: - // Spec: only applicable to outermost 'svg' elements - if(isRootElement()) - setEventListener(SVGEvent::SCROLL_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); - break; - default: - kdWarning() << k_funcinfo << "unhandled token " << token << endl; - } -} - -Value SVGSVGElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGSVGElementImpl) - - switch(id) - { - case SVGSVGElementImpl::CreateSVGNumber: - return obj->createSVGNumber()->cache(exec); - case SVGSVGElementImpl::CreateSVGLength: - return obj->createSVGLength()->cache(exec); - case SVGSVGElementImpl::CreateSVGAngle: - return obj->createSVGAngle()->cache(exec); - case SVGSVGElementImpl::CreateSVGPoint: - return obj->createSVGPoint()->cache(exec); - case SVGSVGElementImpl::CreateSVGMatrix: - return obj->createSVGMatrix()->cache(exec); - case SVGSVGElementImpl::CreateSVGRect: - return obj->createSVGRect()->cache(exec); - case SVGSVGElementImpl::CreateSVGTransform: - return obj->createSVGTransform()->cache(exec); - case SVGSVGElementImpl::CreateSVGTransformFromMatrix: - return obj->createSVGTransformFromMatrix(static_cast *>(args[0].imp())->impl())->cache(exec); - case SVGSVGElementImpl::GetElementById: - { - // Keep in sync with SVGDocumentImpl's version. - Value ret; - - SVGElementImpl *element = obj->getElementById(args[0].toString(exec).string()); - - if(element) - ret = getDOMNode(exec, *element); - else - { - element = obj->ownerDoc()->recursiveSearch(*(obj->ownerDoc()), args[0].toString(exec).string()); - if(!element) - return Null(); - - ret = getDOMNode(exec, *element); - } - - return ret; - } - case SVGSVGElementImpl::GetCurrentTime: - return Number(obj->getCurrentTime()); - case SVGSVGElementImpl::SetCurrentTime: - obj->setCurrentTime(args[0].toNumber(exec)); - return Undefined(); - case SVGSVGElementImpl::DeselectAll: - obj->deSelectAll(); - return Undefined(); - case SVGSVGElementImpl::PauseAnimations: - obj->pauseAnimations(); - return Undefined(); - case SVGSVGElementImpl::UnpauseAnimations: - obj->unpauseAnimations(); - return Undefined(); - case SVGSVGElementImpl::AnimationsPaused: - return Boolean(obj->animationsPaused()); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} diff --git a/ksvg/impl/SVGSVGElementImpl.cpp b/ksvg/impl/SVGSVGElementImpl.cpp new file mode 100644 index 00000000..98106d7c --- /dev/null +++ b/ksvg/impl/SVGSVGElementImpl.cpp @@ -0,0 +1,980 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include +#include + +#define USE_VALGRIND 0 + +#if USE_VALGRIND +#include +#endif + +#include "SVGLength.h" + +#include "SVGRectImpl.h" +#include "SVGAngleImpl.h" +#include "SVGShapeImpl.h" +#include "SVGPointImpl.h" +#include "SVGNumberImpl.h" +#include "SVGMatrixImpl.h" + +#include "SVGEventImpl.h" +#include "SVGAElementImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGViewSpecImpl.h" +#include "SVGTransformImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedRectImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGPreserveAspectRatioImpl.h" +#include "SVGAnimatedTransformListImpl.h" +#include "SVGAnimatedPreserveAspectRatioImpl.h" + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +using namespace KSVG; + +#include "SVGSVGElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGSVGElementImpl::SVGSVGElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGLocatableImpl(), SVGFitToViewBoxImpl(), SVGZoomAndPanImpl() +{ + KSVG_EMPTY_FLAGS + + m_x = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_y->ref(); + + m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_height->ref(); + + m_viewport = SVGSVGElementImpl::createSVGRect(); + + m_currentTranslate = SVGSVGElementImpl::createSVGPoint(); + + m_currentView = new SVGViewSpecImpl(); + m_currentView->ref(); + + m_currentScale = 1.0; + + m_useCurrentView = false; + + m_clip[0] = 0; + m_clip[1] = 0; + m_clip[2] = 0; + m_clip[3] = 0; + + m_rootParentScreenCTM = 0; + + m_localMatrix = SVGSVGElementImpl::createSVGMatrix(); +} + +SVGSVGElementImpl::~SVGSVGElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + if(m_viewport) + m_viewport->deref(); + if(m_currentTranslate) + m_currentTranslate->deref(); + if(m_currentView) + m_currentView->deref(); + if(m_rootParentScreenCTM) + m_rootParentScreenCTM->deref(); + if(m_localMatrix) + m_localMatrix->deref(); +} + +bool SVGSVGElementImpl::isRootElement() const +{ + return ownerDoc()->rootElement() == this; +} + +void SVGSVGElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(X)) + KSVG_SET_ALT_ATTRIBUTE(X, "0") + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(Y)) + KSVG_SET_ALT_ATTRIBUTE(Y, "0") + + // Spec: If the attribute is not specified, the effect is as if a value of "100%" were specified. + if(KSVG_TOKEN_NOT_PARSED(Width)) + KSVG_SET_ALT_ATTRIBUTE(Width, "100%") + + // Spec: If the attribute is not specified, the effect is as if a value of "100%" were specified. + if(KSVG_TOKEN_NOT_PARSED(Height)) + KSVG_SET_ALT_ATTRIBUTE(Height, "100%") + + // Spec: The contentScriptType should default to "text/ecmascript". + if(KSVG_TOKEN_NOT_PARSED(ContentScriptType)) + KSVG_SET_ALT_ATTRIBUTE(ContentScriptType, "text/ecmascript") + + // Spec: The contentStyleType should default to "text/css". + if(KSVG_TOKEN_NOT_PARSED(ContentStyleType)) + KSVG_SET_ALT_ATTRIBUTE(ContentStyleType, "text/css") + + if(m_useCurrentView) + { + parseViewBox(m_currentView->viewBoxString().string()); + preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(m_currentView->preserveAspectRatioString().string()); + } + + m_viewport->setX(x()->baseVal()->value()); + m_viewport->setY(y()->baseVal()->value()); + m_viewport->setWidth(width()->baseVal()->value()); + m_viewport->setHeight(height()->baseVal()->value()); + + if(isRootElement() && ownerDoc()->parentImage() == 0) + { + if(ownerDoc()->canvas()) + ownerDoc()->canvas()->setViewportDimension(int(ceil(width()->baseVal()->value() * currentScale())), int(ceil(height()->baseVal()->value() * currentScale()))); + + // Special case for outermost svg element: + // We need to register our id manually, because + // m_ownerSVGElement is 0 in SVGElementImpl::setAttributes (Niko) + if(!id().isNull()) + addToIdMap(id().string(), this); + } +} + +SVGAnimatedLengthImpl *SVGSVGElementImpl::x() +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGSVGElementImpl::y() +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGSVGElementImpl::width() +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGSVGElementImpl::height() +{ + return m_height; +} + +void SVGSVGElementImpl::setContentScriptType(const DOM::DOMString &contentScriptType) +{ + setAttribute("contentScriptType", contentScriptType); +} + +DOM::DOMString SVGSVGElementImpl::contentScriptType() const +{ + return getAttribute("contentScriptType"); +} + +void SVGSVGElementImpl::setContentStyleType(const DOM::DOMString &contentStyleType) +{ + setAttribute("contentStyleType", contentStyleType); +} + +DOM::DOMString SVGSVGElementImpl::contentStyleType() const +{ + return getAttribute("contentStyleType"); +} + +SVGRectImpl *SVGSVGElementImpl::viewport() +{ + return m_viewport; +} + +SVGRectImpl *SVGSVGElementImpl::getBBox() +{ + SVGRectImpl *ret = new SVGRectImpl(getCTM()->qmatrix().invert().map(m_viewport->qrect())); + ret->ref(); + return ret; +} + +float SVGSVGElementImpl::pixelUnitToMillimeterX() const +{ + return ownerDoc()->screenPixelsPerMillimeterX(); +} + +float SVGSVGElementImpl::pixelUnitToMillimeterY() const +{ + return ownerDoc()->screenPixelsPerMillimeterY(); +} + +float SVGSVGElementImpl::screenPixelToMillimeterX() const +{ + return pixelUnitToMillimeterX(); +} + +float SVGSVGElementImpl::screenPixelToMillimeterY() const +{ + return pixelUnitToMillimeterY(); +} + +void SVGSVGElementImpl::setUseCurrentView(bool useCurrentView) +{ + m_useCurrentView = useCurrentView; +} + +bool SVGSVGElementImpl::useCurrentView() const +{ + return m_useCurrentView; +} + +SVGViewSpecImpl *SVGSVGElementImpl::currentView() const +{ + return m_currentView; +} + +void SVGSVGElementImpl::setCurrentScale(float currentScale) +{ + if( m_currentScale != currentScale ) + { + m_currentScale = currentScale; + invalidateCachedMatrices(); + + if(hasEventListener(SVGEvent::ZOOM_EVENT, true)) + dispatchEvent(SVGEvent::ZOOM_EVENT, false, false); + } +} + +float SVGSVGElementImpl::currentScale() const +{ + return m_currentScale; +} + +void SVGSVGElementImpl::setCurrentTranslate(const TQPoint &p) +{ + if(m_currentTranslate->x() != p.x() || m_currentTranslate->y() != p.y()) + { + m_currentTranslate->setX(p.x()); + m_currentTranslate->setY(p.y()); + invalidateCachedMatrices(); + if(hasEventListener(SVGEvent::SCROLL_EVENT, true)) + dispatchEvent(SVGEvent::SCROLL_EVENT, false, false); + } +} + +SVGPointImpl *SVGSVGElementImpl::currentTranslate() +{ + return m_currentTranslate; +} + +unsigned long SVGSVGElementImpl::suspendRedraw(unsigned long) +{ + return 0; +} + +void SVGSVGElementImpl::unsuspendRedraw(unsigned long) +{ +} + +void SVGSVGElementImpl::unsuspendRedrawAll() +{ +} + +void SVGSVGElementImpl::forceRedraw() +{ +#if USE_VALGRIND + CALLTREE_ZERO_STATS(); +#endif + + TQTime timer; + timer.start(); + + if(ownerDoc() && ownerDoc()->canvas()) + ownerDoc()->canvas()->update(); + + kdDebug(26000) << "forceRedraw in " << timer.elapsed()/1000.0 << " seconds" << endl; + +#if USE_VALGRIND + CALLTREE_DUMP_STATS(); +#endif +} + +void SVGSVGElementImpl::pauseAnimations() +{ + if(!ownerDoc()->timeScheduler()->animationsPaused()) + ownerDoc()->timeScheduler()->toggleAnimations(); +} + +void SVGSVGElementImpl::unpauseAnimations() +{ + if(ownerDoc()->timeScheduler()->animationsPaused()) + ownerDoc()->timeScheduler()->toggleAnimations(); +} + +bool SVGSVGElementImpl::animationsPaused() +{ + return ownerDoc()->timeScheduler()->animationsPaused(); +} + +float SVGSVGElementImpl::getCurrentTime() const +{ + return ownerDoc()->timeScheduler()->elapsed(); +} + +void SVGSVGElementImpl::setCurrentTime(float) +{ +} + +DOM::NodeList SVGSVGElementImpl::getIntersectionList(SVGRectImpl *, SVGElementImpl *) +{ + // TODO : implement me + return DOM::NodeList(); +} + +DOM::NodeList SVGSVGElementImpl::getEnclosureList(SVGRectImpl *rect, SVGElementImpl */*referenceElement*/) +{ + DOM::NodeList list; + + DOM::Node node = firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + SVGShapeImpl *shape = dynamic_cast(element); + if(shape) + { + if(shape->isContainer()) + // TODO : pass it on to container::getEnclosureList() which should return a NodeList + kdDebug() << "!shape" << endl; + else + { + // TODO : add the shape to list if the test succeeds + SVGRectImpl *current = shape->getBBox(); + if(rect->qrect().contains(current->qrect(), true)) + kdDebug() << "shape : " << element->nodeName().string() << " is fully enclosed" << endl; + + current->deref(); + } + } + } + + return list; +} + +bool SVGSVGElementImpl::checkIntersection(SVGElementImpl *element, SVGRectImpl *rect) +{ + SVGShapeImpl *shape = dynamic_cast(element); + if(!shape) + return false; + + SVGRectImpl *current = shape->getBBox(); + bool result = rect->qrect().intersects(current->qrect()); + current->deref(); + return result; +} + +bool SVGSVGElementImpl::checkEnclosure(SVGElementImpl *element, SVGRectImpl *rect) +{ + SVGShapeImpl *shape = dynamic_cast(element); + if(!shape) + return false; + + SVGRectImpl *current = shape->getBBox(); + bool result = rect->qrect().contains(current->qrect()); + current->deref(); + return result; +} + +void SVGSVGElementImpl::deSelectAll() +{ +} + +SVGNumberImpl *SVGSVGElementImpl::createSVGNumber() +{ + // Spec: Creates an SVGNumber object outside of any document + // trees. The object is initialized to a value of zero. + SVGNumberImpl *ret = new SVGNumberImpl(); + ret->ref(); + return ret; +} + +SVGLengthImpl *SVGSVGElementImpl::createSVGLength() +{ + // Spec: Creates an SVGLength object outside of any document + // trees. The object is initialized to the value of 0 user units. + SVGLengthImpl *ret = new SVGLengthImpl(); + ret->ref(); + return ret; +} + +SVGAngleImpl *SVGSVGElementImpl::createSVGAngle() +{ + // Spec: Creates an SVGAngle object outside of any document + // trees. The object is initialized to the value 0 degrees (unitless). + SVGAngleImpl *ret = new SVGAngleImpl(); + ret->ref(); + return ret; +} + +SVGPointImpl *SVGSVGElementImpl::createSVGPoint() +{ + // Spec: Creates an SVGPoint object outside of any document + // trees. The object is initialized to the point (0,0) in the user coordinate system. + SVGPointImpl *ret = new SVGPointImpl(); + ret->ref(); + return ret; +} + +SVGMatrixImpl *SVGSVGElementImpl::createSVGMatrix() +{ + // Spec: Creates an SVGMatrix object outside of any document + // trees. The object is initialized to the identity matrix. + SVGMatrixImpl *ret = new SVGMatrixImpl(TQWMatrix(1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F)); + ret->ref(); + return ret; +} + +SVGRectImpl *SVGSVGElementImpl::createSVGRect() +{ + // Spec: Creates an SVGRect object outside of any document + // trees. The object is initialized such that all values are set to 0 user units. + SVGRectImpl *ret = new SVGRectImpl(); + ret->ref(); + return ret; +} + +SVGTransformImpl *SVGSVGElementImpl::createSVGTransform() +{ + // Spec: Creates an SVGTransform object outside of any document + // trees. The object is initialized to an identity matrix transform (SVG_TRANSFORM_MATRIX). + SVGTransformImpl *transform = createSVGTransformFromMatrix(createSVGMatrix()); + + // createSVGMatrix already ref's the matrix, the SVGTransformImpl->setMatrix + // call also does this, prevent non deleting of the object by deref'ing (Niko) + transform->matrix()->deref(); + + return transform; +} + +SVGTransformImpl *SVGSVGElementImpl::createSVGTransformFromMatrix(SVGMatrixImpl *mat) +{ + // Spec: Creates an SVGTransform object outside of any document + // trees. The object is initialized to the given matrix transform (i.e., SVG_TRANSFORM_MATRIX). + SVGTransformImpl *ret = new SVGTransformImpl(); + ret->setMatrix(mat); + ret->ref(); + return ret; +} + +SVGElementImpl *SVGSVGElementImpl::getElementById(const DOM::DOMString &elementId) +{ + return m_map[elementId.string()]; +} + +void SVGSVGElementImpl::addToIdMap(const TQString &id, SVGElementImpl *obj) +{ + m_map.insert(id, obj); +} + +SVGMatrixImpl *SVGSVGElementImpl::getCTM() +{ + return viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value()); +} + +const SVGMatrixImpl *SVGSVGElementImpl::localMatrix() +{ + // TODO: only update the matrix when needed and just return m_localMatrix + + m_localMatrix->reset(); + + if(ownerSVGElement() == 0) + { + if(m_rootParentScreenCTM != 0) + m_localMatrix->copy(m_rootParentScreenCTM); + + // We're the outermost svg element. + // Put the zoom scale and translate into the matrix. + m_localMatrix->translate(currentTranslate()->x(), currentTranslate()->y()); + m_localMatrix->scale(currentScale()); + } + + // Apply viewport translation. + m_localMatrix->translate(x()->baseVal()->value(), y()->baseVal()->value()); + + // And viewbox. + SVGMatrixImpl *viewboxMatrix = viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value()); + + m_localMatrix->multiply(viewboxMatrix); + viewboxMatrix->deref(); + + return m_localMatrix; +} + +void SVGSVGElementImpl::setClip(const TQString &clip) +{ + // TODO : this routine should probably be shared between all classes that establish new viewports (Rob) + if(!clip.startsWith("rect(") || !clip.endsWith(")")) + return; + + TQString work = clip.mid(5, clip.length() - 6); + TQStringList substrings = TQStringList::split(',', clip); + TQStringList::ConstIterator it = substrings.begin(); + + if(m_clip[0]) + m_clip[0]->deref(); + m_clip[0] = SVGSVGElementImpl::createSVGLength(); + + if(*it != "auto") + m_clip[0]->setValueAsString(*it); + ++it; + + if(m_clip[1]) + m_clip[1]->deref(); + m_clip[1] = SVGSVGElementImpl::createSVGLength(); + + if(*it != "auto") + m_clip[1]->setValueAsString(*it); + ++it; + + if(m_clip[2]) + m_clip[2]->deref(); + m_clip[2] = SVGSVGElementImpl::createSVGLength(); + + if(*it != "auto") + m_clip[2]->setValueAsString(*it); + ++it; + + if(m_clip[3]) + m_clip[3]->deref(); + m_clip[3] = SVGSVGElementImpl::createSVGLength(); + + if(*it != "auto") + m_clip[3]->setValueAsString(*it); +} + +TQRect SVGSVGElementImpl::clip() +{ + // Get viewport in user coordinates. + TQRect v(0, 0, m_viewport->qrect().width(), m_viewport->qrect().height()); + + SVGMatrixImpl *ctm = getCTM(); + TQRect r = ctm->qmatrix().invert().mapRect(v); + ctm->deref(); + + if(m_clip[0]) + r.setTop(static_cast(r.top() + m_clip[0]->value())); + if(m_clip[1]) + r.setRight(static_cast(r.right() - m_clip[1]->value())); + if(m_clip[2]) + r.setBottom(static_cast(r.bottom() - m_clip[2]->value())); + if(m_clip[3]) + r.setLeft(static_cast(r.left() + m_clip[3]->value())); + + return r; +} + +void SVGSVGElementImpl::setRootParentScreenCTM(SVGMatrixImpl *screenCTM) +{ + if(m_rootParentScreenCTM != 0) + m_rootParentScreenCTM->deref(); + + m_rootParentScreenCTM = screenCTM; + screenCTM->ref(); +} + +bool SVGSVGElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &a, SVGMouseEventImpl *mev) +{ + // mop: central bool var which turns to true once the current "mouseover" element has been found + bool ret = false, dorerender = false; + SVGElementImpl *elem = 0; + + SVGMatrixImpl *ctm = getCTM(); + TQPoint userA = ctm->qmatrix().invert().map(a); + ctm->deref(); + + // Just check the lastTarget once (mop) + if(ownerDoc()->lastTarget()) + { + elem = ownerDoc()->lastTarget(); + ret = elem->prepareMouseEvent(p, userA, mev); + + // mop: only proceed if element is not the current element anymore. rest is done in the lower part + if(!ret) + { + if(elem->hasEventListener(SVGEvent::MOUSEOUT_EVENT, false)) + { + dorerender = true; + elem->setMouseOver(false); + elem->dispatchMouseEvent(SVGEvent::MOUSEOUT_EVENT, true, true, 0, mev->screenX(), mev->screenY(), mev->clientX(), mev->clientY(), mev->ctrlKey(), mev->altKey(), mev->shiftKey(), mev->metaKey(), mev->button(), elem); + } + + if(elem->hasEventListener(SVGEvent::DOMFOCUSOUT_EVENT, false) && elem->focus()) + { + dorerender = true; + elem->setFocus(false); + elem->dispatchEvent(SVGEvent::DOMFOCUSOUT_EVENT, true, true); + } + + // mop: unset last target once we left it + ownerDoc()->setLastTarget(0); + } + } + + // mop: DAMN...logic doesn't work :( + // we cant use the results of the above check because something like this + // _________ + // | ____ | + // ||____| | + // |_________| + // + // wouldn't work because even if the mousepointer would be in the inner rect it would still be inside the bbox + // of the outer (assuming that the outer is the lastTarget). :( + ret = false; + + // mop: just check for a node until the element where the mouse is over is found + // mop: "ret" can be set from the above stuff too... + // find the element here and do the event stuff in the lower part..much cleaner + CanvasItemList hits = ownerDoc()->canvas()->collisions(p, true); + for(CanvasItemList::Iterator it = hits.begin(); it != hits.end(); ++it) + { + elem = (*it)->element(); + if(elem) + { + // Check if mouse is over a certain shape... + // mop: once an element has been found check eventlisteners and leave immediately + ret = elem->prepareMouseEvent(p, userA, mev); + if(ret) break; + } + } + + // mop: has an element been found? + if(ret) + { + int events = mev->target()->getEventListeners(false); + + // Dispatch mousemove, mousedown, mouseup and mouseclick events + bool cancel = (mev->id() != SVGEvent::MOUSEMOVE_EVENT); + + if(events & 1 << mev->id()) + { + mev->target()->dispatchMouseEvent(mev->id(), true, cancel, 0, mev->screenX(), mev->screenY(), mev->clientX(), mev->clientY(), mev->ctrlKey(), mev->altKey(), mev->shiftKey(), mev->metaKey(), mev->button(), elem); + dorerender = true; // mop: if it has the event then rerender + } + + // If a mouse "moves" over a shape, it's also "over" the shape + if(mev->id() == SVGEvent::MOUSEMOVE_EVENT) + { + mev->target()->setMouseOver(true); + if(events & 1 << SVGEvent::MOUSEOVER_EVENT) + { + mev->target()->dispatchMouseEvent(SVGEvent::MOUSEOVER_EVENT, true, cancel, 0, mev->screenX(), mev->screenY(), mev->clientX(), mev->clientY(), mev->ctrlKey(), mev->altKey(), mev->shiftKey(), mev->metaKey(), mev->button(), elem); + dorerender = true; + } + + } + + // Also send an domactivate + focusin event on mouseup + bool dolinktest = true; + if(mev->id() == SVGEvent::MOUSEUP_EVENT) + { + mev->target()->setFocus(true); + + if(events & 1 << SVGEvent::CLICK_EVENT) + { + dolinktest = mev->target()->dispatchEvent(SVGEvent::CLICK_EVENT, true, true); + dorerender = true; + } + + if(events & 1 << SVGEvent::DOMACTIVATE_EVENT) + { + mev->target()->dispatchEvent(SVGEvent::DOMACTIVATE_EVENT, true, true); + dorerender = true; + } + + if(events & 1 << SVGEvent::DOMFOCUSIN_EVENT) + { + mev->target()->dispatchEvent(SVGEvent::DOMFOCUSIN_EVENT, true, true); + dorerender = true; + } + } + + // Hyperlink support + SVGAElementImpl* link=0; + if(dolinktest && !mev->defaultPrevented()) + { + link = SVGAElementImpl::getLink(elem); + if(link) + { + mev->setURL(link->href()->baseVal()); + emit ownerDoc()->gotURL(link->target()->baseVal().string()); + } + } + + // The mouse is over a shape, so we have a target..we need to register that for a mouseout + ownerDoc()->setLastTarget(mev->target()); + } + + // mop: all events may trigger changed style, add elements etc. this is definately needed :( + if(dorerender) + ownerDoc()->rerender(); + + return dorerender; // mop: some kind of event has been found and executed +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGSVGElementImpl::s_hashTable 23 + x SVGSVGElementImpl::X DontDelete|ReadOnly + y SVGSVGElementImpl::Y DontDelete|ReadOnly + width SVGSVGElementImpl::Width DontDelete|ReadOnly + height SVGSVGElementImpl::Height DontDelete|ReadOnly + viewport SVGSVGElementImpl::Viewport DontDelete|ReadOnly + contentScriptType SVGSVGElementImpl::ContentScriptType DontDelete + contentStyleType SVGSVGElementImpl::ContentStyleType DontDelete + pixelUnitToMillimeterX SVGSVGElementImpl::PixelUnitToMillimeterX DontDelete|ReadOnly + pixelUnitToMillimeterY SVGSVGElementImpl::PixelUnitToMillimeterY DontDelete|ReadOnly + screenPixelToMillimeterX SVGSVGElementImpl::ScreenPixelToMillimeterX DontDelete|ReadOnly + screenPixelToMillimeterY SVGSVGElementImpl::ScreenPixelToMillimeterY DontDelete|ReadOnly + useCurrentView SVGSVGElementImpl::UseCurrentView DontDelete + currentScale SVGSVGElementImpl::CurrentScale DontDelete + currentTranslate SVGSVGElementImpl::CurrentTranslate DontDelete|ReadOnly + onunload SVGSVGElementImpl::OnUnload DontDelete + onerror SVGSVGElementImpl::OnError DontDelete + onresize SVGSVGElementImpl::OnResize DontDelete + onzoom SVGSVGElementImpl::OnZoom DontDelete + onscroll SVGSVGElementImpl::OnScroll DontDelete +@end +@namespace KSVG +@begin SVGSVGElementImplProto::s_hashTable 29 + createSVGNumber SVGSVGElementImpl::CreateSVGNumber DontDelete|Function 0 + createSVGLength SVGSVGElementImpl::CreateSVGLength DontDelete|Function 0 + createSVGAngle SVGSVGElementImpl::CreateSVGAngle DontDelete|Function 0 + createSVGPoint SVGSVGElementImpl::CreateSVGPoint DontDelete|Function 0 + createSVGMatrix SVGSVGElementImpl::CreateSVGMatrix DontDelete|Function 0 + createSVGRect SVGSVGElementImpl::CreateSVGRect DontDelete|Function 0 + createSVGTransform SVGSVGElementImpl::CreateSVGTransform DontDelete|Function 0 + createSVGTransformFromMatrix SVGSVGElementImpl::CreateSVGTransformFromMatrix DontDelete|Function 1 + suspendRedraw SVGSVGElementImpl::SuspendRedraw DontDelete|Function 1 + unsuspendRedraw SVGSVGElementImpl::UnsuspendRedraw DontDelete|Function 1 + unsuspendRedrawAll SVGSVGElementImpl::UnsuspendRedrawAll DontDelete|Function 0 + forceRedraw SVGSVGElementImpl::ForceRedraw DontDelete|Function 0 + pauseAnimations SVGSVGElementImpl::PauseAnimations DontDelete|Function 0 + unpauseAnimations SVGSVGElementImpl::UnpauseAnimations DontDelete|Function 0 + animationsPaused SVGSVGElementImpl::AnimationsPaused DontDelete|Function 0 + getCurrentTime SVGSVGElementImpl::GetCurrentTime DontDelete|Function 0 + setCurrentTime SVGSVGElementImpl::SetCurrentTime DontDelete|Function 1 + getIntersectionList SVGSVGElementImpl::GetIntersectionList DontDelete|Function 2 + getEnclosureList SVGSVGElementImpl::GetEnclosureList DontDelete|Function 2 + checkIntersection SVGSVGElementImpl::CheckIntersection DontDelete|Function 2 + checkEnclosure SVGSVGElementImpl::CheckEnclosure DontDelete|Function 2 + deselectAll SVGSVGElementImpl::DeselectAll DontDelete|Function 0 + getElementById SVGSVGElementImpl::GetElementById DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGSVGElement", SVGSVGElementImplProto, SVGSVGElementImplProtoFunc) + +Value SVGSVGElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X: + if(!attributeMode) + return m_x->cache(exec); + else + return Number(m_x->baseVal()->value()); + case Y: + if(!attributeMode) + return m_y->cache(exec); + else + return Number(m_y->baseVal()->value()); + case Width: + if(!attributeMode) + return m_width->cache(exec); + else + return Number(m_width->baseVal()->value()); + case Height: + if(!attributeMode) + return m_height->cache(exec); + else + return Number(m_height->baseVal()->value()); + case Viewport: + return m_viewport->cache(exec); + case ContentScriptType: + return String(contentScriptType().string()); + case ContentStyleType: + return String(contentStyleType().string()); + case PixelUnitToMillimeterX: + return Number(pixelUnitToMillimeterX()); + case PixelUnitToMillimeterY: + return Number(pixelUnitToMillimeterY()); + case ScreenPixelToMillimeterX: + return Number(screenPixelToMillimeterX()); + case ScreenPixelToMillimeterY: + return Number(screenPixelToMillimeterY()); + case UseCurrentView: + return Boolean(useCurrentView()); + case CurrentScale: + return Number(currentScale()); + case CurrentTranslate: + return m_currentTranslate->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGSVGElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int) +{ + switch(token) + { + case ContentScriptType: + setContentScriptType(value.toString(exec).string()); + break; + case ContentStyleType: + setContentStyleType(value.toString(exec).string()); + break; + case CurrentScale: + m_currentScale = value.toNumber(exec); + break; + case X: + x()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Y: + y()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Width: + width()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Height: + height()->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case OnUnload: + // Spec: only applicable to outermost 'svg' elements + if(isRootElement()) + setEventListener(SVGEvent::UNLOAD_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); + break; + case OnError: + setEventListener(SVGEvent::ERROR_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); + break; + case OnResize: + // Spec: only applicable to outermost 'svg' elements + if(isRootElement()) + setEventListener(SVGEvent::RESIZE_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); + break; + case OnZoom: + // Spec: only applicable to outermost 'svg' elements + if(isRootElement()) + setEventListener(SVGEvent::ZOOM_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); + break; + case OnScroll: + // Spec: only applicable to outermost 'svg' elements + if(isRootElement()) + setEventListener(SVGEvent::SCROLL_EVENT, ownerDoc()->createEventListener(value.toString(exec).qstring())); + break; + default: + kdWarning() << k_funcinfo << "unhandled token " << token << endl; + } +} + +Value SVGSVGElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGSVGElementImpl) + + switch(id) + { + case SVGSVGElementImpl::CreateSVGNumber: + return obj->createSVGNumber()->cache(exec); + case SVGSVGElementImpl::CreateSVGLength: + return obj->createSVGLength()->cache(exec); + case SVGSVGElementImpl::CreateSVGAngle: + return obj->createSVGAngle()->cache(exec); + case SVGSVGElementImpl::CreateSVGPoint: + return obj->createSVGPoint()->cache(exec); + case SVGSVGElementImpl::CreateSVGMatrix: + return obj->createSVGMatrix()->cache(exec); + case SVGSVGElementImpl::CreateSVGRect: + return obj->createSVGRect()->cache(exec); + case SVGSVGElementImpl::CreateSVGTransform: + return obj->createSVGTransform()->cache(exec); + case SVGSVGElementImpl::CreateSVGTransformFromMatrix: + return obj->createSVGTransformFromMatrix(static_cast *>(args[0].imp())->impl())->cache(exec); + case SVGSVGElementImpl::GetElementById: + { + // Keep in sync with SVGDocumentImpl's version. + Value ret; + + SVGElementImpl *element = obj->getElementById(args[0].toString(exec).string()); + + if(element) + ret = getDOMNode(exec, *element); + else + { + element = obj->ownerDoc()->recursiveSearch(*(obj->ownerDoc()), args[0].toString(exec).string()); + if(!element) + return Null(); + + ret = getDOMNode(exec, *element); + } + + return ret; + } + case SVGSVGElementImpl::GetCurrentTime: + return Number(obj->getCurrentTime()); + case SVGSVGElementImpl::SetCurrentTime: + obj->setCurrentTime(args[0].toNumber(exec)); + return Undefined(); + case SVGSVGElementImpl::DeselectAll: + obj->deSelectAll(); + return Undefined(); + case SVGSVGElementImpl::PauseAnimations: + obj->pauseAnimations(); + return Undefined(); + case SVGSVGElementImpl::UnpauseAnimations: + obj->unpauseAnimations(); + return Undefined(); + case SVGSVGElementImpl::AnimationsPaused: + return Boolean(obj->animationsPaused()); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} diff --git a/ksvg/impl/SVGScriptElementImpl.cc b/ksvg/impl/SVGScriptElementImpl.cc deleted file mode 100644 index f97ebf89..00000000 --- a/ksvg/impl/SVGScriptElementImpl.cc +++ /dev/null @@ -1,183 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include -#include -#include - -#include "SVGDocumentImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGScriptElementImpl.moc" - -using namespace KSVG; - -#include "SVGScriptElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGScriptElementImpl::SVGScriptElementImpl(DOM::ElementImpl *impl) : TQObject(), SVGElementImpl(impl), SVGURIReferenceImpl(), SVGExternalResourcesRequiredImpl() -{ - KSVG_EMPTY_FLAGS - - m_job = 0; - m_added = false; -} - -SVGScriptElementImpl::~SVGScriptElementImpl() -{ -} - -void SVGScriptElementImpl::setType(const DOM::DOMString &type) -{ - setAttribute("type", type); -} - -DOM::DOMString SVGScriptElementImpl::type() const -{ - return getAttribute("type"); -} - -void SVGScriptElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: provide a default type - if(KSVG_TOKEN_NOT_PARSED(Type)) - KSVG_SET_ALT_ATTRIBUTE(Type, "text/ecmascript") - - // Remote downloading - TQString href = m_href->baseVal().string(); - - if(!href.isEmpty()) - { - KURL url(ownerDoc()->baseUrl(), href); - - if(m_job == 0) - m_job = TDEIO::get(url, false, false); - - connect(m_job, TQT_SIGNAL(data(TDEIO::Job *, const TQByteArray &)), this, TQT_SLOT(slotData(TDEIO::Job *, const TQByteArray &))); - connect(m_job, TQT_SIGNAL(result(TDEIO::Job *)), this, TQT_SLOT(slotResult(TDEIO::Job *))); - } -} - -void SVGScriptElementImpl::slotData(TDEIO::Job *, const TQByteArray &data) -{ - TQDataStream dataStream(m_data, IO_WriteOnly | IO_Append); - dataStream.writeRawBytes(data.data(), data.size()); -} - -void SVGScriptElementImpl::slotResult(TDEIO::Job *) -{ - m_job = 0; - - // Append a NULL terminator so we don't die - m_data.resize(m_data.size() + 1); - m_data[m_data.size() - 1] = '\0'; - - TQBuffer buf(m_data); - TQIODevice *dev = KFilterDev::device(TQT_TQIODEVICE(&buf), "application/x-gzip", false); - TQByteArray contents; - if(dev->open(IO_ReadOnly)) - contents = dev->readAll(); - delete dev; - m_text = TQString::fromUtf8(contents.data()); - - m_data.resize(0); -} - -bool SVGScriptElementImpl::canExecuteScript() -{ - if(!m_added) - { - m_added = true; - m_text += collectText(); - } - - if(m_text.isEmpty() && !getAttribute("href").isNull() && !getAttribute("href").string().isEmpty()) - return false; - - return true; -} - -bool SVGScriptElementImpl::executeScript(DOM::Node node) -{ - return SVGScriptElementImpl::executeScript(node, ownerDoc(), m_text); -} - -bool SVGScriptElementImpl::executeScript(DOM::Node node, SVGDocumentImpl *document, const TQString &text) -{ -#ifdef KJS_VERBOSE - kdDebug(6070) << "SVGScriptElementImpl::executeScript n=" << node.nodeName().string().latin1() << "(" << (node.isNull() ? 0 : node.nodeType()) << ") " << text << endl; -#endif - KSVGEcma *ecmaEngine = document->ecmaEngine(); - - if(!ecmaEngine->initialized()) - ecmaEngine->setup(); - - KJS::Value thisNode = node.isNull() ? ecmaEngine->globalObject() : getDOMNode(ecmaEngine->globalExec(), node); - - KJS::UString code(text); - KJS::Completion comp = ecmaEngine->evaluate(code, thisNode); - - // TODO: If that's needed find a better solution which - // doesn't cause endless loops if the func, specified in - // onerror="..." isn't yet available - // onerror support -// if(comp.complType() == Throw) -// document->rootElement()->dispatchEvent(SVGEventImpl::ERROR_EVENT, false, false); - - return (comp.complType() == KJS::Normal) || (comp.complType() == KJS::ReturnValue); -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGScriptElementImpl::s_hashTable 2 - type SVGScriptElementImpl::Type DontDelete -@end -*/ - -Value SVGScriptElementImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case Type: - return String(type()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGScriptElementImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case Type: - setType(value.toString(exec).string()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGScriptElementImpl.cpp b/ksvg/impl/SVGScriptElementImpl.cpp new file mode 100644 index 00000000..f97ebf89 --- /dev/null +++ b/ksvg/impl/SVGScriptElementImpl.cpp @@ -0,0 +1,183 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include +#include + +#include "SVGDocumentImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGScriptElementImpl.moc" + +using namespace KSVG; + +#include "SVGScriptElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGScriptElementImpl::SVGScriptElementImpl(DOM::ElementImpl *impl) : TQObject(), SVGElementImpl(impl), SVGURIReferenceImpl(), SVGExternalResourcesRequiredImpl() +{ + KSVG_EMPTY_FLAGS + + m_job = 0; + m_added = false; +} + +SVGScriptElementImpl::~SVGScriptElementImpl() +{ +} + +void SVGScriptElementImpl::setType(const DOM::DOMString &type) +{ + setAttribute("type", type); +} + +DOM::DOMString SVGScriptElementImpl::type() const +{ + return getAttribute("type"); +} + +void SVGScriptElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: provide a default type + if(KSVG_TOKEN_NOT_PARSED(Type)) + KSVG_SET_ALT_ATTRIBUTE(Type, "text/ecmascript") + + // Remote downloading + TQString href = m_href->baseVal().string(); + + if(!href.isEmpty()) + { + KURL url(ownerDoc()->baseUrl(), href); + + if(m_job == 0) + m_job = TDEIO::get(url, false, false); + + connect(m_job, TQT_SIGNAL(data(TDEIO::Job *, const TQByteArray &)), this, TQT_SLOT(slotData(TDEIO::Job *, const TQByteArray &))); + connect(m_job, TQT_SIGNAL(result(TDEIO::Job *)), this, TQT_SLOT(slotResult(TDEIO::Job *))); + } +} + +void SVGScriptElementImpl::slotData(TDEIO::Job *, const TQByteArray &data) +{ + TQDataStream dataStream(m_data, IO_WriteOnly | IO_Append); + dataStream.writeRawBytes(data.data(), data.size()); +} + +void SVGScriptElementImpl::slotResult(TDEIO::Job *) +{ + m_job = 0; + + // Append a NULL terminator so we don't die + m_data.resize(m_data.size() + 1); + m_data[m_data.size() - 1] = '\0'; + + TQBuffer buf(m_data); + TQIODevice *dev = KFilterDev::device(TQT_TQIODEVICE(&buf), "application/x-gzip", false); + TQByteArray contents; + if(dev->open(IO_ReadOnly)) + contents = dev->readAll(); + delete dev; + m_text = TQString::fromUtf8(contents.data()); + + m_data.resize(0); +} + +bool SVGScriptElementImpl::canExecuteScript() +{ + if(!m_added) + { + m_added = true; + m_text += collectText(); + } + + if(m_text.isEmpty() && !getAttribute("href").isNull() && !getAttribute("href").string().isEmpty()) + return false; + + return true; +} + +bool SVGScriptElementImpl::executeScript(DOM::Node node) +{ + return SVGScriptElementImpl::executeScript(node, ownerDoc(), m_text); +} + +bool SVGScriptElementImpl::executeScript(DOM::Node node, SVGDocumentImpl *document, const TQString &text) +{ +#ifdef KJS_VERBOSE + kdDebug(6070) << "SVGScriptElementImpl::executeScript n=" << node.nodeName().string().latin1() << "(" << (node.isNull() ? 0 : node.nodeType()) << ") " << text << endl; +#endif + KSVGEcma *ecmaEngine = document->ecmaEngine(); + + if(!ecmaEngine->initialized()) + ecmaEngine->setup(); + + KJS::Value thisNode = node.isNull() ? ecmaEngine->globalObject() : getDOMNode(ecmaEngine->globalExec(), node); + + KJS::UString code(text); + KJS::Completion comp = ecmaEngine->evaluate(code, thisNode); + + // TODO: If that's needed find a better solution which + // doesn't cause endless loops if the func, specified in + // onerror="..." isn't yet available + // onerror support +// if(comp.complType() == Throw) +// document->rootElement()->dispatchEvent(SVGEventImpl::ERROR_EVENT, false, false); + + return (comp.complType() == KJS::Normal) || (comp.complType() == KJS::ReturnValue); +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGScriptElementImpl::s_hashTable 2 + type SVGScriptElementImpl::Type DontDelete +@end +*/ + +Value SVGScriptElementImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case Type: + return String(type()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGScriptElementImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case Type: + setType(value.toString(exec).string()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGSetElementImpl.cc b/ksvg/impl/SVGSetElementImpl.cc deleted file mode 100644 index 9e506eac..00000000 --- a/ksvg/impl/SVGSetElementImpl.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDocumentImpl.h" -#include "SVGSetElementImpl.h" - -using namespace KSVG; - -SVGSetElementImpl::SVGSetElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) -{ -} - -SVGSetElementImpl::~SVGSetElementImpl() -{ -} - -void SVGSetElementImpl::setAttributes() -{ - SVGAnimationElementImpl::setAttributes(); - - // Always create singleShot timers when used by (Niko) - // Those are automatically deleted by the scheduler after timeout. - ownerDoc()->timeScheduler()->addTimer(this, int(getStartTime() * 1000.0)); -} - -void SVGSetElementImpl::handleTimerEvent() -{ - applyAttribute(getAttributeName(), getTo()); -} diff --git a/ksvg/impl/SVGSetElementImpl.cpp b/ksvg/impl/SVGSetElementImpl.cpp new file mode 100644 index 00000000..9e506eac --- /dev/null +++ b/ksvg/impl/SVGSetElementImpl.cpp @@ -0,0 +1,46 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDocumentImpl.h" +#include "SVGSetElementImpl.h" + +using namespace KSVG; + +SVGSetElementImpl::SVGSetElementImpl(DOM::ElementImpl *impl) : SVGAnimationElementImpl(impl) +{ +} + +SVGSetElementImpl::~SVGSetElementImpl() +{ +} + +void SVGSetElementImpl::setAttributes() +{ + SVGAnimationElementImpl::setAttributes(); + + // Always create singleShot timers when used by (Niko) + // Those are automatically deleted by the scheduler after timeout. + ownerDoc()->timeScheduler()->addTimer(this, int(getStartTime() * 1000.0)); +} + +void SVGSetElementImpl::handleTimerEvent() +{ + applyAttribute(getAttributeName(), getTo()); +} diff --git a/ksvg/impl/SVGShapeImpl.cc b/ksvg/impl/SVGShapeImpl.cc deleted file mode 100644 index dc9b728f..00000000 --- a/ksvg/impl/SVGShapeImpl.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGPaint.h" - -#include "SVGRectImpl.h" -#include "SVGEventImpl.h" -#include "SVGShapeImpl.h" -#include "SVGPaintImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGClipPathElementImpl.h" -#include "SVGAnimatedLengthListImpl.h" - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -using namespace KSVG; - -SVGShapeImpl::SVGShapeImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ - m_item = 0; -} - -SVGShapeImpl::~SVGShapeImpl() -{ - if(hasChildNodes()) - { - DOM::Node node = firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGShapeImpl *rend = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); - if(rend) - rend->deref(); - } - } -} - -bool SVGShapeImpl::directRender() -{ - SVGShapeImpl *parent = dynamic_cast(ownerDoc()->getElementFromHandle(parentNode().handle())); - if(parent) - return parent->directRender(); - else - return true; -} - -SVGRectImpl *SVGShapeImpl::getBBox() -{ - SVGRectImpl *rect = SVGSVGElementImpl::createSVGRect(); - return rect; -} - -SVGRectImpl *SVGShapeImpl::getBBoxInternal() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - if(m_item) - { - TQRect r = m_item->bbox(); - ret->setX(r.x()); - ret->setY(r.y()); - ret->setWidth(r.width()); - ret->setHeight(r.height()); - } - return ret; -} - -bool SVGShapeImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &, SVGMouseEventImpl *mev) -{ - // TODO : pointer-events should be stored here, not in SVGStylableImpl. - SVGStylableImpl *style = dynamic_cast(this); - if(!style || style->getPointerEvents() == PE_NONE) - return false; - bool testFill = false; - bool testStroke = false; - switch(style->getPointerEvents()) - { - case PE_VISIBLE: testFill = testStroke = style->getVisible(); break; - case PE_VISIBLE_PAINTED: testStroke = style->getVisible() && style->isStroked(); - case PE_VISIBLE_FILL: testFill = style->getVisible() && style->isFilled(); break; - case PE_VISIBLE_STROKE: testStroke = style->getVisible() && style->isStroked(); break; - case PE_PAINTED: testStroke = style->isStroked(); - case PE_FILL: testFill = style->isFilled(); break; - case PE_STROKE: testStroke = style->isStroked(); break; - case PE_ALL: - default: testFill = testStroke = true; - }; - - if(testFill || testStroke) - { - if((testFill && m_item->fillContains(p)) || (testStroke && m_item->strokeContains(p))) - { - mev->setTarget(this); - return true; - } - } - - return false; -} - -void SVGShapeImpl::update(CanvasItemUpdate reason, int param1, int param2) -{ - if(m_item) - m_item->update(reason, param1, param2); -} - -void SVGShapeImpl::invalidate(KSVGCanvas *c, bool recalc) -{ - if(m_item && c) - c->invalidate(m_item, recalc); -} - -void SVGShapeImpl::setReferenced(bool referenced) -{ - if(m_item) - m_item->setReferenced(referenced); -} - -void SVGShapeImpl::draw() -{ - if(m_item) - m_item->draw(); -} - -void SVGShapeImpl::blit(KSVGCanvas *c) -{ - SVGRectImpl *rect = getBBoxInternal(); - c->blit(rect->qrect(), true); - rect->deref(); -} - -void SVGShapeImpl::removeItem(KSVGCanvas *c) -{ - if(m_item && c) - { - c->removeItem(m_item); - m_item = 0; - } -} diff --git a/ksvg/impl/SVGShapeImpl.cpp b/ksvg/impl/SVGShapeImpl.cpp new file mode 100644 index 00000000..dc9b728f --- /dev/null +++ b/ksvg/impl/SVGShapeImpl.cpp @@ -0,0 +1,160 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGPaint.h" + +#include "SVGRectImpl.h" +#include "SVGEventImpl.h" +#include "SVGShapeImpl.h" +#include "SVGPaintImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGClipPathElementImpl.h" +#include "SVGAnimatedLengthListImpl.h" + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +using namespace KSVG; + +SVGShapeImpl::SVGShapeImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ + m_item = 0; +} + +SVGShapeImpl::~SVGShapeImpl() +{ + if(hasChildNodes()) + { + DOM::Node node = firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGShapeImpl *rend = dynamic_cast(ownerDoc()->getElementFromHandle(node.handle())); + if(rend) + rend->deref(); + } + } +} + +bool SVGShapeImpl::directRender() +{ + SVGShapeImpl *parent = dynamic_cast(ownerDoc()->getElementFromHandle(parentNode().handle())); + if(parent) + return parent->directRender(); + else + return true; +} + +SVGRectImpl *SVGShapeImpl::getBBox() +{ + SVGRectImpl *rect = SVGSVGElementImpl::createSVGRect(); + return rect; +} + +SVGRectImpl *SVGShapeImpl::getBBoxInternal() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + if(m_item) + { + TQRect r = m_item->bbox(); + ret->setX(r.x()); + ret->setY(r.y()); + ret->setWidth(r.width()); + ret->setHeight(r.height()); + } + return ret; +} + +bool SVGShapeImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &, SVGMouseEventImpl *mev) +{ + // TODO : pointer-events should be stored here, not in SVGStylableImpl. + SVGStylableImpl *style = dynamic_cast(this); + if(!style || style->getPointerEvents() == PE_NONE) + return false; + bool testFill = false; + bool testStroke = false; + switch(style->getPointerEvents()) + { + case PE_VISIBLE: testFill = testStroke = style->getVisible(); break; + case PE_VISIBLE_PAINTED: testStroke = style->getVisible() && style->isStroked(); + case PE_VISIBLE_FILL: testFill = style->getVisible() && style->isFilled(); break; + case PE_VISIBLE_STROKE: testStroke = style->getVisible() && style->isStroked(); break; + case PE_PAINTED: testStroke = style->isStroked(); + case PE_FILL: testFill = style->isFilled(); break; + case PE_STROKE: testStroke = style->isStroked(); break; + case PE_ALL: + default: testFill = testStroke = true; + }; + + if(testFill || testStroke) + { + if((testFill && m_item->fillContains(p)) || (testStroke && m_item->strokeContains(p))) + { + mev->setTarget(this); + return true; + } + } + + return false; +} + +void SVGShapeImpl::update(CanvasItemUpdate reason, int param1, int param2) +{ + if(m_item) + m_item->update(reason, param1, param2); +} + +void SVGShapeImpl::invalidate(KSVGCanvas *c, bool recalc) +{ + if(m_item && c) + c->invalidate(m_item, recalc); +} + +void SVGShapeImpl::setReferenced(bool referenced) +{ + if(m_item) + m_item->setReferenced(referenced); +} + +void SVGShapeImpl::draw() +{ + if(m_item) + m_item->draw(); +} + +void SVGShapeImpl::blit(KSVGCanvas *c) +{ + SVGRectImpl *rect = getBBoxInternal(); + c->blit(rect->qrect(), true); + rect->deref(); +} + +void SVGShapeImpl::removeItem(KSVGCanvas *c) +{ + if(m_item && c) + { + c->removeItem(m_item); + m_item = 0; + } +} diff --git a/ksvg/impl/SVGStopElementImpl.cc b/ksvg/impl/SVGStopElementImpl.cc deleted file mode 100644 index f15fb0a6..00000000 --- a/ksvg/impl/SVGStopElementImpl.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGLengthImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGStopElementImpl.h" -#include "SVGAnimatedNumberImpl.h" -#include "SVGColorImpl.h" - -using namespace KSVG; - -#include "SVGStopElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGStopElementImpl::SVGStopElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this) -{ - KSVG_EMPTY_FLAGS - - m_offset = new SVGAnimatedNumberImpl(); - m_offset->ref(); - - m_stopOpacity = 1; -} - -SVGStopElementImpl::~SVGStopElementImpl() -{ - if(m_offset) - m_offset->deref(); -} - -SVGAnimatedNumberImpl *SVGStopElementImpl::offset() const -{ - return m_offset; -} - -float SVGStopElementImpl::stopOpacity() const -{ - return m_stopOpacity; -} - - -/* -@namespace KSVG -@begin SVGStopElementImpl::s_hashTable 3 - offset SVGStopElementImpl::Offset DontDelete|ReadOnly - stop-opacity SVGStopElementImpl::StopOpacity DontDelete|ReadOnly -@end -*/ - -Value SVGStopElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case Offset: - if(!attributeMode) - return m_offset->cache(exec); - else - return Number(m_offset->baseVal()); - case StopOpacity: - if(!attributeMode) - return Undefined(); - else - return Number(m_stopOpacity); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGStopElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Offset: - float temp; - SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), temp); - offset()->setBaseVal(temp); - break; - case StopOpacity: - { - SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_stopOpacity); - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGStopElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not set, specifiy 0 - if(KSVG_TOKEN_NOT_PARSED(Offset)) - KSVG_SET_ALT_ATTRIBUTE(Offset, "0") -} diff --git a/ksvg/impl/SVGStopElementImpl.cpp b/ksvg/impl/SVGStopElementImpl.cpp new file mode 100644 index 00000000..f15fb0a6 --- /dev/null +++ b/ksvg/impl/SVGStopElementImpl.cpp @@ -0,0 +1,123 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGLengthImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGStopElementImpl.h" +#include "SVGAnimatedNumberImpl.h" +#include "SVGColorImpl.h" + +using namespace KSVG; + +#include "SVGStopElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGStopElementImpl::SVGStopElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGStylableImpl(this) +{ + KSVG_EMPTY_FLAGS + + m_offset = new SVGAnimatedNumberImpl(); + m_offset->ref(); + + m_stopOpacity = 1; +} + +SVGStopElementImpl::~SVGStopElementImpl() +{ + if(m_offset) + m_offset->deref(); +} + +SVGAnimatedNumberImpl *SVGStopElementImpl::offset() const +{ + return m_offset; +} + +float SVGStopElementImpl::stopOpacity() const +{ + return m_stopOpacity; +} + + +/* +@namespace KSVG +@begin SVGStopElementImpl::s_hashTable 3 + offset SVGStopElementImpl::Offset DontDelete|ReadOnly + stop-opacity SVGStopElementImpl::StopOpacity DontDelete|ReadOnly +@end +*/ + +Value SVGStopElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case Offset: + if(!attributeMode) + return m_offset->cache(exec); + else + return Number(m_offset->baseVal()); + case StopOpacity: + if(!attributeMode) + return Undefined(); + else + return Number(m_stopOpacity); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGStopElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Offset: + float temp; + SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), temp); + offset()->setBaseVal(temp); + break; + case StopOpacity: + { + SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_stopOpacity); + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGStopElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not set, specifiy 0 + if(KSVG_TOKEN_NOT_PARSED(Offset)) + KSVG_SET_ALT_ATTRIBUTE(Offset, "0") +} diff --git a/ksvg/impl/SVGStringListImpl.cc b/ksvg/impl/SVGStringListImpl.cc deleted file mode 100644 index 331b4393..00000000 --- a/ksvg/impl/SVGStringListImpl.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGStringListImpl.h" - -using namespace KSVG; - -#include "SVGStringListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -// Ecma stuff - -/* -@namespace KSVG -@begin SharedString::s_hashTable 2 - dummy SharedString::Dummy DontDelete|ReadOnly -@end -*/ - -/* -@namespace KSVG -@begin SVGStringListImpl::s_hashTable 2 - numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGStringListImplProto::s_hashTable 11 - getItem SVGListDefs::GetItem DontDelete|Function 1 - removeItem SVGListDefs::RemoveItem DontDelete|Function 1 - appendItem SVGListDefs::AppendItem DontDelete|Function 1 - initialize SVGListDefs::Initialize DontDelete|Function 1 - insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 - replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 - clear SVGListDefs::Clear DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGStringList", SVGStringListImplProto, SVGStringListImplProtoFunc) - -Value SVGStringListImpl::getValueProperty(ExecState *exec, int token) const -{ - return SVGList::getValueProperty(exec, token); -} - -Value SVGStringListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGStringListImpl) - - return obj->call(exec, static_cast *>(obj), args, id); -} - -TQString SVGStringListImpl::join(const TQString &seperator) const -{ - SVGStringListImpl *self = const_cast(this); - - TQString result; - - if(!self->getItem(0)) - return result; - else - result += self->getItem(0)->string(); - - for(unsigned int i = 1; i <= numberOfItems(); i++) - { - DOM::DOMString *string = self->getItem(i); - - if(string) - result += seperator + string->string(); - } - - return result; -} diff --git a/ksvg/impl/SVGStringListImpl.cpp b/ksvg/impl/SVGStringListImpl.cpp new file mode 100644 index 00000000..331b4393 --- /dev/null +++ b/ksvg/impl/SVGStringListImpl.cpp @@ -0,0 +1,91 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGStringListImpl.h" + +using namespace KSVG; + +#include "SVGStringListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +// Ecma stuff + +/* +@namespace KSVG +@begin SharedString::s_hashTable 2 + dummy SharedString::Dummy DontDelete|ReadOnly +@end +*/ + +/* +@namespace KSVG +@begin SVGStringListImpl::s_hashTable 2 + numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGStringListImplProto::s_hashTable 11 + getItem SVGListDefs::GetItem DontDelete|Function 1 + removeItem SVGListDefs::RemoveItem DontDelete|Function 1 + appendItem SVGListDefs::AppendItem DontDelete|Function 1 + initialize SVGListDefs::Initialize DontDelete|Function 1 + insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 + replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 + clear SVGListDefs::Clear DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGStringList", SVGStringListImplProto, SVGStringListImplProtoFunc) + +Value SVGStringListImpl::getValueProperty(ExecState *exec, int token) const +{ + return SVGList::getValueProperty(exec, token); +} + +Value SVGStringListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGStringListImpl) + + return obj->call(exec, static_cast *>(obj), args, id); +} + +TQString SVGStringListImpl::join(const TQString &seperator) const +{ + SVGStringListImpl *self = const_cast(this); + + TQString result; + + if(!self->getItem(0)) + return result; + else + result += self->getItem(0)->string(); + + for(unsigned int i = 1; i <= numberOfItems(); i++) + { + DOM::DOMString *string = self->getItem(i); + + if(string) + result += seperator + string->string(); + } + + return result; +} diff --git a/ksvg/impl/SVGStylableImpl.cc b/ksvg/impl/SVGStylableImpl.cc deleted file mode 100644 index 4400b236..00000000 --- a/ksvg/impl/SVGStylableImpl.cc +++ /dev/null @@ -1,1307 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -#include "SVGPaint.h" -#include "SVGColorImpl.h" -#include "SVGPaintImpl.h" -#include "SVGHelperImpl.h" -#include "SVGLengthImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGStylableImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGStringListImpl.h" -#include "SVGImageElementImpl.h" -#include "SVGURIReferenceImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGColorProfileElementImpl.h" -#include "SVGAnimatedLengthListImpl.h" - -using namespace KSVG; - -#include "SVGStylableImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGStylableImpl::SVGStylableImpl(SVGElementImpl *object) : m_object(object) -{ - KSVG_EMPTY_FLAGS - - // View propidx.html, if you want to verify those default values (Niko) - m_flags = SVG_STYLE_FLAG_NONE; - - // Initialize all pointers to 0 - // Important! - m_color = 0; - m_fillColor = 0; - m_stopColor = 0; - m_dashArray = 0; - m_dashOffset = 0; - m_strokeWidth = 0; - m_strokeColor = 0; - m_fontFamily = 0; - - m_fillOpacity = 1; - m_strokeOpacity = 1; - m_opacity = 1; - - // Special case, getFontSize() could be accessed - // _before_ processStyle() is called -> no default - // value for font-size yet -> crash - // SVGLengthImpl access it when parsing em/ex values (Niko) - m_fontSize = -1; -} - -SVGStylableImpl::~SVGStylableImpl() -{ - if(m_strokeWidth) - m_strokeWidth->deref(); - if(m_fontFamily) - m_fontFamily->deref(); - if(m_strokeColor) - m_strokeColor->deref(); - if(m_fillColor) - m_fillColor->deref(); - if(m_color) - m_color->deref(); - if(m_stopColor) - m_stopColor->deref(); - if(m_dashOffset) - m_dashOffset->deref(); - if(m_dashArray) - m_dashArray->deref(); -} - -void SVGStylableImpl::processStyle() -{ - SVGStylableImpl *parentStyle = 0; - if(m_object && m_object->ownerDoc()) - parentStyle = dynamic_cast(m_object->ownerDoc()->getElementFromHandle((*m_object).parentNode().handle())); - - // Spec: default "none" - if(~m_flags & SVG_STYLE_FLAG_STROKE) - { - m_strokeColor = new SVGPaintImpl(m_object); - m_strokeColor->ref(); - - SVGPaintImpl *strokeColor = 0L; - if(parentStyle) - strokeColor = parentStyle->getStrokeColor(); - - if(strokeColor) - *m_strokeColor = *strokeColor; - else - m_strokeColor->setPaint(SVG_PAINTTYPE_NONE); - } - - // Spec: default "black" - if(~m_flags & SVG_STYLE_FLAG_FILL) - { - m_fillColor = new SVGPaintImpl(m_object); - m_fillColor->ref(); - - SVGPaintImpl *fillColor = 0; - if(parentStyle) - fillColor = parentStyle->getFillColor(); - - if(fillColor) - *m_fillColor = *fillColor; - else - m_fillColor->setRGBColor(DOM::DOMString("black")); - } - - // Spec: no real default - if(~m_flags & SVG_STYLE_FLAG_COLOR) - { - m_color = new SVGColorImpl(m_object); - m_color->ref(); - SVGColorImpl *color = 0; - if(parentStyle) - color = parentStyle->getColor(); - - if(color) - *m_color = *color; - } - - // Spec: default sRGB - if(~m_flags & SVG_STYLE_FLAG_COLOR_INTERPOLATION) - { - if(parentStyle) - m_colorInterpolation = parentStyle->getColorInterpolation(); - else - m_colorInterpolation = CI_SRGB; - } - - // Spec: default "1" - if(~m_flags & SVG_STYLE_FLAG_STROKE_WIDTH) - { - m_strokeWidth = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); - m_strokeWidth->ref(); - - SVGAnimatedLengthImpl *strokeWidth = 0; - if(parentStyle) - strokeWidth = parentStyle->getStrokeWidth(); - - if(strokeWidth) - *m_strokeWidth = *strokeWidth; - else - m_strokeWidth->baseVal()->setValue(1.0); - } - - // Spec: default "4" - if(~m_flags & SVG_STYLE_FLAG_STROKE_MITER_LIMIT) - { - if(parentStyle) - m_strokeMiterlimit = parentStyle->getStrokeMiterlimit(); - else - m_strokeMiterlimit = 4; - } - - // Spec: default "butt" - if(~m_flags & SVG_STYLE_FLAG_STROKE_LINE_CAP) - { - if(parentStyle) - m_capStyle = parentStyle->getCapStyle(); - else - m_capStyle = PATH_STROKE_CAP_BUTT; - } - - // Spec: default "miter" - if(~m_flags & SVG_STYLE_FLAG_STROKE_LINE_JOIN) - { - if(parentStyle) - m_joinStyle = parentStyle->getJoinStyle(); - else - m_joinStyle = PATH_STROKE_JOIN_MITER; - } - - // Spec: default "auto" - if(~m_flags & SVG_STYLE_FLAG_CURSOR) - { - if(parentStyle) - m_cursor = parentStyle->getCursor(); - else - m_cursor = CURSOR_AUTO; - } - - // Spec: default "visiblePainted" - if(~m_flags & SVG_STYLE_FLAG_POINTER_EVENTS) - { - if(parentStyle) - m_pointerEvents = parentStyle->getPointerEvents(); - else - m_pointerEvents = PE_VISIBLE_PAINTED; - } - - // Spec: default "0" - if(~m_flags & SVG_STYLE_FLAG_STROKE_DASH_OFFSET) - { - m_dashOffset = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); - m_dashOffset->ref(); - - SVGAnimatedLengthImpl *dashOffset = 0; - if(parentStyle) - dashOffset = parentStyle->getDashOffset(); - - if(dashOffset) - *m_dashOffset = *dashOffset; - else - m_dashOffset->baseVal()->setValue(0); - } - - // Spec: default "none" -> 0 == empty dash array - if(~m_flags & SVG_STYLE_FLAG_STROKE_DASH_ARRAY) - { - SVGAnimatedLengthListImpl *dashArray = 0; - if(parentStyle) - dashArray = parentStyle->getDashArray(); - - if(dashArray) - { - if (!m_dashArray) - { - m_dashArray = new SVGAnimatedLengthListImpl(); - m_dashArray->ref(); - } - *m_dashArray = *dashArray; - } - else - m_dashArray = 0; - } - - // Spec: default "1" -> 1 == Not opaque - if(~m_flags & SVG_STYLE_FLAG_FILL_OPACITY) - { - if(parentStyle) - m_fillOpacity = parentStyle->getFillOpacity(); - else - m_fillOpacity = 1; - } - - if(~m_flags & SVG_STYLE_FLAG_STROKE_OPACITY) - { - if(parentStyle) - m_strokeOpacity = parentStyle->getStrokeOpacity(); - else - m_strokeOpacity = 1; - } - - // Fake group opacity by multiplying by our parent's group opacity - if(~m_flags & SVG_STYLE_FLAG_OPACITY) - { - if(parentStyle) - m_opacity = parentStyle->getOpacity(); - else - m_opacity = 1; - } - else - if(parentStyle) - m_opacity *= parentStyle->getOpacity(); - - if(~m_flags & SVG_STYLE_FLAG_CLIP_PATH) - m_clipPath = ""; - - if(~m_flags & SVG_STYLE_FLAG_MASK) - m_mask = ""; - - // Spec: default "nonzero" - if(~m_flags & SVG_STYLE_FLAG_FILL_RULE) - { - if(parentStyle) - m_fillRule = parentStyle->getFillRule(); - else - m_fillRule = RULE_NONZERO; - } - - if(~m_flags & SVG_STYLE_FLAG_CLIP_RULE) - { - if(parentStyle) - m_clipRule = parentStyle->getClipRule(); - else - m_clipRule = RULE_NONZERO; - } - - // Spec: default "hidden" - if(~m_flags & SVG_STYLE_FLAG_OVERFLOW) - { - if(parentStyle) - m_overflow = parentStyle->getOverflow(); - else - m_overflow = false; - } - - // We are not really, spec compatible here, we just - // define a bool, to indicate wheter an element should - // be rendered or not. - if(~m_flags & SVG_STYLE_FLAG_DISPLAY) - m_display = true; - - if(~m_flags & SVG_STYLE_FLAG_VISIBILITY) - { - if(parentStyle) - m_visible = parentStyle->getVisible(); - else - m_visible = true; - } - - // Spec: default "medium" - if(~m_flags & SVG_STYLE_FLAG_FONT_SIZE) - { - if(parentStyle) - m_fontSize = parentStyle->getFontSize(); - else - m_fontSize = fontSizeForText("medium"); - } - - // Spec: default "depends on user agent" -> "Arial" for SVG - if(~m_flags & SVG_STYLE_FLAG_FONT_FAMILY) - { - if(!m_fontFamily) - { - m_fontFamily = new SVGStringListImpl(); - m_fontFamily->ref(); - } - - SVGStringListImpl *fontFamily = 0; - if(parentStyle) - fontFamily = parentStyle->getFontFamily(); - - if(fontFamily) - *m_fontFamily = *fontFamily; - else - { - SharedString *string = new SharedString("Arial"); - string->ref(); - - m_fontFamily->appendItem(string); - } - } - - // Spec: default "normal" - if(~m_flags & SVG_STYLE_FLAG_FONT_STYLE) - { - if(parentStyle) - m_fontStyle = parentStyle->getFontStyle(); - else - m_fontStyle = FSNORMAL; - } - - // Spec: default "normal" - if(~m_flags & SVG_STYLE_FLAG_FONT_WEIGHT) - { - if(parentStyle) - m_fontWeight = parentStyle->getFontWeight(); - else - m_fontWeight = "normal"; - } - - // Spec: default "start" - if(~m_flags & SVG_STYLE_FLAG_TEXT_ANCHOR) - { - if(parentStyle) - m_textAnchor = parentStyle->getTextAnchor(); - else - m_textAnchor = TASTART; - } - - // Spec: default "LTR" - if(~m_flags & SVG_STYLE_FLAG_TEXT_DIRECTION) - { - if(parentStyle) - m_textDirection = parentStyle->getTextDirection(); - else - m_textDirection = LTR; - } - - // Spec: default "none" - if(~m_flags & SVG_STYLE_FLAG_TEXT_DECORATION) - { - if(parentStyle) - m_textDecoration = parentStyle->getTextDecoration(); - else - m_textDecoration = TDNONE; - } - - // Spec: default "baseline" - if(~m_flags & SVG_STYLE_FLAG_BASELINE_SHIFT) - { - if(parentStyle) - m_baselineShift = parentStyle->getBaselineShift(); - else - m_baselineShift = "baseline"; - } - - // Spec: default "lr-tb", FIXME - if(~m_flags & SVG_STYLE_FLAG_TEXT_WRITING_MODE) - { - if(parentStyle) - m_textWritingMode = parentStyle->getTextWritingMode(); - else - m_textWritingMode = LR; - } - - // Spec: default "normal" - if(~m_flags & SVG_STYLE_FLAG_TEXT_UNICODE_BIDI) - { - if(parentStyle) - m_textUnicodeBidi = parentStyle->getTextUnicodeBidi(); - else - m_textUnicodeBidi = UBNORMAL; - } - - // Spec: default "auto" - if(~m_flags & SVG_STYLE_FLAG_GLYPH_ORIENTATION_VERTICAL) - { - if(parentStyle) - m_glyphOrientationVertical = parentStyle->getGlyphOrientationVertical(); - else - m_glyphOrientationVertical = "auto"; - } - - // Spec: default "auto" - if(~m_flags & SVG_STYLE_FLAG_GLYPH_ORIENTATION_HORIZONTAL) - { - if(parentStyle) - m_glyphOrientationHorizontal = parentStyle->getGlyphOrientationHorizontal(); - else - m_glyphOrientationHorizontal = "auto"; - } - - // Spec: default "normal" - if(~m_flags & SVG_STYLE_FLAG_LETTER_SPACING) - { - if(parentStyle) - m_letterSpacing = parentStyle->getLetterSpacing(); - else - m_letterSpacing = "normal"; - } - - // Spec: default "normal" - if(~m_flags & SVG_STYLE_FLAG_WORD_SPACING) - { - if(parentStyle) - m_wordSpacing = parentStyle->getWordSpacing(); - else - m_wordSpacing = "normal"; - } - - // Spec: default "black" - if(~m_flags & SVG_STYLE_FLAG_STOP) - { - m_stopColor = new SVGColorImpl(m_object); - m_stopColor->ref(); - - m_stopColor->setRGBColor(DOM::DOMString("black")); - } - - // Spec: default "none" - if(~m_flags & SVG_STYLE_FLAG_MARKER_START) - { - if(parentStyle) - m_startMarker = parentStyle->getStartMarker(); - else - m_startMarker = TQString(); - } - - // Spec: default "none" - if(~m_flags & SVG_STYLE_FLAG_MARKER_MID) - { - if(parentStyle) - m_midMarker = parentStyle->getMidMarker(); - else - m_midMarker = TQString(); - } - - // Spec: default "none" - if(~m_flags & SVG_STYLE_FLAG_MARKER_END) - { - if(parentStyle) - m_endMarker = parentStyle->getEndMarker(); - else - m_endMarker = TQString(); - } -} - -bool SVGStylableImpl::isStroked() const -{ - if(!m_strokeColor) - return false; - - return m_strokeColor->paintType() != SVG_PAINTTYPE_UNKNOWN && - m_strokeColor->paintType() != SVG_PAINTTYPE_NONE && - m_strokeColor->paintType() != SVG_PAINTTYPE_URI_NONE; -} - -bool SVGStylableImpl::isFilled() const -{ - if(!m_fillColor) - return false; - - return m_fillColor->paintType() != SVG_PAINTTYPE_UNKNOWN && - m_fillColor->paintType() != SVG_PAINTTYPE_NONE && - m_fillColor->paintType() != SVG_PAINTTYPE_URI_NONE; -} - -TQString SVGStylableImpl::extractUrlId(const TQString &url) -{ - TQString id; - - if(url.startsWith("url(#")) - { - int idstart = url.find("#") + 1; - id = url.mid(idstart, url.length() - idstart - 1); - } - else - id = url; - - return id; -} - -void SVGStylableImpl::setMarkers(const TQString &marker) -{ - setStartMarker(marker); - setMidMarker(marker); - setEndMarker(marker); -} - -void SVGStylableImpl::setStartMarker(const TQString &startMarker) -{ - if(startMarker.startsWith("url(#")) - { - int idstart = startMarker.find("#") + 1; - m_startMarker = startMarker.mid(idstart, startMarker.length() - idstart - 1); - } - else if(startMarker == "none") - m_startMarker = TQString(); -} - -void SVGStylableImpl::setMidMarker(const TQString &midMarker) -{ - if(midMarker.startsWith("url(#")) - { - int idstart = midMarker.find("#") + 1; - m_midMarker = midMarker.mid(idstart, midMarker.length() - idstart - 1); - } - else if(midMarker == "none") - m_midMarker = TQString(); -} - -void SVGStylableImpl::setEndMarker(const TQString &endMarker) -{ - if(endMarker.startsWith("url(#")) - { - int idstart = endMarker.find("#") + 1; - m_endMarker = endMarker.mid(idstart, endMarker.length() - idstart - 1); - } - else if(endMarker == "none") - m_endMarker = TQString(); -} - -bool SVGStylableImpl::hasMarkers() const -{ - return !m_startMarker.isEmpty() || !m_midMarker.isEmpty() || !m_endMarker.isEmpty(); -} - -void SVGStylableImpl::setPaint(const TQString ¶m, SVGPaintImpl *svgPaint) -{ - if(param.stripWhiteSpace() == "none") - svgPaint->setPaint(SVG_PAINTTYPE_NONE, DOM::DOMString(""), DOM::DOMString("")); - else if(SVGURIReferenceImpl::isUrl(param)) - svgPaint->setUri(SVGURIReferenceImpl::getTarget(param)); - else - setColor(param, svgPaint); -} - -void SVGStylableImpl::setColor(const TQString ¶m, SVGColorImpl *svgColor) -{ - if(param.stripWhiteSpace().startsWith("#")) - { - if(param.contains("icc-color")) - { - TQString first = param.left(7); - TQString last = param.right(param.length() - 8); - - svgColor->setRGBColorICCColor(first, last); - } - else - { - TQColor color; - color.setNamedColor(param.stripWhiteSpace()); - svgColor->setRGBColor(color); - } - } - else if(param.stripWhiteSpace().startsWith("rgb(")) - { - TQString parse = param.stripWhiteSpace(); - TQStringList colors = TQStringList::split(',', parse); - TQString r = colors[0].right((colors[0].length() - 4)); - TQString g = colors[1]; - TQString b = colors[2].left((colors[2].length() - 1)); - - if(r.contains("%")) - { - r = r.left(r.length() - 1); - r = TQString::number(int((double(255 * r.toDouble()) / 100.0))); - } - - if(g.contains("%")) - { - g = g.left(g.length() - 1); - g = TQString::number(int((double(255 * g.toDouble()) / 100.0))); - } - - if(b.contains("%")) - { - b = b.left(b.length() - 1); - b = TQString::number(int((double(255 * b.toDouble()) / 100.0))); - } - - svgColor->setRGBColor(int(r.toFloat()), int(g.toFloat()), int(b.toFloat())); - } - else - { - if(param.stripWhiteSpace().lower() == "currentcolor") - svgColor->setColor(SVG_COLORTYPE_CURRENTCOLOR, DOM::DOMString(""), DOM::DOMString("")); - else - svgColor->setRGBColor(DOM::DOMString(param.stripWhiteSpace().lower())); - } -} - -TQRect SVGStylableImpl::clip() -{ - return TQRect(); -} - -void SVGStylableImpl::setClip(const TQString &) -{ -} - -float SVGStylableImpl::fontSizeForText(const TQString &value) -{ - float ret = -1; - - // Spec: "On a computer screen a scaling factor of 1.2 is suggested between adjacent indexes" - const float factor = 1.2; - - // Spec: "If the 'medium' font is 12pt, the 'large' font could be 14.4pt." - const float mediumFont = 12.0; - - if(value == "xx-small") - ret = mediumFont - (3.0 * factor); - else if(value == "x-small") - ret = mediumFont - (2.0 * factor); - else if(value == "small") - ret = mediumFont - factor; - else if(value == "medium") - ret = mediumFont; - else if(value == "large") - ret = mediumFont + factor; - else if(value == "x-large") - ret = mediumFont + (2.0 * factor); - else if(value == "xx-large") - ret = mediumFont + (3.0 * factor); - - return ret; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGStylableImpl::s_hashTable 47 - className SVGStylableImpl::ClassName DontDelete|ReadOnly - style SVGStylableImpl::Style DontDelete|ReadOnly - stroke-width SVGStylableImpl::StrokeWidth DontDelete|ReadOnly - stroke-miterlimit SVGStylableImpl::StrokeMiterlimit DontDelete|ReadOnly - stroke-linecap SVGStylableImpl::StrokeLineCap DontDelete|ReadOnly - stroke-linejoin SVGStylableImpl::StrokeLineJoin DontDelete|ReadOnly - stroke SVGStylableImpl::Stroke DontDelete|ReadOnly - fill SVGStylableImpl::Fill DontDelete|ReadOnly - color SVGStylableImpl::Color DontDelete|ReadOnly - stop-color SVGStylableImpl::StopColor DontDelete|ReadOnly - font-size SVGStylableImpl::FontSize DontDelete|ReadOnly - font-family SVGStylableImpl::FontFamily DontDelete|ReadOnly - font-weight SVGStylableImpl::FontWeight DontDelete|ReadOnly - font-style SVGStylableImpl::FontStyle DontDelete|ReadOnly - text-decoration SVGStylableImpl::TextDecoration DontDelete|ReadOnly - text-anchor SVGStylableImpl::TextAnchor DontDelete|ReadOnly - direction SVGStylableImpl::Direction DontDelete|ReadOnly - writing-mode SVGStylableImpl::WritingMode DontDelete|ReadOnly - unicode-bidi SVGStylableImpl::UnicodeBidi DontDelete|ReadOnly - opacity SVGStylableImpl::Opacity DontDelete|ReadOnly - fill-opacity SVGStylableImpl::FillOpacity DontDelete|ReadOnly - stroke-opacity SVGStylableImpl::StrokeOpacity DontDelete|ReadOnly - clip-path SVGStylableImpl::ClipPath DontDelete|ReadOnly - marker-start SVGStylableImpl::MarkerStart DontDelete|ReadOnly - marker-mid SVGStylableImpl::MarkerMid DontDelete|ReadOnly - marker-end SVGStylableImpl::MarkerEnd DontDelete|ReadOnly - marker SVGStylableImpl::Marker DontDelete|ReadOnly - cursor SVGStylableImpl::Cursor DontDelete|ReadOnly - display SVGStylableImpl::Display DontDelete|ReadOnly - overflow SVGStylableImpl::Overflow DontDelete|ReadOnly - clip SVGStylableImpl::Clip DontDelete|ReadOnly - visibility SVGStylableImpl::Visibility DontDelete|ReadOnly - fill-rule SVGStylableImpl::FillRule DontDelete|ReadOnly - clip-rule SVGStylableImpl::ClipRule DontDelete|ReadOnly - stroke-dashoffset SVGStylableImpl::StrokeDashOffset DontDelete|ReadOnly - stroke-dasharray SVGStylableImpl::StrokeDashArray DontDelete|ReadOnly - color-profile SVGStylableImpl::ColorProfile DontDelete|ReadOnly - baseline-shift SVGStylableImpl::BaselineShift DontDelete|ReadOnly - letter-spacing SVGStylableImpl::LetterSpacing DontDelete|ReadOnly - word-spacing SVGStylableImpl::WordSpacing DontDelete|ReadOnly - pointer-events SVGStylableImpl::PointerEvents DontDelete|ReadOnly - glyph-orientation-vertical SVGStylableImpl::GlyphOrientationVertical DontDelete|ReadOnly - glyph-orientation-horizontal SVGStylableImpl::GlyphOrientationHorizontal DontDelete|ReadOnly - color-interpolation SVGStylableImpl::ColorInterpolation DontDelete|ReadOnly - mask SVGStylableImpl::Mask DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGStylableImplProto::s_hashTable 2 - getStyle SVGStylableImpl::GetStyle DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGStylable", SVGStylableImplProto, SVGStylableImplProtoFunc) - -Value SVGStylableImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - //case ClassName: - // return String(className().string()); - case Style: - return String(m_object ? m_object->DOM::Element::getAttribute("style") : ""); - case Visibility: - return String(m_visible ? "visible" : "hidden"); - case Display: - return String(m_display ? "inline" : "none"); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGStylableImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - TQString param = value.toString(exec).qstring(); - - if (param.isEmpty()) - return; - - bool redraw = false; - bool inherit = (param == "inherit"); - int update = -1; - - switch(token) - { - case Style: - { - if(!m_object) - return; - - TQStringList substyles = TQStringList::split(';', param); - for(TQStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it) - { - TQStringList substyle = TQStringList::split(':', (*it)); - m_object->setAttributeInternal(substyle[0].stripWhiteSpace(), substyle[1].stripWhiteSpace()); - } - break; - } - case StrokeWidth: - if(m_flags & SVG_STYLE_FLAG_STROKE_WIDTH) - { - redraw = true; - update = UPDATE_LINEWIDTH; - } - if(inherit) - m_flags &= ~SVG_STYLE_FLAG_STROKE_WIDTH; - else - { - m_flags |= SVG_STYLE_FLAG_STROKE_WIDTH; - - if(!m_strokeWidth) - { - m_strokeWidth = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); - m_strokeWidth->ref(); - } - - m_strokeWidth->baseVal()->setValueAsString(param); - } - break; - case StrokeMiterlimit: - m_flags |= SVG_STYLE_FLAG_STROKE_MITER_LIMIT; - if(!inherit) - m_strokeMiterlimit = param.toUInt(); - break; - case StrokeLineCap: - m_flags |= SVG_STYLE_FLAG_STROKE_LINE_CAP; - if(param == "butt") - m_capStyle = PATH_STROKE_CAP_BUTT; - else if(param == "round") - m_capStyle = PATH_STROKE_CAP_ROUND; - else if(param == "square") - m_capStyle = PATH_STROKE_CAP_SQUARE; - break; - case StrokeLineJoin: - m_flags |= SVG_STYLE_FLAG_STROKE_LINE_JOIN; - if(param == "miter") - m_joinStyle = PATH_STROKE_JOIN_MITER; - else if(param == "round") - m_joinStyle = PATH_STROKE_JOIN_ROUND; - else if(param == "bevel") - m_joinStyle = PATH_STROKE_JOIN_BEVEL; - break; - case Stroke: - if(m_flags & SVG_STYLE_FLAG_STROKE) - redraw = true; - if(inherit) - m_flags &= ~SVG_STYLE_FLAG_STROKE; - else - { - m_flags |= SVG_STYLE_FLAG_STROKE; - - if(!m_strokeColor) - { - m_strokeColor = new SVGPaintImpl(m_object); - m_strokeColor->ref(); - } - - setPaint(param, m_strokeColor); - } - break; - case Fill: - if(m_flags & SVG_STYLE_FLAG_FILL) - { - redraw = true; - update = UPDATE_STYLE; - } - if(inherit) - m_flags &= ~SVG_STYLE_FLAG_FILL; - else - { - m_flags |= SVG_STYLE_FLAG_FILL; - - if(!m_fillColor) - { - m_fillColor = new SVGPaintImpl(m_object); - m_fillColor->ref(); - } - - setPaint(param, m_fillColor); - } - break; - case Color: - if(m_flags & SVG_STYLE_FLAG_COLOR) - redraw = true; - if(inherit) - m_flags &= ~SVG_STYLE_FLAG_COLOR; - else - { - m_flags |= SVG_STYLE_FLAG_COLOR; - - if(!m_color) - { - m_color = new SVGColorImpl(m_object); - m_color->ref(); - } - setColor(param, m_color); - } - break; - case StopColor: - m_flags |= SVG_STYLE_FLAG_STOP; - - if(!m_stopColor) - { - m_stopColor = new SVGColorImpl(m_object); - m_stopColor->ref(); - } - - if(!inherit) - setColor(param, m_stopColor); - break; - case ColorInterpolation: - if(inherit) - m_flags &= ~SVG_STYLE_FLAG_COLOR_INTERPOLATION; - else - { - m_flags |= SVG_STYLE_FLAG_COLOR_INTERPOLATION; - if(param == "auto" || param == "sRGB") - m_colorInterpolation = CI_SRGB; - else - if(param == "linearRGB") - m_colorInterpolation = CI_LINEARRGB; - } - break; - case FontSize: - { - m_flags |= SVG_STYLE_FLAG_FONT_SIZE; - if(!inherit) - { - double temp = fontSizeForText(param); - if(temp != -1) // Is "absolute-size" - { - m_fontSize = temp; - break; - } - - SVGLengthImpl *length = SVGSVGElementImpl::createSVGLength(); - length->setContext(m_object); - length->setValueAsString(DOM::DOMString(param)); - m_fontSize = length->value(); - length->deref(); - } - break; - } - case FontFamily: - m_flags |= SVG_STYLE_FLAG_FONT_FAMILY; - - // Hacks - // #1 Replace "'" characters by "" - param = param.replace('\'', TQString()); - // #2 Replace "MS-Gothic" by "MS Gothic" - param = param.replace("MS-Gothic", "MS Gothic"); - // #3 Replace "Helvetica" by "Arial" - param = param.replace("Helvetica", "Arial"); - param = param.replace("helvetica", "Arial"); - - if(!m_fontFamily) - { - m_fontFamily = new SVGStringListImpl(); - m_fontFamily->ref(); - } - - if(!inherit) - SVGHelperImpl::parseCommaSeperatedList(m_fontFamily, param); - break; - case FontWeight: - m_flags |= SVG_STYLE_FLAG_FONT_WEIGHT; - if(!inherit) - m_fontWeight = param; - break; - case FontStyle: - m_flags |= SVG_STYLE_FLAG_FONT_STYLE; - if(param == "normal") - m_fontStyle = FSNORMAL; - else if(param == "italic") - m_fontStyle = ITALIC; - else if(param == "oblique") - m_fontStyle = OBLIQUE; - break; - case TextDecoration: - m_flags |= SVG_STYLE_FLAG_TEXT_DECORATION; - if(param == "none") - m_textDecoration = TDNONE; - { - // CSS2 allows multiple decorations - m_textDecoration = TDNONE; - TQStringList decorations = TQStringList::split(' ', param); - for(TQStringList::Iterator it = decorations.begin(); it != decorations.end(); ++it) - { - if(*it == "underline") - m_textDecoration |= UNDERLINE; - else if(*it == "overline") - m_textDecoration |= OVERLINE; - else if(*it == "line-through") - m_textDecoration |= LINE_THROUGH; - } - } - break; - case TextAnchor: - m_flags |= SVG_STYLE_FLAG_TEXT_ANCHOR; - if(param == "start") - m_textAnchor = TASTART; - else if(param == "middle") - m_textAnchor = TAMIDDLE; - else if(param == "end") - m_textAnchor = TAEND; - break; - case Direction: - m_flags |= SVG_STYLE_FLAG_TEXT_DIRECTION; - // Spec: direction is only processed when unicode-bidi - // is set to bidi-override or embedded - if(m_textUnicodeBidi == OVERRIDE || - m_textUnicodeBidi == EMBED || - m_textUnicodeBidi == UBNORMAL) - { - if(param == "rtl") - m_textDirection = RTL; - else if(param == "ltr") - m_textDirection = LTR; - } - break; - case WritingMode: - m_flags |= SVG_STYLE_FLAG_TEXT_WRITING_MODE; - if(param == "lr-tb" || param == "lr") - m_textWritingMode = LR; - else if(param == "rl-tb" || param == "rl") - m_textWritingMode = RL; - else if(param == "tb-lr" || param == "tb") - m_textWritingMode = TB; - break; - case UnicodeBidi: - m_flags |= SVG_STYLE_FLAG_TEXT_UNICODE_BIDI; - if(param == "normal") - m_textUnicodeBidi = UBNORMAL; - else if(param == "embed") - m_textUnicodeBidi = EMBED; - else if(param == "bidi-override") - m_textUnicodeBidi = OVERRIDE; - break; - case GlyphOrientationVertical: - m_flags |= SVG_STYLE_FLAG_GLYPH_ORIENTATION_VERTICAL; - m_glyphOrientationVertical = param; - break; - case GlyphOrientationHorizontal: - m_flags |= SVG_STYLE_FLAG_GLYPH_ORIENTATION_HORIZONTAL; - m_glyphOrientationHorizontal = param; - break; - case Opacity: - m_flags |= SVG_STYLE_FLAG_OPACITY; - - if(!inherit) - { - SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_opacity); - } - break; - case FillOpacity: - m_flags |= SVG_STYLE_FLAG_FILL_OPACITY; - - if(!inherit) - { - SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_fillOpacity); - } - break; - case StrokeOpacity: - m_flags |= SVG_STYLE_FLAG_STROKE_OPACITY; - - if(!inherit) - { - SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_strokeOpacity); - } - break; - case ClipPath: - m_flags |= SVG_STYLE_FLAG_CLIP_PATH; - if(!inherit) - m_clipPath = extractUrlId(param); - break; - case Mask: - m_flags |= SVG_STYLE_FLAG_MASK; - if(!inherit) - m_mask = extractUrlId(param); - break; - case MarkerStart: - m_flags |= SVG_STYLE_FLAG_MARKER_START; - if(!inherit) - setStartMarker(param); - break; - case MarkerMid: - m_flags |= SVG_STYLE_FLAG_MARKER_MID; - if(!inherit) - setMidMarker(param); - break; - case MarkerEnd: - m_flags |= SVG_STYLE_FLAG_MARKER_END; - if(!inherit) - setEndMarker(param); - break; - case Marker: - m_flags |= (SVG_STYLE_FLAG_MARKER_START | SVG_STYLE_FLAG_MARKER_MID | SVG_STYLE_FLAG_MARKER_END); - if(!inherit) - setMarkers(param); - break; - case PointerEvents: - m_flags |= SVG_STYLE_FLAG_POINTER_EVENTS; - if(param == "none") - m_pointerEvents = PE_NONE; - else if(param == "stroke") - m_pointerEvents = PE_STROKE; - else if(param == "fill") - m_pointerEvents = PE_FILL; - else if(param == "painted") - m_pointerEvents = PE_PAINTED; - else if(param == "visibleStroke") - m_pointerEvents = PE_VISIBLE_STROKE; - else if(param == "visibleFill") - m_pointerEvents = PE_VISIBLE_FILL; - else if(param == "visiblePainted") - m_pointerEvents = PE_VISIBLE_PAINTED; - else if(param == "visible") - m_pointerEvents = PE_VISIBLE; - else if(param == "all") - m_pointerEvents = PE_ALL; - break; - case Cursor: - m_flags |= SVG_STYLE_FLAG_CURSOR; - if(param == "auto") - m_cursor = CURSOR_AUTO; - else if(param == "crosshair") - m_cursor = CURSOR_CROSSHAIR; - else if(param == "default") - m_cursor = CURSOR_DEFAULT; - else if(param == "pointer") - m_cursor = CURSOR_POINTER; - else if(param == "move") - m_cursor = CURSOR_MOVE; - else if(param == "e-resize") - m_cursor = CURSOR_E_RESIZE; - else if(param == "ne-resize") - m_cursor = CURSOR_NE_RESIZE; - else if(param == "nw-resize") - m_cursor = CURSOR_NW_RESIZE; - else if(param == "n-resize") - m_cursor = CURSOR_N_RESIZE; - else if(param == "se-resize") - m_cursor = CURSOR_SE_RESIZE; - else if(param == "sw-resize") - m_cursor = CURSOR_SW_RESIZE; - else if(param == "s-resize") - m_cursor = CURSOR_S_RESIZE; - else if(param == "w-resize") - m_cursor = CURSOR_W_RESIZE; - else if(param == "text") - m_cursor = CURSOR_TEXT; - else if(param == "wait") - m_cursor = CURSOR_WAIT; - else if(param == "help") - m_cursor = CURSOR_HELP; - break; - case Display: - m_flags |= SVG_STYLE_FLAG_DISPLAY; - - if(param == "none") - m_display = false; - else if(!inherit) - m_display = true; - break; - case Overflow: - m_flags |= SVG_STYLE_FLAG_OVERFLOW; - if(param == "hidden" || param == "scroll") - m_overflow = false; - else if(!inherit) - m_overflow = true; - break; - case Clip: - m_flags |= SVG_STYLE_FLAG_CLIP_PATH; - if(!inherit) - setClip(param); - break; - case Visibility: - if(m_flags & SVG_STYLE_FLAG_VISIBILITY) - redraw = true; - if(inherit) - m_flags &= ~SVG_STYLE_FLAG_COLOR; - else - { - m_flags |= SVG_STYLE_FLAG_VISIBILITY; - - if(param == "visible") - m_visible = true; - else if(!inherit) - m_visible = false; - - // Just a quick fix for the script-* files (Niko) - // Any better solution?? - update = UPDATE_TRANSFORM; - redraw = true; - } - SVGHelperImpl::applyContainer(this, Visibility, param); - break; - case FillRule: - m_flags |= SVG_STYLE_FLAG_FILL_RULE; - if(!inherit) - m_fillRule = (param == "evenodd" ? RULE_EVENODD : RULE_NONZERO); - break; - case ClipRule: - m_flags |= SVG_STYLE_FLAG_CLIP_RULE; - if(!inherit) - m_clipRule = (param == "evenodd" ? RULE_EVENODD : RULE_NONZERO); - break; - case StrokeDashOffset: - m_flags |= SVG_STYLE_FLAG_STROKE_DASH_OFFSET; - - if(!m_dashOffset) - { - m_dashOffset = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); - m_dashOffset->ref(); - } - - if(!inherit) - m_dashOffset->baseVal()->setValueAsString(param); - break; - case StrokeDashArray: - { - m_flags |= SVG_STYLE_FLAG_STROKE_DASH_ARRAY; - - if(!m_dashArray) - { - m_dashArray = new SVGAnimatedLengthListImpl(); - m_dashArray->ref(); - } - else - m_dashArray->baseVal()->clear(); - - if(param != "none" && !inherit) - SVGHelperImpl::parseLengthList(m_dashArray, param); - break; - } - case ColorProfile: - { - m_flags |= SVG_STYLE_FLAG_COLOR_PROFILE; - if(!inherit) - { - if(!m_object) - return; - - SVGColorProfileElementImpl *handle = static_cast(m_object->ownerSVGElement()->getElementById(SVGURIReferenceImpl::getTarget(param))); - if(handle) - SVGImageElementImpl::applyColorProfile(handle, static_cast(this)); - } - break; - } - case BaselineShift: - { - m_flags |= SVG_STYLE_FLAG_BASELINE_SHIFT; - if(!inherit) - m_baselineShift = param; - break; - } - case LetterSpacing: - m_flags |= SVG_STYLE_FLAG_LETTER_SPACING; - case WordSpacing: - { - if(!inherit) - { - if(token == WordSpacing) - { - m_flags |= SVG_STYLE_FLAG_WORD_SPACING; - m_wordSpacing = param; - } - else - m_letterSpacing = param; - } - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } - - if(redraw) - { - SVGShapeImpl *shape = dynamic_cast(m_object); - if(inherit) - processStyle(); - - if(shape && shape->item()) - { - if(update > -1) - shape->item()->update(static_cast(update)); - else if(m_object) - m_object->ownerDoc()->canvas()->invalidate(shape->item(), false); - } - } -} - -Value SVGStylableImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) -{ - KSVG_CHECK_THIS(SVGStylableImpl) - - switch(id) - { - case SVGStylableImpl::GetStyle: - return Undefined(); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} diff --git a/ksvg/impl/SVGStylableImpl.cpp b/ksvg/impl/SVGStylableImpl.cpp new file mode 100644 index 00000000..4400b236 --- /dev/null +++ b/ksvg/impl/SVGStylableImpl.cpp @@ -0,0 +1,1307 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +#include "SVGPaint.h" +#include "SVGColorImpl.h" +#include "SVGPaintImpl.h" +#include "SVGHelperImpl.h" +#include "SVGLengthImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGStylableImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGStringListImpl.h" +#include "SVGImageElementImpl.h" +#include "SVGURIReferenceImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGColorProfileElementImpl.h" +#include "SVGAnimatedLengthListImpl.h" + +using namespace KSVG; + +#include "SVGStylableImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGStylableImpl::SVGStylableImpl(SVGElementImpl *object) : m_object(object) +{ + KSVG_EMPTY_FLAGS + + // View propidx.html, if you want to verify those default values (Niko) + m_flags = SVG_STYLE_FLAG_NONE; + + // Initialize all pointers to 0 + // Important! + m_color = 0; + m_fillColor = 0; + m_stopColor = 0; + m_dashArray = 0; + m_dashOffset = 0; + m_strokeWidth = 0; + m_strokeColor = 0; + m_fontFamily = 0; + + m_fillOpacity = 1; + m_strokeOpacity = 1; + m_opacity = 1; + + // Special case, getFontSize() could be accessed + // _before_ processStyle() is called -> no default + // value for font-size yet -> crash + // SVGLengthImpl access it when parsing em/ex values (Niko) + m_fontSize = -1; +} + +SVGStylableImpl::~SVGStylableImpl() +{ + if(m_strokeWidth) + m_strokeWidth->deref(); + if(m_fontFamily) + m_fontFamily->deref(); + if(m_strokeColor) + m_strokeColor->deref(); + if(m_fillColor) + m_fillColor->deref(); + if(m_color) + m_color->deref(); + if(m_stopColor) + m_stopColor->deref(); + if(m_dashOffset) + m_dashOffset->deref(); + if(m_dashArray) + m_dashArray->deref(); +} + +void SVGStylableImpl::processStyle() +{ + SVGStylableImpl *parentStyle = 0; + if(m_object && m_object->ownerDoc()) + parentStyle = dynamic_cast(m_object->ownerDoc()->getElementFromHandle((*m_object).parentNode().handle())); + + // Spec: default "none" + if(~m_flags & SVG_STYLE_FLAG_STROKE) + { + m_strokeColor = new SVGPaintImpl(m_object); + m_strokeColor->ref(); + + SVGPaintImpl *strokeColor = 0L; + if(parentStyle) + strokeColor = parentStyle->getStrokeColor(); + + if(strokeColor) + *m_strokeColor = *strokeColor; + else + m_strokeColor->setPaint(SVG_PAINTTYPE_NONE); + } + + // Spec: default "black" + if(~m_flags & SVG_STYLE_FLAG_FILL) + { + m_fillColor = new SVGPaintImpl(m_object); + m_fillColor->ref(); + + SVGPaintImpl *fillColor = 0; + if(parentStyle) + fillColor = parentStyle->getFillColor(); + + if(fillColor) + *m_fillColor = *fillColor; + else + m_fillColor->setRGBColor(DOM::DOMString("black")); + } + + // Spec: no real default + if(~m_flags & SVG_STYLE_FLAG_COLOR) + { + m_color = new SVGColorImpl(m_object); + m_color->ref(); + SVGColorImpl *color = 0; + if(parentStyle) + color = parentStyle->getColor(); + + if(color) + *m_color = *color; + } + + // Spec: default sRGB + if(~m_flags & SVG_STYLE_FLAG_COLOR_INTERPOLATION) + { + if(parentStyle) + m_colorInterpolation = parentStyle->getColorInterpolation(); + else + m_colorInterpolation = CI_SRGB; + } + + // Spec: default "1" + if(~m_flags & SVG_STYLE_FLAG_STROKE_WIDTH) + { + m_strokeWidth = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); + m_strokeWidth->ref(); + + SVGAnimatedLengthImpl *strokeWidth = 0; + if(parentStyle) + strokeWidth = parentStyle->getStrokeWidth(); + + if(strokeWidth) + *m_strokeWidth = *strokeWidth; + else + m_strokeWidth->baseVal()->setValue(1.0); + } + + // Spec: default "4" + if(~m_flags & SVG_STYLE_FLAG_STROKE_MITER_LIMIT) + { + if(parentStyle) + m_strokeMiterlimit = parentStyle->getStrokeMiterlimit(); + else + m_strokeMiterlimit = 4; + } + + // Spec: default "butt" + if(~m_flags & SVG_STYLE_FLAG_STROKE_LINE_CAP) + { + if(parentStyle) + m_capStyle = parentStyle->getCapStyle(); + else + m_capStyle = PATH_STROKE_CAP_BUTT; + } + + // Spec: default "miter" + if(~m_flags & SVG_STYLE_FLAG_STROKE_LINE_JOIN) + { + if(parentStyle) + m_joinStyle = parentStyle->getJoinStyle(); + else + m_joinStyle = PATH_STROKE_JOIN_MITER; + } + + // Spec: default "auto" + if(~m_flags & SVG_STYLE_FLAG_CURSOR) + { + if(parentStyle) + m_cursor = parentStyle->getCursor(); + else + m_cursor = CURSOR_AUTO; + } + + // Spec: default "visiblePainted" + if(~m_flags & SVG_STYLE_FLAG_POINTER_EVENTS) + { + if(parentStyle) + m_pointerEvents = parentStyle->getPointerEvents(); + else + m_pointerEvents = PE_VISIBLE_PAINTED; + } + + // Spec: default "0" + if(~m_flags & SVG_STYLE_FLAG_STROKE_DASH_OFFSET) + { + m_dashOffset = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); + m_dashOffset->ref(); + + SVGAnimatedLengthImpl *dashOffset = 0; + if(parentStyle) + dashOffset = parentStyle->getDashOffset(); + + if(dashOffset) + *m_dashOffset = *dashOffset; + else + m_dashOffset->baseVal()->setValue(0); + } + + // Spec: default "none" -> 0 == empty dash array + if(~m_flags & SVG_STYLE_FLAG_STROKE_DASH_ARRAY) + { + SVGAnimatedLengthListImpl *dashArray = 0; + if(parentStyle) + dashArray = parentStyle->getDashArray(); + + if(dashArray) + { + if (!m_dashArray) + { + m_dashArray = new SVGAnimatedLengthListImpl(); + m_dashArray->ref(); + } + *m_dashArray = *dashArray; + } + else + m_dashArray = 0; + } + + // Spec: default "1" -> 1 == Not opaque + if(~m_flags & SVG_STYLE_FLAG_FILL_OPACITY) + { + if(parentStyle) + m_fillOpacity = parentStyle->getFillOpacity(); + else + m_fillOpacity = 1; + } + + if(~m_flags & SVG_STYLE_FLAG_STROKE_OPACITY) + { + if(parentStyle) + m_strokeOpacity = parentStyle->getStrokeOpacity(); + else + m_strokeOpacity = 1; + } + + // Fake group opacity by multiplying by our parent's group opacity + if(~m_flags & SVG_STYLE_FLAG_OPACITY) + { + if(parentStyle) + m_opacity = parentStyle->getOpacity(); + else + m_opacity = 1; + } + else + if(parentStyle) + m_opacity *= parentStyle->getOpacity(); + + if(~m_flags & SVG_STYLE_FLAG_CLIP_PATH) + m_clipPath = ""; + + if(~m_flags & SVG_STYLE_FLAG_MASK) + m_mask = ""; + + // Spec: default "nonzero" + if(~m_flags & SVG_STYLE_FLAG_FILL_RULE) + { + if(parentStyle) + m_fillRule = parentStyle->getFillRule(); + else + m_fillRule = RULE_NONZERO; + } + + if(~m_flags & SVG_STYLE_FLAG_CLIP_RULE) + { + if(parentStyle) + m_clipRule = parentStyle->getClipRule(); + else + m_clipRule = RULE_NONZERO; + } + + // Spec: default "hidden" + if(~m_flags & SVG_STYLE_FLAG_OVERFLOW) + { + if(parentStyle) + m_overflow = parentStyle->getOverflow(); + else + m_overflow = false; + } + + // We are not really, spec compatible here, we just + // define a bool, to indicate wheter an element should + // be rendered or not. + if(~m_flags & SVG_STYLE_FLAG_DISPLAY) + m_display = true; + + if(~m_flags & SVG_STYLE_FLAG_VISIBILITY) + { + if(parentStyle) + m_visible = parentStyle->getVisible(); + else + m_visible = true; + } + + // Spec: default "medium" + if(~m_flags & SVG_STYLE_FLAG_FONT_SIZE) + { + if(parentStyle) + m_fontSize = parentStyle->getFontSize(); + else + m_fontSize = fontSizeForText("medium"); + } + + // Spec: default "depends on user agent" -> "Arial" for SVG + if(~m_flags & SVG_STYLE_FLAG_FONT_FAMILY) + { + if(!m_fontFamily) + { + m_fontFamily = new SVGStringListImpl(); + m_fontFamily->ref(); + } + + SVGStringListImpl *fontFamily = 0; + if(parentStyle) + fontFamily = parentStyle->getFontFamily(); + + if(fontFamily) + *m_fontFamily = *fontFamily; + else + { + SharedString *string = new SharedString("Arial"); + string->ref(); + + m_fontFamily->appendItem(string); + } + } + + // Spec: default "normal" + if(~m_flags & SVG_STYLE_FLAG_FONT_STYLE) + { + if(parentStyle) + m_fontStyle = parentStyle->getFontStyle(); + else + m_fontStyle = FSNORMAL; + } + + // Spec: default "normal" + if(~m_flags & SVG_STYLE_FLAG_FONT_WEIGHT) + { + if(parentStyle) + m_fontWeight = parentStyle->getFontWeight(); + else + m_fontWeight = "normal"; + } + + // Spec: default "start" + if(~m_flags & SVG_STYLE_FLAG_TEXT_ANCHOR) + { + if(parentStyle) + m_textAnchor = parentStyle->getTextAnchor(); + else + m_textAnchor = TASTART; + } + + // Spec: default "LTR" + if(~m_flags & SVG_STYLE_FLAG_TEXT_DIRECTION) + { + if(parentStyle) + m_textDirection = parentStyle->getTextDirection(); + else + m_textDirection = LTR; + } + + // Spec: default "none" + if(~m_flags & SVG_STYLE_FLAG_TEXT_DECORATION) + { + if(parentStyle) + m_textDecoration = parentStyle->getTextDecoration(); + else + m_textDecoration = TDNONE; + } + + // Spec: default "baseline" + if(~m_flags & SVG_STYLE_FLAG_BASELINE_SHIFT) + { + if(parentStyle) + m_baselineShift = parentStyle->getBaselineShift(); + else + m_baselineShift = "baseline"; + } + + // Spec: default "lr-tb", FIXME + if(~m_flags & SVG_STYLE_FLAG_TEXT_WRITING_MODE) + { + if(parentStyle) + m_textWritingMode = parentStyle->getTextWritingMode(); + else + m_textWritingMode = LR; + } + + // Spec: default "normal" + if(~m_flags & SVG_STYLE_FLAG_TEXT_UNICODE_BIDI) + { + if(parentStyle) + m_textUnicodeBidi = parentStyle->getTextUnicodeBidi(); + else + m_textUnicodeBidi = UBNORMAL; + } + + // Spec: default "auto" + if(~m_flags & SVG_STYLE_FLAG_GLYPH_ORIENTATION_VERTICAL) + { + if(parentStyle) + m_glyphOrientationVertical = parentStyle->getGlyphOrientationVertical(); + else + m_glyphOrientationVertical = "auto"; + } + + // Spec: default "auto" + if(~m_flags & SVG_STYLE_FLAG_GLYPH_ORIENTATION_HORIZONTAL) + { + if(parentStyle) + m_glyphOrientationHorizontal = parentStyle->getGlyphOrientationHorizontal(); + else + m_glyphOrientationHorizontal = "auto"; + } + + // Spec: default "normal" + if(~m_flags & SVG_STYLE_FLAG_LETTER_SPACING) + { + if(parentStyle) + m_letterSpacing = parentStyle->getLetterSpacing(); + else + m_letterSpacing = "normal"; + } + + // Spec: default "normal" + if(~m_flags & SVG_STYLE_FLAG_WORD_SPACING) + { + if(parentStyle) + m_wordSpacing = parentStyle->getWordSpacing(); + else + m_wordSpacing = "normal"; + } + + // Spec: default "black" + if(~m_flags & SVG_STYLE_FLAG_STOP) + { + m_stopColor = new SVGColorImpl(m_object); + m_stopColor->ref(); + + m_stopColor->setRGBColor(DOM::DOMString("black")); + } + + // Spec: default "none" + if(~m_flags & SVG_STYLE_FLAG_MARKER_START) + { + if(parentStyle) + m_startMarker = parentStyle->getStartMarker(); + else + m_startMarker = TQString(); + } + + // Spec: default "none" + if(~m_flags & SVG_STYLE_FLAG_MARKER_MID) + { + if(parentStyle) + m_midMarker = parentStyle->getMidMarker(); + else + m_midMarker = TQString(); + } + + // Spec: default "none" + if(~m_flags & SVG_STYLE_FLAG_MARKER_END) + { + if(parentStyle) + m_endMarker = parentStyle->getEndMarker(); + else + m_endMarker = TQString(); + } +} + +bool SVGStylableImpl::isStroked() const +{ + if(!m_strokeColor) + return false; + + return m_strokeColor->paintType() != SVG_PAINTTYPE_UNKNOWN && + m_strokeColor->paintType() != SVG_PAINTTYPE_NONE && + m_strokeColor->paintType() != SVG_PAINTTYPE_URI_NONE; +} + +bool SVGStylableImpl::isFilled() const +{ + if(!m_fillColor) + return false; + + return m_fillColor->paintType() != SVG_PAINTTYPE_UNKNOWN && + m_fillColor->paintType() != SVG_PAINTTYPE_NONE && + m_fillColor->paintType() != SVG_PAINTTYPE_URI_NONE; +} + +TQString SVGStylableImpl::extractUrlId(const TQString &url) +{ + TQString id; + + if(url.startsWith("url(#")) + { + int idstart = url.find("#") + 1; + id = url.mid(idstart, url.length() - idstart - 1); + } + else + id = url; + + return id; +} + +void SVGStylableImpl::setMarkers(const TQString &marker) +{ + setStartMarker(marker); + setMidMarker(marker); + setEndMarker(marker); +} + +void SVGStylableImpl::setStartMarker(const TQString &startMarker) +{ + if(startMarker.startsWith("url(#")) + { + int idstart = startMarker.find("#") + 1; + m_startMarker = startMarker.mid(idstart, startMarker.length() - idstart - 1); + } + else if(startMarker == "none") + m_startMarker = TQString(); +} + +void SVGStylableImpl::setMidMarker(const TQString &midMarker) +{ + if(midMarker.startsWith("url(#")) + { + int idstart = midMarker.find("#") + 1; + m_midMarker = midMarker.mid(idstart, midMarker.length() - idstart - 1); + } + else if(midMarker == "none") + m_midMarker = TQString(); +} + +void SVGStylableImpl::setEndMarker(const TQString &endMarker) +{ + if(endMarker.startsWith("url(#")) + { + int idstart = endMarker.find("#") + 1; + m_endMarker = endMarker.mid(idstart, endMarker.length() - idstart - 1); + } + else if(endMarker == "none") + m_endMarker = TQString(); +} + +bool SVGStylableImpl::hasMarkers() const +{ + return !m_startMarker.isEmpty() || !m_midMarker.isEmpty() || !m_endMarker.isEmpty(); +} + +void SVGStylableImpl::setPaint(const TQString ¶m, SVGPaintImpl *svgPaint) +{ + if(param.stripWhiteSpace() == "none") + svgPaint->setPaint(SVG_PAINTTYPE_NONE, DOM::DOMString(""), DOM::DOMString("")); + else if(SVGURIReferenceImpl::isUrl(param)) + svgPaint->setUri(SVGURIReferenceImpl::getTarget(param)); + else + setColor(param, svgPaint); +} + +void SVGStylableImpl::setColor(const TQString ¶m, SVGColorImpl *svgColor) +{ + if(param.stripWhiteSpace().startsWith("#")) + { + if(param.contains("icc-color")) + { + TQString first = param.left(7); + TQString last = param.right(param.length() - 8); + + svgColor->setRGBColorICCColor(first, last); + } + else + { + TQColor color; + color.setNamedColor(param.stripWhiteSpace()); + svgColor->setRGBColor(color); + } + } + else if(param.stripWhiteSpace().startsWith("rgb(")) + { + TQString parse = param.stripWhiteSpace(); + TQStringList colors = TQStringList::split(',', parse); + TQString r = colors[0].right((colors[0].length() - 4)); + TQString g = colors[1]; + TQString b = colors[2].left((colors[2].length() - 1)); + + if(r.contains("%")) + { + r = r.left(r.length() - 1); + r = TQString::number(int((double(255 * r.toDouble()) / 100.0))); + } + + if(g.contains("%")) + { + g = g.left(g.length() - 1); + g = TQString::number(int((double(255 * g.toDouble()) / 100.0))); + } + + if(b.contains("%")) + { + b = b.left(b.length() - 1); + b = TQString::number(int((double(255 * b.toDouble()) / 100.0))); + } + + svgColor->setRGBColor(int(r.toFloat()), int(g.toFloat()), int(b.toFloat())); + } + else + { + if(param.stripWhiteSpace().lower() == "currentcolor") + svgColor->setColor(SVG_COLORTYPE_CURRENTCOLOR, DOM::DOMString(""), DOM::DOMString("")); + else + svgColor->setRGBColor(DOM::DOMString(param.stripWhiteSpace().lower())); + } +} + +TQRect SVGStylableImpl::clip() +{ + return TQRect(); +} + +void SVGStylableImpl::setClip(const TQString &) +{ +} + +float SVGStylableImpl::fontSizeForText(const TQString &value) +{ + float ret = -1; + + // Spec: "On a computer screen a scaling factor of 1.2 is suggested between adjacent indexes" + const float factor = 1.2; + + // Spec: "If the 'medium' font is 12pt, the 'large' font could be 14.4pt." + const float mediumFont = 12.0; + + if(value == "xx-small") + ret = mediumFont - (3.0 * factor); + else if(value == "x-small") + ret = mediumFont - (2.0 * factor); + else if(value == "small") + ret = mediumFont - factor; + else if(value == "medium") + ret = mediumFont; + else if(value == "large") + ret = mediumFont + factor; + else if(value == "x-large") + ret = mediumFont + (2.0 * factor); + else if(value == "xx-large") + ret = mediumFont + (3.0 * factor); + + return ret; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGStylableImpl::s_hashTable 47 + className SVGStylableImpl::ClassName DontDelete|ReadOnly + style SVGStylableImpl::Style DontDelete|ReadOnly + stroke-width SVGStylableImpl::StrokeWidth DontDelete|ReadOnly + stroke-miterlimit SVGStylableImpl::StrokeMiterlimit DontDelete|ReadOnly + stroke-linecap SVGStylableImpl::StrokeLineCap DontDelete|ReadOnly + stroke-linejoin SVGStylableImpl::StrokeLineJoin DontDelete|ReadOnly + stroke SVGStylableImpl::Stroke DontDelete|ReadOnly + fill SVGStylableImpl::Fill DontDelete|ReadOnly + color SVGStylableImpl::Color DontDelete|ReadOnly + stop-color SVGStylableImpl::StopColor DontDelete|ReadOnly + font-size SVGStylableImpl::FontSize DontDelete|ReadOnly + font-family SVGStylableImpl::FontFamily DontDelete|ReadOnly + font-weight SVGStylableImpl::FontWeight DontDelete|ReadOnly + font-style SVGStylableImpl::FontStyle DontDelete|ReadOnly + text-decoration SVGStylableImpl::TextDecoration DontDelete|ReadOnly + text-anchor SVGStylableImpl::TextAnchor DontDelete|ReadOnly + direction SVGStylableImpl::Direction DontDelete|ReadOnly + writing-mode SVGStylableImpl::WritingMode DontDelete|ReadOnly + unicode-bidi SVGStylableImpl::UnicodeBidi DontDelete|ReadOnly + opacity SVGStylableImpl::Opacity DontDelete|ReadOnly + fill-opacity SVGStylableImpl::FillOpacity DontDelete|ReadOnly + stroke-opacity SVGStylableImpl::StrokeOpacity DontDelete|ReadOnly + clip-path SVGStylableImpl::ClipPath DontDelete|ReadOnly + marker-start SVGStylableImpl::MarkerStart DontDelete|ReadOnly + marker-mid SVGStylableImpl::MarkerMid DontDelete|ReadOnly + marker-end SVGStylableImpl::MarkerEnd DontDelete|ReadOnly + marker SVGStylableImpl::Marker DontDelete|ReadOnly + cursor SVGStylableImpl::Cursor DontDelete|ReadOnly + display SVGStylableImpl::Display DontDelete|ReadOnly + overflow SVGStylableImpl::Overflow DontDelete|ReadOnly + clip SVGStylableImpl::Clip DontDelete|ReadOnly + visibility SVGStylableImpl::Visibility DontDelete|ReadOnly + fill-rule SVGStylableImpl::FillRule DontDelete|ReadOnly + clip-rule SVGStylableImpl::ClipRule DontDelete|ReadOnly + stroke-dashoffset SVGStylableImpl::StrokeDashOffset DontDelete|ReadOnly + stroke-dasharray SVGStylableImpl::StrokeDashArray DontDelete|ReadOnly + color-profile SVGStylableImpl::ColorProfile DontDelete|ReadOnly + baseline-shift SVGStylableImpl::BaselineShift DontDelete|ReadOnly + letter-spacing SVGStylableImpl::LetterSpacing DontDelete|ReadOnly + word-spacing SVGStylableImpl::WordSpacing DontDelete|ReadOnly + pointer-events SVGStylableImpl::PointerEvents DontDelete|ReadOnly + glyph-orientation-vertical SVGStylableImpl::GlyphOrientationVertical DontDelete|ReadOnly + glyph-orientation-horizontal SVGStylableImpl::GlyphOrientationHorizontal DontDelete|ReadOnly + color-interpolation SVGStylableImpl::ColorInterpolation DontDelete|ReadOnly + mask SVGStylableImpl::Mask DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGStylableImplProto::s_hashTable 2 + getStyle SVGStylableImpl::GetStyle DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGStylable", SVGStylableImplProto, SVGStylableImplProtoFunc) + +Value SVGStylableImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + //case ClassName: + // return String(className().string()); + case Style: + return String(m_object ? m_object->DOM::Element::getAttribute("style") : ""); + case Visibility: + return String(m_visible ? "visible" : "hidden"); + case Display: + return String(m_display ? "inline" : "none"); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGStylableImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + TQString param = value.toString(exec).qstring(); + + if (param.isEmpty()) + return; + + bool redraw = false; + bool inherit = (param == "inherit"); + int update = -1; + + switch(token) + { + case Style: + { + if(!m_object) + return; + + TQStringList substyles = TQStringList::split(';', param); + for(TQStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it) + { + TQStringList substyle = TQStringList::split(':', (*it)); + m_object->setAttributeInternal(substyle[0].stripWhiteSpace(), substyle[1].stripWhiteSpace()); + } + break; + } + case StrokeWidth: + if(m_flags & SVG_STYLE_FLAG_STROKE_WIDTH) + { + redraw = true; + update = UPDATE_LINEWIDTH; + } + if(inherit) + m_flags &= ~SVG_STYLE_FLAG_STROKE_WIDTH; + else + { + m_flags |= SVG_STYLE_FLAG_STROKE_WIDTH; + + if(!m_strokeWidth) + { + m_strokeWidth = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); + m_strokeWidth->ref(); + } + + m_strokeWidth->baseVal()->setValueAsString(param); + } + break; + case StrokeMiterlimit: + m_flags |= SVG_STYLE_FLAG_STROKE_MITER_LIMIT; + if(!inherit) + m_strokeMiterlimit = param.toUInt(); + break; + case StrokeLineCap: + m_flags |= SVG_STYLE_FLAG_STROKE_LINE_CAP; + if(param == "butt") + m_capStyle = PATH_STROKE_CAP_BUTT; + else if(param == "round") + m_capStyle = PATH_STROKE_CAP_ROUND; + else if(param == "square") + m_capStyle = PATH_STROKE_CAP_SQUARE; + break; + case StrokeLineJoin: + m_flags |= SVG_STYLE_FLAG_STROKE_LINE_JOIN; + if(param == "miter") + m_joinStyle = PATH_STROKE_JOIN_MITER; + else if(param == "round") + m_joinStyle = PATH_STROKE_JOIN_ROUND; + else if(param == "bevel") + m_joinStyle = PATH_STROKE_JOIN_BEVEL; + break; + case Stroke: + if(m_flags & SVG_STYLE_FLAG_STROKE) + redraw = true; + if(inherit) + m_flags &= ~SVG_STYLE_FLAG_STROKE; + else + { + m_flags |= SVG_STYLE_FLAG_STROKE; + + if(!m_strokeColor) + { + m_strokeColor = new SVGPaintImpl(m_object); + m_strokeColor->ref(); + } + + setPaint(param, m_strokeColor); + } + break; + case Fill: + if(m_flags & SVG_STYLE_FLAG_FILL) + { + redraw = true; + update = UPDATE_STYLE; + } + if(inherit) + m_flags &= ~SVG_STYLE_FLAG_FILL; + else + { + m_flags |= SVG_STYLE_FLAG_FILL; + + if(!m_fillColor) + { + m_fillColor = new SVGPaintImpl(m_object); + m_fillColor->ref(); + } + + setPaint(param, m_fillColor); + } + break; + case Color: + if(m_flags & SVG_STYLE_FLAG_COLOR) + redraw = true; + if(inherit) + m_flags &= ~SVG_STYLE_FLAG_COLOR; + else + { + m_flags |= SVG_STYLE_FLAG_COLOR; + + if(!m_color) + { + m_color = new SVGColorImpl(m_object); + m_color->ref(); + } + setColor(param, m_color); + } + break; + case StopColor: + m_flags |= SVG_STYLE_FLAG_STOP; + + if(!m_stopColor) + { + m_stopColor = new SVGColorImpl(m_object); + m_stopColor->ref(); + } + + if(!inherit) + setColor(param, m_stopColor); + break; + case ColorInterpolation: + if(inherit) + m_flags &= ~SVG_STYLE_FLAG_COLOR_INTERPOLATION; + else + { + m_flags |= SVG_STYLE_FLAG_COLOR_INTERPOLATION; + if(param == "auto" || param == "sRGB") + m_colorInterpolation = CI_SRGB; + else + if(param == "linearRGB") + m_colorInterpolation = CI_LINEARRGB; + } + break; + case FontSize: + { + m_flags |= SVG_STYLE_FLAG_FONT_SIZE; + if(!inherit) + { + double temp = fontSizeForText(param); + if(temp != -1) // Is "absolute-size" + { + m_fontSize = temp; + break; + } + + SVGLengthImpl *length = SVGSVGElementImpl::createSVGLength(); + length->setContext(m_object); + length->setValueAsString(DOM::DOMString(param)); + m_fontSize = length->value(); + length->deref(); + } + break; + } + case FontFamily: + m_flags |= SVG_STYLE_FLAG_FONT_FAMILY; + + // Hacks + // #1 Replace "'" characters by "" + param = param.replace('\'', TQString()); + // #2 Replace "MS-Gothic" by "MS Gothic" + param = param.replace("MS-Gothic", "MS Gothic"); + // #3 Replace "Helvetica" by "Arial" + param = param.replace("Helvetica", "Arial"); + param = param.replace("helvetica", "Arial"); + + if(!m_fontFamily) + { + m_fontFamily = new SVGStringListImpl(); + m_fontFamily->ref(); + } + + if(!inherit) + SVGHelperImpl::parseCommaSeperatedList(m_fontFamily, param); + break; + case FontWeight: + m_flags |= SVG_STYLE_FLAG_FONT_WEIGHT; + if(!inherit) + m_fontWeight = param; + break; + case FontStyle: + m_flags |= SVG_STYLE_FLAG_FONT_STYLE; + if(param == "normal") + m_fontStyle = FSNORMAL; + else if(param == "italic") + m_fontStyle = ITALIC; + else if(param == "oblique") + m_fontStyle = OBLIQUE; + break; + case TextDecoration: + m_flags |= SVG_STYLE_FLAG_TEXT_DECORATION; + if(param == "none") + m_textDecoration = TDNONE; + { + // CSS2 allows multiple decorations + m_textDecoration = TDNONE; + TQStringList decorations = TQStringList::split(' ', param); + for(TQStringList::Iterator it = decorations.begin(); it != decorations.end(); ++it) + { + if(*it == "underline") + m_textDecoration |= UNDERLINE; + else if(*it == "overline") + m_textDecoration |= OVERLINE; + else if(*it == "line-through") + m_textDecoration |= LINE_THROUGH; + } + } + break; + case TextAnchor: + m_flags |= SVG_STYLE_FLAG_TEXT_ANCHOR; + if(param == "start") + m_textAnchor = TASTART; + else if(param == "middle") + m_textAnchor = TAMIDDLE; + else if(param == "end") + m_textAnchor = TAEND; + break; + case Direction: + m_flags |= SVG_STYLE_FLAG_TEXT_DIRECTION; + // Spec: direction is only processed when unicode-bidi + // is set to bidi-override or embedded + if(m_textUnicodeBidi == OVERRIDE || + m_textUnicodeBidi == EMBED || + m_textUnicodeBidi == UBNORMAL) + { + if(param == "rtl") + m_textDirection = RTL; + else if(param == "ltr") + m_textDirection = LTR; + } + break; + case WritingMode: + m_flags |= SVG_STYLE_FLAG_TEXT_WRITING_MODE; + if(param == "lr-tb" || param == "lr") + m_textWritingMode = LR; + else if(param == "rl-tb" || param == "rl") + m_textWritingMode = RL; + else if(param == "tb-lr" || param == "tb") + m_textWritingMode = TB; + break; + case UnicodeBidi: + m_flags |= SVG_STYLE_FLAG_TEXT_UNICODE_BIDI; + if(param == "normal") + m_textUnicodeBidi = UBNORMAL; + else if(param == "embed") + m_textUnicodeBidi = EMBED; + else if(param == "bidi-override") + m_textUnicodeBidi = OVERRIDE; + break; + case GlyphOrientationVertical: + m_flags |= SVG_STYLE_FLAG_GLYPH_ORIENTATION_VERTICAL; + m_glyphOrientationVertical = param; + break; + case GlyphOrientationHorizontal: + m_flags |= SVG_STYLE_FLAG_GLYPH_ORIENTATION_HORIZONTAL; + m_glyphOrientationHorizontal = param; + break; + case Opacity: + m_flags |= SVG_STYLE_FLAG_OPACITY; + + if(!inherit) + { + SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_opacity); + } + break; + case FillOpacity: + m_flags |= SVG_STYLE_FLAG_FILL_OPACITY; + + if(!inherit) + { + SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_fillOpacity); + } + break; + case StrokeOpacity: + m_flags |= SVG_STYLE_FLAG_STROKE_OPACITY; + + if(!inherit) + { + SVGLengthImpl::convertPercentageToFloat(value.toString(exec).qstring(), m_strokeOpacity); + } + break; + case ClipPath: + m_flags |= SVG_STYLE_FLAG_CLIP_PATH; + if(!inherit) + m_clipPath = extractUrlId(param); + break; + case Mask: + m_flags |= SVG_STYLE_FLAG_MASK; + if(!inherit) + m_mask = extractUrlId(param); + break; + case MarkerStart: + m_flags |= SVG_STYLE_FLAG_MARKER_START; + if(!inherit) + setStartMarker(param); + break; + case MarkerMid: + m_flags |= SVG_STYLE_FLAG_MARKER_MID; + if(!inherit) + setMidMarker(param); + break; + case MarkerEnd: + m_flags |= SVG_STYLE_FLAG_MARKER_END; + if(!inherit) + setEndMarker(param); + break; + case Marker: + m_flags |= (SVG_STYLE_FLAG_MARKER_START | SVG_STYLE_FLAG_MARKER_MID | SVG_STYLE_FLAG_MARKER_END); + if(!inherit) + setMarkers(param); + break; + case PointerEvents: + m_flags |= SVG_STYLE_FLAG_POINTER_EVENTS; + if(param == "none") + m_pointerEvents = PE_NONE; + else if(param == "stroke") + m_pointerEvents = PE_STROKE; + else if(param == "fill") + m_pointerEvents = PE_FILL; + else if(param == "painted") + m_pointerEvents = PE_PAINTED; + else if(param == "visibleStroke") + m_pointerEvents = PE_VISIBLE_STROKE; + else if(param == "visibleFill") + m_pointerEvents = PE_VISIBLE_FILL; + else if(param == "visiblePainted") + m_pointerEvents = PE_VISIBLE_PAINTED; + else if(param == "visible") + m_pointerEvents = PE_VISIBLE; + else if(param == "all") + m_pointerEvents = PE_ALL; + break; + case Cursor: + m_flags |= SVG_STYLE_FLAG_CURSOR; + if(param == "auto") + m_cursor = CURSOR_AUTO; + else if(param == "crosshair") + m_cursor = CURSOR_CROSSHAIR; + else if(param == "default") + m_cursor = CURSOR_DEFAULT; + else if(param == "pointer") + m_cursor = CURSOR_POINTER; + else if(param == "move") + m_cursor = CURSOR_MOVE; + else if(param == "e-resize") + m_cursor = CURSOR_E_RESIZE; + else if(param == "ne-resize") + m_cursor = CURSOR_NE_RESIZE; + else if(param == "nw-resize") + m_cursor = CURSOR_NW_RESIZE; + else if(param == "n-resize") + m_cursor = CURSOR_N_RESIZE; + else if(param == "se-resize") + m_cursor = CURSOR_SE_RESIZE; + else if(param == "sw-resize") + m_cursor = CURSOR_SW_RESIZE; + else if(param == "s-resize") + m_cursor = CURSOR_S_RESIZE; + else if(param == "w-resize") + m_cursor = CURSOR_W_RESIZE; + else if(param == "text") + m_cursor = CURSOR_TEXT; + else if(param == "wait") + m_cursor = CURSOR_WAIT; + else if(param == "help") + m_cursor = CURSOR_HELP; + break; + case Display: + m_flags |= SVG_STYLE_FLAG_DISPLAY; + + if(param == "none") + m_display = false; + else if(!inherit) + m_display = true; + break; + case Overflow: + m_flags |= SVG_STYLE_FLAG_OVERFLOW; + if(param == "hidden" || param == "scroll") + m_overflow = false; + else if(!inherit) + m_overflow = true; + break; + case Clip: + m_flags |= SVG_STYLE_FLAG_CLIP_PATH; + if(!inherit) + setClip(param); + break; + case Visibility: + if(m_flags & SVG_STYLE_FLAG_VISIBILITY) + redraw = true; + if(inherit) + m_flags &= ~SVG_STYLE_FLAG_COLOR; + else + { + m_flags |= SVG_STYLE_FLAG_VISIBILITY; + + if(param == "visible") + m_visible = true; + else if(!inherit) + m_visible = false; + + // Just a quick fix for the script-* files (Niko) + // Any better solution?? + update = UPDATE_TRANSFORM; + redraw = true; + } + SVGHelperImpl::applyContainer(this, Visibility, param); + break; + case FillRule: + m_flags |= SVG_STYLE_FLAG_FILL_RULE; + if(!inherit) + m_fillRule = (param == "evenodd" ? RULE_EVENODD : RULE_NONZERO); + break; + case ClipRule: + m_flags |= SVG_STYLE_FLAG_CLIP_RULE; + if(!inherit) + m_clipRule = (param == "evenodd" ? RULE_EVENODD : RULE_NONZERO); + break; + case StrokeDashOffset: + m_flags |= SVG_STYLE_FLAG_STROKE_DASH_OFFSET; + + if(!m_dashOffset) + { + m_dashOffset = new SVGAnimatedLengthImpl(LENGTHMODE_OTHER, m_object); + m_dashOffset->ref(); + } + + if(!inherit) + m_dashOffset->baseVal()->setValueAsString(param); + break; + case StrokeDashArray: + { + m_flags |= SVG_STYLE_FLAG_STROKE_DASH_ARRAY; + + if(!m_dashArray) + { + m_dashArray = new SVGAnimatedLengthListImpl(); + m_dashArray->ref(); + } + else + m_dashArray->baseVal()->clear(); + + if(param != "none" && !inherit) + SVGHelperImpl::parseLengthList(m_dashArray, param); + break; + } + case ColorProfile: + { + m_flags |= SVG_STYLE_FLAG_COLOR_PROFILE; + if(!inherit) + { + if(!m_object) + return; + + SVGColorProfileElementImpl *handle = static_cast(m_object->ownerSVGElement()->getElementById(SVGURIReferenceImpl::getTarget(param))); + if(handle) + SVGImageElementImpl::applyColorProfile(handle, static_cast(this)); + } + break; + } + case BaselineShift: + { + m_flags |= SVG_STYLE_FLAG_BASELINE_SHIFT; + if(!inherit) + m_baselineShift = param; + break; + } + case LetterSpacing: + m_flags |= SVG_STYLE_FLAG_LETTER_SPACING; + case WordSpacing: + { + if(!inherit) + { + if(token == WordSpacing) + { + m_flags |= SVG_STYLE_FLAG_WORD_SPACING; + m_wordSpacing = param; + } + else + m_letterSpacing = param; + } + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } + + if(redraw) + { + SVGShapeImpl *shape = dynamic_cast(m_object); + if(inherit) + processStyle(); + + if(shape && shape->item()) + { + if(update > -1) + shape->item()->update(static_cast(update)); + else if(m_object) + m_object->ownerDoc()->canvas()->invalidate(shape->item(), false); + } + } +} + +Value SVGStylableImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) +{ + KSVG_CHECK_THIS(SVGStylableImpl) + + switch(id) + { + case SVGStylableImpl::GetStyle: + return Undefined(); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} diff --git a/ksvg/impl/SVGStyleElementImpl.cc b/ksvg/impl/SVGStyleElementImpl.cc deleted file mode 100644 index c376cb30..00000000 --- a/ksvg/impl/SVGStyleElementImpl.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGStyleElementImpl.h" - -using namespace KSVG; - -#include "SVGStyleElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGStyleElementImpl::SVGStyleElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ - KSVG_EMPTY_FLAGS -} - -SVGStyleElementImpl::~SVGStyleElementImpl() -{ -} - -void SVGStyleElementImpl::setXmlspace(const DOM::DOMString &xmlspace) -{ - setAttribute("xml:space", xmlspace); -} - -DOM::DOMString SVGStyleElementImpl::xmlspace() const -{ - return getAttribute("xml:space"); -} - -void SVGStyleElementImpl::setType(const DOM::DOMString &type) -{ - setAttribute("type", type); -} - -DOM::DOMString SVGStyleElementImpl::type() const -{ - return getAttribute("type"); -} - -void SVGStyleElementImpl::setMedia(const DOM::DOMString &media) -{ - setAttribute("media", media); -} - -DOM::DOMString SVGStyleElementImpl::media() const -{ - return getAttribute("media"); -} - -void SVGStyleElementImpl::setTitle(const DOM::DOMString &title) -{ - setAttribute("title", title); -} - -DOM::DOMString SVGStyleElementImpl::title() const -{ - return getAttribute("title"); -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGStyleElementImpl::s_hashTable 5 - xmlspace SVGStyleElementImpl::Xmlspace DontDelete - type SVGStyleElementImpl::Type DontDelete - media SVGStyleElementImpl::Media DontDelete - title SVGStyleElementImpl::Title DontDelete -@end -*/ - -Value SVGStyleElementImpl::getValueProperty(ExecState *, int token) const -{ - //KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case Xmlspace: - return String(xmlspace()); - case Type: - return String(type()); - case Media: - return String(media()); - case Title: - return String(title()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGStyleElementImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case Xmlspace: - setXmlspace(value.toString(exec).string()); - break; - case Type: - setType(value.toString(exec).string()); - break; - case Media: - setMedia(value.toString(exec).string()); - break; - case Title: - setTitle(value.toString(exec).string()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - break; - } -} diff --git a/ksvg/impl/SVGStyleElementImpl.cpp b/ksvg/impl/SVGStyleElementImpl.cpp new file mode 100644 index 00000000..c376cb30 --- /dev/null +++ b/ksvg/impl/SVGStyleElementImpl.cpp @@ -0,0 +1,133 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGStyleElementImpl.h" + +using namespace KSVG; + +#include "SVGStyleElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGStyleElementImpl::SVGStyleElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ + KSVG_EMPTY_FLAGS +} + +SVGStyleElementImpl::~SVGStyleElementImpl() +{ +} + +void SVGStyleElementImpl::setXmlspace(const DOM::DOMString &xmlspace) +{ + setAttribute("xml:space", xmlspace); +} + +DOM::DOMString SVGStyleElementImpl::xmlspace() const +{ + return getAttribute("xml:space"); +} + +void SVGStyleElementImpl::setType(const DOM::DOMString &type) +{ + setAttribute("type", type); +} + +DOM::DOMString SVGStyleElementImpl::type() const +{ + return getAttribute("type"); +} + +void SVGStyleElementImpl::setMedia(const DOM::DOMString &media) +{ + setAttribute("media", media); +} + +DOM::DOMString SVGStyleElementImpl::media() const +{ + return getAttribute("media"); +} + +void SVGStyleElementImpl::setTitle(const DOM::DOMString &title) +{ + setAttribute("title", title); +} + +DOM::DOMString SVGStyleElementImpl::title() const +{ + return getAttribute("title"); +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGStyleElementImpl::s_hashTable 5 + xmlspace SVGStyleElementImpl::Xmlspace DontDelete + type SVGStyleElementImpl::Type DontDelete + media SVGStyleElementImpl::Media DontDelete + title SVGStyleElementImpl::Title DontDelete +@end +*/ + +Value SVGStyleElementImpl::getValueProperty(ExecState *, int token) const +{ + //KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case Xmlspace: + return String(xmlspace()); + case Type: + return String(type()); + case Media: + return String(media()); + case Title: + return String(title()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGStyleElementImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case Xmlspace: + setXmlspace(value.toString(exec).string()); + break; + case Type: + setType(value.toString(exec).string()); + break; + case Media: + setMedia(value.toString(exec).string()); + break; + case Title: + setTitle(value.toString(exec).string()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + break; + } +} diff --git a/ksvg/impl/SVGSwitchElementImpl.cc b/ksvg/impl/SVGSwitchElementImpl.cc deleted file mode 100644 index d69483f7..00000000 --- a/ksvg/impl/SVGSwitchElementImpl.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDocumentImpl.h" -#include "SVGSwitchElementImpl.h" -#include "KSVGCanvas.h" - -using namespace KSVG; - -SVGSwitchElementImpl::SVGSwitchElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ -} - -SVGSwitchElementImpl::~SVGSwitchElementImpl() -{ -} - -void SVGSwitchElementImpl::createItem(KSVGCanvas *c) -{ - if(!c) - c = ownerDoc()->canvas(); - - DOM::Node node = firstChild(); - for(; !node.isNull(); node = node.nextSibling()) - { - SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); - SVGShapeImpl *shape = dynamic_cast(element); - SVGTestsImpl *tests = dynamic_cast(element); - SVGStylableImpl *style = dynamic_cast(element); - - bool ok = tests ? tests->ok() : true; - - if(element && shape && ok && style->getVisible() && style->getDisplay() && (shape->directRender() || !directRender())) - { - element->createItem(c); - break; - } - } -} diff --git a/ksvg/impl/SVGSwitchElementImpl.cpp b/ksvg/impl/SVGSwitchElementImpl.cpp new file mode 100644 index 00000000..d69483f7 --- /dev/null +++ b/ksvg/impl/SVGSwitchElementImpl.cpp @@ -0,0 +1,56 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDocumentImpl.h" +#include "SVGSwitchElementImpl.h" +#include "KSVGCanvas.h" + +using namespace KSVG; + +SVGSwitchElementImpl::SVGSwitchElementImpl(DOM::ElementImpl *impl) : SVGContainerImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ +} + +SVGSwitchElementImpl::~SVGSwitchElementImpl() +{ +} + +void SVGSwitchElementImpl::createItem(KSVGCanvas *c) +{ + if(!c) + c = ownerDoc()->canvas(); + + DOM::Node node = firstChild(); + for(; !node.isNull(); node = node.nextSibling()) + { + SVGElementImpl *element = ownerDoc()->getElementFromHandle(node.handle()); + SVGShapeImpl *shape = dynamic_cast(element); + SVGTestsImpl *tests = dynamic_cast(element); + SVGStylableImpl *style = dynamic_cast(element); + + bool ok = tests ? tests->ok() : true; + + if(element && shape && ok && style->getVisible() && style->getDisplay() && (shape->directRender() || !directRender())) + { + element->createItem(c); + break; + } + } +} diff --git a/ksvg/impl/SVGSymbolElementImpl.cc b/ksvg/impl/SVGSymbolElementImpl.cc deleted file mode 100644 index bbbef0b8..00000000 --- a/ksvg/impl/SVGSymbolElementImpl.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGRectImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGAnimatedRectImpl.h" -#include "SVGSymbolElementImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGPreserveAspectRatioImpl.h" -#include "SVGAnimatedPreserveAspectRatioImpl.h" -#include "KSVGCanvas.h" - -using namespace KSVG; - -#include "SVGSymbolElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" - -SVGSymbolElementImpl::SVGSymbolElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFitToViewBoxImpl() -{ - KSVG_EMPTY_FLAGS - - m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); - m_height->ref(); -} - -SVGSymbolElementImpl::~SVGSymbolElementImpl() -{ - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); -} -/* -@namespace KSVG -@begin SVGSymbolElementImpl::s_hashTable 3 - width SVGSymbolElementImpl::Width DontDelete|ReadOnly - height SVGSymbolElementImpl::Height DontDelete|ReadOnly -@end -*/ - -Value SVGSymbolElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case Width: - if(!attributeMode) - return m_width->cache(exec); - else - return Number(m_width->baseVal()->value()); - case Height: - if(!attributeMode) - return m_height->cache(exec); - else - return Number(m_height->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGSymbolElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Width: - m_width->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - case Height: - m_height->baseVal()->setValueAsString(value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGSymbolElementImpl.cpp b/ksvg/impl/SVGSymbolElementImpl.cpp new file mode 100644 index 00000000..bbbef0b8 --- /dev/null +++ b/ksvg/impl/SVGSymbolElementImpl.cpp @@ -0,0 +1,104 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGRectImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGAnimatedRectImpl.h" +#include "SVGSymbolElementImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGPreserveAspectRatioImpl.h" +#include "SVGAnimatedPreserveAspectRatioImpl.h" +#include "KSVGCanvas.h" + +using namespace KSVG; + +#include "SVGSymbolElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" + +SVGSymbolElementImpl::SVGSymbolElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGFitToViewBoxImpl() +{ + KSVG_EMPTY_FLAGS + + m_width = new SVGAnimatedLengthImpl(LENGTHMODE_WIDTH, this); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(LENGTHMODE_HEIGHT, this); + m_height->ref(); +} + +SVGSymbolElementImpl::~SVGSymbolElementImpl() +{ + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); +} +/* +@namespace KSVG +@begin SVGSymbolElementImpl::s_hashTable 3 + width SVGSymbolElementImpl::Width DontDelete|ReadOnly + height SVGSymbolElementImpl::Height DontDelete|ReadOnly +@end +*/ + +Value SVGSymbolElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case Width: + if(!attributeMode) + return m_width->cache(exec); + else + return Number(m_width->baseVal()->value()); + case Height: + if(!attributeMode) + return m_height->cache(exec); + else + return Number(m_height->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGSymbolElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Width: + m_width->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + case Height: + m_height->baseVal()->setValueAsString(value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGTRefElementImpl.cc b/ksvg/impl/SVGTRefElementImpl.cc deleted file mode 100644 index 1f352f9b..00000000 --- a/ksvg/impl/SVGTRefElementImpl.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGTRefElementImpl.h" -#include "SVGTextElementImpl.h" -#include "SVGAnimatedStringImpl.h" - -#include "KSVGLoader.h" - -using namespace KSVG; - -SVGTRefElementImpl::SVGTRefElementImpl(DOM::ElementImpl *impl) : SVGTSpanElementImpl(impl), SVGURIReferenceImpl() -{ -} - -SVGTRefElementImpl::~SVGTRefElementImpl() -{ -} - -void SVGTRefElementImpl::setAttributes() -{ - SVGTSpanElementImpl::setAttributes(); - - DOM::DOMString _href = href()->baseVal(); - - if(!_href.isNull()) - href()->setBaseVal(DOM::DOMString(SVGURIReferenceImpl::getTarget(_href.string()))); - - // get the text of the referenced element - TQString text; - - TQString url = _href.string().stripWhiteSpace(), filename, id; - if(!SVGURIReferenceImpl::parseURIReference(url, filename, id)) - return; - - if(!filename.isEmpty()) // a reference into another svg - text = KSVGLoader::getCharacterData(KURL(ownerDoc()->baseUrl().path(), filename), id); - else - { - // a reference to an element in this svg - SVGElementImpl *target = ownerSVGElement()->getElementById(id); - SVGTextElementImpl *textTarget = dynamic_cast(target); - - if(textTarget) - text = textTarget->text(); - } - - text = handleText(text); - - if(!text.isEmpty()) - { - DOM::Text impl = static_cast(ownerDoc())->createTextNode(text); - appendChild(impl); - } -} diff --git a/ksvg/impl/SVGTRefElementImpl.cpp b/ksvg/impl/SVGTRefElementImpl.cpp new file mode 100644 index 00000000..1f352f9b --- /dev/null +++ b/ksvg/impl/SVGTRefElementImpl.cpp @@ -0,0 +1,74 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGTRefElementImpl.h" +#include "SVGTextElementImpl.h" +#include "SVGAnimatedStringImpl.h" + +#include "KSVGLoader.h" + +using namespace KSVG; + +SVGTRefElementImpl::SVGTRefElementImpl(DOM::ElementImpl *impl) : SVGTSpanElementImpl(impl), SVGURIReferenceImpl() +{ +} + +SVGTRefElementImpl::~SVGTRefElementImpl() +{ +} + +void SVGTRefElementImpl::setAttributes() +{ + SVGTSpanElementImpl::setAttributes(); + + DOM::DOMString _href = href()->baseVal(); + + if(!_href.isNull()) + href()->setBaseVal(DOM::DOMString(SVGURIReferenceImpl::getTarget(_href.string()))); + + // get the text of the referenced element + TQString text; + + TQString url = _href.string().stripWhiteSpace(), filename, id; + if(!SVGURIReferenceImpl::parseURIReference(url, filename, id)) + return; + + if(!filename.isEmpty()) // a reference into another svg + text = KSVGLoader::getCharacterData(KURL(ownerDoc()->baseUrl().path(), filename), id); + else + { + // a reference to an element in this svg + SVGElementImpl *target = ownerSVGElement()->getElementById(id); + SVGTextElementImpl *textTarget = dynamic_cast(target); + + if(textTarget) + text = textTarget->text(); + } + + text = handleText(text); + + if(!text.isEmpty()) + { + DOM::Text impl = static_cast(ownerDoc())->createTextNode(text); + appendChild(impl); + } +} diff --git a/ksvg/impl/SVGTSpanElementImpl.cc b/ksvg/impl/SVGTSpanElementImpl.cc deleted file mode 100644 index 2cc35d05..00000000 --- a/ksvg/impl/SVGTSpanElementImpl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGDocumentImpl.h" -#include "SVGTextElementImpl.h" -#include "SVGTSpanElementImpl.h" -#include "SVGAnimatedLengthListImpl.h" - -#include "KSVGCanvas.h" -#include "KSVGTextChunk.h" - -using namespace KSVG; -using namespace KJS; - -SVGTSpanElementImpl::SVGTSpanElementImpl(DOM::ElementImpl *impl) : SVGTextPositioningElementImpl(impl) -{ -} - -SVGTSpanElementImpl::~SVGTSpanElementImpl() -{ -} - -long SVGTSpanElementImpl::getNumberOfChars() -{ - return text().length(); -} - -TQString SVGTSpanElementImpl::text() -{ - // Otherwhise some js scripts which require a child, don't work (Niko) - if(!hasChildNodes()) - { - DOM::Text impl = static_cast(ownerDoc())->createTextNode(DOM::DOMString("")); - appendChild(impl); - } - - return textDirectionAwareText(); -} - -void SVGTSpanElementImpl::setAttributes() -{ - SVGTextPositioningElementImpl::setAttributes(); -} diff --git a/ksvg/impl/SVGTSpanElementImpl.cpp b/ksvg/impl/SVGTSpanElementImpl.cpp new file mode 100644 index 00000000..2cc35d05 --- /dev/null +++ b/ksvg/impl/SVGTSpanElementImpl.cpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGDocumentImpl.h" +#include "SVGTextElementImpl.h" +#include "SVGTSpanElementImpl.h" +#include "SVGAnimatedLengthListImpl.h" + +#include "KSVGCanvas.h" +#include "KSVGTextChunk.h" + +using namespace KSVG; +using namespace KJS; + +SVGTSpanElementImpl::SVGTSpanElementImpl(DOM::ElementImpl *impl) : SVGTextPositioningElementImpl(impl) +{ +} + +SVGTSpanElementImpl::~SVGTSpanElementImpl() +{ +} + +long SVGTSpanElementImpl::getNumberOfChars() +{ + return text().length(); +} + +TQString SVGTSpanElementImpl::text() +{ + // Otherwhise some js scripts which require a child, don't work (Niko) + if(!hasChildNodes()) + { + DOM::Text impl = static_cast(ownerDoc())->createTextNode(DOM::DOMString("")); + appendChild(impl); + } + + return textDirectionAwareText(); +} + +void SVGTSpanElementImpl::setAttributes() +{ + SVGTextPositioningElementImpl::setAttributes(); +} diff --git a/ksvg/impl/SVGTestsImpl.cc b/ksvg/impl/SVGTestsImpl.cc deleted file mode 100644 index 15f8bcc6..00000000 --- a/ksvg/impl/SVGTestsImpl.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "SVGTestsImpl.h" -#include "SVGStringListImpl.h" - -using namespace KSVG; - -#include "SVGTestsImpl.lut.h" - -SVGTestsImpl::SVGTestsImpl() -{ - KSVG_EMPTY_FLAGS - - m_requiredFeatures = new SVGStringListImpl(); - m_requiredFeatures->ref(); - - m_requiredExtensions = new SVGStringListImpl(); - m_requiredExtensions->ref(); - - m_systemLanguage = new SVGStringListImpl(); - m_systemLanguage->ref(); -} - -SVGTestsImpl::~SVGTestsImpl() -{ - if(m_requiredFeatures) - m_requiredFeatures->deref(); - if(m_requiredExtensions) - m_requiredExtensions->deref(); - if(m_systemLanguage) - m_systemLanguage->deref(); -} - -void SVGTestsImpl::parseRequiredFeatures(const TQString &/*value*/) -{ - // FIXME -} - -void SVGTestsImpl::parseRequiredExtensions(const TQString &value) -{ - m_requiredExtensions->appendItem(new SharedString(value)); -} - -void SVGTestsImpl::parseSystemLanguage(const TQString &value) -{ - m_systemLanguage->appendItem(new SharedString(value)); -} - -SVGStringListImpl *SVGTestsImpl::requiredFeatures() const -{ - return m_requiredFeatures; -} - -SVGStringListImpl *SVGTestsImpl::requiredExtensions() const -{ - return m_requiredExtensions; -} - -SVGStringListImpl *SVGTestsImpl::systemLanguage() const -{ - return m_systemLanguage; -} - -bool SVGTestsImpl::ok() -{ - for(unsigned int i = 0;i < m_requiredExtensions->numberOfItems();i++) - { - // FIXME - return false; - } - for(unsigned int i = 0;i < m_systemLanguage->numberOfItems();i++) - { - TQString value = m_systemLanguage->getItem(i)->string(); - if(value.isEmpty() || value != (TDEGlobal::locale()->language()).left(2)) - return false; - } - return true; -} - -bool SVGTestsImpl::hasExtension(const DOM::DOMString &/*extension*/) -{ - return false; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGTestsImpl::s_hashTable 5 - requiredFeatures SVGTestsImpl::RequiredFeatures DontDelete|ReadOnly - requiredExtensions SVGTestsImpl::RequiredExtensions DontDelete|ReadOnly - systemLanguage SVGTestsImpl::SystemLanguage DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGTestsImplProto::s_hashTable 2 - hasExtension SVGTestsImpl::HasExtension DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGTests", SVGTestsImplProto, SVGTestsImplProtoFunc) - -Value SVGTestsImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case RequiredFeatures: - return m_requiredFeatures->cache(exec); - case RequiredExtensions: - return m_requiredExtensions->cache(exec); - case SystemLanguage: - return m_systemLanguage->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGTestsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case RequiredFeatures: - parseRequiredFeatures(value.toString(exec).qstring()); - break; - case RequiredExtensions: - parseRequiredExtensions(value.toString(exec).qstring()); - break; - case SystemLanguage: - parseSystemLanguage(value.toString(exec).qstring()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGTestsImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGTestsImpl) - - switch(id) - { - case SVGTestsImpl::HasExtension: - return Boolean(obj->hasExtension(args[0].toString(exec).string())); - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} diff --git a/ksvg/impl/SVGTestsImpl.cpp b/ksvg/impl/SVGTestsImpl.cpp new file mode 100644 index 00000000..15f8bcc6 --- /dev/null +++ b/ksvg/impl/SVGTestsImpl.cpp @@ -0,0 +1,176 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "SVGTestsImpl.h" +#include "SVGStringListImpl.h" + +using namespace KSVG; + +#include "SVGTestsImpl.lut.h" + +SVGTestsImpl::SVGTestsImpl() +{ + KSVG_EMPTY_FLAGS + + m_requiredFeatures = new SVGStringListImpl(); + m_requiredFeatures->ref(); + + m_requiredExtensions = new SVGStringListImpl(); + m_requiredExtensions->ref(); + + m_systemLanguage = new SVGStringListImpl(); + m_systemLanguage->ref(); +} + +SVGTestsImpl::~SVGTestsImpl() +{ + if(m_requiredFeatures) + m_requiredFeatures->deref(); + if(m_requiredExtensions) + m_requiredExtensions->deref(); + if(m_systemLanguage) + m_systemLanguage->deref(); +} + +void SVGTestsImpl::parseRequiredFeatures(const TQString &/*value*/) +{ + // FIXME +} + +void SVGTestsImpl::parseRequiredExtensions(const TQString &value) +{ + m_requiredExtensions->appendItem(new SharedString(value)); +} + +void SVGTestsImpl::parseSystemLanguage(const TQString &value) +{ + m_systemLanguage->appendItem(new SharedString(value)); +} + +SVGStringListImpl *SVGTestsImpl::requiredFeatures() const +{ + return m_requiredFeatures; +} + +SVGStringListImpl *SVGTestsImpl::requiredExtensions() const +{ + return m_requiredExtensions; +} + +SVGStringListImpl *SVGTestsImpl::systemLanguage() const +{ + return m_systemLanguage; +} + +bool SVGTestsImpl::ok() +{ + for(unsigned int i = 0;i < m_requiredExtensions->numberOfItems();i++) + { + // FIXME + return false; + } + for(unsigned int i = 0;i < m_systemLanguage->numberOfItems();i++) + { + TQString value = m_systemLanguage->getItem(i)->string(); + if(value.isEmpty() || value != (TDEGlobal::locale()->language()).left(2)) + return false; + } + return true; +} + +bool SVGTestsImpl::hasExtension(const DOM::DOMString &/*extension*/) +{ + return false; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGTestsImpl::s_hashTable 5 + requiredFeatures SVGTestsImpl::RequiredFeatures DontDelete|ReadOnly + requiredExtensions SVGTestsImpl::RequiredExtensions DontDelete|ReadOnly + systemLanguage SVGTestsImpl::SystemLanguage DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGTestsImplProto::s_hashTable 2 + hasExtension SVGTestsImpl::HasExtension DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGTests", SVGTestsImplProto, SVGTestsImplProtoFunc) + +Value SVGTestsImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case RequiredFeatures: + return m_requiredFeatures->cache(exec); + case RequiredExtensions: + return m_requiredExtensions->cache(exec); + case SystemLanguage: + return m_systemLanguage->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGTestsImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case RequiredFeatures: + parseRequiredFeatures(value.toString(exec).qstring()); + break; + case RequiredExtensions: + parseRequiredExtensions(value.toString(exec).qstring()); + break; + case SystemLanguage: + parseSystemLanguage(value.toString(exec).qstring()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGTestsImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGTestsImpl) + + switch(id) + { + case SVGTestsImpl::HasExtension: + return Boolean(obj->hasExtension(args[0].toString(exec).string())); + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} diff --git a/ksvg/impl/SVGTextContentElementImpl.cc b/ksvg/impl/SVGTextContentElementImpl.cc deleted file mode 100644 index a772672b..00000000 --- a/ksvg/impl/SVGTextContentElementImpl.cc +++ /dev/null @@ -1,283 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "Glyph.h" - -#include "SVGStringListImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGTextContentElementImpl.h" -#include "SVGTextElementImpl.h" -#include "SVGAnimatedEnumerationImpl.h" -#include "SVGDocumentImpl.h" - -using namespace KSVG; - -#include "SVGTextContentElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_cacheimpl.h" - -SVGTextContentElementImpl::SVGTextContentElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this) -{ - KSVG_EMPTY_FLAGS - - m_lengthAdjust = new SVGAnimatedEnumerationImpl(); - m_lengthAdjust->ref(); - - // Spec: default value 'spacing' - m_lengthAdjust->setBaseVal(LENGTHADJUST_SPACING); - - m_textLength = new SVGAnimatedLengthImpl(); - m_textLength->baseVal()->setValueAsString("-1"); - m_textLength->ref(); -} - -SVGTextContentElementImpl::~SVGTextContentElementImpl() -{ - if(m_lengthAdjust) - m_lengthAdjust->deref(); - if(m_textLength) - m_textLength->deref(); -} - -TQString SVGTextContentElementImpl::textDirectionAwareText() -{ - TQString text; - - if(hasChildNodes()) - { - bool ltr = getTextDirection() == LTR; - DOM::Node node = ltr ? firstChild() : lastChild(); - - for(; !node.isNull(); node = ltr ? node.nextSibling() : node.previousSibling()) - { - if(node.nodeType() == TEXT_NODE) - { - DOM::Text textNode = node; - TQString temp = textNode.data().string(); - - if(!ltr) - { - TQString convert = temp; - - for(int i = temp.length(); i > 0; i--) - convert[temp.length() - i] = temp[i - 1]; - - text += convert; - } - else - text += temp; - } - else - return text; - } - } - - return text; -} - -T2P::GlyphLayoutParams *SVGTextContentElementImpl::layoutParams() const -{ - SVGStylableImpl *style = const_cast(this); - - T2P::GlyphLayoutParams *params = new T2P::GlyphLayoutParams(); - params->setTb(style->getTextWritingMode() == TB); - params->setUseBidi(style->getTextUnicodeBidi() == UBNORMAL); - if(!dynamic_cast(m_object)) // not allowed for - params->setBaselineShift(style->getBaselineShift().latin1()); - - bool worked = true; - int deg = style->getGlyphOrientationVertical().toInt(&worked); - if(!worked) - params->setGlyphOrientationVertical(-90); - else - params->setGlyphOrientationVertical(deg); - - worked = true; - deg = style->getGlyphOrientationHorizontal().toInt(&worked); - if(!worked) - params->setGlyphOrientationHorizontal(-90); - else - params->setGlyphOrientationHorizontal(deg); - - SVGLengthImpl *length = new SVGLengthImpl(LENGTHMODE_OTHER, const_cast(this)); - length->ref(); - - if(style->getLetterSpacing() != "normal" && style->getLetterSpacing() != "inherit") - length->setValueAsString(DOM::DOMString(style->getLetterSpacing())); - params->setLetterSpacing(length->value()); - - if(style->getWordSpacing() != "normal" && style->getWordSpacing() != "inherit") - length->setValueAsString(DOM::DOMString(style->getWordSpacing())); - params->setWordSpacing(length->value()); - - length->deref(); - - return params; -} - -SVGAnimatedLengthImpl *SVGTextContentElementImpl::textLength() const -{ - return m_textLength; -} - -SVGAnimatedEnumerationImpl *SVGTextContentElementImpl::lengthAdjust() const -{ - return m_lengthAdjust; -} - -long SVGTextContentElementImpl::getNumberOfChars() -{ - return 0; -} - -float SVGTextContentElementImpl::getComputedTextLength() -{ - return 0.0; -} - -/* -float SVGTextContentElementImpl::getSubStringLength(const unsigned long &charnum,const unsigned long &nchars) -{ -} - -SVGPoint SVGTextContentElementImpl::getStartPositionOfChar(const unsigned long &charnum) -{ -} - -SVGPoint SVGTextContentElementImpl::getEndPositionOfChar(const unsigned long &charnum) -{ -} - -SVGRect SVGTextContentElementImpl::getExtentOfChar(const unsigned long &charnum) -{ -} - -float SVGTextContentElementImpl::getRotationOfChar(const unsigned long &charnum) -{ -} - -long SVGTextContentElementImpl::getCharNumAtPosition(const SVGPoint &point) -{ -} - -void SVGTextContentElementImpl::selectSubString(const unsigned long &charnum,const unsigned long &nchars) -{ -} -*/ - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGTextContentElementImpl::s_hashTable 3 - textLength SVGTextContentElementImpl::TextLength DontDelete|ReadOnly - lengthAdjust SVGTextContentElementImpl::LengthAdjust DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGTextContentElementImplProto::s_hashTable 11 - getNumberOfChars SVGTextContentElementImpl::GetNumberOfChars DontDelete|Function 0 - getComputedTextLength SVGTextContentElementImpl::GetComputedTextLength DontDelete|Function 0 - getSubStringLength SVGTextContentElementImpl::GetSubStringLength DontDelete|Function 2 - getStartPositionOfChar SVGTextContentElementImpl::GetStartPositionOfChar DontDelete|Function 1 - getEndPositionOfChar SVGTextContentElementImpl::GetEndPositionOfChar DontDelete|Function 1 - getExtentOfChar SVGTextContentElementImpl::GetExtentOfChar DontDelete|Function 1 - getRotationOfChar SVGTextContentElementImpl::GetRotationOfChar DontDelete|Function 1 - getCharNumAtPosition SVGTextContentElementImpl::GetCharNumAtPosition DontDelete|Function 1 - selectSubString SVGTextContentElementImpl::SelectSubString DontDelete|Function 2 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGTextContentElement", SVGTextContentElementImplProto, SVGTextContentElementImplProtoFunc) - -Value SVGTextContentElementImpl::getValueProperty(ExecState *, int token) const -{ - //KSVG_CHECK_ATTRIBUTE - - switch(token) - { - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGTextContentElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case TextLength: - m_textLength->baseVal()->setValueAsString(value.toString(exec).string()); - if(m_textLength->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute textLength of element is illegal")); - break; - case LengthAdjust: - { - TQString temp = value.toString(exec).qstring(); - if(temp == "spacingAndGlyphs") - m_lengthAdjust->setBaseVal(LENGTHADJUST_SPACINGANDGLYPHS); - else if(temp == "spacing") - m_lengthAdjust->setBaseVal(LENGTHADJUST_SPACING); - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -Value SVGTextContentElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) -{ - KSVG_CHECK_THIS(SVGTextContentElementImpl) - - switch(id) - { - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -/* -@namespace KSVG -@begin SVGTextContentElementImplConstructor::s_hashTable 5 - LENGTHADJUST_UNKNOWN KSVG::LENGTHADJUST_UNKNOWN DontDelete|ReadOnly - LENGTHADJUST_SPACING KSVG::LENGTHADJUST_SPACING DontDelete|ReadOnly - LENGTHADJUST_SPACINGANDGLYPHS KSVG::LENGTHADJUST_SPACINGANDGLYPHS DontDelete|ReadOnly -@end -*/ - -Value SVGTextContentElementImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGTextContentElementImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgtextcontentelement.constructor]]"); -} diff --git a/ksvg/impl/SVGTextContentElementImpl.cpp b/ksvg/impl/SVGTextContentElementImpl.cpp new file mode 100644 index 00000000..a772672b --- /dev/null +++ b/ksvg/impl/SVGTextContentElementImpl.cpp @@ -0,0 +1,283 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "Glyph.h" + +#include "SVGStringListImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGTextContentElementImpl.h" +#include "SVGTextElementImpl.h" +#include "SVGAnimatedEnumerationImpl.h" +#include "SVGDocumentImpl.h" + +using namespace KSVG; + +#include "SVGTextContentElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_cacheimpl.h" + +SVGTextContentElementImpl::SVGTextContentElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this) +{ + KSVG_EMPTY_FLAGS + + m_lengthAdjust = new SVGAnimatedEnumerationImpl(); + m_lengthAdjust->ref(); + + // Spec: default value 'spacing' + m_lengthAdjust->setBaseVal(LENGTHADJUST_SPACING); + + m_textLength = new SVGAnimatedLengthImpl(); + m_textLength->baseVal()->setValueAsString("-1"); + m_textLength->ref(); +} + +SVGTextContentElementImpl::~SVGTextContentElementImpl() +{ + if(m_lengthAdjust) + m_lengthAdjust->deref(); + if(m_textLength) + m_textLength->deref(); +} + +TQString SVGTextContentElementImpl::textDirectionAwareText() +{ + TQString text; + + if(hasChildNodes()) + { + bool ltr = getTextDirection() == LTR; + DOM::Node node = ltr ? firstChild() : lastChild(); + + for(; !node.isNull(); node = ltr ? node.nextSibling() : node.previousSibling()) + { + if(node.nodeType() == TEXT_NODE) + { + DOM::Text textNode = node; + TQString temp = textNode.data().string(); + + if(!ltr) + { + TQString convert = temp; + + for(int i = temp.length(); i > 0; i--) + convert[temp.length() - i] = temp[i - 1]; + + text += convert; + } + else + text += temp; + } + else + return text; + } + } + + return text; +} + +T2P::GlyphLayoutParams *SVGTextContentElementImpl::layoutParams() const +{ + SVGStylableImpl *style = const_cast(this); + + T2P::GlyphLayoutParams *params = new T2P::GlyphLayoutParams(); + params->setTb(style->getTextWritingMode() == TB); + params->setUseBidi(style->getTextUnicodeBidi() == UBNORMAL); + if(!dynamic_cast(m_object)) // not allowed for + params->setBaselineShift(style->getBaselineShift().latin1()); + + bool worked = true; + int deg = style->getGlyphOrientationVertical().toInt(&worked); + if(!worked) + params->setGlyphOrientationVertical(-90); + else + params->setGlyphOrientationVertical(deg); + + worked = true; + deg = style->getGlyphOrientationHorizontal().toInt(&worked); + if(!worked) + params->setGlyphOrientationHorizontal(-90); + else + params->setGlyphOrientationHorizontal(deg); + + SVGLengthImpl *length = new SVGLengthImpl(LENGTHMODE_OTHER, const_cast(this)); + length->ref(); + + if(style->getLetterSpacing() != "normal" && style->getLetterSpacing() != "inherit") + length->setValueAsString(DOM::DOMString(style->getLetterSpacing())); + params->setLetterSpacing(length->value()); + + if(style->getWordSpacing() != "normal" && style->getWordSpacing() != "inherit") + length->setValueAsString(DOM::DOMString(style->getWordSpacing())); + params->setWordSpacing(length->value()); + + length->deref(); + + return params; +} + +SVGAnimatedLengthImpl *SVGTextContentElementImpl::textLength() const +{ + return m_textLength; +} + +SVGAnimatedEnumerationImpl *SVGTextContentElementImpl::lengthAdjust() const +{ + return m_lengthAdjust; +} + +long SVGTextContentElementImpl::getNumberOfChars() +{ + return 0; +} + +float SVGTextContentElementImpl::getComputedTextLength() +{ + return 0.0; +} + +/* +float SVGTextContentElementImpl::getSubStringLength(const unsigned long &charnum,const unsigned long &nchars) +{ +} + +SVGPoint SVGTextContentElementImpl::getStartPositionOfChar(const unsigned long &charnum) +{ +} + +SVGPoint SVGTextContentElementImpl::getEndPositionOfChar(const unsigned long &charnum) +{ +} + +SVGRect SVGTextContentElementImpl::getExtentOfChar(const unsigned long &charnum) +{ +} + +float SVGTextContentElementImpl::getRotationOfChar(const unsigned long &charnum) +{ +} + +long SVGTextContentElementImpl::getCharNumAtPosition(const SVGPoint &point) +{ +} + +void SVGTextContentElementImpl::selectSubString(const unsigned long &charnum,const unsigned long &nchars) +{ +} +*/ + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGTextContentElementImpl::s_hashTable 3 + textLength SVGTextContentElementImpl::TextLength DontDelete|ReadOnly + lengthAdjust SVGTextContentElementImpl::LengthAdjust DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGTextContentElementImplProto::s_hashTable 11 + getNumberOfChars SVGTextContentElementImpl::GetNumberOfChars DontDelete|Function 0 + getComputedTextLength SVGTextContentElementImpl::GetComputedTextLength DontDelete|Function 0 + getSubStringLength SVGTextContentElementImpl::GetSubStringLength DontDelete|Function 2 + getStartPositionOfChar SVGTextContentElementImpl::GetStartPositionOfChar DontDelete|Function 1 + getEndPositionOfChar SVGTextContentElementImpl::GetEndPositionOfChar DontDelete|Function 1 + getExtentOfChar SVGTextContentElementImpl::GetExtentOfChar DontDelete|Function 1 + getRotationOfChar SVGTextContentElementImpl::GetRotationOfChar DontDelete|Function 1 + getCharNumAtPosition SVGTextContentElementImpl::GetCharNumAtPosition DontDelete|Function 1 + selectSubString SVGTextContentElementImpl::SelectSubString DontDelete|Function 2 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGTextContentElement", SVGTextContentElementImplProto, SVGTextContentElementImplProtoFunc) + +Value SVGTextContentElementImpl::getValueProperty(ExecState *, int token) const +{ + //KSVG_CHECK_ATTRIBUTE + + switch(token) + { + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGTextContentElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case TextLength: + m_textLength->baseVal()->setValueAsString(value.toString(exec).string()); + if(m_textLength->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute textLength of element is illegal")); + break; + case LengthAdjust: + { + TQString temp = value.toString(exec).qstring(); + if(temp == "spacingAndGlyphs") + m_lengthAdjust->setBaseVal(LENGTHADJUST_SPACINGANDGLYPHS); + else if(temp == "spacing") + m_lengthAdjust->setBaseVal(LENGTHADJUST_SPACING); + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +Value SVGTextContentElementImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &) +{ + KSVG_CHECK_THIS(SVGTextContentElementImpl) + + switch(id) + { + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +/* +@namespace KSVG +@begin SVGTextContentElementImplConstructor::s_hashTable 5 + LENGTHADJUST_UNKNOWN KSVG::LENGTHADJUST_UNKNOWN DontDelete|ReadOnly + LENGTHADJUST_SPACING KSVG::LENGTHADJUST_SPACING DontDelete|ReadOnly + LENGTHADJUST_SPACINGANDGLYPHS KSVG::LENGTHADJUST_SPACINGANDGLYPHS DontDelete|ReadOnly +@end +*/ + +Value SVGTextContentElementImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGTextContentElementImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgtextcontentelement.constructor]]"); +} diff --git a/ksvg/impl/SVGTextElementImpl.cc b/ksvg/impl/SVGTextElementImpl.cc deleted file mode 100644 index 7617f7de..00000000 --- a/ksvg/impl/SVGTextElementImpl.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGRectImpl.h" -#include "SVGEventImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGTextElementImpl.h" - -#include "CanvasItem.h" -#include "KSVGCanvas.h" - -using namespace KSVG; - -SVGTextElementImpl::SVGTextElementImpl(DOM::ElementImpl *impl) : SVGTextPositioningElementImpl(impl), SVGTransformableImpl() -{ - m_bboxX = 0; - m_bboxY = 0; - - m_bboxWidth = 0; - m_bboxHeight = 0; -} - -SVGTextElementImpl::~SVGTextElementImpl() -{ -} - -long SVGTextElementImpl::getNumberOfChars() -{ - return text().length(); -} - -TQString SVGTextElementImpl::text() -{ - // Otherwhise some js scripts which require a child, don't work (Niko) - if(!hasChildNodes()) - { - DOM::Text impl = static_cast(ownerDoc())->createTextNode(DOM::DOMString("")); - appendChild(impl); - } - - return textDirectionAwareText(); -} - -SVGRectImpl *SVGTextElementImpl::getBBox() -{ - SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); - ret->setX(m_bboxX); - ret->setY(m_bboxY); - ret->setWidth(m_bboxWidth); - ret->setHeight(m_bboxHeight); - return ret; -} - -void SVGTextElementImpl::createItem(KSVGCanvas *c ) -{ - if(!c) - c = ownerDoc()->canvas(); - - if(!m_item) - { - m_item = c->createText(this); - // Set up bbox before insert(), as that may render the item - TQRect rect = m_item->bbox(); - m_bboxX = rect.x(); - m_bboxY = rect.y(); - m_bboxWidth = rect.width(); - m_bboxHeight = rect.height(); - c->insert(m_item); - } -} - -bool SVGTextElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &, SVGMouseEventImpl *mev) -{ - // TODO : pointer-events should be stored here, not in SVGStylableImpl. - SVGStylableImpl *style = dynamic_cast(this); - if(!style || style->getPointerEvents() == PE_NONE) - return false; - bool test = false; - switch(style->getPointerEvents()) - { - case PE_VISIBLE: test = style->getVisible(); break; - case PE_VISIBLE_PAINTED: test = style->getVisible() && (style->isStroked() || style->isFilled()) ; break; - case PE_VISIBLE_FILL: test = style->getVisible() && style->isFilled(); break; - case PE_VISIBLE_STROKE: test = style->getVisible() && style->isStroked(); break; - case PE_PAINTED: test = style->isStroked() || style->isFilled(); break; - case PE_FILL: test = style->isFilled(); break; - case PE_STROKE: test = style->isStroked(); break; - case PE_ALL: - default: test = true; - }; - - if(test) - { - if(m_item->bbox().contains(p)) - { - mev->setTarget(dynamic_cast(this)); - return true; - } - } - - return false; -} diff --git a/ksvg/impl/SVGTextElementImpl.cpp b/ksvg/impl/SVGTextElementImpl.cpp new file mode 100644 index 00000000..7617f7de --- /dev/null +++ b/ksvg/impl/SVGTextElementImpl.cpp @@ -0,0 +1,122 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGRectImpl.h" +#include "SVGEventImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGTextElementImpl.h" + +#include "CanvasItem.h" +#include "KSVGCanvas.h" + +using namespace KSVG; + +SVGTextElementImpl::SVGTextElementImpl(DOM::ElementImpl *impl) : SVGTextPositioningElementImpl(impl), SVGTransformableImpl() +{ + m_bboxX = 0; + m_bboxY = 0; + + m_bboxWidth = 0; + m_bboxHeight = 0; +} + +SVGTextElementImpl::~SVGTextElementImpl() +{ +} + +long SVGTextElementImpl::getNumberOfChars() +{ + return text().length(); +} + +TQString SVGTextElementImpl::text() +{ + // Otherwhise some js scripts which require a child, don't work (Niko) + if(!hasChildNodes()) + { + DOM::Text impl = static_cast(ownerDoc())->createTextNode(DOM::DOMString("")); + appendChild(impl); + } + + return textDirectionAwareText(); +} + +SVGRectImpl *SVGTextElementImpl::getBBox() +{ + SVGRectImpl *ret = SVGSVGElementImpl::createSVGRect(); + ret->setX(m_bboxX); + ret->setY(m_bboxY); + ret->setWidth(m_bboxWidth); + ret->setHeight(m_bboxHeight); + return ret; +} + +void SVGTextElementImpl::createItem(KSVGCanvas *c ) +{ + if(!c) + c = ownerDoc()->canvas(); + + if(!m_item) + { + m_item = c->createText(this); + // Set up bbox before insert(), as that may render the item + TQRect rect = m_item->bbox(); + m_bboxX = rect.x(); + m_bboxY = rect.y(); + m_bboxWidth = rect.width(); + m_bboxHeight = rect.height(); + c->insert(m_item); + } +} + +bool SVGTextElementImpl::prepareMouseEvent(const TQPoint &p, const TQPoint &, SVGMouseEventImpl *mev) +{ + // TODO : pointer-events should be stored here, not in SVGStylableImpl. + SVGStylableImpl *style = dynamic_cast(this); + if(!style || style->getPointerEvents() == PE_NONE) + return false; + bool test = false; + switch(style->getPointerEvents()) + { + case PE_VISIBLE: test = style->getVisible(); break; + case PE_VISIBLE_PAINTED: test = style->getVisible() && (style->isStroked() || style->isFilled()) ; break; + case PE_VISIBLE_FILL: test = style->getVisible() && style->isFilled(); break; + case PE_VISIBLE_STROKE: test = style->getVisible() && style->isStroked(); break; + case PE_PAINTED: test = style->isStroked() || style->isFilled(); break; + case PE_FILL: test = style->isFilled(); break; + case PE_STROKE: test = style->isStroked(); break; + case PE_ALL: + default: test = true; + }; + + if(test) + { + if(m_item->bbox().contains(p)) + { + mev->setTarget(dynamic_cast(this)); + return true; + } + } + + return false; +} diff --git a/ksvg/impl/SVGTextPathElementImpl.cc b/ksvg/impl/SVGTextPathElementImpl.cc deleted file mode 100644 index 4a116715..00000000 --- a/ksvg/impl/SVGTextPathElementImpl.cc +++ /dev/null @@ -1,238 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "Glyph.h" - -#include "SVGDocumentImpl.h" -#include "SVGTextPathElement.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGTextPathElementImpl.h" -#include "SVGAnimatedEnumerationImpl.h" - -using namespace KSVG; - -#include "SVGTextPathElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_ecma.h" -#include "ksvg_cacheimpl.h" - -SVGTextPathElementImpl::SVGTextPathElementImpl(DOM::ElementImpl *impl) : SVGTextContentElementImpl(impl), SVGURIReferenceImpl() -{ - KSVG_EMPTY_FLAGS - - m_startOffset = new SVGAnimatedLengthImpl(); - m_startOffset->ref(); - - m_method = new SVGAnimatedEnumerationImpl(); - m_method->ref(); - - m_spacing = new SVGAnimatedEnumerationImpl(); - m_spacing->ref(); -} - -SVGTextPathElementImpl::~SVGTextPathElementImpl() -{ - if(m_startOffset) - m_startOffset->deref(); - if(m_method) - m_method->deref(); - if(m_spacing) - m_spacing->deref(); -} - -SVGAnimatedLengthImpl *SVGTextPathElementImpl::startOffset() const -{ - return m_startOffset; -} - -SVGAnimatedEnumerationImpl *SVGTextPathElementImpl::method() const -{ - return m_method; -} - -SVGAnimatedEnumerationImpl *SVGTextPathElementImpl::spacing() const -{ - return m_spacing; -} - -TQString SVGTextPathElementImpl::text() -{ - // Otherwhise some js scripts which require a child, don't work (Niko) - if(!hasChildNodes()) - { - DOM::Text impl = static_cast(ownerDoc())->createTextNode(DOM::DOMString("")); - appendChild(impl); - } - - return textDirectionAwareText(); -} - -void SVGTextPathElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - // Spec: if not specified, effect is as if a value of "0" were specified - if(KSVG_TOKEN_NOT_PARSED(StartOffset)) - KSVG_SET_ALT_ATTRIBUTE(StartOffset, "0") - - // Spec: if not specified, effect is as if a value of "align" were specified - if(KSVG_TOKEN_NOT_PARSED(Method)) - KSVG_SET_ALT_ATTRIBUTE(Method, "align") - - // Spec: if not specified, effect is as if a value of "exact" were specified - if(KSVG_TOKEN_NOT_PARSED(Spacing)) - KSVG_SET_ALT_ATTRIBUTE(Spacing, "exact") -} - -T2P::GlyphLayoutParams *SVGTextPathElementImpl::layoutParams() const -{ - T2P::GlyphLayoutParams *params = SVGTextContentElementImpl::layoutParams(); - params->setTextPathStartOffset(startOffset()->baseVal()->value()); - return params; -} - - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGTextPathElementImpl::s_hashTable 5 - startOffset SVGTextPathElementImpl::StartOffset DontDelete|ReadOnly - method SVGTextPathElementImpl::Method DontDelete|ReadOnly - spacing SVGTextPathElementImpl::Spacing DontDelete|ReadOnly -@end -*/ - -Value SVGTextPathElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case StartOffset: - if(!attributeMode) - return m_startOffset->cache(exec); - else - return Number(m_startOffset->baseVal()->value()); - case Method: - if(!attributeMode) - return m_method->cache(exec); - else - return Number(m_method->baseVal()); - case Spacing: - if(!attributeMode) - return m_spacing->cache(exec); - else - return Number(m_spacing->baseVal()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGTextPathElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case StartOffset: - { - TQString param = value.toString(exec).qstring(); - - if(param.endsWith("%")) - { - TQString value = param.left(param.length() - 1); - bool ok = false; - double dValue = value.toDouble(&ok); - if(ok) - startOffset()->baseVal()->setValue(dValue / 100.0); - else - kdDebug() << "Couldn't parse startOffset: " << value << endl; - } - else - startOffset()->baseVal()->setValueAsString(value.toString(exec).qstring()); - - if(startOffset()->baseVal()->value() < 0) // A negative value is an error - gotError(i18n("Negative value for attribute startOffset of element is illegal")); - break; - } - case Method: - { - TQString param = value.toString(exec).qstring(); - - if(param == "align") - method()->setBaseVal(TEXTPATH_METHODTYPE_ALIGN); - else if(param == "stretch") - method()->setBaseVal(TEXTPATH_METHODTYPE_STRETCH); - else - method()->setBaseVal(TEXTPATH_METHODTYPE_UNKNOWN); - - break; - } - case Spacing: - { - TQString param = value.toString(exec).qstring(); - - if(param == "auto") - spacing()->setBaseVal(TEXTPATH_SPACINGTYPE_AUTO); - else if(param == "exact") - spacing()->setBaseVal(TEXTPATH_SPACINGTYPE_EXACT); - else - spacing()->setBaseVal(TEXTPATH_SPACINGTYPE_UNKNOWN); - - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -// CONSTANTS - -/* -@namespace KSVG -@begin SVGTextPathElementImplConstructor::s_hashTable 7 - TEXTPATH_METHODTYPE_UNKNOWN KSVG::TEXTPATH_METHODTYPE_UNKNOWN DontDelete|ReadOnly - TEXTPATH_METHODTYPE_ALIGN KSVG::TEXTPATH_METHODTYPE_ALIGN DontDelete|ReadOnly - TEXTPATH_METHODTYPE_STRETCH KSVG::TEXTPATH_METHODTYPE_STRETCH DontDelete|ReadOnly - TEXTPATH_SPACINGTYPE_UNKNOWN KSVG::TEXTPATH_SPACINGTYPE_UNKNOWN DontDelete|ReadOnly - TEXTPATH_SPACINGTYPE_AUTO KSVG::TEXTPATH_SPACINGTYPE_AUTO DontDelete|ReadOnly - TEXTPATH_SPACINGTYPE_EXACT KSVG::TEXTPATH_SPACINGTYPE_EXACT DontDelete|ReadOnly -@end -*/ - -using namespace KJS; - -Value SVGTextPathElementImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGTextPathElementImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgtextpathelement.constructor]]"); -} diff --git a/ksvg/impl/SVGTextPathElementImpl.cpp b/ksvg/impl/SVGTextPathElementImpl.cpp new file mode 100644 index 00000000..4a116715 --- /dev/null +++ b/ksvg/impl/SVGTextPathElementImpl.cpp @@ -0,0 +1,238 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include "Glyph.h" + +#include "SVGDocumentImpl.h" +#include "SVGTextPathElement.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGTextPathElementImpl.h" +#include "SVGAnimatedEnumerationImpl.h" + +using namespace KSVG; + +#include "SVGTextPathElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_ecma.h" +#include "ksvg_cacheimpl.h" + +SVGTextPathElementImpl::SVGTextPathElementImpl(DOM::ElementImpl *impl) : SVGTextContentElementImpl(impl), SVGURIReferenceImpl() +{ + KSVG_EMPTY_FLAGS + + m_startOffset = new SVGAnimatedLengthImpl(); + m_startOffset->ref(); + + m_method = new SVGAnimatedEnumerationImpl(); + m_method->ref(); + + m_spacing = new SVGAnimatedEnumerationImpl(); + m_spacing->ref(); +} + +SVGTextPathElementImpl::~SVGTextPathElementImpl() +{ + if(m_startOffset) + m_startOffset->deref(); + if(m_method) + m_method->deref(); + if(m_spacing) + m_spacing->deref(); +} + +SVGAnimatedLengthImpl *SVGTextPathElementImpl::startOffset() const +{ + return m_startOffset; +} + +SVGAnimatedEnumerationImpl *SVGTextPathElementImpl::method() const +{ + return m_method; +} + +SVGAnimatedEnumerationImpl *SVGTextPathElementImpl::spacing() const +{ + return m_spacing; +} + +TQString SVGTextPathElementImpl::text() +{ + // Otherwhise some js scripts which require a child, don't work (Niko) + if(!hasChildNodes()) + { + DOM::Text impl = static_cast(ownerDoc())->createTextNode(DOM::DOMString("")); + appendChild(impl); + } + + return textDirectionAwareText(); +} + +void SVGTextPathElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + // Spec: if not specified, effect is as if a value of "0" were specified + if(KSVG_TOKEN_NOT_PARSED(StartOffset)) + KSVG_SET_ALT_ATTRIBUTE(StartOffset, "0") + + // Spec: if not specified, effect is as if a value of "align" were specified + if(KSVG_TOKEN_NOT_PARSED(Method)) + KSVG_SET_ALT_ATTRIBUTE(Method, "align") + + // Spec: if not specified, effect is as if a value of "exact" were specified + if(KSVG_TOKEN_NOT_PARSED(Spacing)) + KSVG_SET_ALT_ATTRIBUTE(Spacing, "exact") +} + +T2P::GlyphLayoutParams *SVGTextPathElementImpl::layoutParams() const +{ + T2P::GlyphLayoutParams *params = SVGTextContentElementImpl::layoutParams(); + params->setTextPathStartOffset(startOffset()->baseVal()->value()); + return params; +} + + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGTextPathElementImpl::s_hashTable 5 + startOffset SVGTextPathElementImpl::StartOffset DontDelete|ReadOnly + method SVGTextPathElementImpl::Method DontDelete|ReadOnly + spacing SVGTextPathElementImpl::Spacing DontDelete|ReadOnly +@end +*/ + +Value SVGTextPathElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case StartOffset: + if(!attributeMode) + return m_startOffset->cache(exec); + else + return Number(m_startOffset->baseVal()->value()); + case Method: + if(!attributeMode) + return m_method->cache(exec); + else + return Number(m_method->baseVal()); + case Spacing: + if(!attributeMode) + return m_spacing->cache(exec); + else + return Number(m_spacing->baseVal()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGTextPathElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case StartOffset: + { + TQString param = value.toString(exec).qstring(); + + if(param.endsWith("%")) + { + TQString value = param.left(param.length() - 1); + bool ok = false; + double dValue = value.toDouble(&ok); + if(ok) + startOffset()->baseVal()->setValue(dValue / 100.0); + else + kdDebug() << "Couldn't parse startOffset: " << value << endl; + } + else + startOffset()->baseVal()->setValueAsString(value.toString(exec).qstring()); + + if(startOffset()->baseVal()->value() < 0) // A negative value is an error + gotError(i18n("Negative value for attribute startOffset of element is illegal")); + break; + } + case Method: + { + TQString param = value.toString(exec).qstring(); + + if(param == "align") + method()->setBaseVal(TEXTPATH_METHODTYPE_ALIGN); + else if(param == "stretch") + method()->setBaseVal(TEXTPATH_METHODTYPE_STRETCH); + else + method()->setBaseVal(TEXTPATH_METHODTYPE_UNKNOWN); + + break; + } + case Spacing: + { + TQString param = value.toString(exec).qstring(); + + if(param == "auto") + spacing()->setBaseVal(TEXTPATH_SPACINGTYPE_AUTO); + else if(param == "exact") + spacing()->setBaseVal(TEXTPATH_SPACINGTYPE_EXACT); + else + spacing()->setBaseVal(TEXTPATH_SPACINGTYPE_UNKNOWN); + + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +// CONSTANTS + +/* +@namespace KSVG +@begin SVGTextPathElementImplConstructor::s_hashTable 7 + TEXTPATH_METHODTYPE_UNKNOWN KSVG::TEXTPATH_METHODTYPE_UNKNOWN DontDelete|ReadOnly + TEXTPATH_METHODTYPE_ALIGN KSVG::TEXTPATH_METHODTYPE_ALIGN DontDelete|ReadOnly + TEXTPATH_METHODTYPE_STRETCH KSVG::TEXTPATH_METHODTYPE_STRETCH DontDelete|ReadOnly + TEXTPATH_SPACINGTYPE_UNKNOWN KSVG::TEXTPATH_SPACINGTYPE_UNKNOWN DontDelete|ReadOnly + TEXTPATH_SPACINGTYPE_AUTO KSVG::TEXTPATH_SPACINGTYPE_AUTO DontDelete|ReadOnly + TEXTPATH_SPACINGTYPE_EXACT KSVG::TEXTPATH_SPACINGTYPE_EXACT DontDelete|ReadOnly +@end +*/ + +using namespace KJS; + +Value SVGTextPathElementImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGTextPathElementImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgtextpathelement.constructor]]"); +} diff --git a/ksvg/impl/SVGTextPositioningElementImpl.cc b/ksvg/impl/SVGTextPositioningElementImpl.cc deleted file mode 100644 index e6b02745..00000000 --- a/ksvg/impl/SVGTextPositioningElementImpl.cc +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGHelperImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGAnimatedLengthListImpl.h" -#include "SVGAnimatedNumberListImpl.h" -#include "SVGTextPositioningElementImpl.h" - -using namespace KSVG; - -#include "SVGTextPositioningElementImpl.lut.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGTextPositioningElementImpl::SVGTextPositioningElementImpl(DOM::ElementImpl *impl) : SVGTextContentElementImpl(impl) -{ - KSVG_EMPTY_FLAGS - - m_x = new SVGAnimatedLengthListImpl(); - m_x->ref(); - - m_y = new SVGAnimatedLengthListImpl(); - m_y->ref(); - - m_dx = new SVGAnimatedLengthListImpl(); - m_dx->ref(); - - m_dy = new SVGAnimatedLengthListImpl(); - m_dy->ref(); - - m_rotate = new SVGAnimatedNumberListImpl(); - m_rotate->ref(); -} - -SVGTextPositioningElementImpl::~SVGTextPositioningElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_dx) - m_dx->deref(); - if(m_dy) - m_dy->deref(); - if(m_rotate) - m_rotate->deref(); -} - -SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::x() -{ - return m_x; -} - -SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::y() -{ - return m_y; -} - -SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::dx() -{ - return m_dx; -} - -SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::dy() -{ - return m_dy; -} - -SVGAnimatedNumberListImpl *SVGTextPositioningElementImpl::rotate() -{ - return m_rotate; -} - -/* -@namespace KSVG -@begin SVGTextPositioningElementImpl::s_hashTable 7 - x SVGTextPositioningElementImpl::X DontDelete|ReadOnly - y SVGTextPositioningElementImpl::Y DontDelete|ReadOnly - dx SVGTextPositioningElementImpl::Dx DontDelete|ReadOnly - dy SVGTextPositioningElementImpl::Dy DontDelete|ReadOnly - rotate SVGTextPositioningElementImpl::Rotate DontDelete|ReadOnly -@end -*/ - -Value SVGTextPositioningElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X: - if(!attributeMode) - return m_x->cache(exec); - else - return Number(m_x->baseVal()->getItem(0)->value()); - case Y: - if(!attributeMode) - return m_y->cache(exec); - else - return Number(m_y->baseVal()->getItem(0)->value()); - case Dx: - if(!attributeMode) - return m_dx->cache(exec); - else - return Number(m_dx->baseVal()->getItem(0)->value()); - case Dy: - if(!attributeMode) - return m_dy->cache(exec); - else - return Number(m_dy->baseVal()->getItem(0)->value()); - case Rotate: - if(!attributeMode) - return m_rotate->cache(exec); - else - return Number(m_rotate->baseVal()->getItem(0)->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGTextPositioningElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X: - x()->baseVal()->clear(); - SVGHelperImpl::parseLengthList(x(), value.toString(exec).qstring(), LENGTHMODE_WIDTH, this); - break; - case Y: - y()->baseVal()->clear(); - SVGHelperImpl::parseLengthList(y(), value.toString(exec).qstring(), LENGTHMODE_HEIGHT, this); - break; - case Dx: - dx()->baseVal()->clear(); - SVGHelperImpl::parseLengthList(dx(), value.toString(exec).qstring(), LENGTHMODE_WIDTH, this); - break; - case Dy: - dy()->baseVal()->clear(); - SVGHelperImpl::parseLengthList(dy(), value.toString(exec).qstring(), LENGTHMODE_HEIGHT, this); - break; - case Rotate: - { - rotate()->baseVal()->clear(); - - SVGNumberImpl *number = SVGSVGElementImpl::createSVGNumber(); - number->setValue(value.toNumber(exec)); - rotate()->baseVal()->appendItem(number); - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -void SVGTextPositioningElementImpl::setAttributes() -{ - SVGElementImpl::setAttributes(); - - if(tagName() != "text") - return; - - // Spec: If the attribute is not specified, the effect is as if a value of "0" were specified. - if(KSVG_TOKEN_NOT_PARSED(X)) - KSVG_SET_ALT_ATTRIBUTE(X, "0") - - // Spec: If the attribute is not specified, the effect is as if a value of "0" were specified. - if(KSVG_TOKEN_NOT_PARSED(Y)) - KSVG_SET_ALT_ATTRIBUTE(Y, "0") -} diff --git a/ksvg/impl/SVGTextPositioningElementImpl.cpp b/ksvg/impl/SVGTextPositioningElementImpl.cpp new file mode 100644 index 00000000..e6b02745 --- /dev/null +++ b/ksvg/impl/SVGTextPositioningElementImpl.cpp @@ -0,0 +1,196 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGHelperImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGAnimatedLengthListImpl.h" +#include "SVGAnimatedNumberListImpl.h" +#include "SVGTextPositioningElementImpl.h" + +using namespace KSVG; + +#include "SVGTextPositioningElementImpl.lut.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGTextPositioningElementImpl::SVGTextPositioningElementImpl(DOM::ElementImpl *impl) : SVGTextContentElementImpl(impl) +{ + KSVG_EMPTY_FLAGS + + m_x = new SVGAnimatedLengthListImpl(); + m_x->ref(); + + m_y = new SVGAnimatedLengthListImpl(); + m_y->ref(); + + m_dx = new SVGAnimatedLengthListImpl(); + m_dx->ref(); + + m_dy = new SVGAnimatedLengthListImpl(); + m_dy->ref(); + + m_rotate = new SVGAnimatedNumberListImpl(); + m_rotate->ref(); +} + +SVGTextPositioningElementImpl::~SVGTextPositioningElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_dx) + m_dx->deref(); + if(m_dy) + m_dy->deref(); + if(m_rotate) + m_rotate->deref(); +} + +SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::x() +{ + return m_x; +} + +SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::y() +{ + return m_y; +} + +SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::dx() +{ + return m_dx; +} + +SVGAnimatedLengthListImpl *SVGTextPositioningElementImpl::dy() +{ + return m_dy; +} + +SVGAnimatedNumberListImpl *SVGTextPositioningElementImpl::rotate() +{ + return m_rotate; +} + +/* +@namespace KSVG +@begin SVGTextPositioningElementImpl::s_hashTable 7 + x SVGTextPositioningElementImpl::X DontDelete|ReadOnly + y SVGTextPositioningElementImpl::Y DontDelete|ReadOnly + dx SVGTextPositioningElementImpl::Dx DontDelete|ReadOnly + dy SVGTextPositioningElementImpl::Dy DontDelete|ReadOnly + rotate SVGTextPositioningElementImpl::Rotate DontDelete|ReadOnly +@end +*/ + +Value SVGTextPositioningElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X: + if(!attributeMode) + return m_x->cache(exec); + else + return Number(m_x->baseVal()->getItem(0)->value()); + case Y: + if(!attributeMode) + return m_y->cache(exec); + else + return Number(m_y->baseVal()->getItem(0)->value()); + case Dx: + if(!attributeMode) + return m_dx->cache(exec); + else + return Number(m_dx->baseVal()->getItem(0)->value()); + case Dy: + if(!attributeMode) + return m_dy->cache(exec); + else + return Number(m_dy->baseVal()->getItem(0)->value()); + case Rotate: + if(!attributeMode) + return m_rotate->cache(exec); + else + return Number(m_rotate->baseVal()->getItem(0)->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGTextPositioningElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X: + x()->baseVal()->clear(); + SVGHelperImpl::parseLengthList(x(), value.toString(exec).qstring(), LENGTHMODE_WIDTH, this); + break; + case Y: + y()->baseVal()->clear(); + SVGHelperImpl::parseLengthList(y(), value.toString(exec).qstring(), LENGTHMODE_HEIGHT, this); + break; + case Dx: + dx()->baseVal()->clear(); + SVGHelperImpl::parseLengthList(dx(), value.toString(exec).qstring(), LENGTHMODE_WIDTH, this); + break; + case Dy: + dy()->baseVal()->clear(); + SVGHelperImpl::parseLengthList(dy(), value.toString(exec).qstring(), LENGTHMODE_HEIGHT, this); + break; + case Rotate: + { + rotate()->baseVal()->clear(); + + SVGNumberImpl *number = SVGSVGElementImpl::createSVGNumber(); + number->setValue(value.toNumber(exec)); + rotate()->baseVal()->appendItem(number); + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +void SVGTextPositioningElementImpl::setAttributes() +{ + SVGElementImpl::setAttributes(); + + if(tagName() != "text") + return; + + // Spec: If the attribute is not specified, the effect is as if a value of "0" were specified. + if(KSVG_TOKEN_NOT_PARSED(X)) + KSVG_SET_ALT_ATTRIBUTE(X, "0") + + // Spec: If the attribute is not specified, the effect is as if a value of "0" were specified. + if(KSVG_TOKEN_NOT_PARSED(Y)) + KSVG_SET_ALT_ATTRIBUTE(Y, "0") +} diff --git a/ksvg/impl/SVGTimeScheduler.cc b/ksvg/impl/SVGTimeScheduler.cc deleted file mode 100644 index b38eceaa..00000000 --- a/ksvg/impl/SVGTimeScheduler.cc +++ /dev/null @@ -1,232 +0,0 @@ -/* - Copyright (C) 2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "KSVGCanvas.h" -#include "CanvasItem.h" -#include "SVGShapeImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGTimeScheduler.moc" - -using namespace KSVG; - -SVGTimer::SVGTimer(TQObject *scheduler, unsigned int ms, bool singleShot) -{ - m_ms = ms; - m_singleShot = singleShot; - m_timer = new TQTimer(scheduler); -} - -SVGTimer::~SVGTimer() -{ - delete m_timer; -} - -bool SVGTimer::operator==(const TQTimer *timer) -{ - return (m_timer == timer); -} - -const TQTimer *SVGTimer::qtimer() const -{ - return m_timer; -} - -void SVGTimer::start(TQObject *receiver, const char *member) -{ - TQObject::connect(m_timer, TQT_SIGNAL(timeout()), receiver, member); - m_timer->start(m_ms, m_singleShot); -} - -void SVGTimer::stop() -{ - m_timer->stop(); -} - -bool SVGTimer::isActive() const -{ - return m_timer->isActive(); -} - -unsigned int SVGTimer::ms() const -{ - return m_ms; -} - -bool SVGTimer::singleShot() const -{ - return m_singleShot; -} - -void SVGTimer::notifyAll() -{ - if(m_notifyList.isEmpty()) - return; - - TQValueList elements; - for(unsigned int i = m_notifyList.count();i > 0; i--) - { - SVGElementImpl *element = m_notifyList[i - 1]; - if(!element) - continue; - - SVGAnimationElementImpl *animation = dynamic_cast(element); - if(animation) - { - animation->handleTimerEvent(); - - SVGElementImpl *target = animation->targetElement(); - if(!elements.contains(target)) - elements.append(target); - } - } - - // Optimized update logic (to avoid 4 updates, on the same element) - TQValueList::iterator it2; - for(it2 = elements.begin(); it2 != elements.end(); ++it2) - { - SVGShapeImpl *shape = dynamic_cast(*it2); - if(shape && shape->item()) - shape->item()->update(UPDATE_TRANSFORM); - } -} - -void SVGTimer::addNotify(SVGElementImpl *element) -{ - m_notifyList.append(element); -} - -void SVGTimer::removeNotify(SVGElementImpl *element) -{ - m_notifyList.remove(element); - - if(m_notifyList.isEmpty()) - stop(); -} - -const unsigned int SVGTimeScheduler::staticTimerInterval = 15; // milliseconds - -SVGTimeScheduler::SVGTimeScheduler(SVGDocumentImpl *doc) : TQObject(), m_doc(doc) -{ - // Create static interval timers but don't start it yet! - m_intervalTimer = new SVGTimer(this, staticTimerInterval, false); - m_creationTime.start(); -} - -SVGTimeScheduler::~SVGTimeScheduler() -{ - // Usually singleShot timers cleanup themselves, after usage - SVGTimerList::iterator it; - for(it = m_timerList.begin(); it != m_timerList.end(); ++it) - { - SVGTimer *svgTimer = *it; - delete svgTimer; - } - delete m_intervalTimer; -} - -void SVGTimeScheduler::addTimer(SVGElementImpl *element, unsigned int ms) -{ - SVGTimer *svgTimer = new SVGTimer(this, ms, true); - svgTimer->addNotify(element); - m_timerList.append(svgTimer); -} - -void SVGTimeScheduler::connectIntervalTimer(SVGElementImpl *element) -{ - m_intervalTimer->addNotify(element); -} - -void SVGTimeScheduler::disconnectIntervalTimer(SVGElementImpl *element) -{ - m_intervalTimer->removeNotify(element); -} - -void SVGTimeScheduler::startAnimations() -{ - SVGTimerList::iterator it; - for(it = m_timerList.begin(); it != m_timerList.end(); ++it) - { - SVGTimer *svgTimer = *it; - if(svgTimer && !svgTimer->isActive()) - svgTimer->start(this, TQT_SLOT(slotTimerNotify())); - } -} - -void SVGTimeScheduler::toggleAnimations() -{ - if(m_intervalTimer->isActive()) - m_intervalTimer->stop(); - else - m_intervalTimer->start(this, TQT_SLOT(slotTimerNotify())); -} - -bool SVGTimeScheduler::animationsPaused() const -{ - return !m_intervalTimer->isActive(); -} - -void SVGTimeScheduler::slotTimerNotify() -{ - TQTimer *senderTimer = const_cast(static_cast(sender())); - - SVGTimer *svgTimer = 0; - SVGTimerList::iterator it; - for(it = m_timerList.begin(); it != m_timerList.end(); ++it) - { - SVGTimer *cur = *it; - if(*cur == senderTimer) - { - svgTimer = cur; - break; - } - } - - if(!svgTimer) - { - svgTimer = (*m_intervalTimer == senderTimer) ? m_intervalTimer : 0; - - if(!svgTimer) - return; - } - - svgTimer->notifyAll(); - - // Animations need direct updates - if(m_doc->canvas()) - m_doc->canvas()->update(); - emit m_doc->finishedRendering(); - - if(svgTimer->singleShot()) - { - m_timerList.remove(svgTimer); - delete svgTimer; - } - - // The singleShot timers of ie. with begin="3s" are notified - // by the previous call, and now all connections to the interval timer - // are created and now we just need to fire that timer (Niko) - if(svgTimer != m_intervalTimer && !m_intervalTimer->isActive()) - m_intervalTimer->start(this, TQT_SLOT(slotTimerNotify())); -} - -float SVGTimeScheduler::elapsed() const -{ - return float(m_creationTime.elapsed()) / 1000.0; -} diff --git a/ksvg/impl/SVGTimeScheduler.cpp b/ksvg/impl/SVGTimeScheduler.cpp new file mode 100644 index 00000000..b38eceaa --- /dev/null +++ b/ksvg/impl/SVGTimeScheduler.cpp @@ -0,0 +1,232 @@ +/* + Copyright (C) 2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "KSVGCanvas.h" +#include "CanvasItem.h" +#include "SVGShapeImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGTimeScheduler.moc" + +using namespace KSVG; + +SVGTimer::SVGTimer(TQObject *scheduler, unsigned int ms, bool singleShot) +{ + m_ms = ms; + m_singleShot = singleShot; + m_timer = new TQTimer(scheduler); +} + +SVGTimer::~SVGTimer() +{ + delete m_timer; +} + +bool SVGTimer::operator==(const TQTimer *timer) +{ + return (m_timer == timer); +} + +const TQTimer *SVGTimer::qtimer() const +{ + return m_timer; +} + +void SVGTimer::start(TQObject *receiver, const char *member) +{ + TQObject::connect(m_timer, TQT_SIGNAL(timeout()), receiver, member); + m_timer->start(m_ms, m_singleShot); +} + +void SVGTimer::stop() +{ + m_timer->stop(); +} + +bool SVGTimer::isActive() const +{ + return m_timer->isActive(); +} + +unsigned int SVGTimer::ms() const +{ + return m_ms; +} + +bool SVGTimer::singleShot() const +{ + return m_singleShot; +} + +void SVGTimer::notifyAll() +{ + if(m_notifyList.isEmpty()) + return; + + TQValueList elements; + for(unsigned int i = m_notifyList.count();i > 0; i--) + { + SVGElementImpl *element = m_notifyList[i - 1]; + if(!element) + continue; + + SVGAnimationElementImpl *animation = dynamic_cast(element); + if(animation) + { + animation->handleTimerEvent(); + + SVGElementImpl *target = animation->targetElement(); + if(!elements.contains(target)) + elements.append(target); + } + } + + // Optimized update logic (to avoid 4 updates, on the same element) + TQValueList::iterator it2; + for(it2 = elements.begin(); it2 != elements.end(); ++it2) + { + SVGShapeImpl *shape = dynamic_cast(*it2); + if(shape && shape->item()) + shape->item()->update(UPDATE_TRANSFORM); + } +} + +void SVGTimer::addNotify(SVGElementImpl *element) +{ + m_notifyList.append(element); +} + +void SVGTimer::removeNotify(SVGElementImpl *element) +{ + m_notifyList.remove(element); + + if(m_notifyList.isEmpty()) + stop(); +} + +const unsigned int SVGTimeScheduler::staticTimerInterval = 15; // milliseconds + +SVGTimeScheduler::SVGTimeScheduler(SVGDocumentImpl *doc) : TQObject(), m_doc(doc) +{ + // Create static interval timers but don't start it yet! + m_intervalTimer = new SVGTimer(this, staticTimerInterval, false); + m_creationTime.start(); +} + +SVGTimeScheduler::~SVGTimeScheduler() +{ + // Usually singleShot timers cleanup themselves, after usage + SVGTimerList::iterator it; + for(it = m_timerList.begin(); it != m_timerList.end(); ++it) + { + SVGTimer *svgTimer = *it; + delete svgTimer; + } + delete m_intervalTimer; +} + +void SVGTimeScheduler::addTimer(SVGElementImpl *element, unsigned int ms) +{ + SVGTimer *svgTimer = new SVGTimer(this, ms, true); + svgTimer->addNotify(element); + m_timerList.append(svgTimer); +} + +void SVGTimeScheduler::connectIntervalTimer(SVGElementImpl *element) +{ + m_intervalTimer->addNotify(element); +} + +void SVGTimeScheduler::disconnectIntervalTimer(SVGElementImpl *element) +{ + m_intervalTimer->removeNotify(element); +} + +void SVGTimeScheduler::startAnimations() +{ + SVGTimerList::iterator it; + for(it = m_timerList.begin(); it != m_timerList.end(); ++it) + { + SVGTimer *svgTimer = *it; + if(svgTimer && !svgTimer->isActive()) + svgTimer->start(this, TQT_SLOT(slotTimerNotify())); + } +} + +void SVGTimeScheduler::toggleAnimations() +{ + if(m_intervalTimer->isActive()) + m_intervalTimer->stop(); + else + m_intervalTimer->start(this, TQT_SLOT(slotTimerNotify())); +} + +bool SVGTimeScheduler::animationsPaused() const +{ + return !m_intervalTimer->isActive(); +} + +void SVGTimeScheduler::slotTimerNotify() +{ + TQTimer *senderTimer = const_cast(static_cast(sender())); + + SVGTimer *svgTimer = 0; + SVGTimerList::iterator it; + for(it = m_timerList.begin(); it != m_timerList.end(); ++it) + { + SVGTimer *cur = *it; + if(*cur == senderTimer) + { + svgTimer = cur; + break; + } + } + + if(!svgTimer) + { + svgTimer = (*m_intervalTimer == senderTimer) ? m_intervalTimer : 0; + + if(!svgTimer) + return; + } + + svgTimer->notifyAll(); + + // Animations need direct updates + if(m_doc->canvas()) + m_doc->canvas()->update(); + emit m_doc->finishedRendering(); + + if(svgTimer->singleShot()) + { + m_timerList.remove(svgTimer); + delete svgTimer; + } + + // The singleShot timers of ie. with begin="3s" are notified + // by the previous call, and now all connections to the interval timer + // are created and now we just need to fire that timer (Niko) + if(svgTimer != m_intervalTimer && !m_intervalTimer->isActive()) + m_intervalTimer->start(this, TQT_SLOT(slotTimerNotify())); +} + +float SVGTimeScheduler::elapsed() const +{ + return float(m_creationTime.elapsed()) / 1000.0; +} diff --git a/ksvg/impl/SVGTitleElementImpl.cc b/ksvg/impl/SVGTitleElementImpl.cc deleted file mode 100644 index 838f27fe..00000000 --- a/ksvg/impl/SVGTitleElementImpl.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGDocumentImpl.h" -#include "SVGTitleElementImpl.h" - -using namespace KSVG; - -SVGTitleElementImpl::SVGTitleElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGLangSpaceImpl(), SVGStylableImpl(this) -{ -} - -SVGTitleElementImpl::~SVGTitleElementImpl() -{ -} - -void SVGTitleElementImpl::createItem(KSVGCanvas *) -{ - emit ownerDoc()->gotTitle(collectText()); -} diff --git a/ksvg/impl/SVGTitleElementImpl.cpp b/ksvg/impl/SVGTitleElementImpl.cpp new file mode 100644 index 00000000..838f27fe --- /dev/null +++ b/ksvg/impl/SVGTitleElementImpl.cpp @@ -0,0 +1,37 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGDocumentImpl.h" +#include "SVGTitleElementImpl.h" + +using namespace KSVG; + +SVGTitleElementImpl::SVGTitleElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGLangSpaceImpl(), SVGStylableImpl(this) +{ +} + +SVGTitleElementImpl::~SVGTitleElementImpl() +{ +} + +void SVGTitleElementImpl::createItem(KSVGCanvas *) +{ + emit ownerDoc()->gotTitle(collectText()); +} diff --git a/ksvg/impl/SVGTransformImpl.cc b/ksvg/impl/SVGTransformImpl.cc deleted file mode 100644 index dba50b09..00000000 --- a/ksvg/impl/SVGTransformImpl.cc +++ /dev/null @@ -1,238 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGTransform.h" - -#include "SVGMatrixImpl.h" -#include "SVGTransformImpl.h" -#include "SVGSVGElementImpl.h" - -using namespace KSVG; - -#include "SVGTransformImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_cacheimpl.h" - -SVGTransformImpl::SVGTransformImpl() -{ - m_matrix = SVGSVGElementImpl::createSVGMatrix(); - - m_type = SVG_TRANSFORM_UNKNOWN; - m_angle = 0; -} - -SVGTransformImpl::~SVGTransformImpl() -{ - if(m_matrix) - m_matrix->deref(); -} - -unsigned short SVGTransformImpl::type() const -{ - return m_type; -} - -SVGMatrixImpl *SVGTransformImpl::matrix() const -{ - return m_matrix; -} - -double SVGTransformImpl::angle() const -{ - return m_angle; -} - -void SVGTransformImpl::setMatrix(SVGMatrixImpl *matrix) -{ - if(!matrix) - return; - - m_type = SVG_TRANSFORM_MATRIX; - m_angle = 0; - - m_matrix->deref(); - m_matrix = matrix; - m_matrix->ref(); -} - -void SVGTransformImpl::setTranslate(double tx, double ty) -{ - m_type = SVG_TRANSFORM_TRANSLATE; - m_angle = 0; - m_matrix->reset(); - m_matrix->translate(tx, ty); -} - -void SVGTransformImpl::setScale(double sx, double sy) -{ - m_type = SVG_TRANSFORM_SCALE; - m_angle = 0; - m_matrix->reset(); - m_matrix->scaleNonUniform(sx, sy); -} - -void SVGTransformImpl::setRotate(double angle, double cx, double cy) -{ - m_type = SVG_TRANSFORM_ROTATE; - // mop: evil...fix that...needed to make toString() work correctly - m_cx = cx; - m_cy = cy; - m_angle = angle; - m_matrix->reset(); - m_matrix->translate(cx, cy); - m_matrix->rotate(angle); - m_matrix->translate(-cx, -cy); -} - -void SVGTransformImpl::setSkewX(double angle) -{ - m_type = SVG_TRANSFORM_SKEWX; - m_angle = angle; - m_matrix->reset(); - m_matrix->skewX(angle); -} - -void SVGTransformImpl::setSkewY(double angle) -{ - m_type = SVG_TRANSFORM_SKEWY; - m_angle = angle; - m_matrix->reset(); - m_matrix->skewY(angle); -} - -TQString SVGTransformImpl::toString() const -{ - switch (m_type) - { - case SVG_TRANSFORM_UNKNOWN: - return TQString(); - case SVG_TRANSFORM_MATRIX: - return TQString("matrix(" + TQString::number(m_matrix->a()) + " " + TQString::number(m_matrix->b()) + " " + TQString::number(m_matrix->c()) + " " + TQString::number(m_matrix->d()) + " " + TQString::number(m_matrix->e()) + " " + TQString::number(m_matrix->f()) + ")"); - case SVG_TRANSFORM_TRANSLATE: - return TQString("translate(" + TQString::number(m_matrix->e()) + " " + TQString::number(m_matrix->f()) + ")"); - case SVG_TRANSFORM_SCALE: - return TQString("scale(" + TQString::number(m_matrix->a()) + " " + TQString::number(m_matrix->d()) + ")"); - case SVG_TRANSFORM_ROTATE: - return TQString("rotate(" + TQString::number(m_angle) + " " + TQString::number(m_cx) + " " + TQString::number(m_cy) + ")"); - case SVG_TRANSFORM_SKEWX: - return TQString("skewX(" + TQString::number(m_angle) + ")"); - case SVG_TRANSFORM_SKEWY: - return TQString("skewY(" + TQString::number(m_angle) + ")"); - default: - kdWarning() << "Unknown transform type " << m_type << endl; - return TQString(); - } -} - -// ECMA binding - -/* -@namespace KSVG -@begin SVGTransformImpl::s_hashTable 5 - type SVGTransformImpl::Type DontDelete|ReadOnly - matrix SVGTransformImpl::Matrix DontDelete|ReadOnly - angle SVGTransformImpl::Angle DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGTransformImplProto::s_hashTable 7 - setMatrix SVGTransformImpl::SetMatrix DontDelete|Function 1 - setTranslate SVGTransformImpl::SetTranslate DontDelete|Function 2 - setScale SVGTransformImpl::SetScale DontDelete|Function 2 - setRotate SVGTransformImpl::SetRotate DontDelete|Function 3 - setSkewX SVGTransformImpl::SetSkewX DontDelete|Function 1 - setSkewY SVGTransformImpl::SetSkewY DontDelete|Function 1 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGTransform", SVGTransformImplProto, SVGTransformImplProtoFunc) - -Value SVGTransformImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case Type: - return Number(m_type); - case Matrix: - return m_matrix->cache(exec); - case Angle: - return Number(m_angle); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -Value SVGTransformImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGTransformImpl) - - switch(id) - { - case SVGTransformImpl::SetMatrix: - obj->setMatrix(static_cast *>(args[0].imp())->impl()); - break; - case SVGTransformImpl::SetTranslate: - obj->setTranslate(args[0].toNumber(exec), args[1].toNumber(exec)); - break; - case SVGTransformImpl::SetScale: - obj->setScale(args[0].toNumber(exec), args[1].toNumber(exec)); - break; - case SVGTransformImpl::SetRotate: - obj->setRotate(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec)); - break; - case SVGTransformImpl::SetSkewX: - obj->setSkewX(args[0].toNumber(exec)); - break; - case SVGTransformImpl::SetSkewY: - obj->setSkewY(args[0].toNumber(exec)); - break; - default: - kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; - break; - } - - return Undefined(); -} - -/* -@namespace KSVG -@begin SVGTransformImplConstructor::s_hashTable 11 - SVG_TRANSFORM_UNKNOWN KSVG::SVG_TRANSFORM_UNKNOWN DontDelete|ReadOnly - SVG_TRANSFORM_MATRIX KSVG::SVG_TRANSFORM_MATRIX DontDelete|ReadOnly - SVG_TRANSFORM_TRANSLATE KSVG::SVG_TRANSFORM_TRANSLATE DontDelete|ReadOnly - SVG_TRANSFORM_SCALE KSVG::SVG_TRANSFORM_SCALE DontDelete|ReadOnly - SVG_TRANSFORM_ROTATE KSVG::SVG_TRANSFORM_ROTATE DontDelete|ReadOnly - SVG_TRANSFORM_SKEWX KSVG::SVG_TRANSFORM_SKEWX DontDelete|ReadOnly - SVG_TRANSFORM_SKEWY KSVG::SVG_TRANSFORM_SKEWY DontDelete|ReadOnly -@end -*/ - -Value SVGTransformImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGTransformImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgtransform.constructor]]"); -} diff --git a/ksvg/impl/SVGTransformImpl.cpp b/ksvg/impl/SVGTransformImpl.cpp new file mode 100644 index 00000000..dba50b09 --- /dev/null +++ b/ksvg/impl/SVGTransformImpl.cpp @@ -0,0 +1,238 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGTransform.h" + +#include "SVGMatrixImpl.h" +#include "SVGTransformImpl.h" +#include "SVGSVGElementImpl.h" + +using namespace KSVG; + +#include "SVGTransformImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_cacheimpl.h" + +SVGTransformImpl::SVGTransformImpl() +{ + m_matrix = SVGSVGElementImpl::createSVGMatrix(); + + m_type = SVG_TRANSFORM_UNKNOWN; + m_angle = 0; +} + +SVGTransformImpl::~SVGTransformImpl() +{ + if(m_matrix) + m_matrix->deref(); +} + +unsigned short SVGTransformImpl::type() const +{ + return m_type; +} + +SVGMatrixImpl *SVGTransformImpl::matrix() const +{ + return m_matrix; +} + +double SVGTransformImpl::angle() const +{ + return m_angle; +} + +void SVGTransformImpl::setMatrix(SVGMatrixImpl *matrix) +{ + if(!matrix) + return; + + m_type = SVG_TRANSFORM_MATRIX; + m_angle = 0; + + m_matrix->deref(); + m_matrix = matrix; + m_matrix->ref(); +} + +void SVGTransformImpl::setTranslate(double tx, double ty) +{ + m_type = SVG_TRANSFORM_TRANSLATE; + m_angle = 0; + m_matrix->reset(); + m_matrix->translate(tx, ty); +} + +void SVGTransformImpl::setScale(double sx, double sy) +{ + m_type = SVG_TRANSFORM_SCALE; + m_angle = 0; + m_matrix->reset(); + m_matrix->scaleNonUniform(sx, sy); +} + +void SVGTransformImpl::setRotate(double angle, double cx, double cy) +{ + m_type = SVG_TRANSFORM_ROTATE; + // mop: evil...fix that...needed to make toString() work correctly + m_cx = cx; + m_cy = cy; + m_angle = angle; + m_matrix->reset(); + m_matrix->translate(cx, cy); + m_matrix->rotate(angle); + m_matrix->translate(-cx, -cy); +} + +void SVGTransformImpl::setSkewX(double angle) +{ + m_type = SVG_TRANSFORM_SKEWX; + m_angle = angle; + m_matrix->reset(); + m_matrix->skewX(angle); +} + +void SVGTransformImpl::setSkewY(double angle) +{ + m_type = SVG_TRANSFORM_SKEWY; + m_angle = angle; + m_matrix->reset(); + m_matrix->skewY(angle); +} + +TQString SVGTransformImpl::toString() const +{ + switch (m_type) + { + case SVG_TRANSFORM_UNKNOWN: + return TQString(); + case SVG_TRANSFORM_MATRIX: + return TQString("matrix(" + TQString::number(m_matrix->a()) + " " + TQString::number(m_matrix->b()) + " " + TQString::number(m_matrix->c()) + " " + TQString::number(m_matrix->d()) + " " + TQString::number(m_matrix->e()) + " " + TQString::number(m_matrix->f()) + ")"); + case SVG_TRANSFORM_TRANSLATE: + return TQString("translate(" + TQString::number(m_matrix->e()) + " " + TQString::number(m_matrix->f()) + ")"); + case SVG_TRANSFORM_SCALE: + return TQString("scale(" + TQString::number(m_matrix->a()) + " " + TQString::number(m_matrix->d()) + ")"); + case SVG_TRANSFORM_ROTATE: + return TQString("rotate(" + TQString::number(m_angle) + " " + TQString::number(m_cx) + " " + TQString::number(m_cy) + ")"); + case SVG_TRANSFORM_SKEWX: + return TQString("skewX(" + TQString::number(m_angle) + ")"); + case SVG_TRANSFORM_SKEWY: + return TQString("skewY(" + TQString::number(m_angle) + ")"); + default: + kdWarning() << "Unknown transform type " << m_type << endl; + return TQString(); + } +} + +// ECMA binding + +/* +@namespace KSVG +@begin SVGTransformImpl::s_hashTable 5 + type SVGTransformImpl::Type DontDelete|ReadOnly + matrix SVGTransformImpl::Matrix DontDelete|ReadOnly + angle SVGTransformImpl::Angle DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGTransformImplProto::s_hashTable 7 + setMatrix SVGTransformImpl::SetMatrix DontDelete|Function 1 + setTranslate SVGTransformImpl::SetTranslate DontDelete|Function 2 + setScale SVGTransformImpl::SetScale DontDelete|Function 2 + setRotate SVGTransformImpl::SetRotate DontDelete|Function 3 + setSkewX SVGTransformImpl::SetSkewX DontDelete|Function 1 + setSkewY SVGTransformImpl::SetSkewY DontDelete|Function 1 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGTransform", SVGTransformImplProto, SVGTransformImplProtoFunc) + +Value SVGTransformImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case Type: + return Number(m_type); + case Matrix: + return m_matrix->cache(exec); + case Angle: + return Number(m_angle); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +Value SVGTransformImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGTransformImpl) + + switch(id) + { + case SVGTransformImpl::SetMatrix: + obj->setMatrix(static_cast *>(args[0].imp())->impl()); + break; + case SVGTransformImpl::SetTranslate: + obj->setTranslate(args[0].toNumber(exec), args[1].toNumber(exec)); + break; + case SVGTransformImpl::SetScale: + obj->setScale(args[0].toNumber(exec), args[1].toNumber(exec)); + break; + case SVGTransformImpl::SetRotate: + obj->setRotate(args[0].toNumber(exec), args[1].toNumber(exec), args[2].toNumber(exec)); + break; + case SVGTransformImpl::SetSkewX: + obj->setSkewX(args[0].toNumber(exec)); + break; + case SVGTransformImpl::SetSkewY: + obj->setSkewY(args[0].toNumber(exec)); + break; + default: + kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl; + break; + } + + return Undefined(); +} + +/* +@namespace KSVG +@begin SVGTransformImplConstructor::s_hashTable 11 + SVG_TRANSFORM_UNKNOWN KSVG::SVG_TRANSFORM_UNKNOWN DontDelete|ReadOnly + SVG_TRANSFORM_MATRIX KSVG::SVG_TRANSFORM_MATRIX DontDelete|ReadOnly + SVG_TRANSFORM_TRANSLATE KSVG::SVG_TRANSFORM_TRANSLATE DontDelete|ReadOnly + SVG_TRANSFORM_SCALE KSVG::SVG_TRANSFORM_SCALE DontDelete|ReadOnly + SVG_TRANSFORM_ROTATE KSVG::SVG_TRANSFORM_ROTATE DontDelete|ReadOnly + SVG_TRANSFORM_SKEWX KSVG::SVG_TRANSFORM_SKEWX DontDelete|ReadOnly + SVG_TRANSFORM_SKEWY KSVG::SVG_TRANSFORM_SKEWY DontDelete|ReadOnly +@end +*/ + +Value SVGTransformImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGTransformImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgtransform.constructor]]"); +} diff --git a/ksvg/impl/SVGTransformListImpl.cc b/ksvg/impl/SVGTransformListImpl.cc deleted file mode 100644 index 18e737b5..00000000 --- a/ksvg/impl/SVGTransformListImpl.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGMatrixImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGTransformListImpl.h" - -using namespace KSVG; - -#include "SVGTransformListImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGTransformListImpl::s_hashTable 2 - numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly -@end -@namespace KSVG -@begin SVGTransformListImplProto::s_hashTable 11 - getItem SVGListDefs::GetItem DontDelete|Function 1 - removeItem SVGListDefs::RemoveItem DontDelete|Function 1 - appendItem SVGListDefs::AppendItem DontDelete|Function 1 - initialize SVGListDefs::Initialize DontDelete|Function 1 - insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 - replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 - clear SVGListDefs::Clear DontDelete|Function 0 -@end -*/ - -KSVG_IMPLEMENT_PROTOTYPE("SVGTransformList", SVGTransformListImplProto, SVGTransformListImplProtoFunc) - -Value SVGTransformListImpl::getValueProperty(ExecState *exec, int token) const -{ - return SVGList::getValueProperty(exec, token); -} - -Value SVGTransformListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) -{ - KSVG_CHECK_THIS(SVGTransformListImpl) - - return obj->call(exec, static_cast *>(obj), args, id); -} - -SVGTransformImpl *SVGTransformListImpl::consolidate() -{ - SVGTransformImpl *trans = 0; - - if(numberOfItems()>0) - { - trans = SVGSVGElementImpl::createSVGTransform(); - SVGMatrixImpl *matrix = SVGSVGElementImpl::createSVGMatrix(); - - for(unsigned int i = 0; i < numberOfItems(); i++) - matrix->multiply(getItem(i)->matrix()); - - // Pedantic - sets type to MATRIX as per spec. - trans->setMatrix(matrix); - matrix->deref(); - initialize(trans); - trans->ref(); - } - - return trans; -} - -SVGMatrixImpl *SVGTransformListImpl::concatenate() const -{ - SVGMatrixImpl *matrix = 0; - - if(numberOfItems()>0) - { - matrix = SVGSVGElementImpl::createSVGMatrix(); - - for(unsigned int i = 0; i < numberOfItems(); i++) - matrix->multiply(getItem(i)->matrix()); - } - - return matrix; -} diff --git a/ksvg/impl/SVGTransformListImpl.cpp b/ksvg/impl/SVGTransformListImpl.cpp new file mode 100644 index 00000000..18e737b5 --- /dev/null +++ b/ksvg/impl/SVGTransformListImpl.cpp @@ -0,0 +1,101 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGMatrixImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGTransformListImpl.h" + +using namespace KSVG; + +#include "SVGTransformListImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGTransformListImpl::s_hashTable 2 + numberOfItems SVGListDefs::NumberOfItems DontDelete|ReadOnly +@end +@namespace KSVG +@begin SVGTransformListImplProto::s_hashTable 11 + getItem SVGListDefs::GetItem DontDelete|Function 1 + removeItem SVGListDefs::RemoveItem DontDelete|Function 1 + appendItem SVGListDefs::AppendItem DontDelete|Function 1 + initialize SVGListDefs::Initialize DontDelete|Function 1 + insertItemBefore SVGListDefs::InsertItemBefore DontDelete|Function 2 + replaceItem SVGListDefs::ReplaceItem DontDelete|Function 2 + clear SVGListDefs::Clear DontDelete|Function 0 +@end +*/ + +KSVG_IMPLEMENT_PROTOTYPE("SVGTransformList", SVGTransformListImplProto, SVGTransformListImplProtoFunc) + +Value SVGTransformListImpl::getValueProperty(ExecState *exec, int token) const +{ + return SVGList::getValueProperty(exec, token); +} + +Value SVGTransformListImplProtoFunc::call(ExecState *exec, Object &thisObj, const List &args) +{ + KSVG_CHECK_THIS(SVGTransformListImpl) + + return obj->call(exec, static_cast *>(obj), args, id); +} + +SVGTransformImpl *SVGTransformListImpl::consolidate() +{ + SVGTransformImpl *trans = 0; + + if(numberOfItems()>0) + { + trans = SVGSVGElementImpl::createSVGTransform(); + SVGMatrixImpl *matrix = SVGSVGElementImpl::createSVGMatrix(); + + for(unsigned int i = 0; i < numberOfItems(); i++) + matrix->multiply(getItem(i)->matrix()); + + // Pedantic - sets type to MATRIX as per spec. + trans->setMatrix(matrix); + matrix->deref(); + initialize(trans); + trans->ref(); + } + + return trans; +} + +SVGMatrixImpl *SVGTransformListImpl::concatenate() const +{ + SVGMatrixImpl *matrix = 0; + + if(numberOfItems()>0) + { + matrix = SVGSVGElementImpl::createSVGMatrix(); + + for(unsigned int i = 0; i < numberOfItems(); i++) + matrix->multiply(getItem(i)->matrix()); + } + + return matrix; +} diff --git a/ksvg/impl/SVGTransformableImpl.cc b/ksvg/impl/SVGTransformableImpl.cc deleted file mode 100644 index 6d9e4055..00000000 --- a/ksvg/impl/SVGTransformableImpl.cc +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGMatrixImpl.h" -#include "SVGHelperImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGTransformableImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGAnimatedTransformListImpl.h" -#include "SVGElementImpl.h" -#include "SVGDocumentImpl.h" - -using namespace KSVG; - -#include "SVGTransformableImpl.lut.h" -#include "ksvg_bridge.h" - -SVGTransformableImpl::SVGTransformableImpl() : SVGLocatableImpl() -{ - KSVG_EMPTY_FLAGS - - m_transform = new SVGAnimatedTransformListImpl(); - m_transform->ref(); - - m_localMatrix = 0; -} - -SVGTransformableImpl::SVGTransformableImpl(const SVGTransformableImpl &other) : SVGLocatableImpl() -{ - (*this) = other; -} - -SVGTransformableImpl::~SVGTransformableImpl() -{ - if(m_transform) - m_transform->deref(); - if(m_localMatrix) - m_localMatrix->deref(); -} - -SVGTransformableImpl &SVGTransformableImpl::operator=(const SVGTransformableImpl &other) -{ - SVGTransformListImpl *otherTransform = other.m_transform->baseVal(); - - // Concat computed values - for(unsigned int i = 0;i < otherTransform->numberOfItems(); i++) - { - SVGTransformImpl *trafo = otherTransform->getItem(i); - m_transform->baseVal()->insertItemBefore(SVGSVGElementImpl::createSVGTransformFromMatrix(trafo->matrix()), i); - } - - return *this; -} - -SVGAnimatedTransformListImpl *SVGTransformableImpl::transform() const -{ - return m_transform; -} - -SVGMatrixImpl *SVGTransformableImpl::getCTM() -{ - SVGMatrixImpl *ctm = SVGSVGElementImpl::createSVGMatrix(); - - SVGElementImpl *element = dynamic_cast(this); - Q_ASSERT(element); - - DOM::Node parentNde = element->parentNode(); - - if(!parentNde.isNull() && parentNde.nodeType() != DOM::Node::DOCUMENT_NODE) - { - SVGElementImpl *parent = element->ownerDoc()->getElementFromHandle(parentNde.handle()); - SVGLocatableImpl *locatableParent = dynamic_cast(parent); - - if(locatableParent) - { - SVGMatrixImpl *parentCTM = locatableParent->getCTM(); - ctm->multiply(parentCTM); - parentCTM->deref(); - } - } - - if(m_localMatrix) - { - ctm->multiply(m_localMatrix); - } - - return ctm; -} - -void SVGTransformableImpl::updateLocalMatrix() -{ - if(m_transform->baseVal()->numberOfItems()>0) - { - if(m_localMatrix) - m_localMatrix->deref(); - - m_localMatrix = m_transform->baseVal()->concatenate(); - } - else - { - if(m_localMatrix) - { - m_localMatrix->deref(); - m_localMatrix = 0; - } - } - - invalidateCachedMatrices(); -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGTransformableImpl::s_hashTable 2 - transform SVGTransformableImpl::Transform DontDelete -@end -*/ - -Value SVGTransformableImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case Transform: - return m_transform->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGTransformableImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Transform: - SVGHelperImpl::parseTransformAttribute(m_transform->baseVal(), value.toString(exec).qstring()); - updateLocalMatrix(); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGTransformableImpl.cpp b/ksvg/impl/SVGTransformableImpl.cpp new file mode 100644 index 00000000..6d9e4055 --- /dev/null +++ b/ksvg/impl/SVGTransformableImpl.cpp @@ -0,0 +1,167 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGMatrixImpl.h" +#include "SVGHelperImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGTransformableImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGAnimatedTransformListImpl.h" +#include "SVGElementImpl.h" +#include "SVGDocumentImpl.h" + +using namespace KSVG; + +#include "SVGTransformableImpl.lut.h" +#include "ksvg_bridge.h" + +SVGTransformableImpl::SVGTransformableImpl() : SVGLocatableImpl() +{ + KSVG_EMPTY_FLAGS + + m_transform = new SVGAnimatedTransformListImpl(); + m_transform->ref(); + + m_localMatrix = 0; +} + +SVGTransformableImpl::SVGTransformableImpl(const SVGTransformableImpl &other) : SVGLocatableImpl() +{ + (*this) = other; +} + +SVGTransformableImpl::~SVGTransformableImpl() +{ + if(m_transform) + m_transform->deref(); + if(m_localMatrix) + m_localMatrix->deref(); +} + +SVGTransformableImpl &SVGTransformableImpl::operator=(const SVGTransformableImpl &other) +{ + SVGTransformListImpl *otherTransform = other.m_transform->baseVal(); + + // Concat computed values + for(unsigned int i = 0;i < otherTransform->numberOfItems(); i++) + { + SVGTransformImpl *trafo = otherTransform->getItem(i); + m_transform->baseVal()->insertItemBefore(SVGSVGElementImpl::createSVGTransformFromMatrix(trafo->matrix()), i); + } + + return *this; +} + +SVGAnimatedTransformListImpl *SVGTransformableImpl::transform() const +{ + return m_transform; +} + +SVGMatrixImpl *SVGTransformableImpl::getCTM() +{ + SVGMatrixImpl *ctm = SVGSVGElementImpl::createSVGMatrix(); + + SVGElementImpl *element = dynamic_cast(this); + Q_ASSERT(element); + + DOM::Node parentNde = element->parentNode(); + + if(!parentNde.isNull() && parentNde.nodeType() != DOM::Node::DOCUMENT_NODE) + { + SVGElementImpl *parent = element->ownerDoc()->getElementFromHandle(parentNde.handle()); + SVGLocatableImpl *locatableParent = dynamic_cast(parent); + + if(locatableParent) + { + SVGMatrixImpl *parentCTM = locatableParent->getCTM(); + ctm->multiply(parentCTM); + parentCTM->deref(); + } + } + + if(m_localMatrix) + { + ctm->multiply(m_localMatrix); + } + + return ctm; +} + +void SVGTransformableImpl::updateLocalMatrix() +{ + if(m_transform->baseVal()->numberOfItems()>0) + { + if(m_localMatrix) + m_localMatrix->deref(); + + m_localMatrix = m_transform->baseVal()->concatenate(); + } + else + { + if(m_localMatrix) + { + m_localMatrix->deref(); + m_localMatrix = 0; + } + } + + invalidateCachedMatrices(); +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGTransformableImpl::s_hashTable 2 + transform SVGTransformableImpl::Transform DontDelete +@end +*/ + +Value SVGTransformableImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case Transform: + return m_transform->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGTransformableImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Transform: + SVGHelperImpl::parseTransformAttribute(m_transform->baseVal(), value.toString(exec).qstring()); + updateLocalMatrix(); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGURIReferenceImpl.cc b/ksvg/impl/SVGURIReferenceImpl.cc deleted file mode 100644 index 0d634e13..00000000 --- a/ksvg/impl/SVGURIReferenceImpl.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGURIReferenceImpl.h" -#include "SVGAnimatedStringImpl.h" - -using namespace KSVG; - -#include "SVGURIReferenceImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" - -SVGURIReferenceImpl::SVGURIReferenceImpl() -{ - KSVG_EMPTY_FLAGS - - m_href = new SVGAnimatedStringImpl(); - m_href->ref(); -} - -SVGURIReferenceImpl::~SVGURIReferenceImpl() -{ - if(m_href) - m_href->deref(); -} - -SVGAnimatedStringImpl *SVGURIReferenceImpl::href() const -{ - return m_href; -} - -bool SVGURIReferenceImpl::parseURIReference(const TQString &urireference, TQString &uri, TQString &elementreference) -{ - int seperator = urireference.find("#"); - - if(seperator == -1) - return false; - - uri = urireference.left(seperator); - elementreference = urireference.mid(seperator + 1); - - return true; -} - -bool SVGURIReferenceImpl::isUrl(const TQString &url) -{ - TQString temp = url.stripWhiteSpace(); - return temp.startsWith("url(#") && temp.endsWith(")"); -} - -TQString SVGURIReferenceImpl::getTarget(const TQString &url) -{ - if(url.startsWith("url(")) // URI References, ie. fill:url(#target) - { - unsigned int start = url.find("#") + 1; - unsigned int end = url.findRev(")"); - - return url.mid(start, end - start); - } - else if(url.find("#") > -1) // format is #target - { - unsigned int start = url.find("#") + 1; - - return url.mid(start, url.length() - start); - } - else // Normal Reference, ie. style="color-profile:changeColor" - return url; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGURIReferenceImpl::s_hashTable 2 - href SVGURIReferenceImpl::Href DontDelete|ReadOnly -@end -*/ - -Value SVGURIReferenceImpl::getValueProperty(ExecState *exec, int token) const -{ - switch(token) - { - case Href: - return m_href->cache(exec); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGURIReferenceImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case Href: - { - if(m_href) - m_href->deref(); - - SVGAnimatedStringImpl *temp = new SVGAnimatedStringImpl(); - temp->ref(); - temp->setBaseVal(value.toString(exec).string()); - m_href = temp; - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGURIReferenceImpl.cpp b/ksvg/impl/SVGURIReferenceImpl.cpp new file mode 100644 index 00000000..0d634e13 --- /dev/null +++ b/ksvg/impl/SVGURIReferenceImpl.cpp @@ -0,0 +1,133 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGURIReferenceImpl.h" +#include "SVGAnimatedStringImpl.h" + +using namespace KSVG; + +#include "SVGURIReferenceImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" + +SVGURIReferenceImpl::SVGURIReferenceImpl() +{ + KSVG_EMPTY_FLAGS + + m_href = new SVGAnimatedStringImpl(); + m_href->ref(); +} + +SVGURIReferenceImpl::~SVGURIReferenceImpl() +{ + if(m_href) + m_href->deref(); +} + +SVGAnimatedStringImpl *SVGURIReferenceImpl::href() const +{ + return m_href; +} + +bool SVGURIReferenceImpl::parseURIReference(const TQString &urireference, TQString &uri, TQString &elementreference) +{ + int seperator = urireference.find("#"); + + if(seperator == -1) + return false; + + uri = urireference.left(seperator); + elementreference = urireference.mid(seperator + 1); + + return true; +} + +bool SVGURIReferenceImpl::isUrl(const TQString &url) +{ + TQString temp = url.stripWhiteSpace(); + return temp.startsWith("url(#") && temp.endsWith(")"); +} + +TQString SVGURIReferenceImpl::getTarget(const TQString &url) +{ + if(url.startsWith("url(")) // URI References, ie. fill:url(#target) + { + unsigned int start = url.find("#") + 1; + unsigned int end = url.findRev(")"); + + return url.mid(start, end - start); + } + else if(url.find("#") > -1) // format is #target + { + unsigned int start = url.find("#") + 1; + + return url.mid(start, url.length() - start); + } + else // Normal Reference, ie. style="color-profile:changeColor" + return url; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGURIReferenceImpl::s_hashTable 2 + href SVGURIReferenceImpl::Href DontDelete|ReadOnly +@end +*/ + +Value SVGURIReferenceImpl::getValueProperty(ExecState *exec, int token) const +{ + switch(token) + { + case Href: + return m_href->cache(exec); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGURIReferenceImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case Href: + { + if(m_href) + m_href->deref(); + + SVGAnimatedStringImpl *temp = new SVGAnimatedStringImpl(); + temp->ref(); + temp->setBaseVal(value.toString(exec).string()); + m_href = temp; + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGUseElementImpl.cc b/ksvg/impl/SVGUseElementImpl.cc deleted file mode 100644 index b7f36be5..00000000 --- a/ksvg/impl/SVGUseElementImpl.cc +++ /dev/null @@ -1,407 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "KSVGLoader.h" -#include "KSVGCanvas.h" - -#include "SVGRectImpl.h" -#include "SVGEventImpl.h" -#include "SVGHelperImpl.h" -#include "SVGMatrixImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGTransformImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGUseElementImpl.h" -#include "SVGSymbolElementImpl.h" -#include "SVGTransformListImpl.h" -#include "SVGAnimatedStringImpl.h" -#include "SVGAnimatedLengthImpl.h" -#include "SVGElementInstanceImpl.h" -#include "SVGAnimatedTransformListImpl.h" - -using namespace KSVG; - -#include "SVGUseElementImpl.lut.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGUseElementImpl::SVGUseElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() -{ - KSVG_EMPTY_FLAGS - - m_x = new SVGAnimatedLengthImpl(); - m_x->ref(); - - m_y = new SVGAnimatedLengthImpl(); - m_y->ref(); - - m_width = new SVGAnimatedLengthImpl(); - m_width->ref(); - - m_height = new SVGAnimatedLengthImpl(); - m_height->ref(); - - m_instanceRoot = 0; -} - -SVGUseElementImpl::~SVGUseElementImpl() -{ - if(m_x) - m_x->deref(); - if(m_y) - m_y->deref(); - if(m_width) - m_width->deref(); - if(m_height) - m_height->deref(); - if(m_instanceRoot) - m_instanceRoot->deref(); -} - -SVGAnimatedLengthImpl *SVGUseElementImpl::x() const -{ - return m_x; -} - -SVGAnimatedLengthImpl *SVGUseElementImpl::y() const -{ - return m_y; -} - -SVGAnimatedLengthImpl *SVGUseElementImpl::width() const -{ - return m_width; -} - -SVGAnimatedLengthImpl *SVGUseElementImpl::height() const -{ - return m_height; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGUseElementImpl::s_hashTable 11 - x SVGUseElementImpl::X DontDelete|ReadOnly - y SVGUseElementImpl::Y DontDelete|ReadOnly - width SVGUseElementImpl::Width DontDelete|ReadOnly - height SVGUseElementImpl::Height DontDelete|ReadOnly - href SVGUseElementImpl::Href DontDelete|ReadOnly - instanceRoot SVGUseElementImpl::InstanceRoot DontDelete|ReadOnly - animatedInstanceRoot SVGUseElementImpl::AnimatedInstanceRoot DontDelete|ReadOnly -@end -*/ - -Value SVGUseElementImpl::getValueProperty(ExecState *exec, int token) const -{ - KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case X: - if(!attributeMode) - return m_x->cache(exec); - else - return Number(m_x->baseVal()->value()); - case Y: - if(!attributeMode) - return m_y->cache(exec); - else - return Number(m_y->baseVal()->value()); - case Width: - if(!attributeMode) - return m_width->cache(exec); - else - return Number(m_width->baseVal()->value()); - case Height: - if(!attributeMode) - return m_height->cache(exec); - else - return Number(m_height->baseVal()->value()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGUseElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case X: - x()->baseVal()->setValue(value.toNumber(exec)); - break; - case Y: - y()->baseVal()->setValue(value.toNumber(exec)); - break; - case Width: - width()->baseVal()->setValue(value.toNumber(exec)); - break; - case Height: - height()->baseVal()->setValue(value.toNumber(exec)); - break; - case Href: - { - TQString url = value.toString(exec).qstring(); - href()->setBaseVal(SVGURIReferenceImpl::getTarget(url)); - break; - } - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -SVGRectImpl *SVGUseElementImpl::getBBox() -{ - if(m_instanceRoot) - { - SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); - if(KSVG_TOKEN_NOT_PARSED(Width) && KSVG_TOKEN_NOT_PARSED(Height) && shape) - return shape->getBBox(); - } - - SVGRectImpl *ret = new SVGRectImpl(); - ret->ref(); - ret->setX(m_x->baseVal()->value()); - ret->setY(m_y->baseVal()->value()); - ret->setWidth(m_width->baseVal()->value()); - ret->setHeight(m_height->baseVal()->value()); - return ret; -} - -SVGElementInstanceImpl *SVGUseElementImpl::instanceRoot() const -{ - return m_instanceRoot; -} - -SVGElementInstanceImpl *SVGUseElementImpl::animatedInstanceRoot() const -{ - return m_animatedInstanceRoot; -} - -void SVGUseElementImpl::createItem(KSVGCanvas *c) -{ - if(!m_instanceRoot) - { - // ownerSVGElement()->getElementById() is wrong here. - // It could reference elements from other documents when using getURL (Niko) - TQString filename, id; - DOM::DOMString url = getAttribute("href"); - if(!SVGURIReferenceImpl::parseURIReference(url.string(), filename, id)) - return; - - SVGElementImpl *orig; - if(!filename.isEmpty()) - { - KURL fragmentUrl(ownerDoc()->baseUrl(), url.string()); - - id = fragmentUrl.ref(); - fragmentUrl.setRef(TQString()); - - orig = KSVGLoader::getSVGFragment(fragmentUrl, ownerDoc(), id); - } - else - { - orig = ownerDoc()->getElementByIdRecursive(ownerSVGElement(), href()->baseVal()); - - if(orig == 0) - { - // The document will try to create this item again once the parsing has finished. - ownerDoc()->addForwardReferencingUseElement(this); - } - } - - if(orig == 0) - return; - - setReferencedElement(orig); - - // Create a parent, a - SVGElementImpl *parent = 0; - DOM::Element impl = static_cast(ownerDoc())->createElement("g"); - parent = SVGDocumentImpl::createElement("g", impl, ownerDoc()); - SVGElementImpl *clone = orig->cloneNode(true); - - // Apply the use-correction - TQString trans; - trans += " translate("; - trans += TQString::number(x()->baseVal()->value()); - trans += " "; - trans += TQString::number(y()->baseVal()->value()); - trans += ")"; - - // Apply the transform attribute and render the element - parent->setAttributeInternal("transform", trans); - parent->setAttribute("transform", trans); - - // Apply width/height if symbol - if(dynamic_cast(clone)) - { - DOM::Element impl = static_cast(ownerDoc())->createElement("svg"); - SVGElementImpl *symbolSvg = SVGDocumentImpl::createElement("svg", impl, ownerDoc()); - - SVGHelperImpl::copyAttributes(orig, symbolSvg); - - symbolSvg->setAttribute("width", getAttribute("width")); - symbolSvg->setAttributeInternal("width", getAttribute("width")); - symbolSvg->setAttribute("height", getAttribute("height")); - symbolSvg->setAttributeInternal("height", getAttribute("height")); - DOM::Node node = clone->firstChild(); - for(; !node.isNull(); node = clone->firstChild()) - symbolSvg->appendChild(node); - - clone = symbolSvg; - } - else if(dynamic_cast(clone)) - { - if(!getAttribute("width").isEmpty()) - { - clone->setAttribute("width", getAttribute("width")); - clone->setAttributeInternal("width", getAttribute("width")); - } - - if(!getAttribute("height").isEmpty()) - { - clone->setAttribute("height", getAttribute("height")); - clone->setAttributeInternal("height", getAttribute("height")); - } - } - - appendChild(*parent); - parent->appendChild(*clone); - - setupSubtree(parent, ownerSVGElement(), viewportElement()); - - m_instanceRoot->setCorrespondingElement(clone); - - dynamic_cast(parent)->updateCachedScreenCTM(screenCTM()); - - // Redirect local ecma event handlers to the correspondingElement - TQPtrListIterator it(eventListeners()); - SVGRegisteredEventListener *eventListener; - while((eventListener = it.current()) != 0) - { - ++it; - clone->setEventListener(eventListener->id, eventListener->listener); - } - } - - if(m_instanceRoot) - { - SVGElementImpl *element = m_instanceRoot->correspondingElement(); - element->createItem(c); - } -} - -void SVGUseElementImpl::removeItem(KSVGCanvas *c) -{ - if(m_instanceRoot) - { - SVGElementImpl *element = m_instanceRoot->correspondingElement(); - element->removeItem(c); - } -} - -void SVGUseElementImpl::setupSubtree(SVGElementImpl *element, SVGSVGElementImpl *ownerSVG, SVGElementImpl *viewport) -{ - element->setOwnerSVGElement(ownerSVG); - element->setViewportElement(viewport); - element->setAttributes(); - - SVGSVGElementImpl *thisSVG = dynamic_cast(element); - - if(thisSVG != 0) - { - ownerSVG = thisSVG; - viewport = element; - } - - DOM::Node child = element->firstChild(); - for(; !child.isNull(); child = child.nextSibling()) - { - SVGElementImpl *childElement = ownerDoc()->getElementFromHandle(child.handle()); - if(childElement != 0) - setupSubtree(childElement, ownerSVG, viewport); - } -} - -void SVGUseElementImpl::setReferencedElement(SVGElementImpl *referenced) -{ - if(!referenced) - return; - - if(!m_instanceRoot) - { - m_instanceRoot = new SVGElementInstanceImpl(); - m_instanceRoot->ref(); - } - - m_instanceRoot->setCorrespondingElement(referenced); -} - -void SVGUseElementImpl::update(CanvasItemUpdate reason, int param1, int param2) -{ - if(m_instanceRoot) - { - SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); - if(shape) - shape->update(reason, param1, param2); - } -} - -void SVGUseElementImpl::invalidate(KSVGCanvas *c, bool recalc) -{ - if(m_instanceRoot) - { - SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); - if(shape) - shape->invalidate(c, recalc); - } -} - -void SVGUseElementImpl::setReferenced(bool referenced) -{ - if(m_instanceRoot) - { - SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); - if(shape) - shape->setReferenced(referenced); - } -} - -void SVGUseElementImpl::draw() -{ - if(m_instanceRoot) - { - SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); - if(shape) - shape->draw(); - } -} diff --git a/ksvg/impl/SVGUseElementImpl.cpp b/ksvg/impl/SVGUseElementImpl.cpp new file mode 100644 index 00000000..b7f36be5 --- /dev/null +++ b/ksvg/impl/SVGUseElementImpl.cpp @@ -0,0 +1,407 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "KSVGLoader.h" +#include "KSVGCanvas.h" + +#include "SVGRectImpl.h" +#include "SVGEventImpl.h" +#include "SVGHelperImpl.h" +#include "SVGMatrixImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGTransformImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGUseElementImpl.h" +#include "SVGSymbolElementImpl.h" +#include "SVGTransformListImpl.h" +#include "SVGAnimatedStringImpl.h" +#include "SVGAnimatedLengthImpl.h" +#include "SVGElementInstanceImpl.h" +#include "SVGAnimatedTransformListImpl.h" + +using namespace KSVG; + +#include "SVGUseElementImpl.lut.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGUseElementImpl::SVGUseElementImpl(DOM::ElementImpl *impl) : SVGShapeImpl(impl), SVGURIReferenceImpl(), SVGTestsImpl(), SVGLangSpaceImpl(), SVGExternalResourcesRequiredImpl(), SVGStylableImpl(this), SVGTransformableImpl() +{ + KSVG_EMPTY_FLAGS + + m_x = new SVGAnimatedLengthImpl(); + m_x->ref(); + + m_y = new SVGAnimatedLengthImpl(); + m_y->ref(); + + m_width = new SVGAnimatedLengthImpl(); + m_width->ref(); + + m_height = new SVGAnimatedLengthImpl(); + m_height->ref(); + + m_instanceRoot = 0; +} + +SVGUseElementImpl::~SVGUseElementImpl() +{ + if(m_x) + m_x->deref(); + if(m_y) + m_y->deref(); + if(m_width) + m_width->deref(); + if(m_height) + m_height->deref(); + if(m_instanceRoot) + m_instanceRoot->deref(); +} + +SVGAnimatedLengthImpl *SVGUseElementImpl::x() const +{ + return m_x; +} + +SVGAnimatedLengthImpl *SVGUseElementImpl::y() const +{ + return m_y; +} + +SVGAnimatedLengthImpl *SVGUseElementImpl::width() const +{ + return m_width; +} + +SVGAnimatedLengthImpl *SVGUseElementImpl::height() const +{ + return m_height; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGUseElementImpl::s_hashTable 11 + x SVGUseElementImpl::X DontDelete|ReadOnly + y SVGUseElementImpl::Y DontDelete|ReadOnly + width SVGUseElementImpl::Width DontDelete|ReadOnly + height SVGUseElementImpl::Height DontDelete|ReadOnly + href SVGUseElementImpl::Href DontDelete|ReadOnly + instanceRoot SVGUseElementImpl::InstanceRoot DontDelete|ReadOnly + animatedInstanceRoot SVGUseElementImpl::AnimatedInstanceRoot DontDelete|ReadOnly +@end +*/ + +Value SVGUseElementImpl::getValueProperty(ExecState *exec, int token) const +{ + KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case X: + if(!attributeMode) + return m_x->cache(exec); + else + return Number(m_x->baseVal()->value()); + case Y: + if(!attributeMode) + return m_y->cache(exec); + else + return Number(m_y->baseVal()->value()); + case Width: + if(!attributeMode) + return m_width->cache(exec); + else + return Number(m_width->baseVal()->value()); + case Height: + if(!attributeMode) + return m_height->cache(exec); + else + return Number(m_height->baseVal()->value()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGUseElementImpl::putValueProperty(ExecState *exec, int token, const Value &value, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case X: + x()->baseVal()->setValue(value.toNumber(exec)); + break; + case Y: + y()->baseVal()->setValue(value.toNumber(exec)); + break; + case Width: + width()->baseVal()->setValue(value.toNumber(exec)); + break; + case Height: + height()->baseVal()->setValue(value.toNumber(exec)); + break; + case Href: + { + TQString url = value.toString(exec).qstring(); + href()->setBaseVal(SVGURIReferenceImpl::getTarget(url)); + break; + } + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +SVGRectImpl *SVGUseElementImpl::getBBox() +{ + if(m_instanceRoot) + { + SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); + if(KSVG_TOKEN_NOT_PARSED(Width) && KSVG_TOKEN_NOT_PARSED(Height) && shape) + return shape->getBBox(); + } + + SVGRectImpl *ret = new SVGRectImpl(); + ret->ref(); + ret->setX(m_x->baseVal()->value()); + ret->setY(m_y->baseVal()->value()); + ret->setWidth(m_width->baseVal()->value()); + ret->setHeight(m_height->baseVal()->value()); + return ret; +} + +SVGElementInstanceImpl *SVGUseElementImpl::instanceRoot() const +{ + return m_instanceRoot; +} + +SVGElementInstanceImpl *SVGUseElementImpl::animatedInstanceRoot() const +{ + return m_animatedInstanceRoot; +} + +void SVGUseElementImpl::createItem(KSVGCanvas *c) +{ + if(!m_instanceRoot) + { + // ownerSVGElement()->getElementById() is wrong here. + // It could reference elements from other documents when using getURL (Niko) + TQString filename, id; + DOM::DOMString url = getAttribute("href"); + if(!SVGURIReferenceImpl::parseURIReference(url.string(), filename, id)) + return; + + SVGElementImpl *orig; + if(!filename.isEmpty()) + { + KURL fragmentUrl(ownerDoc()->baseUrl(), url.string()); + + id = fragmentUrl.ref(); + fragmentUrl.setRef(TQString()); + + orig = KSVGLoader::getSVGFragment(fragmentUrl, ownerDoc(), id); + } + else + { + orig = ownerDoc()->getElementByIdRecursive(ownerSVGElement(), href()->baseVal()); + + if(orig == 0) + { + // The document will try to create this item again once the parsing has finished. + ownerDoc()->addForwardReferencingUseElement(this); + } + } + + if(orig == 0) + return; + + setReferencedElement(orig); + + // Create a parent, a + SVGElementImpl *parent = 0; + DOM::Element impl = static_cast(ownerDoc())->createElement("g"); + parent = SVGDocumentImpl::createElement("g", impl, ownerDoc()); + SVGElementImpl *clone = orig->cloneNode(true); + + // Apply the use-correction + TQString trans; + trans += " translate("; + trans += TQString::number(x()->baseVal()->value()); + trans += " "; + trans += TQString::number(y()->baseVal()->value()); + trans += ")"; + + // Apply the transform attribute and render the element + parent->setAttributeInternal("transform", trans); + parent->setAttribute("transform", trans); + + // Apply width/height if symbol + if(dynamic_cast(clone)) + { + DOM::Element impl = static_cast(ownerDoc())->createElement("svg"); + SVGElementImpl *symbolSvg = SVGDocumentImpl::createElement("svg", impl, ownerDoc()); + + SVGHelperImpl::copyAttributes(orig, symbolSvg); + + symbolSvg->setAttribute("width", getAttribute("width")); + symbolSvg->setAttributeInternal("width", getAttribute("width")); + symbolSvg->setAttribute("height", getAttribute("height")); + symbolSvg->setAttributeInternal("height", getAttribute("height")); + DOM::Node node = clone->firstChild(); + for(; !node.isNull(); node = clone->firstChild()) + symbolSvg->appendChild(node); + + clone = symbolSvg; + } + else if(dynamic_cast(clone)) + { + if(!getAttribute("width").isEmpty()) + { + clone->setAttribute("width", getAttribute("width")); + clone->setAttributeInternal("width", getAttribute("width")); + } + + if(!getAttribute("height").isEmpty()) + { + clone->setAttribute("height", getAttribute("height")); + clone->setAttributeInternal("height", getAttribute("height")); + } + } + + appendChild(*parent); + parent->appendChild(*clone); + + setupSubtree(parent, ownerSVGElement(), viewportElement()); + + m_instanceRoot->setCorrespondingElement(clone); + + dynamic_cast(parent)->updateCachedScreenCTM(screenCTM()); + + // Redirect local ecma event handlers to the correspondingElement + TQPtrListIterator it(eventListeners()); + SVGRegisteredEventListener *eventListener; + while((eventListener = it.current()) != 0) + { + ++it; + clone->setEventListener(eventListener->id, eventListener->listener); + } + } + + if(m_instanceRoot) + { + SVGElementImpl *element = m_instanceRoot->correspondingElement(); + element->createItem(c); + } +} + +void SVGUseElementImpl::removeItem(KSVGCanvas *c) +{ + if(m_instanceRoot) + { + SVGElementImpl *element = m_instanceRoot->correspondingElement(); + element->removeItem(c); + } +} + +void SVGUseElementImpl::setupSubtree(SVGElementImpl *element, SVGSVGElementImpl *ownerSVG, SVGElementImpl *viewport) +{ + element->setOwnerSVGElement(ownerSVG); + element->setViewportElement(viewport); + element->setAttributes(); + + SVGSVGElementImpl *thisSVG = dynamic_cast(element); + + if(thisSVG != 0) + { + ownerSVG = thisSVG; + viewport = element; + } + + DOM::Node child = element->firstChild(); + for(; !child.isNull(); child = child.nextSibling()) + { + SVGElementImpl *childElement = ownerDoc()->getElementFromHandle(child.handle()); + if(childElement != 0) + setupSubtree(childElement, ownerSVG, viewport); + } +} + +void SVGUseElementImpl::setReferencedElement(SVGElementImpl *referenced) +{ + if(!referenced) + return; + + if(!m_instanceRoot) + { + m_instanceRoot = new SVGElementInstanceImpl(); + m_instanceRoot->ref(); + } + + m_instanceRoot->setCorrespondingElement(referenced); +} + +void SVGUseElementImpl::update(CanvasItemUpdate reason, int param1, int param2) +{ + if(m_instanceRoot) + { + SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); + if(shape) + shape->update(reason, param1, param2); + } +} + +void SVGUseElementImpl::invalidate(KSVGCanvas *c, bool recalc) +{ + if(m_instanceRoot) + { + SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); + if(shape) + shape->invalidate(c, recalc); + } +} + +void SVGUseElementImpl::setReferenced(bool referenced) +{ + if(m_instanceRoot) + { + SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); + if(shape) + shape->setReferenced(referenced); + } +} + +void SVGUseElementImpl::draw() +{ + if(m_instanceRoot) + { + SVGShapeImpl *shape = dynamic_cast(m_instanceRoot->correspondingElement()); + if(shape) + shape->draw(); + } +} diff --git a/ksvg/impl/SVGVKernElementImpl.cc b/ksvg/impl/SVGVKernElementImpl.cc deleted file mode 100644 index 2f07baee..00000000 --- a/ksvg/impl/SVGVKernElementImpl.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGVKernElementImpl.h" - -using namespace KSVG; - -SVGVKernElementImpl::SVGVKernElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) -{ -} - -SVGVKernElementImpl::~SVGVKernElementImpl() -{ -} diff --git a/ksvg/impl/SVGVKernElementImpl.cpp b/ksvg/impl/SVGVKernElementImpl.cpp new file mode 100644 index 00000000..2f07baee --- /dev/null +++ b/ksvg/impl/SVGVKernElementImpl.cpp @@ -0,0 +1,31 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGVKernElementImpl.h" + +using namespace KSVG; + +SVGVKernElementImpl::SVGVKernElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl) +{ +} + +SVGVKernElementImpl::~SVGVKernElementImpl() +{ +} diff --git a/ksvg/impl/SVGViewElementImpl.cc b/ksvg/impl/SVGViewElementImpl.cc deleted file mode 100644 index 19d56dc5..00000000 --- a/ksvg/impl/SVGViewElementImpl.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGStringListImpl.h" -#include "SVGViewElementImpl.h" - -using namespace KSVG; - -#include "SVGViewElementImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_ecma.h" - -SVGViewElementImpl::SVGViewElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGExternalResourcesRequiredImpl(), SVGFitToViewBoxImpl(), SVGZoomAndPanImpl() -{ - KSVG_EMPTY_FLAGS - - m_viewTarget = new SVGStringListImpl(); - m_viewTarget->ref(); -} - -SVGViewElementImpl::~SVGViewElementImpl() -{ - if(m_viewTarget) - m_viewTarget->deref(); -} - -SVGStringListImpl *SVGViewElementImpl::viewTarget() const -{ - return m_viewTarget; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGViewElementImpl::s_hashTable 2 - viewTarget SVGViewElementImpl::ViewTarget DontDelete|ReadOnly -@end -*/ - -Value SVGViewElementImpl::getValueProperty(ExecState *, int token) const -{ - //KSVG_CHECK_ATTRIBUTE - - switch(token) - { - case ViewTarget: - // TODO - return Undefined(); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} - -void SVGViewElementImpl::putValueProperty(ExecState *, int token, const Value &, int attr) -{ - // This class has just ReadOnly properties, only with the Internal flag set - // it's allowed to modify those. - if(!(attr & KJS::Internal)) - return; - - switch(token) - { - case ViewTarget: - // TODO - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} diff --git a/ksvg/impl/SVGViewElementImpl.cpp b/ksvg/impl/SVGViewElementImpl.cpp new file mode 100644 index 00000000..19d56dc5 --- /dev/null +++ b/ksvg/impl/SVGViewElementImpl.cpp @@ -0,0 +1,92 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGStringListImpl.h" +#include "SVGViewElementImpl.h" + +using namespace KSVG; + +#include "SVGViewElementImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_ecma.h" + +SVGViewElementImpl::SVGViewElementImpl(DOM::ElementImpl *impl) : SVGElementImpl(impl), SVGExternalResourcesRequiredImpl(), SVGFitToViewBoxImpl(), SVGZoomAndPanImpl() +{ + KSVG_EMPTY_FLAGS + + m_viewTarget = new SVGStringListImpl(); + m_viewTarget->ref(); +} + +SVGViewElementImpl::~SVGViewElementImpl() +{ + if(m_viewTarget) + m_viewTarget->deref(); +} + +SVGStringListImpl *SVGViewElementImpl::viewTarget() const +{ + return m_viewTarget; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGViewElementImpl::s_hashTable 2 + viewTarget SVGViewElementImpl::ViewTarget DontDelete|ReadOnly +@end +*/ + +Value SVGViewElementImpl::getValueProperty(ExecState *, int token) const +{ + //KSVG_CHECK_ATTRIBUTE + + switch(token) + { + case ViewTarget: + // TODO + return Undefined(); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} + +void SVGViewElementImpl::putValueProperty(ExecState *, int token, const Value &, int attr) +{ + // This class has just ReadOnly properties, only with the Internal flag set + // it's allowed to modify those. + if(!(attr & KJS::Internal)) + return; + + switch(token) + { + case ViewTarget: + // TODO + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} diff --git a/ksvg/impl/SVGViewSpecImpl.cc b/ksvg/impl/SVGViewSpecImpl.cc deleted file mode 100644 index ff42db43..00000000 --- a/ksvg/impl/SVGViewSpecImpl.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include - -#include "SVGElementImpl.h" -#include "SVGViewSpecImpl.h" -#include "SVGTransformListImpl.h" - -using namespace KSVG; - -SVGViewSpecImpl::SVGViewSpecImpl() : SVGZoomAndPanImpl(), SVGFitToViewBoxImpl() -{ - m_transform = new SVGTransformListImpl(); - m_transform->ref(); - - m_viewTarget = new SVGElementImpl(0); - m_viewTarget->ref(); -} - -SVGViewSpecImpl::~SVGViewSpecImpl() -{ - if(m_transform) - m_transform->deref(); - if(m_viewTarget) - m_viewTarget->deref(); -} - -SVGTransformListImpl *SVGViewSpecImpl::transform() const -{ - return m_transform; -} - -SVGElementImpl *SVGViewSpecImpl::viewTarget() const -{ - return m_viewTarget; -} - -DOM::DOMString SVGViewSpecImpl::viewBoxString() const -{ - return m_viewBoxString; -} - -DOM::DOMString SVGViewSpecImpl::preserveAspectRatioString() const -{ - return m_preserveAspectRatioString; -} - -DOM::DOMString SVGViewSpecImpl::transformString() const -{ - return m_transformString; -} - -DOM::DOMString SVGViewSpecImpl::viewTargetString() const -{ - return m_viewTargetString; -} - -bool SVGViewSpecImpl::parseViewSpec(const TQString &s) -{ - if(!s.startsWith("svgView(")) - return false; - - // remove 'svgView(' and ')' - TQStringList subAttrs = TQStringList::split(';', s.mid(8)); - - for(TQStringList::ConstIterator it = subAttrs.begin() ; it != subAttrs.end(); ++it) - { - if((*it).startsWith("viewBox(")) - m_viewBoxString = (*it).mid(8); - else if((*it).startsWith("zoomAndPan(")) - parseZoomAndPan(DOM::DOMString((*it).mid(11))); - else if((*it).startsWith("preserveAspectRatio(")) - m_preserveAspectRatioString = (*it).mid(20); - } - return true; -} diff --git a/ksvg/impl/SVGViewSpecImpl.cpp b/ksvg/impl/SVGViewSpecImpl.cpp new file mode 100644 index 00000000..ff42db43 --- /dev/null +++ b/ksvg/impl/SVGViewSpecImpl.cpp @@ -0,0 +1,96 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include + +#include "SVGElementImpl.h" +#include "SVGViewSpecImpl.h" +#include "SVGTransformListImpl.h" + +using namespace KSVG; + +SVGViewSpecImpl::SVGViewSpecImpl() : SVGZoomAndPanImpl(), SVGFitToViewBoxImpl() +{ + m_transform = new SVGTransformListImpl(); + m_transform->ref(); + + m_viewTarget = new SVGElementImpl(0); + m_viewTarget->ref(); +} + +SVGViewSpecImpl::~SVGViewSpecImpl() +{ + if(m_transform) + m_transform->deref(); + if(m_viewTarget) + m_viewTarget->deref(); +} + +SVGTransformListImpl *SVGViewSpecImpl::transform() const +{ + return m_transform; +} + +SVGElementImpl *SVGViewSpecImpl::viewTarget() const +{ + return m_viewTarget; +} + +DOM::DOMString SVGViewSpecImpl::viewBoxString() const +{ + return m_viewBoxString; +} + +DOM::DOMString SVGViewSpecImpl::preserveAspectRatioString() const +{ + return m_preserveAspectRatioString; +} + +DOM::DOMString SVGViewSpecImpl::transformString() const +{ + return m_transformString; +} + +DOM::DOMString SVGViewSpecImpl::viewTargetString() const +{ + return m_viewTargetString; +} + +bool SVGViewSpecImpl::parseViewSpec(const TQString &s) +{ + if(!s.startsWith("svgView(")) + return false; + + // remove 'svgView(' and ')' + TQStringList subAttrs = TQStringList::split(';', s.mid(8)); + + for(TQStringList::ConstIterator it = subAttrs.begin() ; it != subAttrs.end(); ++it) + { + if((*it).startsWith("viewBox(")) + m_viewBoxString = (*it).mid(8); + else if((*it).startsWith("zoomAndPan(")) + parseZoomAndPan(DOM::DOMString((*it).mid(11))); + else if((*it).startsWith("preserveAspectRatio(")) + m_preserveAspectRatioString = (*it).mid(20); + } + return true; +} diff --git a/ksvg/impl/SVGWindowImpl.cc b/ksvg/impl/SVGWindowImpl.cc deleted file mode 100644 index 5edd4b4e..00000000 --- a/ksvg/impl/SVGWindowImpl.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "SVGWindowImpl.h" -#include "SVGDocumentImpl.h" -#include "SVGSVGElementImpl.h" -#include "SVGEvent.h" -#include "KSVGCanvas.h" -#include -#include - -#include - -#include -#include -#include -#include - -using namespace KSVG; - - -SVGWindowImpl::SVGWindowImpl() -{ - m_document = 0; -} - -SVGWindowImpl::SVGWindowImpl(SVGDocumentImpl *doc) -{ - m_document = doc; - if(m_document) - m_document->ref(); -} - -SVGWindowImpl::~SVGWindowImpl() -{ - if(m_document) - m_document->deref(); -} - -/*StyleSheet SVGWindowImpl::defaultStyleSheet() const -{ - return m_defaultStyleSheet; -}*/ - -SVGDocumentImpl *SVGWindowImpl::document() const -{ - return m_document; -} - -DOM::Event SVGWindowImpl::evt() const -{ - return KSVG::SVGEvent(m_document->ecmaEngine()->interpreter()->currentEvent()); -} - -long SVGWindowImpl::innerHeight() const -{ - return m_document ? int(m_document->canvas()->height()) : -1; -} - -long SVGWindowImpl::innerWidth() const -{ - return m_document ? int(m_document->canvas()->width()) : -1; -} - -void SVGWindowImpl::setSrc(const DOM::DOMString &/*src*/) -{ - // TODO : make KURL, load and parse doc -} - -DOM::DOMString SVGWindowImpl::src() const -{ - if(!m_document) - return DOM::DOMString(); - return m_document->baseUrl().prettyURL(); -} - -void SVGWindowImpl::clearInterval(long /*interval*/) -{ -} - -void SVGWindowImpl::clearTimeout(long /*timeout*/) -{ -} - -void SVGWindowImpl::getURL(const DOM::DOMString &/*uri*/, const DOM::EventListener &/*callback*/) -{ -} - -/*DocumentFragment SVGWindowImpl::parseXML(const DOM::DOMString &source, const Document &document) -{ -}*/ - -void SVGWindowImpl::postURL(const DOM::DOMString &/*uri*/, const DOM::DOMString &/*data*/, const DOM::EventListener &/*callback*/, const DOM::DOMString &/*mimeType*/, const DOM::DOMString &/*contentEncoding*/) -{ -} - -DOM::DOMString SVGWindowImpl::printNode(const DOM::Node &node, unsigned short level) -{ - TQString ret; - if(node.isNull()) return ret; - SVGElementImpl *elem = m_document->getElementFromHandle(node.handle()); - if(node.nodeType() == DOM::Node::DOCUMENT_NODE) - { - ret += "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>\n" + printNode(node.firstChild()).string() + "\n"; - } - else if(node.nodeType() == DOM::Node::TEXT_NODE) - { - printIndentation(ret, level); - ret += node.nodeValue().string(); - } - else if(elem) - { - printIndentation(ret, level); - ret += "<" + elem->tagName().string(); - // handle attrs - TQDictIterator it(elem->attributes()); - for(;it.current(); ++it) - ret += " " + it.currentKey() + "=\"" + it.current()->string() + '\"'; - if(elem->firstChild().isNull()) // no children - ret += " />\n"; - else // handle children - { - ret += ">\n"; - for(DOM::Node child = node.firstChild();!child.isNull();child = child.nextSibling()) - ret += printNode(child, level + 1).string(); - printIndentation(ret, level); - ret += "tagName().string() + ">\n"; - } - } - return ret; -} - -void SVGWindowImpl::printIndentation(TQString &ret, unsigned short level, unsigned short indent) -{ - for(int i = 0;i < indent * level;i++) - ret += " "; -} - -long SVGWindowImpl::setInterval(const DOM::DOMString &/*code*/, const long &/*delay*/) -{ - return 0; -} - -long SVGWindowImpl::setTimeout(const DOM::DOMString &/*code*/, const long &/*delay*/) -{ - return 0; -} - -void SVGWindowImpl::alert(const DOM::DOMString &message, const TQString &title) -{ - KMessageBox::error(0L, TQStyleSheet::convertFromPlainText(message.string()), title); -} - -bool SVGWindowImpl::confirm(const DOM::DOMString &message, const TQString &title) -{ - return KMessageBox::warningContinueCancel(0L, TQStyleSheet::convertFromPlainText(message.string()), title, KStdGuiItem::ok()) == KMessageBox::Continue; -} - -DOM::DOMString SVGWindowImpl::prompt(const DOM::DOMString &message, const DOM::DOMString &_default, const TQString &) -{ - bool ok; - TQString str; - str = KInputDialog::getText(i18n("Prompt"), TQStyleSheet::convertFromPlainText(message.string()), _default.string(), &ok); - if(ok) - return str; - else - return ""; -} diff --git a/ksvg/impl/SVGWindowImpl.cpp b/ksvg/impl/SVGWindowImpl.cpp new file mode 100644 index 00000000..5edd4b4e --- /dev/null +++ b/ksvg/impl/SVGWindowImpl.cpp @@ -0,0 +1,185 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "SVGWindowImpl.h" +#include "SVGDocumentImpl.h" +#include "SVGSVGElementImpl.h" +#include "SVGEvent.h" +#include "KSVGCanvas.h" +#include +#include + +#include + +#include +#include +#include +#include + +using namespace KSVG; + + +SVGWindowImpl::SVGWindowImpl() +{ + m_document = 0; +} + +SVGWindowImpl::SVGWindowImpl(SVGDocumentImpl *doc) +{ + m_document = doc; + if(m_document) + m_document->ref(); +} + +SVGWindowImpl::~SVGWindowImpl() +{ + if(m_document) + m_document->deref(); +} + +/*StyleSheet SVGWindowImpl::defaultStyleSheet() const +{ + return m_defaultStyleSheet; +}*/ + +SVGDocumentImpl *SVGWindowImpl::document() const +{ + return m_document; +} + +DOM::Event SVGWindowImpl::evt() const +{ + return KSVG::SVGEvent(m_document->ecmaEngine()->interpreter()->currentEvent()); +} + +long SVGWindowImpl::innerHeight() const +{ + return m_document ? int(m_document->canvas()->height()) : -1; +} + +long SVGWindowImpl::innerWidth() const +{ + return m_document ? int(m_document->canvas()->width()) : -1; +} + +void SVGWindowImpl::setSrc(const DOM::DOMString &/*src*/) +{ + // TODO : make KURL, load and parse doc +} + +DOM::DOMString SVGWindowImpl::src() const +{ + if(!m_document) + return DOM::DOMString(); + return m_document->baseUrl().prettyURL(); +} + +void SVGWindowImpl::clearInterval(long /*interval*/) +{ +} + +void SVGWindowImpl::clearTimeout(long /*timeout*/) +{ +} + +void SVGWindowImpl::getURL(const DOM::DOMString &/*uri*/, const DOM::EventListener &/*callback*/) +{ +} + +/*DocumentFragment SVGWindowImpl::parseXML(const DOM::DOMString &source, const Document &document) +{ +}*/ + +void SVGWindowImpl::postURL(const DOM::DOMString &/*uri*/, const DOM::DOMString &/*data*/, const DOM::EventListener &/*callback*/, const DOM::DOMString &/*mimeType*/, const DOM::DOMString &/*contentEncoding*/) +{ +} + +DOM::DOMString SVGWindowImpl::printNode(const DOM::Node &node, unsigned short level) +{ + TQString ret; + if(node.isNull()) return ret; + SVGElementImpl *elem = m_document->getElementFromHandle(node.handle()); + if(node.nodeType() == DOM::Node::DOCUMENT_NODE) + { + ret += "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>\n" + printNode(node.firstChild()).string() + "\n"; + } + else if(node.nodeType() == DOM::Node::TEXT_NODE) + { + printIndentation(ret, level); + ret += node.nodeValue().string(); + } + else if(elem) + { + printIndentation(ret, level); + ret += "<" + elem->tagName().string(); + // handle attrs + TQDictIterator it(elem->attributes()); + for(;it.current(); ++it) + ret += " " + it.currentKey() + "=\"" + it.current()->string() + '\"'; + if(elem->firstChild().isNull()) // no children + ret += " />\n"; + else // handle children + { + ret += ">\n"; + for(DOM::Node child = node.firstChild();!child.isNull();child = child.nextSibling()) + ret += printNode(child, level + 1).string(); + printIndentation(ret, level); + ret += "tagName().string() + ">\n"; + } + } + return ret; +} + +void SVGWindowImpl::printIndentation(TQString &ret, unsigned short level, unsigned short indent) +{ + for(int i = 0;i < indent * level;i++) + ret += " "; +} + +long SVGWindowImpl::setInterval(const DOM::DOMString &/*code*/, const long &/*delay*/) +{ + return 0; +} + +long SVGWindowImpl::setTimeout(const DOM::DOMString &/*code*/, const long &/*delay*/) +{ + return 0; +} + +void SVGWindowImpl::alert(const DOM::DOMString &message, const TQString &title) +{ + KMessageBox::error(0L, TQStyleSheet::convertFromPlainText(message.string()), title); +} + +bool SVGWindowImpl::confirm(const DOM::DOMString &message, const TQString &title) +{ + return KMessageBox::warningContinueCancel(0L, TQStyleSheet::convertFromPlainText(message.string()), title, KStdGuiItem::ok()) == KMessageBox::Continue; +} + +DOM::DOMString SVGWindowImpl::prompt(const DOM::DOMString &message, const DOM::DOMString &_default, const TQString &) +{ + bool ok; + TQString str; + str = KInputDialog::getText(i18n("Prompt"), TQStyleSheet::convertFromPlainText(message.string()), _default.string(), &ok); + if(ok) + return str; + else + return ""; +} diff --git a/ksvg/impl/SVGZoomAndPanImpl.cc b/ksvg/impl/SVGZoomAndPanImpl.cc deleted file mode 100644 index c632a4dc..00000000 --- a/ksvg/impl/SVGZoomAndPanImpl.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "SVGZoomAndPan.h" -#include "SVGZoomAndPanImpl.h" - -using namespace KSVG; - -#include "SVGZoomAndPanImpl.lut.h" -#include "ksvg_scriptinterpreter.h" -#include "ksvg_bridge.h" -#include "ksvg_cacheimpl.h" - -SVGZoomAndPanImpl::SVGZoomAndPanImpl() -{ - KSVG_EMPTY_FLAGS - - m_zoomAndPan = SVG_ZOOMANDPAN_MAGNIFY; -} - -SVGZoomAndPanImpl::~SVGZoomAndPanImpl() -{ -} - -void SVGZoomAndPanImpl::setZoomAndPan(unsigned short zoomAndPan) -{ - m_zoomAndPan = zoomAndPan; -} - -unsigned short SVGZoomAndPanImpl::zoomAndPan() const -{ - return m_zoomAndPan; -} - -void SVGZoomAndPanImpl::parseZoomAndPan(const DOM::DOMString &attr) -{ - if(attr == "disable") - m_zoomAndPan = SVG_ZOOMANDPAN_DISABLE; -} - -// Ecma stuff - -/* -@namespace KSVG -@begin SVGZoomAndPanImpl::s_hashTable 2 - zoomAndPan SVGZoomAndPanImpl::ZoomAndPan DontDelete -@end -*/ - -Value SVGZoomAndPanImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case ZoomAndPan: - return Number(zoomAndPan()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return KJS::Undefined(); - } -} - -void SVGZoomAndPanImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) -{ - switch(token) - { - case ZoomAndPan: - parseZoomAndPan(value.toString(exec).string()); - break; - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - } -} - -/* -@namespace KSVG -@begin SVGZoomAndPanImplConstructor::s_hashTable 5 - SVG_ZOOMANDPAN_UNKNOWN KSVG::SVG_ZOOMANDPAN_UNKNOWN DontDelete|ReadOnly - SVG_ZOOMANDPAN_DISABLE KSVG::SVG_ZOOMANDPAN_DISABLE DontDelete|ReadOnly - SVG_ZOOMANDPAN_MAGNIFY KSVG::SVG_ZOOMANDPAN_MAGNIFY DontDelete|ReadOnly -@end -*/ - -Value SVGZoomAndPanImplConstructor::getValueProperty(ExecState *, int token) const -{ - return Number(token); -} - -Value KSVG::getSVGZoomAndPanImplConstructor(ExecState *exec) -{ - return cacheGlobalBridge(exec, "[[svgzoomandpan.constructor]]"); -} diff --git a/ksvg/impl/SVGZoomAndPanImpl.cpp b/ksvg/impl/SVGZoomAndPanImpl.cpp new file mode 100644 index 00000000..c632a4dc --- /dev/null +++ b/ksvg/impl/SVGZoomAndPanImpl.cpp @@ -0,0 +1,110 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "SVGZoomAndPan.h" +#include "SVGZoomAndPanImpl.h" + +using namespace KSVG; + +#include "SVGZoomAndPanImpl.lut.h" +#include "ksvg_scriptinterpreter.h" +#include "ksvg_bridge.h" +#include "ksvg_cacheimpl.h" + +SVGZoomAndPanImpl::SVGZoomAndPanImpl() +{ + KSVG_EMPTY_FLAGS + + m_zoomAndPan = SVG_ZOOMANDPAN_MAGNIFY; +} + +SVGZoomAndPanImpl::~SVGZoomAndPanImpl() +{ +} + +void SVGZoomAndPanImpl::setZoomAndPan(unsigned short zoomAndPan) +{ + m_zoomAndPan = zoomAndPan; +} + +unsigned short SVGZoomAndPanImpl::zoomAndPan() const +{ + return m_zoomAndPan; +} + +void SVGZoomAndPanImpl::parseZoomAndPan(const DOM::DOMString &attr) +{ + if(attr == "disable") + m_zoomAndPan = SVG_ZOOMANDPAN_DISABLE; +} + +// Ecma stuff + +/* +@namespace KSVG +@begin SVGZoomAndPanImpl::s_hashTable 2 + zoomAndPan SVGZoomAndPanImpl::ZoomAndPan DontDelete +@end +*/ + +Value SVGZoomAndPanImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case ZoomAndPan: + return Number(zoomAndPan()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return KJS::Undefined(); + } +} + +void SVGZoomAndPanImpl::putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int) +{ + switch(token) + { + case ZoomAndPan: + parseZoomAndPan(value.toString(exec).string()); + break; + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + } +} + +/* +@namespace KSVG +@begin SVGZoomAndPanImplConstructor::s_hashTable 5 + SVG_ZOOMANDPAN_UNKNOWN KSVG::SVG_ZOOMANDPAN_UNKNOWN DontDelete|ReadOnly + SVG_ZOOMANDPAN_DISABLE KSVG::SVG_ZOOMANDPAN_DISABLE DontDelete|ReadOnly + SVG_ZOOMANDPAN_MAGNIFY KSVG::SVG_ZOOMANDPAN_MAGNIFY DontDelete|ReadOnly +@end +*/ + +Value SVGZoomAndPanImplConstructor::getValueProperty(ExecState *, int token) const +{ + return Number(token); +} + +Value KSVG::getSVGZoomAndPanImplConstructor(ExecState *exec) +{ + return cacheGlobalBridge(exec, "[[svgzoomandpan.constructor]]"); +} diff --git a/ksvg/impl/SVGZoomEventImpl.cc b/ksvg/impl/SVGZoomEventImpl.cc deleted file mode 100644 index 0164779c..00000000 --- a/ksvg/impl/SVGZoomEventImpl.cc +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (C) 2001-2003 KSVG Team - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include "SVGRectImpl.h" -#include "SVGPointImpl.h" -#include "SVGZoomEventImpl.h" - -using namespace KSVG; - -#include "SVGZoomEventImpl.lut.h" -#include "SVGSVGElementImpl.h" - -using namespace KJS; - -SVGZoomEventImpl::SVGZoomEventImpl(SVGEvent::EventId _id, - bool canBubbleArg, - bool cancelableArg, - DOM::AbstractView &viewArg, - long detailArg, - float previousScale, SVGPointImpl *previousTranslate, - float newScale, SVGPointImpl *newTranslate) -: SVGUIEventImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg), m_previousScale( previousScale ), m_newScale( newScale ) -{ - m_zoomRectScreen = SVGSVGElementImpl::createSVGRect(); - m_previousTranslate = previousTranslate; - if(m_previousTranslate) - m_previousTranslate->ref(); - m_newTranslate = newTranslate; - if(m_newTranslate) - m_newTranslate->ref(); -} - -SVGZoomEventImpl::~SVGZoomEventImpl() -{ - if(m_zoomRectScreen) - m_zoomRectScreen->deref(); - if(m_previousTranslate) - m_previousTranslate->deref(); - if(m_newTranslate) - m_newTranslate->deref(); -} - -SVGRectImpl *SVGZoomEventImpl::zoomRectScreen() const -{ - return m_zoomRectScreen; -} - -float SVGZoomEventImpl::previousScale() const -{ - return m_previousScale; -} - -SVGPointImpl *SVGZoomEventImpl::previousTranslate() const -{ - return m_previousTranslate; -} - -float SVGZoomEventImpl::newScale() const -{ - return m_newScale; -} - -SVGPointImpl *SVGZoomEventImpl::newTranslate() const -{ - return m_newTranslate; -} - -/* -@namespace KSVG -@begin SVGZoomEventImpl::s_hashTable 7 - zoomRectScreen SVGZoomEventImpl::ZoomRectScreen DontDelete|ReadOnly - previousScale SVGZoomEventImpl::PreviousScale DontDelete|ReadOnly - previousTranslate SVGZoomEventImpl::PreviousTranslate DontDelete|ReadOnly - newScale SVGZoomEventImpl::NewScale DontDelete|ReadOnly - newTranslate SVGZoomEventImpl::NewTranslate DontDelete|ReadOnly -@end -*/ - -Value SVGZoomEventImpl::getValueProperty(ExecState *, int token) const -{ - switch(token) - { - case PreviousScale: - return Number(previousScale()); - case NewScale: - return Number(newScale()); - default: - kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; - return Undefined(); - } -} diff --git a/ksvg/impl/SVGZoomEventImpl.cpp b/ksvg/impl/SVGZoomEventImpl.cpp new file mode 100644 index 00000000..0164779c --- /dev/null +++ b/ksvg/impl/SVGZoomEventImpl.cpp @@ -0,0 +1,109 @@ +/* + Copyright (C) 2001-2003 KSVG Team + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include "SVGRectImpl.h" +#include "SVGPointImpl.h" +#include "SVGZoomEventImpl.h" + +using namespace KSVG; + +#include "SVGZoomEventImpl.lut.h" +#include "SVGSVGElementImpl.h" + +using namespace KJS; + +SVGZoomEventImpl::SVGZoomEventImpl(SVGEvent::EventId _id, + bool canBubbleArg, + bool cancelableArg, + DOM::AbstractView &viewArg, + long detailArg, + float previousScale, SVGPointImpl *previousTranslate, + float newScale, SVGPointImpl *newTranslate) +: SVGUIEventImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg), m_previousScale( previousScale ), m_newScale( newScale ) +{ + m_zoomRectScreen = SVGSVGElementImpl::createSVGRect(); + m_previousTranslate = previousTranslate; + if(m_previousTranslate) + m_previousTranslate->ref(); + m_newTranslate = newTranslate; + if(m_newTranslate) + m_newTranslate->ref(); +} + +SVGZoomEventImpl::~SVGZoomEventImpl() +{ + if(m_zoomRectScreen) + m_zoomRectScreen->deref(); + if(m_previousTranslate) + m_previousTranslate->deref(); + if(m_newTranslate) + m_newTranslate->deref(); +} + +SVGRectImpl *SVGZoomEventImpl::zoomRectScreen() const +{ + return m_zoomRectScreen; +} + +float SVGZoomEventImpl::previousScale() const +{ + return m_previousScale; +} + +SVGPointImpl *SVGZoomEventImpl::previousTranslate() const +{ + return m_previousTranslate; +} + +float SVGZoomEventImpl::newScale() const +{ + return m_newScale; +} + +SVGPointImpl *SVGZoomEventImpl::newTranslate() const +{ + return m_newTranslate; +} + +/* +@namespace KSVG +@begin SVGZoomEventImpl::s_hashTable 7 + zoomRectScreen SVGZoomEventImpl::ZoomRectScreen DontDelete|ReadOnly + previousScale SVGZoomEventImpl::PreviousScale DontDelete|ReadOnly + previousTranslate SVGZoomEventImpl::PreviousTranslate DontDelete|ReadOnly + newScale SVGZoomEventImpl::NewScale DontDelete|ReadOnly + newTranslate SVGZoomEventImpl::NewTranslate DontDelete|ReadOnly +@end +*/ + +Value SVGZoomEventImpl::getValueProperty(ExecState *, int token) const +{ + switch(token) + { + case PreviousScale: + return Number(previousScale()); + case NewScale: + return Number(newScale()); + default: + kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl; + return Undefined(); + } +} diff --git a/ksvg/impl/libs/libtext2path/src/Cache.h b/ksvg/impl/libs/libtext2path/src/Cache.h index 39536179..6f6ca705 100644 --- a/ksvg/impl/libs/libtext2path/src/Cache.h +++ b/ksvg/impl/libs/libtext2path/src/Cache.h @@ -26,7 +26,7 @@ #include #include -#include "myboost/shared_ptr.hpp" +#include "myboost/shared_ptr.h" namespace T2P { diff --git a/ksvg/impl/libs/libtext2path/src/Converter.cpp b/ksvg/impl/libs/libtext2path/src/Converter.cpp index f8e3d20e..88af02ae 100644 --- a/ksvg/impl/libs/libtext2path/src/Converter.cpp +++ b/ksvg/impl/libs/libtext2path/src/Converter.cpp @@ -22,7 +22,7 @@ #include -#include "myboost/shared_ptr.hpp" +#include "myboost/shared_ptr.h" #include #include diff --git a/ksvg/impl/libs/libtext2path/src/myboost/assert.h b/ksvg/impl/libs/libtext2path/src/myboost/assert.h new file mode 100644 index 00000000..ebedcd32 --- /dev/null +++ b/ksvg/impl/libs/libtext2path/src/myboost/assert.h @@ -0,0 +1,24 @@ +// +// boost/assert.h - BOOST_ASSERT(expr) +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// Note: There are no include guards. This is intentional. +// +// See http://www.boost.org/libs/utility/assert.html for documentation. +// + +#ifndef ASSERT_H +#define ASSERT_H + +#undef BOOST_ASSERT + +# include +# define BOOST_ASSERT(expr) assert(expr) + +#endif diff --git a/ksvg/impl/libs/libtext2path/src/myboost/assert.hpp b/ksvg/impl/libs/libtext2path/src/myboost/assert.hpp deleted file mode 100644 index 3f3c61c2..00000000 --- a/ksvg/impl/libs/libtext2path/src/myboost/assert.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// boost/assert.hpp - BOOST_ASSERT(expr) -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// Note: There are no include guards. This is intentional. -// -// See http://www.boost.org/libs/utility/assert.html for documentation. -// - -#ifndef ASSERT_HPP -#define ASSERT_HPP - -#undef BOOST_ASSERT - -# include -# define BOOST_ASSERT(expr) assert(expr) - -#endif diff --git a/ksvg/impl/libs/libtext2path/src/myboost/checked_delete.h b/ksvg/impl/libs/libtext2path/src/myboost/checked_delete.h new file mode 100644 index 00000000..ba5b534c --- /dev/null +++ b/ksvg/impl/libs/libtext2path/src/myboost/checked_delete.h @@ -0,0 +1,61 @@ +#ifndef BOOST_CHECKED_DELETE_H_INCLUDED +#define BOOST_CHECKED_DELETE_H_INCLUDED + +// +// boost/checked_delete.h +// +// Copyright (c) 1999, 2000, 2001, 2002 boost.org +// Copyright (c) 2002, 2003 Peter Dimov +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org/libs/utility/checked_delete.html for documentation. +// + +namespace myboost +{ + +// verify that types are complete for increased safety + +template inline void checked_delete(T * x) +{ + // Intel 7 accepts sizeof(incomplete) as 0 in system headers + typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; + delete x; +} + +template inline void checked_array_delete(T * x) +{ + typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; + delete [] x; +} + +template struct checked_deleter +{ + typedef void result_type; + typedef T * argument_type; + + void operator()(T * x) const + { + // boost:: disables ADL + myboost::checked_delete(x); + } +}; + +template struct checked_array_deleter +{ + typedef void result_type; + typedef T * argument_type; + + void operator()(T * x) const + { + myboost::checked_array_delete(x); + } +}; + +} // namespace myboost + +#endif // #ifndef BOOST_CHECKED_DELETE_H_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/checked_delete.hpp b/ksvg/impl/libs/libtext2path/src/myboost/checked_delete.hpp deleted file mode 100644 index 73afd5f5..00000000 --- a/ksvg/impl/libs/libtext2path/src/myboost/checked_delete.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED -#define BOOST_CHECKED_DELETE_HPP_INCLUDED - -// -// boost/checked_delete.hpp -// -// Copyright (c) 1999, 2000, 2001, 2002 boost.org -// Copyright (c) 2002, 2003 Peter Dimov -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// See http://www.boost.org/libs/utility/checked_delete.html for documentation. -// - -namespace myboost -{ - -// verify that types are complete for increased safety - -template inline void checked_delete(T * x) -{ - // Intel 7 accepts sizeof(incomplete) as 0 in system headers - typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; - delete x; -} - -template inline void checked_array_delete(T * x) -{ - typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; - delete [] x; -} - -template struct checked_deleter -{ - typedef void result_type; - typedef T * argument_type; - - void operator()(T * x) const - { - // boost:: disables ADL - myboost::checked_delete(x); - } -}; - -template struct checked_array_deleter -{ - typedef void result_type; - typedef T * argument_type; - - void operator()(T * x) const - { - myboost::checked_array_delete(x); - } -}; - -} // namespace myboost - -#endif // #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.h b/ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.h new file mode 100644 index 00000000..2c09ca8b --- /dev/null +++ b/ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.h @@ -0,0 +1,74 @@ +#ifndef BOOST_DETAIL_LWM_PTHREADS_H_INCLUDED +#define BOOST_DETAIL_LWM_PTHREADS_H_INCLUDED + +// +// boost/detail/lwm_pthreads.h +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// + +#include + +namespace myboost +{ + +namespace detail +{ + +class lightweight_mutex +{ +private: + + pthread_mutex_t m_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { + pthread_mutex_init(&m_, 0); + } + + ~lightweight_mutex() + { + pthread_mutex_destroy(&m_); + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + pthread_mutex_t & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + scoped_lock(lightweight_mutex & m): m_(m.m_) + { + pthread_mutex_lock(&m_); + } + + ~scoped_lock() + { + pthread_mutex_unlock(&m_); + } + }; +}; + +} // namespace detail + +} // namespace myboost + +#endif // #ifndef BOOST_DETAIL_LWM_PTHREADS_H_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.hpp b/ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.hpp deleted file mode 100644 index 10db127c..00000000 --- a/ksvg/impl/libs/libtext2path/src/myboost/lightweight_mutex.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED -#define BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED - -// -// boost/detail/lwm_pthreads.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// - -#include - -namespace myboost -{ - -namespace detail -{ - -class lightweight_mutex -{ -private: - - pthread_mutex_t m_; - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - -public: - - lightweight_mutex() - { - pthread_mutex_init(&m_, 0); - } - - ~lightweight_mutex() - { - pthread_mutex_destroy(&m_); - } - - class scoped_lock; - friend class scoped_lock; - - class scoped_lock - { - private: - - pthread_mutex_t & m_; - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - scoped_lock(lightweight_mutex & m): m_(m.m_) - { - pthread_mutex_lock(&m_); - } - - ~scoped_lock() - { - pthread_mutex_unlock(&m_); - } - }; -}; - -} // namespace detail - -} // namespace myboost - -#endif // #ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/shared_count.h b/ksvg/impl/libs/libtext2path/src/myboost/shared_count.h new file mode 100644 index 00000000..b240ff8f --- /dev/null +++ b/ksvg/impl/libs/libtext2path/src/myboost/shared_count.h @@ -0,0 +1,367 @@ +#ifndef BOOST_DETAIL_SHARED_COUNT_H_INCLUDED +#define BOOST_DETAIL_SHARED_COUNT_H_INCLUDED + +// +// detail/shared_count.h +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// + +#include "myboost/checked_delete.h" +#include "myboost/throw_exception.h" +#include "myboost/lightweight_mutex.h" + +#include // std::auto_ptr, std::allocator +#include // std::less +#include // std::exception +#include // std::bad_alloc +#include // std::type_info in get_deleter +#include // std::size_t + +namespace myboost +{ + +class bad_weak_ptr: public std::exception +{ +public: + + virtual char const * what() const throw() + { + return "myboost::bad_weak_ptr"; + } +}; + +namespace detail +{ + +class sp_counted_base +{ +private: + + typedef detail::lightweight_mutex mutex_type; + +public: + + sp_counted_base(): use_count_(1), weak_count_(1) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destruct() is called when weak_count_ drops to zero. + + virtual void destruct() // nothrow + { + delete this; + } + + virtual void * get_deleter(std::type_info const & ti) = 0; + + void add_ref_copy() + { + mutex_type::scoped_lock lock(mtx_); + ++use_count_; + } + + void add_ref_lock() + { + mutex_type::scoped_lock lock(mtx_); + if(use_count_ == 0) myboost::throw_exception(myboost::bad_weak_ptr()); + ++use_count_; + } + + void release() // nothrow + { + { + mutex_type::scoped_lock lock(mtx_); + long new_use_count = --use_count_; + + if(new_use_count != 0) return; + } + + dispose(); + weak_release(); + } + + void weak_add_ref() // nothrow + { + mutex_type::scoped_lock lock(mtx_); + ++weak_count_; + } + + void weak_release() // nothrow + { + long new_weak_count; + + { + mutex_type::scoped_lock lock(mtx_); + new_weak_count = --weak_count_; + } + + if(new_weak_count == 0) + { + destruct(); + } + } + + long use_count() const // nothrow + { + mutex_type::scoped_lock lock(mtx_); + return use_count_; + } + +private: + + sp_counted_base(sp_counted_base const &); + sp_counted_base & operator= (sp_counted_base const &); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + + mutable mutex_type mtx_; +}; + +template class sp_counted_base_impl: public sp_counted_base +{ +private: + + P ptr; // copy constructor must not throw + D del; // copy constructor must not throw + + sp_counted_base_impl(sp_counted_base_impl const &); + sp_counted_base_impl & operator= (sp_counted_base_impl const &); + + typedef sp_counted_base_impl this_type; + +public: + + // pre: initial_use_count <= initial_weak_count, d(p) must not throw + + sp_counted_base_impl(P p, D d): ptr(p), del(d) + { + } + + virtual void dispose() // nothrow + { + del(ptr); + } + + virtual void * get_deleter(std::type_info const & ti) + { + return ti == typeid(D)? &del: 0; + } + + void * operator new(std::size_t) + { + return std::allocator().allocate(1, static_cast(0)); + } + + void operator delete(void * p) + { + std::allocator().deallocate(static_cast(p), 1); + } +}; + +class weak_count; + +class shared_count +{ +private: + + sp_counted_base * pi_; + + friend class weak_count; + +public: + + shared_count(): pi_(0) // nothrow + { + } + + template shared_count(P p, D d): pi_(0) + { + + try + { + pi_ = new sp_counted_base_impl(p, d); + } + catch(...) + { + d(p); // delete p + throw; + } + + + pi_ = new sp_counted_base_impl(p, d); + + if(pi_ == 0) + { + d(p); // delete p + myboost::throw_exception(std::bad_alloc()); + } + } + + // auto_ptr is special cased to provide the strong guarantee + + template + explicit shared_count(std::auto_ptr & r): pi_(new sp_counted_base_impl< Y *, checked_deleter >(r.get(), checked_deleter())) + { + r.release(); + } + + ~shared_count() // nothrow + { + if(pi_ != 0) pi_->release(); + } + + shared_count(shared_count const & r): pi_(r.pi_) // nothrow + { + if(pi_ != 0) pi_->add_ref_copy(); + } + + explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 + + shared_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + if(tmp != 0) tmp->add_ref_copy(); + if(pi_ != 0) pi_->release(); + pi_ = tmp; + + return *this; + } + + void swap(shared_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + bool unique() const // nothrow + { + return use_count() == 1; + } + + friend inline bool operator==(shared_count const & a, shared_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(shared_count const & a, shared_count const & b) + { + return std::less()(a.pi_, b.pi_); + } + + void * get_deleter(std::type_info const & ti) const + { + return pi_? pi_->get_deleter(ti): 0; + } +}; + +class weak_count +{ +private: + + sp_counted_base * pi_; + + friend class shared_count; + +public: + + weak_count(): pi_(0) // nothrow + { + } + + weak_count(shared_count const & r): pi_(r.pi_) // nothrow + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + weak_count(weak_count const & r): pi_(r.pi_) // nothrow + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + ~weak_count() // nothrow + { + if(pi_ != 0) pi_->weak_release(); + } + + weak_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + + return *this; + } + + weak_count & operator= (weak_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + + return *this; + } + + void swap(weak_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + friend inline bool operator==(weak_count const & a, weak_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(weak_count const & a, weak_count const & b) + { + return std::less()(a.pi_, b.pi_); + } +}; + +inline shared_count::shared_count(weak_count const & r): pi_(r.pi_) +{ + if(pi_ != 0) + { + pi_->add_ref_lock(); + } + else + { + myboost::throw_exception(myboost::bad_weak_ptr()); + } +} + +} // namespace detail + +} // namespace myboost + +#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_H_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/shared_count.hpp b/ksvg/impl/libs/libtext2path/src/myboost/shared_count.hpp deleted file mode 100644 index e8ec19a8..00000000 --- a/ksvg/impl/libs/libtext2path/src/myboost/shared_count.hpp +++ /dev/null @@ -1,367 +0,0 @@ -#ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED -#define BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED - -// -// detail/shared_count.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// - -#include "myboost/checked_delete.hpp" -#include "myboost/throw_exception.hpp" -#include "myboost/lightweight_mutex.hpp" - -#include // std::auto_ptr, std::allocator -#include // std::less -#include // std::exception -#include // std::bad_alloc -#include // std::type_info in get_deleter -#include // std::size_t - -namespace myboost -{ - -class bad_weak_ptr: public std::exception -{ -public: - - virtual char const * what() const throw() - { - return "myboost::bad_weak_ptr"; - } -}; - -namespace detail -{ - -class sp_counted_base -{ -private: - - typedef detail::lightweight_mutex mutex_type; - -public: - - sp_counted_base(): use_count_(1), weak_count_(1) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destruct() is called when weak_count_ drops to zero. - - virtual void destruct() // nothrow - { - delete this; - } - - virtual void * get_deleter(std::type_info const & ti) = 0; - - void add_ref_copy() - { - mutex_type::scoped_lock lock(mtx_); - ++use_count_; - } - - void add_ref_lock() - { - mutex_type::scoped_lock lock(mtx_); - if(use_count_ == 0) myboost::throw_exception(myboost::bad_weak_ptr()); - ++use_count_; - } - - void release() // nothrow - { - { - mutex_type::scoped_lock lock(mtx_); - long new_use_count = --use_count_; - - if(new_use_count != 0) return; - } - - dispose(); - weak_release(); - } - - void weak_add_ref() // nothrow - { - mutex_type::scoped_lock lock(mtx_); - ++weak_count_; - } - - void weak_release() // nothrow - { - long new_weak_count; - - { - mutex_type::scoped_lock lock(mtx_); - new_weak_count = --weak_count_; - } - - if(new_weak_count == 0) - { - destruct(); - } - } - - long use_count() const // nothrow - { - mutex_type::scoped_lock lock(mtx_); - return use_count_; - } - -private: - - sp_counted_base(sp_counted_base const &); - sp_counted_base & operator= (sp_counted_base const &); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - - mutable mutex_type mtx_; -}; - -template class sp_counted_base_impl: public sp_counted_base -{ -private: - - P ptr; // copy constructor must not throw - D del; // copy constructor must not throw - - sp_counted_base_impl(sp_counted_base_impl const &); - sp_counted_base_impl & operator= (sp_counted_base_impl const &); - - typedef sp_counted_base_impl this_type; - -public: - - // pre: initial_use_count <= initial_weak_count, d(p) must not throw - - sp_counted_base_impl(P p, D d): ptr(p), del(d) - { - } - - virtual void dispose() // nothrow - { - del(ptr); - } - - virtual void * get_deleter(std::type_info const & ti) - { - return ti == typeid(D)? &del: 0; - } - - void * operator new(std::size_t) - { - return std::allocator().allocate(1, static_cast(0)); - } - - void operator delete(void * p) - { - std::allocator().deallocate(static_cast(p), 1); - } -}; - -class weak_count; - -class shared_count -{ -private: - - sp_counted_base * pi_; - - friend class weak_count; - -public: - - shared_count(): pi_(0) // nothrow - { - } - - template shared_count(P p, D d): pi_(0) - { - - try - { - pi_ = new sp_counted_base_impl(p, d); - } - catch(...) - { - d(p); // delete p - throw; - } - - - pi_ = new sp_counted_base_impl(p, d); - - if(pi_ == 0) - { - d(p); // delete p - myboost::throw_exception(std::bad_alloc()); - } - } - - // auto_ptr is special cased to provide the strong guarantee - - template - explicit shared_count(std::auto_ptr & r): pi_(new sp_counted_base_impl< Y *, checked_deleter >(r.get(), checked_deleter())) - { - r.release(); - } - - ~shared_count() // nothrow - { - if(pi_ != 0) pi_->release(); - } - - shared_count(shared_count const & r): pi_(r.pi_) // nothrow - { - if(pi_ != 0) pi_->add_ref_copy(); - } - - explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 - - shared_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - if(tmp != 0) tmp->add_ref_copy(); - if(pi_ != 0) pi_->release(); - pi_ = tmp; - - return *this; - } - - void swap(shared_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - bool unique() const // nothrow - { - return use_count() == 1; - } - - friend inline bool operator==(shared_count const & a, shared_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(shared_count const & a, shared_count const & b) - { - return std::less()(a.pi_, b.pi_); - } - - void * get_deleter(std::type_info const & ti) const - { - return pi_? pi_->get_deleter(ti): 0; - } -}; - -class weak_count -{ -private: - - sp_counted_base * pi_; - - friend class shared_count; - -public: - - weak_count(): pi_(0) // nothrow - { - } - - weak_count(shared_count const & r): pi_(r.pi_) // nothrow - { - if(pi_ != 0) pi_->weak_add_ref(); - } - - weak_count(weak_count const & r): pi_(r.pi_) // nothrow - { - if(pi_ != 0) pi_->weak_add_ref(); - } - - ~weak_count() // nothrow - { - if(pi_ != 0) pi_->weak_release(); - } - - weak_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - - return *this; - } - - weak_count & operator= (weak_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - - return *this; - } - - void swap(weak_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - friend inline bool operator==(weak_count const & a, weak_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(weak_count const & a, weak_count const & b) - { - return std::less()(a.pi_, b.pi_); - } -}; - -inline shared_count::shared_count(weak_count const & r): pi_(r.pi_) -{ - if(pi_ != 0) - { - pi_->add_ref_lock(); - } - else - { - myboost::throw_exception(myboost::bad_weak_ptr()); - } -} - -} // namespace detail - -} // namespace myboost - -#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.h b/ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.h new file mode 100644 index 00000000..435be678 --- /dev/null +++ b/ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.h @@ -0,0 +1,395 @@ +#ifndef BOOST_SHARED_PTR_H_INCLUDED +#define BOOST_SHARED_PTR_H_INCLUDED + +// shared_ptr.h +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002, 2003 Peter Dimov +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation. +// + +#include "myboost/assert.h" +#include "myboost/checked_delete.h" +#include "myboost/throw_exception.h" +#include "myboost/shared_count.h" + +#include // for std::auto_ptr +#include // for std::swap +#include // for std::less +#include // for std::bad_cast +#include // for std::basic_ostream + +namespace myboost +{ + +template class weak_ptr; +template class enable_shared_from_this; + +namespace detail +{ + +struct static_cast_tag {}; +struct const_cast_tag {}; +struct dynamic_cast_tag {}; +struct polymorphic_cast_tag {}; + +template struct shared_ptr_traits +{ + typedef T & reference; +}; + +template<> struct shared_ptr_traits +{ + typedef void reference; +}; + +template<> struct shared_ptr_traits +{ + typedef void reference; +}; + +template<> struct shared_ptr_traits +{ + typedef void reference; +}; + +template<> struct shared_ptr_traits +{ + typedef void reference; +}; + +// enable_shared_from_this support + +template void sp_enable_shared_from_this(myboost::enable_shared_from_this * pe, Y * px, shared_count const & pn) +{ + if(pe != 0) pe->_internal_weak_this._internal_assign(px, pn); +} + +inline void sp_enable_shared_from_this(void const *, void const *, shared_count const &) +{ +} + +} // namespace detail + + +// +// shared_ptr +// +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. +// + +template class shared_ptr +{ +private: + + // Borland 5.5.1 specific workaround + typedef shared_ptr this_type; + +public: + + typedef T element_type; + typedef T value_type; + typedef T * pointer; + typedef typename detail::shared_ptr_traits::reference reference; + + shared_ptr(): px(0), pn() // never throws in 1.30+ + { + } + + template + explicit shared_ptr(Y * p): px(p), pn(p, checked_deleter()) // Y must be complete + { + detail::sp_enable_shared_from_this(p, p, pn); + } + + // + // Requirements: D's copy constructor must not throw + // + // shared_ptr will release p by calling d(p) + // + + template shared_ptr(Y * p, D d): px(p), pn(p, d) + { + detail::sp_enable_shared_from_this(p, p, pn); + } + +// generated copy constructor, assignment, destructor are fine... +// except that Borland C++ has a bug, and g++ with -Wsynth warns + shared_ptr & operator=(shared_ptr const & r) // never throws + { + px = r.px; + pn = r.pn; // shared_count::op= doesn't throw + return *this; + } + + template + explicit shared_ptr(weak_ptr const & r): pn(r.pn) // may throw + { + // it is now safe to copy r.px, as pn(r.pn) did not throw + px = r.px; + } + + template + shared_ptr(shared_ptr const & r): px(r.px), pn(r.pn) // never throws + { + } + + template + shared_ptr(shared_ptr const & r, detail::static_cast_tag): px(static_cast(r.px)), pn(r.pn) + { + } + + template + shared_ptr(shared_ptr const & r, detail::const_cast_tag): px(const_cast(r.px)), pn(r.pn) + { + } + + template + shared_ptr(shared_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) + { + if(px == 0) // need to allocate new counter -- the cast failed + { + pn = detail::shared_count(); + } + } + + template + shared_ptr(shared_ptr const & r, detail::polymorphic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) + { + if(px == 0) + { + myboost::throw_exception(std::bad_cast()); + } + } + + template + explicit shared_ptr(std::auto_ptr & r): px(r.get()), pn() + { + Y * tmp = r.get(); + pn = detail::shared_count(r); + detail::sp_enable_shared_from_this(tmp, tmp, pn); + } + + template + shared_ptr & operator=(shared_ptr const & r) // never throws + { + px = r.px; + pn = r.pn; // shared_count::op= doesn't throw + return *this; + } + + template + shared_ptr & operator=(std::auto_ptr & r) + { + this_type(r).swap(*this); + return *this; + } + + void reset() // never throws in 1.30+ + { + this_type().swap(*this); + } + + template void reset(Y * p) // Y must be complete + { + BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors + this_type(p).swap(*this); + } + + template void reset(Y * p, D d) + { + this_type(p, d).swap(*this); + } + + reference operator* () const // never throws + { + BOOST_ASSERT(px != 0); + return *px; + } + + T * operator-> () const // never throws + { + BOOST_ASSERT(px != 0); + return px; + } + + T * get() const // never throws + { + return px; + } + + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::get; + } + + // operator! is redundant, but some compilers need it + + bool operator! () const // never throws + { + return px == 0; + } + + bool unique() const // never throws + { + return pn.unique(); + } + + long use_count() const // never throws + { + return pn.use_count(); + } + + void swap(shared_ptr & other) // never throws + { + std::swap(px, other.px); + pn.swap(other.pn); + } + + template bool _internal_less(shared_ptr const & rhs) const + { + return pn < rhs.pn; + } + + void * _internal_get_deleter(std::type_info const & ti) const + { + return pn.get_deleter(ti); + } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) + +# if __GNUC__ >= 2 && __GNUC_MINOR__ >= 97 +private: + + template friend class shared_ptr; + template friend class weak_ptr; +#endif + + T * px; // contained pointer + detail::shared_count pn; // reference counter + +}; // shared_ptr + +template inline bool operator==(shared_ptr const & a, shared_ptr const & b) +{ + return a.get() == b.get(); +} + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) +{ + return a.get() != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) +{ + return a.get() != b.get(); +} + +#endif + +template inline bool operator<(shared_ptr const & a, shared_ptr const & b) +{ + return a._internal_less(b); +} + +template inline void swap(shared_ptr & a, shared_ptr & b) +{ + a.swap(b); +} + +template shared_ptr static_pointer_cast(shared_ptr const & r) +{ + return shared_ptr(r, detail::static_cast_tag()); +} + +template shared_ptr const_pointer_cast(shared_ptr const & r) +{ + return shared_ptr(r, detail::const_cast_tag()); +} + +template shared_ptr dynamic_pointer_cast(shared_ptr const & r) +{ + return shared_ptr(r, detail::dynamic_cast_tag()); +} + +// shared_*_cast names are deprecated. Use *_pointer_cast instead. + +template shared_ptr shared_static_cast(shared_ptr const & r) +{ + return shared_ptr(r, detail::static_cast_tag()); +} + +template shared_ptr shared_dynamic_cast(shared_ptr const & r) +{ + return shared_ptr(r, detail::dynamic_cast_tag()); +} + +template shared_ptr shared_polymorphic_cast(shared_ptr const & r) +{ + return shared_ptr(r, detail::polymorphic_cast_tag()); +} + +template shared_ptr shared_polymorphic_downcast(shared_ptr const & r) +{ + BOOST_ASSERT(dynamic_cast(r.get()) == r.get()); + return shared_static_cast(r); +} + +// get_pointer() enables boost::mem_fn to recognize shared_ptr + +template inline T * get_pointer(shared_ptr const & p) +{ + return p.get(); +} + +// operator<< + + +template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) +{ + os << p.get(); + return os; +} + + +// get_deleter (experimental) + +#if (defined(__GNUC__) && (__GNUC__ < 3)) || (defined(__EDG_VERSION__) && (__EDG_VERSION__ <= 238)) + +// g++ 2.9x doesn't allow static_cast(void *) +// apparently EDG 2.38 also doesn't accept it + +template D * get_deleter(shared_ptr const & p) +{ + void const * q = p._internal_get_deleter(typeid(D)); + return const_cast(static_cast(q)); +} + +#else + +template D * get_deleter(shared_ptr const & p) +{ + return static_cast(p._internal_get_deleter(typeid(D))); +} + +#endif + +} // namespace boost + + +#endif // #ifndef BOOST_SHARED_PTR_H_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.hpp b/ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.hpp deleted file mode 100644 index 3f2fe30d..00000000 --- a/ksvg/impl/libs/libtext2path/src/myboost/shared_ptr.hpp +++ /dev/null @@ -1,395 +0,0 @@ -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED -#define BOOST_SHARED_PTR_HPP_INCLUDED - -// shared_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002, 2003 Peter Dimov -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation. -// - -#include "myboost/assert.hpp" -#include "myboost/checked_delete.hpp" -#include "myboost/throw_exception.hpp" -#include "myboost/shared_count.hpp" - -#include // for std::auto_ptr -#include // for std::swap -#include // for std::less -#include // for std::bad_cast -#include // for std::basic_ostream - -namespace myboost -{ - -template class weak_ptr; -template class enable_shared_from_this; - -namespace detail -{ - -struct static_cast_tag {}; -struct const_cast_tag {}; -struct dynamic_cast_tag {}; -struct polymorphic_cast_tag {}; - -template struct shared_ptr_traits -{ - typedef T & reference; -}; - -template<> struct shared_ptr_traits -{ - typedef void reference; -}; - -template<> struct shared_ptr_traits -{ - typedef void reference; -}; - -template<> struct shared_ptr_traits -{ - typedef void reference; -}; - -template<> struct shared_ptr_traits -{ - typedef void reference; -}; - -// enable_shared_from_this support - -template void sp_enable_shared_from_this(myboost::enable_shared_from_this * pe, Y * px, shared_count const & pn) -{ - if(pe != 0) pe->_internal_weak_this._internal_assign(px, pn); -} - -inline void sp_enable_shared_from_this(void const *, void const *, shared_count const &) -{ -} - -} // namespace detail - - -// -// shared_ptr -// -// An enhanced relative of scoped_ptr with reference counted copy semantics. -// The object pointed to is deleted when the last shared_ptr pointing to it -// is destroyed or reset. -// - -template class shared_ptr -{ -private: - - // Borland 5.5.1 specific workaround - typedef shared_ptr this_type; - -public: - - typedef T element_type; - typedef T value_type; - typedef T * pointer; - typedef typename detail::shared_ptr_traits::reference reference; - - shared_ptr(): px(0), pn() // never throws in 1.30+ - { - } - - template - explicit shared_ptr(Y * p): px(p), pn(p, checked_deleter()) // Y must be complete - { - detail::sp_enable_shared_from_this(p, p, pn); - } - - // - // Requirements: D's copy constructor must not throw - // - // shared_ptr will release p by calling d(p) - // - - template shared_ptr(Y * p, D d): px(p), pn(p, d) - { - detail::sp_enable_shared_from_this(p, p, pn); - } - -// generated copy constructor, assignment, destructor are fine... -// except that Borland C++ has a bug, and g++ with -Wsynth warns - shared_ptr & operator=(shared_ptr const & r) // never throws - { - px = r.px; - pn = r.pn; // shared_count::op= doesn't throw - return *this; - } - - template - explicit shared_ptr(weak_ptr const & r): pn(r.pn) // may throw - { - // it is now safe to copy r.px, as pn(r.pn) did not throw - px = r.px; - } - - template - shared_ptr(shared_ptr const & r): px(r.px), pn(r.pn) // never throws - { - } - - template - shared_ptr(shared_ptr const & r, detail::static_cast_tag): px(static_cast(r.px)), pn(r.pn) - { - } - - template - shared_ptr(shared_ptr const & r, detail::const_cast_tag): px(const_cast(r.px)), pn(r.pn) - { - } - - template - shared_ptr(shared_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) - { - if(px == 0) // need to allocate new counter -- the cast failed - { - pn = detail::shared_count(); - } - } - - template - shared_ptr(shared_ptr const & r, detail::polymorphic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) - { - if(px == 0) - { - myboost::throw_exception(std::bad_cast()); - } - } - - template - explicit shared_ptr(std::auto_ptr & r): px(r.get()), pn() - { - Y * tmp = r.get(); - pn = detail::shared_count(r); - detail::sp_enable_shared_from_this(tmp, tmp, pn); - } - - template - shared_ptr & operator=(shared_ptr const & r) // never throws - { - px = r.px; - pn = r.pn; // shared_count::op= doesn't throw - return *this; - } - - template - shared_ptr & operator=(std::auto_ptr & r) - { - this_type(r).swap(*this); - return *this; - } - - void reset() // never throws in 1.30+ - { - this_type().swap(*this); - } - - template void reset(Y * p) // Y must be complete - { - BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors - this_type(p).swap(*this); - } - - template void reset(Y * p, D d) - { - this_type(p, d).swap(*this); - } - - reference operator* () const // never throws - { - BOOST_ASSERT(px != 0); - return *px; - } - - T * operator-> () const // never throws - { - BOOST_ASSERT(px != 0); - return px; - } - - T * get() const // never throws - { - return px; - } - - typedef T * (this_type::*unspecified_bool_type)() const; - - operator unspecified_bool_type() const // never throws - { - return px == 0? 0: &this_type::get; - } - - // operator! is redundant, but some compilers need it - - bool operator! () const // never throws - { - return px == 0; - } - - bool unique() const // never throws - { - return pn.unique(); - } - - long use_count() const // never throws - { - return pn.use_count(); - } - - void swap(shared_ptr & other) // never throws - { - std::swap(px, other.px); - pn.swap(other.pn); - } - - template bool _internal_less(shared_ptr const & rhs) const - { - return pn < rhs.pn; - } - - void * _internal_get_deleter(std::type_info const & ti) const - { - return pn.get_deleter(ti); - } - -// Tasteless as this may seem, making all members public allows member templates -// to work in the absence of member template friends. (Matthew Langston) - -# if __GNUC__ >= 2 && __GNUC_MINOR__ >= 97 -private: - - template friend class shared_ptr; - template friend class weak_ptr; -#endif - - T * px; // contained pointer - detail::shared_count pn; // reference counter - -}; // shared_ptr - -template inline bool operator==(shared_ptr const & a, shared_ptr const & b) -{ - return a.get() == b.get(); -} - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) -{ - return a.get() != b.get(); -} - -#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 - -// Resolve the ambiguity between our op!= and the one in rel_ops - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) -{ - return a.get() != b.get(); -} - -#endif - -template inline bool operator<(shared_ptr const & a, shared_ptr const & b) -{ - return a._internal_less(b); -} - -template inline void swap(shared_ptr & a, shared_ptr & b) -{ - a.swap(b); -} - -template shared_ptr static_pointer_cast(shared_ptr const & r) -{ - return shared_ptr(r, detail::static_cast_tag()); -} - -template shared_ptr const_pointer_cast(shared_ptr const & r) -{ - return shared_ptr(r, detail::const_cast_tag()); -} - -template shared_ptr dynamic_pointer_cast(shared_ptr const & r) -{ - return shared_ptr(r, detail::dynamic_cast_tag()); -} - -// shared_*_cast names are deprecated. Use *_pointer_cast instead. - -template shared_ptr shared_static_cast(shared_ptr const & r) -{ - return shared_ptr(r, detail::static_cast_tag()); -} - -template shared_ptr shared_dynamic_cast(shared_ptr const & r) -{ - return shared_ptr(r, detail::dynamic_cast_tag()); -} - -template shared_ptr shared_polymorphic_cast(shared_ptr const & r) -{ - return shared_ptr(r, detail::polymorphic_cast_tag()); -} - -template shared_ptr shared_polymorphic_downcast(shared_ptr const & r) -{ - BOOST_ASSERT(dynamic_cast(r.get()) == r.get()); - return shared_static_cast(r); -} - -// get_pointer() enables boost::mem_fn to recognize shared_ptr - -template inline T * get_pointer(shared_ptr const & p) -{ - return p.get(); -} - -// operator<< - - -template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) -{ - os << p.get(); - return os; -} - - -// get_deleter (experimental) - -#if (defined(__GNUC__) && (__GNUC__ < 3)) || (defined(__EDG_VERSION__) && (__EDG_VERSION__ <= 238)) - -// g++ 2.9x doesn't allow static_cast(void *) -// apparently EDG 2.38 also doesn't accept it - -template D * get_deleter(shared_ptr const & p) -{ - void const * q = p._internal_get_deleter(typeid(D)); - return const_cast(static_cast(q)); -} - -#else - -template D * get_deleter(shared_ptr const & p) -{ - return static_cast(p._internal_get_deleter(typeid(D))); -} - -#endif - -} // namespace boost - - -#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/throw_exception.h b/ksvg/impl/libs/libtext2path/src/myboost/throw_exception.h new file mode 100644 index 00000000..3223b564 --- /dev/null +++ b/ksvg/impl/libs/libtext2path/src/myboost/throw_exception.h @@ -0,0 +1,30 @@ +#ifndef BOOST_THROW_EXCEPTION_H_INCLUDED +#define BOOST_THROW_EXCEPTION_H_INCLUDED + + +// +// boost/throw_exception.h +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// http://www.boost.org/libs/utility/throw_exception.html +// + +# include + +namespace myboost +{ + +template void throw_exception(E const & e) +{ + throw e; +} + +} // namespace myboost + +#endif // #ifndef BOOST_THROW_EXCEPTION_H_INCLUDED diff --git a/ksvg/impl/libs/libtext2path/src/myboost/throw_exception.hpp b/ksvg/impl/libs/libtext2path/src/myboost/throw_exception.hpp deleted file mode 100644 index dd32ec43..00000000 --- a/ksvg/impl/libs/libtext2path/src/myboost/throw_exception.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED -#define BOOST_THROW_EXCEPTION_HPP_INCLUDED - - -// -// boost/throw_exception.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// http://www.boost.org/libs/utility/throw_exception.html -// - -# include - -namespace myboost -{ - -template void throw_exception(E const & e) -{ - throw e; -} - -} // namespace myboost - -#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED diff --git a/ksvg/impl/svgpathparser.cc b/ksvg/impl/svgpathparser.cc deleted file mode 100644 index 87a03aca..00000000 --- a/ksvg/impl/svgpathparser.cc +++ /dev/null @@ -1,564 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002, 2003 The Karbon Developers - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "svgpathparser.h" -#include -#include - -// parses the number into parameter number -const char * -KSVG::getNumber( const char *ptr, double &number ) -{ - int integer, exponent; - double decimal, frac; - int sign, expsign; - - exponent = 0; - integer = 0; - frac = 1.0; - decimal = 0; - sign = 1; - expsign = 1; - - // read the sign - if(*ptr == '+') - ptr++; - else if(*ptr == '-') - { - ptr++; - sign = -1; - } - - // read the integer part - while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9') - integer = (integer * 10) + *(ptr++) - '0'; - if(*ptr == '.') // read the decimals - { - ptr++; - while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9') - decimal += (*(ptr++) - '0') * (frac *= 0.1); - } - - if(*ptr == 'e' || *ptr == 'E') // read the exponent part - { - ptr++; - - // read the sign of the exponent - if(*ptr == '+') - ptr++; - else if(*ptr == '-') - { - ptr++; - expsign = -1; - } - - exponent = 0; - while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9') - { - exponent *= 10; - exponent += *ptr - '0'; - ptr++; - } - } - number = integer + decimal; - number *= sign * pow( (double)10, double( expsign * exponent ) ); - - return ptr; -} - -// parses the coord into parameter number and forwards to the next coord in the path data -const char * -SVGPathParser::getCoord( const char *ptr, double &number ) -{ - ptr = KSVG::getNumber( ptr, number ); - // skip the following space - if(*ptr == ' ') - ptr++; - - return ptr; -} - -void -SVGPathParser::parseSVG( const TQString &s, bool process ) -{ - if(!s.isEmpty()) - { - TQString d = s; - d = d.replace(',', ' '); - d = d.simplifyWhiteSpace(); - const char *ptr = d.latin1(); - const char *end = d.latin1() + d.length() + 1; - - double contrlx, contrly, curx, cury, subpathx, subpathy, tox, toy, x1, y1, x2, y2, xc, yc; - double px1, py1, px2, py2, px3, py3; - bool relative, closed = true; - char command = *(ptr++), lastCommand = ' '; - - subpathx = subpathy = curx = cury = contrlx = contrly = 0.0; - while( ptr < end ) - { - if( *ptr == ' ' ) - ptr++; - - relative = false; - - //std::cout << "Command : " << command << std::endl; - switch( command ) - { - case 'm': - relative = true; - case 'M': - { - ptr = getCoord( ptr, tox ); - ptr = getCoord( ptr, toy ); - - if( process ) - { - subpathx = curx = relative ? curx + tox : tox; - subpathy = cury = relative ? cury + toy : toy; - - svgMoveTo( curx, cury, closed ); - } - else - svgMoveTo( tox, toy, closed, !relative ); - closed = false; - break; - } - case 'l': - relative = true; - case 'L': - { - ptr = getCoord( ptr, tox ); - ptr = getCoord( ptr, toy ); - - if( process ) - { - curx = relative ? curx + tox : tox; - cury = relative ? cury + toy : toy; - - svgLineTo( curx, cury ); - } - else - svgLineTo( tox, toy, !relative ); - break; - } - case 'h': - { - ptr = getCoord( ptr, tox ); - if( process ) - { - curx = curx + tox; - svgLineTo( curx, cury ); - } - else - svgLineToHorizontal( tox, false ); - break; - } - case 'H': - { - ptr = getCoord( ptr, tox ); - if( process ) - { - curx = tox; - svgLineTo( curx, cury ); - } - else - svgLineToHorizontal( tox ); - break; - } - case 'v': - { - ptr = getCoord( ptr, toy ); - if( process ) - { - cury = cury + toy; - svgLineTo( curx, cury ); - } - else - svgLineToVertical( toy, false ); - break; - } - case 'V': - { - ptr = getCoord( ptr, toy ); - if( process ) - { - cury = toy; - svgLineTo( curx, cury ); - } - else - svgLineToVertical( toy ); - break; - } - case 'z': - case 'Z': - { - // reset curx, cury for next path - if( process ) - { - curx = subpathx; - cury = subpathy; - } - closed = true; - svgClosePath(); - break; - } - case 'c': - relative = true; - case 'C': - { - ptr = getCoord( ptr, x1 ); - ptr = getCoord( ptr, y1 ); - ptr = getCoord( ptr, x2 ); - ptr = getCoord( ptr, y2 ); - ptr = getCoord( ptr, tox ); - ptr = getCoord( ptr, toy ); - - if( process ) - { - px1 = relative ? curx + x1 : x1; - py1 = relative ? cury + y1 : y1; - px2 = relative ? curx + x2 : x2; - py2 = relative ? cury + y2 : y2; - px3 = relative ? curx + tox : tox; - py3 = relative ? cury + toy : toy; - - svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); - - contrlx = relative ? curx + x2 : x2; - contrly = relative ? cury + y2 : y2; - curx = relative ? curx + tox : tox; - cury = relative ? cury + toy : toy; - } - else - svgCurveToCubic( x1, y1, x2, y2, tox, toy, !relative ); - - break; - } - case 's': - relative = true; - case 'S': - { - ptr = getCoord( ptr, x2 ); - ptr = getCoord( ptr, y2 ); - ptr = getCoord( ptr, tox ); - ptr = getCoord( ptr, toy ); - - if( process ) - { - px1 = 2 * curx - contrlx; - py1 = 2 * cury - contrly; - px2 = relative ? curx + x2 : x2; - py2 = relative ? cury + y2 : y2; - px3 = relative ? curx + tox : tox; - py3 = relative ? cury + toy : toy; - - svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); - - contrlx = relative ? curx + x2 : x2; - contrly = relative ? cury + y2 : y2; - curx = relative ? curx + tox : tox; - cury = relative ? cury + toy : toy; - } - else - svgCurveToCubicSmooth( x2, y2, tox, toy, !relative ); - break; - } - case 'q': - relative = true; - case 'Q': - { - ptr = getCoord( ptr, x1 ); - ptr = getCoord( ptr, y1 ); - ptr = getCoord( ptr, tox ); - ptr = getCoord( ptr, toy ); - - if( process ) - { - px1 = relative ? (curx + 2 * (x1 + curx)) * (1.0 / 3.0) : (curx + 2 * x1) * (1.0 / 3.0); - py1 = relative ? (cury + 2 * (y1 + cury)) * (1.0 / 3.0) : (cury + 2 * y1) * (1.0 / 3.0); - px2 = relative ? ((curx + tox) + 2 * (x1 + curx)) * (1.0 / 3.0) : (tox + 2 * x1) * (1.0 / 3.0); - py2 = relative ? ((cury + toy) + 2 * (y1 + cury)) * (1.0 / 3.0) : (toy + 2 * y1) * (1.0 / 3.0); - px3 = relative ? curx + tox : tox; - py3 = relative ? cury + toy : toy; - - svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); - - contrlx = relative ? curx + x1 : (tox + 2 * x1) * (1.0 / 3.0); - contrly = relative ? cury + y1 : (toy + 2 * y1) * (1.0 / 3.0); - curx = relative ? curx + tox : tox; - cury = relative ? cury + toy : toy; - } - else - svgCurveToQuadratic( x1, y1, tox, toy, !relative ); - break; - } - case 't': - relative = true; - case 'T': - { - ptr = getCoord(ptr, tox); - ptr = getCoord(ptr, toy); - - if( process ) - { - xc = 2 * curx - contrlx; - yc = 2 * cury - contrly; - - px1 = (curx + 2 * xc) * (1.0 / 3.0); - py1 = (cury + 2 * yc) * (1.0 / 3.0); - px2 = relative ? ((curx + tox) + 2 * xc) * (1.0 / 3.0) : (tox + 2 * xc) * (1.0 / 3.0); - py2 = relative ? ((cury + toy) + 2 * yc) * (1.0 / 3.0) : (toy + 2 * yc) * (1.0 / 3.0); - px3 = relative ? curx + tox : tox; - py3 = relative ? cury + toy : toy; - - svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); - - contrlx = xc; - contrly = yc; - curx = relative ? curx + tox : tox; - cury = relative ? cury + toy : toy; - } - else - svgCurveToQuadraticSmooth( tox, toy, !relative ); - break; - } - case 'a': - relative = true; - case 'A': - { - bool largeArc, sweep; - double angle, rx, ry; - ptr = getCoord( ptr, rx ); - ptr = getCoord( ptr, ry ); - ptr = getCoord( ptr, angle ); - ptr = getCoord( ptr, tox ); - largeArc = tox == 1; - ptr = getCoord( ptr, tox ); - sweep = tox == 1; - ptr = getCoord( ptr, tox ); - ptr = getCoord( ptr, toy ); - - // Spec: radii are nonnegative numbers - rx = fabs(rx); - ry = fabs(ry); - - if( process ) - calculateArc( relative, curx, cury, angle, tox, toy, rx, ry, largeArc, sweep ); - else - svgArcTo( tox, toy, rx, ry, angle, largeArc, sweep, !relative ); - } - } - - lastCommand = command; - - if(*ptr == '+' || *ptr == '-' || *ptr == '.' || (*ptr >= '0' && *ptr <= '9')) - { - // there are still coords in this command - if(command == 'M') - command = 'L'; - else if(command == 'm') - command = 'l'; - } - else - command = *(ptr++); - - if( lastCommand != 'C' && lastCommand != 'c' && - lastCommand != 'S' && lastCommand != 's' && - lastCommand != 'Q' && lastCommand != 'q' && - lastCommand != 'T' && lastCommand != 't') - { - contrlx = curx; - contrly = cury; - } - } - } -} - -// This works by converting the SVG arc to "simple" beziers. -// For each bezier found a svgToCurve call is done. -// Adapted from Niko's code in tdelibs/tdecore/svgicons. -// Maybe this can serve in some shared lib? (Rob) -void -SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag) -{ - double sin_th, cos_th; - double a00, a01, a10, a11; - double x0, y0, x1, y1, xc, yc; - double d, sfactor, sfactor_sq; - double th0, th1, th_arc; - int i, n_segs; - - sin_th = sin(angle * (M_PI / 180.0)); - cos_th = cos(angle * (M_PI / 180.0)); - - double dx; - - if(!relative) - dx = (curx - x) / 2.0; - else - dx = -x / 2.0; - - double dy; - - if(!relative) - dy = (cury - y) / 2.0; - else - dy = -y / 2.0; - - double _x1 = cos_th * dx + sin_th * dy; - double _y1 = -sin_th * dx + cos_th * dy; - double Pr1 = r1 * r1; - double Pr2 = r2 * r2; - double Px = _x1 * _x1; - double Py = _y1 * _y1; - - // Spec : check if radii are large enough - double check = Px / Pr1 + Py / Pr2; - if(check > 1) - { - r1 = r1 * sqrt(check); - r2 = r2 * sqrt(check); - } - - a00 = cos_th / r1; - a01 = sin_th / r1; - a10 = -sin_th / r2; - a11 = cos_th / r2; - - x0 = a00 * curx + a01 * cury; - y0 = a10 * curx + a11 * cury; - - if(!relative) - x1 = a00 * x + a01 * y; - else - x1 = a00 * (curx + x) + a01 * (cury + y); - - if(!relative) - y1 = a10 * x + a11 * y; - else - y1 = a10 * (curx + x) + a11 * (cury + y); - - /* (x0, y0) is current point in transformed coordinate space. - (x1, y1) is new point in transformed coordinate space. - - The arc fits a unit-radius circle in this space. - */ - - d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - - sfactor_sq = 1.0 / d - 0.25; - - if(sfactor_sq < 0) - sfactor_sq = 0; - - sfactor = sqrt(sfactor_sq); - - if(sweepFlag == largeArcFlag) - sfactor = -sfactor; - - xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - - /* (xc, yc) is center of the circle. */ - th0 = atan2(y0 - yc, x0 - xc); - th1 = atan2(y1 - yc, x1 - xc); - - th_arc = th1 - th0; - if(th_arc < 0 && sweepFlag) - th_arc += 2 * M_PI; - else if(th_arc > 0 && !sweepFlag) - th_arc -= 2 * M_PI; - - n_segs = (int) (int) ceil(fabs(th_arc / (M_PI * 0.5 + 0.001))); - - for(i = 0; i < n_segs; i++) - { - { - double sin_th, cos_th; - double a00, a01, a10, a11; - double x1, y1, x2, y2, x3, y3; - double t; - double th_half; - - double _th0 = th0 + i * th_arc / n_segs; - double _th1 = th0 + (i + 1) * th_arc / n_segs; - - sin_th = sin(angle * (M_PI / 180.0)); - cos_th = cos(angle * (M_PI / 180.0)); - - /* inverse transform compared with rsvg_path_arc */ - a00 = cos_th * r1; - a01 = -sin_th * r2; - a10 = sin_th * r1; - a11 = cos_th * r2; - - th_half = 0.5 * (_th1 - _th0); - t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half); - x1 = xc + cos(_th0) - t * sin(_th0); - y1 = yc + sin(_th0) + t * cos(_th0); - x3 = xc + cos(_th1); - y3 = yc + sin(_th1); - x2 = x3 + t * sin(_th1); - y2 = y3 - t * cos(_th1); - - svgCurveToCubic( a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3 ); - } - } - - if(!relative) - curx = x; - else - curx += x; - - if(!relative) - cury = y; - else - cury += y; -} - -void -SVGPathParser::svgLineToHorizontal( double, bool ) -{ -} - -void -SVGPathParser::svgLineToVertical( double, bool ) -{ -} - -void -SVGPathParser::svgCurveToCubicSmooth( double, double, double, double, bool ) -{ -} - -void -SVGPathParser::svgCurveToQuadratic( double, double, double, double, bool ) -{ -} - -void -SVGPathParser::svgCurveToQuadraticSmooth( double, double, bool ) -{ -} - -void -SVGPathParser::svgArcTo( double, double, double, double, double, bool, bool, bool ) -{ -} diff --git a/ksvg/impl/svgpathparser.cpp b/ksvg/impl/svgpathparser.cpp new file mode 100644 index 00000000..87a03aca --- /dev/null +++ b/ksvg/impl/svgpathparser.cpp @@ -0,0 +1,564 @@ +/* This file is part of the KDE project + Copyright (C) 2002, 2003 The Karbon Developers + + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "svgpathparser.h" +#include +#include + +// parses the number into parameter number +const char * +KSVG::getNumber( const char *ptr, double &number ) +{ + int integer, exponent; + double decimal, frac; + int sign, expsign; + + exponent = 0; + integer = 0; + frac = 1.0; + decimal = 0; + sign = 1; + expsign = 1; + + // read the sign + if(*ptr == '+') + ptr++; + else if(*ptr == '-') + { + ptr++; + sign = -1; + } + + // read the integer part + while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9') + integer = (integer * 10) + *(ptr++) - '0'; + if(*ptr == '.') // read the decimals + { + ptr++; + while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9') + decimal += (*(ptr++) - '0') * (frac *= 0.1); + } + + if(*ptr == 'e' || *ptr == 'E') // read the exponent part + { + ptr++; + + // read the sign of the exponent + if(*ptr == '+') + ptr++; + else if(*ptr == '-') + { + ptr++; + expsign = -1; + } + + exponent = 0; + while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9') + { + exponent *= 10; + exponent += *ptr - '0'; + ptr++; + } + } + number = integer + decimal; + number *= sign * pow( (double)10, double( expsign * exponent ) ); + + return ptr; +} + +// parses the coord into parameter number and forwards to the next coord in the path data +const char * +SVGPathParser::getCoord( const char *ptr, double &number ) +{ + ptr = KSVG::getNumber( ptr, number ); + // skip the following space + if(*ptr == ' ') + ptr++; + + return ptr; +} + +void +SVGPathParser::parseSVG( const TQString &s, bool process ) +{ + if(!s.isEmpty()) + { + TQString d = s; + d = d.replace(',', ' '); + d = d.simplifyWhiteSpace(); + const char *ptr = d.latin1(); + const char *end = d.latin1() + d.length() + 1; + + double contrlx, contrly, curx, cury, subpathx, subpathy, tox, toy, x1, y1, x2, y2, xc, yc; + double px1, py1, px2, py2, px3, py3; + bool relative, closed = true; + char command = *(ptr++), lastCommand = ' '; + + subpathx = subpathy = curx = cury = contrlx = contrly = 0.0; + while( ptr < end ) + { + if( *ptr == ' ' ) + ptr++; + + relative = false; + + //std::cout << "Command : " << command << std::endl; + switch( command ) + { + case 'm': + relative = true; + case 'M': + { + ptr = getCoord( ptr, tox ); + ptr = getCoord( ptr, toy ); + + if( process ) + { + subpathx = curx = relative ? curx + tox : tox; + subpathy = cury = relative ? cury + toy : toy; + + svgMoveTo( curx, cury, closed ); + } + else + svgMoveTo( tox, toy, closed, !relative ); + closed = false; + break; + } + case 'l': + relative = true; + case 'L': + { + ptr = getCoord( ptr, tox ); + ptr = getCoord( ptr, toy ); + + if( process ) + { + curx = relative ? curx + tox : tox; + cury = relative ? cury + toy : toy; + + svgLineTo( curx, cury ); + } + else + svgLineTo( tox, toy, !relative ); + break; + } + case 'h': + { + ptr = getCoord( ptr, tox ); + if( process ) + { + curx = curx + tox; + svgLineTo( curx, cury ); + } + else + svgLineToHorizontal( tox, false ); + break; + } + case 'H': + { + ptr = getCoord( ptr, tox ); + if( process ) + { + curx = tox; + svgLineTo( curx, cury ); + } + else + svgLineToHorizontal( tox ); + break; + } + case 'v': + { + ptr = getCoord( ptr, toy ); + if( process ) + { + cury = cury + toy; + svgLineTo( curx, cury ); + } + else + svgLineToVertical( toy, false ); + break; + } + case 'V': + { + ptr = getCoord( ptr, toy ); + if( process ) + { + cury = toy; + svgLineTo( curx, cury ); + } + else + svgLineToVertical( toy ); + break; + } + case 'z': + case 'Z': + { + // reset curx, cury for next path + if( process ) + { + curx = subpathx; + cury = subpathy; + } + closed = true; + svgClosePath(); + break; + } + case 'c': + relative = true; + case 'C': + { + ptr = getCoord( ptr, x1 ); + ptr = getCoord( ptr, y1 ); + ptr = getCoord( ptr, x2 ); + ptr = getCoord( ptr, y2 ); + ptr = getCoord( ptr, tox ); + ptr = getCoord( ptr, toy ); + + if( process ) + { + px1 = relative ? curx + x1 : x1; + py1 = relative ? cury + y1 : y1; + px2 = relative ? curx + x2 : x2; + py2 = relative ? cury + y2 : y2; + px3 = relative ? curx + tox : tox; + py3 = relative ? cury + toy : toy; + + svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); + + contrlx = relative ? curx + x2 : x2; + contrly = relative ? cury + y2 : y2; + curx = relative ? curx + tox : tox; + cury = relative ? cury + toy : toy; + } + else + svgCurveToCubic( x1, y1, x2, y2, tox, toy, !relative ); + + break; + } + case 's': + relative = true; + case 'S': + { + ptr = getCoord( ptr, x2 ); + ptr = getCoord( ptr, y2 ); + ptr = getCoord( ptr, tox ); + ptr = getCoord( ptr, toy ); + + if( process ) + { + px1 = 2 * curx - contrlx; + py1 = 2 * cury - contrly; + px2 = relative ? curx + x2 : x2; + py2 = relative ? cury + y2 : y2; + px3 = relative ? curx + tox : tox; + py3 = relative ? cury + toy : toy; + + svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); + + contrlx = relative ? curx + x2 : x2; + contrly = relative ? cury + y2 : y2; + curx = relative ? curx + tox : tox; + cury = relative ? cury + toy : toy; + } + else + svgCurveToCubicSmooth( x2, y2, tox, toy, !relative ); + break; + } + case 'q': + relative = true; + case 'Q': + { + ptr = getCoord( ptr, x1 ); + ptr = getCoord( ptr, y1 ); + ptr = getCoord( ptr, tox ); + ptr = getCoord( ptr, toy ); + + if( process ) + { + px1 = relative ? (curx + 2 * (x1 + curx)) * (1.0 / 3.0) : (curx + 2 * x1) * (1.0 / 3.0); + py1 = relative ? (cury + 2 * (y1 + cury)) * (1.0 / 3.0) : (cury + 2 * y1) * (1.0 / 3.0); + px2 = relative ? ((curx + tox) + 2 * (x1 + curx)) * (1.0 / 3.0) : (tox + 2 * x1) * (1.0 / 3.0); + py2 = relative ? ((cury + toy) + 2 * (y1 + cury)) * (1.0 / 3.0) : (toy + 2 * y1) * (1.0 / 3.0); + px3 = relative ? curx + tox : tox; + py3 = relative ? cury + toy : toy; + + svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); + + contrlx = relative ? curx + x1 : (tox + 2 * x1) * (1.0 / 3.0); + contrly = relative ? cury + y1 : (toy + 2 * y1) * (1.0 / 3.0); + curx = relative ? curx + tox : tox; + cury = relative ? cury + toy : toy; + } + else + svgCurveToQuadratic( x1, y1, tox, toy, !relative ); + break; + } + case 't': + relative = true; + case 'T': + { + ptr = getCoord(ptr, tox); + ptr = getCoord(ptr, toy); + + if( process ) + { + xc = 2 * curx - contrlx; + yc = 2 * cury - contrly; + + px1 = (curx + 2 * xc) * (1.0 / 3.0); + py1 = (cury + 2 * yc) * (1.0 / 3.0); + px2 = relative ? ((curx + tox) + 2 * xc) * (1.0 / 3.0) : (tox + 2 * xc) * (1.0 / 3.0); + py2 = relative ? ((cury + toy) + 2 * yc) * (1.0 / 3.0) : (toy + 2 * yc) * (1.0 / 3.0); + px3 = relative ? curx + tox : tox; + py3 = relative ? cury + toy : toy; + + svgCurveToCubic( px1, py1, px2, py2, px3, py3 ); + + contrlx = xc; + contrly = yc; + curx = relative ? curx + tox : tox; + cury = relative ? cury + toy : toy; + } + else + svgCurveToQuadraticSmooth( tox, toy, !relative ); + break; + } + case 'a': + relative = true; + case 'A': + { + bool largeArc, sweep; + double angle, rx, ry; + ptr = getCoord( ptr, rx ); + ptr = getCoord( ptr, ry ); + ptr = getCoord( ptr, angle ); + ptr = getCoord( ptr, tox ); + largeArc = tox == 1; + ptr = getCoord( ptr, tox ); + sweep = tox == 1; + ptr = getCoord( ptr, tox ); + ptr = getCoord( ptr, toy ); + + // Spec: radii are nonnegative numbers + rx = fabs(rx); + ry = fabs(ry); + + if( process ) + calculateArc( relative, curx, cury, angle, tox, toy, rx, ry, largeArc, sweep ); + else + svgArcTo( tox, toy, rx, ry, angle, largeArc, sweep, !relative ); + } + } + + lastCommand = command; + + if(*ptr == '+' || *ptr == '-' || *ptr == '.' || (*ptr >= '0' && *ptr <= '9')) + { + // there are still coords in this command + if(command == 'M') + command = 'L'; + else if(command == 'm') + command = 'l'; + } + else + command = *(ptr++); + + if( lastCommand != 'C' && lastCommand != 'c' && + lastCommand != 'S' && lastCommand != 's' && + lastCommand != 'Q' && lastCommand != 'q' && + lastCommand != 'T' && lastCommand != 't') + { + contrlx = curx; + contrly = cury; + } + } + } +} + +// This works by converting the SVG arc to "simple" beziers. +// For each bezier found a svgToCurve call is done. +// Adapted from Niko's code in tdelibs/tdecore/svgicons. +// Maybe this can serve in some shared lib? (Rob) +void +SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag) +{ + double sin_th, cos_th; + double a00, a01, a10, a11; + double x0, y0, x1, y1, xc, yc; + double d, sfactor, sfactor_sq; + double th0, th1, th_arc; + int i, n_segs; + + sin_th = sin(angle * (M_PI / 180.0)); + cos_th = cos(angle * (M_PI / 180.0)); + + double dx; + + if(!relative) + dx = (curx - x) / 2.0; + else + dx = -x / 2.0; + + double dy; + + if(!relative) + dy = (cury - y) / 2.0; + else + dy = -y / 2.0; + + double _x1 = cos_th * dx + sin_th * dy; + double _y1 = -sin_th * dx + cos_th * dy; + double Pr1 = r1 * r1; + double Pr2 = r2 * r2; + double Px = _x1 * _x1; + double Py = _y1 * _y1; + + // Spec : check if radii are large enough + double check = Px / Pr1 + Py / Pr2; + if(check > 1) + { + r1 = r1 * sqrt(check); + r2 = r2 * sqrt(check); + } + + a00 = cos_th / r1; + a01 = sin_th / r1; + a10 = -sin_th / r2; + a11 = cos_th / r2; + + x0 = a00 * curx + a01 * cury; + y0 = a10 * curx + a11 * cury; + + if(!relative) + x1 = a00 * x + a01 * y; + else + x1 = a00 * (curx + x) + a01 * (cury + y); + + if(!relative) + y1 = a10 * x + a11 * y; + else + y1 = a10 * (curx + x) + a11 * (cury + y); + + /* (x0, y0) is current point in transformed coordinate space. + (x1, y1) is new point in transformed coordinate space. + + The arc fits a unit-radius circle in this space. + */ + + d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); + + sfactor_sq = 1.0 / d - 0.25; + + if(sfactor_sq < 0) + sfactor_sq = 0; + + sfactor = sqrt(sfactor_sq); + + if(sweepFlag == largeArcFlag) + sfactor = -sfactor; + + xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); + yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); + + /* (xc, yc) is center of the circle. */ + th0 = atan2(y0 - yc, x0 - xc); + th1 = atan2(y1 - yc, x1 - xc); + + th_arc = th1 - th0; + if(th_arc < 0 && sweepFlag) + th_arc += 2 * M_PI; + else if(th_arc > 0 && !sweepFlag) + th_arc -= 2 * M_PI; + + n_segs = (int) (int) ceil(fabs(th_arc / (M_PI * 0.5 + 0.001))); + + for(i = 0; i < n_segs; i++) + { + { + double sin_th, cos_th; + double a00, a01, a10, a11; + double x1, y1, x2, y2, x3, y3; + double t; + double th_half; + + double _th0 = th0 + i * th_arc / n_segs; + double _th1 = th0 + (i + 1) * th_arc / n_segs; + + sin_th = sin(angle * (M_PI / 180.0)); + cos_th = cos(angle * (M_PI / 180.0)); + + /* inverse transform compared with rsvg_path_arc */ + a00 = cos_th * r1; + a01 = -sin_th * r2; + a10 = sin_th * r1; + a11 = cos_th * r2; + + th_half = 0.5 * (_th1 - _th0); + t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half); + x1 = xc + cos(_th0) - t * sin(_th0); + y1 = yc + sin(_th0) + t * cos(_th0); + x3 = xc + cos(_th1); + y3 = yc + sin(_th1); + x2 = x3 + t * sin(_th1); + y2 = y3 - t * cos(_th1); + + svgCurveToCubic( a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3 ); + } + } + + if(!relative) + curx = x; + else + curx += x; + + if(!relative) + cury = y; + else + cury += y; +} + +void +SVGPathParser::svgLineToHorizontal( double, bool ) +{ +} + +void +SVGPathParser::svgLineToVertical( double, bool ) +{ +} + +void +SVGPathParser::svgCurveToCubicSmooth( double, double, double, double, bool ) +{ +} + +void +SVGPathParser::svgCurveToQuadratic( double, double, double, double, bool ) +{ +} + +void +SVGPathParser::svgCurveToQuadraticSmooth( double, double, bool ) +{ +} + +void +SVGPathParser::svgArcTo( double, double, double, double, double, bool, bool, bool ) +{ +} diff --git a/ksvg/scripts/check_hashtablesize.pl b/ksvg/scripts/check_hashtablesize.pl index d22e3f30..d460e5ad 100755 --- a/ksvg/scripts/check_hashtablesize.pl +++ b/ksvg/scripts/check_hashtablesize.pl @@ -138,10 +138,10 @@ foreach(@useresult) { my $temp = $middle[0]; if($calcMode != 2) { - $temp =~ s/.cc://; + $temp =~ s/.cpp://; $class = $temp; } else { - $temp =~ s/.cc//; + $temp =~ s/.cpp//; $class = substr($temp, 0, index($temp, ":")); } } diff --git a/ksvg/scripts/gen.sh b/ksvg/scripts/gen.sh index 9c87e22e..5e53438e 100755 --- a/ksvg/scripts/gen.sh +++ b/ksvg/scripts/gen.sh @@ -12,11 +12,11 @@ fi # make them touch $1.h -touch $1.cc +touch $1.cpp #start with copyright notices cat ../COPYRIGHTS > $1.h -cat ../COPYRIGHTS > $1.cc +cat ../COPYRIGHTS > $1.cpp # add define for multiple include problem echo "" >> $1.h @@ -27,13 +27,13 @@ echo "namespace KSVG" >> $1.h echo "{" >> $1.h echo "" >> $1.h -#include in .cc + namespace -echo "" >> $1.cc -echo "#include \"$1.h\"" >> $1.cc -echo "#include \"$1Impl.h\"" >> $1.cc -echo "" >> $1.cc -echo "using namespace KSVG;" >> $1.cc -echo "" >> $1.cc +#include in .cpp + namespace +echo "" >> $1.cpp +echo "#include \"$1.h\"" >> $1.cpp +echo "#include \"$1Impl.h\"" >> $1.cpp +echo "" >> $1.cpp +echo "using namespace KSVG;" >> $1.cpp +echo "" >> $1.cpp #go go go $cmd_awk -f ../makeheader $1 diff --git a/ksvg/scripts/genimpl.sh b/ksvg/scripts/genimpl.sh index 207e4329..c4cd1284 100755 --- a/ksvg/scripts/genimpl.sh +++ b/ksvg/scripts/genimpl.sh @@ -12,11 +12,11 @@ fi # you cant touch this touch $1Impl.h -touch $1Impl.cc +touch $1Impl.cpp #start with copyright notices cat ../COPYRIGHTS > $1Impl.h -cat ../COPYRIGHTS > $1Impl.cc +cat ../COPYRIGHTS > $1Impl.cpp # add define for multiple include problem echo "" >> $1Impl.h @@ -28,12 +28,12 @@ echo "" >> $1Impl.h echo "namespace KSVG" >> $1Impl.h echo "{" >> $1Impl.h -#include in .cc + namespace -echo "" >> $1Impl.cc -echo "#include \"$1Impl.h\"" >> $1Impl.cc -echo "" >> $1Impl.cc -echo "using namespace KSVG;" >> $1Impl.cc -echo "" >> $1Impl.cc +#include in .cpp + namespace +echo "" >> $1Impl.cpp +echo "#include \"$1Impl.h\"" >> $1Impl.cpp +echo "" >> $1Impl.cpp +echo "using namespace KSVG;" >> $1Impl.cpp +echo "" >> $1Impl.cpp #go go go $cmd_awk -f ../makeimpl $1 diff --git a/ksvg/scripts/getjs.php b/ksvg/scripts/getjs.php index 5f300fe9..514287a3 100755 --- a/ksvg/scripts/getjs.php +++ b/ksvg/scripts/getjs.php @@ -359,7 +359,7 @@ function crawlFiles($path) crawlFiles($path."/".$file); fputs($fp,"Leaving directory ".$file."\n"); } - elseif (is_file($path."/".$file) && preg_match("/^[A-Za-z0-9_]+(\.cc|\.cpp|\.h|\.hpp)$/",$file)) + elseif (is_file($path."/".$file) && preg_match("/^[A-Za-z0-9_]+(\.cpp|\.h)$/",$file)) { fputs($fp,"\tchecking $file\n"); searchKalyptusCode($path."/".$file,$fp); diff --git a/ksvg/scripts/makecc b/ksvg/scripts/makecc index 29a28b93..97eb4b74 100644 --- a/ksvg/scripts/makecc +++ b/ksvg/scripts/makecc @@ -1,6 +1,6 @@ function printg( a ) { - printf a >> FILENAME ".cc" + printf a >> FILENAME ".cpp" } function doFunc( a ) { diff --git a/ksvg/scripts/makeimpl b/ksvg/scripts/makeimpl index fb5ab8f5..e6c7b719 100644 --- a/ksvg/scripts/makeimpl +++ b/ksvg/scripts/makeimpl @@ -21,7 +21,7 @@ function printg( a ) } function printh( a ) { - printf a >> FILENAME "Impl.cc" + printf a >> FILENAME "Impl.cpp" } function doFuncCC( a, class ) { @@ -166,7 +166,7 @@ function doAttr( a, class ) printg( " " )n printg( b[nr] ");\n" ) - # do put method .cc + # do put method .cpp printtofunc( "void " clas "::set" ) printtofunc( toupper( substr( b[nr], 1, 1) ) ) printtofunc( substr( b[nr], 2) "(" ) @@ -212,7 +212,7 @@ function doAttr( a, class ) $temp = b[nr] printg( $temp "() const;\n" ) - # do get method .cc + # do get method .cpp i = 1 while ( i < nr ) { @@ -277,7 +277,7 @@ function doReadonlyAttr( a, class ) $temp = b[nr] printg( $temp "() const;\n" ) - # do get method .cc + # do get method .cpp i = 1 while ( i < nr ) { diff --git a/ksvg/test/external/CMakeLists.txt b/ksvg/test/external/CMakeLists.txt index 60c588a3..a07e0406 100644 --- a/ksvg/test/external/CMakeLists.txt +++ b/ksvg/test/external/CMakeLists.txt @@ -32,7 +32,7 @@ link_directories( ##### svgdisplay (executable) ################### tde_add_executable( svgdisplay AUTOMOC - SOURCES SVGTestWidget.cc svgdisplay.cc + SOURCES SVGTestWidget.cpp svgdisplay.cpp LINK ksvg-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/ksvg/test/external/Makefile.am b/ksvg/test/external/Makefile.am index 9a624667..b2b8c494 100644 --- a/ksvg/test/external/Makefile.am +++ b/ksvg/test/external/Makefile.am @@ -4,7 +4,7 @@ KDE_CXXFLAGS = $(USE_EXCEPTIONS) bin_PROGRAMS = svgdisplay printnodetest -svgdisplay_SOURCES = SVGTestWidget.cc svgdisplay.cc +svgdisplay_SOURCES = SVGTestWidget.cpp svgdisplay.cpp svgdisplay_LDADD = $(LIB_TDECORE) ../../libksvg.la svgdisplay_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor diff --git a/ksvg/test/external/SVGTestWidget.cc b/ksvg/test/external/SVGTestWidget.cc deleted file mode 100644 index 895b5357..00000000 --- a/ksvg/test/external/SVGTestWidget.cc +++ /dev/null @@ -1,204 +0,0 @@ -// Very small test app to look at ksvg performance without konqueror overhead (Rob) - -#include "SVGTestWidget.moc" -#include "DocumentFactory.h" -#include "CanvasFactory.h" -#include "SVGCircleElement.h" -#include "SVGAnimatedLength.h" -#include "SVGLength.h" -#include "SVGSVGElement.h" -#include "SVGEventImpl.h" -#include "KSVGCanvas.h" -#include "CanvasItem.h" -#include - -using namespace KSVG; - -SVGTestWidget::SVGTestWidget(const KURL &url) -{ - setBackgroundColor(TQt::white); - setMouseTracking(true); - setFocusPolicy(TQ_WheelFocus); - - m_doc = DocumentFactory::self()->requestDocument(TQT_TQOBJECT(this), TQT_SLOT(slotRenderingFinished())); - if(!m_doc) - return; - - resize(450, 450); - m_canvas = CanvasFactory::self()->loadCanvas(450, 450); - if(!m_canvas) - return; - - m_canvas->setup(TQT_TQPAINTDEVICE(this), TQT_TQPAINTDEVICE(this)); - - if(!DocumentFactory::self()->attachCanvas(m_canvas, m_doc)) - return; - - if(!DocumentFactory::self()->startParsing(m_doc, url)) - return; -} - -SVGTestWidget::~SVGTestWidget() -{ - delete m_canvas; - delete m_doc; -} - -void SVGTestWidget::slotRenderingFinished() -{ - TQRect rect(0, 0, width(), height()); - m_canvas->blit(rect, true); - - SVGElement test = m_doc->rootElement().getElementById("test"); - if(test.nodeName() == "circle") - { - SVGCircleElement c = dom_cast(SVGCircleElement, test); - c.r().baseVal().setValue(150); - c.setAttribute("fill", "blue"); - } -} - -void SVGTestWidget::paintEvent(TQPaintEvent *event) -{ - m_canvas->update(); - m_canvas->blit(event->rect(), true); -} - -void SVGTestWidget::resizeEvent(TQResizeEvent *event) -{ - int w = event->size().width(); - int h = event->size().height(); - - m_canvas->resize(w, h); - resize(w, h); - m_canvas->blit(); -} -/* -KSVG::SVGMouseEventImpl *newMouseEvent(SVGDocument *doc, KSVG::SVGEventImpl::EventId id, TQMouseEvent *event) -{ - DOM::AbstractView temp; - - int clientX = event->x(); - int clientY = event->y(); - - if(doc && doc->rootElement()) - { - clientX = int(clientX / doc->rootElement()->currentScale()); - clientY = int(clientY / doc->rootElement()->currentScale()); - } - - int button = 0; - if(event->stateAfter() & Qt::LeftButton) - button = 1; - else if(event->stateAfter() & Qt::MidButton) - button = 2; - else if(event->stateAfter() & Qt::RightButton) - button = 3; - - KSVG::SVGMouseEventImpl *mev = new KSVG::SVGMouseEventImpl(id, // type - true, // canBubbleArg - true, // cancelableArg - temp, // view - 0, // detail - event->globalX(), //screenXArg - event->globalY(), // screenYArg, - clientX, // clientXArg - clientY, // clientYArg - (event->state() & TQt::ControlButton), // ctrlKeyArg - (event->state() & TQt::AltButton), // altKeyArg - (event->state() & TQt::ShiftButton), // shiftKeyArg - (event->state() & TQt::MetaButton), // metaKeyArg - button, // buttonArg - 0); - - mev->ref(); - - return mev; -} - -void SVGTestWidget::mouseMoveEvent(TQMouseEvent *event) -{ - if(event->state() & TQMouseEvent::ControlButton && event->state() & TQMouseEvent::LeftButton) - { - if(m_panningPos.isNull()) - m_panningPos = event->pos(); - else - { - TQPoint panPoint = m_oldPanningPos - (m_panningPos - event->pos()); - m_doc->rootElement()->setCurrentTranslate(panPoint); -// m_doc->syncCachedMatrices(); FIXME - m_canvas->update(panPoint); - } - return; - } - else if(event->state() & TQMouseEvent::ControlButton) - return; -} - -void SVGTestWidget::mousePressEvent(TQMouseEvent *event) -{ - if(event->state() & TQMouseEvent::ControlButton) - return; - - KSVG::SVGMouseEventImpl *mev = newMouseEvent(m_doc, KSVG::SVGEventImpl::MOUSEDOWN_EVENT, event); - - if(m_doc && m_doc->rootElement()) - m_doc->rootElement()->prepareMouseEvent(event->pos(), event->pos(), mev); - mev->deref(); -} - -void SVGTestWidget::mouseReleaseEvent(TQMouseEvent *event) -{ - if(!m_panningPos.isNull()) - { - m_oldPanningPos = m_oldPanningPos - (m_panningPos - event->pos()); - m_panningPos.setX(0); - m_panningPos.setY(0); - } - - if(event->state() & TQMouseEvent::ControlButton) - return; - - // only simulate mouse clicks for now - KSVG::SVGMouseEventImpl *mev = newMouseEvent(m_doc, KSVG::SVGEventImpl::MOUSEUP_EVENT, event); - - if(m_doc && m_doc->rootElement()) - m_doc->rootElement()->prepareMouseEvent(event->pos(), event->pos(), mev); - mev->deref(); -} - -void SVGTestWidget::keyPressEvent(TQKeyEvent *event) -{ - if(event->stateAfter() & TQMouseEvent::ControlButton) - { - setCursor(KCursor::sizeAllCursor()); - return; - } -} - -void SVGTestWidget::keyReleaseEvent(TQKeyEvent *event) -{ - if(event->state() & TQMouseEvent::ControlButton) - { - setCursor(KCursor::arrowCursor()); - return; - } - SVGSVGElementImpl *root = m_doc->rootElement(); - if(!root) return; - if(event->key() == TQt::Key_Minus) - { - erase(0, 0, m_canvas->width(), m_canvas->height()); - float zoomFactor = root->currentScale() / 1.2; - root->setCurrentScale(zoomFactor); - m_doc->syncCachedMatrices(); - m_canvas->update(zoomFactor); - } - else if(event->key() == TQt::Key_Plus) - { - float zoomFactor = root->currentScale() * 1.2; - root->setCurrentScale(zoomFactor); - m_doc->syncCachedMatrices(); - m_canvas->update(zoomFactor); - } -} -*/ diff --git a/ksvg/test/external/SVGTestWidget.cpp b/ksvg/test/external/SVGTestWidget.cpp new file mode 100644 index 00000000..895b5357 --- /dev/null +++ b/ksvg/test/external/SVGTestWidget.cpp @@ -0,0 +1,204 @@ +// Very small test app to look at ksvg performance without konqueror overhead (Rob) + +#include "SVGTestWidget.moc" +#include "DocumentFactory.h" +#include "CanvasFactory.h" +#include "SVGCircleElement.h" +#include "SVGAnimatedLength.h" +#include "SVGLength.h" +#include "SVGSVGElement.h" +#include "SVGEventImpl.h" +#include "KSVGCanvas.h" +#include "CanvasItem.h" +#include + +using namespace KSVG; + +SVGTestWidget::SVGTestWidget(const KURL &url) +{ + setBackgroundColor(TQt::white); + setMouseTracking(true); + setFocusPolicy(TQ_WheelFocus); + + m_doc = DocumentFactory::self()->requestDocument(TQT_TQOBJECT(this), TQT_SLOT(slotRenderingFinished())); + if(!m_doc) + return; + + resize(450, 450); + m_canvas = CanvasFactory::self()->loadCanvas(450, 450); + if(!m_canvas) + return; + + m_canvas->setup(TQT_TQPAINTDEVICE(this), TQT_TQPAINTDEVICE(this)); + + if(!DocumentFactory::self()->attachCanvas(m_canvas, m_doc)) + return; + + if(!DocumentFactory::self()->startParsing(m_doc, url)) + return; +} + +SVGTestWidget::~SVGTestWidget() +{ + delete m_canvas; + delete m_doc; +} + +void SVGTestWidget::slotRenderingFinished() +{ + TQRect rect(0, 0, width(), height()); + m_canvas->blit(rect, true); + + SVGElement test = m_doc->rootElement().getElementById("test"); + if(test.nodeName() == "circle") + { + SVGCircleElement c = dom_cast(SVGCircleElement, test); + c.r().baseVal().setValue(150); + c.setAttribute("fill", "blue"); + } +} + +void SVGTestWidget::paintEvent(TQPaintEvent *event) +{ + m_canvas->update(); + m_canvas->blit(event->rect(), true); +} + +void SVGTestWidget::resizeEvent(TQResizeEvent *event) +{ + int w = event->size().width(); + int h = event->size().height(); + + m_canvas->resize(w, h); + resize(w, h); + m_canvas->blit(); +} +/* +KSVG::SVGMouseEventImpl *newMouseEvent(SVGDocument *doc, KSVG::SVGEventImpl::EventId id, TQMouseEvent *event) +{ + DOM::AbstractView temp; + + int clientX = event->x(); + int clientY = event->y(); + + if(doc && doc->rootElement()) + { + clientX = int(clientX / doc->rootElement()->currentScale()); + clientY = int(clientY / doc->rootElement()->currentScale()); + } + + int button = 0; + if(event->stateAfter() & Qt::LeftButton) + button = 1; + else if(event->stateAfter() & Qt::MidButton) + button = 2; + else if(event->stateAfter() & Qt::RightButton) + button = 3; + + KSVG::SVGMouseEventImpl *mev = new KSVG::SVGMouseEventImpl(id, // type + true, // canBubbleArg + true, // cancelableArg + temp, // view + 0, // detail + event->globalX(), //screenXArg + event->globalY(), // screenYArg, + clientX, // clientXArg + clientY, // clientYArg + (event->state() & TQt::ControlButton), // ctrlKeyArg + (event->state() & TQt::AltButton), // altKeyArg + (event->state() & TQt::ShiftButton), // shiftKeyArg + (event->state() & TQt::MetaButton), // metaKeyArg + button, // buttonArg + 0); + + mev->ref(); + + return mev; +} + +void SVGTestWidget::mouseMoveEvent(TQMouseEvent *event) +{ + if(event->state() & TQMouseEvent::ControlButton && event->state() & TQMouseEvent::LeftButton) + { + if(m_panningPos.isNull()) + m_panningPos = event->pos(); + else + { + TQPoint panPoint = m_oldPanningPos - (m_panningPos - event->pos()); + m_doc->rootElement()->setCurrentTranslate(panPoint); +// m_doc->syncCachedMatrices(); FIXME + m_canvas->update(panPoint); + } + return; + } + else if(event->state() & TQMouseEvent::ControlButton) + return; +} + +void SVGTestWidget::mousePressEvent(TQMouseEvent *event) +{ + if(event->state() & TQMouseEvent::ControlButton) + return; + + KSVG::SVGMouseEventImpl *mev = newMouseEvent(m_doc, KSVG::SVGEventImpl::MOUSEDOWN_EVENT, event); + + if(m_doc && m_doc->rootElement()) + m_doc->rootElement()->prepareMouseEvent(event->pos(), event->pos(), mev); + mev->deref(); +} + +void SVGTestWidget::mouseReleaseEvent(TQMouseEvent *event) +{ + if(!m_panningPos.isNull()) + { + m_oldPanningPos = m_oldPanningPos - (m_panningPos - event->pos()); + m_panningPos.setX(0); + m_panningPos.setY(0); + } + + if(event->state() & TQMouseEvent::ControlButton) + return; + + // only simulate mouse clicks for now + KSVG::SVGMouseEventImpl *mev = newMouseEvent(m_doc, KSVG::SVGEventImpl::MOUSEUP_EVENT, event); + + if(m_doc && m_doc->rootElement()) + m_doc->rootElement()->prepareMouseEvent(event->pos(), event->pos(), mev); + mev->deref(); +} + +void SVGTestWidget::keyPressEvent(TQKeyEvent *event) +{ + if(event->stateAfter() & TQMouseEvent::ControlButton) + { + setCursor(KCursor::sizeAllCursor()); + return; + } +} + +void SVGTestWidget::keyReleaseEvent(TQKeyEvent *event) +{ + if(event->state() & TQMouseEvent::ControlButton) + { + setCursor(KCursor::arrowCursor()); + return; + } + SVGSVGElementImpl *root = m_doc->rootElement(); + if(!root) return; + if(event->key() == TQt::Key_Minus) + { + erase(0, 0, m_canvas->width(), m_canvas->height()); + float zoomFactor = root->currentScale() / 1.2; + root->setCurrentScale(zoomFactor); + m_doc->syncCachedMatrices(); + m_canvas->update(zoomFactor); + } + else if(event->key() == TQt::Key_Plus) + { + float zoomFactor = root->currentScale() * 1.2; + root->setCurrentScale(zoomFactor); + m_doc->syncCachedMatrices(); + m_canvas->update(zoomFactor); + } +} +*/ diff --git a/ksvg/test/external/svgdisplay.cc b/ksvg/test/external/svgdisplay.cc deleted file mode 100644 index de1172dc..00000000 --- a/ksvg/test/external/svgdisplay.cc +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include -#include "SVGTestWidget.h" - -static TDECmdLineOptions options[] = -{ - { "+URL", I18N_NOOP("SVG file to open"), 0 }, - TDECmdLineLastOption -}; - -int main(int argc, char **argv) -{ - - TDEAboutData *about = new TDEAboutData( "KSVG test app", I18N_NOOP("KSVG test"), "0.1", I18N_NOOP("KSVG standalone test app") ); - TDECmdLineArgs::init(argc, argv, about); - TDECmdLineArgs::addCmdLineOptions( options ); - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - if(args->count() == 0) - { - args->usage(); - return 0; - } - KURL url = args->url(0); - TDEApplication a( argc, argv ); - SVGTestWidget *w = new SVGTestWidget(url); - a.setMainWidget(w); - w->show(); - - return a.exec(); -} diff --git a/ksvg/test/external/svgdisplay.cpp b/ksvg/test/external/svgdisplay.cpp new file mode 100644 index 00000000..de1172dc --- /dev/null +++ b/ksvg/test/external/svgdisplay.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include "SVGTestWidget.h" + +static TDECmdLineOptions options[] = +{ + { "+URL", I18N_NOOP("SVG file to open"), 0 }, + TDECmdLineLastOption +}; + +int main(int argc, char **argv) +{ + + TDEAboutData *about = new TDEAboutData( "KSVG test app", I18N_NOOP("KSVG test"), "0.1", I18N_NOOP("KSVG standalone test app") ); + TDECmdLineArgs::init(argc, argv, about); + TDECmdLineArgs::addCmdLineOptions( options ); + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + if(args->count() == 0) + { + args->usage(); + return 0; + } + KURL url = args->url(0); + TDEApplication a( argc, argv ); + SVGTestWidget *w = new SVGTestWidget(url); + a.setMainWidget(w); + w->show(); + + return a.exec(); +} -- cgit v1.2.1