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