This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA.*/#include "KoShape.h"#include "KoShapeContainer.h"

// the shadow has an offset to the shape, so we simply// check if the position minus the shadow offset hits the shapepoint=absoluteTransformation(0).inverted().map(position-d->shadow->offset());returnbb.contains(point);

intdiff=s1->zIndex()-s2->zIndex();if(diff==0){KoShape*s=s1->parent();while(s){if(s==s2)// s1 is a child of s2returnfalse;// children are always on top of their parents.s=s->parent();}s=s2->parent();while(s){if(s==s1)// s2 is a child of s1returntrue;s=s->parent();}}returndiff<0;

subtransform[0]=subtransform[0].right(subtransform[0].length()-1);if(subtransform[0]=="rotate"){// TODO find out what oo2 really does when rotating, it seems severly brokenif(params.count()==3){doublex=KoUnit::parseValue(params[1]);doubley=KoUnit::parseValue(params[2]);matrix.translate(x,y);// oo2 rotates by radiansmatrix.rotate(params[0].toDouble()*180.0/M_PI);matrix.translate(-x,-y);}else{// oo2 rotates by radiansmatrix.rotate(params[0].toDouble()*180.0/M_PI);}}elseif(subtransform[0]=="translate"){if(params.count()==2){doublex=KoUnit::parseValue(params[0]);doubley=KoUnit::parseValue(params[1]);matrix.translate(x,y);}else// Spec : if only one param given, assume 2nd param to be 0matrix.translate(KoUnit::parseValue(params[0]),0);}elseif(subtransform[0]=="scale"){if(params.count()==2)matrix.scale(params[0].toDouble(),params[1].toDouble());else// Spec : if only one param given, assume uniform scalingmatrix.scale(params[0].toDouble(),params[0].toDouble());}elseif(subtransform[0]=="skewx")matrix.shear(tan(params[0].toDouble()),0.0F);elseif(subtransform[0]=="skewy")matrix.shear(tan(params[0].toDouble()),0.0F);elseif(subtransform[0]=="skewy")matrix.shear(0.0F,tan(params[0].toDouble()));elseif(subtransform[0]=="matrix"){if(params.count()>=6)matrix.setMatrix(params[0].toDouble(),params[1].toDouble(),params[2].toDouble(),params[3].toDouble(),KoUnit::parseValue(params[4]),KoUnit::parseValue(params[5]));}}returnmatrix;}