svgnode.cxx (01e92ad6) svgnode.cxx (175cd092)
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

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

180
181 if(mpId) delete mpId;
182 if(mpClass) delete mpClass;
183 }
184
185 void SvgNode::parseAttributes(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs)
186 {
187 const sal_uInt32 nAttributes(xAttribs->getLength());
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

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

180
181 if(mpId) delete mpId;
182 if(mpClass) delete mpClass;
183 }
184
185 void SvgNode::parseAttributes(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs)
186 {
187 const sal_uInt32 nAttributes(xAttribs->getLength());
188
188 // #122522# SVG defines that 'In general, this means that the presentation attributes have
189 // lower priority than other CSS style rules specified in author style sheets or �style�
190 // attributes.' in http://www.w3.org/TR/SVG/styling.html#UsingPresentationAttributes
191 // (6.4 Specifying properties using the presentation attributes SVG 1.1). That means that
192 // e.g. font-size will appear as presentation attribute and CSS style attribute. In these
193 // cases, CSS style attributes need to have precedence. To do so it is possible to create
194 // a proirity system for all properties of a shape, but it will also work to parse the
195 // presentation attributes of type 'style' last, so they will overwrite the less-prioritized
196 // already interpreted ones. Thus, remember SVGTokenStyle entries and parse them last.
197 // To make this work it is required that parseAttribute is only called by parseAttributes
198 // which is the case.
199 std::vector< sal_uInt32 > aSVGTokenStyleIndexes;
200
189 for(sal_uInt32 a(0); a < nAttributes; a++)
190 {
191 const ::rtl::OUString aTokenName(xAttribs->getNameByIndex(a));
201 for(sal_uInt32 a(0); a < nAttributes; a++)
202 {
203 const ::rtl::OUString aTokenName(xAttribs->getNameByIndex(a));
192
193 parseAttribute(aTokenName, StrToSVGToken(aTokenName), xAttribs->getValueByIndex(a));
204 const SVGToken aSVGToken(StrToSVGToken(aTokenName));
205
206 if(SVGTokenStyle == aSVGToken)
207 {
208 // #122522# remember SVGTokenStyle entry
209 aSVGTokenStyleIndexes.push_back(a);
210 }
211 else
212 {
213 parseAttribute(aTokenName, StrToSVGToken(aTokenName), xAttribs->getValueByIndex(a));
214 }
194 }
215 }
216
217 // #122522# parse SVGTokenStyle entries last to override already interpreted
218 // 'presentation attributes' of potenially the same type
219 for(sal_uInt32 b(0); b < aSVGTokenStyleIndexes.size(); b++)
220 {
221 const sal_uInt32 nSVGTokenStyleIndex(aSVGTokenStyleIndexes[b]);
222 const ::rtl::OUString aTokenName(xAttribs->getNameByIndex(nSVGTokenStyleIndex));
223
224 parseAttribute(aTokenName, SVGTokenStyle, xAttribs->getValueByIndex(nSVGTokenStyleIndex));
225 }
195 }
196
197 Display getDisplayFromContent(const rtl::OUString& aContent)
198 {
199 if(aContent.getLength())
200 {
201 static rtl::OUString aStrInline(rtl::OUString::createFromAscii("inline"));
202 static rtl::OUString aStrBlock(rtl::OUString::createFromAscii("block"));

--- 352 unchanged lines hidden ---
226 }
227
228 Display getDisplayFromContent(const rtl::OUString& aContent)
229 {
230 if(aContent.getLength())
231 {
232 static rtl::OUString aStrInline(rtl::OUString::createFromAscii("inline"));
233 static rtl::OUString aStrBlock(rtl::OUString::createFromAscii("block"));

--- 352 unchanged lines hidden ---