svgnode.cxx (e9ec990d) | svgnode.cxx (abfbd45a) |
---|---|
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 --- 164 unchanged lines hidden (view full) --- 173 } 174 } 175 176 void SvgNode::fillCssStyleVector(const rtl::OUString& rClassStr) 177 { 178 OSL_ENSURE(!mbCssStyleVectorBuilt, "OOps, fillCssStyleVector called double ?!?"); 179 mbCssStyleVectorBuilt = true; 180 | 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 --- 164 unchanged lines hidden (view full) --- 173 } 174 } 175 176 void SvgNode::fillCssStyleVector(const rtl::OUString& rClassStr) 177 { 178 OSL_ENSURE(!mbCssStyleVectorBuilt, "OOps, fillCssStyleVector called double ?!?"); 179 mbCssStyleVectorBuilt = true; 180 |
181 // #125293# If we have CssStyles we need to buuild a linked list of SvgStyleAttributes | 181 // #125293# If we have CssStyles we need to build a linked list of SvgStyleAttributes |
182 // which represent this for the current object. There are various methods to 183 // specify CssStyles which need to be taken into account in a given order: 184 // - local CssStyle (independent from global CssStyles at SvgDocument) 185 // - 'id' CssStyle 186 // - 'class' CssStyle(s) 187 // - type-dependent elements (e..g. 'rect' for all rect elements) 188 // - local attributes (rOriginal) 189 // - inherited attributes (up the hierarchy) --- 27 unchanged lines hidden (view full) --- 217 if(!mbCssStyleVectorBuilt) 218 { 219 // build needed CssStyleVector for local node 220 const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr); 221 } 222 223 if(maCssStyleVector.empty()) 224 { | 182 // which represent this for the current object. There are various methods to 183 // specify CssStyles which need to be taken into account in a given order: 184 // - local CssStyle (independent from global CssStyles at SvgDocument) 185 // - 'id' CssStyle 186 // - 'class' CssStyle(s) 187 // - type-dependent elements (e..g. 'rect' for all rect elements) 188 // - local attributes (rOriginal) 189 // - inherited attributes (up the hierarchy) --- 27 unchanged lines hidden (view full) --- 217 if(!mbCssStyleVectorBuilt) 218 { 219 // build needed CssStyleVector for local node 220 const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr); 221 } 222 223 if(maCssStyleVector.empty()) 224 { |
225 // return given original if no CssStlyes found | 225 // return given original if no CssStyles found |
226 return &rOriginal; 227 } 228 else 229 { 230 // #125293# rOriginal will be the last element in the linked list; use no CssStyleParent 231 // there (reset it) to ensure that the parent hierarchy will be used when it's base 232 // is referenced. This new chaning inserts the CssStyles before the original style, 233 // this makes the whole process much safer since the original style when used will 234 // be not different to the situation without CssStyles; thus loops which may be caused 235 // by trying to use the parent hierarchy of the owner of the style will be avoided 236 // already in this mechanism. It's still good to keep the supportsParentStyle 237 // from #125258# in place, though. 238 // This chain building using pointers will be done every time when checkForCssStyle 239 // is used (not the search, only the chaining). This is needed since the CssStyles 240 // themselves will be potentially used multiple times. It is not expensive since it's 241 // only changing some pointers. 242 // The alternative would be to create the style hierarchy for every element (or even 243 // for the element containing the hierarchy) in a vector of pointers and to use that. | 226 return &rOriginal; 227 } 228 else 229 { 230 // #125293# rOriginal will be the last element in the linked list; use no CssStyleParent 231 // there (reset it) to ensure that the parent hierarchy will be used when it's base 232 // is referenced. This new chaning inserts the CssStyles before the original style, 233 // this makes the whole process much safer since the original style when used will 234 // be not different to the situation without CssStyles; thus loops which may be caused 235 // by trying to use the parent hierarchy of the owner of the style will be avoided 236 // already in this mechanism. It's still good to keep the supportsParentStyle 237 // from #125258# in place, though. 238 // This chain building using pointers will be done every time when checkForCssStyle 239 // is used (not the search, only the chaining). This is needed since the CssStyles 240 // themselves will be potentially used multiple times. It is not expensive since it's 241 // only changing some pointers. 242 // The alternative would be to create the style hierarchy for every element (or even 243 // for the element containing the hierarchy) in a vector of pointers and to use that. |
244 // Resetting the CssStyleParent on rOriginal is probably not needeed | 244 // Resetting the CssStyleParent on rOriginal is probably not needed |
245 // but simply safer to do. 246 const_cast< SvgStyleAttributes& >(rOriginal).setCssStyleParent(0); 247 248 // loop over the existing CssStyles and link them. There is a first one, take 249 // as current 250 SvgStyleAttributes* pCurrent = const_cast< SvgStyleAttributes* >(maCssStyleVector[0]); 251 252 for(sal_uInt32 a(1); a < maCssStyleVector.size(); a++) --- 284 unchanged lines hidden (view full) --- 537 // do not decompose defs or symbol nodes (these hold only style-like 538 // objects which may be used by referencing them) except when doing 539 // so controlled referenced 540 541 // also do not decompose ClipPaths and Masks. These should be embedded 542 // in a defs node (which gets not decomposed by itself), but you never 543 // know 544 | 245 // but simply safer to do. 246 const_cast< SvgStyleAttributes& >(rOriginal).setCssStyleParent(0); 247 248 // loop over the existing CssStyles and link them. There is a first one, take 249 // as current 250 SvgStyleAttributes* pCurrent = const_cast< SvgStyleAttributes* >(maCssStyleVector[0]); 251 252 for(sal_uInt32 a(1); a < maCssStyleVector.size(); a++) --- 284 unchanged lines hidden (view full) --- 537 // do not decompose defs or symbol nodes (these hold only style-like 538 // objects which may be used by referencing them) except when doing 539 // so controlled referenced 540 541 // also do not decompose ClipPaths and Masks. These should be embedded 542 // in a defs node (which gets not decomposed by itself), but you never 543 // know 544 |
545 // also not directly used are Markers and Patterns, only indirecty used | 545 // also not directly used are Markers and Patterns, only indirectly used |
546 // by reference 547 548 // #121656# also do not decompose nodes which have display="none" set 549 // as property 550 return; 551 } 552 } 553 --- 171 unchanged lines hidden --- | 546 // by reference 547 548 // #121656# also do not decompose nodes which have display="none" set 549 // as property 550 return; 551 } 552 } 553 --- 171 unchanged lines hidden --- |