svgstyleattributes.cxx (a180b29c) svgstyleattributes.cxx (a275c134)
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

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

1074 const drawinglayer::primitive2d::Primitive2DReference xRef(
1075 new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
1076 aSource,
1077 1.0 - fOpacity));
1078
1079 aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1);
1080 }
1081
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

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

1074 const drawinglayer::primitive2d::Primitive2DReference xRef(
1075 new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
1076 aSource,
1077 1.0 - fOpacity));
1078
1079 aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1);
1080 }
1081
1082 if(pTransform)
1083 {
1084 // create embedding group element with transformation. This applies the given
1085 // transformation to the graphical content, but *not* to mask and/or clip (as needed)
1086 const drawinglayer::primitive2d::Primitive2DReference xRef(
1087 new drawinglayer::primitive2d::TransformPrimitive2D(
1088 *pTransform,
1089 aSource));
1090
1091 aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1);
1092 }
1093
1082 if(getClipPathXLink().getLength())
1083 {
1084 // try to access linked ClipPath
1085 const SvgClipPathNode* mpClip = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(getClipPathXLink()));
1086
1087 if(mpClip)
1088 {
1089 mpClip->apply(aSource);

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

1100 if(mpMask)
1101 {
1102 mpMask->apply(aSource);
1103 }
1104 }
1105
1106 if(aSource.hasElements()) // test again, applied mask may have lead to empty geometry
1107 {
1094 if(getClipPathXLink().getLength())
1095 {
1096 // try to access linked ClipPath
1097 const SvgClipPathNode* mpClip = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(getClipPathXLink()));
1098
1099 if(mpClip)
1100 {
1101 mpClip->apply(aSource);

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

1112 if(mpMask)
1113 {
1114 mpMask->apply(aSource);
1115 }
1116 }
1117
1118 if(aSource.hasElements()) // test again, applied mask may have lead to empty geometry
1119 {
1108 if(pTransform)
1109 {
1110 // create embedding group element with transformation
1111 const drawinglayer::primitive2d::Primitive2DReference xRef(
1112 new drawinglayer::primitive2d::TransformPrimitive2D(
1113 *pTransform,
1114 aSource));
1115
1116 aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1);
1117 }
1118
1119 // append to current target
1120 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aSource);
1121 }
1122 }
1123 }
1124 }
1125
1126 SvgStyleAttributes::SvgStyleAttributes(SvgNode& rOwner)

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

1955 {
1956 return pSvgStyleAttributes->getSvgPatternNodeStroke();
1957 }
1958 }
1959
1960 return 0;
1961 }
1962
1120 // append to current target
1121 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aSource);
1122 }
1123 }
1124 }
1125 }
1126
1127 SvgStyleAttributes::SvgStyleAttributes(SvgNode& rOwner)

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

1956 {
1957 return pSvgStyleAttributes->getSvgPatternNodeStroke();
1958 }
1959 }
1960
1961 return 0;
1962 }
1963
1963 SvgNumber SvgStyleAttributes::getStrokeWidth() const
1964 const SvgNumber SvgStyleAttributes::getStrokeWidth() const
1964 {
1965 if(mbIsClipPathContent)
1966 {
1967 return SvgNumber(0.0);
1968 }
1969 else if(maStrokeWidth.isSet())
1970 {
1971 return maStrokeWidth;

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

1977 {
1978 return pSvgStyleAttributes->getStrokeWidth();
1979 }
1980
1981 // default is 1
1982 return SvgNumber(1.0);
1983 }
1984
1965 {
1966 if(mbIsClipPathContent)
1967 {
1968 return SvgNumber(0.0);
1969 }
1970 else if(maStrokeWidth.isSet())
1971 {
1972 return maStrokeWidth;

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

1978 {
1979 return pSvgStyleAttributes->getStrokeWidth();
1980 }
1981
1982 // default is 1
1983 return SvgNumber(1.0);
1984 }
1985
1985 SvgNumber SvgStyleAttributes::getStopOpacity() const
1986 const SvgNumber SvgStyleAttributes::getStopOpacity() const
1986 {
1987 if(maStopOpacity.isSet())
1988 {
1989 return maStopOpacity;
1990 }
1991
1992 // default is 1
1993 return SvgNumber(1.0);
1994 }
1995
1987 {
1988 if(maStopOpacity.isSet())
1989 {
1990 return maStopOpacity;
1991 }
1992
1993 // default is 1
1994 return SvgNumber(1.0);
1995 }
1996
1996 SvgNumber SvgStyleAttributes::getFillOpacity() const
1997 const SvgNumber SvgStyleAttributes::getFillOpacity() const
1997 {
1998 if(mbIsClipPathContent)
1999 {
2000 return SvgNumber(1.0);
2001 }
2002 else if(maFillOpacity.isSet())
2003 {
2004 return maFillOpacity;

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

2010 {
2011 return pSvgStyleAttributes->getFillOpacity();
2012 }
2013
2014 // default is 1
2015 return SvgNumber(1.0);
2016 }
2017
1998 {
1999 if(mbIsClipPathContent)
2000 {
2001 return SvgNumber(1.0);
2002 }
2003 else if(maFillOpacity.isSet())
2004 {
2005 return maFillOpacity;

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

2011 {
2012 return pSvgStyleAttributes->getFillOpacity();
2013 }
2014
2015 // default is 1
2016 return SvgNumber(1.0);
2017 }
2018
2018 FillRule SvgStyleAttributes::getFillRule() const
2019 const FillRule SvgStyleAttributes::getFillRule() const
2019 {
2020 if(FillRule_notset != maFillRule)
2021 {
2022 return maFillRule;
2023 }
2024
2025 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2026

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

2051 {
2052 return pSvgStyleAttributes->getStrokeDasharray();
2053 }
2054
2055 // default empty
2056 return maStrokeDasharray;
2057 }
2058
2020 {
2021 if(FillRule_notset != maFillRule)
2022 {
2023 return maFillRule;
2024 }
2025
2026 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2027

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

2052 {
2053 return pSvgStyleAttributes->getStrokeDasharray();
2054 }
2055
2056 // default empty
2057 return maStrokeDasharray;
2058 }
2059
2059 SvgNumber SvgStyleAttributes::getStrokeDashOffset() const
2060 const SvgNumber SvgStyleAttributes::getStrokeDashOffset() const
2060 {
2061 if(maStrokeDashOffset.isSet())
2062 {
2063 return maStrokeDashOffset;
2064 }
2065
2066 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2067
2068 if(pSvgStyleAttributes)
2069 {
2070 return pSvgStyleAttributes->getStrokeDashOffset();
2071 }
2072
2073 // default is 0
2074 return SvgNumber(0.0);
2075 }
2076
2061 {
2062 if(maStrokeDashOffset.isSet())
2063 {
2064 return maStrokeDashOffset;
2065 }
2066
2067 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2068
2069 if(pSvgStyleAttributes)
2070 {
2071 return pSvgStyleAttributes->getStrokeDashOffset();
2072 }
2073
2074 // default is 0
2075 return SvgNumber(0.0);
2076 }
2077
2077 StrokeLinecap SvgStyleAttributes::getStrokeLinecap() const
2078 const StrokeLinecap SvgStyleAttributes::getStrokeLinecap() const
2078 {
2079 if(maStrokeLinecap != StrokeLinecap_notset)
2080 {
2081 return maStrokeLinecap;
2082 }
2083
2084 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2085
2086 if(pSvgStyleAttributes)
2087 {
2088 return pSvgStyleAttributes->getStrokeLinecap();
2089 }
2090
2091 // default is StrokeLinecap_butt
2092 return StrokeLinecap_butt;
2093 }
2094
2079 {
2080 if(maStrokeLinecap != StrokeLinecap_notset)
2081 {
2082 return maStrokeLinecap;
2083 }
2084
2085 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2086
2087 if(pSvgStyleAttributes)
2088 {
2089 return pSvgStyleAttributes->getStrokeLinecap();
2090 }
2091
2092 // default is StrokeLinecap_butt
2093 return StrokeLinecap_butt;
2094 }
2095
2095 StrokeLinejoin SvgStyleAttributes::getStrokeLinejoin() const
2096 const StrokeLinejoin SvgStyleAttributes::getStrokeLinejoin() const
2096 {
2097 if(maStrokeLinejoin != StrokeLinejoin_notset)
2098 {
2099 return maStrokeLinejoin;
2100 }
2101
2102 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2103
2104 if(pSvgStyleAttributes)
2105 {
2106 return pSvgStyleAttributes->getStrokeLinejoin();
2107 }
2108
2109 // default is StrokeLinejoin_butt
2110 return StrokeLinejoin_miter;
2111 }
2112
2097 {
2098 if(maStrokeLinejoin != StrokeLinejoin_notset)
2099 {
2100 return maStrokeLinejoin;
2101 }
2102
2103 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2104
2105 if(pSvgStyleAttributes)
2106 {
2107 return pSvgStyleAttributes->getStrokeLinejoin();
2108 }
2109
2110 // default is StrokeLinejoin_butt
2111 return StrokeLinejoin_miter;
2112 }
2113
2113 SvgNumber SvgStyleAttributes::getStrokeMiterLimit() const
2114 const SvgNumber SvgStyleAttributes::getStrokeMiterLimit() const
2114 {
2115 if(maStrokeMiterLimit.isSet())
2116 {
2117 return maStrokeMiterLimit;
2118 }
2119
2120 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2121
2122 if(pSvgStyleAttributes)
2123 {
2124 return pSvgStyleAttributes->getStrokeMiterLimit();
2125 }
2126
2127 // default is 4
2128 return SvgNumber(4.0);
2129 }
2130
2115 {
2116 if(maStrokeMiterLimit.isSet())
2117 {
2118 return maStrokeMiterLimit;
2119 }
2120
2121 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2122
2123 if(pSvgStyleAttributes)
2124 {
2125 return pSvgStyleAttributes->getStrokeMiterLimit();
2126 }
2127
2128 // default is 4
2129 return SvgNumber(4.0);
2130 }
2131
2131 SvgNumber SvgStyleAttributes::getStrokeOpacity() const
2132 const SvgNumber SvgStyleAttributes::getStrokeOpacity() const
2132 {
2133 if(maStrokeOpacity.isSet())
2134 {
2135 return maStrokeOpacity;
2136 }
2137
2138 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2139

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

2159 {
2160 return pSvgStyleAttributes->getFontFamily();
2161 }
2162
2163 // default is empty
2164 return maFontFamily;
2165 }
2166
2133 {
2134 if(maStrokeOpacity.isSet())
2135 {
2136 return maStrokeOpacity;
2137 }
2138
2139 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2140

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

2160 {
2161 return pSvgStyleAttributes->getFontFamily();
2162 }
2163
2164 // default is empty
2165 return maFontFamily;
2166 }
2167
2167 SvgNumber SvgStyleAttributes::getFontSize() const
2168 const SvgNumber SvgStyleAttributes::getFontSize() const
2168 {
2169 if(maFontSize.isSet())
2170 {
2171 return maFontSize;
2172 }
2173
2174 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2175
2176 if(pSvgStyleAttributes)
2177 {
2178 return pSvgStyleAttributes->getFontSize();
2179 }
2180
2181 // default is 'medium'
2182 return SvgNumber(12.0);
2183 }
2184
2169 {
2170 if(maFontSize.isSet())
2171 {
2172 return maFontSize;
2173 }
2174
2175 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2176
2177 if(pSvgStyleAttributes)
2178 {
2179 return pSvgStyleAttributes->getFontSize();
2180 }
2181
2182 // default is 'medium'
2183 return SvgNumber(12.0);
2184 }
2185
2185 FontStretch SvgStyleAttributes::getFontStretch() const
2186 const FontStretch SvgStyleAttributes::getFontStretch() const
2186 {
2187 if(maFontStretch != FontStretch_notset)
2188 {
2189 if(FontStretch_wider != maFontStretch && FontStretch_narrower != maFontStretch)
2190 {
2191 return maFontStretch;
2192 }
2193 }

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

2209
2210 return aInherited;
2211 }
2212
2213 // default is FontStretch_normal
2214 return FontStretch_normal;
2215 }
2216
2187 {
2188 if(maFontStretch != FontStretch_notset)
2189 {
2190 if(FontStretch_wider != maFontStretch && FontStretch_narrower != maFontStretch)
2191 {
2192 return maFontStretch;
2193 }
2194 }

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

2210
2211 return aInherited;
2212 }
2213
2214 // default is FontStretch_normal
2215 return FontStretch_normal;
2216 }
2217
2217 FontStyle SvgStyleAttributes::getFontStyle() const
2218 const FontStyle SvgStyleAttributes::getFontStyle() const
2218 {
2219 if(maFontStyle != FontStyle_notset)
2220 {
2221 return maFontStyle;
2222 }
2223
2224 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2225
2226 if(pSvgStyleAttributes)
2227 {
2228 return pSvgStyleAttributes->getFontStyle();
2229 }
2230
2231 // default is FontStyle_normal
2232 return FontStyle_normal;
2233 }
2234
2219 {
2220 if(maFontStyle != FontStyle_notset)
2221 {
2222 return maFontStyle;
2223 }
2224
2225 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2226
2227 if(pSvgStyleAttributes)
2228 {
2229 return pSvgStyleAttributes->getFontStyle();
2230 }
2231
2232 // default is FontStyle_normal
2233 return FontStyle_normal;
2234 }
2235
2235 FontWeight SvgStyleAttributes::getFontWeight() const
2236 const FontWeight SvgStyleAttributes::getFontWeight() const
2236 {
2237 if(maFontWeight != FontWeight_notset)
2238 {
2239 if(FontWeight_bolder != maFontWeight && FontWeight_lighter != maFontWeight)
2240 {
2241 return maFontWeight;
2242 }
2243 }

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

2259
2260 return aInherited;
2261 }
2262
2263 // default is FontWeight_400 (FontWeight_normal)
2264 return FontWeight_400;
2265 }
2266
2237 {
2238 if(maFontWeight != FontWeight_notset)
2239 {
2240 if(FontWeight_bolder != maFontWeight && FontWeight_lighter != maFontWeight)
2241 {
2242 return maFontWeight;
2243 }
2244 }

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

2260
2261 return aInherited;
2262 }
2263
2264 // default is FontWeight_400 (FontWeight_normal)
2265 return FontWeight_400;
2266 }
2267
2267 TextAlign SvgStyleAttributes::getTextAlign() const
2268 const TextAlign SvgStyleAttributes::getTextAlign() const
2268 {
2269 if(maTextAlign != TextAlign_notset)
2270 {
2271 return maTextAlign;
2272 }
2273
2274 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2275

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

2295 {
2296 return pSvgStyleAttributes->getTextDecorationDefiningSvgStyleAttributes();
2297 }
2298
2299 // default is 0
2300 return 0;
2301 }
2302
2269 {
2270 if(maTextAlign != TextAlign_notset)
2271 {
2272 return maTextAlign;
2273 }
2274
2275 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2276

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

2296 {
2297 return pSvgStyleAttributes->getTextDecorationDefiningSvgStyleAttributes();
2298 }
2299
2300 // default is 0
2301 return 0;
2302 }
2303
2303 TextDecoration SvgStyleAttributes::getTextDecoration() const
2304 const TextDecoration SvgStyleAttributes::getTextDecoration() const
2304 {
2305 const SvgStyleAttributes* pDefining = getTextDecorationDefiningSvgStyleAttributes();
2306
2307 if(pDefining)
2308 {
2309 return pDefining->maTextDecoration;
2310 }
2311 else
2312 {
2313 // default is TextDecoration_none
2314 return TextDecoration_none;
2315 }
2316 }
2317
2305 {
2306 const SvgStyleAttributes* pDefining = getTextDecorationDefiningSvgStyleAttributes();
2307
2308 if(pDefining)
2309 {
2310 return pDefining->maTextDecoration;
2311 }
2312 else
2313 {
2314 // default is TextDecoration_none
2315 return TextDecoration_none;
2316 }
2317 }
2318
2318 TextAnchor SvgStyleAttributes::getTextAnchor() const
2319 const TextAnchor SvgStyleAttributes::getTextAnchor() const
2319 {
2320 if(maTextAnchor != TextAnchor_notset)
2321 {
2322 return maTextAnchor;
2323 }
2324
2325 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2326

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

2355 {
2356 return pSvgStyleAttributes->getColor();
2357 }
2358 }
2359
2360 return 0;
2361 }
2362
2320 {
2321 if(maTextAnchor != TextAnchor_notset)
2322 {
2323 return maTextAnchor;
2324 }
2325
2326 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2327

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

2356 {
2357 return pSvgStyleAttributes->getColor();
2358 }
2359 }
2360
2361 return 0;
2362 }
2363
2363 rtl::OUString SvgStyleAttributes::getMarkerStartXLink() const
2364 const rtl::OUString SvgStyleAttributes::getMarkerStartXLink() const
2364 {
2365 if(maMarkerStartXLink.getLength())
2366 {
2367 return maMarkerStartXLink;
2368 }
2369
2370 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2371

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

2387 {
2388 const_cast< SvgStyleAttributes* >(this)->mpMarkerStartXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink()));
2389 }
2390 }
2391
2392 return mpMarkerStartXLink;
2393 }
2394
2365 {
2366 if(maMarkerStartXLink.getLength())
2367 {
2368 return maMarkerStartXLink;
2369 }
2370
2371 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2372

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

2388 {
2389 const_cast< SvgStyleAttributes* >(this)->mpMarkerStartXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink()));
2390 }
2391 }
2392
2393 return mpMarkerStartXLink;
2394 }
2395
2395 rtl::OUString SvgStyleAttributes::getMarkerMidXLink() const
2396 const rtl::OUString SvgStyleAttributes::getMarkerMidXLink() const
2396 {
2397 if(maMarkerMidXLink.getLength())
2398 {
2399 return maMarkerMidXLink;
2400 }
2401
2402 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2403

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

2419 {
2420 const_cast< SvgStyleAttributes* >(this)->mpMarkerMidXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink()));
2421 }
2422 }
2423
2424 return mpMarkerMidXLink;
2425 }
2426
2397 {
2398 if(maMarkerMidXLink.getLength())
2399 {
2400 return maMarkerMidXLink;
2401 }
2402
2403 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2404

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

2420 {
2421 const_cast< SvgStyleAttributes* >(this)->mpMarkerMidXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink()));
2422 }
2423 }
2424
2425 return mpMarkerMidXLink;
2426 }
2427
2427 rtl::OUString SvgStyleAttributes::getMarkerEndXLink() const
2428 const rtl::OUString SvgStyleAttributes::getMarkerEndXLink() const
2428 {
2429 if(maMarkerEndXLink.getLength())
2430 {
2431 return maMarkerEndXLink;
2432 }
2433
2434 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2435

--- 28 unchanged lines hidden ---
2429 {
2430 if(maMarkerEndXLink.getLength())
2431 {
2432 return maMarkerEndXLink;
2433 }
2434
2435 const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
2436

--- 28 unchanged lines hidden ---