svgnode.cxx (e92bb418) svgnode.cxx (7b027e49)
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

--- 98 unchanged lines hidden (view full) ---

107 if(pNew)
108 {
109 const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
110 }
111 }
112 }
113 }
114
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

--- 98 unchanged lines hidden (view full) ---

107 if(pNew)
108 {
109 const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
110 }
111 }
112 }
113 }
114
115 if(maCssStyleVector.empty())
115 if(!maCssStyleVector.empty())
116 {
116 {
117 return &rOriginal;
118 }
119 else
120 {
121 // set CssStyleParent at maCssStyleVector members to hang them in front of
122 // the existing style. Build a style chain, reset parent of original for security.
117 // #123510# if CSS styles were found, create a linked list with rOriginal as parent
118 // and all CSS styles as linked children, so that the style attribute has
119 // priority over the CSS style. If there is no style attribute this means that
120 // no values are set at rOriginal, thus it is still correct to have that order.
123 // Repeated style requests should only be issued from sub-Text nodes and I'm not
124 // sure if in-between text nodes may build other chains (should not happen). But
125 // it's only a re-chaining with pointers (cheap), so allow to do it every time.
126 SvgStyleAttributes* pCurrent = const_cast< SvgStyleAttributes* >(&rOriginal);
127 pCurrent->setCssStyleParent(0);
128
129 for(sal_uInt32 a(0); a < maCssStyleVector.size(); a++)
130 {
121 // Repeated style requests should only be issued from sub-Text nodes and I'm not
122 // sure if in-between text nodes may build other chains (should not happen). But
123 // it's only a re-chaining with pointers (cheap), so allow to do it every time.
124 SvgStyleAttributes* pCurrent = const_cast< SvgStyleAttributes* >(&rOriginal);
125 pCurrent->setCssStyleParent(0);
126
127 for(sal_uInt32 a(0); a < maCssStyleVector.size(); a++)
128 {
131 SvgStyleAttributes* pCandidate = const_cast< SvgStyleAttributes* >(maCssStyleVector[maCssStyleVector.size() - a - 1]);
129 SvgStyleAttributes* pNext = const_cast< SvgStyleAttributes* >(maCssStyleVector[a]);
132
130
133 pCandidate->setCssStyleParent(pCurrent);
134 pCurrent = pCandidate;
131 pCurrent->setCssStyleParent(pNext);
132 pCurrent = pNext;
133 pCurrent->setCssStyleParent(0);
135 }
134 }
136
137 return pCurrent;
138 }
135 }
136
137 return &rOriginal;
139 }
140
141 SvgNode::SvgNode(
142 SVGToken aType,
143 SvgDocument& rDocument,
144 SvgNode* pParent)
145 : maType(aType),
146 mrDocument(rDocument),

--- 439 unchanged lines hidden ---
138 }
139
140 SvgNode::SvgNode(
141 SVGToken aType,
142 SvgDocument& rDocument,
143 SvgNode* pParent)
144 : maType(aType),
145 mrDocument(rDocument),

--- 439 unchanged lines hidden ---