svgtools.cxx (e2bf1e9d) | svgtools.cxx (2169cc62) |
---|---|
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 --- 142 unchanged lines hidden (view full) --- 151 // add target translation 152 aRetval.translate( 153 rTarget.getMinX() + fTransX, 154 rTarget.getMinY() + fTransY); 155 156 return aRetval; 157 } 158 | 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 --- 142 unchanged lines hidden (view full) --- 151 // add target translation 152 aRetval.translate( 153 rTarget.getMinX() + fTransX, 154 rTarget.getMinY() + fTransY); 155 156 return aRetval; 157 } 158 |
159 double SvgNumber::solve(const InfoProvider& rInfoProvider, NumberType aNumberType) const | 159 double SvgNumber::solveNonPercentage(const InfoProvider& rInfoProvider) const |
160 { 161 if(isSet()) 162 { 163 switch(meUnit) 164 { 165 case Unit_em: 166 { 167 return mfNumber * rInfoProvider.getCurrentFontSize(); --- 11 unchanged lines hidden (view full) --- 179 } 180 case Unit_pt: 181 case Unit_pc: 182 case Unit_cm: 183 case Unit_mm: 184 case Unit_in: 185 { 186 double fRetval(mfNumber); | 160 { 161 if(isSet()) 162 { 163 switch(meUnit) 164 { 165 case Unit_em: 166 { 167 return mfNumber * rInfoProvider.getCurrentFontSize(); --- 11 unchanged lines hidden (view full) --- 179 } 180 case Unit_pt: 181 case Unit_pc: 182 case Unit_cm: 183 case Unit_mm: 184 case Unit_in: 185 { 186 double fRetval(mfNumber); |
187 | 187 |
188 switch(meUnit) 189 { | 188 switch(meUnit) 189 { |
190 case Unit_pt: fRetval *= 1.25; break; 191 case Unit_pc: fRetval *= 15.0; break; 192 case Unit_cm: fRetval *= 35.43307; break; 193 case Unit_mm: fRetval *= 3.543307; break; 194 case Unit_in: fRetval *= 90.0; break; | 190 case Unit_pt: fRetval *= F_SVG_PIXEL_PER_INCH / 72.0; break; 191 case Unit_pc: fRetval *= F_SVG_PIXEL_PER_INCH / 6.0; break; 192 case Unit_cm: fRetval *= F_SVG_PIXEL_PER_INCH / 2.54; break; 193 case Unit_mm: fRetval *= 0.1 * F_SVG_PIXEL_PER_INCH / 2.54; break; 194 case Unit_in: fRetval *= F_SVG_PIXEL_PER_INCH; break; |
195 default: break; 196 } | 195 default: break; 196 } |
197 | 197 |
198 return fRetval; 199 break; 200 } | 198 return fRetval; 199 break; 200 } |
201 default: 202 { 203 OSL_ENSURE(false, "Do not use with percentage! "); 204 return 0.0; 205 break; 206 } 207 } 208 } 209 210 /// not set 211 OSL_ENSURE(false, "SvgNumber not set (!)"); 212 return 0.0; 213 } 214 215 double SvgNumber::solve(const InfoProvider& rInfoProvider, NumberType aNumberType) const 216 { 217 if(isSet()) 218 { 219 switch(meUnit) 220 { 221 case Unit_px: 222 { 223 return mfNumber; 224 break; 225 } 226 case Unit_pt: 227 case Unit_pc: 228 case Unit_cm: 229 case Unit_mm: 230 case Unit_in: 231 case Unit_em: 232 case Unit_ex: 233 { 234 return solveNonPercentage( rInfoProvider); 235 break; 236 } |
|
201 case Unit_percent: 202 { 203 double fRetval(mfNumber * 0.01); 204 const basegfx::B2DRange* pViewPort = rInfoProvider.getCurrentViewPort(); 205 206 if(!pViewPort) 207 { | 237 case Unit_percent: 238 { 239 double fRetval(mfNumber * 0.01); 240 const basegfx::B2DRange* pViewPort = rInfoProvider.getCurrentViewPort(); 241 242 if(!pViewPort) 243 { |
244#ifdef DBG_UTIL 245 myAssert(rtl::OUString::createFromAscii("Design error, this case should have been handled in the caller")); 246#endif |
|
208 // no viewPort, assume a normal page size (A4) 209 static basegfx::B2DRange aDinA4Range( 210 0.0, 211 0.0, | 247 // no viewPort, assume a normal page size (A4) 248 static basegfx::B2DRange aDinA4Range( 249 0.0, 250 0.0, |
212 210.0 * 3.543307, 213 297.0 * 3.543307); | 251 210.0 * F_SVG_PIXEL_PER_INCH / 2.54, 252 297.0 * F_SVG_PIXEL_PER_INCH / 2.54); |
214 215 pViewPort = &aDinA4Range; 216 } 217 218 if(pViewPort) 219 { 220 if(xcoordinate == aNumberType) 221 { --- 697 unchanged lines hidden (view full) --- 919 920 if(readNumberAndUnit(rCandidate, nPos, aWidth, nLen)) 921 { 922 SvgNumber aHeight; 923 skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(','), nPos, nLen); 924 925 if(readNumberAndUnit(rCandidate, nPos, aHeight, nLen)) 926 { | 253 254 pViewPort = &aDinA4Range; 255 } 256 257 if(pViewPort) 258 { 259 if(xcoordinate == aNumberType) 260 { --- 697 unchanged lines hidden (view full) --- 958 959 if(readNumberAndUnit(rCandidate, nPos, aWidth, nLen)) 960 { 961 SvgNumber aHeight; 962 skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(','), nPos, nLen); 963 964 if(readNumberAndUnit(rCandidate, nPos, aHeight, nLen)) 965 { |
927 return basegfx::B2DRange( 928 aMinX.solve(rInfoProvider, xcoordinate), 929 aMinY.solve(rInfoProvider, ycoordinate), 930 aWidth.solve(rInfoProvider, xcoordinate), 931 aHeight.solve(rInfoProvider, ycoordinate)); | 966 double fX(aMinX.solve(rInfoProvider, xcoordinate)); 967 double fY(aMinY.solve(rInfoProvider, ycoordinate)); 968 double fW(aWidth.solve(rInfoProvider,xcoordinate)); 969 double fH(aHeight.solve(rInfoProvider,ycoordinate)); 970 return basegfx::B2DRange(fX,fY,fX+fW,fY+fH); |
932 } 933 } 934 } 935 } 936 } 937 938 return basegfx::B2DRange(); 939 } --- 653 unchanged lines hidden --- | 971 } 972 } 973 } 974 } 975 } 976 977 return basegfx::B2DRange(); 978 } --- 653 unchanged lines hidden --- |