svgstyleattributes.cxx (025b0597) | svgstyleattributes.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 --- 198 unchanged lines hidden (view full) --- 207 if(nInitPos == nPos) 208 { 209 OSL_ENSURE(false, "Could not interpret on current position (!)"); 210 nPos++; 211 } 212 } 213 } 214 | 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 --- 198 unchanged lines hidden (view full) --- 207 if(nInitPos == nPos) 208 { 209 OSL_ENSURE(false, "Could not interpret on current position (!)"); 210 nPos++; 211 } 212 } 213 } 214 |
215 void SvgStyleAttributes::checkForCssStyle(const rtl::OUString& rClassStr) const 216 { 217 if(!mpCssStyleParent) 218 { 219 const SvgDocument& rDocument = mrOwner.getDocument(); 220 const SvgStyleAttributes* pNew = 0; 221 222 if(rDocument.hasSvgStyleAttributesById()) 223 { 224 if(mrOwner.getClass()) 225 { 226 rtl::OUString aId(rtl::OUString::createFromAscii(".")); 227 aId = aId + *mrOwner.getClass(); 228 pNew = rDocument.findSvgStyleAttributesById(aId); 229 230 if(!pNew && rClassStr.getLength()) 231 { 232 aId = rClassStr + aId; 233 234 pNew = rDocument.findSvgStyleAttributesById(aId); 235 } 236 } 237 238 if(!pNew && mrOwner.getId()) 239 { 240 pNew = rDocument.findSvgStyleAttributesById(*mrOwner.getId()); 241 } 242 243 if(!pNew && rClassStr.getLength()) 244 { 245 pNew = rDocument.findSvgStyleAttributesById(rClassStr); 246 } 247 248 if(pNew) 249 { 250 // found css style, set as parent 251 const_cast< SvgStyleAttributes* >(this)->mpCssStyleParent = pNew; 252 } 253 } 254 } 255 } 256 | |
257 const SvgStyleAttributes* SvgStyleAttributes::getParentStyle() const 258 { | 215 const SvgStyleAttributes* SvgStyleAttributes::getParentStyle() const 216 { |
259 if(mpCssStyleParent) | 217 if(getCssStyleParent()) |
260 { | 218 { |
261 return mpCssStyleParent; | 219 return getCssStyleParent(); |
262 } 263 | 220 } 221 |
264 if(mrOwner.getParent()) | 222 if(mrOwner.getParent()) |
265 { 266 return mrOwner.getParent()->getSvgStyleAttributes(); 267 } 268 269 return 0; 270 } 271 272 void SvgStyleAttributes::add_text( --- 790 unchanged lines hidden (view full) --- 1063 { 1064 return; 1065 } 1066 1067 if(!bIsLine) 1068 { 1069 basegfx::B2DPolyPolygon aPath(rPath); 1070 const bool bNeedToCheckClipRule(SVGTokenPath == mrOwner.getType() || SVGTokenPolygon == mrOwner.getType()); | 223 { 224 return mrOwner.getParent()->getSvgStyleAttributes(); 225 } 226 227 return 0; 228 } 229 230 void SvgStyleAttributes::add_text( --- 790 unchanged lines hidden (view full) --- 1021 { 1022 return; 1023 } 1024 1025 if(!bIsLine) 1026 { 1027 basegfx::B2DPolyPolygon aPath(rPath); 1028 const bool bNeedToCheckClipRule(SVGTokenPath == mrOwner.getType() || SVGTokenPolygon == mrOwner.getType()); |
1071 const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && mbClipRule); 1072 const bool bFillRuleIsNonzero(!bIsLine && bNeedToCheckClipRule && !mbIsClipPathContent && getFillRule()); | 1029 const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && FillRule_nonzero == maClipRule); 1030 const bool bFillRuleIsNonzero(!bIsLine && bNeedToCheckClipRule && !mbIsClipPathContent && FillRule_nonzero == getFillRule()); |
1073 1074 if(bClipPathIsNonzero || bFillRuleIsNonzero) 1075 { 1076 // nonzero is wanted, solve geometrically (see description on basegfx) 1077 aPath = basegfx::tools::createNonzeroConform(aPath); 1078 } 1079 1080 add_fill(aPath, rTarget, aGeoRange); --- 117 unchanged lines hidden (view full) --- 1198 maClipPathXLink(), 1199 maMaskXLink(), 1200 maMarkerStartXLink(), 1201 mpMarkerStartXLink(0), 1202 maMarkerMidXLink(), 1203 mpMarkerMidXLink(0), 1204 maMarkerEndXLink(), 1205 mpMarkerEndXLink(0), | 1031 1032 if(bClipPathIsNonzero || bFillRuleIsNonzero) 1033 { 1034 // nonzero is wanted, solve geometrically (see description on basegfx) 1035 aPath = basegfx::tools::createNonzeroConform(aPath); 1036 } 1037 1038 add_fill(aPath, rTarget, aGeoRange); --- 117 unchanged lines hidden (view full) --- 1156 maClipPathXLink(), 1157 maMaskXLink(), 1158 maMarkerStartXLink(), 1159 mpMarkerStartXLink(0), 1160 maMarkerMidXLink(), 1161 mpMarkerMidXLink(0), 1162 maMarkerEndXLink(), 1163 mpMarkerEndXLink(0), |
1206 maFillRule(true), 1207 maFillRuleSet(false), 1208 mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()), 1209 mbClipRule(true) | 1164 maFillRule(FillRule_notset), 1165 maClipRule(FillRule_nonzero), 1166 mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()) |
1210 { 1211 if(!mbIsClipPathContent) 1212 { 1213 const SvgStyleAttributes* pParentStyle = getParentStyle(); 1214 1215 if(pParentStyle) 1216 { 1217 mbIsClipPathContent = pParentStyle->mbIsClipPathContent; --- 50 unchanged lines hidden (view full) --- 1268 break; 1269 } 1270 case SVGTokenFillRule: 1271 { 1272 if(aContent.getLength()) 1273 { 1274 if(aContent.match(commonStrings::aStrNonzero)) 1275 { | 1167 { 1168 if(!mbIsClipPathContent) 1169 { 1170 const SvgStyleAttributes* pParentStyle = getParentStyle(); 1171 1172 if(pParentStyle) 1173 { 1174 mbIsClipPathContent = pParentStyle->mbIsClipPathContent; --- 50 unchanged lines hidden (view full) --- 1225 break; 1226 } 1227 case SVGTokenFillRule: 1228 { 1229 if(aContent.getLength()) 1230 { 1231 if(aContent.match(commonStrings::aStrNonzero)) 1232 { |
1276 maFillRule = true; 1277 maFillRuleSet = true; | 1233 maFillRule = FillRule_nonzero; |
1278 } 1279 else if(aContent.match(commonStrings::aStrEvenOdd)) 1280 { | 1234 } 1235 else if(aContent.match(commonStrings::aStrEvenOdd)) 1236 { |
1281 maFillRule = false; 1282 maFillRuleSet = true; | 1237 maFillRule = FillRule_evenodd; |
1283 } 1284 } 1285 break; 1286 } 1287 case SVGTokenStroke: 1288 { 1289 SvgPaint aSvgPaint; 1290 rtl::OUString aURL; --- 494 unchanged lines hidden (view full) --- 1785 break; 1786 } 1787 case SVGTokenClipRule: 1788 { 1789 if(aContent.getLength()) 1790 { 1791 if(aContent.match(commonStrings::aStrNonzero)) 1792 { | 1238 } 1239 } 1240 break; 1241 } 1242 case SVGTokenStroke: 1243 { 1244 SvgPaint aSvgPaint; 1245 rtl::OUString aURL; --- 494 unchanged lines hidden (view full) --- 1740 break; 1741 } 1742 case SVGTokenClipRule: 1743 { 1744 if(aContent.getLength()) 1745 { 1746 if(aContent.match(commonStrings::aStrNonzero)) 1747 { |
1793 mbClipRule = true; | 1748 maClipRule = FillRule_nonzero; |
1794 } 1795 else if(aContent.match(commonStrings::aStrEvenOdd)) 1796 { | 1749 } 1750 else if(aContent.match(commonStrings::aStrEvenOdd)) 1751 { |
1797 mbClipRule = false; | 1752 maClipRule = FillRule_evenodd; |
1798 } 1799 } 1800 break; 1801 } 1802 case SVGTokenMarker: 1803 { 1804 readLocalUrl(aContent, maMarkerEndXLink); 1805 maMarkerStartXLink = maMarkerMidXLink = maMarkerEndXLink; --- 237 unchanged lines hidden (view full) --- 2043 { 2044 return pSvgStyleAttributes->getFillOpacity(); 2045 } 2046 2047 // default is 1 2048 return SvgNumber(1.0); 2049 } 2050 | 1753 } 1754 } 1755 break; 1756 } 1757 case SVGTokenMarker: 1758 { 1759 readLocalUrl(aContent, maMarkerEndXLink); 1760 maMarkerStartXLink = maMarkerMidXLink = maMarkerEndXLink; --- 237 unchanged lines hidden (view full) --- 1998 { 1999 return pSvgStyleAttributes->getFillOpacity(); 2000 } 2001 2002 // default is 1 2003 return SvgNumber(1.0); 2004 } 2005 |
2051 bool SvgStyleAttributes::getFillRule() const | 2006 const FillRule SvgStyleAttributes::getFillRule() const |
2052 { | 2007 { |
2053 if(maFillRuleSet) | 2008 if(FillRule_notset != maFillRule) |
2054 { 2055 return maFillRule; 2056 } 2057 2058 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); 2059 2060 if(pSvgStyleAttributes) 2061 { 2062 return pSvgStyleAttributes->getFillRule(); 2063 } 2064 2065 // default is NonZero | 2009 { 2010 return maFillRule; 2011 } 2012 2013 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); 2014 2015 if(pSvgStyleAttributes) 2016 { 2017 return pSvgStyleAttributes->getFillRule(); 2018 } 2019 2020 // default is NonZero |
2066 return true; | 2021 return FillRule_nonzero; |
2067 } 2068 | 2022 } 2023 |
2069 void SvgStyleAttributes::setFillRule(const bool* pFillRule) 2070 { 2071 if(pFillRule) 2072 { 2073 maFillRuleSet = true; 2074 maFillRule = *pFillRule; 2075 } 2076 else 2077 { 2078 maFillRuleSet = false; 2079 } 2080 } 2081 | |
2082 const SvgNumberVector& SvgStyleAttributes::getStrokeDasharray() const 2083 { 2084 if(!maStrokeDasharray.empty()) 2085 { 2086 return maStrokeDasharray; 2087 } 2088 2089 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); --- 415 unchanged lines hidden --- | 2024 const SvgNumberVector& SvgStyleAttributes::getStrokeDasharray() const 2025 { 2026 if(!maStrokeDasharray.empty()) 2027 { 2028 return maStrokeDasharray; 2029 } 2030 2031 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); --- 415 unchanged lines hidden --- |