/[pkgs]/devel/openoffice.org/ooo-build.ooo2497.filter.svg.patch
ViewVC logotype

Contents of /devel/openoffice.org/ooo-build.ooo2497.filter.svg.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download) (as text)
Sat Oct 10 22:44:58 2009 UTC (6 weeks, 2 days ago) by caolanm
Branch: MAIN
CVS Tags: openoffice_org-3_2_0-2_2_fc13, openoffice_org-3_2_0-2_1_fc13, openoffice_org-3_2_0-4_2_fc13, openoffice_org-3_2_0-2_4_fc13, openoffice_org-3_2_0-1_2_fc13, openoffice_org-3_2_0-4_1_fc13, openoffice_org-3_2_0-2_3_fc13, openoffice_org-3_2_0-5_1_fc13, openoffice_org-3_2_0-3_1_fc13, openoffice_org-3_2_0-3_2_fc13, openoffice_org-3_2_0-5_2_fc13, openoffice_org-3_2_0-1_1_fc13, openoffice_org-3_2_0-2_5_fc13, openoffice_org-3_2_0-3_4_fc13, HEAD
Changes since 1.3: +0 -17 lines
File MIME type: text/x-patch
fix ooo-build.ooo2497.filter.svg.patch
1 diff -ruN OOO310_m6.orig/filter/source/config/fragments/fcfg_drawgraphics.mk OOO310_m6/filter/source/config/fragments/fcfg_drawgraphics.mk
2 --- OOO310_m6.orig/filter/source/config/fragments/fcfg_drawgraphics.mk 2009-03-17 14:58:31.000000000 +0000
3 +++ OOO310_m6/filter/source/config/fragments/fcfg_drawgraphics.mk 2009-03-17 14:59:37.000000000 +0000
4 @@ -54,6 +54,7 @@
5 SGF___StarOffice_Writer_SGF \
6 SGV___StarDraw_2_0 \
7 SVM___StarView_Metafile \
8 + SVG___Scalable_Vector_Graphics \
9 TGA___Truevision_TARGA \
10 TIF___Tag_Image_File \
11 WMF___MS_Windows_Metafile \
12 diff -ruN OOO310_m6.orig/filter/source/config/fragments/fcfg_internalgraphics.mk OOO310_m6/filter/source/config/fragments/fcfg_internalgraphics.mk
13 --- OOO310_m6.orig/filter/source/config/fragments/fcfg_internalgraphics.mk 2009-03-17 14:58:31.000000000 +0000
14 +++ OOO310_m6/filter/source/config/fragments/fcfg_internalgraphics.mk 2009-03-17 14:59:37.000000000 +0000
15 @@ -68,6 +68,7 @@
16 sgf_Import \
17 sgv_Import \
18 svg_Export \
19 + svg_Import \
20 svm_Export \
21 svm_Import \
22 tga_Import \
23 diff -ruN OOO310_m6.orig/filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu OOO310_m6/filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu
24 --- OOO310_m6.orig/filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu 1970-01-01 01:00:00.000000000 +0100
25 +++ OOO310_m6/filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu 2009-03-17 14:59:37.000000000 +0000
26 @@ -0,0 +1,13 @@
27 + <node oor:name="SVG - Scalable Vector Graphics" oor:op="replace">
28 + <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
29 + <prop oor:name="UIComponent"/>
30 + <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
31 + <prop oor:name="UserData"><value></value></prop>
32 + <prop oor:name="UIName">
33 + <value xml:lang="x-default">SVG - Scalable Vector Graphics</value>
34 + </prop>
35 + <prop oor:name="FileFormatVersion"><value>0</value></prop>
36 + <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
37 + <prop oor:name="TemplateName"/>
38 + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
39 + </node>
40 diff -ruN OOO310_m6.orig/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu OOO310_m6/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu
41 --- OOO310_m6.orig/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu 1970-01-01 01:00:00.000000000 +0100
42 +++ OOO310_m6/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu 2009-03-17 14:59:37.000000000 +0000
43 @@ -0,0 +1,10 @@
44 + <node oor:name="svg_Import" oor:op="replace" >
45 + <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
46 + <prop oor:name="FormatName"><value>svgfilter</value></prop>
47 + <prop oor:name="RealFilterName"/>
48 + <prop oor:name="UIComponent"/>
49 + <prop oor:name="UIName">
50 + <value xml:lang="en-US">SVG - Scalable Vector Graphics</value>
51 + </prop>
52 + <prop oor:name="Flags"><value>IMPORT</value></prop>
53 + </node>
54 diff -ruN OOO310_m6.orig/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu OOO310_m6/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
55 --- OOO310_m6.orig/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu 2009-03-17 14:58:31.000000000 +0000
56 +++ OOO310_m6/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu 2009-03-17 14:59:37.000000000 +0000
57 @@ -1,10 +1,10 @@
58 <node oor:name="svg_Scalable_Vector_Graphics" oor:op="replace" >
59 - <prop oor:name="DetectService"/>
60 + <prop oor:name="DetectService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
61 <prop oor:name="URLPattern"/>
62 <prop oor:name="Extensions"><value>svg</value></prop>
63 <prop oor:name="MediaType"><value>image/svg+xml</value></prop>
64 - <prop oor:name="Preferred"><value>false</value></prop>
65 - <prop oor:name="PreferredFilter"/>
66 + <prop oor:name="Preferred"><value>true</value></prop>
67 + <prop oor:name="PreferredFilter"><value>SVG - Scalable Vector Graphics</value></prop>
68 <prop oor:name="UIName">
69 <value>SVG - Scalable Vector Graphics</value>
70 </prop>
71 diff -ruN OOO310_m6.orig/filter/source/svg/b2dellipse.cxx OOO310_m6/filter/source/svg/b2dellipse.cxx
72 --- OOO310_m6.orig/filter/source/svg/b2dellipse.cxx 1970-01-01 01:00:00.000000000 +0100
73 +++ OOO310_m6/filter/source/svg/b2dellipse.cxx 2009-03-17 14:59:37.000000000 +0000
74 @@ -0,0 +1,139 @@
75 +/*************************************************************************
76 + *
77 + * OpenOffice.org - a multi-platform office productivity suite
78 + *
79 + * Author:
80 + * Fridrich Strba <fridrich.strba@bluewin.ch>
81 + * Thorsten Behrens <tbehrens@novell.com>
82 + *
83 + * Copyright (C) 2008, Novell Inc.
84 + *
85 + * The Contents of this file are made available subject to
86 + * the terms of GNU Lesser General Public License Version 2.1.
87 + *
88 + ************************************************************************/
89 +
90 +#include "b2dellipse.hxx"
91 +
92 +#include <osl/diagnose.h>
93 +
94 +#include <basegfx/point/b2dpoint.hxx>
95 +
96 +#include <basegfx/matrix/b2dhommatrix.hxx>
97 +
98 +#include <rtl/instance.hxx>
99 +
100 +#include <boost/scoped_ptr.hpp>
101 +#include <vector>
102 +#include <algorithm>
103 +
104 +class ImplB2DEllipse
105 +{
106 + basegfx::B2DPoint maCenter;
107 + basegfx::B2DTuple maRadius;
108 +
109 +public:
110 + ImplB2DEllipse()
111 + : maCenter(0.0f, 0.0f),
112 + maRadius(0.0f, 0.0f)
113 + {}
114 +
115 + ImplB2DEllipse(const ImplB2DEllipse& rToBeCopied)
116 + : maCenter(rToBeCopied.maCenter),
117 + maRadius(rToBeCopied.maRadius)
118 + {}
119 +
120 + ImplB2DEllipse& operator=( const ImplB2DEllipse& rToBeCopied )
121 + {
122 + maCenter = rToBeCopied.maCenter;
123 + maRadius = rToBeCopied.maRadius;
124 +
125 + return *this;
126 + }
127 +
128 + bool isEqual(const ImplB2DEllipse& rCandidate) const
129 + {
130 + return (maCenter == rCandidate.maCenter)
131 + && (maRadius == rCandidate.maRadius);
132 + }
133 +
134 + basegfx::B2DPoint getCenter() const
135 + {
136 + return maCenter;
137 + }
138 +
139 + void setCenter(const basegfx::B2DPoint& rCenter)
140 + {
141 + maCenter = rCenter;
142 + }
143 +
144 + basegfx::B2DTuple getRadius() const
145 + {
146 + return maRadius;
147 + }
148 +
149 + void setRadius(const basegfx::B2DTuple& rRadius)
150 + {
151 + maRadius = rRadius;
152 + }
153 +
154 +
155 + void transform(const basegfx::B2DHomMatrix& /* rMatrix */)
156 + {
157 + }
158 +};
159 +
160 +//////////////////////////////////////////////////////////////////////////////
161 +
162 +namespace basegfx
163 +{
164 +
165 + B2DEllipse::B2DEllipse()
166 + {}
167 +
168 + B2DEllipse::B2DEllipse(const basegfx::B2DPoint& rCenter, const basegfx::B2DTuple& rRadius)
169 + : maCenter(rCenter), maRadius(rRadius)
170 + {
171 + }
172 +
173 + B2DEllipse::~B2DEllipse()
174 + {
175 + }
176 +
177 + bool B2DEllipse::operator==(const B2DEllipse& rEllipse) const
178 + {
179 + return (maCenter == rEllipse.maCenter) && (maRadius == rEllipse.maRadius);
180 + }
181 +
182 + bool B2DEllipse::operator!=(const B2DEllipse& rEllipse) const
183 + {
184 + return !(*this == rEllipse);
185 + }
186 +
187 + basegfx::B2DPoint B2DEllipse::getB2DEllipseCenter() const
188 + {
189 + return maCenter;
190 + }
191 +
192 + void B2DEllipse::setB2DEllipseCenter(const basegfx::B2DPoint& rCenter)
193 + {
194 + maCenter = rCenter;
195 + }
196 +
197 + basegfx::B2DTuple B2DEllipse::getB2DEllipseRadius() const
198 + {
199 + return maRadius;
200 + }
201 +
202 + void B2DEllipse::setB2DEllipseRadius(const basegfx::B2DTuple& rRadius)
203 + {
204 + maRadius = rRadius;
205 + }
206 +
207 + void B2DEllipse::transform(const basegfx::B2DHomMatrix& /* rMatrix */)
208 + {
209 + }
210 +} // end of namespace basegfx
211 +
212 +//////////////////////////////////////////////////////////////////////////////
213 +// eof
214 diff -ruN OOO310_m6.orig/filter/source/svg/b2dellipse.hxx OOO310_m6/filter/source/svg/b2dellipse.hxx
215 --- OOO310_m6.orig/filter/source/svg/b2dellipse.hxx 1970-01-01 01:00:00.000000000 +0100
216 +++ OOO310_m6/filter/source/svg/b2dellipse.hxx 2009-03-17 14:59:37.000000000 +0000
217 @@ -0,0 +1,77 @@
218 +/*************************************************************************
219 + *
220 + * OpenOffice.org - a multi-platform office productivity suite
221 + *
222 + * Author:
223 + * Fridrich Strba <fridrich.strba@bluewin.ch>
224 + * Thorsten Behrens <tbehrens@novell.com>
225 + *
226 + * Copyright (C) 2008, Novell Inc.
227 + *
228 + * The Contents of this file are made available subject to
229 + * the terms of GNU Lesser General Public License Version 2.1.
230 + *
231 + ************************************************************************/
232 +
233 +#ifndef _BASEGFX_B2DELLIPSE_HXX
234 +#define _BASEGFX_B2DELLIPSE_HXX
235 +
236 +#include <sal/types.h>
237 +
238 +#include <o3tl/cow_wrapper.hxx>
239 +
240 +#include <basegfx/point/b2dpoint.hxx>
241 +
242 +#include <basegfx/tuple/b2dtuple.hxx>
243 +
244 +#include <basegfx/vector/b2enums.hxx>
245 +
246 +//////////////////////////////////////////////////////////////////////////////
247 +// predeclarations
248 +class ImplB2DEllipse;
249 +
250 +namespace basegfx
251 +{
252 + class B2DPoint;
253 + class B2DVector;
254 + class B2DHomMatrix;
255 +} // end of namespace basegfx
256 +
257 +//////////////////////////////////////////////////////////////////////////////
258 +
259 +namespace basegfx
260 +{
261 + class B2DEllipse
262 + {
263 + private:
264 + basegfx::B2DPoint maCenter;
265 + basegfx::B2DTuple maRadius;
266 +
267 + public:
268 + B2DEllipse();
269 + B2DEllipse(const B2DEllipse& rEllipse);
270 + B2DEllipse(const basegfx::B2DPoint& rCenter, const basegfx::B2DTuple& rRadius);
271 + ~B2DEllipse();
272 +
273 + // assignment operator
274 + B2DEllipse& operator=(const B2DEllipse& rEllipse);
275 +
276 + // compare operators
277 + bool operator==(const B2DEllipse& rEllipse) const;
278 + bool operator!=(const B2DEllipse& rEllipse) const;
279 +
280 + // Coordinate interface
281 + basegfx::B2DPoint getB2DEllipseCenter() const;
282 + void setB2DEllipseCenter(const basegfx::B2DPoint& rCenter);
283 +
284 + basegfx::B2DTuple getB2DEllipseRadius() const;
285 + void setB2DEllipseRadius(const basegfx::B2DTuple& rRadius);
286 +
287 + // apply transformation given in matrix form to the Ellipse
288 + void transform(const basegfx::B2DHomMatrix& rMatrix);
289 + };
290 +} // end of namespace basegfx
291 +
292 +//////////////////////////////////////////////////////////////////////////////
293 +
294 +#endif /* _BASEGFX_B2DELLIPSE_HXX */
295 diff -ruN OOO310_m6.orig/filter/source/svg/exports.map OOO310_m6/filter/source/svg/exports.map
296 --- OOO310_m6.orig/filter/source/svg/exports.map 2009-03-17 14:58:30.000000000 +0000
297 +++ OOO310_m6/filter/source/svg/exports.map 2009-03-17 14:59:37.000000000 +0000
298 @@ -1,9 +1,10 @@
299 -PDFFILTER_1_0 {
300 +SVGFILTER_1_0 {
301 global:
302 component_getImplementationEnvironment;
303 component_getFactory;
304 component_writeInfo;
305 + GraphicImport;
306
307 local:
308 *;
309 -};
310 \ No newline at end of file
311 +};
312 diff -ruN OOO310_m6.orig/filter/source/svg/gentoken.pl OOO310_m6/filter/source/svg/gentoken.pl
313 --- OOO310_m6.orig/filter/source/svg/gentoken.pl 1970-01-01 01:00:00.000000000 +0100
314 +++ OOO310_m6/filter/source/svg/gentoken.pl 2009-03-17 14:59:37.000000000 +0000
315 @@ -0,0 +1,58 @@
316 +# from oox/source/token - should really put this into solenv
317 +
318 +$ARGV0 = shift @ARGV;
319 +$ARGV1 = shift @ARGV;
320 +$ARGV2 = shift @ARGV;
321 +
322 +open ( TOKENS, $ARGV0 ) || die "can't open token file: $!";
323 +my %tokens;
324 +
325 +while ( defined ($line = <TOKENS>) )
326 +{
327 + if( !($line =~ /^#/) )
328 + {
329 + chomp($line);
330 + @token = split(/\s+/,$line);
331 + if ( not defined ($token[1]) )
332 + {
333 + $token[1] = "XML_".$token[0];
334 + $token[1] =~ tr/\-\.\:/___/;
335 + $token[1] =~ s/\+/PLUS/g;
336 + $token[1] =~ s/\-/MINUS/g;
337 + }
338 +
339 + $tokens{$token[0]} = uc($token[1]);
340 + }
341 +}
342 +close ( TOKENS );
343 +
344 +open ( HXX, ">$ARGV1" ) || die "can't open tokens.hxx file: $!";
345 +open ( GPERF, ">$ARGV2" ) || die "can't open tokens.gperf file: $!";
346 +
347 +print ( GPERF "%language=C++\n" );
348 +print ( GPERF "%global-table\n" );
349 +print ( GPERF "%null-strings\n" );
350 +print ( GPERF "%struct-type\n" );
351 +print ( GPERF "struct xmltoken\n" );
352 +print ( GPERF "{\n" );
353 +print ( GPERF " const sal_Char *name; sal_Int32 nToken; \n" );
354 +print ( GPERF "};\n" );
355 +print ( GPERF "%%\n" );
356 +
357 +print ( HXX "#ifndef INCLUDED_AUTOGEN_TOKEN_HXX\n" );
358 +print ( HXX "#define INCLUDED_AUTOGEN_TOKEN_HXX\n\n" );
359 +print ( HXX "#include <sal/types.h>\n\n" );
360 +
361 +$i = 0;
362 +foreach( sort(keys(%tokens)) )
363 +{
364 + print( HXX "const sal_Int32 $tokens{$_} = $i;\n" );
365 + print( GPERF "$_,$tokens{$_}\n" );
366 + $i = $i + 1;
367 +}
368 +print ( GPERF "%%\n" );
369 +print ( HXX "const sal_Int32 XML_TOKEN_COUNT = $i;\n" );
370 +print ( HXX "const sal_Int32 XML_TOKEN_INVALID = -1;\n\n" );
371 +print ( HXX "#endif\n" );
372 +close ( HXX );
373 +close ( GPERF );
374 diff -ruN OOO310_m6.orig/filter/source/svg/gfxtypes.hxx OOO310_m6/filter/source/svg/gfxtypes.hxx
375 --- OOO310_m6.orig/filter/source/svg/gfxtypes.hxx 1970-01-01 01:00:00.000000000 +0100
376 +++ OOO310_m6/filter/source/svg/gfxtypes.hxx 2009-03-17 14:59:37.000000000 +0000
377 @@ -0,0 +1,343 @@
378 +/*************************************************************************
379 + *
380 + * OpenOffice.org - a multi-platform office productivity suite
381 + *
382 + * Author:
383 + * Fridrich Strba <fridrich.strba@bluewin.ch>
384 + * Thorsten Behrens <tbehrens@novell.com>
385 + *
386 + * Copyright (C) 2008, Novell Inc.
387 + *
388 + * The Contents of this file are made available subject to
389 + * the terms of GNU Lesser General Public License Version 2.1.
390 + *
391 + ************************************************************************/
392 +
393 +#ifndef INCLUDED_GFXTYPES_HXX
394 +#define INCLUDED_GFXTYPES_HXX
395 +
396 +#include <basegfx/range/b2drange.hxx>
397 +#include <basegfx/matrix/b2dhommatrix.hxx>
398 +#include <basegfx/polygon/b2dlinegeometry.hxx>
399 +
400 +#include <hash_set>
401 +#include <hash_map>
402 +#include <rtl/ustring.hxx>
403 +
404 +namespace svgi
405 +{
406 +
407 +struct ARGBColor
408 +{
409 + double toDoubleColor( sal_uInt8 val ) { return val/255.0; }
410 +
411 + ARGBColor() : a(1.0), r(0.0), g(0.0), b(0.0)
412 + {}
413 + explicit ARGBColor(double fGrey) : a(1.0), r(fGrey), g(fGrey), b(fGrey)
414 + {}
415 + ARGBColor( double r_, double g_, double b_ ) :
416 + a(1.0), r(r_), g(g_), b(b_)
417 + {}
418 + ARGBColor( double a_, double r_, double g_, double b_ ) :
419 + a(a_), r(r_), g(g_), b(b_)
420 + {}
421 + ARGBColor( int r_, int g_, int b_ ) :
422 + a(1.0),
423 + r(toDoubleColor(sal::static_int_cast<sal_uInt8>(r_))),
424 + g(toDoubleColor(sal::static_int_cast<sal_uInt8>(g_))),
425 + b(toDoubleColor(sal::static_int_cast<sal_uInt8>(b_)))
426 + {}
427 + ARGBColor( int a_, int r_, int g_, int b_ ) :
428 + a(toDoubleColor(sal::static_int_cast<sal_uInt8>(a_))),
429 + r(toDoubleColor(sal::static_int_cast<sal_uInt8>(r_))),
430 + g(toDoubleColor(sal::static_int_cast<sal_uInt8>(g_))),
431 + b(toDoubleColor(sal::static_int_cast<sal_uInt8>(b_)))
432 + {}
433 + double a;
434 + double r;
435 + double g;
436 + double b;
437 +};
438 +inline bool operator==( const ARGBColor& rLHS, const ARGBColor& rRHS )
439 +{ return rLHS.a==rRHS.a && rLHS.r==rRHS.r && rLHS.g==rRHS.g && rLHS.b==rRHS.b; }
440 +inline bool operator!=( const ARGBColor& rLHS, const ARGBColor& rRHS )
441 +{ return !(rLHS==rRHS); }
442 +
443 +struct GradientStop
444 +{
445 + GradientStop() : maStopColor(), mnStopPosition(0.0)
446 + {}
447 + ARGBColor maStopColor;
448 + double mnStopPosition;
449 +};
450 +inline bool operator==( const GradientStop& rLHS, const GradientStop& rRHS )
451 +{ return rLHS.mnStopPosition==rRHS.mnStopPosition && rLHS.maStopColor==rRHS.maStopColor; }
452 +
453 +struct Gradient
454 +{
455 + enum GradientType { LINEAR, RADIAL};
456 + std::vector<sal_Size> maStops;
457 + basegfx::B2DHomMatrix maTransform;
458 + GradientType meType;
459 + union
460 + {
461 + double test;
462 + struct
463 + {
464 + double mfX1;
465 + double mfX2;
466 + double mfY1;
467 + double mfY2;
468 + } linear;
469 + struct
470 + {
471 + double mfCX;
472 + double mfCY;
473 + double mfFX;
474 + double mfFY;
475 + double mfR;
476 + } radial;
477 + } maCoords;
478 + sal_Int32 mnId;
479 + bool mbBoundingBoxUnits;
480 + bool mbLinearBoundingBoxUnits;
481 +
482 +// explicit Gradient(GradientType eType) : maStops(), maTransform(), meType(eType), maCoords.mfCX(0.0), maCoords.mfCY(0.0), maCoords.mfFX(0.0), maCoords.mfFY(0.0), maCoords.mfR(0.0), mnId(0), mbBoundingBoxUnits(false)
483 + explicit Gradient(GradientType eType) : maStops(), maTransform(), meType(eType), mnId(0), mbBoundingBoxUnits(false)
484 + {
485 + maCoords.radial.mfCX = 0.0;
486 + maCoords.radial.mfCY = 0.0;
487 + maCoords.radial.mfFX = 0.0;
488 + maCoords.radial.mfFY = 0.0;
489 + maCoords.radial.mfR = 0.0;
490 + }
491 +};
492 +
493 +inline bool operator==( const Gradient& rLHS, const Gradient& rRHS )
494 +{
495 + if( rLHS.meType != rRHS.meType )
496 + return false;
497 + if( rLHS.meType == Gradient::LINEAR )
498 + return rLHS.mbBoundingBoxUnits==rRHS.mbBoundingBoxUnits && rLHS.maStops==rRHS.maStops &&
499 + rLHS.maCoords.linear.mfX1 == rRHS.maCoords.linear.mfX1 && rLHS.maCoords.linear.mfX2 == rRHS.maCoords.linear.mfX2 &&
500 + rLHS.maCoords.linear.mfY1 == rRHS.maCoords.linear.mfY1 && rLHS.maCoords.linear.mfY2 == rRHS.maCoords.linear.mfY2;
501 + else
502 + return rLHS.mbBoundingBoxUnits==rRHS.mbBoundingBoxUnits && rLHS.maStops==rRHS.maStops &&
503 + rLHS.maCoords.radial.mfCX == rRHS.maCoords.radial.mfCX && rLHS.maCoords.radial.mfCY == rRHS.maCoords.radial.mfCY &&
504 + rLHS.maCoords.radial.mfFX == rRHS.maCoords.radial.mfFX && rLHS.maCoords.radial.mfFY == rRHS.maCoords.radial.mfFY &&
505 + rLHS.maCoords.radial.mfR == rRHS.maCoords.radial.mfR;
506 +}
507 +
508 +enum PaintType
509 +{
510 + NONE,
511 + SOLID,
512 + GRADIENT
513 +};
514 +
515 +enum FillRule
516 +{
517 + NON_ZERO,
518 + EVEN_ODD
519 +};
520 +
521 +enum TextAlign
522 +{
523 + BEFORE,
524 + CENTER,
525 + AFTER
526 +};
527 +
528 +enum CapStyle
529 +{
530 + BUTT,
531 + RECT,
532 + ROUND
533 +};
534 +
535 +struct State
536 +{
537 + State() :
538 + maCTM(),
539 + maTransform(),
540 + maViewport(),
541 + maViewBox(),
542 + maFontFamily(), // app-default
543 + mnFontSize(12.0),
544 + maFontStyle(RTL_CONSTASCII_USTRINGPARAM("normal")),
545 + maFontVariant(RTL_CONSTASCII_USTRINGPARAM("normal")),
546 + mnFontWeight(400.0),
547 + meTextAnchor(BEFORE),
548 + meTextDisplayAlign(BEFORE),
549 + mnTextLineIncrement(0.0),
550 + maCurrentColor(1.0),
551 + mbVisibility(true),
552 + meFillType(SOLID),
553 + mnFillOpacity(1.0),
554 + meStrokeType(NONE),
555 + mnStrokeOpacity(1.0),
556 + meViewportFillType(NONE),
557 + mnViewportFillOpacity(1.0),
558 + maFillColor(0.0),
559 + maFillGradient(Gradient::LINEAR),
560 + meFillRule(NON_ZERO),
561 + maStrokeColor(0.0),
562 + maStrokeGradient(Gradient::LINEAR),
563 + maDashArray(),
564 + mnDashOffset(0.0),
565 + meLineCap(BUTT),
566 + meLineJoin(basegfx::B2DLINEJOIN_MITER),
567 + mnMiterLimit(4.0),
568 + mnStrokeWidth(1.0),
569 + maViewportFillColor(1.0),
570 + maViewportFillGradient(Gradient::LINEAR),
571 + mnStyleId(0)
572 + {}
573 +
574 + basegfx::B2DHomMatrix maCTM;
575 + basegfx::B2DHomMatrix maTransform;
576 + basegfx::B2DRange maViewport;
577 + basegfx::B2DRange maViewBox;
578 +
579 + rtl::OUString maFontFamily;
580 + /** Absolute: xx-small=6.94 | x-small=8.33 | small=10 | medium=12 | large=14.4 | x-large=17.28 | xx-large=20.736
581 +
582 + Relative(to parent): larger (enlarge by 1.2)
583 + smaller (shrink by 1.2)
584 +
585 + */
586 + double mnFontSize;
587 + rtl::OUString maFontStyle;
588 + rtl::OUString maFontVariant;
589 + double mnFontWeight;
590 +
591 + TextAlign meTextAnchor; // text-anchor
592 + TextAlign meTextDisplayAlign; // display-align
593 + double mnTextLineIncrement; // 0.0 means auto
594 +
595 + ARGBColor maCurrentColor;
596 + bool mbVisibility;
597 +
598 + PaintType meFillType;
599 + double mnFillOpacity;
600 + PaintType meStrokeType;
601 + double mnStrokeOpacity;
602 + PaintType meViewportFillType;
603 + double mnViewportFillOpacity;
604 +
605 + ARGBColor maFillColor;
606 + Gradient maFillGradient;
607 + FillRule meFillRule;
608 +
609 + ARGBColor maStrokeColor;
610 + Gradient maStrokeGradient;
611 + std::vector<double> maDashArray;
612 + double mnDashOffset;
613 + CapStyle meLineCap;
614 + basegfx::B2DLineJoin meLineJoin;
615 + double mnMiterLimit;
616 + double mnStrokeWidth;
617 +
618 + ARGBColor maViewportFillColor;
619 + Gradient maViewportFillGradient;
620 +
621 + sal_Int32 mnStyleId;
622 +};
623 +
624 +inline bool operator==(const State& rLHS, const State& rRHS )
625 +{
626 + return rLHS.maCTM==rRHS.maCTM &&
627 + rLHS.maTransform==rRHS.maTransform &&
628 + rLHS.maViewport==rRHS.maViewport &&
629 + rLHS.maViewBox==rRHS.maViewBox &&
630 + rLHS.maFontFamily==rRHS.maFontFamily &&
631 + rLHS.mnFontSize==rRHS.mnFontSize &&
632 + rLHS.maFontStyle==rRHS.maFontStyle &&
633 + rLHS.maFontVariant==rRHS.maFontVariant &&
634 + rLHS.mnFontWeight==rRHS.mnFontWeight &&
635 + rLHS.meTextAnchor==rRHS.meTextAnchor &&
636 + rLHS.meTextDisplayAlign==rRHS.meTextDisplayAlign &&
637 + rLHS.mnTextLineIncrement==rRHS.mnTextLineIncrement &&
638 + rLHS.maCurrentColor==rRHS.maCurrentColor &&
639 + rLHS.mbVisibility==rRHS.mbVisibility &&
640 + rLHS.meFillType==rRHS.meFillType &&
641 + rLHS.mnFillOpacity==rRHS.mnFillOpacity &&
642 + rLHS.meStrokeType==rRHS.meStrokeType &&
643 + rLHS.mnStrokeOpacity==rRHS.mnStrokeOpacity &&
644 + rLHS.meViewportFillType==rRHS.meViewportFillType &&
645 + rLHS.mnViewportFillOpacity==rRHS.mnViewportFillOpacity &&
646 + rLHS.maFillColor==rRHS.maFillColor &&
647 + rLHS.maFillGradient==rRHS.maFillGradient &&
648 + rLHS.meFillRule==rRHS.meFillRule &&
649 + rLHS.maStrokeColor==rRHS.maStrokeColor &&
650 + rLHS.maStrokeGradient==rRHS.maStrokeGradient &&
651 + rLHS.maDashArray==rRHS.maDashArray &&
652 + rLHS.mnDashOffset==rRHS.mnDashOffset &&
653 + rLHS.meLineCap==rRHS.meLineCap &&
654 + rLHS.meLineJoin==rRHS.meLineJoin &&
655 + rLHS.mnMiterLimit==rRHS.mnMiterLimit &&
656 + rLHS.mnStrokeWidth==rRHS.mnStrokeWidth &&
657 + rLHS.maViewportFillColor==rRHS.maViewportFillColor &&
658 + rLHS.maViewportFillGradient==rRHS.maViewportFillGradient;
659 +}
660 +
661 +struct StateHash
662 +{
663 + size_t operator()(const State& rState ) const
664 + {
665 + return size_t(rState.maCTM.get( 0, 0 ))
666 + ^ size_t(rState.maCTM.get( 1, 0 ))
667 + ^ size_t(rState.maCTM.get( 0, 1 ))
668 + ^ size_t(rState.maCTM.get( 1, 1 ))
669 + ^ size_t(rState.maCTM.get( 0, 2 ))
670 + ^ size_t(rState.maCTM.get( 1, 2 ))
671 + ^ size_t(rState.maViewport.getWidth())
672 + ^ size_t(rState.maViewport.getHeight())
673 + ^ size_t(rState.maViewBox.getWidth())
674 + ^ size_t(rState.maViewBox.getHeight())
675 + ^ size_t(rState.maFontFamily.hashCode())
676 + ^ size_t(rState.mnFontSize)
677 + ^ size_t(rState.maFontStyle.hashCode())
678 + ^ size_t(rState.maFontVariant.hashCode())
679 + ^ size_t(rState.mnFontWeight)
680 + ^ size_t(rState.meTextAnchor)
681 + ^ size_t(rState.meTextDisplayAlign)
682 + ^ size_t(rState.mnTextLineIncrement)
683 + ^ size_t(rState.mbVisibility)
684 + ^ size_t(rState.meFillType)
685 + ^ size_t(rState.mnFillOpacity)
686 + ^ size_t(rState.meStrokeType)
687 + ^ size_t(rState.mnStrokeOpacity)
688 + ^ size_t(rState.meViewportFillType)
689 + ^ size_t(rState.mnViewportFillOpacity)
690 + ^ size_t(rState.maFillColor.a)
691 + ^ size_t(rState.maFillColor.r)
692 + ^ size_t(rState.maFillColor.g)
693 + ^ size_t(rState.maFillColor.b)
694 + ^ size_t(rState.maFillGradient.maStops.size())
695 + ^ size_t(rState.meFillRule)
696 + ^ size_t(rState.maStrokeColor.a)
697 + ^ size_t(rState.maStrokeColor.r)
698 + ^ size_t(rState.maStrokeColor.g)
699 + ^ size_t(rState.maStrokeColor.b)
700 + ^ size_t(rState.maStrokeGradient.maStops.size())
701 + ^ size_t(rState.maDashArray.size())
702 + ^ size_t(rState.mnDashOffset)
703 + ^ size_t(rState.meLineCap)
704 + ^ size_t(rState.meLineJoin)
705 + ^ size_t(rState.mnMiterLimit)
706 + ^ size_t(rState.mnStrokeWidth)
707 + ^ size_t(rState.maViewportFillColor.a)
708 + ^ size_t(rState.maViewportFillColor.r)
709 + ^ size_t(rState.maViewportFillColor.g)
710 + ^ size_t(rState.maViewportFillColor.b)
711 + ^ size_t(rState.maViewportFillGradient.maStops.size());
712 + }
713 +};
714 +
715 +typedef std::hash_set<State, StateHash> StatePool;
716 +typedef std::hash_map<sal_Int32, State> StateMap;
717 +
718 +} // namespace svgi
719 +
720 +#endif
721 diff -ruN OOO310_m6.orig/filter/source/svg/makefile.mk OOO310_m6/filter/source/svg/makefile.mk
722 --- OOO310_m6.orig/filter/source/svg/makefile.mk 2009-03-17 14:58:30.000000000 +0000
723 +++ OOO310_m6/filter/source/svg/makefile.mk 2009-03-17 14:59:37.000000000 +0000
724 @@ -30,25 +30,35 @@
725 #*************************************************************************
726
727 PRJ=..$/..
728 +
729 PRJNAME=filter
730 TARGET=svgfilter
731 -
732 ENABLE_EXCEPTIONS=TRUE
733 VISIBILITY_HIDDEN=TRUE
734
735 # --- Settings ----------------------------------
736
737 -.INCLUDE : settings.mk
738 +.INCLUDE : settings.mk
739 +.INCLUDE : libs.mk
740
741 # --- Types -------------------------------------
742
743 -SLOFILES= $(SLO)$/svguno.obj \
744 - $(SLO)$/svgfilter.obj \
745 +SLOFILES= \
746 + $(SLO)$/b2dellipse.obj \
747 + $(SLO)$/parserfragments.obj \
748 $(SLO)$/svgexport.obj \
749 + $(SLO)$/svgfilter.obj \
750 $(SLO)$/svgfontexport.obj \
751 - $(SLO)$/svgwriter.obj
752 -.IF "$(SOLAR_JAVA)"!=""
753 -SLOFILES+= $(SLO)$/svgimport.obj
754 + $(SLO)$/svgimport.obj \
755 + $(SLO)$/svgreader.obj \
756 + $(SLO)$/svgwriter.obj \
757 + $(SLO)$/tokenmap.obj \
758 + $(SLO)$/units.obj
759 +
760 +.IF "$(COMID)"=="gcc3"
761 +.IF "$(CCNUMVER)">="000400000000" || "$(SYSTEM_BOOST)"=="YES"
762 +CFLAGS+=-DUSE_MODERN_SPIRIT
763 +.ENDIF
764 .ENDIF
765
766 # --- Library -----------------------------------
767 @@ -58,19 +68,17 @@
768 SHL1STDLIBS=\
769 $(SVXCORELIB) \
770 $(XMLOFFLIB) \
771 - $(GOODIESLIB) \
772 + $(SVTOOLLIB) \
773 + $(BASEGFXLIB) \
774 $(VCLLIB) \
775 $(UNOTOOLSLIB) \
776 $(TOOLSLIB) \
777 $(COMPHELPERLIB) \
778 + $(SVTOOLLIB) \
779 $(CPPUHELPERLIB) \
780 $(CPPULIB) \
781 - $(SALLIB)
782 -
783 -.IF "$(SOLAR_JAVA)"!=""
784 -SHL1STDLIBS+=\
785 - $(JVMACCESSLIB)
786 -.ENDIF
787 + $(SALLIB) \
788 + $(LIBXML)
789
790
791 SHL1DEPN=
792 @@ -84,3 +92,16 @@
793 # --- Targets ----------------------------------
794
795 .INCLUDE : target.mk
796 +
797 +# Generate gperf files - from oox/source/token
798 +$(INCCOM)$/tokens.hxx $(MISC)$/tokens.gperf : tokens.txt gentoken.pl
799 + $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(MISC)$/tokens.gperf
800 +
801 +$(INCCOM)$/tokens.cxx : $(MISC)$/tokens.gperf makefile.mk
802 + gperf --compare-strncmp -C -m 20 $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" >$(INCCOM)$/tokens.cxx
803 +
804 +$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.cxx $(INCCOM)$/tokens.hxx
805 +
806 +$(SLO)$/parserfragments.obj : $(INCCOM)$/tokens.cxx $(INCCOM)$/tokens.hxx
807 +
808 +$(SLO)$/svgreader.obj : $(INCCOM)$/tokens.cxx $(INCCOM)$/tokens.hxx
809 diff -ruN OOO310_m6.orig/filter/source/svg/parserfragments.cxx OOO310_m6/filter/source/svg/parserfragments.cxx
810 --- OOO310_m6.orig/filter/source/svg/parserfragments.cxx 1970-01-01 01:00:00.000000000 +0100
811 +++ OOO310_m6/filter/source/svg/parserfragments.cxx 2009-03-17 14:59:37.000000000 +0000
812 @@ -0,0 +1,600 @@
813 +/*************************************************************************
814 + *
815 + * OpenOffice.org - a multi-platform office productivity suite
816 + *
817 + * Author:
818 + * Fridrich Strba <fridrich.strba@bluewin.ch>
819 + * Thorsten Behrens <tbehrens@novell.com>
820 + *
821 + * Copyright (C) 2008, Novell Inc.
822 + *
823 + * The Contents of this file are made available subject to
824 + * the terms of GNU Lesser General Public License Version 2.1.
825 + *
826 + ************************************************************************/
827 +
828 +// MARKER(update_precomp.py): autogen include statement, do not remove
829 +#include "precompiled_filter.hxx"
830 +
831 +#include "parserfragments.hxx"
832 +#include "spirit_supplements.hxx"
833 +#include "gfxtypes.hxx"
834 +
835 +#include <basegfx/tools/canvastools.hxx>
836 +#include <com/sun/star/geometry/AffineMatrix2D.hpp>
837 +
838 +#include <string.h>
839 +#include <limits.h>
840 +#include <boost/bind.hpp>
841 +#include <boost/spirit.hpp>
842 +#include <boost/spirit/dynamic/while.hpp>
843 +#include <numeric>
844 +#include <algorithm>
845 +
846 +#include "units.hxx"
847 +#include "tokenmap.hxx"
848 +
849 +using namespace ::com::sun::star;
850 +
851 +namespace svgi
852 +{
853 +
854 +inline sal_uInt8 hex2int( char val )
855 +{
856 + return val <= '9' ? val-'0' : (val < 'a' ? val+10-'A' : val+10-'a');
857 +}
858 +
859 +void setFourBitColor( double& rChannel, char nChar )
860 +{
861 + const sal_uInt8 nVal(hex2int(nChar));
862 + OSL_TRACE( "setFourBitCOlor %d color", nVal );
863 + rChannel = (nVal*16+nVal)/255.0;
864 +}
865 +
866 +void setEightBitColor( double& rChannel, const char* pStart, const char* )
867 +{
868 + const sal_uInt8 nVal0(hex2int(pStart[0]));
869 + const sal_uInt8 nVal1(hex2int(pStart[1]));
870 + OSL_TRACE( "setEightbitCOlor %d, %d color", nVal0, nVal1 );
871 + rChannel = (nVal0*16+nVal1)/255.0;
872 +}
873 +
874 +void setIntColor( double& rChannel, sal_uInt8 nVal )
875 +{
876 + OSL_TRACE( "setIntColor %d color", nVal );
877 + rChannel = nVal/255.0;
878 +}
879 +
880 +void calcRotation(std::vector<geometry::AffineMatrix2D>& rTransforms,
881 + geometry::AffineMatrix2D& rCurrTransform,
882 + double fRotationAngle)
883 +{
884 + ::basegfx::B2DHomMatrix aCurr;
885 + aCurr.translate(-rCurrTransform.m02,-rCurrTransform.m12);
886 + aCurr.rotate(fRotationAngle*M_PI/180);
887 + aCurr.translate(rCurrTransform.m02,rCurrTransform.m12);
888 +
889 + OSL_TRACE("calcRotation - fRotationAngle - %f", fRotationAngle);
890 + rTransforms.push_back(
891 + basegfx::unotools::affineMatrixFromHomMatrix(
892 + rCurrTransform,
893 + aCurr));
894 +}
895 +
896 +void calcSkewX(std::vector<geometry::AffineMatrix2D>& rTransforms,
897 + double fSkewAngle)
898 +{
899 + geometry::AffineMatrix2D aMat(1.0,0.0,0.0,
900 + tan(fSkewAngle*M_PI/180),1.0,0.0);
901 + rTransforms.push_back(aMat);
902 +}
903 +
904 +void calcSkewY(std::vector<geometry::AffineMatrix2D>& rTransforms,
905 + double fSkewAngle)
906 +{
907 + geometry::AffineMatrix2D aMat(1.0,tan(fSkewAngle*M_PI/180),0.0,
908 + 0.0,1.0,0.0);
909 + rTransforms.push_back(aMat);
910 +}
911 +
912 +void assign_twice(double& r_oVal1, double& r_oVal2, const double& rInVal )
913 +{
914 + r_oVal1 = r_oVal2 = rInVal;
915 +}
916 +
917 +geometry::AffineMatrix2D multiplyMatrix( const geometry::AffineMatrix2D& rLHS,
918 + const geometry::AffineMatrix2D& rRHS )
919 +{
920 + basegfx::B2DHomMatrix aLHS;
921 + basegfx::B2DHomMatrix aRHS;
922 +
923 + basegfx::unotools::homMatrixFromAffineMatrix(aLHS,rLHS);
924 + basegfx::unotools::homMatrixFromAffineMatrix(aRHS,rRHS);
925 +
926 + aRHS*=aLHS;
927 +
928 + geometry::AffineMatrix2D aRet;
929 + return basegfx::unotools::affineMatrixFromHomMatrix(aRet,aRHS);
930 +}
931 +
932 +namespace
933 +{
934 + struct ColorGrammar : public ::boost::spirit::grammar< ColorGrammar >
935 + {
936 + public:
937 + ARGBColor& m_rColor;
938 + explicit ColorGrammar( ARGBColor& rColor ) : m_rColor(rColor) {}
939 + template< typename ScannerT >
940 + struct definition
941 + {
942 + ::boost::spirit::rule< ScannerT > colorExpression;
943 + definition( const ColorGrammar& self )
944 + {
945 + using namespace ::boost::spirit;
946 +
947 + int_parser<sal_uInt8,10,1,3> byte_p;
948 + colorExpression =
949 + (
950 + // the #rrggbb form
951 + ('#' >> (xdigit_p >> xdigit_p)[boost::bind(&setEightBitColor,
952 + boost::ref(self.m_rColor.r),_1,_2)]
953 + >> (xdigit_p >> xdigit_p)[boost::bind(&setEightBitColor,
954 + boost::ref(self.m_rColor.g),_1,_2)]
955 + >> (xdigit_p >> xdigit_p)[boost::bind(&setEightBitColor,
956 + boost::ref(self.m_rColor.b),_1,_2)])
957 + |
958 + // the #rgb form
959 + ('#' >> xdigit_p[boost::bind(&setFourBitColor,
960 + boost::ref(self.m_rColor.r),_1)]
961 + >> xdigit_p[boost::bind(&setFourBitColor,
962 + boost::ref(self.m_rColor.g),_1)]
963 + >> xdigit_p[boost::bind(&setFourBitColor,
964 + boost::ref(self.m_rColor.b),_1)])
965 + |
966 + // rgb() form
967 + (str_p("rgb")
968 + >> '(' >>
969 + (
970 + // rgb(int,int,int)
971 + (byte_p[boost::bind(&setIntColor,
972 + boost::ref(self.m_rColor.r),_1)] >> ',' >>
973 + byte_p[boost::bind(&setIntColor,
974 + boost::ref(self.m_rColor.g),_1)] >> ',' >>
975 + byte_p[boost::bind(&setIntColor,
976 + boost::ref(self.m_rColor.b),_1)])
977 + |
978 + // rgb(double,double,double)
979 + (real_p[assign_a(self.m_rColor.r)] >> ',' >>
980 + real_p[assign_a(self.m_rColor.g)] >> ',' >>
981 + real_p[assign_a(self.m_rColor.b)])
982 + )
983 + >> ')')
984 + );
985 + }
986 + ::boost::spirit::rule<ScannerT> const& start() const { return colorExpression; }
987 + };
988 + };
989 +}
990 +
991 +bool parseColor( const char* sColor, ARGBColor& rColor )
992 +{
993 + using namespace ::boost::spirit;
994 +
995 + if( parse(sColor,
996 + ColorGrammar(rColor) >> end_p,
997 + space_p).full )
998 + {
999 + // free-form color found & parsed
1000 + return true;
1001 + }
1002 +
1003 + // no free-form color - maybe a color name?
1004 + // trim white space before
1005 + while( *sColor &&
1006 + (*sColor==' ' || *sColor=='\t' || *sColor=='\r' || *sColor=='\n') )
1007 + ++sColor;
1008 + // trim white space after
1009 + int nLen=strlen(sColor)-1;
1010 + while( nLen &&
1011 + (sColor[nLen]==' ' || sColor[nLen]=='\t' || sColor[nLen]=='\r' || sColor[nLen]=='\n') )
1012 + --nLen;
1013 + switch (getTokenId(sColor, nLen+1))
1014 + {
1015 + case XML_ALICEBLUE: rColor = ARGBColor(240,248,255); return true;
1016 + case XML_ANTIQUEWHITE: rColor = ARGBColor(250,235,215); return true;
1017 + case XML_AQUA: rColor = ARGBColor(0,255,255); return true;
1018 + case XML_AQUAMARINE: rColor = ARGBColor(127,255,212); return true;
1019 + case XML_AZURE: rColor = ARGBColor(240,255,255); return true;
1020 + case XML_BEIGE: rColor = ARGBColor(245,245,220); return true;
1021 + case XML_BISQUE: rColor = ARGBColor(255,228,196); return true;
1022 + case XML_BLACK: rColor = ARGBColor(0,0,0); return true;
1023 + case XML_BLANCHEDALMOND: rColor = ARGBColor(255,235,205); return true;
1024 + case XML_BLUE: rColor = ARGBColor(0,0,255); return true;
1025 + case XML_BLUEVIOLET: rColor = ARGBColor(138,43,226); return true;
1026 + case XML_BROWN: rColor = ARGBColor(165,42,42); return true;
1027 + case XML_BURLYWOOD: rColor = ARGBColor(222,184,135); return true;
1028 + case XML_CADETBLUE: rColor = ARGBColor(95,158,160); return true;
1029 + case XML_CHARTREUSE: rColor = ARGBColor(127,255,0); return true;
1030 + case XML_CHOCOLATE: rColor = ARGBColor(210,105,30); return true;
1031 + case XML_CORAL: rColor = ARGBColor(255,127,80); return true;
1032 + case XML_CORNFLOWERBLUE: rColor = ARGBColor(100,149,237); return true;
1033 + case XML_CORNSILK: rColor = ARGBColor(255,248,220); return true;
1034 + case XML_CRIMSON: rColor = ARGBColor(220,20,60); return true;
1035 + case XML_CYAN: rColor = ARGBColor(0,255,255); return true;
1036 + case XML_DARKBLUE: rColor = ARGBColor(0,0,139); return true;
1037 + case XML_DARKCYAN: rColor = ARGBColor(0,139,139); return true;
1038 + case XML_DARKGOLDENROD: rColor = ARGBColor(184,134,11); return true;
1039 + case XML_DARKGRAY: rColor = ARGBColor(169,169,169); return true;
1040 + case XML_DARKGREEN: rColor = ARGBColor(0,100,0); return true;
1041 + case XML_DARKGREY: rColor = ARGBColor(169,169,169); return true;
1042 + case XML_DARKKHAKI: rColor = ARGBColor(189,183,107); return true;
1043 + case XML_DARKMAGENTA: rColor = ARGBColor(139,0,139); return true;
1044 + case XML_DARKOLIVEGREEN: rColor = ARGBColor(85,107,47); return true;
1045 + case XML_DARKORANGE: rColor = ARGBColor(255,140,0); return true;
1046 + case XML_DARKORCHID: rColor = ARGBColor(153,50,204); return true;
1047 + case XML_DARKRED: rColor = ARGBColor(139,0,0); return true;
1048 + case XML_DARKSALMON: rColor = ARGBColor(233,150,122); return true;
1049 + case XML_DARKSEAGREEN: rColor = ARGBColor(143,188,143); return true;
1050 + case XML_DARKSLATEBLUE: rColor = ARGBColor(72,61,139); return true;
1051 + case XML_DARKSLATEGRAY: rColor = ARGBColor(47,79,79); return true;
1052 + case XML_DARKSLATEGREY: rColor = ARGBColor(47,79,79); return true;
1053 + case XML_DARKTURQUOISE: rColor = ARGBColor(0,206,209); return true;
1054 + case XML_DARKVIOLET: rColor = ARGBColor(148,0,211); return true;
1055 + case XML_DEEPPINK: rColor = ARGBColor(255,20,147); return true;
1056 + case XML_DEEPSKYBLUE: rColor = ARGBColor(0,191,255); return true;
1057 + case XML_DIMGRAY: rColor = ARGBColor(105,105,105); return true;
1058 + case XML_DIMGREY: rColor = ARGBColor(105,105,105); return true;
1059 + case XML_DODGERBLUE: rColor = ARGBColor(30,144,255); return true;
1060 + case XML_FIREBRICK: rColor = ARGBColor(178,34,34); return true;
1061 + case XML_FLORALWHITE: rColor = ARGBColor(255,250,240); return true;
1062 + case XML_FORESTGREEN: rColor = ARGBColor(34,139,34); return true;
1063 + case XML_FUCHSIA: rColor = ARGBColor(255,0,255); return true;
1064 + case XML_GAINSBORO: rColor = ARGBColor(220,220,220); return true;
1065 + case XML_GHOSTWHITE: rColor = ARGBColor(248,248,255); return true;
1066 + case XML_GOLD: rColor = ARGBColor(255,215,0); return true;
1067 + case XML_GOLDENROD: rColor = ARGBColor(218,165,32); return true;
1068 + case XML_GRAY: rColor = ARGBColor(128,128,128); return true;
1069 + case XML_GREY: rColor = ARGBColor(128,128,128); return true;
1070 + case XML_GREEN: rColor = ARGBColor(0,128,0); return true;
1071 + case XML_GREENYELLOW: rColor = ARGBColor(173,255,47); return true;
1072 + case XML_HONEYDEW: rColor = ARGBColor(240,255,240); return true;
1073 + case XML_HOTPINK: rColor = ARGBColor(255,105,180); return true;
1074 + case XML_INDIANRED: rColor = ARGBColor(205,92,92); return true;
1075 + case XML_INDIGO: rColor = ARGBColor(75,0,130); return true;
1076 + case XML_IVORY: rColor = ARGBColor(255,255,240); return true;
1077 + case XML_KHAKI: rColor = ARGBColor(240,230,140); return true;
1078 + case XML_LAVENDER: rColor = ARGBColor(230,230,250); return true;
1079 + case XML_LAVENDERBLUSH: rColor = ARGBColor(255,240,245); return true;
1080 + case XML_LAWNGREEN: rColor = ARGBColor(124,252,0); return true;
1081 + case XML_LEMONCHIFFON: rColor = ARGBColor(255,250,205); return true;
1082 + case XML_LIGHTBLUE: rColor = ARGBColor(173,216,230); return true;
1083 + case XML_LIGHTCORAL: rColor = ARGBColor(240,128,128); return true;
1084 + case XML_LIGHTCYAN: rColor = ARGBColor(224,255,255); return true;
1085 + case XML_LIGHTGOLDENRODYELLOW: rColor = ARGBColor(250,250,210); return true;
1086 + case XML_LIGHTGRAY: rColor = ARGBColor(211,211,211); return true;
1087 + case XML_LIGHTGREEN: rColor = ARGBColor(144,238,144); return true;
1088 + case XML_LIGHTGREY: rColor = ARGBColor(211,211,211); return true;
1089 + case XML_LIGHTPINK: rColor = ARGBColor(255,182,193); return true;
1090 + case XML_LIGHTSALMON: rColor = ARGBColor(255,160,122); return true;
1091 + case XML_LIGHTSEAGREEN: rColor = ARGBColor(32,178,170); return true;
1092 + case XML_LIGHTSKYBLUE: rColor = ARGBColor(135,206,250); return true;
1093 + case XML_LIGHTSLATEGRAY: rColor = ARGBColor(119,136,153); return true;
1094 + case XML_LIGHTSLATEGREY: rColor = ARGBColor(119,136,153); return true;
1095 + case XML_LIGHTSTEELBLUE: rColor = ARGBColor(176,196,222); return true;
1096 + case XML_LIGHTYELLOW: rColor = ARGBColor(255,255,224); return true;
1097 + case XML_LIME: rColor = ARGBColor(0,255,0); return true;
1098 + case XML_LIMEGREEN: rColor = ARGBColor(50,205,50); return true;
1099 + case XML_LINEN: rColor = ARGBColor(250,240,230); return true;
1100 + case XML_MAGENTA: rColor = ARGBColor(255,0,255); return true;
1101 + case XML_MAROON: rColor = ARGBColor(128,0,0); return true;
1102 + case XML_MEDIUMAQUAMARINE: rColor = ARGBColor(102,205,170); return true;
1103 + case XML_MEDIUMBLUE: rColor = ARGBColor(0,0,205); return true;
1104 + case XML_MEDIUMORCHID: rColor = ARGBColor(186,85,211); return true;
1105 + case XML_MEDIUMPURPLE: rColor = ARGBColor(147,112,219); return true;
1106 + case XML_MEDIUMSEAGREEN: rColor = ARGBColor(60,179,113); return true;
1107 + case XML_MEDIUMSLATEBLUE: rColor = ARGBColor(123,104,238); return true;
1108 + case XML_MEDIUMSPRINGGREEN: rColor = ARGBColor(0,250,154); return true;
1109 + case XML_MEDIUMTURQUOISE: rColor = ARGBColor(72,209,204); return true;
1110 + case XML_MEDIUMVIOLETRED: rColor = ARGBColor(199,21,133); return true;
1111 + case XML_MIDNIGHTBLUE: rColor = ARGBColor(25,25,112); return true;
1112 + case XML_MINTCREAM: rColor = ARGBColor(245,255,250); return true;
1113 + case XML_MISTYROSE: rColor = ARGBColor(255,228,225); return true;
1114 + case XML_MOCCASIN: rColor = ARGBColor(255,228,181); return true;
1115 + case XML_NAVAJOWHITE: rColor = ARGBColor(255,222,173); return true;
1116 + case XML_NAVY: rColor = ARGBColor(0,0,128); return true;
1117 + case XML_OLDLACE: rColor = ARGBColor(253,245,230); return true;
1118 + case XML_OLIVE: rColor = ARGBColor(128,128,0); return true;
1119 + case XML_OLIVEDRAB: rColor = ARGBColor(107,142,35); return true;
1120 + case XML_ORANGE: rColor = ARGBColor(255,165,0); return true;
1121 + case XML_ORANGERED: rColor = ARGBColor(255,69,0); return true;
1122 + case XML_ORCHID: rColor = ARGBColor(218,112,214); return true;
1123 + case XML_PALEGOLDENROD: rColor = ARGBColor(238,232,170); return true;
1124 + case XML_PALEGREEN: rColor = ARGBColor(152,251,152); return true;
1125 + case XML_PALETURQUOISE: rColor = ARGBColor(175,238,238); return true;
1126 + case XML_PALEVIOLETRED: rColor = ARGBColor(219,112,147); return true;
1127 + case XML_PAPAYAWHIP: rColor = ARGBColor(255,239,213); return true;
1128 + case XML_PEACHPUFF: rColor = ARGBColor(255,218,185); return true;
1129 + case XML_PERU: rColor = ARGBColor(205,133,63); return true;
1130 + case XML_PINK: rColor = ARGBColor(255,192,203); return true;
1131 + case XML_PLUM: rColor = ARGBColor(221,160,221); return true;
1132 + case XML_POWDERBLUE: rColor = ARGBColor(176,224,230); return true;
1133 + case XML_PURPLE: rColor = ARGBColor(128,0,128); return true;
1134 + case XML_RED: rColor = ARGBColor(255,0,0); return true;
1135 + case XML_ROSYBROWN: rColor = ARGBColor(188,143,143); return true;
1136 + case XML_ROYALBLUE: rColor = ARGBColor(65,105,225); return true;
1137 + case XML_SADDLEBROWN: rColor = ARGBColor(139,69,19); return true;
1138 + case XML_SALMON: rColor = ARGBColor(250,128,114); return true;
1139 + case XML_SANDYBROWN: rColor = ARGBColor(244,164,96); return true;
1140 + case XML_SEAGREEN: rColor = ARGBColor(46,139,87); return true;
1141 + case XML_SEASHELL: rColor = ARGBColor(255,245,238); return true;
1142 + case XML_SIENNA: rColor = ARGBColor(160,82,45); return true;
1143 + case XML_SILVER: rColor = ARGBColor(192,192,192); return true;
1144 + case XML_SKYBLUE: rColor = ARGBColor(135,206,235); return true;
1145 + case XML_SLATEBLUE: rColor = ARGBColor(106,90,205); return true;
1146 + case XML_SLATEGRAY: rColor = ARGBColor(112,128,144); return true;
1147 + case XML_SLATEGREY: rColor = ARGBColor(112,128,144); return true;
1148 + case XML_SNOW: rColor = ARGBColor(255,250,250); return true;
1149 + case XML_SPRINGGREEN: rColor = ARGBColor(0,255,127); return true;
1150 + case XML_STEELBLUE: rColor = ARGBColor(70,130,180); return true;
1151 + case XML_TAN: rColor = ARGBColor(210,180,140); return true;
1152 + case XML_TEAL: rColor = ARGBColor(0,128,128); return true;
1153 + case XML_THISTLE: rColor = ARGBColor(216,191,216); return true;
1154 + case XML_TOMATO: rColor = ARGBColor(255,99,71); return true;
1155 + case XML_TURQUOISE: rColor = ARGBColor(64,224,208); return true;
1156 + case XML_VIOLET: rColor = ARGBColor(238,130,238); return true;
1157 + case XML_WHEAT: rColor = ARGBColor(245,222,179); return true;
1158 + case XML_WHITE: rColor = ARGBColor(255,255,255); return true;
1159 + case XML_WHITESMOKE: rColor = ARGBColor(245,245,245); return true;
1160 + case XML_YELLOW: rColor = ARGBColor(255,255,0); return true;
1161 + case XML_YELLOWGREEN: rColor = ARGBColor(154,205,50); return true;
1162 +
1163 + default:
1164 + return false; // no color at all, I'd guess.
1165 + }
1166 +}
1167 +
1168 +bool parseOpacity (const char* sOpacity, ARGBColor& rColor )
1169 +{
1170 + using namespace ::boost::spirit;
1171 +
1172 + if( parse(sOpacity,
1173 + // Begin grammar
1174 + (
1175 + real_p[assign_a(rColor.a)]
1176 + ) >> end_p,
1177 + // End grammar
1178 + space_p).full )
1179 + {
1180 + return true;
1181 + }
1182 + return false;
1183 +}
1184 +
1185 +//////////////////////////////////////////////////////////////
1186 +
1187 +bool parseTransform( const char* sTransform, basegfx::B2DHomMatrix& rTransform )
1188 +{
1189 + using namespace ::boost::spirit;
1190 +
1191 + double fRefOffsetX(0.0);
1192 + double fRefOffsetY(0.0);
1193 + bool bRefTransform(false);
1194 +
1195 + double fRotationAngle=0.0;
1196 + double fSkewAngle=0.0;
1197 + geometry::AffineMatrix2D aIdentityTransform;
1198 + geometry::AffineMatrix2D aCurrTransform;
1199 + std::vector<geometry::AffineMatrix2D> aTransforms;
1200 + aIdentityTransform.m00 = 1.0; aIdentityTransform.m11 = 1.0;
1201 + aCurrTransform = aIdentityTransform;
1202 +
1203 + const bool bRes = parse(sTransform,
1204 + // Begin grammar
1205 + (
1206 + // identity transform
1207 + str_p("none")
1208 + |
1209 + // the ref() form
1210 + (str_p("ref")
1211 + >> '('
1212 + >> str_p("svg")[assign_a(bRefTransform,true)]
1213 + >> !(real_p[assign_a(fRefOffsetX)] >> (',' | eps_p) >>
1214 + real_p[assign_a(fRefOffsetY)])
1215 + >> ')')
1216 + |
1217 + // the transform-list form
1218 + (list_p(
1219 + (
1220 + // matrix(a,b,c,d,e,f)
1221 + (str_p("matrix")
1222 + >> '('
1223 + >> real_p[assign_a(aCurrTransform.m00)] >> (',' | eps_p)
1224 + >> real_p[assign_a(aCurrTransform.m10)] >> (',' | eps_p)
1225 + >> real_p[assign_a(aCurrTransform.m01)] >> (',' | eps_p)
1226 + >> real_p[assign_a(aCurrTransform.m11)] >> (',' | eps_p)
1227 + >> real_p[assign_a(aCurrTransform.m02)] >> (',' | eps_p)
1228 + >> real_p[assign_a(aCurrTransform.m12)]
1229 + >> ')')[push_back_a(aTransforms,aCurrTransform)]
1230 + |
1231 + // translate(x,[y])
1232 + (str_p("translate")
1233 + >> '('
1234 + >> real_p[boost::bind(&assign_twice,
1235 + boost::ref(aCurrTransform.m02),
1236 + boost::ref(aCurrTransform.m12),_1)]
1237 + >> !((',' | eps_p) >> real_p[assign_a(aCurrTransform.m12)])
1238 + >> ')')[push_back_a(aTransforms,aCurrTransform)]
1239 + |
1240 + // scale(x,[y])
1241 + (str_p("scale")
1242 + >> '('
1243 + >> real_p[boost::bind(&assign_twice,
1244 + boost::ref(aCurrTransform.m00),
1245 + boost::ref(aCurrTransform.m11),_1)]
1246 + >> !((',' | eps_p) >> real_p[assign_a(aCurrTransform.m11)])
1247 + >> ')')[push_back_a(aTransforms,aCurrTransform)]
1248 + |
1249 + // rotate(phi,[cx, cy])
1250 + (str_p("rotate")
1251 + >> '('
1252 + >> real_p[assign_a(fRotationAngle)]
1253 + >> !((',' | eps_p) >> real_p[assign_a(aCurrTransform.m02)]
1254 + >> real_p[assign_a(aCurrTransform.m12)])
1255 + >> ')')[boost::bind(&calcRotation,
1256 + boost::ref(aTransforms),
1257 + boost::ref(aCurrTransform),
1258 + boost::cref(fRotationAngle))]
1259 + |
1260 + // skewX(phi)
1261 + (str_p("skewX")
1262 + >> '('
1263 + >> real_p[assign_a(fSkewAngle)]
1264 + >> ')')[boost::bind(&calcSkewX,
1265 + boost::ref(aTransforms),
1266 + boost::cref(fSkewAngle))]
1267 + |
1268 + // skewY(phi)
1269 + (str_p("skewY")
1270 + >> '('
1271 + >> real_p[assign_a(fSkewAngle)]
1272 + >> ')')[boost::bind(&calcSkewY,
1273 + boost::ref(aTransforms),
1274 + boost::cref(fSkewAngle))]
1275 + // reset current transform after every push
1276 + )[assign_a(aCurrTransform,aIdentityTransform)],
1277 + // list delimiter is either ',' or space
1278 + ',' | eps_p ))
1279 + ) >> end_p,
1280 + // End grammar
1281 + space_p).full;
1282 +
1283 + if( !bRes )
1284 + return false;
1285 +
1286 + // fold all transformations into one
1287 + const geometry::AffineMatrix2D aTotalTransform(
1288 + std::accumulate(aTransforms.begin(),
1289 + aTransforms.end(),
1290 + aIdentityTransform,
1291 + &multiplyMatrix));
1292 +
1293 + basegfx::unotools::homMatrixFromAffineMatrix(
1294 + rTransform,
1295 + aTotalTransform);
1296 +
1297 + // TODO(F1): handle the ref case
1298 + return bRes;
1299 +}
1300 +
1301 +//////////////////////////////////////////////////////////////
1302 +
1303 +bool parseViewBox( const char* sViewbox, basegfx::B2DRange& rRect )
1304 +{
1305 + using namespace ::boost::spirit;
1306 +
1307 + double x=0.0,y=0.0,w=0.0,h=0.0;
1308 +
1309 + const bool bRes = parse(sViewbox,
1310 + // Begin grammar
1311 + (
1312 + // either comma- or space-delimited list of four doubles
1313 + real_p[assign_a(x)] >> (',' | eps_p) >>
1314 + real_p[assign_a(y)] >> (',' | eps_p) >>
1315 + real_p[assign_a(w)] >> (',' | eps_p) >>
1316 + real_p[assign_a(h)] >> end_p
1317 + ),
1318 + // End grammar
1319 + space_p).full;
1320 +
1321 + if( !bRes )
1322 + return false;
1323 +
1324 + rRect = basegfx::B2DRange(x,y,x+w,y+h);
1325 +
1326 + return true;
1327 +}
1328 +
1329 +//////////////////////////////////////////////////////////////
1330 +
1331 +bool parseDashArray( const char* sDashArray, std::vector<double>& rOutputVector )
1332 +{
1333 + using namespace ::boost::spirit;
1334 +
1335 + rOutputVector.clear();
1336 + return parse(sDashArray,
1337 + // Begin grammar
1338 + (
1339 + // parse comma-delimited list of doubles (have to use the
1340 + // 'direct' variant, as otherwise spirit refactors our
1341 + // parser to push both real num and comma to push_back_a)
1342 + list_p.direct
1343 + (
1344 + real_p[push_back_a(rOutputVector)],
1345 + // list delimiter is either ',' or space
1346 + ',' | eps_p
1347 + )
1348 + ) >> end_p,
1349 + // End grammar
1350 + space_p).full;
1351 +}
1352 +
1353 +//////////////////////////////////////////////////////////////
1354 +
1355 +bool parsePaintUri( std::pair<const char*,const char*>& o_rPaintUri,
1356 + std::pair<ARGBColor,bool>& io_rColor,
1357 + const char* sPaintUri )
1358 +{
1359 + using namespace ::boost::spirit;
1360 +
1361 + const bool bRes = parse(sPaintUri,
1362 + // Begin grammar
1363 + (
1364 + str_p("url(#") >>
1365 + (+alnum_p)[assign_a(o_rPaintUri)] >>
1366 + str_p(")") >>
1367 + *( str_p("none")[assign_a(io_rColor.second,false)] |
1368 + str_p("currentColor")[assign_a(io_rColor.second,true)] |
1369 + ColorGrammar(io_rColor.first)
1370 + // TODO(F1): named color
1371 + )
1372 + ) >> end_p,
1373 + // End grammar
1374 + space_p).full;
1375 +
1376 + return bRes;
1377 +}
1378 +
1379 +//////////////////////////////////////////////////////////////
1380 +
1381 +namespace
1382 +{
1383 +void appendChar( std::string& str, char character)
1384 +{
1385 + str.append(1,character);
1386 +}
1387 +}
1388 +
1389 +bool parseXlinkHref( const char* sXlinkHref, std::string& data )
1390 +{
1391 + using namespace ::boost::spirit;
1392 +
1393 + data.erase(data.begin(),data.end());
1394 +
1395 + std::string sLink(sXlinkHref);
1396 +
1397 + if (!sLink.compare(0,5,"data:"))
1398 + {
1399 + // the inplace "data" uri
1400 + size_t position = sLink.rfind(',');
1401 + if (position > 0 && position < std::string::npos)
1402 + {
1403 + data = sLink.substr(position+1);
1404 + OSL_TRACE("%s", data.c_str());
1405 + return true;
1406 + }
1407 + }
1408 +
1409 + return false;
1410 +}
1411 +
1412 +} // namespace svgi
1413 diff -ruN OOO310_m6.orig/filter/source/svg/parserfragments.hxx OOO310_m6/filter/source/svg/parserfragments.hxx
1414 --- OOO310_m6.orig/filter/source/svg/parserfragments.hxx 1970-01-01 01:00:00.000000000 +0100
1415 +++ OOO310_m6/filter/source/svg/parserfragments.hxx 2009-03-17 14:59:37.000000000 +0000
1416 @@ -0,0 +1,74 @@
1417 +/*************************************************************************
1418 + *
1419 + * OpenOffice.org - a multi-platform office productivity suite
1420 + *
1421 + * Author:
1422 + * Fridrich Strba <fridrich.strba@bluewin.ch>
1423 + * Thorsten Behrens <tbehrens@novell.com>
1424 + *
1425 + * Copyright (C) 2008, Novell Inc.
1426 + *
1427 + * The Contents of this file are made available subject to
1428 + * the terms of GNU Lesser General Public License Version 2.1.
1429 + *
1430 + ************************************************************************/
1431 +
1432 +#ifndef INCLUDED_PARSERFRAGMENTS_HXX
1433 +#define INCLUDED_PARSERFRAGMENTS_HXX
1434 +
1435 +#include <sal/config.h>
1436 +#include <vector>
1437 +#include <utility>
1438 +#include <string>
1439 +
1440 +namespace basegfx
1441 +{
1442 + class B2DHomMatrix;
1443 + class B2DRange;
1444 +}
1445 +namespace svgi
1446 +{
1447 + struct ARGBColor;
1448 +
1449 + /// Parse given string for one of the SVG color grammars
1450 + bool parseColor( const char* sColor, ARGBColor& rColor );
1451 + bool parseOpacity( const char* sOpacity, ARGBColor& rColor );
1452 +
1453 + /// Parse given string for one of the SVG transformation grammars
1454 + bool parseTransform( const char* sTransform, basegfx::B2DHomMatrix& rTransform );
1455 +
1456 + /// Parse given string for the viewBox attribute
1457 + bool parseViewBox( const char* sViewbox, basegfx::B2DRange& rRect );
1458 +
1459 + /// Parse given string for a list of double values, comma-delimited
1460 + bool parseDashArray( const char* sDashArray, std::vector<double>& rOutputVector );
1461 +
1462 + /** Parse paint uri
1463 +
1464 + @param o_rPaintUri
1465 + Start and end ptr for uri substring (within
1466 + [sPaintUri,sPaintUri+strlen(sPaintUri)]
1467 +
1468 + @param io_rColor
1469 + The optional paint color to use. if o_rPaintUri is empty,
1470 + parser sets io_rColor.second to false for color="None", to
1471 + true and keeps current io_rColor.first entry for
1472 + "currentColor", and to true and sets io_rColor.first to parsed
1473 + color otherwise.
1474 +
1475 + @param sPaintUri
1476 + String to parse. Permitted to contain the optional paint
1477 + stuff, like fallback color.
1478 +
1479 + @return true, if a paint uri was successfully parsed.
1480 + */
1481 + bool parsePaintUri( std::pair<const char*,const char*>& o_rPaintUri,
1482 + std::pair<ARGBColor,bool>& io_rColor,
1483 + const char* sPaintUri );
1484 +
1485 + /// Parse given string for the xlink attribute
1486 + bool parseXlinkHref( const char* xlink, std::string& data );
1487 +
1488 +} // namespace svgi
1489 +
1490 +#endif
1491 diff -ruN OOO310_m6.orig/filter/source/svg/spirit_supplements.hxx OOO310_m6/filter/source/svg/spirit_supplements.hxx
1492 --- OOO310_m6.orig/filter/source/svg/spirit_supplements.hxx 1970-01-01 01:00:00.000000000 +0100
1493 +++ OOO310_m6/filter/source/svg/spirit_supplements.hxx 2009-03-17 14:59:37.000000000 +0000
1494 @@ -0,0 +1,115 @@
1495 +/*************************************************************************
1496 + *
1497 + * OpenOffice.org - a multi-platform office productivity suite
1498 + *
1499 + * Author:
1500 + * Fridrich Strba <fridrich.strba@bluewin.ch>
1501 + * Thorsten Behrens <tbehrens@novell.com>
1502 + *
1503 + * Copyright (C) 2008, Novell Inc.
1504 + *
1505 + * The Contents of this file are made available subject to
1506 + * the terms of GNU Lesser General Public License Version 2.1.
1507 + *
1508 + ************************************************************************/
1509 +
1510 +#ifndef INCLUDED_SPIRIT_SUPPLEMENTS_HXX
1511 +#define INCLUDED_SPIRIT_SUPPLEMENTS_HXX
1512 +
1513 +# ifndef USE_MODERN_SPIRIT
1514 +# include <boost/spirit.hpp>
1515 +
1516 +namespace boost { namespace spirit
1517 +{
1518 + template <>
1519 + class assign_actor< std::pair<const char*,const char*> >
1520 + {
1521 + public:
1522 + explicit assign_actor(std::pair<const char*,const char*>& ref_)
1523 + : ref(ref_) {}
1524 +
1525 + template <typename T2>
1526 + void operator()(T2 const& val) const
1527 + { ref = val; }
1528 +
1529 + template <typename IteratorT>
1530 + void operator()(IteratorT const& f, IteratorT const& l) const
1531 + {
1532 + ref.first = f, ref.second = l;
1533 + }
1534 +
1535 + private:
1536 + std::pair<const char*,const char*>& ref;
1537 + };
1538 +
1539 + template<typename Target, typename Value> struct assigner
1540 + {
1541 + assigner( Target& rTarget, Value aValue ) :
1542 + mrTarget(rTarget), maValue(aValue)
1543 + {}
1544 +
1545 + void assign() const { mrTarget=maValue; }
1546 +
1547 + void operator()() const { assign(); }
1548 + template<typename T1> void operator()(T1) const { assign(); }
1549 + template<typename T1,typename T2> void operator()(T1,T2) const { assign(); }
1550 + template<typename T1,typename T2,typename T3> void operator()(T1,T2,T3) const { assign(); }
1551 +
1552 + Target& mrTarget;
1553 + const Value maValue;
1554 + };
1555 +
1556 + template<typename Target, typename Value> inline assigner<Target,Value>
1557 + assign_a( Target& rTarget, Value aValue )
1558 + {
1559 + return assigner<Target,Value>(rTarget,aValue);
1560 + }
1561 +
1562 + template <typename Target> inline assign_actor<Target>
1563 + assign_a(Target& rTarget)
1564 + {
1565 + return assign_actor<Target>(rTarget);
1566 + }
1567 +
1568 + template<typename Target, typename Value> struct back_pusher
1569 + {
1570 + back_pusher( Target& rTarget, const Value& rValue ) :
1571 + mrTarget(rTarget), mrValue(rValue)
1572 + {}
1573 +
1574 + void push_back() const { mrTarget.push_back(mrValue); }
1575 +
1576 + void operator()() const { push_back(); }
1577 + template<typename T1> void operator()(T1) const { push_back(); }
1578 + template<typename T1,typename T2> void operator()(T1,T2) const { push_back(); }
1579 + template<typename T1,typename T2,typename T3> void operator()(T1,T2,T3) const { push_back(); }
1580 +
1581 + Target& mrTarget;
1582 + const Value& mrValue;
1583 + };
1584 +
1585 + template<typename Target, typename Value> inline back_pusher<Target,Value>
1586 + push_back_a( Target& rTarget, const Value& rValue )
1587 + {
1588 + return back_pusher<Target,Value>(rTarget,rValue);
1589 + }
1590 +
1591 + template<typename Target> struct value_back_pusher
1592 + {
1593 + explicit value_back_pusher( Target& rTarget ) :
1594 + mrTarget(rTarget)
1595 + {}
1596 + template<typename T1> void operator()(T1 val) const { mrTarget.push_back(val); }
1597 +
1598 + Target& mrTarget;
1599 + };
1600 +
1601 + template<typename Target> inline value_back_pusher<Target>
1602 + push_back_a( Target& rTarget )
1603 + {
1604 + return value_back_pusher<Target>(rTarget);
1605 + }
1606 +} }
1607 +
1608 +# endif
1609 +#endif
1610 diff -ruN OOO310_m6.orig/filter/source/svg/svgfilter.cxx OOO310_m6/filter/source/svg/svgfilter.cxx
1611 --- OOO310_m6.orig/filter/source/svg/svgfilter.cxx 2009-03-17 14:58:30.000000000 +0000
1612 +++ OOO310_m6/filter/source/svg/svgfilter.cxx 2009-03-17 14:59:37.000000000 +0000
1613 @@ -33,13 +33,16 @@
1614
1615 #include <cstdio>
1616
1617 -#include "svgfilter.hxx"
1618 +#include <comphelper/servicedecl.hxx>
1619 +#include <uno/environment.h>
1620 #include <com/sun/star/drawing/XDrawPage.hpp>
1621 #include <com/sun/star/drawing/XDrawView.hpp>
1622 #include <com/sun/star/frame/XDesktop.hdl>
1623 #include <com/sun/star/frame/XController.hdl>
1624 #include <vos/mutex.hxx>
1625
1626 +#include "svgfilter.hxx"
1627 +
1628 using ::rtl::OUString;
1629 using namespace ::com::sun::star;
1630
1631 @@ -47,8 +50,9 @@
1632 // - SVGFilter -
1633 // -------------
1634
1635 -SVGFilter::SVGFilter( const Reference< XMultiServiceFactory > &rxMSF ) :
1636 - mxMSF( rxMSF ),
1637 +SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) :
1638 + mxMSF( rxCtx->getServiceManager(),
1639 + uno::UNO_QUERY_THROW ),
1640 mpSVGDoc( NULL ),
1641 mpSVGExport( NULL ),
1642 mpSVGFontExport( NULL ),
1643 @@ -83,11 +87,9 @@
1644 if( pFocusWindow )
1645 pFocusWindow->EnterWait();
1646
1647 -#ifdef SOLAR_JAVA
1648 if( mxDstDoc.is() )
1649 bRet = implImport( rDescriptor );
1650 else
1651 -#endif
1652 if( mxSrcDoc.is() )
1653 {
1654 uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
1655 @@ -156,77 +158,73 @@
1656
1657 // -----------------------------------------------------------------------------
1658
1659 -#ifdef SOLAR_JAVA
1660 void SAL_CALL SVGFilter::setTargetDocument( const Reference< XComponent >& xDoc )
1661 throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
1662 {
1663 mxDstDoc = xDoc;
1664 }
1665 -#endif
1666
1667 // -----------------------------------------------------------------------------
1668
1669 -void SAL_CALL SVGFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& /* aArguments */ )
1670 - throw (Exception, RuntimeException)
1671 +rtl::OUString SAL_CALL SVGFilter::detect( Sequence< PropertyValue >& io_rDescriptor ) throw (RuntimeException)
1672 {
1673 -}
1674 + uno::Reference< io::XInputStream > xInput;
1675 + rtl::OUString aURL;
1676
1677 -// -----------------------------------------------------------------------------
1678 + const beans::PropertyValue* pAttribs = io_rDescriptor.getConstArray();
1679 + const sal_Int32 nAttribs = io_rDescriptor.getLength();
1680 + for( sal_Int32 i = 0; i < nAttribs; i++ )
1681 + {
1682 + if( pAttribs[i].Name.equalsAscii( "InputStream" ) )
1683 + pAttribs[i].Value >>= xInput;
1684 + }
1685
1686 -OUString SVGFilter_getImplementationName ()
1687 - throw (RuntimeException)
1688 -{
1689 - return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.SVGFilter" ) );
1690 -}
1691 + if( !xInput.is() )
1692 + return rtl::OUString();
1693
1694 -// -----------------------------------------------------------------------------
1695 + uno::Reference< io::XSeekable > xSeek( xInput, uno::UNO_QUERY );
1696 + if( xSeek.is() )
1697 + xSeek->seek( 0 );
1698
1699 -#define SERVICE_NAME "com.sun.star.document.SVGFilter"
1700 + // read the first 1024 bytes & check a few magic string
1701 + // constants (heuristically)
1702 + const sal_Int32 nLookAhead = 1024;
1703 + uno::Sequence< sal_Int8 > aBuf( nLookAhead );
1704 + const sal_uInt64 nBytes=xInput->readBytes(aBuf, nLookAhead);
1705 + const sal_Int8* const pBuf=aBuf.getConstArray();
1706
1707 -sal_Bool SAL_CALL SVGFilter_supportsService( const OUString& ServiceName )
1708 - throw (RuntimeException)
1709 -{
1710 - return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
1711 -}
1712 + sal_Int8 aMagic1[] = {'<', 's', 'v', 'g'};
1713 + if( std::search(pBuf, pBuf+nBytes,
1714 + aMagic1, aMagic1+sizeof(aMagic1)/sizeof(*aMagic1)) != pBuf+nBytes )
1715 + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("svg_Scalable_Vector_Graphics") );
1716
1717 -// -----------------------------------------------------------------------------
1718 + sal_Int8 aMagic2[] = {'D', 'O', 'C', 'T', 'Y', 'P', 'E', ' ', 's', 'v', 'g'};
1719 + if( std::search(pBuf, pBuf+nBytes,
1720 + aMagic2, aMagic2+sizeof(aMagic2)/sizeof(*aMagic2)) != pBuf+nBytes )
1721 + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("svg_Scalable_Vector_Graphics") );
1722
1723 -Sequence< OUString > SAL_CALL SVGFilter_getSupportedServiceNames( ) throw (RuntimeException)
1724 -{
1725 - Sequence < OUString > aRet(1);
1726 - OUString* pArray = aRet.getArray();
1727 - pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
1728 - return aRet;
1729 + return rtl::OUString();
1730 }
1731
1732 -#undef SERVICE_NAME
1733 -
1734 // -----------------------------------------------------------------------------
1735
1736 -Reference< XInterface > SAL_CALL SVGFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
1737 +class FilterConfigItem;
1738 +extern "C" SAL_DLLPUBLIC_EXPORT BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
1739 {
1740 - return (cppu::OWeakObject*) new SVGFilter( rSMgr );
1741 + return importSvg( rStream, rGraphic );
1742 }
1743
1744 // -----------------------------------------------------------------------------
1745
1746 -OUString SAL_CALL SVGFilter::getImplementationName( )
1747 - throw (RuntimeException)
1748 -{
1749 - return SVGFilter_getImplementationName();
1750 -}
1751 +namespace sdecl = comphelper::service_decl;
1752 + sdecl::class_<SVGFilter> serviceImpl;
1753 + const sdecl::ServiceDecl svgFilter(
1754 + serviceImpl,
1755 + "com.sun.star.comp.Draw.SVGFilter",
1756 + "com.sun.star.document.ImportFilter;"
1757 + "com.sun.star.document.ExportFilter;"
1758 + "com.sun.star.document.ExtendedTypeDetection" );
1759
1760 -// -----------------------------------------------------------------------------
1761 +// The C shared lib entry points
1762 +COMPHELPER_SERVICEDECL_EXPORTS1(svgFilter)
1763
1764 -sal_Bool SAL_CALL SVGFilter::supportsService( const OUString& rServiceName )
1765 - throw (RuntimeException)
1766 -{
1767 - return SVGFilter_supportsService( rServiceName );
1768 -}
1769 -
1770 -// -----------------------------------------------------------------------------
1771 -
1772 -::com::sun::star::uno::Sequence< OUString > SAL_CALL SVGFilter::getSupportedServiceNames( ) throw (RuntimeException)
1773 -{
1774 - return SVGFilter_getSupportedServiceNames();
1775 -}
1776 diff -ruN OOO310_m6.orig/filter/source/svg/svgfilter.hxx OOO310_m6/filter/source/svg/svgfilter.hxx
1777 --- OOO310_m6.orig/filter/source/svg/svgfilter.hxx 2009-03-17 14:58:30.000000000 +0000
1778 +++ OOO310_m6/filter/source/svg/svgfilter.hxx 2009-03-17 14:59:37.000000000 +0000
1779 @@ -38,20 +38,14 @@
1780 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
1781 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
1782 #include <com/sun/star/document/XFilter.hpp>
1783 -#ifdef SOLAR_JAVA
1784 #include <com/sun/star/document/XImporter.hpp>
1785 -#endif // SOLAR_JAVA
1786 #include <com/sun/star/document/XExporter.hpp>
1787 +#include <com/sun/star/document/XExtendedFilterDetection.hpp>
1788 #include <com/sun/star/lang/XInitialization.hpp>
1789 #include <com/sun/star/lang/XServiceInfo.hpp>
1790 #include <com/sun/star/beans/XPropertySet.hpp>
1791 #include <com/sun/star/lang/XComponent.hpp>
1792 -#include <cppuhelper/implbase1.hxx>
1793 -#ifdef SOLAR_JAVA
1794 -#include <cppuhelper/implbase5.hxx>
1795 -#else // !SOLAR_JAVA
1796 #include <cppuhelper/implbase4.hxx>
1797 -#endif
1798 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
1799 #include <com/sun/star/io/XActiveDataSource.hpp>
1800 #include <com/sun/star/presentation/AnimationEffect.hpp>
1801 @@ -178,18 +172,10 @@
1802 class SVGActionWriter;
1803 class EditFieldInfo;
1804
1805 -#ifdef SOLAR_JAVA
1806 -class SVGFilter : public cppu::WeakImplHelper5 < XFilter,
1807 - XImporter,
1808 - XExporter,
1809 - XInitialization,
1810 - XServiceInfo >
1811 -#else // !SOLAR_JAVA
1812 class SVGFilter : public cppu::WeakImplHelper4 < XFilter,
1813 + XImporter,
1814 XExporter,
1815 - XInitialization,
1816 - XServiceInfo >
1817 -#endif
1818 + XExtendedFilterDetection >
1819 {
1820 typedef ::std::hash_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
1821
1822 @@ -206,15 +192,11 @@
1823
1824 ObjectMap* mpObjects;
1825 Reference< XComponent > mxSrcDoc;
1826 -#ifdef SOLAR_JAVA
1827 Reference< XComponent > mxDstDoc;
1828 -#endif
1829 Reference< XDrawPage > mxDefaultPage;
1830 Link maOldFieldHdl;
1831
1832 -#ifdef SOLAR_JAVA
1833 sal_Bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
1834 -#endif
1835
1836 sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
1837 Reference< XDocumentHandler > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
1838 @@ -253,26 +235,19 @@
1839 virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException);
1840 virtual void SAL_CALL cancel( ) throw (RuntimeException);
1841
1842 -#ifdef SOLAR_JAVA
1843 // XImporter
1844 virtual void SAL_CALL setTargetDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
1845 -#endif
1846
1847 // XExporter
1848 virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
1849
1850 - // XInitialization
1851 - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
1852 -
1853 - // XServiceInfo
1854 - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException);
1855 - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(RuntimeException);
1856 - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
1857 + // XExtendedFilterDetection
1858 + virtual rtl::OUString SAL_CALL detect( Sequence< PropertyValue >& io_rDescriptor ) throw (RuntimeException);
1859
1860 public:
1861
1862 - SVGFilter( const Reference< XMultiServiceFactory > &rxMSF );
1863 - virtual ~SVGFilter();
1864 + explicit SVGFilter( const Reference< XComponentContext >& rxCtx );
1865 + virtual ~SVGFilter();
1866 };
1867
1868 // -----------------------------------------------------------------------------
1869 @@ -296,4 +271,11 @@
1870 SAL_CALL SVGFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
1871 throw ( ::com::sun::star::uno::Exception );
1872
1873 +// -----------------------------------------------------------------------------
1874 +
1875 +class SvStream;
1876 +class Graphic;
1877 +
1878 +bool importSvg(SvStream & rStream, Graphic & rGraphic );
1879 +
1880 #endif // SVGFILTER_HXX
1881 diff -ruN OOO310_m6.orig/filter/source/svg/svgimport.cxx OOO310_m6/filter/source/svg/svgimport.cxx
1882 --- OOO310_m6.orig/filter/source/svg/svgimport.cxx 2009-03-17 14:58:30.000000000 +0000
1883 +++ OOO310_m6/filter/source/svg/svgimport.cxx 2009-03-17 14:59:37.000000000 +0000
1884 @@ -32,160 +32,59 @@
1885 #include "precompiled_filter.hxx"
1886
1887 #include "svgfilter.hxx"
1888 +#include "svgreader.hxx"
1889 +
1890 #include "rtl/ref.hxx"
1891 -#include "jvmaccess/virtualmachine.hxx"
1892 -// -------------
1893 -// - SVGFilter -
1894 -// -------------
1895 +
1896 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
1897 +
1898 +#include <com/sun/star/lang/XComponent.hpp>
1899 +
1900 +#include <com/sun/star/uno/Any.hxx>
1901 +#include <com/sun/star/uno/Type.hxx>
1902 +
1903 +#include <com/sun/star/beans/PropertyValue.hpp>
1904 +
1905 +#include <com/sun/star/xml/sax/XParser.hpp>
1906 +#include <com/sun/star/xml/sax/InputSource.hpp>
1907 +#include <com/sun/star/xml/XImportFilter.hpp>
1908 +
1909 +#include <com/sun/star/io/XActiveDataSource.hpp>
1910 +#include <com/sun/star/task/XStatusIndicator.hpp>
1911 +
1912 +using namespace ::com::sun::star;
1913 +using namespace ::svgi;
1914
1915 sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
1916 throw (RuntimeException)
1917 {
1918 - Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
1919 - rtl::OUString aTmpFileName;
1920 - String aFileName;
1921 - sal_Int32 nLength = rDescriptor.getLength();
1922 - const PropertyValue* pValue = rDescriptor.getConstArray();
1923 - sal_Bool bRet = sal_False;
1924 -
1925 - for( sal_Int32 i = 0 ; ( i < nLength ) && !aTmpFileName.getLength(); i++)
1926 - if( pValue[ i ].Name.equalsAscii( "FileName" ) )
1927 - pValue[ i ].Value >>= aTmpFileName;
1928 -
1929 - if( aTmpFileName.getLength() && xServiceFactory.is() )
1930 - {
1931 -
1932 - Reference< XJavaVM > xJavaVM( xServiceFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), UNO_QUERY );
1933 - Sequence< sal_Int8 > aProcessID( 17 );
1934 - String aLocalFile;
1935 -
1936 - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpFileName, aLocalFile ) && aLocalFile.Len() )
1937 + rtl::OUString aURL;
1938 + uno::Reference< io::XInputStream > xInputStream;
1939 + uno::Reference< task::XStatusIndicator > xStatus;
1940 + const sal_Int32 nLength = rDescriptor.getLength();
1941 + const beans::PropertyValue* pAttribs = rDescriptor.getConstArray();
1942 + for ( sal_Int32 i=0 ; i<nLength; ++i, ++pAttribs )
1943 + {
1944 + if( pAttribs->Name.equalsAscii( "InputStream" ) )
1945 {
1946 - rtl_getGlobalProcessId( (sal_uInt8 *) aProcessID.getArray() );
1947 - aProcessID[16] = 0;
1948 -
1949 - OSL_ENSURE(sizeof (sal_Int64)
1950 - >= sizeof (jvmaccess::VirtualMachine *),
1951 - "Pointer cannot be represented as sal_Int64");
1952 - sal_Int64 nPointer = reinterpret_cast< sal_Int64 >(
1953 - static_cast< jvmaccess::VirtualMachine * >(0));
1954 - xJavaVM->getJavaVM(aProcessID) >>= nPointer;
1955 - rtl::Reference<jvmaccess::VirtualMachine> _virtualMachine =
1956 - reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer);
1957 - if (!_virtualMachine.is())
1958 - return bRet;
1959 -
1960 - jobjectArray aArgs;
1961 - jclass aClass;
1962 - jmethodID aMId;
1963 - jstring aJStr;
1964 -
1965 - try
1966 - {
1967 - jvmaccess::VirtualMachine::AttachGuard vmGuard(_virtualMachine);