svgnode.cxx (172c67b2) | svgnode.cxx (50b37974) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 27 unchanged lines hidden (view full) --- 36{ 37 namespace svgreader 38 { 39 const SvgStyleAttributes* SvgNode::getSvgStyleAttributes() const 40 { 41 return 0; 42 } 43 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 27 unchanged lines hidden (view full) --- 36{ 37 namespace svgreader 38 { 39 const SvgStyleAttributes* SvgNode::getSvgStyleAttributes() const 40 { 41 return 0; 42 } 43 |
44 const SvgStyleAttributes* SvgNode::checkForCssStyle(const rtl::OUString& rClassStr, const SvgStyleAttributes& rOriginal) const 45 { 46 const SvgDocument& rDocument = getDocument(); 47 48 if(rDocument.hasSvgStyleAttributesById()) 49 { 50 if(getClass()) 51 { 52 // find all referenced CSS styles, a list of entries is allowed 53 const rtl::OUString* pClassList = getClass(); 54 const sal_Int32 nLen(pClassList->getLength()); 55 sal_Int32 nPos(0); 56 const SvgStyleAttributes* pNew = 0; 57 58 skip_char(*pClassList, sal_Unicode(' '), nPos, nLen); 59 60 while(nPos < nLen) 61 { 62 rtl::OUStringBuffer aTokenValue; 63 64 copyToLimiter(*pClassList, sal_Unicode(' '), nPos, aTokenValue, nLen); 65 skip_char(*pClassList, sal_Unicode(' '), nPos, nLen); 66 67 rtl::OUString aId(rtl::OUString::createFromAscii(".")); 68 const rtl::OUString aOUTokenValue(aTokenValue.makeStringAndClear()); 69 70 // look for CSS style common to token 71 aId = aId + aOUTokenValue; 72 pNew = rDocument.findSvgStyleAttributesById(aId); 73 74 if(!pNew && rClassStr.getLength()) 75 { 76 // look for CSS style common to class.token 77 aId = rClassStr + aId; 78 79 pNew = rDocument.findSvgStyleAttributesById(aId); 80 } 81 82 if(pNew) 83 { 84 const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew); 85 } 86 } 87 } 88 89 if(maCssStyleVector.empty() && getId()) 90 { 91 // if none found, search for CSS style equal to Id 92 const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(*getId()); 93 94 if(pNew) 95 { 96 const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew); 97 } 98 } 99 100 if(maCssStyleVector.empty() && rClassStr.getLength()) 101 { 102 // if none found, search for CSS style equal to class type 103 const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(rClassStr); 104 105 if(pNew) 106 { 107 const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew); 108 } 109 } 110 } 111 112 if(maCssStyleVector.empty()) 113 { 114 return &rOriginal; 115 } 116 else 117 { 118 // set CssStyleParent at maCssStyleVector members to hang them in front of 119 // the existing style 120 SvgStyleAttributes* pCurrent = const_cast< SvgStyleAttributes* >(&rOriginal); 121 122 for(sal_uInt32 a(0); a < maCssStyleVector.size(); a++) 123 { 124 SvgStyleAttributes* pCandidate = const_cast< SvgStyleAttributes* >(maCssStyleVector[maCssStyleVector.size() - a - 1]); 125 126 pCandidate->setCssStyleParent(pCurrent); 127 pCurrent = pCandidate; 128 } 129 130 return pCurrent; 131 } 132 } 133 |
|
44 SvgNode::SvgNode( 45 SVGToken aType, 46 SvgDocument& rDocument, 47 SvgNode* pParent) 48 : maType(aType), 49 mrDocument(rDocument), 50 mpParent(pParent), 51 mpAlternativeParent(0), 52 maChildren(), 53 mpId(0), 54 mpClass(0), | 134 SvgNode::SvgNode( 135 SVGToken aType, 136 SvgDocument& rDocument, 137 SvgNode* pParent) 138 : maType(aType), 139 mrDocument(rDocument), 140 mpParent(pParent), 141 mpAlternativeParent(0), 142 maChildren(), 143 mpId(0), 144 mpClass(0), |
55 maXmlSpace(XmlSpace_notset) | 145 maXmlSpace(XmlSpace_notset), 146 maCssStyleVector() |
56 { 57 OSL_ENSURE(SVGTokenUnknown != maType, "SvgNode with unknown type created (!)"); 58 59 if(pParent) 60 { 61 pParent->maChildren.push_back(this); 62 } 63 else --- 275 unchanged lines hidden --- | 147 { 148 OSL_ENSURE(SVGTokenUnknown != maType, "SvgNode with unknown type created (!)"); 149 150 if(pParent) 151 { 152 pParent->maChildren.push_back(this); 153 } 154 else --- 275 unchanged lines hidden --- |