Update ooo320-m1
[ooovba.git] / applied_patches / 0401-svg-import-convlength-fix.diff
blob1d0c8f5b421694f060823718582137d196ed564f
1 diff -ru svg.orig/units.cxx svg/units.cxx
2 --- filter.orig/source/svg/units.cxx 2009-06-09 15:39:35.000000000 +0100
3 +++ filter/source/svg/units.cxx 2009-06-09 15:39:46.000000000 +0100
4 @@ -35,10 +35,6 @@
6 double convLength( double value, SvgUnit unit, const State& rState, char dir )
8 - const double fBoxLen( dir=='h' ? rState.maViewBox.getWidth() :
9 - (dir=='v' ? rState.maViewBox.getHeight() :
10 - rState.maViewBox.getRange().getLength()));
12 // convert svg unit to internal coordinates ("pixel"). Since the
13 // OOo drawing layer is still largely integer-based, the initial
14 // viewport transformation includes a certain scale factor
15 @@ -55,7 +51,28 @@
16 case SVG_LENGTH_UNIT_PT: break;
17 case SVG_LENGTH_UNIT_EM: fRet *= rState.mnFontSize; break;
18 case SVG_LENGTH_UNIT_EX: fRet *= rState.mnFontSize / 2.0; break;
19 - case SVG_LENGTH_UNIT_PERCENTAGE: fRet *= fBoxLen; break;
20 + case SVG_LENGTH_UNIT_PERCENTAGE:
21 + {
22 + double fBoxLen;
23 + if (rState.maViewBox.isEmpty())
24 + {
25 + basegfx::B2DRange aDefaultBox(0, 0,
26 + convLength(210, SVG_LENGTH_UNIT_MM, rState, 'h'),
27 + convLength(297, SVG_LENGTH_UNIT_MM, rState, 'v'));
28 + fBoxLen = (dir=='h' ? aDefaultBox.getWidth() :
29 + (dir=='v' ? aDefaultBox.getHeight() :
30 + aDefaultBox.getRange().getLength()));
31 + }
32 + else
33 + {
34 + fBoxLen = (dir=='h' ? rState.maViewBox.getWidth() :
35 + (dir=='v' ? rState.maViewBox.getHeight() :
36 + rState.maViewBox.getRange().getLength()));
37 + }
39 + fRet *= fBoxLen/100.0;
40 + }
41 + break;
42 default: OSL_TRACE( "Unknown length type" ); break;