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 7450b37974SArmin Le Grand return checkForCssStyle(aClassStr, maSvgStyleAttributes); 75ddde725dSArmin Le Grand } 76ddde725dSArmin Le Grand 77ddde725dSArmin Le Grand void SvgPatternNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent) 78ddde725dSArmin Le Grand { 79ddde725dSArmin Le Grand // call parent 80ddde725dSArmin Le Grand SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); 81ddde725dSArmin Le Grand 82ddde725dSArmin Le Grand // read style attributes 83ddde725dSArmin Le Grand maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); 84ddde725dSArmin Le Grand 85ddde725dSArmin Le Grand // parse own 86ddde725dSArmin Le Grand switch(aSVGToken) 87ddde725dSArmin Le Grand { 88ddde725dSArmin Le Grand case SVGTokenStyle: 89ddde725dSArmin Le Grand { 90ddde725dSArmin Le Grand maSvgStyleAttributes.readStyle(aContent); 91ddde725dSArmin Le Grand break; 92ddde725dSArmin Le Grand } 93ddde725dSArmin Le Grand case SVGTokenViewBox: 94ddde725dSArmin Le Grand { 95ddde725dSArmin Le Grand const basegfx::B2DRange aRange(readViewBox(aContent, *this)); 96ddde725dSArmin Le Grand 97ddde725dSArmin Le Grand if(!aRange.isEmpty()) 98ddde725dSArmin Le Grand { 99ddde725dSArmin Le Grand setViewBox(&aRange); 100ddde725dSArmin Le Grand } 101ddde725dSArmin Le Grand break; 102ddde725dSArmin Le Grand } 103ddde725dSArmin Le Grand case SVGTokenPreserveAspectRatio: 104ddde725dSArmin Le Grand { 105ddde725dSArmin Le Grand setSvgAspectRatio(readSvgAspectRatio(aContent)); 106ddde725dSArmin Le Grand break; 107ddde725dSArmin Le Grand } 108ddde725dSArmin Le Grand case SVGTokenX: 109ddde725dSArmin Le Grand { 110ddde725dSArmin Le Grand SvgNumber aNum; 111ddde725dSArmin Le Grand 112ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 113ddde725dSArmin Le Grand { 114ddde725dSArmin Le Grand setX(aNum); 115ddde725dSArmin Le Grand } 116ddde725dSArmin Le Grand break; 117ddde725dSArmin Le Grand } 118ddde725dSArmin Le Grand case SVGTokenY: 119ddde725dSArmin Le Grand { 120ddde725dSArmin Le Grand SvgNumber aNum; 121ddde725dSArmin Le Grand 122ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 123ddde725dSArmin Le Grand { 124ddde725dSArmin Le Grand setY(aNum); 125ddde725dSArmin Le Grand } 126ddde725dSArmin Le Grand break; 127ddde725dSArmin Le Grand } 128ddde725dSArmin Le Grand case SVGTokenWidth: 129ddde725dSArmin Le Grand { 130ddde725dSArmin Le Grand SvgNumber aNum; 131ddde725dSArmin Le Grand 132ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 133ddde725dSArmin Le Grand { 134ddde725dSArmin Le Grand if(aNum.isPositive()) 135ddde725dSArmin Le Grand { 136ddde725dSArmin Le Grand setWidth(aNum); 137ddde725dSArmin Le Grand } 138ddde725dSArmin Le Grand } 139ddde725dSArmin Le Grand break; 140ddde725dSArmin Le Grand } 141ddde725dSArmin Le Grand case SVGTokenHeight: 142ddde725dSArmin Le Grand { 143ddde725dSArmin Le Grand SvgNumber aNum; 144ddde725dSArmin Le Grand 145ddde725dSArmin Le Grand if(readSingleNumber(aContent, aNum)) 146ddde725dSArmin Le Grand { 147ddde725dSArmin Le Grand if(aNum.isPositive()) 148ddde725dSArmin Le Grand { 149ddde725dSArmin Le Grand setHeight(aNum); 150ddde725dSArmin Le Grand } 151ddde725dSArmin Le Grand } 152ddde725dSArmin Le Grand break; 153ddde725dSArmin Le Grand } 154ddde725dSArmin Le Grand case SVGTokenPatternUnits: 155ddde725dSArmin Le Grand { 156ddde725dSArmin Le Grand if(aContent.getLength()) 157ddde725dSArmin Le Grand { 158ddde725dSArmin Le Grand if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) 159ddde725dSArmin Le Grand { 160ddde725dSArmin Le Grand setPatternUnits(userSpaceOnUse); 161ddde725dSArmin Le Grand } 162ddde725dSArmin Le Grand else if(aContent.match(commonStrings::aStrObjectBoundingBox, 0)) 163ddde725dSArmin Le Grand { 164ddde725dSArmin Le Grand setPatternUnits(objectBoundingBox); 165ddde725dSArmin Le Grand } 166ddde725dSArmin Le Grand } 167ddde725dSArmin Le Grand break; 168ddde725dSArmin Le Grand } 169ddde725dSArmin Le Grand case SVGTokenPatternContentUnits: 170ddde725dSArmin Le Grand { 171ddde725dSArmin Le Grand if(aContent.getLength()) 172ddde725dSArmin Le Grand { 173ddde725dSArmin Le Grand if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) 174ddde725dSArmin Le Grand { 175ddde725dSArmin Le Grand setPatternContentUnits(userSpaceOnUse); 176ddde725dSArmin Le Grand } 177ddde725dSArmin Le Grand else if(aContent.match(commonStrings::aStrObjectBoundingBox, 0)) 178ddde725dSArmin Le Grand { 179ddde725dSArmin Le Grand setPatternContentUnits(objectBoundingBox); 180ddde725dSArmin Le Grand } 181ddde725dSArmin Le Grand } 182ddde725dSArmin Le Grand break; 183ddde725dSArmin Le Grand } 184ddde725dSArmin Le Grand case SVGTokenPatternTransform: 185ddde725dSArmin Le Grand { 186ddde725dSArmin Le Grand const basegfx::B2DHomMatrix aMatrix(readTransform(aContent, *this)); 187ddde725dSArmin Le Grand 188ddde725dSArmin Le Grand if(!aMatrix.isIdentity()) 189ddde725dSArmin Le Grand { 190ddde725dSArmin Le Grand setPatternTransform(&aMatrix); 191ddde725dSArmin Le Grand } 192ddde725dSArmin Le Grand break; 193ddde725dSArmin Le Grand } 194ddde725dSArmin Le Grand case SVGTokenXlinkHref: 195ddde725dSArmin Le Grand { 196ddde725dSArmin Le Grand const sal_Int32 nLen(aContent.getLength()); 197ddde725dSArmin Le Grand 198ddde725dSArmin Le Grand if(nLen && sal_Unicode('#') == aContent[0]) 199ddde725dSArmin Le Grand { 200ddde725dSArmin Le Grand maXLink = aContent.copy(1); 201ddde725dSArmin Le Grand tryToFindLink(); 202ddde725dSArmin Le Grand } 203ddde725dSArmin Le Grand break; 204ddde725dSArmin Le Grand } 205e2bf1e9dSArmin Le Grand default: 206e2bf1e9dSArmin Le Grand { 207e2bf1e9dSArmin Le Grand break; 208e2bf1e9dSArmin Le Grand } 209ddde725dSArmin Le Grand } 210ddde725dSArmin Le Grand } 211ddde725dSArmin Le Grand 212ddde725dSArmin Le Grand void SvgPatternNode::getValuesRelative(double& rfX, double& rfY, double& rfW, double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode& rUser) const 213ddde725dSArmin Le Grand { 214ddde725dSArmin Le Grand double fTargetWidth(rGeoRange.getWidth()); 215ddde725dSArmin Le Grand double fTargetHeight(rGeoRange.getHeight()); 216ddde725dSArmin Le Grand 217ddde725dSArmin Le Grand if(fTargetWidth > 0.0 && fTargetHeight > 0.0) 218ddde725dSArmin Le Grand { 219ddde725dSArmin Le Grand const SvgUnits aPatternUnits(getPatternUnits() ? *getPatternUnits() : objectBoundingBox); 220ddde725dSArmin Le Grand 221ddde725dSArmin Le Grand if(objectBoundingBox == aPatternUnits) 222ddde725dSArmin Le Grand { 223ddde725dSArmin Le Grand rfW = (getWidth().isSet()) ? getWidth().getNumber() : 0.0; 224ddde725dSArmin Le Grand rfH = (getHeight().isSet()) ? getHeight().getNumber() : 0.0; 225ddde725dSArmin Le Grand 226ddde725dSArmin Le Grand if(Unit_percent == getWidth().getUnit()) 227ddde725dSArmin Le Grand { 228ddde725dSArmin Le Grand rfW *= 0.01; 229ddde725dSArmin Le Grand } 230ddde725dSArmin Le Grand 231ddde725dSArmin Le Grand if(Unit_percent == getHeight().getUnit()) 232ddde725dSArmin Le Grand { 233ddde725dSArmin Le Grand rfH *= 0.01; 234ddde725dSArmin Le Grand } 235ddde725dSArmin Le Grand } 236ddde725dSArmin Le Grand else 237ddde725dSArmin Le Grand { 238ddde725dSArmin Le Grand rfW = (getWidth().isSet()) ? getWidth().solve(rUser, xcoordinate) : 0.0; 239ddde725dSArmin Le Grand rfH = (getHeight().isSet()) ? getHeight().solve(rUser, ycoordinate) : 0.0; 240ddde725dSArmin Le Grand 241ddde725dSArmin Le Grand // make relative to rGeoRange 242ddde725dSArmin Le Grand rfW /= fTargetWidth; 243ddde725dSArmin Le Grand rfH /= fTargetHeight; 244ddde725dSArmin Le Grand } 245ddde725dSArmin Le Grand 246ddde725dSArmin Le Grand if(rfW > 0.0 && rfH > 0.0) 247ddde725dSArmin Le Grand { 248ddde725dSArmin Le Grand if(objectBoundingBox == aPatternUnits) 249ddde725dSArmin Le Grand { 250ddde725dSArmin Le Grand rfX = (getX().isSet()) ? getX().getNumber() : 0.0; 251ddde725dSArmin Le Grand rfY = (getY().isSet()) ? getY().getNumber() : 0.0; 252ddde725dSArmin Le Grand 253ddde725dSArmin Le Grand if(Unit_percent == getX().getUnit()) 254ddde725dSArmin Le Grand { 255ddde725dSArmin Le Grand rfX *= 0.01; 256ddde725dSArmin Le Grand } 257ddde725dSArmin Le Grand 258ddde725dSArmin Le Grand if(Unit_percent == getY().getUnit()) 259ddde725dSArmin Le Grand { 260ddde725dSArmin Le Grand rfY *= 0.01; 261ddde725dSArmin Le Grand } 262ddde725dSArmin Le Grand } 263ddde725dSArmin Le Grand else 264ddde725dSArmin Le Grand { 265ddde725dSArmin Le Grand rfX = (getX().isSet()) ? getX().solve(rUser, xcoordinate) : 0.0; 266ddde725dSArmin Le Grand rfY = (getY().isSet()) ? getY().solve(rUser, ycoordinate) : 0.0; 267ddde725dSArmin Le Grand 268ddde725dSArmin Le Grand // make relative to rGeoRange 269ddde725dSArmin Le Grand rfX = (rfX - rGeoRange.getMinX()) / fTargetWidth; 270ddde725dSArmin Le Grand rfY = (rfY - rGeoRange.getMinY()) / fTargetHeight; 271ddde725dSArmin Le Grand } 272ddde725dSArmin Le Grand } 273ddde725dSArmin Le Grand } 274ddde725dSArmin Le Grand } 275ddde725dSArmin Le Grand 276ddde725dSArmin Le Grand const drawinglayer::primitive2d::Primitive2DSequence& SvgPatternNode::getPatternPrimitives() const 277ddde725dSArmin Le Grand { 278a275c134SArmin Le Grand if(!aPrimitives.hasElements() && Display_none != getDisplay()) 279ddde725dSArmin Le Grand { 280ddde725dSArmin Le Grand decomposeSvgNode(const_cast< SvgPatternNode* >(this)->aPrimitives, true); 281ddde725dSArmin Le Grand } 282ddde725dSArmin Le Grand 283ddde725dSArmin Le Grand if(!aPrimitives.hasElements() && maXLink.getLength()) 284ddde725dSArmin Le Grand { 285ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 286ddde725dSArmin Le Grand 287ddde725dSArmin Le Grand if(mpXLink) 288ddde725dSArmin Le Grand { 289ddde725dSArmin Le Grand return mpXLink->getPatternPrimitives(); 290ddde725dSArmin Le Grand } 291ddde725dSArmin Le Grand } 292ddde725dSArmin Le Grand 293ddde725dSArmin Le Grand return aPrimitives; 294ddde725dSArmin Le Grand } 295ddde725dSArmin Le Grand 296*e92bb418SOliver-Rainer Wittmann const basegfx::B2DRange SvgPatternNode::getCurrentViewPort() const 297ddde725dSArmin Le Grand { 298ddde725dSArmin Le Grand if(getViewBox()) 299ddde725dSArmin Le Grand { 300*e92bb418SOliver-Rainer Wittmann return *(getViewBox()); 301ddde725dSArmin Le Grand } 302ddde725dSArmin Le Grand else 303ddde725dSArmin Le Grand { 304ddde725dSArmin Le Grand return SvgNode::getCurrentViewPort(); 305ddde725dSArmin Le Grand } 306ddde725dSArmin Le Grand } 307ddde725dSArmin Le Grand 308ddde725dSArmin Le Grand const basegfx::B2DRange* SvgPatternNode::getViewBox() const 309ddde725dSArmin Le Grand { 310ddde725dSArmin Le Grand if(mpViewBox) 311ddde725dSArmin Le Grand { 312ddde725dSArmin Le Grand return mpViewBox; 313ddde725dSArmin Le Grand } 314ddde725dSArmin Le Grand 315ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 316ddde725dSArmin Le Grand 317ddde725dSArmin Le Grand if(mpXLink) 318ddde725dSArmin Le Grand { 319ddde725dSArmin Le Grand return mpXLink->getViewBox(); 320ddde725dSArmin Le Grand } 321ddde725dSArmin Le Grand 322ddde725dSArmin Le Grand return 0; 323ddde725dSArmin Le Grand } 324ddde725dSArmin Le Grand 325ddde725dSArmin Le Grand const SvgAspectRatio& SvgPatternNode::getSvgAspectRatio() const 326ddde725dSArmin Le Grand { 327ddde725dSArmin Le Grand if(maSvgAspectRatio.isSet()) 328ddde725dSArmin Le Grand { 329ddde725dSArmin Le Grand return maSvgAspectRatio; 330ddde725dSArmin Le Grand } 331ddde725dSArmin Le Grand 332ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 333ddde725dSArmin Le Grand 334ddde725dSArmin Le Grand if(mpXLink) 335ddde725dSArmin Le Grand { 336ddde725dSArmin Le Grand return mpXLink->getSvgAspectRatio(); 337ddde725dSArmin Le Grand } 338ddde725dSArmin Le Grand 339ddde725dSArmin Le Grand return maSvgAspectRatio; 340ddde725dSArmin Le Grand } 341ddde725dSArmin Le Grand 342ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getX() const 343ddde725dSArmin Le Grand { 344ddde725dSArmin Le Grand if(maX.isSet()) 345ddde725dSArmin Le Grand { 346ddde725dSArmin Le Grand return maX; 347ddde725dSArmin Le Grand } 348ddde725dSArmin Le Grand 349ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 350ddde725dSArmin Le Grand 351ddde725dSArmin Le Grand if(mpXLink) 352ddde725dSArmin Le Grand { 353ddde725dSArmin Le Grand return mpXLink->getX(); 354ddde725dSArmin Le Grand } 355ddde725dSArmin Le Grand 356ddde725dSArmin Le Grand return maX; 357ddde725dSArmin Le Grand } 358ddde725dSArmin Le Grand 359ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getY() const 360ddde725dSArmin Le Grand { 361ddde725dSArmin Le Grand if(maY.isSet()) 362ddde725dSArmin Le Grand { 363ddde725dSArmin Le Grand return maY; 364ddde725dSArmin Le Grand } 365ddde725dSArmin Le Grand 366ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 367ddde725dSArmin Le Grand 368ddde725dSArmin Le Grand if(mpXLink) 369ddde725dSArmin Le Grand { 370ddde725dSArmin Le Grand return mpXLink->getY(); 371ddde725dSArmin Le Grand } 372ddde725dSArmin Le Grand 373ddde725dSArmin Le Grand return maY; 374ddde725dSArmin Le Grand } 375ddde725dSArmin Le Grand 376ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getWidth() const 377ddde725dSArmin Le Grand { 378ddde725dSArmin Le Grand if(maWidth.isSet()) 379ddde725dSArmin Le Grand { 380ddde725dSArmin Le Grand return maWidth; 381ddde725dSArmin Le Grand } 382ddde725dSArmin Le Grand 383ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 384ddde725dSArmin Le Grand 385ddde725dSArmin Le Grand if(mpXLink) 386ddde725dSArmin Le Grand { 387ddde725dSArmin Le Grand return mpXLink->getWidth(); 388ddde725dSArmin Le Grand } 389ddde725dSArmin Le Grand 390ddde725dSArmin Le Grand return maWidth; 391ddde725dSArmin Le Grand } 392ddde725dSArmin Le Grand 393ddde725dSArmin Le Grand const SvgNumber& SvgPatternNode::getHeight() const 394ddde725dSArmin Le Grand { 395ddde725dSArmin Le Grand if(maHeight.isSet()) 396ddde725dSArmin Le Grand { 397ddde725dSArmin Le Grand return maHeight; 398ddde725dSArmin Le Grand } 399ddde725dSArmin Le Grand 400ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 401ddde725dSArmin Le Grand 402ddde725dSArmin Le Grand if(mpXLink) 403ddde725dSArmin Le Grand { 404ddde725dSArmin Le Grand return mpXLink->getHeight(); 405ddde725dSArmin Le Grand } 406ddde725dSArmin Le Grand 407ddde725dSArmin Le Grand return maHeight; 408ddde725dSArmin Le Grand } 409ddde725dSArmin Le Grand 410ddde725dSArmin Le Grand const SvgUnits* SvgPatternNode::getPatternUnits() const 411ddde725dSArmin Le Grand { 412ddde725dSArmin Le Grand if(mpPatternUnits) 413ddde725dSArmin Le Grand { 414ddde725dSArmin Le Grand return mpPatternUnits; 415ddde725dSArmin Le Grand } 416ddde725dSArmin Le Grand 417ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 418ddde725dSArmin Le Grand 419ddde725dSArmin Le Grand if(mpXLink) 420ddde725dSArmin Le Grand { 421ddde725dSArmin Le Grand return mpXLink->getPatternUnits(); 422ddde725dSArmin Le Grand } 423ddde725dSArmin Le Grand 424ddde725dSArmin Le Grand return 0; 425ddde725dSArmin Le Grand } 426ddde725dSArmin Le Grand 427ddde725dSArmin Le Grand const SvgUnits* SvgPatternNode::getPatternContentUnits() const 428ddde725dSArmin Le Grand { 429ddde725dSArmin Le Grand if(mpPatternContentUnits) 430ddde725dSArmin Le Grand { 431ddde725dSArmin Le Grand return mpPatternContentUnits; 432ddde725dSArmin Le Grand } 433ddde725dSArmin Le Grand 434ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 435ddde725dSArmin Le Grand 436ddde725dSArmin Le Grand if(mpXLink) 437ddde725dSArmin Le Grand { 438ddde725dSArmin Le Grand return mpXLink->getPatternContentUnits(); 439ddde725dSArmin Le Grand } 440ddde725dSArmin Le Grand 441ddde725dSArmin Le Grand return 0; 442ddde725dSArmin Le Grand } 443ddde725dSArmin Le Grand 444ddde725dSArmin Le Grand const basegfx::B2DHomMatrix* SvgPatternNode::getPatternTransform() const 445ddde725dSArmin Le Grand { 446ddde725dSArmin Le Grand if(mpaPatternTransform) 447ddde725dSArmin Le Grand { 448ddde725dSArmin Le Grand return mpaPatternTransform; 449ddde725dSArmin Le Grand } 450ddde725dSArmin Le Grand 451ddde725dSArmin Le Grand const_cast< SvgPatternNode* >(this)->tryToFindLink(); 452ddde725dSArmin Le Grand 453ddde725dSArmin Le Grand if(mpXLink) 454ddde725dSArmin Le Grand { 455ddde725dSArmin Le Grand return mpXLink->getPatternTransform(); 456ddde725dSArmin Le Grand } 457ddde725dSArmin Le Grand 458ddde725dSArmin Le Grand return 0; 459ddde725dSArmin Le Grand } 460ddde725dSArmin Le Grand 461ddde725dSArmin Le Grand } // end of namespace svgreader 462ddde725dSArmin Le Grand } // end of namespace svgio 463ddde725dSArmin Le Grand 464ddde725dSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 465ddde725dSArmin Le Grand // eof 466