ooo-build r13214 - in branches/ooo-build-2-4-1: . patches/src680
- From: thorstenb svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13214 - in branches/ooo-build-2-4-1: . patches/src680
- Date: Tue, 15 Jul 2008 07:40:29 +0000 (UTC)
Author: thorstenb
Date: Tue Jul 15 07:40:29 2008
New Revision: 13214
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13214&view=rev
Log:
* patches/src680/svg-import-filter.diff:
* patches/src680/svg-import-filter-gfxfilter.diff: backport of
fixes from trunk. Improves filter detection and nested
transformations.
Modified:
branches/ooo-build-2-4-1/ChangeLog
branches/ooo-build-2-4-1/patches/src680/svg-import-filter-gfxfilter.diff
branches/ooo-build-2-4-1/patches/src680/svg-import-filter.diff
Modified: branches/ooo-build-2-4-1/patches/src680/svg-import-filter-gfxfilter.diff
==============================================================================
--- branches/ooo-build-2-4-1/patches/src680/svg-import-filter-gfxfilter.diff (original)
+++ branches/ooo-build-2-4-1/patches/src680/svg-import-filter-gfxfilter.diff Tue Jul 15 07:40:29 2008
@@ -1,10 +1,17 @@
-diff -ur filter_orig/source/config/fragments/internalgraphicfilters/svg_Export.xcu filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu
---- filter_orig/source/config/fragments/internalgraphicfilters/svg_Export.xcu 2008-05-28 02:34:02.000000000 +0200
-+++ filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu 2008-05-28 02:30:15.000000000 +0200
-@@ -8,3 +8,13 @@
- </prop>
- <prop oor:name="Flags"><value>EXPORT</value></prop>
- </node>
+ .../internalgraphicfilters/svg_Export.xcu | 10
+ filter/source/svg/exports.map | 1
+ filter/source/svg/makefile.mk | 1
+ filter/source/svg/svgfilter.cxx | 9
+ filter/source/svg/svgfilter.hxx | 7
+ filter/source/svg/svgreader.cxx | 745 ++++++++++++++++++++
+ filter/source/svg/test/makefile.mk | 1
+ 7 files changed, 770 insertions(+), 4 deletions(-)
+
+diff --git a/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu
+index 8b73f15..f0cd69d 100644
+--- /dev/null
++++ filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu
+@@ -0,0 +1,10 @@
+ <node oor:name="svg_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
+ <prop oor:name="FormatName"><value>svgfilter</value></prop>
@@ -15,10 +22,21 @@
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
-diff -ur filter_orig/source/svg/exports.map filter/source/svg/exports.map
---- filter_orig/source/svg/exports.map 2008-05-28 02:34:02.000000000 +0200
-+++ filter/source/svg/exports.map 2008-05-27 23:32:34.000000000 +0200
-@@ -3,6 +3,7 @@
+--- filter/source/config/fragments/fcfg_internalgraphics.mk
++++ filter/source/config/fragments/fcfg_internalgraphics.mk
+@@ -68,6 +68,7 @@
+ sgf_Import \
+ sgv_Import \
+ svg_Export \
++ svg_Import \
+ svm_Export \
+ svm_Import \
+ tga_Import \
+diff --git a/filter/source/svg/exports.map b/filter/source/svg/exports.map
+index acb4748..d56c225 100644
+--- filter/source/svg/exports.map
++++ filter/source/svg/exports.map
+@@ -3,6 +3,7 @@ SVGFILTER_1_0 {
component_getImplementationEnvironment;
component_getFactory;
component_writeInfo;
@@ -26,10 +44,11 @@
local:
*;
-diff -ur filter_orig/source/svg/makefile.mk filter/source/svg/makefile.mk
---- filter_orig/source/svg/makefile.mk 2008-05-28 02:34:02.000000000 +0200
-+++ filter/source/svg/makefile.mk 2008-05-28 02:16:23.000000000 +0200
-@@ -78,6 +78,7 @@
+diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk
+index f5682cc..e24734b 100644
+--- filter/source/svg/makefile.mk
++++ filter/source/svg/makefile.mk
+@@ -74,6 +74,7 @@ SHL1STDLIBS=\
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
$(COMPHELPERLIB) \
@@ -37,25 +56,35 @@
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
-diff -ur filter_orig/source/svg/svgfilter.cxx filter/source/svg/svgfilter.cxx
---- filter_orig/source/svg/svgfilter.cxx 2008-05-28 02:34:02.000000000 +0200
-+++ filter/source/svg/svgfilter.cxx 2008-05-27 23:32:59.000000000 +0200
-@@ -243,3 +243,11 @@
- {
- return SVGFilter_getSupportedServiceNames();
- }
-+
-+// -----------------------------------------------------------------------------
-+
+diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
+index 9efbed7..de1e638 100644
+--- filter/source/svg/svgfilter.cxx
++++ filter/source/svg/svgfilter.cxx
+@@ -208,6 +208,14 @@ rtl::OUString SAL_CALL SVGFilter::detect( Sequence< PropertyValue >& io_rDescrip
+
+ // -----------------------------------------------------------------------------
+
+class FilterConfigItem;
+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
+{
+ return importSvg( rStream, rGraphic );
+}
-diff -ur filter_orig/source/svg/svgfilter.hxx filter/source/svg/svgfilter.hxx
---- filter_orig/source/svg/svgfilter.hxx 2008-05-28 02:34:02.000000000 +0200
-+++ filter/source/svg/svgfilter.hxx 2008-05-27 23:03:42.000000000 +0200
-@@ -328,4 +328,11 @@
++
++// -----------------------------------------------------------------------------
++
+ namespace sdecl = comphelper::service_decl;
+ sdecl::class_<SVGFilter> serviceImpl;
+ const sdecl::ServiceDecl svgFilter(
+@@ -219,3 +227,4 @@ namespace sdecl = comphelper::service_decl;
+
+ // The C shared lib entry points
+ COMPHELPER_SERVICEDECL_EXPORTS1(svgFilter)
++
+diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
+index dcb8065..b057a5e 100644
+--- filter/source/svg/svgfilter.hxx
++++ filter/source/svg/svgfilter.hxx
+@@ -271,4 +271,11 @@ sal_Bool SAL_CALL SVGFilter_supportsService( const ::rtl::OUString& ServiceName
SAL_CALL SVGFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
throw ( ::com::sun::star::uno::Exception );
@@ -67,9 +96,10 @@
+bool importSvg(SvStream & rStream, Graphic & rGraphic );
+
#endif // SVGFILTER_HXX
-diff -ur filter_orig/source/svg/svgreader.cxx filter/source/svg/svgreader.cxx
---- filter_orig/source/svg/svgreader.cxx 2008-05-28 02:34:02.000000000 +0200
-+++ filter/source/svg/svgreader.cxx 2008-05-28 22:12:21.000000000 +0200
+diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
+index 2525999..cda0efd 100644
+--- filter/source/svg/svgreader.cxx
++++ filter/source/svg/svgreader.cxx
@@ -7,6 +7,7 @@
* Thorsten Behrens <tbehrens novell com>
*
@@ -96,7 +126,7 @@
#include <boost/bind.hpp>
#include <hash_set>
#include <map>
-@@ -432,6 +444,9 @@
+@@ -424,6 +436,9 @@ struct AnnotatingVisitor
// start&end color)
optimizeGradientStops(rState.maFillGradient);
@@ -106,7 +136,7 @@
// do we have a gradient fill? then write out gradient as well
if( rState.meFillType == GRADIENT && rState.maFillGradient.maStops.size() > 1 )
{
-@@ -1541,10 +1556,13 @@
+@@ -1505,10 +1520,13 @@ struct ShapeWritingVisitor
for( sal_uInt32 i=0; i<rPoly.count(); ++i )
{
aPolys.push_back(
@@ -124,7 +154,7 @@
// TODO(F2): line ends
}
-@@ -1896,4 +1914,745 @@
+@@ -1873,4 +1891,723 @@ sal_Bool SVGReader::parseAndConvert()
return sal_True;
}
@@ -132,12 +162,11 @@
+
+struct ShapeRenderingVisitor
+{
-+ ShapeRenderingVisitor(StatePool& rStatePool,
++ ShapeRenderingVisitor(StatePool& /*rStatePool*/,
+ StateMap& rStateMap,
+ OutputDevice& rOutDev,
+ const std::vector< Gradient >& rGradientVector,
+ const std::vector< GradientStop >& rGradientStopVector) :
-+ mrStates(rStatePool),
+ mrStateMap(rStateMap),
+ mrOutDev(rOutDev),
+ mrGradientVector(rGradientVector),
@@ -158,16 +187,12 @@
+ 0,'$',nDummyIndex));
+ StateMap::iterator pOrigState=mrStateMap.find(
+ sStyleId.toInt32());
-+ maCurrState = pOrigState != mrStateMap.end() ? pOrigState->second : maParentStates.back();
+
-+ OSL_TRACE("the CTM is now #2: %f %f %f %f %f %f",
-+ maCurrState.maCTM.get(0,0),
-+ maCurrState.maCTM.get(0,1),
-+ maCurrState.maCTM.get(0,2),
-+ maCurrState.maCTM.get(1,0),
-+ maCurrState.maCTM.get(1,1),
-+ maCurrState.maCTM.get(1,2));
-+
++ if( pOrigState == mrStateMap.end() )
++ return; // non-exportable element, e.g. linearGradient
++
++ maCurrState = pOrigState->second;
++
+ const sal_Int32 nTokenId(getTokenId(xElem->getNodeName()));
+ switch(nTokenId)
+ {
@@ -185,16 +210,16 @@
+ switch(nAttribId)
+ {
+ case XML_X1:
-+ x1= convLength(sAttributeValue);
++ x1= convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_X2:
-+ x2 = convLength(sAttributeValue);
++ x2 = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y1:
-+ y1 = convLength(sAttributeValue);
++ y1 = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_Y2:
-+ y2 = convLength(sAttributeValue);
++ y2 = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ default:
+ // skip
@@ -218,11 +243,6 @@
+ // if( nTokenId == XML_POLYGON )
+ aPoly.setClosed(true);
+
-+ // assuming the coordinates are in pts since they are interpreted as such by different renderers
-+ basegfx::B2DHomMatrix aScale;
-+ aScale.scale(2540.0f/72.0f,2540.0f/72.0f);
-+ aPoly.transform(aScale);
-+
+ renderPathShape(basegfx::B2DPolyPolygon(aPoly));
+ break;
+ }
@@ -241,23 +261,23 @@
+ switch(nAttribId)
+ {
+ case XML_X:
-+ x = convLength(sAttributeValue);
++ x = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y:
-+ y = convLength(sAttributeValue);
++ y = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_WIDTH:
-+ width = convLength(sAttributeValue);
++ width = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_HEIGHT:
-+ height = convLength(sAttributeValue);
++ height = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_RX:
-+ rx = convLength(sAttributeValue);
++ rx = convLength(sAttributeValue,maCurrState,'h');
+ bRxSeen=true;
+ break;
+ case XML_RY:
-+ ry = convLength(sAttributeValue);
++ ry = convLength(sAttributeValue,maCurrState,'v');
+ bRySeen=true;
+ break;
+ default:
@@ -285,11 +305,6 @@
+ basegfx::B2DPolyPolygon aPoly;
+ basegfx::tools::importFromSvgD(aPoly, sPath);
+
-+ // assuming the coordinates are in pts since they are interpreted as such by different renderers
-+ basegfx::B2DHomMatrix aScale;
-+ aScale.scale(2540.0f/72.0f,2540.0f/72.0f);
-+ aPoly.transform(aScale);
-+
+ renderPathShape(aPoly);
+ break;
+ }
@@ -307,13 +322,13 @@
+ switch(nAttribId)
+ {
+ case XML_CX:
-+ cx = convLength(sAttributeValue);
++ cx = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_CY:
-+ cy = convLength(sAttributeValue);
++ cy = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_R:
-+ r = convLength(sAttributeValue);
++ r = convLength(sAttributeValue,maCurrState,'o');
+ default:
+ // skip
+ break;
@@ -343,16 +358,16 @@
+ switch(nAttribId)
+ {
+ case XML_CX:
-+ cx = convLength(sAttributeValue);
++ cx = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_CY:
-+ cy = convLength(sAttributeValue);
++ cy = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_RX:
-+ rx = convLength(sAttributeValue);
++ rx = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_RY:
-+ ry = convLength(sAttributeValue);
++ ry = convLength(sAttributeValue,maCurrState,'v');
+ default:
+ // skip
+ break;
@@ -382,16 +397,16 @@
+ switch(nAttribId)
+ {
+ case XML_X:
-+ x = convLength(sAttributeValue);
++ x = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y:
-+ y = convLength(sAttributeValue);
++ y = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_WIDTH:
-+ width = convLength(sAttributeValue);
++ width = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_HEIGHT:
-+ height = convLength(sAttributeValue);
++ height = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ default:
+ // skip
@@ -470,10 +485,10 @@
+ // -> blatant copy from svx/source/xml/xmlgrhlp.cxx
+
+ const Rectangle aBounds(
-+ Point(basegfx::fround(x),
-+ basegfx::fround(y)),
-+ Size(basegfx::fround(width),
-+ basegfx::fround(height)));
++ Point(basegfx::fround(pt100thmm(x)),
++ basegfx::fround(pt100thmm(y))),
++ Size(basegfx::fround(pt100thmm(width)),
++ basegfx::fround(pt100thmm(height))));
+ aGraphic.Draw(&mrOutDev,
+ aBounds.TopLeft(),
+ aBounds.GetSize());
@@ -505,16 +520,16 @@
+ switch(nAttribId)
+ {
+ case XML_X:
-+ x = convLength(sAttributeValue);
++ x = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y:
-+ y = convLength(sAttributeValue);
++ y = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_WIDTH:
-+ width = convLength(sAttributeValue);
++ width = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_HEIGHT:
-+ height = convLength(sAttributeValue);
++ height = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ default:
+ // skip
@@ -525,7 +540,7 @@
+ // actually export text
+ Font aFont(maCurrState.maFontFamily,
+ Size(0,
-+ basegfx::fround(maCurrState.mnFontSize)));
++ basegfx::fround(pt100thmm(maCurrState.mnFontSize))));
+
+ // extract basic transformations out of CTM
+ basegfx::B2DTuple aScale, aTranslate;
@@ -547,8 +562,8 @@
+
+ // TODO(F2): update bounds
+ mrOutDev.SetFont(aFont);
-+ mrOutDev.DrawText(Point(basegfx::fround(x),
-+ basegfx::fround(y)),
++ mrOutDev.DrawText(Point(basegfx::fround(pt100thmm(x)),
++ basegfx::fround(pt100thmm(y))),
+ sText.makeStringAndClear());
+ break;
+ }
@@ -557,12 +572,10 @@
+
+ void push()
+ {
-+ maParentStates.push_back(maCurrState);
+ }
+
+ void pop()
+ {
-+ maParentStates.pop_back();
+ }
+
+ bool hasGradientOpacity( const Gradient& rGradient )
@@ -596,17 +609,12 @@
+ // shapes (e.g. when emulating line stroking)
+ State aState = maCurrState;
+
++ // bring polygon from pt coordinate system to 100th millimeter
++ aState.maCTM.scale(2540.0/72.0,2540.0/72.0);
++
+ basegfx::B2DPolyPolygon aPoly(rPoly);
+ aPoly.transform(aState.maCTM);
+
-+ OSL_TRACE("the CTM is now #2: %f %f %f %f %f %f",
-+ maCurrState.maCTM.get(0,0),
-+ maCurrState.maCTM.get(0,1),
-+ maCurrState.maCTM.get(0,2),
-+ maCurrState.maCTM.get(1,0),
-+ maCurrState.maCTM.get(1,1),
-+ maCurrState.maCTM.get(1,2));
-+
+ const basegfx::B2DRange aBounds=basegfx::tools::getRange(aPoly);
+ maBounds.Union(
+ Rectangle(
@@ -742,7 +750,7 @@
+ ::PolyPolygon(
+ basegfx::tools::createAreaGeometryForPolygon(
+ aPoly.getB2DPolygon(i),
-+ aState.mnStrokeWidth/2.0,
++ pt100thmm(aState.mnStrokeWidth/2.0),
+ aState.meLineJoin)).getB2DPolyPolygon()),
+ true));
+ // TODO(F2): line ends
@@ -786,8 +794,6 @@
+ }
+
+ State maCurrState;
-+ std::vector<State> maParentStates;
-+ StatePool& mrStates;
+ StateMap& mrStateMap;
+ OutputDevice& mrOutDev;
+ const std::vector< Gradient >& mrGradientVector;
@@ -824,10 +830,12 @@
+ aMtf.Record( &aVDev );
+
+ // parse styles and fill state stack
++ svgi::State aInitialState;
+ svgi::StatePool aStatePool;
+ svgi::StateMap aStateMap;
+ svgi::AnnotatingVisitor aVisitor(aStatePool,
+ aStateMap,
++ aInitialState,
+ uno::Reference<xml::sax::XDocumentHandler>());
+ svgi::visitElements(aVisitor, xDocElem);
+
@@ -859,10 +867,10 @@
+ Size(
+ std::max(
+ sal_Int32(aRenderer.maBounds.Right()),
-+ basegfx::fround(svgi::convLength(xDocElem->getAttribute(USTR("width"))))),
++ basegfx::fround( svgi::pt100thmm(svgi::convLength(xDocElem->getAttribute(USTR("width")),aInitialState,'h')) )),
+ std::max(
+ sal_Int32(aRenderer.maBounds.Bottom()),
-+ basegfx::fround(svgi::convLength(xDocElem->getAttribute(USTR("height"))))) ));
++ basegfx::fround( svgi::pt100thmm(svgi::convLength(xDocElem->getAttribute(USTR("height")),aInitialState,'v')) ))));
+
+ rGraphic = aMtf;
+
@@ -870,10 +878,11 @@
+}
+
+
-diff -ur filter_orig/source/svg/test/makefile.mk filter/source/svg/test/makefile.mk
---- filter_orig/source/svg/test/makefile.mk 2008-05-28 02:34:02.000000000 +0200
-+++ filter/source/svg/test/makefile.mk 2008-05-28 02:18:07.000000000 +0200
-@@ -40,6 +40,7 @@
+diff --git a/filter/source/svg/test/makefile.mk b/filter/source/svg/test/makefile.mk
+index 3f14c88..1d743c6 100644
+--- filter/source/svg/test/makefile.mk
++++ filter/source/svg/test/makefile.mk
+@@ -41,6 +41,7 @@ SHL1STDLIBS= \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
$(COMPHELPERLIB) \
Modified: branches/ooo-build-2-4-1/patches/src680/svg-import-filter.diff
==============================================================================
--- branches/ooo-build-2-4-1/patches/src680/svg-import-filter.diff (original)
+++ branches/ooo-build-2-4-1/patches/src680/svg-import-filter.diff Tue Jul 15 07:40:29 2008
@@ -1,6 +1,38 @@
---- filter/source/config/fragments/fcfg_drawgraphics.mk 2008-04-11 08:49:31.000000000 +0200
-+++ filter/source/config/fragments/fcfg_drawgraphics.mk 2008-04-11 00:09:55.000000000 +0200
-@@ -54,6 +54,7 @@
+ .../source/config/fragments/fcfg_drawgraphics.mk | 1
+ .../filters/SVG___Scalable_Vector_Graphics.xcu | 13
+ .../types/svg_Scalable_Vector_Graphics.xcu | 6
+ filter/source/svg/b2dellipse.cxx | 139 +
+ filter/source/svg/b2dellipse.hxx | 77 +
+ filter/source/svg/exports.map | 4
+ filter/source/svg/gentoken.pl | 58 +
+ filter/source/svg/gfxtypes.hxx | 356 ++++
+ filter/source/svg/makefile.mk | 50 -
+ filter/source/svg/parserfragments.cxx | 553 ++++++
+ filter/source/svg/parserfragments.hxx | 50 +
+ filter/source/svg/spirit_supplements.hxx | 94 +
+ filter/source/svg/svgfilter.cxx | 121 +
+ filter/source/svg/svgfilter.hxx | 39
+ filter/source/svg/svgimport.cxx | 191 --
+ filter/source/svg/svgreader.cxx | 1876 ++++++++++++++++++++
+ filter/source/svg/svgreader.hxx | 43
+ filter/source/svg/svguno.cxx | 105 -
+ filter/source/svg/test/makefile.mk | 114 +
+ filter/source/svg/test/odfserializer.cxx | 140 +
+ filter/source/svg/test/odfserializer.hxx | 31
+ filter/source/svg/test/parsertest.cxx | 210 ++
+ filter/source/svg/test/svg2odf.cxx | 124 +
+ filter/source/svg/tokenmap.cxx | 62 +
+ filter/source/svg/tokenmap.hxx | 32
+ filter/source/svg/tokens.txt | 403 ++++
+ filter/source/svg/units.cxx | 99 +
+ filter/source/svg/units.hxx | 60 +
+ 28 files changed, 4682 insertions(+), 369 deletions(-)
+
+diff --git a/filter/source/config/fragments/fcfg_drawgraphics.mk b/filter/source/config/fragments/fcfg_drawgraphics.mk
+index 7038e27..41a4625 100644
+--- filter/source/config/fragments/fcfg_drawgraphics.mk
++++ filter/source/config/fragments/fcfg_drawgraphics.mk
+@@ -54,6 +54,7 @@ F4_DRAWGRAPHICS = \
SGF___StarOffice_Writer_SGF \
SGV___StarDraw_2_0 \
SVM___StarView_Metafile \
@@ -8,8 +40,11 @@
TGA___Truevision_TARGA \
TIF___Tag_Image_File \
WMF___MS_Windows_Metafile \
---- filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu
+new file mode 100644
+index 0000000..7a1b9a5
+--- /dev/null
++++ filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="SVG - Scalable Vector Graphics" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
@@ -24,12 +59,14 @@
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
---- filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu 2008-04-11 08:49:31.000000000 +0200
-+++ filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu 2008-04-11 00:09:55.000000000 +0200
-@@ -1,12 +1,12 @@
+diff --git a/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
+index 31fc7fc..910ebe9 100644
+--- filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
++++ filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
+@@ -1,10 +1,10 @@
<node oor:name="svg_Scalable_Vector_Graphics" oor:op="replace" >
- <prop oor:name="DetectService"/>
-+ <prop oor:name="DetectService"><value>com.sun.star.comp.filters.XMLFilterDetect</value></prop>
++ <prop oor:name="DetectService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
<prop oor:name="URLPattern"/>
<prop oor:name="Extensions"><value>svg</value></prop>
<prop oor:name="MediaType"><value>image/svg+xml</value></prop>
@@ -40,11 +77,11 @@
<prop oor:name="UIName">
<value>SVG - Scalable Vector Graphics</value>
</prop>
-- <prop oor:name="ClipboardFormat"/>
-+ <prop oor:name="ClipboardFormat"><value>doctype:xmlns="http://www.w3.org/2000/svg"</value></prop>
- </node>
---- filter/source/svg/b2dellipse.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/b2dellipse.cxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/b2dellipse.cxx b/filter/source/svg/b2dellipse.cxx
+new file mode 100644
+index 0000000..a93beb2
+--- /dev/null
++++ filter/source/svg/b2dellipse.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
@@ -185,8 +222,11 @@
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
---- filter/source/svg/b2dellipse.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/b2dellipse.hxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/b2dellipse.hxx b/filter/source/svg/b2dellipse.hxx
+new file mode 100644
+index 0000000..0708fdf
+--- /dev/null
++++ filter/source/svg/b2dellipse.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
@@ -265,23 +305,28 @@
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BASEGFX_B2DELLIPSE_HXX */
---- filter/source/svg/exports.map 2008-04-11 08:49:31.000000000 +0200
-+++ filter/source/svg/exports.map 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/exports.map b/filter/source/svg/exports.map
+index c673092..acb4748 100644
+--- filter/source/svg/exports.map
++++ filter/source/svg/exports.map
@@ -1,4 +1,4 @@
-PDFFILTER_1_0 {
+SVGFILTER_1_0 {
global:
component_getImplementationEnvironment;
component_getFactory;
-@@ -6,4 +6,4 @@
+@@ -6,4 +6,4 @@ PDFFILTER_1_0 {
local:
*;
-};
\ No newline at end of file
+};
---- filter/source/svg/gentoken.pl 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/gentoken.pl 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/gentoken.pl b/filter/source/svg/gentoken.pl
+new file mode 100644
+index 0000000..124457f
+--- /dev/null
++++ filter/source/svg/gentoken.pl
@@ -0,0 +1,58 @@
+# from oox/source/token - should really put this into solenv
+
@@ -341,8 +386,11 @@
+print ( HXX "#endif\n" );
+close ( HXX );
+close ( GPERF );
---- filter/source/svg/gfxtypes.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/gfxtypes.hxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/gfxtypes.hxx b/filter/source/svg/gfxtypes.hxx
+new file mode 100644
+index 0000000..d21f821
+--- /dev/null
++++ filter/source/svg/gfxtypes.hxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
@@ -700,9 +748,11 @@
+} // namespace svgi
+
+#endif
---- filter/source/svg/makefile.mk 2008-04-11 08:49:31.000000000 +0200
-+++ filter/source/svg/makefile.mk 2008-04-11 00:09:55.000000000 +0200
-@@ -34,24 +34,35 @@
+diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk
+index 74e3908..f5682cc 100644
+--- filter/source/svg/makefile.mk
++++ filter/source/svg/makefile.mk
+@@ -30,24 +30,34 @@
#*************************************************************************
PRJ=..$/..
@@ -733,7 +783,6 @@
-SLOFILES+= $(SLO)$/svgimport.obj
+ $(SLO)$/svgimport.obj \
+ $(SLO)$/svgreader.obj \
-+ $(SLO)$/svguno.obj \
+ $(SLO)$/svgwriter.obj \
+ $(SLO)$/tokenmap.obj \
+ $(SLO)$/units.obj
@@ -745,14 +794,15 @@
.ENDIF
# --- Library -----------------------------------
-@@ -59,22 +70,18 @@
- SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX)
+@@ -55,22 +65,19 @@ SLOFILES+= $(SLO)$/svgimport.obj
+ SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS=\
+ $(BASEGFXLIB) \
$(SVXLIB) \
$(XMLOFFLIB) \
- $(GOODIESLIB) \
++ $(SVTOOLLIB) \
+ $(BASEGFXLIB) \
$(VCLLIB) \
$(UNOTOOLSLIB) \
@@ -772,7 +822,7 @@
SHL1DEPN=
SHL1IMPLIB= i$(SHL1TARGET)
-@@ -87,3 +94,16 @@
+@@ -83,3 +90,16 @@ DEF1NAME=$(SHL1TARGET)
# --- Targets ----------------------------------
.INCLUDE : target.mk
@@ -789,8 +839,11 @@
+$(SLO)$/parserfragments.obj : $(INCCOM)$/tokens.cxx $(INCCOM)$/tokens.hxx
+
+$(SLO)$/svgreader.obj : $(INCCOM)$/tokens.cxx $(INCCOM)$/tokens.hxx
---- filter/source/svg/parserfragments.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/parserfragments.cxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/parserfragments.cxx b/filter/source/svg/parserfragments.cxx
+new file mode 100644
+index 0000000..9d78625
+--- /dev/null
++++ filter/source/svg/parserfragments.cxx
@@ -0,0 +1,553 @@
+/*************************************************************************
+ *
@@ -1345,8 +1398,11 @@
+}
+
+} // namespace svgi
---- filter/source/svg/parserfragments.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/parserfragments.hxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/parserfragments.hxx b/filter/source/svg/parserfragments.hxx
+new file mode 100644
+index 0000000..c76b44b
+--- /dev/null
++++ filter/source/svg/parserfragments.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
@@ -1398,8 +1454,11 @@
+} // namespace svgi
+
+#endif
---- filter/source/svg/spirit_supplements.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/spirit_supplements.hxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/spirit_supplements.hxx b/filter/source/svg/spirit_supplements.hxx
+new file mode 100644
+index 0000000..3a40e14
+--- /dev/null
++++ filter/source/svg/spirit_supplements.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
@@ -1495,9 +1554,42 @@
+
+# endif
+#endif
---- filter/source/svg/svgfilter.cxx 2008-04-11 08:49:31.000000000 +0200
-+++ filter/source/svg/svgfilter.cxx 2008-04-11 00:09:55.000000000 +0200
-@@ -96,11 +96,9 @@
+diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
+index 15d5d64..9efbed7 100644
+--- filter/source/svg/svgfilter.cxx
++++ filter/source/svg/svgfilter.cxx
+@@ -38,7 +38,8 @@
+
+ #include <cstdio>
+
+-#include "svgfilter.hxx"
++#include <comphelper/servicedecl.hxx>
++#include <uno/environment.h>
+
+ #ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGE_HPP_
+ #include <com/sun/star/drawing/XDrawPage.hpp>
+@@ -53,6 +54,8 @@
+ #include <vos/mutex.hxx>
+ #endif
+
++#include "svgfilter.hxx"
++
+ using ::rtl::OUString;
+ using namespace ::com::sun::star;
+
+@@ -47,8 +50,9 @@ using namespace ::com::sun::star;
+ // - SVGFilter -
+ // -------------
+
+-SVGFilter::SVGFilter( const Reference< XMultiServiceFactory > &rxMSF ) :
+- mxMSF( rxMSF ),
++SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) :
++ mxMSF( rxCtx->getServiceManager(),
++ uno::UNO_QUERY_THROW ),
+ mpSVGDoc( NULL ),
+ mpSVGExport( NULL ),
+ mpSVGFontExport( NULL ),
+@@ -83,11 +87,9 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
if( pFocusWindow )
pFocusWindow->EnterWait();
@@ -1509,7 +1601,7 @@
if( mxSrcDoc.is() )
{
uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
-@@ -169,13 +167,11 @@
+@@ -156,77 +158,64 @@ void SAL_CALL SVGFilter::setSourceDocument( const Reference< XComponent >& xDoc
// -----------------------------------------------------------------------------
@@ -1523,45 +1615,122 @@
// -----------------------------------------------------------------------------
-@@ -194,25 +190,29 @@
-
- // -----------------------------------------------------------------------------
-
--#define SERVICE_NAME "com.sun.star.document.SVGFilter"
-+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
-+#define SERVICE_NAME2 "com.sun.star.document.ExportFilter"
-
- sal_Bool SAL_CALL SVGFilter_supportsService( const OUString& ServiceName )
- throw (RuntimeException)
+-void SAL_CALL SVGFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& /* aArguments */ )
+- throw (Exception, RuntimeException)
++rtl::OUString SAL_CALL SVGFilter::detect( Sequence< PropertyValue >& io_rDescriptor ) throw (RuntimeException)
{
-- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
-+ return (ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) ||
-+ ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) ) );
++ uno::Reference< io::XInputStream > xInput;
++ rtl::OUString aURL;
++
++ const beans::PropertyValue* pAttribs = io_rDescriptor.getConstArray();
++ const sal_Int32 nAttribs = io_rDescriptor.getLength();
++ for( sal_Int32 i = 0; i < nAttribs; i++ )
++ {
++ if( pAttribs[i].Name.equalsAscii( "InputStream" ) )
++ pAttribs[i].Value >>= xInput;
++ }
++
++ if( !xInput.is() )
++ return rtl::OUString();
++
++ uno::Reference< io::XSeekable > xSeek( xInput, uno::UNO_QUERY );
++ if( xSeek.is() )
++ xSeek->seek( 0 );
++
++ // read the first 1024 bytes & check a few magic string
++ // constants (heuristically)
++ const sal_Int32 nLookAhead = 1024;
++ uno::Sequence< sal_Int8 > aBuf( nLookAhead );
++ const sal_uInt64 nBytes=xInput->readBytes(aBuf, nLookAhead);
++ const sal_Int8* const pBuf=aBuf.getConstArray();
++
++ sal_Int8 aMagic1[] = {'<', 's', 'v', 'g'};
++ if( std::search(pBuf, pBuf+nBytes,
++ aMagic1, aMagic1+sizeof(aMagic1)/sizeof(*aMagic1)) != pBuf+nBytes )
++ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("svg_Scalable_Vector_Graphics") );
++
++ sal_Int8 aMagic2[] = {'D', 'O', 'C', 'T', 'Y', 'P', 'E', ' ', 's', 'v', 'g'};
++ if( std::search(pBuf, pBuf+nBytes,
++ aMagic2, aMagic2+sizeof(aMagic2)/sizeof(*aMagic2)) != pBuf+nBytes )
++ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("svg_Scalable_Vector_Graphics") );
++
++ return rtl::OUString();
}
// -----------------------------------------------------------------------------
- Sequence< OUString > SAL_CALL SVGFilter_getSupportedServiceNames( ) throw (RuntimeException)
- {
+-OUString SVGFilter_getImplementationName ()
+- throw (RuntimeException)
+-{
+- return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.SVGFilter" ) );
+-}
+-
+-// -----------------------------------------------------------------------------
+-
+-#define SERVICE_NAME "com.sun.star.document.SVGFilter"
+-
+-sal_Bool SAL_CALL SVGFilter_supportsService( const OUString& ServiceName )
+- throw (RuntimeException)
+-{
+- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+-}
+-
+-// -----------------------------------------------------------------------------
+-
+-Sequence< OUString > SAL_CALL SVGFilter_getSupportedServiceNames( ) throw (RuntimeException)
+-{
- Sequence < OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
- return aRet;
-+ Sequence < OUString > aRet(2);
-+ OUString* pArray = aRet.getArray();
-+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
-+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
-+ return aRet;
- }
-
+-}
+-
-#undef SERVICE_NAME
-+#undef SERVICE_NAME1
-+#undef SERVICE_NAME2
-
- // -----------------------------------------------------------------------------
-
---- filter/source/svg/svgfilter.hxx 2008-04-11 08:49:31.000000000 +0200
-+++ filter/source/svg/svgfilter.hxx 2008-04-11 00:09:55.000000000 +0200
+-
+-// -----------------------------------------------------------------------------
+-
+-Reference< XInterface > SAL_CALL SVGFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
+-{
+- return (cppu::OWeakObject*) new SVGFilter( rSMgr );
+-}
+-
+-// -----------------------------------------------------------------------------
+-
+-OUString SAL_CALL SVGFilter::getImplementationName( )
+- throw (RuntimeException)
+-{
+- return SVGFilter_getImplementationName();
+-}
+-
+-// -----------------------------------------------------------------------------
+-
+-sal_Bool SAL_CALL SVGFilter::supportsService( const OUString& rServiceName )
+- throw (RuntimeException)
+-{
+- return SVGFilter_supportsService( rServiceName );
+-}
+-
+-// -----------------------------------------------------------------------------
+-
+-::com::sun::star::uno::Sequence< OUString > SAL_CALL SVGFilter::getSupportedServiceNames( ) throw (RuntimeException)
+-{
+- return SVGFilter_getSupportedServiceNames();
+-}
++namespace sdecl = comphelper::service_decl;
++ sdecl::class_<SVGFilter> serviceImpl;
++ const sdecl::ServiceDecl svgFilter(
++ serviceImpl,
++ "com.sun.star.comp.Draw.SVGFilter",
++ "com.sun.star.document.ImportFilter;"
++ "com.sun.star.document.ExportFilter;"
++ "com.sun.star.document.ExtendedTypeDetection" );
++
++// The C shared lib entry points
++COMPHELPER_SERVICEDECL_EXPORTS1(svgFilter)
+diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
+index dc4b64e..dcb8065 100644
+--- filter/source/svg/svgfilter.hxx
++++ filter/source/svg/svgfilter.hxx
@@ -57,11 +57,9 @@
#ifndef _COM_SUN_STAR_DOCUMENT_XFILTER_HPP_
#include <com/sun/star/document/XFilter.hpp>
@@ -1574,42 +1743,45 @@
#ifndef _COM_SUN_STAR_DOCUMENT_XEXPORTER_HPP_
#include <com/sun/star/document/XExporter.hpp>
#endif
-@@ -80,15 +78,9 @@
+@@ -80,15 +78,10 @@
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
-#ifdef SOLAR_JAVA
- #ifndef _CPPUHELPER_IMPLBASE5_HXX_
- #include <cppuhelper/implbase5.hxx>
- #endif
--#else // !SOLAR_JAVA
--#ifndef _CPPUHELPER_IMPLBASE4_HXX_
--#include <cppuhelper/implbase4.hxx>
+-#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+-#include <cppuhelper/implbase5.hxx>
++#include <com/sun/star/document/XExtendedFilterDetection.hpp>
-#endif
+-#else // !SOLAR_JAVA
+ #ifndef _CPPUHELPER_IMPLBASE4_HXX_
+ #include <cppuhelper/implbase4.hxx>
+ #endif
-#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
-@@ -231,18 +223,11 @@
+@@ -178,18 +172,10 @@ class SVGFontExport;
class SVGActionWriter;
class EditFieldInfo;
-#ifdef SOLAR_JAVA
- class SVGFilter : public cppu::WeakImplHelper5 < XFilter,
- XImporter,
- XExporter,
- XInitialization,
- XServiceInfo >
--#else // !SOLAR_JAVA
--class SVGFilter : public cppu::WeakImplHelper4 < XFilter,
+-class SVGFilter : public cppu::WeakImplHelper5 < XFilter,
+- XImporter,
- XExporter,
+- XInitialization,
+- XServiceInfo >
+-#else // !SOLAR_JAVA
+ class SVGFilter : public cppu::WeakImplHelper4 < XFilter,
++ XImporter,
+ XExporter,
- XInitialization,
- XServiceInfo >
-#endif
++ XExtendedFilterDetection >
{
typedef ::std::hash_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
-@@ -259,15 +244,11 @@
+@@ -206,15 +192,11 @@ private:
ObjectMap* mpObjects;
Reference< XComponent > mxSrcDoc;
@@ -1625,7 +1797,7 @@
sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
Reference< XDocumentHandler > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
-@@ -306,10 +287,8 @@
+@@ -253,26 +235,19 @@ protected:
virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException);
virtual void SAL_CALL cancel( ) throw (RuntimeException);
@@ -1636,9 +1808,31 @@
// XExporter
virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
---- filter/source/svg/svgimport.cxx 2008-04-11 08:49:32.000000000 +0200
-+++ filter/source/svg/svgimport.cxx 2008-04-11 00:09:55.000000000 +0200
-@@ -37,160 +37,59 @@
+
+- // XInitialization
+- virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+-
+- // XServiceInfo
+- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException);
+- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(RuntimeException);
+- virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
++ // XExtendedFilterDetection
++ virtual rtl::OUString SAL_CALL detect( Sequence< PropertyValue >& io_rDescriptor ) throw (RuntimeException);
+
+ public:
+
+- SVGFilter( const Reference< XMultiServiceFactory > &rxMSF );
+- virtual ~SVGFilter();
++ explicit SVGFilter( const Reference< XComponentContext >& rxCtx );
++ virtual ~SVGFilter();
+ };
+
+ // -----------------------------------------------------------------------------
+diff --git a/filter/source/svg/svgimport.cxx b/filter/source/svg/svgimport.cxx
+index 32c114c..1d27cf0 100644
+--- filter/source/svg/svgimport.cxx
++++ filter/source/svg/svgimport.cxx
+@@ -32,160 +32,59 @@
#include "precompiled_filter.hxx"
#include "svgfilter.hxx"
@@ -1682,15 +1876,6 @@
- for( sal_Int32 i = 0 ; ( i < nLength ) && !aTmpFileName.getLength(); i++)
- if( pValue[ i ].Name.equalsAscii( "FileName" ) )
- pValue[ i ].Value >>= aTmpFileName;
--
-- if( aTmpFileName.getLength() && xServiceFactory.is() )
-- {
--
-- Reference< XJavaVM > xJavaVM( xServiceFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), UNO_QUERY );
-- Sequence< sal_Int8 > aProcessID( 17 );
-- String aLocalFile;
--
-- if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpFileName, aLocalFile ) && aLocalFile.Len() )
+ rtl::OUString aURL;
+ uno::Reference< io::XInputStream > xInputStream;
+ uno::Reference< task::XStatusIndicator > xStatus;
@@ -1699,7 +1884,27 @@
+ for ( sal_Int32 i=0 ; i<nLength; ++i, ++pAttribs )
+ {
+ if( pAttribs->Name.equalsAscii( "InputStream" ) )
- {
++ {
++ pAttribs->Value >>= xInputStream;
++ }
++ else if( pAttribs->Name.equalsAscii( "StatusIndicator" ) )
++ pAttribs->Value >>= xStatus;
++ }
+
+- if( aTmpFileName.getLength() && xServiceFactory.is() )
+- {
++ OSL_ASSERT(xInputStream.is());
++ if(!xInputStream.is())
++ return sal_False;
+
+- Reference< XJavaVM > xJavaVM( xServiceFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), UNO_QUERY );
+- Sequence< sal_Int8 > aProcessID( 17 );
+- String aLocalFile;
++ rtl::OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
++ Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
+
+- if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpFileName, aLocalFile ) && aLocalFile.Len() )
+- {
- rtl_getGlobalProcessId( (sal_uInt8 *) aProcessID.getArray() );
- aProcessID[16] = 0;
-
@@ -1732,7 +1937,10 @@
- aMId = pEnv->GetStaticMethodID( aClass, "main", "([Ljava/lang/String;)V" );
- if ( aMId )
- {
--
++ // The XImporter sets up an empty target document for XDocumentHandler to write to..
++ uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
++ xImporter->setTargetDocument(mxDstDoc);
+
- ::utl::TempFile aTempFile;
- String aOutputURL( aTempFile.GetURL() );
- String aOutputFile;
@@ -1826,30 +2034,16 @@
- }
- }
- return bRet;
-+ pAttribs->Value >>= xInputStream;
-+ }
-+ else if( pAttribs->Name.equalsAscii( "StatusIndicator" ) )
-+ pAttribs->Value >>= xStatus;
-+ }
-+
-+ OSL_ASSERT(xInputStream.is());
-+ if(!xInputStream.is())
-+ return sal_False;
-+
-+ rtl::OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
-+ Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
-+
-+ // The XImporter sets up an empty target document for XDocumentHandler to write to..
-+ uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
-+ xImporter->setTargetDocument(mxDstDoc);
-+
+ SVGReader aReader(mxMSF, xInputStream, xInternalHandler);
+ return aReader.parseAndConvert();
}
---- filter/source/svg/svgreader.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/svgreader.cxx 2008-04-11 09:33:30.000000000 +0200
-@@ -0,0 +1,1899 @@
+diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
+new file mode 100644
+index 0000000..2525999
+--- /dev/null
++++ filter/source/svg/svgreader.cxx
+@@ -0,0 +1,1876 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -1975,6 +2169,7 @@
+{
+ AnnotatingVisitor(StatePool& rStatePool,
+ StateMap& rStateMap,
++ const State& rInitialState,
+ const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler) :
+ mnCurrStateId(0),
+ maCurrState(),
@@ -1985,9 +2180,7 @@
+ maGradientVector(),
+ maGradientStopVector()
+ {
-+ State aState;
-+ aState.maCTM = aState.maTransform;
-+ maParentStates.push_back(aState);
++ maParentStates.push_back(rInitialState);
+ }
+
+ void operator()( const uno::Reference<xml::dom::XElement>& )
@@ -2096,14 +2289,6 @@
+ maCurrState = maParentStates.back();
+ maCurrState.maTransform.identity();
+
-+ OSL_TRACE("the CTM is currently #1: %f %f %f %f %f %f",
-+ maCurrState.maCTM.get(0,0),
-+ maCurrState.maCTM.get(0,1),
-+ maCurrState.maCTM.get(0,2),
-+ maCurrState.maCTM.get(1,0),
-+ maCurrState.maCTM.get(1,1),
-+ maCurrState.maCTM.get(1,2));
-+
+ // scan for style info
+ const sal_Int32 nNumAttrs( xAttributes->getLength() );
+ rtl::OUString sAttributeValue;
@@ -2120,20 +2305,21 @@
+ }
+
+ // all attributes parsed, can calc total CTM now
++ basegfx::B2DHomMatrix aLocalTransform;
+ if( !maCurrState.maViewBox.isEmpty() &&
+ maCurrState.maViewBox.getWidth() != 0.0 &&
+ maCurrState.maViewBox.getHeight() != 0.0 )
+ {
+ // transform aViewBox into viewport, such that they
+ // coincide
-+ maCurrState.maTransform.translate(-maCurrState.maViewBox.getMinX(),
-+ -maCurrState.maViewBox.getMinY());
-+ maCurrState.maTransform.scale(maCurrState.maViewport.getWidth()/maCurrState.maViewBox.getWidth(),
-+ maCurrState.maViewport.getHeight()/maCurrState.maViewBox.getHeight());
++ aLocalTransform.translate(-maCurrState.maViewBox.getMinX(),
++ -maCurrState.maViewBox.getMinY());
++ aLocalTransform.scale(maCurrState.maViewport.getWidth()/maCurrState.maViewBox.getWidth(),
++ maCurrState.maViewport.getHeight()/maCurrState.maViewBox.getHeight());
+ }
-+ maCurrState.maCTM *= maCurrState.maTransform;
++ maCurrState.maCTM = maCurrState.maCTM*maCurrState.maTransform*aLocalTransform;
+
-+ OSL_TRACE("the CTM is currently #2: %f %f %f %f %f %f",
++ OSL_TRACE("annotateStyle - CTM is: %f %f %f %f %f %f",
+ maCurrState.maCTM.get(0,0),
+ maCurrState.maCTM.get(0,1),
+ maCurrState.maCTM.get(0,2),
@@ -2429,7 +2615,7 @@
+ {
+ ::basegfx::B2DVector aVec(maCurrState.mnStrokeWidth,0);
+ aVec *= maCurrState.maCTM;
-+ xAttrs->AddAttribute( USTR("svg:stroke-width"), rtl::OUString::valueOf( aVec.getLength()/100.0 )+USTR("mm"));
++ xAttrs->AddAttribute( USTR("svg:stroke-width"), rtl::OUString::valueOf( pt2mm(aVec.getLength()) )+USTR("mm"));
+ }
+ if( maCurrState.meLineJoin == basegfx::tools::B2DLINEJOIN_MITER )
+ xAttrs->AddAttribute( USTR( "draw:stroke-linejoin"), USTR("miter"));
@@ -2515,16 +2701,16 @@
+ break;
+ }
+ case XML_X1:
-+ io_rCurrGradient.maCoords.linear.mfX1 = convLength(sValue);
++ io_rCurrGradient.maCoords.linear.mfX1 = convLength(sValue,maCurrState,'h');
+ break;
+ case XML_X2:
-+ io_rCurrGradient.maCoords.linear.mfX2 = convLength(sValue);
++ io_rCurrGradient.maCoords.linear.mfX2 = convLength(sValue,maCurrState,'h');
+ break;
+ case XML_Y1:
-+ io_rCurrGradient.maCoords.linear.mfY1 = convLength(sValue);
++ io_rCurrGradient.maCoords.linear.mfY1 = convLength(sValue,maCurrState,'v');
+ break;
+ case XML_Y2:
-+ io_rCurrGradient.maCoords.linear.mfY2 = convLength(sValue);
++ io_rCurrGradient.maCoords.linear.mfY2 = convLength(sValue,maCurrState,'v');
+ break;
+ case XML_ID:
+ maGradientIdMap.insert(std::make_pair(sValue,nGradientNumber));
@@ -2556,19 +2742,19 @@
+ break;
+ }
+ case XML_CX:
-+ io_rCurrGradient.maCoords.radial.mfCX = convLength(sValue);
++ io_rCurrGradient.maCoords.radial.mfCX = convLength(sValue,maCurrState,'h');
+ break;
+ case XML_CY:
-+ io_rCurrGradient.maCoords.radial.mfCY = convLength(sValue);
++ io_rCurrGradient.maCoords.radial.mfCY = convLength(sValue,maCurrState,'v');
+ break;
+ case XML_FX:
-+ io_rCurrGradient.maCoords.radial.mfFX = convLength(sValue);
++ io_rCurrGradient.maCoords.radial.mfFX = convLength(sValue,maCurrState,'h');
+ break;
+ case XML_FY:
-+ io_rCurrGradient.maCoords.radial.mfFY = convLength(sValue);
++ io_rCurrGradient.maCoords.radial.mfFY = convLength(sValue,maCurrState,'v');
+ break;
+ case XML_R:
-+ io_rCurrGradient.maCoords.radial.mfR = convLength(sValue);
++ io_rCurrGradient.maCoords.radial.mfR = convLength(sValue,maCurrState,'r');
+ break;
+ case XML_ID:
+ maGradientIdMap.insert(std::make_pair(sValue,nGradientNumber));
@@ -2628,7 +2814,7 @@
+ case XML_WIDTH:
+ {
+ const double fViewPortWidth(
-+ convLength(sValue));
++ convLength(sValue,maCurrState,'h'));
+
+ maCurrState.maViewport.expand(
+ basegfx::B2DTuple(fViewPortWidth,0.0));
@@ -2637,7 +2823,7 @@
+ case XML_HEIGHT:
+ {
+ const double fViewPortHeight(
-+ convLength(sValue));
++ convLength(sValue,maCurrState,'v'));
+
+ maCurrState.maViewport.expand(
+ basegfx::B2DTuple(0.0,fViewPortHeight));
@@ -2672,7 +2858,7 @@
+ if( aValueUtf8 == "inherit" )
+ maCurrState.mnStrokeWidth = maParentStates.back().mnStrokeWidth;
+ else
-+ maCurrState.mnStrokeWidth = convLength(sValue);
++ maCurrState.mnStrokeWidth = convLength(sValue,maCurrState,'r');
+ break;
+ }
+ case XML_STROKE_LINECAP:
@@ -2712,7 +2898,7 @@
+ if( aValueUtf8 == "inherit" )
+ maCurrState.mnDashOffset = maParentStates.back().mnDashOffset;
+ else
-+ maCurrState.mnDashOffset = convLength(sValue);
++ maCurrState.mnDashOffset = convLength(sValue,maCurrState,'r');
+ break;
+ }
+ case XML_STROKE_DASHARRAY:
@@ -2762,9 +2948,6 @@
+ {
+ basegfx::B2DHomMatrix aTransform;
+ parseTransform(aValueUtf8.getStr(),aTransform);
-+ // Ugly and temprorary hack
-+ aTransform.set(0,2,convLength(aTransform.get(0,2),SVG_LENGTH_UNIT_PT));
-+ aTransform.set(1,2,convLength(aTransform.get(1,2),SVG_LENGTH_UNIT_PT));
+ maCurrState.maTransform = maCurrState.maTransform*aTransform;
+ break;
+ }
@@ -2772,7 +2955,7 @@
+ maCurrState.maFontFamily=sValue;
+ break;
+ case XML_FONT_SIZE:
-+ maCurrState.mnFontSize=convLength(sValue);
++ maCurrState.mnFontSize=convLength(sValue,maCurrState,'v');
+ break;
+ case XML_FONT_STYLE:
+ maCurrState.meFontStyle=STYLE_ITALIC; // TODO: sValue.toStyleId();
@@ -2814,19 +2997,22 @@
+ {
+ aCurrToken=sValue.getToken(0,';',nIndex);
+
-+ // split attrib & value
-+ nDummyIndex=0;
-+ rtl::OUString aCurrAttrib(
-+ aCurrToken.getToken(0,':',nDummyIndex).trim());
-+ OSL_ASSERT(nDummyIndex!=-1);
-+ nDummyIndex=0;
-+ rtl::OUString aCurrValue(
-+ aCurrToken.getToken(1,':',nDummyIndex).trim());
-+ OSL_ASSERT(nDummyIndex==-1);
-+
-+ // recurse into normal attribute parsing
-+ parseAttribute( getTokenId(aCurrAttrib),
-+ aCurrValue );
++ if( aCurrToken.getLength() )
++ {
++ // split attrib & value
++ nDummyIndex=0;
++ rtl::OUString aCurrAttrib(
++ aCurrToken.getToken(0,':',nDummyIndex).trim());
++ OSL_ASSERT(nDummyIndex!=-1);
++ nDummyIndex=0;
++ rtl::OUString aCurrValue(
++ aCurrToken.getToken(1,':',nDummyIndex).trim());
++ OSL_ASSERT(nDummyIndex==-1);
++
++ // recurse into normal attribute parsing
++ parseAttribute( getTokenId(aCurrAttrib),
++ aCurrValue );
++ }
+ }
+ while( nIndex != -1 );
+ }
@@ -2889,19 +3075,19 @@
+/// Annotate svg styles with unique references to state pool
+static void annotateStyles( StatePool& rStatePool,
+ StateMap& rStateMap,
++ const State& rInitialState,
+ const uno::Reference<xml::dom::XElement> xElem,
+ const uno::Reference<xml::sax::XDocumentHandler>& xDocHdl )
+{
-+ AnnotatingVisitor aVisitor(rStatePool,rStateMap,xDocHdl);
++ AnnotatingVisitor aVisitor(rStatePool,rStateMap,rInitialState,xDocHdl);
+ visitElements(aVisitor, xElem);
+}
+
+struct ShapeWritingVisitor
+{
-+ ShapeWritingVisitor(StatePool& rStatePool,
++ ShapeWritingVisitor(StatePool& /*rStatePool*/,
+ StateMap& rStateMap,
+ const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler) :
-+ mrStates(rStatePool),
+ mrStateMap(rStateMap),
+ mxDocumentHandler(xDocumentHandler),
+ mnShapeNum(0)
@@ -2924,16 +3110,12 @@
+ 0,'$',nDummyIndex));
+ StateMap::iterator pOrigState=mrStateMap.find(
+ sStyleId.toInt32());
-+ maCurrState = pOrigState != mrStateMap.end() ? pOrigState->second : maParentStates.back();
+
-+ OSL_TRACE("the CTM is now #2: %f %f %f %f %f %f",
-+ maCurrState.maCTM.get(0,0),
-+ maCurrState.maCTM.get(0,1),
-+ maCurrState.maCTM.get(0,2),
-+ maCurrState.maCTM.get(1,0),
-+ maCurrState.maCTM.get(1,1),
-+ maCurrState.maCTM.get(1,2));
-+
++ if( pOrigState == mrStateMap.end() )
++ return; // non-exportable element, e.g. linearGradient
++
++ maCurrState = pOrigState->second;
++
+ const sal_Int32 nTokenId(getTokenId(xElem->getNodeName()));
+ switch(nTokenId)
+ {
@@ -2951,16 +3133,16 @@
+ switch(nAttribId)
+ {
+ case XML_X1:
-+ x1= convLength(sAttributeValue);
++ x1= convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_X2:
-+ x2 = convLength(sAttributeValue);
++ x2 = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y1:
-+ y1 = convLength(sAttributeValue);
++ y1 = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_Y2:
-+ y2 = convLength(sAttributeValue);
++ y2 = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ default:
+ // skip
@@ -2990,11 +3172,6 @@
+ // if( nTokenId == XML_POLYGON )
+ aPoly.setClosed(true);
+
-+ // assuming the coordinates are in pts since they are interpreted as such by different renderers
-+ basegfx::B2DHomMatrix aScale;
-+ aScale.scale(2540.0f/72.0f,2540.0f/72.0f);
-+ aPoly.transform(aScale);
-+
+ writePathShape(xAttrs,
+ xUnoAttrs,
+ xElem,
@@ -3017,23 +3194,23 @@
+ switch(nAttribId)
+ {
+ case XML_X:
-+ x = convLength(sAttributeValue);
++ x = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y:
-+ y = convLength(sAttributeValue);
++ y = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_WIDTH:
-+ width = convLength(sAttributeValue);
++ width = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_HEIGHT:
-+ height = convLength(sAttributeValue);
++ height = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_RX:
-+ rx = convLength(sAttributeValue);
++ rx = convLength(sAttributeValue,maCurrState,'h');
+ bRxSeen=true;
+ break;
+ case XML_RY:
-+ ry = convLength(sAttributeValue);
++ ry = convLength(sAttributeValue,maCurrState,'v');
+ bRySeen=true;
+ break;
+ default:
@@ -3065,11 +3242,6 @@
+ basegfx::B2DPolyPolygon aPoly;
+ basegfx::tools::importFromSvgD(aPoly, sPath);
+
-+ // assuming the coordinates are in pts since they are interpreted as such by different renderers
-+ basegfx::B2DHomMatrix aScale;
-+ aScale.scale(2540.0f/72.0f,2540.0f/72.0f);
-+ aPoly.transform(aScale);
-+
+ writePathShape(xAttrs,
+ xUnoAttrs,
+ xElem,
@@ -3091,13 +3263,13 @@
+ switch(nAttribId)
+ {
+ case XML_CX:
-+ cx = convLength(sAttributeValue);
++ cx = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_CY:
-+ cy = convLength(sAttributeValue);
++ cy = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_R:
-+ r = convLength(sAttributeValue);
++ r = convLength(sAttributeValue,maCurrState,'r');
+ default:
+ // skip
+ break;
@@ -3125,16 +3297,16 @@
+ switch(nAttribId)
+ {
+ case XML_CX:
-+ cx = convLength(sAttributeValue);
++ cx = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_CY:
-+ cy = convLength(sAttributeValue);
++ cy = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_RX:
-+ rx = convLength(sAttributeValue);
++ rx = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_RY:
-+ ry = convLength(sAttributeValue);
++ ry = convLength(sAttributeValue,maCurrState,'v');
+ default:
+ // skip
+ break;
@@ -3162,16 +3334,16 @@
+ switch(nAttribId)
+ {
+ case XML_X:
-+ x = convLength(sAttributeValue);
++ x = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y:
-+ y = convLength(sAttributeValue);
++ y = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_WIDTH:
-+ width = convLength(sAttributeValue);
++ width = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_HEIGHT:
-+ height = convLength(sAttributeValue);
++ height = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ default:
+ // skip
@@ -3212,16 +3384,16 @@
+ switch(nAttribId)
+ {
+ case XML_X:
-+ x = convLength(sAttributeValue);
++ x = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_Y:
-+ y = convLength(sAttributeValue);
++ y = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ case XML_WIDTH:
-+ width = convLength(sAttributeValue);
++ width = convLength(sAttributeValue,maCurrState,'h');
+ break;
+ case XML_HEIGHT:
-+ height = convLength(sAttributeValue);
++ height = convLength(sAttributeValue,maCurrState,'v');
+ break;
+ default:
+ // skip
@@ -3256,10 +3428,8 @@
+ sTransform += USTR(" skewX(") + rtl::OUString::valueOf(fShearX*180.0/M_PI) + USTR(")");
+ }
+
-+ xAttrs->AddAttribute( USTR( "svg:x" ), rtl::OUString::valueOf(x/100.0)+USTR("mm"));
-+ xAttrs->AddAttribute( USTR( "svg:y" ), rtl::OUString::valueOf(y/100.0)+USTR("mm"));
-+ //xAttrs->AddAttribute( USTR( "svg:width" ), rtl::OUString::valueOf(width/100.0)+USTR("mm"));
-+ //xAttrs->AddAttribute( USTR( "svg:height" ), rtl::OUString::valueOf(height/100.0)+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:x" ), rtl::OUString::valueOf(pt2mm(x))+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:y" ), rtl::OUString::valueOf(pt2mm(y))+USTR("mm"));
+ xAttrs->AddAttribute( USTR( "draw:style-name" ), USTR("svggraphicstyle")+sStyleId );
+
+ mxDocumentHandler->startElement(USTR("draw:frame"),xUnoAttrs);
@@ -3278,14 +3448,10 @@
+ }
+
+ void push()
-+ {
-+ maParentStates.push_back(maCurrState);
-+ }
++ {}
+
+ void pop()
-+ {
-+ maParentStates.pop_back();
-+ }
++ {}
+
+ void writeBinaryData( rtl::Reference<SvXMLAttributeList>& xAttrs,
+ const uno::Reference<xml::sax::XAttributeList>& xUnoAttrs,
@@ -3294,10 +3460,10 @@
+ const std::string& data)
+ {
+ xAttrs->Clear();
-+ xAttrs->AddAttribute( USTR( "svg:x" ), rtl::OUString::valueOf(rShapeBounds.getMinX()/100.0)+USTR("mm"));
-+ xAttrs->AddAttribute( USTR( "svg:y" ), rtl::OUString::valueOf(rShapeBounds.getMinY()/100.0)+USTR("mm"));
-+ xAttrs->AddAttribute( USTR( "svg:width" ), rtl::OUString::valueOf(rShapeBounds.getWidth()/100.0)+USTR("mm"));
-+ xAttrs->AddAttribute( USTR( "svg:height" ), rtl::OUString::valueOf(rShapeBounds.getHeight()/100.0)+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:x" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getMinX()))+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:y" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getMinY()))+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:width" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getWidth()))+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:height" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getHeight()))+USTR("mm"));
+
+ mxDocumentHandler->startElement(USTR("draw:frame"),xUnoAttrs);
+
@@ -3350,14 +3516,6 @@
+
+ xAttrs->Clear();
+
-+ OSL_TRACE("the CTM is now #2: %f %f %f %f %f %f",
-+ maCurrState.maCTM.get(0,0),
-+ maCurrState.maCTM.get(0,1),
-+ maCurrState.maCTM.get(0,2),
-+ maCurrState.maCTM.get(1,0),
-+ maCurrState.maCTM.get(1,1),
-+ maCurrState.maCTM.get(1,2));
-+
+ basegfx::B2DPolygon aPoly = basegfx::tools::createPolygonFromEllipse(rEllipse.getB2DEllipseCenter(),
+ rEllipse.getB2DEllipseRadius().getX(), rEllipse.getB2DEllipseRadius().getY());
+ writePathShape(xAttrs, xUnoAttrs, xElem, rStyleId, basegfx::B2DPolyPolygon(aPoly));
@@ -3378,7 +3536,7 @@
+
+ xAttrs->Clear();
+
-+ OSL_TRACE("the CTM is now #2: %f %f %f %f %f %f",
++ OSL_TRACE("writePath - the CTM is: %f %f %f %f %f %f",
+ maCurrState.maCTM.get(0,0),
+ maCurrState.maCTM.get(0,1),
+ maCurrState.maCTM.get(0,2),
@@ -3404,7 +3562,8 @@
+ aStyleId = xElem->getAttribute(
+ USTR("internal-style-ref")).getToken(1,'$',nDummyIndex);
+ StateMap::iterator pAlternateState=mrStateMap.find(aStyleId.toInt32());
-+ aState = pAlternateState != mrStateMap.end() ? pAlternateState->second : maParentStates.back();
++ OSL_ASSERT(pAlternateState != mrStateMap.end());
++ aState = pAlternateState->second;
+ OSL_ENSURE( pAlternateState == mrStateMap.end(),
+ "Doh - where's my alternate style entry?!" );
+ }
@@ -3418,14 +3577,25 @@
+
+ for( sal_uInt32 i=0; i<aPolys.size(); ++i )
+ {
++ const basegfx::B2DRange aBounds(
++ aPolys[i].areControlPointsUsed() ?
++ basegfx::tools::getRange(
++ basegfx::tools::adaptiveSubdivideByAngle(aPolys[i])) :
++ basegfx::tools::getRange(aPolys[i]));
+ fillShapeProperties(xAttrs,
+ xElem,
-+ aPolys[i].areControlPointsUsed() ?
-+ basegfx::tools::getRange(
-+ basegfx::tools::adaptiveSubdivideByAngle(aPolys[i])) :
-+ basegfx::tools::getRange(aPolys[i]),
++ aBounds,
+ USTR("svggraphicstyle")+aStyleId);
+
++ // force path coordinates to 100th millimeter, after
++ // putting polygon data at origin (odf viewbox
++ // calculations largely untested codepaths, as OOo always
++ // writes "0 0 w h" viewboxes)
++ basegfx::B2DHomMatrix aNormalize;
++ aNormalize.translate(-aBounds.getMinX(),-aBounds.getMinY());
++ aNormalize.scale(2540.0/72.0,2540.0/72.0);
++ aPolys[i].transform(aNormalize);
++
+ xAttrs->AddAttribute( USTR( "svg:d" ), basegfx::tools::exportToSvgD(
+ aPolys[i],
+ false, // no relative coords. causes rounding errors
@@ -3443,28 +3613,26 @@
+ {
+ xAttrs->AddAttribute( USTR( "draw:z-index" ), rtl::OUString::valueOf( mnShapeNum++ ));
+ xAttrs->AddAttribute( USTR( "draw:style-name" ), rStyleName);
-+ xAttrs->AddAttribute( USTR( "svg:width" ), rtl::OUString::valueOf(rShapeBounds.getWidth()/100.0)+USTR("mm"));
-+ xAttrs->AddAttribute( USTR( "svg:height" ), rtl::OUString::valueOf(rShapeBounds.getHeight()/100.0)+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:width" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getWidth()))+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:height" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getHeight()))+USTR("mm"));
+
+ // OOo expects the viewbox to be in 100th of mm
+ xAttrs->AddAttribute( USTR( "svg:viewBox" ),
+ USTR("0 0 ")
+ + rtl::OUString::valueOf(
-+ basegfx::fround(rShapeBounds.getWidth()) )
++ basegfx::fround(pt100thmm(rShapeBounds.getWidth())) )
+ + USTR(" ")
+ + rtl::OUString::valueOf(
-+ basegfx::fround(rShapeBounds.getHeight()) ));
++ basegfx::fround(pt100thmm(rShapeBounds.getHeight())) ));
+
+ // TODO(F1): decompose transformation in calling code, and use
+ // transform attribute here
+ // writeTranslate(maCurrState.maCTM, xAttrs);
-+ xAttrs->AddAttribute( USTR( "svg:x" ), rtl::OUString::valueOf(rShapeBounds.getMinX()/100.0)+USTR("mm"));
-+ xAttrs->AddAttribute( USTR( "svg:y" ), rtl::OUString::valueOf(rShapeBounds.getMinY()/100.0)+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:x" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getMinX()))+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "svg:y" ), rtl::OUString::valueOf(pt2mm(rShapeBounds.getMinY()))+USTR("mm"));
+ }
+
+ State maCurrState;
-+ std::vector<State> maParentStates;
-+ StatePool& mrStates;
+ StateMap& mrStateMap;
+ uno::Reference<xml::sax::XDocumentHandler> mxDocumentHandler;
+ sal_Int32 mnShapeNum;
@@ -3547,6 +3715,9 @@
+ uno::Reference<xml::dom::XElement> xDocElem( xDom->getDocumentElement(),
+ uno::UNO_QUERY_THROW );
+
++ // the root state for svg document
++ State aInitialState;
++
+ /////////////////////////////////////////////////////////////////
+ // doc boilerplate
+ /////////////////////////////////////////////////////////////////
@@ -3562,8 +3733,8 @@
+ if (!xDocElem->hasAttribute(USTR("height")))
+ xDocElem->setAttribute(USTR("height"), USTR("297mm"));
+
-+ double fViewPortWidth( convLength(xDocElem->getAttribute(USTR("width"))));
-+ double fViewPortHeight( convLength(xDocElem->getAttribute(USTR("height"))));
++ double fViewPortWidth( pt2mm(convLength(xDocElem->getAttribute(USTR("width")),aInitialState,'h')) );
++ double fViewPortHeight( pt2mm(convLength(xDocElem->getAttribute(USTR("height")),aInitialState,'v')) );
+
+ // document prolog
+ rtl::Reference<SvXMLAttributeList> xAttrs( new SvXMLAttributeList() );
@@ -3662,8 +3833,8 @@
+ xAttrs->AddAttribute( USTR( "fo:margin-bottom" ), USTR("0mm"));
+ xAttrs->AddAttribute( USTR( "fo:margin-left" ), USTR("0mm"));
+ xAttrs->AddAttribute( USTR( "fo:margin-right" ), USTR("0mm"));
-+ xAttrs->AddAttribute( USTR( "fo:page-width" ), rtl::OUString::valueOf(fViewPortWidth/100.0)+USTR("mm"));
-+ xAttrs->AddAttribute( USTR( "fo:page-height" ), rtl::OUString::valueOf(fViewPortHeight/100.0)+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "fo:page-width" ), rtl::OUString::valueOf(fViewPortWidth)+USTR("mm"));
++ xAttrs->AddAttribute( USTR( "fo:page-height" ), rtl::OUString::valueOf(fViewPortHeight)+USTR("mm"));
+ xAttrs->AddAttribute( USTR( "style:print-orientation" ),
+ fViewPortWidth > fViewPortHeight ?
+ USTR("landscape") :
@@ -3689,7 +3860,7 @@
+
+ StatePool aStatePool;
+ StateMap aStateMap;
-+ annotateStyles(aStatePool,aStateMap,
++ annotateStyles(aStatePool,aStateMap,aInitialState,
+ xDocElem,m_xDocumentHandler);
+
+#ifdef VERBOSE
@@ -3749,8 +3920,11 @@
+}
+
+} // namespace svgi
---- filter/source/svg/svgreader.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/svgreader.hxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/svgreader.hxx b/filter/source/svg/svgreader.hxx
+new file mode 100644
+index 0000000..420d326
+--- /dev/null
++++ filter/source/svg/svgreader.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
@@ -3795,9 +3969,12 @@
+} // namespace svgi
+
+#endif
---- filter/source/svg/test/makefile.mk 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/test/makefile.mk 2008-05-23 11:23:50.000000000 +0200
-@@ -0,0 +1,123 @@
+diff --git a/filter/source/svg/test/makefile.mk b/filter/source/svg/test/makefile.mk
+new file mode 100644
+index 0000000..3f14c88
+--- /dev/null
++++ filter/source/svg/test/makefile.mk
+@@ -0,0 +1,114 @@
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
@@ -3834,6 +4011,7 @@
+SHL1STDLIBS= \
+ $(BASEGFXLIB) \
+ $(SVXLIB) \
++ $(SVTOOLLIB) \
+ $(XMLOFFLIB) \
+ $(BASEGFXLIB) \
+ $(VCLLIB) \
@@ -3882,18 +4060,8 @@
+
+TESTFILES=\
+ anarchist.svg \
-+ andorra.svg \
-+ butterfly.svg \
-+ daisies.svg \
-+ ellipticarcs.svg \
-+ firewall_denco_01.svg \
-+ mediatrice.svg \
-+ mouse_the_structorr.svg \
-+ network_could_nicolas_cl.svg \
-+ otto_01.svg \
-+ roundingerrors.svg \
-+ test.svg \
-+ tiger.svg
++ anarchist2.svg \
++ Nested.svg
+
+$(MISC)$/%_svgi_unittest_succeeded : $(BIN)$/svg2odf
+ rm -f $(MISC)$/$(@:s/_succeeded/.xml/:f)
@@ -3918,12 +4086,14 @@
+ @echo UNO_SERVICES=$(BIN)$/unittestservices.rdb > $@
+ @echo UNO_TYPES=$(UNOUCRRDB:s/\/\\/) >> $@
+
-+#ALLTAR : $(BIN)$/svgi_unittest_test.ini \
-+# $(BIN)$/unittestservices.rdb \
-+# $(foreach,i,$(TESTFILES:s/.svg/_svgi_unittest_succeeded/:f) $(MISC)$/$i)
-diff -urN /tmp/svgfilter/filter/source/svg/test/odfserializer.cxx /builds/oobuild/ooo-build-2.4/build/current/filter/source/svg/test/odfserializer.cxx
---- filter/source/svg/test/odfserializer.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/test/odfserializer.cxx 2008-05-23 10:23:53.000000000 +0200
++ALLTAR : $(BIN)$/svgi_unittest_test.ini \
++ $(BIN)$/unittestservices.rdb \
++ $(foreach,i,$(TESTFILES:s/.svg/_svgi_unittest_succeeded/:f) $(MISC)$/$i)
+diff --git a/filter/source/svg/test/odfserializer.cxx b/filter/source/svg/test/odfserializer.cxx
+new file mode 100644
+index 0000000..7686223
+--- /dev/null
++++ filter/source/svg/test/odfserializer.cxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
@@ -4065,9 +4235,11 @@
+}
+
+}
-diff -urN /tmp/svgfilter/filter/source/svg/test/odfserializer.hxx /builds/oobuild/ooo-build-2.4/build/current/filter/source/svg/test/odfserializer.hxx
---- filter/source/svg/test/odfserializer.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/test/odfserializer.hxx 2008-05-23 10:23:53.000000000 +0200
+diff --git a/filter/source/svg/test/odfserializer.hxx b/filter/source/svg/test/odfserializer.hxx
+new file mode 100644
+index 0000000..f2ab4a3
+--- /dev/null
++++ filter/source/svg/test/odfserializer.hxx
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
@@ -4100,9 +4272,11 @@
+}
+
+#endif // _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HDL_
-diff -urN /tmp/svgfilter/filter/source/svg/test/parsertest.cxx /builds/oobuild/ooo-build-2.4/build/current/filter/source/svg/test/parsertest.cxx
---- filter/source/svg/test/parsertest.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/test/parsertest.cxx 2008-05-23 15:52:49.000000000 +0200
+diff --git a/filter/source/svg/test/parsertest.cxx b/filter/source/svg/test/parsertest.cxx
+new file mode 100644
+index 0000000..c8db101
+--- /dev/null
++++ filter/source/svg/test/parsertest.cxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
@@ -4314,9 +4488,11 @@
+// to let the user the possibility to also register some functions by hand.
+NOADDITIONAL;
+
-diff -urN /tmp/svgfilter/filter/source/svg/test/svg2odf.cxx /builds/oobuild/ooo-build-2.4/build/current/filter/source/svg/test/svg2odf.cxx
---- filter/source/svg/test/svg2odf.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/test/svg2odf.cxx 2008-05-23 11:23:07.000000000 +0200
+diff --git a/filter/source/svg/test/svg2odf.cxx b/filter/source/svg/test/svg2odf.cxx
+new file mode 100644
+index 0000000..a271ce0
+--- /dev/null
++++ filter/source/svg/test/svg2odf.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
@@ -4442,8 +4618,11 @@
+ svgi::createSerializer(new OutputWrap(aDstURL)));
+ return aReader.parseAndConvert() ? 0 : 1;
+}
---- filter/source/svg/tokenmap.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/tokenmap.cxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/tokenmap.cxx b/filter/source/svg/tokenmap.cxx
+new file mode 100644
+index 0000000..d9fb57a
+--- /dev/null
++++ filter/source/svg/tokenmap.cxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
@@ -4507,8 +4686,11 @@
+}
+
+} // namespace svgi
---- filter/source/svg/tokenmap.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/tokenmap.hxx 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/tokenmap.hxx b/filter/source/svg/tokenmap.hxx
+new file mode 100644
+index 0000000..c77def6
+--- /dev/null
++++ filter/source/svg/tokenmap.hxx
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
@@ -4542,8 +4724,11 @@
+} // namespace svgi
+
+#endif
---- filter/source/svg/tokens.txt 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/tokens.txt 2008-04-11 00:09:55.000000000 +0200
+diff --git a/filter/source/svg/tokens.txt b/filter/source/svg/tokens.txt
+new file mode 100644
+index 0000000..1211e69
+--- /dev/null
++++ filter/source/svg/tokens.txt
@@ -0,0 +1,403 @@
+#######################################
+#
@@ -4948,9 +5133,12 @@
+#######################################
+userSpaceOnUse
+objectBoundingBox
---- filter/source/svg/units.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/units.cxx 2008-04-11 00:09:55.000000000 +0200
-@@ -0,0 +1,112 @@
+diff --git a/filter/source/svg/units.cxx b/filter/source/svg/units.cxx
+new file mode 100644
+index 0000000..b4f9d94
+--- /dev/null
++++ filter/source/svg/units.cxx
+@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -4971,6 +5159,7 @@
+#include "precompiled_filter.hxx"
+
+#include "units.hxx"
++#include "gfxtypes.hxx"
+#include "spirit_supplements.hxx"
+
+#include <string.h>
@@ -4985,50 +5174,36 @@
+namespace svgi
+{
+
-+namespace
-+{
-+
-+void appendChar( rtl::OUString& str, char character)
-+{
-+ str += rtl::OUString((sal_Char *)&character, 1, RTL_TEXTENCODING_UTF8);
-+}
-+
-+void appendString( rtl::OUString& str, const char *characters)
++double convLength( double value, SvgUnit unit, const State& rState, char dir )
+{
-+ str += rtl::OUString((sal_Char *)characters, strlen(characters), RTL_TEXTENCODING_UTF8);
-+}
++ const double fBoxLen( dir=='h' ? rState.maViewBox.getWidth() :
++ (dir=='v' ? rState.maViewBox.getHeight() :
++ rState.maViewBox.getRange().getLength()));
+
-+void appendDouble( rtl::OUString& str, double value, SvgUnit unit )
-+{
-+ str += rtl::OUString::valueOf(convLength(value, unit));
-+}
-+
-+} //namespace
-+
-+double convLength( double value, SvgUnit unit )
-+{
+ // convert svg unit to internal coordinates ("pixel"). Since the
+ // OOo drawing layer is still largely integer-based, the initial
+ // viewport transformation includes a certain scale factor
++ double fRet(value);
+ switch ( unit )
+ {
-+ case SVG_LENGTH_UNIT_CM: return value * 1000.0;
-+ case SVG_LENGTH_UNIT_EM: fprintf( stderr, "TODO: legth type EM not implemented.\n" ); return 1000.0;
-+ case SVG_LENGTH_UNIT_EX: fprintf( stderr, "TODO: legth type EX not implemented.\n" ); return 1000.0;
-+ case SVG_LENGTH_UNIT_IN: return value * 2540.0;
-+ case SVG_LENGTH_UNIT_MM: return value * 100.0;
-+ case SVG_LENGTH_UNIT_PC: return value * 2540.0/6.0;
-+ case SVG_LENGTH_UNIT_PCT: fprintf( stderr, "TODO: legth type PCT not implemented.\n" ); return 1000.0;
-+ case SVG_LENGTH_UNIT_PT: return value * 2540.0/72.0;
-+ case SVG_LENGTH_UNIT_PX: return value;
-+ case SVG_LENGTH_UNIT_USER: return value * 2540.0/72.0; //FIXME, not true according to the documentation
-+ default: fprintf( stderr, "Unknown length type\n" );
++ case SVG_LENGTH_UNIT_CM: fRet *= 72.0/2.54; break;
++ case SVG_LENGTH_UNIT_IN: fRet *= 72.0; break;
++ case SVG_LENGTH_UNIT_MM: fRet *= 72.0/25.4; break;
++ case SVG_LENGTH_UNIT_PC: fRet *= 72.0/6.0; break;
++ case SVG_LENGTH_UNIT_USER:
++ case SVG_LENGTH_UNIT_PX: // no unit defaults to PX in svg,
++ // assume display to have 72DPI
++ case SVG_LENGTH_UNIT_PT: break;
++ case SVG_LENGTH_UNIT_EM: fRet *= rState.mnFontSize; break;
++ case SVG_LENGTH_UNIT_EX: fRet *= rState.mnFontSize / 2.0; break;
++ case SVG_LENGTH_UNIT_PERCENTAGE: fRet *= fBoxLen; break;
++ default: OSL_TRACE( "Unknown length type" ); break;
+ }
+
-+ return 0.0;
++ return fRet;
+}
+
-+double convLength( const rtl::OUString& sValue )
++double convLength( const rtl::OUString& sValue, const State& rState, char dir )
+{
+ using namespace ::boost::spirit;
+
@@ -5047,9 +5222,9 @@
+ | str_p("in") [assign_a(eUnit,SVG_LENGTH_UNIT_IN)]
+ | str_p("mm") [assign_a(eUnit,SVG_LENGTH_UNIT_MM)]
+ | str_p("pc") [assign_a(eUnit,SVG_LENGTH_UNIT_PC)]
-+ | str_p("pct")[assign_a(eUnit,SVG_LENGTH_UNIT_PCT)]
+ | str_p("pt") [assign_a(eUnit,SVG_LENGTH_UNIT_PT)]
+ | str_p("px") [assign_a(eUnit,SVG_LENGTH_UNIT_PX)]
++ | str_p("%") [assign_a(eUnit,SVG_LENGTH_UNIT_PERCENTAGE)]
+ | str_p("") [assign_a(eUnit,SVG_LENGTH_UNIT_USER)]
+ | end_p)
+ ),
@@ -5059,13 +5234,16 @@
+ if( !bRes )
+ return 0.0;
+
-+ return convLength(nVal,eUnit);
++ return convLength(nVal,eUnit,rState,dir);
+}
+
+} // namespace svgi
---- filter/source/svg/units.hxx 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/svg/units.hxx 2008-04-11 00:09:55.000000000 +0200
-@@ -0,0 +1,47 @@
+diff --git a/filter/source/svg/units.hxx b/filter/source/svg/units.hxx
+new file mode 100644
+index 0000000..e48b5d5
+--- /dev/null
++++ filter/source/svg/units.hxx
+@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -5090,6 +5268,7 @@
+namespace rtl{ class OUString; }
+namespace svgi
+{
++ struct State;
+ enum SvgUnit
+ {
+ SVG_LENGTH_UNIT_CM,
@@ -5098,18 +5277,30 @@
+ SVG_LENGTH_UNIT_IN,
+ SVG_LENGTH_UNIT_MM,
+ SVG_LENGTH_UNIT_PC,
-+ SVG_LENGTH_UNIT_PCT,
+ SVG_LENGTH_UNIT_PT,
+ SVG_LENGTH_UNIT_PX,
++ SVG_LENGTH_UNIT_PERCENTAGE,
+ SVG_LENGTH_UNIT_USER
+ };
+
-+ /// return svg_length_t in 100th's of mm
-+ double convLength( double fVal, SvgUnit unit );
-+ double convLength( const rtl::OUString& sValue );
-+#if 0
-+ void transformPathPointsString( rtl::OUString& sData );
-+#endif
++ /** return svg_length_t in 100th's of mm
++ @param fVal value to convert
++ @param unit unit the value is in
++ @param rState current state (needed for viewport dimensions etc.)
++ @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
++ */
++ double convLength( double fVal, SvgUnit unit, const State& rState, char dir );
++
++ /** return svg_length_t in 100th's of mm
++ @param sValue value to convert
++ @param rState current state (needed for viewport dimensions etc.)
++ @param dir direction - either 'h' or 'v' for horizonal or vertical, resp.
++ */
++ double convLength( const rtl::OUString& sValue, const State& rState, char dir );
++
++ inline double pt2mm(double fVal) { return fVal*25.4/72.0; }
++ inline double pt100thmm(double fVal) { return fVal*2540.0/72.0; }
++
+} // namespace svgi
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]