1*ddde725dSArmin Le Grand /************************************************************** 2*ddde725dSArmin Le Grand * 3*ddde725dSArmin Le Grand * Licensed to the Apache Software Foundation (ASF) under one 4*ddde725dSArmin Le Grand * or more contributor license agreements. See the NOTICE file 5*ddde725dSArmin Le Grand * distributed with this work for additional information 6*ddde725dSArmin Le Grand * regarding copyright ownership. The ASF licenses this file 7*ddde725dSArmin Le Grand * to you under the Apache License, Version 2.0 (the 8*ddde725dSArmin Le Grand * "License"); you may not use this file except in compliance 9*ddde725dSArmin Le Grand * with the License. You may obtain a copy of the License at 10*ddde725dSArmin Le Grand * 11*ddde725dSArmin Le Grand * http://www.apache.org/licenses/LICENSE-2.0 12*ddde725dSArmin Le Grand * 13*ddde725dSArmin Le Grand * Unless required by applicable law or agreed to in writing, 14*ddde725dSArmin Le Grand * software distributed under the License is distributed on an 15*ddde725dSArmin Le Grand * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ddde725dSArmin Le Grand * KIND, either express or implied. See the License for the 17*ddde725dSArmin Le Grand * specific language governing permissions and limitations 18*ddde725dSArmin Le Grand * under the License. 19*ddde725dSArmin Le Grand * 20*ddde725dSArmin Le Grand *************************************************************/ 21*ddde725dSArmin Le Grand 22*ddde725dSArmin Le Grand // MARKER(update_precomp.py): autogen include statement, do not remove 23*ddde725dSArmin Le Grand #include "precompiled_svgio.hxx" 24*ddde725dSArmin Le Grand 25*ddde725dSArmin Le Grand #include <svgio/svgreader/svgpatternnode.hxx> 26*ddde725dSArmin Le Grand #include <svgio/svgreader/svgdocument.hxx> 27*ddde725dSArmin Le Grand 28*ddde725dSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 29*ddde725dSArmin Le Grand 30*ddde725dSArmin Le Grand namespace svgio 31*ddde725dSArmin Le Grand { 32*ddde725dSArmin Le Grand namespace svgreader 33*ddde725dSArmin Le Grand { 34*ddde725dSArmin Le Grand void SvgPatternNode::tryToFindLink() 35*ddde725dSArmin Le Grand { 36*ddde725dSArmin Le Grand if(!mpXLink && maXLink.getLength()) 37*ddde725dSArmin Le Grand { 38*ddde725dSArmin Le Grand mpXLink = dynamic_cast< const SvgPatternNode* >(getDocument().findSvgNodeById(maXLink)); 39*ddde725dSArmin Le Grand } 40*ddde725dSArmin Le Grand } 41*ddde725dSArmin Le Grand 42*ddde725dSArmin Le Grand SvgPatternNode::SvgPatternNode( 43*ddde725dSArmin Le Grand SvgDocument& rDocument, 44*ddde725dSArmin Le Grand SvgNode* pParent) 45*ddde725dSArmin Le Grand : SvgNode(SVGTokenPattern, rDocument, pParent), 46*ddde725dSArmin Le Grand aPrimitives(), 47*ddde725dSArmin Le Grand maSvgStyleAttributes(*this), 48*ddde725dSArmin Le Grand mpViewBox(0), 49*ddde725dSArmin Le Grand maSvgAspectRatio(), 50*ddde725dSArmin Le Grand maX(), 51*ddde725dSArmin Le Grand maY(), 52*ddde725dSArmin Le Grand maWidth(), 53*ddde725dSArmin Le Grand maHeight(), 54*ddde725dSArmin Le Grand mpPatternUnits(0), 55*ddde725dSArmin Le Grand mpPatternContentUnits(0), 56*ddde725dSArmin Le Grand mpaPatternTransform(0), 57*ddde725dSArmin Le Grand maXLink(), 58*ddde725dSArmin Le Grand mpXLink(0) 59*ddde725dSArmin Le Grand { 60*ddde725dSArmin Le Grand } 61*ddde725dSArmin Le Grand 62*ddde725dSArmin Le Grand SvgPatternNode::~SvgPatternNode() 63*ddde725dSArmin Le Grand { 64*ddde725dSArmin Le Grand if(mpViewBox) delete mpViewBox; 65*ddde725dSArmin Le Grand if(mpaPatternTransform) delete mpaPatternTransform; 66*ddde725dSArmin Le Grand if(mpPatternUnits) delete mpPatternUnits; 67*ddde725dSArmin Le Grand if(mpPatternContentUnits) delete mpPatternContentUnits; 68*ddde725dSArmin Le Grand } 69*ddde725dSArmin Le Grand 70*ddde725dSArmin Le Grand const SvgStyleAttributes* SvgPatternNode::getSvgStyleAttributes() const 71*ddde725dSArmin Le Grand { 72*ddde725dSArmin Le Grand static rtl::OUString aClassStr(rtl::OUString::createFromAscii("pattern")); 73*ddde725dSArmin Le Grand maSvgStyleAttributes.checkForCssStyle(aClassStr); 74*ddde725dSArmin Le Grand 75*ddde725dSArmin Le Grand return &maSvgStyleAttributes; 76*ddde725dSArmin Le Grand } 77*ddde725dSArmin Le Grand 78*ddde725dSArmin Le Grand void SvgPatternNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent) 79*ddde725dSArmin Le Grand { 80*ddde725dSArmin Le Grand // call parent 81*ddde725dSArmin Le Grand SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); 82*ddde725dSArmin Le Grand 83*ddde725dSArmin Le Grand // read style attributes 84*ddde725dSArmin Le Grand maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); 85*ddde725dSArmin Le Grand 86*ddde725dSArmin Le Grand // parse own 87*ddde725dSArmin Le Grand switch(aSVGToken) 88*ddde725dSArmin Le Grand { 89*ddde725dSArmin Le Grand case SVGTokenStyle: 90*ddde725dSArmin Le Grand { 91*ddde725dSArmin Le Grand maSvgStyleAttributes.readStyle(aContent); 92*ddde725dSArmin Le Grand break; 93*ddde725dSArmin Le Grand } 94*ddde725dSArmin Le Grand case SVGTokenViewBox: 95*ddde725dSArmin Le Grand { 96*ddde725dSArmin Le Grand const basegfx::B2DRange aRange(readViewBox(aContent, *this)); 97*ddde725dSArmin Le Grand 98*ddde725dSArmin Le Grand if(!aRange.isEmpty()) 99*ddde725dSArmin Le Grand { 100*ddde725dSArmin Le Grand setViewBox(&aRange); 101*ddde725dSArmin Le Grand } 102*ddde725dSArmin Le Grand break; 103*ddde725dSArmin Le Grand } 104*ddde725dSArmin Le Grand case SVGTokenPreserveAspectRatio: 105*ddde725dSArmin Le Grand { 106*ddde725dSArmin Le Grand setSvgAspectRatio(readSvgAspectRatio(aContent)); 107*ddde725dSArmin Le Grand break; 108*ddde725dSArmin Le Grand } 109*ddde725dSArmin Le Grand case SVGTokenX: 110*ddde725dSArmin Le Grand { 111*ddde725dSArmin Le Grand SvgNumber aNum; 112*ddde725dSArmin Le Grand 113*ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 114*ddde725dSArmin Le Grand { 115*ddde725dSArmin Le Grand setX(aNum); 116*ddde725dSArmin Le Grand } 117*ddde725dSArmin Le Grand break; 118*ddde725dSArmin Le Grand } 119*ddde725dSArmin Le Grand case SVGTokenY: 120*ddde725dSArmin Le Grand { 121*ddde725dSArmin Le Grand SvgNumber aNum; 122*ddde725dSArmin Le Grand 123*ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 124*ddde725dSArmin Le Grand { 125*ddde725dSArmin Le Grand setY(aNum); 126*ddde725dSArmin Le Grand } 127*ddde725dSArmin Le Grand break; 128*ddde725dSArmin Le Grand } 129*ddde725dSArmin Le Grand case SVGTokenWidth: 130*ddde725dSArmin Le Grand { 131*ddde725dSArmin Le Grand SvgNumber aNum; 132*ddde725dSArmin Le Grand 133*ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 134*ddde725dSArmin Le Grand { 135*ddde725dSArmin Le Grand if(aNum.isPositive()) 136*ddde725dSArmin Le Grand { 137*ddde725dSArmin Le Grand setWidth(aNum); 138*ddde725dSArmin Le Grand } 139*ddde725dSArmin Le Grand } 140*ddde725dSArmin Le Grand break; 141*ddde725dSArmin Le Grand } 142*ddde725dSArmin Le Grand case SVGTokenHeight: 143*ddde725dSArmin Le Grand { 144*ddde725dSArmin Le Grand SvgNumber aNum; 145*ddde725dSArmin Le Grand 146*ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 147*ddde725dSArmin Le Grand { 148*ddde725dSArmin Le Grand if(aNum.isPositive()) 149*ddde725dSArmin Le Grand { 150*ddde725dSArmin Le Grand setHeight(aNum); 151*ddde725dSArmin Le Grand } 152*ddde725dSArmin Le Grand } 153*ddde725dSArmin Le Grand break; 154*ddde725dSArmin Le Grand } 155*ddde725dSArmin Le Grand case SVGTokenPatternUnits: 156*ddde725dSArmin Le Grand { 157*ddde725dSArmin Le Grand if(aContent.getLength()) 158*ddde725dSArmin Le Grand { 159*ddde725dSArmin Le Grand if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) 160*ddde725dSArmin Le Grand { 161*ddde725dSArmin Le Grand setPatternUnits(userSpaceOnUse); 162*ddde725dSArmin Le Grand } 163*ddde725dSArmin Le Grand else if(aContent.match(commonStrings::aStrObjectBoundingBox, 0)) 164*ddde725dSArmin Le Grand { 165*ddde725dSArmin Le Grand setPatternUnits(objectBoundingBox); 166*ddde725dSArmin Le Grand } 167*ddde725dSArmin Le Grand } 168*ddde725dSArmin Le Grand break; 169*ddde725dSArmin Le Grand } 170*ddde725dSArmin Le Grand case SVGTokenPatternContentUnits: 171*ddde725dSArmin Le Grand { 172*ddde725dSArmin Le Grand if(aContent.getLength()) 173*ddde725dSArmin Le Grand { 174*ddde725dSArmin Le Grand if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) 175*ddde725dSArmin Le Grand { 176*ddde725dSArmin Le Grand setPatternContentUnits(userSpaceOnUse); 177*ddde725dSArmin Le Grand } 178*ddde725dSArmin Le Grand else if(aContent.match(commonStrings::aStrObjectBoundingBox, 0)) 179*ddde725dSArmin Le Grand { 180*ddde725dSArmin Le Grand setPatternContentUnits(objectBoundingBox); 181*ddde725dSArmin Le Grand } 182*ddde725dSArmin Le Grand } 183*ddde725dSArmin Le Grand break; 184*ddde725dSArmin Le Grand } 185*ddde725dSArmin Le Grand case SVGTokenPatternTransform: 186*ddde725dSArmin Le Grand { 187*ddde725dSArmin Le Grand const basegfx::B2DHomMatrix aMatrix(readTransform(aContent, *this)); 188*ddde725dSArmin Le Grand 189*ddde725dSArmin Le Grand if(!aMatrix.isIdentity()) 190*ddde725dSArmin Le Grand { 191*ddde725dSArmin Le Grand setPatternTransform(&aMatrix); 192*ddde725dSArmin Le Grand } 193*ddde725dSArmin Le Grand break; 194*ddde725dSArmin Le Grand } 195*ddde725dSArmin Le Grand case SVGTokenXlinkHref: 196*ddde725dSArmin Le Grand { 197*ddde725dSArmin Le Grand const sal_Int32 nLen(aContent.getLength()); 198*ddde725dSArmin Le Grand 199*ddde725dSArmin Le Grand if(nLen && sal_Unicode('#') == aContent[0]) 200*ddde725dSArmin Le Grand { 201*ddde725dSArmin Le Grand maXLink = aContent.copy(1); 202*ddde725dSArmin Le Grand tryToFindLink(); 203*ddde725dSArmin Le Grand } 204*ddde725dSArmin Le Grand break; 205*ddde725dSArmin Le Grand } 206*ddde725dSArmin Le Grand } 207*ddde725dSArmin Le Grand } 208*ddde725dSArmin Le Grand 209*ddde725dSArmin Le Grand void SvgPatternNode::getValuesRelative(double& rfX, double& rfY, double& rfW, double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode& rUser) const 210*ddde725dSArmin Le Grand { 211*ddde725dSArmin Le Grand double fTargetWidth(rGeoRange.getWidth()); 212*ddde725dSArmin Le Grand double fTargetHeight(rGeoRange.getHeight()); 213*ddde725dSArmin Le Grand 214*ddde725dSArmin Le Grand if(fTargetWidth > 0.0 && fTargetHeight > 0.0) 215*ddde725dSArmin Le Grand { 216*ddde725dSArmin Le Grand const SvgUnits aPatternUnits(getPatternUnits() ? *getPatternUnits() : objectBoundingBox); 217*ddde725dSArmin Le Grand 218*ddde725dSArmin Le Grand if(objectBoundingBox == aPatternUnits) 219*ddde725dSArmin Le Grand { 220*ddde725dSArmin Le Grand rfW = (getWidth().isSet()) ? getWidth().getNumber() : 0.0; 221*ddde725dSArmin Le Grand rfH = (getHeight().isSet()) ? getHeight().getNumber() : 0.0; 222*ddde725dSArmin Le Grand 223*ddde725dSArmin Le Grand if(Unit_percent == getWidth().getUnit()) 224*ddde725dSArmin Le Grand { 225*ddde725dSArmin Le Grand rfW *= 0.01; 226*ddde725dSArmin Le Grand } 227*ddde725dSArmin Le Grand 228*ddde725dSArmin Le Grand if(Unit_percent == getHeight().getUnit()) 229*ddde725dSArmin Le Grand { 230*ddde725dSArmin Le Grand rfH *= 0.01; 231*ddde725dSArmin Le Grand } 232*ddde725dSArmin Le Grand } 233*ddde725dSArmin Le Grand else 234*ddde725dSArmin Le Grand { 235*ddde725dSArmin Le Grand rfW = (getWidth().isSet()) ? getWidth().solve(rUser, xcoordinate) : 0.0; 236*ddde725dSArmin Le Grand rfH = (getHeight().isSet()) ? getHeight().solve(rUser, ycoordinate) : 0.0; 237*ddde725dSArmin Le Grand 238*ddde725dSArmin Le Grand // make relative to rGeoRange 239*ddde725dSArmin Le Grand rfW /= fTargetWidth; 240*ddde725dSArmin Le Grand rfH /= fTargetHeight; 241*ddde725dSArmin Le Grand } 242*ddde725dSArmin Le Grand 243*ddde725dSArmin Le Grand if(rfW > 0.0 && rfH > 0.0) 244*ddde725dSArmin Le Grand { 245*ddde725dSArmin Le Grand if(objectBoundingBox == aPatternUnits) 246*ddde725dSArmin Le Grand { 247*ddde725dSArmin Le Grand rfX = (getX().isSet()) ? getX().getNumber() : 0.0; 248*ddde725dSArmin Le Grand rfY = (getY().isSet()) ? getY().getNumber() : 0.0; 249*ddde725dSArmin Le Grand 250*ddde725dSArmin Le Grand if(Unit_percent == getX().getUnit()) 251*ddde725dSArmin Le Grand { 252*ddde725dSArmin Le Grand rfX *= 0.01; 253*ddde725dSArmin Le Grand } 254*ddde725dSArmin Le Grand 255*ddde725dSArmin Le Grand if(Unit_percent == getY().getUnit()) 256*ddde725dSArmin Le Grand { 257*ddde725dSArmin Le Grand rfY *= 0.01; 258*ddde725dSArmin Le Grand } 259*ddde725dSArmin Le Grand } 260*ddde725dSArmin Le Grand else 261*ddde725dSArmin Le Grand { 262*ddde725dSArmin Le Grand rfX = (getX().isSet()) ? getX().solve(rUser, xcoordinate) : 0.0; 263*ddde725dSArmin Le Grand rfY = (getY().isSet()) ? getY().solve(rUser, ycoordinate) : 0.0; 264*ddde725dSArmin Le Grand 265*ddde725dSArmin Le Grand // make relative to rGeoRange 266*ddde725dSArmin Le Grand rfX = (rfX - rGeoRange.getMinX()) / fTargetWidth; 267*ddde725dSArmin Le Grand rfY = (rfY - rGeoRange.getMinY()) / fTargetHeight; 268*ddde725dSArmin Le Grand } 269*ddde725dSArmin Le Grand } 270*ddde725dSArmin Le Grand } 271*ddde725dSArmin Le Grand } 272*ddde725dSArmin Le Grand 273*ddde725dSArmin Le Grand const drawinglayer::primitive2d::Primitive2DSequence& SvgPatternNode::getPatternPrimitives() const 274*ddde725dSArmin Le Grand { 275*ddde725dSArmin Le Grand if(!aPrimitives.hasElements()) 276*ddde725dSArmin Le Grand { 277*ddde725dSArmin Le Grand decomposeSvgNode(const_cast< SvgPatternNode* >(this)->aPrimitives, true); 278*ddde725dSArmin Le Grand } 279*ddde725dSArmin Le Grand 280*ddde725dSArmin Le Grand if(!aPrimitives.hasElements() && maXLink.getLength()) 281*ddde725dSArmin Le Grand { 282*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 283*ddde725dSArmin Le Grand 284*ddde725dSArmin Le Grand if(mpXLink) 285*ddde725dSArmin Le Grand { 286*ddde725dSArmin Le Grand return mpXLink->getPatternPrimitives(); 287*ddde725dSArmin Le Grand } 288*ddde725dSArmin Le Grand } 289*ddde725dSArmin Le Grand 290*ddde725dSArmin Le Grand return aPrimitives; 291*ddde725dSArmin Le Grand } 292*ddde725dSArmin Le Grand 293*ddde725dSArmin Le Grand const basegfx::B2DRange* SvgPatternNode::getCurrentViewPort() const 294*ddde725dSArmin Le Grand { 295*ddde725dSArmin Le Grand if(getViewBox()) 296*ddde725dSArmin Le Grand { 297*ddde725dSArmin Le Grand return getViewBox(); 298*ddde725dSArmin Le Grand } 299*ddde725dSArmin Le Grand else 300*ddde725dSArmin Le Grand { 301*ddde725dSArmin Le Grand return SvgNode::getCurrentViewPort(); 302*ddde725dSArmin Le Grand } 303*ddde725dSArmin Le Grand } 304*ddde725dSArmin Le Grand 305*ddde725dSArmin Le Grand const basegfx::B2DRange* SvgPatternNode::getViewBox() const 306*ddde725dSArmin Le Grand { 307*ddde725dSArmin Le Grand if(mpViewBox) 308*ddde725dSArmin Le Grand { 309*ddde725dSArmin Le Grand return mpViewBox; 310*ddde725dSArmin Le Grand } 311*ddde725dSArmin Le Grand 312*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 313*ddde725dSArmin Le Grand 314*ddde725dSArmin Le Grand if(mpXLink) 315*ddde725dSArmin Le Grand { 316*ddde725dSArmin Le Grand return mpXLink->getViewBox(); 317*ddde725dSArmin Le Grand } 318*ddde725dSArmin Le Grand 319*ddde725dSArmin Le Grand return 0; 320*ddde725dSArmin Le Grand } 321*ddde725dSArmin Le Grand 322*ddde725dSArmin Le Grand const SvgAspectRatio& SvgPatternNode::getSvgAspectRatio() const 323*ddde725dSArmin Le Grand { 324*ddde725dSArmin Le Grand if(maSvgAspectRatio.isSet()) 325*ddde725dSArmin Le Grand { 326*ddde725dSArmin Le Grand return maSvgAspectRatio; 327*ddde725dSArmin Le Grand } 328*ddde725dSArmin Le Grand 329*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 330*ddde725dSArmin Le Grand 331*ddde725dSArmin Le Grand if(mpXLink) 332*ddde725dSArmin Le Grand { 333*ddde725dSArmin Le Grand return mpXLink->getSvgAspectRatio(); 334*ddde725dSArmin Le Grand } 335*ddde725dSArmin Le Grand 336*ddde725dSArmin Le Grand return maSvgAspectRatio; 337*ddde725dSArmin Le Grand } 338*ddde725dSArmin Le Grand 339*ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getX() const 340*ddde725dSArmin Le Grand { 341*ddde725dSArmin Le Grand if(maX.isSet()) 342*ddde725dSArmin Le Grand { 343*ddde725dSArmin Le Grand return maX; 344*ddde725dSArmin Le Grand } 345*ddde725dSArmin Le Grand 346*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 347*ddde725dSArmin Le Grand 348*ddde725dSArmin Le Grand if(mpXLink) 349*ddde725dSArmin Le Grand { 350*ddde725dSArmin Le Grand return mpXLink->getX(); 351*ddde725dSArmin Le Grand } 352*ddde725dSArmin Le Grand 353*ddde725dSArmin Le Grand return maX; 354*ddde725dSArmin Le Grand } 355*ddde725dSArmin Le Grand 356*ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getY() const 357*ddde725dSArmin Le Grand { 358*ddde725dSArmin Le Grand if(maY.isSet()) 359*ddde725dSArmin Le Grand { 360*ddde725dSArmin Le Grand return maY; 361*ddde725dSArmin Le Grand } 362*ddde725dSArmin Le Grand 363*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 364*ddde725dSArmin Le Grand 365*ddde725dSArmin Le Grand if(mpXLink) 366*ddde725dSArmin Le Grand { 367*ddde725dSArmin Le Grand return mpXLink->getY(); 368*ddde725dSArmin Le Grand } 369*ddde725dSArmin Le Grand 370*ddde725dSArmin Le Grand return maY; 371*ddde725dSArmin Le Grand } 372*ddde725dSArmin Le Grand 373*ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getWidth() const 374*ddde725dSArmin Le Grand { 375*ddde725dSArmin Le Grand if(maWidth.isSet()) 376*ddde725dSArmin Le Grand { 377*ddde725dSArmin Le Grand return maWidth; 378*ddde725dSArmin Le Grand } 379*ddde725dSArmin Le Grand 380*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 381*ddde725dSArmin Le Grand 382*ddde725dSArmin Le Grand if(mpXLink) 383*ddde725dSArmin Le Grand { 384*ddde725dSArmin Le Grand return mpXLink->getWidth(); 385*ddde725dSArmin Le Grand } 386*ddde725dSArmin Le Grand 387*ddde725dSArmin Le Grand return maWidth; 388*ddde725dSArmin Le Grand } 389*ddde725dSArmin Le Grand 390*ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getHeight() const 391*ddde725dSArmin Le Grand { 392*ddde725dSArmin Le Grand if(maHeight.isSet()) 393*ddde725dSArmin Le Grand { 394*ddde725dSArmin Le Grand return maHeight; 395*ddde725dSArmin Le Grand } 396*ddde725dSArmin Le Grand 397*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 398*ddde725dSArmin Le Grand 399*ddde725dSArmin Le Grand if(mpXLink) 400*ddde725dSArmin Le Grand { 401*ddde725dSArmin Le Grand return mpXLink->getHeight(); 402*ddde725dSArmin Le Grand } 403*ddde725dSArmin Le Grand 404*ddde725dSArmin Le Grand return maHeight; 405*ddde725dSArmin Le Grand } 406*ddde725dSArmin Le Grand 407*ddde725dSArmin Le Grand const SvgUnits* SvgPatternNode::getPatternUnits() const 408*ddde725dSArmin Le Grand { 409*ddde725dSArmin Le Grand if(mpPatternUnits) 410*ddde725dSArmin Le Grand { 411*ddde725dSArmin Le Grand return mpPatternUnits; 412*ddde725dSArmin Le Grand } 413*ddde725dSArmin Le Grand 414*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 415*ddde725dSArmin Le Grand 416*ddde725dSArmin Le Grand if(mpXLink) 417*ddde725dSArmin Le Grand { 418*ddde725dSArmin Le Grand return mpXLink->getPatternUnits(); 419*ddde725dSArmin Le Grand } 420*ddde725dSArmin Le Grand 421*ddde725dSArmin Le Grand return 0; 422*ddde725dSArmin Le Grand } 423*ddde725dSArmin Le Grand 424*ddde725dSArmin Le Grand const SvgUnits* SvgPatternNode::getPatternContentUnits() const 425*ddde725dSArmin Le Grand { 426*ddde725dSArmin Le Grand if(mpPatternContentUnits) 427*ddde725dSArmin Le Grand { 428*ddde725dSArmin Le Grand return mpPatternContentUnits; 429*ddde725dSArmin Le Grand } 430*ddde725dSArmin Le Grand 431*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 432*ddde725dSArmin Le Grand 433*ddde725dSArmin Le Grand if(mpXLink) 434*ddde725dSArmin Le Grand { 435*ddde725dSArmin Le Grand return mpXLink->getPatternContentUnits(); 436*ddde725dSArmin Le Grand } 437*ddde725dSArmin Le Grand 438*ddde725dSArmin Le Grand return 0; 439*ddde725dSArmin Le Grand } 440*ddde725dSArmin Le Grand 441*ddde725dSArmin Le Grand const basegfx::B2DHomMatrix* SvgPatternNode::getPatternTransform() const 442*ddde725dSArmin Le Grand { 443*ddde725dSArmin Le Grand if(mpaPatternTransform) 444*ddde725dSArmin Le Grand { 445*ddde725dSArmin Le Grand return mpaPatternTransform; 446*ddde725dSArmin Le Grand } 447*ddde725dSArmin Le Grand 448*ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 449*ddde725dSArmin Le Grand 450*ddde725dSArmin Le Grand if(mpXLink) 451*ddde725dSArmin Le Grand { 452*ddde725dSArmin Le Grand return mpXLink->getPatternTransform(); 453*ddde725dSArmin Le Grand } 454*ddde725dSArmin Le Grand 455*ddde725dSArmin Le Grand return 0; 456*ddde725dSArmin Le Grand } 457*ddde725dSArmin Le Grand 458*ddde725dSArmin Le Grand } // end of namespace svgreader 459*ddde725dSArmin Le Grand } // end of namespace svgio 460*ddde725dSArmin Le Grand 461*ddde725dSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 462*ddde725dSArmin Le Grand // eof 463