[Libreoffice-commits] .: Branch 'integration/dev300_m106' - 64 commits - binfilter/bf_svtools filter/inc filter/prj filter/source oox/inc oox/prj oox/source oox/util oox/workben unoxml/qa writerfilter/source
Thorsten Behrens
thorsten at kemper.freedesktop.org
Tue Apr 26 16:31:53 PDT 2011
binfilter/bf_svtools/source/filter.vcl/jpeg/makefile.mk | 2
binfilter/bf_svtools/source/filter.vcl/jpeg/svt_jpeg.cxx | 4
filter/inc/filter/msfilter/msvbahelper.hxx | 2
filter/prj/build.lst | 6
filter/source/config/fragments/fcfg_drawgraphics.mk | 1
filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu | 4
filter/source/flash/swfwriter1.cxx | 150 -
filter/source/graphicfilter/eos2met/eos2met.cxx | 85
filter/source/graphicfilter/epict/epict.cxx | 52
filter/source/graphicfilter/eps/eps.cxx | 83
filter/source/msfilter/msvbahelper.cxx | 58
filter/source/pdf/impdialog.src | 4
filter/source/svg/impsvgdialog.cxx | 150 +
filter/source/svg/impsvgdialog.hxx | 96
filter/source/svg/makefile.mk | 11
filter/source/svg/svgdialog.cxx | 275 +
filter/source/svg/svgdialog.hxx | 120
filter/source/svg/svgexport.cxx | 320 +-
filter/source/svg/svgfilter.cxx | 34
filter/source/svg/svgfilter.hxx | 75
filter/source/svg/svgfontexport.cxx | 252 +
filter/source/svg/svgfontexport.hxx | 28
filter/source/svg/svguno.cxx | 26
filter/source/svg/svgwriter.cxx | 1492 +++++-----
filter/source/svg/svgwriter.hxx | 170 -
oox/inc/oox/core/contexthandler.hxx | 5
oox/inc/oox/core/fasttokenhandler.hxx | 5
oox/inc/oox/core/filterbase.hxx | 5
oox/inc/oox/core/fragmenthandler.hxx | 5
oox/inc/oox/core/relations.hxx | 5
oox/inc/oox/core/relationshandler.hxx | 5
oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx | 6
oox/inc/oox/drawingml/chart/converterbase.hxx | 2
oox/inc/oox/drawingml/color.hxx | 8
oox/inc/oox/drawingml/drawingmltypes.hxx | 23
oox/inc/oox/drawingml/fillproperties.hxx | 55
oox/inc/oox/drawingml/lineproperties.hxx | 48
oox/inc/oox/drawingml/shapepropertymap.hxx | 148
oox/inc/oox/dump/biffdumper.hxx | 4
oox/inc/oox/dump/dumperbase.hxx | 134
oox/inc/oox/dump/oledumper.hxx | 10
oox/inc/oox/dump/pptxdumper.hxx | 4
oox/inc/oox/dump/xlsbdumper.hxx | 4
oox/inc/oox/helper/binaryinputstream.hxx | 324 +-
oox/inc/oox/helper/binaryoutputstream.hxx | 87
oox/inc/oox/helper/binarystreambase.hxx | 131
oox/inc/oox/helper/containerhelper.hxx | 56
oox/inc/oox/helper/graphichelper.hxx | 2
oox/inc/oox/helper/helper.hxx | 31
oox/inc/oox/helper/modelobjecthelper.hxx | 23
oox/inc/oox/helper/propertymap.hxx | 16
oox/inc/oox/helper/propertyset.hxx | 43
oox/inc/oox/helper/textinputstream.hxx | 90
oox/inc/oox/helper/zipstorage.hxx | 11
oox/inc/oox/ole/axbinaryreader.hxx | 17
oox/inc/oox/ole/oleobjecthelper.hxx | 3
oox/inc/oox/ole/olestorage.hxx | 10
oox/inc/oox/ole/vbacontrol.hxx | 2
oox/inc/oox/ole/vbainputstream.hxx | 18
oox/inc/oox/ole/vbamodule.hxx | 4
oox/inc/oox/ole/vbaproject.hxx | 2
oox/inc/oox/ppt/slidepersist.hxx | 4
oox/inc/oox/vml/vmldrawing.hxx | 3
oox/inc/oox/vml/vmlformatting.hxx | 12
oox/inc/oox/vml/vmlinputstream.hxx | 71
oox/inc/oox/xls/biffhelper.hxx | 4
oox/inc/oox/xls/biffinputstream.hxx | 29
oox/inc/oox/xls/biffoutputstream.hxx | 33
oox/inc/oox/xls/chartsheetfragment.hxx | 12
oox/inc/oox/xls/commentsbuffer.hxx | 14
oox/inc/oox/xls/condformatbuffer.hxx | 5
oox/inc/oox/xls/defnamesbuffer.hxx | 24
oox/inc/oox/xls/drawingbase.hxx | 147
oox/inc/oox/xls/drawingfragment.hxx | 98
oox/inc/oox/xls/drawingmanager.hxx | 521 +++
oox/inc/oox/xls/excelfilter.hxx | 11
oox/inc/oox/xls/excelhandlers.hxx | 83
oox/inc/oox/xls/formulabase.hxx | 137
oox/inc/oox/xls/formulaparser.hxx | 36
oox/inc/oox/xls/ooxformulaparser.hxx | 5
oox/inc/oox/xls/pivotcachebuffer.hxx | 12
oox/inc/oox/xls/pivotcachefragment.hxx | 11
oox/inc/oox/xls/richstring.hxx | 44
oox/inc/oox/xls/sharedstringsbuffer.hxx | 12
oox/inc/oox/xls/sheetdatabuffer.hxx | 354 ++
oox/inc/oox/xls/sheetdatacontext.hxx | 90
oox/inc/oox/xls/stylesbuffer.hxx | 6
oox/inc/oox/xls/workbookhelper.hxx | 70
oox/inc/oox/xls/worksheetfragment.hxx | 16
oox/inc/oox/xls/worksheethelper.hxx | 242 -
oox/prj/d.lst | 5
oox/source/core/binaryfilterbase.cxx | 5
oox/source/core/contexthandler.cxx | 3
oox/source/core/filterdetect.cxx | 188 -
oox/source/core/fragmenthandler.cxx | 5
oox/source/core/xmlfilterbase.cxx | 4
oox/source/drawingml/chart/chartdrawingfragment.cxx | 55
oox/source/drawingml/chart/objectformatter.cxx | 212 -
oox/source/drawingml/color.cxx | 4
oox/source/drawingml/fillproperties.cxx | 122
oox/source/drawingml/lineproperties.cxx | 172 -
oox/source/drawingml/makefile.mk | 1
oox/source/drawingml/shape.cxx | 31
oox/source/drawingml/shapepropertymap.cxx | 194 +
oox/source/drawingml/table/tablecell.cxx | 6
oox/source/dump/biffdumper.cxx | 57
oox/source/dump/biffdumper.ini | 28
oox/source/dump/dffdumper.ini | 53
oox/source/dump/dumperbase.cxx | 359 +-
oox/source/dump/oledumper.cxx | 47
oox/source/dump/pptxdumper.cxx | 24
oox/source/dump/xlsbdumper.cxx | 30
oox/source/dump/xlsbdumper.ini | 1
oox/source/export/ooxml-export-notes.txt | 220 +
oox/source/helper/binaryinputstream.cxx | 182 -
oox/source/helper/binaryoutputstream.cxx | 75
oox/source/helper/binarystreambase.cxx | 63
oox/source/helper/containerhelper.cxx | 68
oox/source/helper/graphichelper.cxx | 11
oox/source/helper/modelobjecthelper.cxx | 30
oox/source/helper/propertymap.cxx | 4
oox/source/helper/propertyset.cxx | 67
oox/source/helper/textinputstream.cxx | 226 +
oox/source/helper/zipstorage.cxx | 38
oox/source/ole/axbinaryreader.cxx | 58
oox/source/ole/axcontrol.cxx | 12
oox/source/ole/axcontrolfragment.cxx | 2
oox/source/ole/oleobjecthelper.cxx | 19
oox/source/ole/olestorage.cxx | 59
oox/source/ole/vbacontrol.cxx | 10
oox/source/ole/vbainputstream.cxx | 51
oox/source/ole/vbamodule.cxx | 6
oox/source/ole/vbaproject.cxx | 27
oox/source/ppt/slidefragmenthandler.cxx | 2
oox/source/ppt/slidepersist.cxx | 25
oox/source/token/namespaces.hxx.tail | 35
oox/source/token/properties.txt | 5
oox/source/vml/vmldrawing.cxx | 5
oox/source/vml/vmldrawingfragment.cxx | 3
oox/source/vml/vmlformatting.cxx | 32
oox/source/vml/vmlinputstream.cxx | 303 +-
oox/source/vml/vmlshape.cxx | 21
oox/source/vml/vmltextboxcontext.cxx | 31
oox/source/xls/addressconverter.cxx | 4
oox/source/xls/autofilterbuffer.cxx | 2
oox/source/xls/biffdetector.cxx | 7
oox/source/xls/biffhelper.cxx | 15
oox/source/xls/biffinputstream.cxx | 138
oox/source/xls/biffoutputstream.cxx | 93
oox/source/xls/chartsheetfragment.cxx | 11
oox/source/xls/commentsbuffer.cxx | 194 +
oox/source/xls/condformatbuffer.cxx | 38
oox/source/xls/defnamesbuffer.cxx | 185 -
oox/source/xls/drawingbase.cxx | 324 ++
oox/source/xls/drawingfragment.cxx | 26
oox/source/xls/drawingmanager.cxx | 1414 +++++++++
oox/source/xls/excelchartconverter.cxx | 11
oox/source/xls/excelfilter.cxx | 53
oox/source/xls/excelhandlers.cxx | 82
oox/source/xls/externallinkbuffer.cxx | 10
oox/source/xls/formulabase.cxx | 91
oox/source/xls/formulaparser.cxx | 317 +-
oox/source/xls/makefile.mk | 4
oox/source/xls/numberformatsbuffer.cxx | 2
oox/source/xls/ooxformulaparser.cxx | 21
oox/source/xls/pagesettings.cxx | 3
oox/source/xls/pivotcachebuffer.cxx | 79
oox/source/xls/pivotcachefragment.cxx | 49
oox/source/xls/richstring.cxx | 95
oox/source/xls/sharedstringsbuffer.cxx | 7
oox/source/xls/sheetdatabuffer.cxx | 935 ++++++
oox/source/xls/sheetdatacontext.cxx | 819 ++---
oox/source/xls/stylesbuffer.cxx | 35
oox/source/xls/viewsettings.cxx | 4
oox/source/xls/workbookfragment.cxx | 103
oox/source/xls/workbookhelper.cxx | 244 -
oox/source/xls/workbooksettings.cxx | 3
oox/source/xls/worksheetfragment.cxx | 105
oox/source/xls/worksheethelper.cxx | 1242 ++------
oox/workben/ooxml-export-notes.txt | 220 -
unoxml/qa/complex/unoxml/RDFRepositoryTest.java | 18
writerfilter/source/ooxml/dummyannotate.xsl | 2
writerfilter/source/ooxml/makefile.mk | 4
writerfilter/source/ooxml/model.xml | 52
writerfilter/source/ooxml/modelcleanup.xsl | 19
writerfilter/source/resourcemodel/makefile.mk | 2
186 files changed, 11290 insertions(+), 6040 deletions(-)
New commits:
commit 65b2d27beb2682fda6029b0ce78a1f10cb2b6b51
Merge: de4c2c6... 7efc5f0...
Author: Thorsten Behrens <tbehrens at novell.com>
Date: Wed Apr 27 01:31:35 2011 +0200
Merge commit 'ooo/DEV300_m106' into integration/dev300_m106
Conflicts:
binfilter/bf_svtools/source/filter.vcl/jpeg/svt_jpegc.c
filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu
filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu
filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
filter/source/graphicfilter/eos2met/eos2met.cxx
filter/source/msfilter/msvbahelper.cxx
filter/source/svg/makefile.mk
filter/source/svg/svgexport.cxx
filter/source/svg/svgfilter.cxx
filter/source/svg/svgfilter.hxx
filter/source/svg/svgfontexport.cxx
filter/source/svg/svgfontexport.hxx
filter/source/svg/svgwriter.cxx
filter/source/svg/svgwriter.hxx
oox/inc/oox/core/relations.hxx
oox/inc/oox/core/relationshandler.hxx
oox/inc/oox/dump/biffdumper.hxx
oox/inc/oox/dump/dffdumper.hxx
oox/inc/oox/dump/dumperbase.hxx
oox/inc/oox/dump/oledumper.hxx
oox/inc/oox/dump/pptxdumper.hxx
oox/inc/oox/helper/containerhelper.hxx
oox/inc/oox/helper/propertyset.hxx
oox/inc/oox/xls/commentsbuffer.hxx
oox/inc/oox/xls/sharedformulabuffer.hxx
oox/source/drawingml/shape.cxx
oox/source/dump/oledumper.cxx
oox/source/helper/binaryinputstream.cxx
oox/source/helper/binaryoutputstream.cxx
oox/source/helper/binarystreambase.cxx
oox/source/helper/propertyset.cxx
oox/source/ole/vbacontrol.cxx
oox/source/ole/vbaproject.cxx
oox/source/token/namespaces.hxx.tail
oox/source/vml/vmlshape.cxx
oox/source/xls/commentsbuffer.cxx
oox/source/xls/condformatbuffer.cxx
oox/source/xls/drawingfragment.cxx
oox/source/xls/formulaparser.cxx
oox/source/xls/pivotcachebuffer.cxx
oox/source/xls/richstring.cxx
oox/source/xls/sharedformulabuffer.cxx
oox/source/xls/sheetdatacontext.cxx
oox/source/xls/worksheethelper.cxx
writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff --cc filter/prj/build.lst
index 0c8d77b,b2182d7..95cfeb9
--- a/filter/prj/build.lst
+++ b/filter/prj/build.lst
@@@ -9,12 -9,11 +9,12 @@@ fl filter\source\msfilter\powerpoint n
fl filter\source\pdf nmake - all fl_pdf fl_svg fl_inc NULL
fl filter\source\svg nmake - all fl_svg fl_inc NULL
fl filter\source\placeware nmake - all fl_placeware fl_inc NULL
- fl filter\source\flash nmake - all fl_flash fl_pdf fl_inc NULL
+ fl filter\source\flash nmake - all fl_flash fl_pdf fl_inc NULL
fl filter\source\filtertracer nmake - all fl_filtertracer fl_inc NULL
+fl filter\source\odfflatxml nmake - all fl_odfflatxml fl_inc NULL
fl filter\source\xsltfilter nmake - all fl_xsltfilter fl_inc NULL
- fl filter\source\xsltvalidate nmake - all fl_xsltvalidate fl_xsltfilter fl_inc NULL
- fl filter\source\xsltdialog nmake - all fl_xsltdialog fl_flash fl_inc NULL
+ fl filter\source\xsltvalidate nmake - all fl_xsltvalidate fl_xsltfilter fl_inc NULL
+ fl filter\source\xsltdialog nmake - all fl_xsltdialog fl_flash fl_inc NULL
fl filter\source\docbook nmake - all fl_docbook fl_inc NULL
fl filter\source\t602 nmake - all fl_t602 fl_inc NULL
fl filter\source\graphicfilter\eos2met nmake - all g_vfeom fl_inc NULL
diff --cc filter/source/config/fragments/fcfg_drawgraphics.mk
index 41a4625,948423a..40e6f3f
--- a/filter/source/config/fragments/fcfg_drawgraphics.mk
+++ b/filter/source/config/fragments/fcfg_drawgraphics.mk
@@@ -53,8 -53,8 +53,9 @@@ F4_DRAWGRAPHICS =
RAS___Sun_Rasterfile \
SGF___StarOffice_Writer_SGF \
SGV___StarDraw_2_0 \
+ SVG___Scalable_Vector_Graphics \
SVM___StarView_Metafile \
+ SVG___Scalable_Vector_Graphics \
TGA___Truevision_TARGA \
TIF___Tag_Image_File \
WMF___MS_Windows_Metafile \
diff --cc filter/source/flash/swfwriter1.cxx
index 8a12b91,2c9e551..9de84a5
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@@ -1299,11 -1324,13 +1300,11 @@@ bool Writer::Impl_writeFilling( SvtGrap
aMatrix.set(a, b, aTransform.matrix[a*3+b]);
}
}
- aMatrix.set(2, 0, 0.0);
- aMatrix.set(2, 1, 0.0);
- aMatrix.set(2, 2, 1.0);
+ aMatrix.set(2, 0, 0.0);
+ aMatrix.set(2, 1, 0.0);
+ aMatrix.set(2, 2, 1.0);
// scale bitmap
- Rectangle originalPixelRect = Rectangle(Point(), aGraphic.GetBitmapEx().GetSizePixel());
-
double XScale = (double)aNewRect.GetWidth()/aOldRect.GetWidth();
double YScale = (double)aNewRect.GetHeight()/aOldRect.GetHeight();
@@@ -1863,8 -1890,30 +1864,21 @@@ void Writer::Impl_writeActions( const G
}
break;
+ case( META_RENDERGRAPHIC_ACTION ):
+ {
+ const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pAction;
+ const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
+ const Point aPointPixel;
+ const Size aSizePixel( mpVDev->LogicToPixel( pA->GetSize() ) );
+ const BitmapEx aBmpEx( aRasterizer.Rasterize( aSizePixel ) );
+
+ Impl_writeImage( aBmpEx, pA->GetPoint(), pA->GetSize(),
+ aPointPixel, aBmpEx.GetSizePixel(), clipRect, 1 == bMap );
+ }
+ break;
+
case( META_MAPMODE_ACTION ):
{
-// const MetaMapModeAction *pA = (const MetaMapModeAction*) pAction;
-// MapMode mm = pA->GetMapMode();
-// MapUnit mu = mm.GetMapUnit();
-//
-// Point pt = mm.GetOrigin();
-// Fraction fx = mm.GetScaleX();
-// Fraction fy = mm.GetScaleY();
-
bMap++;
}
case( META_REFPOINT_ACTION ):
diff --cc filter/source/graphicfilter/eos2met/eos2met.cxx
index 5d7d9fb,c831685..94bcc95
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@@ -2568,6 -2629,3 +2606,5 @@@ extern "C" sal_Bool __LOADONCALLAPI Gra
return aMETWriter.WriteMET( aMTF, rStream, pFilterConfigItem );
}
}
+
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc filter/source/msfilter/msvbahelper.cxx
index efede62,82f7c1d..0b2b1be
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@@ -37,8 -36,8 +37,9 @@@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
+ #include <com/sun/star/script/ModuleType.hpp>
#include <tools/urlobj.hxx>
#include <osl/file.hxx>
#include <unotools/pathoptions.hxx>
@@@ -312,16 -351,11 +353,19 @@@ MacroResolvedInfo resolveVBAMacro( SfxO
{
// Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates,
// get the name of Project/Library for 'this' document
- rtl::OUString sThisProject = getDefaultProjectName( pShell );
+ rtl::OUString sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
+ sThisProject = xVBAMode->getProjectName();
+ }
+ catch( uno::Exception& /*e*/) {}
+
sSearchList.push_back( sThisProject ); // First Lib to search
+
+ // service VBAProjectNameProvider not implemented
+ #if 0
if ( xPrjNameCache.is() )
{
// is this document created from a template?
diff --cc filter/source/svg/makefile.mk
index 6b30190,b742b75..50b48a3
--- a/filter/source/svg/makefile.mk
+++ b/filter/source/svg/makefile.mk
@@@ -39,25 -42,15 +43,28 @@@ VISIBILITY_HIDDEN=TRU
# --- Types -------------------------------------
-SLOFILES= $(SLO)$/svguno.obj \
+SLOFILES= \
+ $(SLO)$/b2dellipse.obj \
+ $(SLO)$/parserfragments.obj \
++ $(SLO)$/svguno.obj \
+ $(SLO)$/svgdialog.obj \
+ $(SLO)$/impsvgdialog.obj \
- $(SLO)$/svgfilter.obj \
$(SLO)$/svgexport.obj \
+ $(SLO)$/svgfilter.obj \
$(SLO)$/svgfontexport.obj \
- $(SLO)$/svgwriter.obj
-.IF "$(SOLAR_JAVA)"!=""
-SLOFILES+= $(SLO)$/svgimport.obj
+ $(SLO)$/svgimport.obj \
+ $(SLO)$/svgreader.obj \
+ $(SLO)$/svgwriter.obj \
+ $(SLO)$/tokenmap.obj \
+ $(SLO)$/units.obj
+
+.IF "$(COMID)"=="gcc3"
+.IF "$(CCNUMVER)">="000400000000" || "$(SYSTEM_BOOST)"=="YES"
+CFLAGS+=-DUSE_MODERN_SPIRIT
+.ENDIF
+.ENDIF
+.IF "$(SYSTEM_BOOST)"=="NO"
+CFLAGS+=-DUSE_MODERN_SPIRIT
.ENDIF
# --- Library -----------------------------------
@@@ -65,11 -58,9 +72,11 @@@
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS=\
- $(EDITENGLIB) \
$(SVXCORELIB) \
- $(EDITENGLIB) \
+ $(BASEGFXLIB) \
$(XMLOFFLIB) \
+ $(SVTOOLLIB) \
++ $(EDITENGLIB) \
$(VCLLIB) \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
diff --cc filter/source/svg/svgexport.cxx
index 7fc7e1e,62b198a..86a3f4c
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@@ -129,12 -239,15 +240,15 @@@ sal_Bool SVGFilter::implExport( const S
sal_Int32 nPageToExport = SVG_EXPORT_ALLPAGES;
const PropertyValue* pValue = rDescriptor.getConstArray();
sal_Bool bRet = sal_False;
-
+
+ mnMasterSlideId = mnSlideId = mnDrawingGroupId = mnDrawingId = 0;
+ maFilterData.realloc( 0 );
+
for ( sal_Int32 i = 0 ; i < nLength; ++i)
{
- if( pValue[ i ].Name.equalsAscii( "OutputStream" ) )
+ if( pValue[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OutputStream" ) ) )
pValue[ i ].Value >>= xOStm;
- else if( pValue[ i ].Name.equalsAscii( "FileName" ) )
+ else if( pValue[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FileName" ) ) )
{
::rtl::OUString aFileName;
@@@ -144,10 -257,66 +258,65 @@@
if( pOStm )
xOStm = Reference< XOutputStream >( new ::utl::OOutputStreamWrapper ( *pOStm ) );
}
- else if( pValue[ i ].Name.equalsAscii( "PagePos" ) )
- {
+ else if( pValue[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PagePos" ) ) )
pValue[ i ].Value >>= nPageToExport;
- }
+ }
+ else if( pValue[ i ].Name.equalsAscii( "FilterData" ) )
+ {
+ pValue[ i ].Value >>= maFilterData;
+ }
+ }
+
+ // if no filter data is given use stored/prepared ones
+ if( !maFilterData.getLength() )
+ {
+ #ifdef _SVG_USE_CONFIG
+ FilterConfigItem aCfgItem( String( RTL_CONSTASCII_USTRINGPARAM( SVG_EXPORTFILTER_CONFIGPATH ) ) );
+
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_TINYPROFILE ) ), sal_True );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_EMBEDFONTS ) ), sal_True );
+ aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_NATIVEDECORATION ) ), sal_False );
+ aCfgItem.ReadString( String( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_NATIVEDECORATION ) ), B2UCONST( "xlist" ) );
+ aCfgItem.ReadString( String( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_OPACITY ) ), sal_True );
+ aCfgItem.ReadString( String( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_GRADIENT ) ), sal_True );
+
+ maFilterData = aCfgItem.GetFilterData();
+ #else
+ maFilterData.realloc( 6 );
+
+ maFilterData[ 0 ].Name = B2UCONST( SVG_PROP_TINYPROFILE );
+ maFilterData[ 0 ].Value <<= (sal_Bool) sal_True;
+
+ // font embedding
+ const char* pSVGDisableFontEmbedding = getenv( "SVG_DISABLE_FONT_EMBEDDING" );
+
+ maFilterData[ 1 ].Name = B2UCONST( SVG_PROP_EMBEDFONTS );
+ maFilterData[ 1 ].Value <<= (sal_Bool) ( pSVGDisableFontEmbedding ? sal_False : sal_True );
+
+ // Native decoration
+ maFilterData[ 2 ].Name = B2UCONST( SVG_PROP_NATIVEDECORATION );
+ maFilterData[ 2 ].Value <<= (sal_Bool) sal_False;
+ // glyph placement
+ const char* pSVGGlyphPlacement = getenv( "SVG_GLYPH_PLACEMENT" );
+
+ maFilterData[ 3 ].Name = B2UCONST( SVG_PROP_GLYPHPLACEMENT );
+
+ if( pSVGGlyphPlacement )
+ maFilterData[ 3 ].Value <<= ::rtl::OUString::createFromAscii( pSVGGlyphPlacement );
+ else
+ maFilterData[ 3 ].Value <<= B2UCONST( "xlist" );
+
+ // Tiny Opacity
+ maFilterData[ 4 ].Name = B2UCONST( SVG_PROP_OPACITY );
+ maFilterData[ 4 ].Value <<= (sal_Bool) sal_True;
+
+ // Tiny Gradient
+ maFilterData[ 5 ].Name = B2UCONST( SVG_PROP_GRADIENT );
+ maFilterData[ 5 ].Value <<= (sal_Bool) sal_False;
+ #endif
+ }
+
if( xOStm.is() && xServiceFactory.is() )
{
Reference< XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, UNO_QUERY );
@@@ -499,17 -679,32 +679,28 @@@ sal_Bool SVGFilter::implExportPages( co
if( xShapes.is() )
{
- OUString aAttr;
+ OUString aVisibility, aId, aSlideName( implGetValidIDFromInterface( xShapes, sal_True ) );
+ // add visibility attribute
if( i == nVisiblePage )
- aAttr = B2UCONST( "visible" );
+ aVisibility = B2UCONST( "visible" );
else
- aAttr = B2UCONST( "hidden" );
+ aVisibility = B2UCONST( "hidden" );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttr );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", implGetValidIDFromInterface( xShapes ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aVisibility );
+
+ // add id attribute
+ if( bMaster )
+ aId = ( B2UCONST( "MasterSlide_" ) ) += ::rtl::OUString::valueOf( ++mnMasterSlideId );
+ else
+ aId = ( B2UCONST( "Slide_" ) ) += ::rtl::OUString::valueOf( ++mnSlideId );
+
+ if( aSlideName.getLength() )
+ ( ( aId += B2UCONST( "(" ) ) += aSlideName ) += B2UCONST( ")" );
+
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId );
{
- SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
- const Point aNullPt;
-
- if( mpObjects->find( xDrawPage ) != mpObjects->end() )
{
Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
@@@ -655,32 -854,45 +842,35 @@@ sal_Bool SVGFilter::implExportShape( co
const Point aTopLeft( aBoundRect.X, aBoundRect.Y );
const Size aSize( aBoundRect.Width, aBoundRect.Height );
+ if( rMtf.GetActionCount() )
{
- OUString aId( B2UCONST( "Drawing_" ) );
- OUString aObjName( implGetValidIDFromInterface( rxShape, sal_True ) ), aObjDesc;
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", implGetClassFromShape( rxShape ) );
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+
+ Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
- aId += ::rtl::OUString::valueOf( ++mnDrawingId );
+ OUString aTitle;
+ xShapePropSet->getPropertyValue( B2UCONST( "Title" ) ) >>= aTitle;
+ if( aTitle.getLength() )
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "title", sal_True, sal_True );
+ xExtDocHandler->characters( aTitle );
+ }
+
+ OUString aDescription;
+ xShapePropSet->getPropertyValue( B2UCONST( "Description" ) ) >>= aDescription;
+ if( aDescription.getLength() )
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", sal_True, sal_True );
+ xExtDocHandler->characters( aDescription );
+ }
- if( rMtf.GetActionCount() )
+ if( aObjName.getLength() )
+ ( ( aId += B2UCONST( "(" ) ) += aObjName ) += B2UCONST( ")" );
+
{
- if( ( aShapeType.lastIndexOf( B2UCONST( "drawing.OLE2Shape" ) ) != -1 ) ||
- ( aShapeType.lastIndexOf( B2UCONST( "drawing.GraphicObjectShape" ) ) != -1 ) )
- {
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId );
-
- {
- SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
- mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_FILL | SVGWRITER_WRITE_TEXT );
- }
- }
- else
- {
- if( implHasText( rMtf ) )
- {
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId );
-
- {
- SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
- mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_FILL );
- mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_TEXT );
- }
- }
- else
- {
- SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
- mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_FILL | SVGWRITER_WRITE_TEXT, &aId );
- }
- }
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+ mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_ALL);
}
}
diff --cc filter/source/svg/svgfilter.cxx
index 77f4271,b222eb6..6ea87df
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@@ -85,12 -83,14 +85,12 @@@ sal_Bool SAL_CALL SVGFilter::filter( co
if( pFocusWindow )
pFocusWindow->EnterWait();
-#ifdef SOLAR_JAVA
if( mxDstDoc.is() )
- bRet = implImport( rDescriptor );
+ bRet = sal_False;//implImport( rDescriptor );
else
-#endif
if( mxSrcDoc.is() )
{
- uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
+ uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ),
uno::UNO_QUERY);
if( xDesktop.is() )
{
@@@ -164,44 -165,26 +164,30 @@@ void SAL_CALL SVGFilter::setTargetDocum
// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL SVGFilter_supportsService( const OUString& rServiceName )
- throw (RuntimeException)
+rtl::OUString SAL_CALL SVGFilter::detect( Sequence< PropertyValue >& io_rDescriptor ) throw (RuntimeException)
{
- 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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "InputStream" ) ) )
- pAttribs[i].Value >>= xInput;
- }
-
- if( !xInput.is() )
- return rtl::OUString();
-
- return( rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SVG_FILTER_SERVICE_NAME ) ) );
+ 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();
}
// -----------------------------------------------------------------------------
diff --cc filter/source/svg/svgfilter.hxx
index 7b4606a,be02e09..a0fd56d
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@@ -56,9 -64,12 +59,12 @@@
#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <osl/diagnose.h>
#include <rtl/process.h>
+ #include <basegfx/polygon/b2dpolypolygon.hxx>
+ #include <basegfx/polygon/b2dpolygonclipper.hxx>
+ #include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <tools/debug.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/tempfile.hxx>
@@@ -170,12 -203,21 +198,13 @@@ 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,
+ XImporter,
XExporter,
- XInitialization,
- XServiceInfo >
-#endif
+ XExtendedFilterDetection >
{
- typedef ::std::hash_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
+ typedef ::boost::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
+ typedef ::std::vector< ::rtl::OUString > UniqueIdVector;
private:
@@@ -190,11 -232,21 +219,17 @@@
ObjectMap* mpObjects;
Reference< XComponent > mxSrcDoc;
-#ifdef SOLAR_JAVA
Reference< XComponent > mxDstDoc;
-#endif
Reference< XDrawPage > mxDefaultPage;
+ Sequence< PropertyValue > maFilterData;
+ UniqueIdVector maUniqueIdVector;
+ sal_Int32 mnMasterSlideId;
+ sal_Int32 mnSlideId;
+ sal_Int32 mnDrawingGroupId;
+ sal_Int32 mnDrawingId;
Link maOldFieldHdl;
-#ifdef SOLAR_JAVA
sal_Bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
-#endif
sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
Reference< XDocumentHandler > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
@@@ -222,9 -274,11 +257,9 @@@
sal_Bool implCreateObjectsFromShape( const Reference< XShape >& rxShape );
sal_Bool implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage );
- ::rtl::OUString implGetDescriptionFromShape( const Reference< XShape >& rxShape );
+ ::rtl::OUString implGetClassFromShape( const Reference< XShape >& rxShape );
- ::rtl::OUString implGetValidIDFromInterface( const Reference< XInterface >& rxIf );
+ ::rtl::OUString implGetValidIDFromInterface( const Reference< XInterface >& rxIf, sal_Bool bUnique = sal_False );
- sal_Bool implHasText( const GDIMetaFile& rMtf ) const;
-
DECL_LINK( CalcFieldHdl, EditFieldInfo* );
protected:
diff --cc filter/source/svg/svgfontexport.cxx
index ef20879,d45667f..2461543
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@@ -199,18 -273,18 +274,17 @@@ void SVGFontExport::implEmbedGlyph( Out
aPolyPoly.Scale( 1.0, -1.0 );
- if( !rOut.GetTextBoundRect( aBoundRect, aStr ) )
- aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( aStr ), 0 ) );
+ if( !rOut.GetTextBoundRect( aBoundRect, rCellStr ) )
+ aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( rCellStr ), 0 ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "unicode", aStr );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "unicode", rCellStr );
- if( rGlyphs[ 0 ] == nSpace )
- aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( sal_Unicode( 'x' ) ), 0 ) );
+ if( rCellStr[ 0 ] == nSpace && rCellStr.getLength() == 1 )
+ aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( sal_Unicode( ' ' ) ), 0 ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", SVGActionWriter::GetValueString( aBoundRect.GetWidth() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", ::rtl::OUString::valueOf( aBoundRect.GetWidth() ) );
const ::rtl::OUString aPathString( SVGActionWriter::GetPathString( aPolyPoly, sal_False ) );
-
-
if( aPathString.getLength() )
{
mrExport.AddAttribute( XML_NAMESPACE_NONE, "d", aPathString );
diff --cc filter/source/svg/svgwriter.cxx
index c0cd48f,d22ab3f..33077ec
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@@ -52,6 -50,11 +51,13 @@@ static const char aXMLElemPolyLine[] =
static const char aXMLElemText[] = "text";
static const char aXMLElemTSpan[] = "tspan";
static const char aXMLElemImage[] = "image";
++static const char aXMLElemMask[] = "mask";
++static const char aXMLElemPattern[] = "pattern";
+ static const char aXMLElemLinearGradient[] = "linearGradient";
+ static const char aXMLElemRadialGradient[] = "radialGradient";
+ static const char aXMLElemStop[] = "stop";
+
+ // -----------------------------------------------------------------------------
static const char aXMLAttrTransform[] = "transform";
static const char aXMLAttrStyle[] = "style";
@@@ -70,70 -74,37 +77,25 @@@ static const char aXMLAttrRY[] = "ry"
static const char aXMLAttrWidth[] = "width";
static const char aXMLAttrHeight[] = "height";
static const char aXMLAttrPoints[] = "points";
- static const char aXMLAttrPatternUnits[] = "patternUnits";
- static const char aXMLAttrGradientUnits[] = "gradientUnits";
- static const char aXMLAttrOffset[] = "offset";
+ static const char aXMLAttrStroke[] = "stroke";
+ static const char aXMLAttrStrokeOpacity[] = "stroke-opacity";
+ static const char aXMLAttrStrokeWidth[] = "stroke-width";
+ static const char aXMLAttrStrokeDashArray[] = "stroke-dasharray";
+ static const char aXMLAttrFill[] = "fill";
+ static const char aXMLAttrFillOpacity[] = "fill-opacity";
+ static const char aXMLAttrFontFamily[] = "font-family";
+ static const char aXMLAttrFontSize[] = "font-size";
+ static const char aXMLAttrFontStyle[] = "font-style";
+ static const char aXMLAttrFontWeight[] = "font-weight";
+ static const char aXMLAttrTextDecoration[] = "text-decoration";
static const char aXMLAttrXLinkHRef[] = "xlink:href";
-
- // --------------
- // - FastString -
- // --------------
-
- FastString::FastString( sal_uInt32 nInitLen, sal_uInt32 nIncrement ) :
- mnBufLen( nInitLen ),
- mnCurLen( 0 ),
- mnBufInc( nIncrement ),
- mpBuffer( new sal_Unicode[ nInitLen * sizeof( sal_Unicode ) ] ),
- mnPartPos( 0 )
- {
- DBG_ASSERT( nInitLen, "invalid initial length" );
- DBG_ASSERT( nIncrement, "invalid increment" );
- }
-
- // -----------------------------------------------------------------------------
-
- FastString::~FastString()
- {
- delete[] mpBuffer;
- }
-
- // -----------------------------------------------------------------------------
-
- FastString& FastString::operator+=( const NMSP_RTL::OUString& rStr )
- {
- if( rStr.getLength() )
- {
- if( ( mnCurLen + rStr.getLength() ) > mnBufLen )
- {
- const sal_uInt32 nNewBufLen = ( mnBufLen + ( ( ( mnCurLen + rStr.getLength() ) - mnBufLen ) / mnBufInc + 1 ) * mnBufInc );
- sal_Unicode* pNewBuffer = new sal_Unicode[ nNewBufLen * sizeof( sal_Unicode ) ];
-
- memcpy( pNewBuffer, mpBuffer, mnBufLen * sizeof( sal_Unicode ) );
- delete[] mpBuffer;
- mpBuffer = pNewBuffer;
- mnBufLen = nNewBufLen;
- }
-
- memcpy( mpBuffer + mnCurLen, rStr.getStr(), rStr.getLength() * sizeof( sal_Unicode ) );
- mnCurLen += rStr.getLength();
-
- if( maString.getLength() )
- maString = NMSP_RTL::OUString();
- }
-
- return *this;
- }
+ static const char aXMLAttrGradientUnits[] = "gradientUnits";
++static const char aXMLAttrPatternUnits[] = "patternUnits";
+ static const char aXMLAttrOffset[] = "offset";
+ static const char aXMLAttrStopColor[] = "stop-color";
// -----------------------------------------------------------------------------
- const NMSP_RTL::OUString& FastString::GetString() const
- {
- if( !maString.getLength() && mnCurLen )
- ( (FastString*) this )->maString = NMSP_RTL::OUString( mpBuffer, mnCurLen );
-
- return maString;
- }
-
-static const sal_Unicode pBase64[] =
-{
- //0 1 2 3 4 5 6 7
- 'A','B','C','D','E','F','G','H', // 0
- 'I','J','K','L','M','N','O','P', // 1
- 'Q','R','S','T','U','V','W','X', // 2
- 'Y','Z','a','b','c','d','e','f', // 3
- 'g','h','i','j','k','l','m','n', // 4
- 'o','p','q','r','s','t','u','v', // 5
- 'w','x','y','z','0','1','2','3', // 6
- '4','5','6','7','8','9','+','/' // 7
-};
-
// ----------------------
// - SVGAttributeWriter -
// ----------------------
@@@ -156,78 -127,27 +118,29 @@@ SVGAttributeWriter::~SVGAttributeWriter
// -----------------------------------------------------------------------------
- NMSP_RTL::OUString SVGAttributeWriter::GetFontStyle( const Font& rFont )
+ double SVGAttributeWriter::ImplRound( double fValue, sal_Int32 nDecs )
{
- FastString aStyle;
-
- // font family
- aStyle += B2UCONST( "font-family:" );
- aStyle += mrFontExport.GetMappedFontName( rFont.GetName() );
-
- // font size
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-size:" );
- aStyle += SVGActionWriter::GetValueString( rFont.GetHeight() );
- aStyle += B2UCONST( "px" );
-
- // font style
- /*
- if( rFont.GetItalic() != ITALIC_NONE )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-style:" );
-
- if( rFont.GetItalic() == ITALIC_OBLIQUE )
- aStyle += B2UCONST( "oblique" );
- else
- aStyle += B2UCONST( "italic" );
- }
- */
-
- // font weight
- sal_Int32 nFontWeight;
-
- switch( rFont.GetWeight() )
- {
- case WEIGHT_THIN: nFontWeight = 100; break;
- case WEIGHT_ULTRALIGHT: nFontWeight = 200; break;
- case WEIGHT_LIGHT: nFontWeight = 300; break;
- case WEIGHT_SEMILIGHT: nFontWeight = 400; break;
- case WEIGHT_NORMAL: nFontWeight = 400; break;
- case WEIGHT_MEDIUM: nFontWeight = 500; break;
- case WEIGHT_SEMIBOLD: nFontWeight = 600; break;
- case WEIGHT_BOLD: nFontWeight = 700; break;
- case WEIGHT_ULTRABOLD: nFontWeight = 800; break;
- case WEIGHT_BLACK: nFontWeight = 900; break;
- default: nFontWeight = 400; break;
- }
-
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-weight:" );
- aStyle += NMSP_RTL::OUString::valueOf( nFontWeight );
-
- // !!!
- // font-variant
- // font-stretch
- // font-size-adjust
+ return( floor( fValue * pow( 10.0, (int)nDecs ) + 0.5 ) / pow( 10.0, (int)nDecs ) );
+ }
- #ifdef _SVG_USE_NATIVE_TEXTDECORATION
+ // -----------------------------------------------------------------------------
- if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
+ void SVGAttributeWriter::ImplGetColorStr( const Color& rColor, ::rtl::OUString& rColorStr )
+ {
+ if( rColor.GetTransparency() == 255 )
+ rColorStr = B2UCONST( "none" );
+ else
{
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "text-decoration:" );
-
- if( rFont.GetUnderline() != UNDERLINE_NONE )
- aStyle += B2UCONST( " underline" );
-
- if( rFont.GetStrikeout() != STRIKEOUT_NONE )
- aStyle += B2UCONST( " line-through" );
- rColorStr = B2UCONST( "rgb(" );
- rColorStr += ::rtl::OUString::valueOf( static_cast< sal_Int32 >( rColor.GetRed() ) );
- rColorStr += B2UCONST( "," );
- rColorStr += ::rtl::OUString::valueOf( static_cast< sal_Int32 >( rColor.GetGreen() ) );
- rColorStr += B2UCONST( "," );
- rColorStr += ::rtl::OUString::valueOf( static_cast< sal_Int32 >( rColor.GetBlue() ) );
- rColorStr += B2UCONST( ")" );
++ ::rtl::OUStringBuffer aStyle;
++ aStyle.appendAscii( RTL_CONSTASCII_USTRINGPARAM("rgb(") );
++ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetRed() );
++ aStyle.appendAscii( RTL_CONSTASCII_USTRINGPARAM(",") );
++ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetGreen() );
++ aStyle.appendAscii( RTL_CONSTASCII_USTRINGPARAM(",") );
++ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetBlue() );
++ aStyle.appendAscii( RTL_CONSTASCII_USTRINGPARAM(")") );
++ rColorStr = aStyle.makeStringAndClear();
}
-
- #endif // _SVG_USE_NATIVE_TEXTDECORATION
-
- return aStyle.GetString();
}
// -----------------------------------------------------------------------------
@@@ -361,22 -323,67 +316,68 @@@ void SVGAttributeWriter::SetFontAttr( c
{
if( !mpElemFont || ( rFont != maCurFont ) )
{
+ ::rtl::OUString aFontStyle, aFontWeight, aTextDecoration;
+ sal_Int32 nFontWeight;
+
delete mpElemPaint, mpElemPaint = NULL;
delete mpElemFont;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetFontStyle( maCurFont = rFont ) );
- mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- }
- }
+ maCurFont = rFont;
+
+ // Font Family
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontFamily, mrFontExport.GetMappedFontName( rFont.GetName() ) );
+
+ // Font Size
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontSize, ::rtl::OUString::valueOf( rFont.GetHeight() ) );
++ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontSize,
++ ::rtl::OUString::valueOf( rFont.GetHeight() ) + B2UCONST( "px" ) );
+
+ // Font Style
+ if( rFont.GetItalic() != ITALIC_NONE )
+ {
+ if( rFont.GetItalic() == ITALIC_OBLIQUE )
+ aFontStyle = B2UCONST( "oblique" );
+ else
+ aFontStyle = B2UCONST( "italic" );
+ }
+ else
+ aFontStyle = B2UCONST( "normal" );
- // -----------------------------------------------------------------------------
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontStyle, aFontStyle );
- void SVGAttributeWriter::SetPaintAttr( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo )
- {
- if( !mpElemPaint || ( rLineColor != maCurLineColor ) || ( rFillColor != maCurFillColor ) )
- {
- delete mpElemPaint;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetPaintStyle( maCurLineColor = rLineColor, maCurFillColor = rFillColor, pLineInfo ) );
- mpElemPaint = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
+ // Font Weight
+ switch( rFont.GetWeight() )
+ {
+ case WEIGHT_THIN: nFontWeight = 100; break;
+ case WEIGHT_ULTRALIGHT: nFontWeight = 200; break;
+ case WEIGHT_LIGHT: nFontWeight = 300; break;
+ case WEIGHT_SEMILIGHT: nFontWeight = 400; break;
+ case WEIGHT_NORMAL: nFontWeight = 400; break;
+ case WEIGHT_MEDIUM: nFontWeight = 500; break;
+ case WEIGHT_SEMIBOLD: nFontWeight = 600; break;
+ case WEIGHT_BOLD: nFontWeight = 700; break;
+ case WEIGHT_ULTRABOLD: nFontWeight = 800; break;
+ case WEIGHT_BLACK: nFontWeight = 900; break;
+ default: nFontWeight = 400; break;
+ }
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontWeight, ::rtl::OUString::valueOf( nFontWeight ) );
+
+ if( mrExport.IsUseNativeTextDecoration() )
+ {
+ if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
+ {
+ if( rFont.GetUnderline() != UNDERLINE_NONE )
+ aTextDecoration = B2UCONST( "underline " );
+
+ if( rFont.GetStrikeout() != STRIKEOUT_NONE )
+ aTextDecoration += B2UCONST( "line-through " );
+ }
+ else
+ aTextDecoration = B2UCONST( "none" );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTextDecoration, aTextDecoration );
+ }
+
+ mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
}
}
@@@ -494,11 -493,11 +487,12 @@@ PolyPolygon& SVGActionWriter::ImplMap(
if( nSize > 1 )
{
aPathData += B2UCONST( "M " );
- aPathData += GetValueString( ( aPolyPoint = rPoly[ 0 ] ).X() );
+ aPathData += ::rtl::OUString::valueOf( ( aPolyPoint = rPoly[ 0 ] ).X() );
aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y() );
+ aPathData += ::rtl::OUString::valueOf( aPolyPoint.Y() );
+
sal_Char nCurrentMode = 0;
+ sal_uInt16 n = 1;
while( n < nSize )
{
@@@ -673,306 -706,38 +701,315 @@@ void SVGActionWriter::ImplWriteShape( c
// -----------------------------------------------------------------------------
+void SVGActionWriter::ImplWritePattern( const PolyPolygon& rPolyPoly,
+ const Hatch* pHatch,
+ const Gradient* pGradient,
+ const NMSP_RTL::OUString* pStyle,
+ sal_uInt32 nWriteFlags )
+{
+ if( rPolyPoly.Count() )
+ {
+ SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
+
- FastString aPatternId;
++ ::rtl::OUString aPatternId;
+ aPatternId += B2UCONST( "pattern" );
+ aPatternId += GetValueString( ImplGetNextPatternId() );
+
+ {
+ SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aPatternId.GetString() );
+
+ Rectangle aRect( ImplMap( rPolyPoly.GetBoundRect() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aRect.Left() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aRect.Top() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aRect.GetWidth() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aRect.GetHeight() ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrPatternUnits, NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( "userSpaceOnUse") ) );
+
+ {
+ SvXMLElementExport aElemPattern( mrExport, XML_NAMESPACE_NONE, aXMLElemPattern, sal_True, sal_True );
+
+ // The origin of a pattern is positioned at (aRect.Left(), aRect.Top()).
+ // So we need to adjust the pattern coordinate.
- FastString aTransform;
++ ::rtl::OUString aTransform;
+ aTransform += B2UCONST( "translate" );
+ aTransform += B2UCONST( "(" );
+ aTransform += GetValueString( -aRect.Left() );
+ aTransform += B2UCONST( "," );
+ aTransform += GetValueString( -aRect.Top() );
+ aTransform += B2UCONST( ")" );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform.GetString() );
+
+ {
+ SvXMLElementExport aElemG2( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
+
+ GDIMetaFile aTmpMtf;
+ if( pHatch )
+ mpVDev->AddHatchActions( rPolyPoly, *pHatch, aTmpMtf );
+ else if ( pGradient )
+ mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), *pGradient, aTmpMtf );
+ ImplWriteActions( aTmpMtf, pStyle, nWriteFlags );
+ }
+ }
+ }
+
- FastString aPatternStyle;
++ ::rtl::OUString aPatternStyle;
+ aPatternStyle += B2UCONST( "fill:url(#" );
+ aPatternStyle += aPatternId.GetString();
+ aPatternStyle += B2UCONST( ")" );
+
+ {
+ ImplWritePolyPolygon( rPolyPoly, sal_False, &aPatternStyle.GetString() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
- void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
- const NMSP_RTL::OUString* pStyle, sal_uInt32 nWriteFlags )
+ void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
+ sal_uInt32 nWriteFlags, sal_Bool bApplyMapping )
{
+ PolyPolygon aPolyPoly;
+
+ if( bApplyMapping )
+ ImplMap( rPolyPoly, aPolyPoly );
+ else
+ aPolyPoly = rPolyPoly;
+
- if( rGradient.GetStyle() == GRADIENT_LINEAR || rGradient.GetStyle() == GRADIENT_AXIAL ||
- rGradient.GetStyle() == GRADIENT_RADIAL || rGradient.GetStyle() == GRADIENT_ELLIPTICAL )
+ if ( rGradient.GetStyle() == GRADIENT_LINEAR ||
+ rGradient.GetStyle() == GRADIENT_AXIAL )
{
- ImplWriteGradientLinear( rPolyPoly, rGradient );
- SVGShapeDescriptor aShapeDesc;
-
- aShapeDesc.maShapePolyPoly = aPolyPoly;
- aShapeDesc.mapShapeGradient.reset( new Gradient( rGradient ) );
-
- ImplWriteShape( aShapeDesc, sal_False );
++ ImplWriteGradientLinear( aPolyPoly, rGradient );
}
else
{
- ImplWritePattern( rPolyPoly, NULL, &rGradient, pStyle, nWriteFlags );
- GDIMetaFile aTmpMtf;
-
- mrExport.pushClip( aPolyPoly.getB2DPolyPolygon() );
- mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
- ++mnInnerMtfCount;
-
- ImplWriteActions( aTmpMtf, nWriteFlags, NULL );
-
- --mnInnerMtfCount;
- mrExport.popClip();
++ ImplWritePattern( aPolyPoly, NULL, &rGradient, nWriteFlags );
+ }
+}
+
++// -----------------------------------------------------------------------------
++
+void SVGActionWriter::ImplWriteGradientLinear( const PolyPolygon& rPolyPoly,
+ const Gradient& rGradient )
+{
+ if( rPolyPoly.Count() )
+ {
+ SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
+
- FastString aGradientId;
++ ::rtl::OUString aGradientId;
+ aGradientId += B2UCONST( "gradient" );
+ aGradientId += GetValueString( ImplGetNextGradientId() );
+
+ {
+ SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aGradientId.GetString() );
+ {
+ Rectangle aTmpRect;
+ Point aTmpCenter;
+ rGradient.GetBoundRect( rPolyPoly.GetBoundRect(), aTmpRect, aTmpCenter );
+ const Rectangle aRect( ImplMap( aTmpRect) );
+ const Point aCenter( ImplMap( aTmpCenter) );
+ const sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+
+ Polygon aPoly( 2 );
+ // Setting x value of a gradient vector to rotation center to
+ // place a gradient vector in a target polygon.
+ // This would help editing it in SVG editors like inkscape.
+ aPoly[ 0 ].X() = aPoly[ 1 ].X() = aCenter.X();
+ aPoly[ 0 ].Y() = aRect.Top();
+ aPoly[ 1 ].Y() = aRect.Bottom();
+ aPoly.Rotate( aCenter, nAngle );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, GetValueString( aPoly[ 0 ].X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, GetValueString( aPoly[ 0 ].Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, GetValueString( aPoly[ 1 ].X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, GetValueString( aPoly[ 1 ].Y() ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits,
+ NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( "userSpaceOnUse" ) ) );
+ }
+
+ {
+ SvXMLElementExport aElemLinearGradient( mrExport, XML_NAMESPACE_NONE, aXMLElemLinearGradient, sal_True, sal_True );
+
+ const Color aStartColor = ImplGetColorWithIntensity( rGradient.GetStartColor(), rGradient.GetStartIntensity() );
+ const Color aEndColor = ImplGetColorWithIntensity( rGradient.GetEndColor(), rGradient.GetEndIntensity() );
+ double fBorderOffset = rGradient.GetBorder() / 100.0;
+ const sal_uInt16 nSteps = rGradient.GetSteps();
+ if( rGradient.GetStyle() == GRADIENT_LINEAR )
+ {
+ // Emulate non-smooth gradient
+ if( 0 < nSteps && nSteps < 100 )
+ {
+ double fOffsetStep = ( 1.0 - fBorderOffset ) / (double)nSteps;
+ for( sal_uInt16 i = 0; i < nSteps; i++ ) {
+ Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / (double) nSteps );
+ ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep );
+ aColor = ImplGetGradientColor( aStartColor, aEndColor, ( i + 1 ) / (double) nSteps );
+ ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep );
+ }
+ }
+ else
+ {
+ ImplWriteGradientStop( aStartColor, fBorderOffset );
+ ImplWriteGradientStop( aEndColor, 1.0 );
+ }
+ }
+ else
+ {
+ fBorderOffset /= 2;
+ // Emulate non-smooth gradient
+ if( 0 < nSteps && nSteps < 100 )
+ {
+ double fOffsetStep = ( 0.5 - fBorderOffset ) / (double)nSteps;
+ // Upper half
+ for( sal_uInt16 i = 0; i < nSteps; i++ )
+ {
+ Color aColor = ImplGetGradientColor( aEndColor, aStartColor, i / (double) nSteps );
+ ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep );
+ aColor = ImplGetGradientColor( aEndColor, aStartColor, (i + 1 ) / (double) nSteps );
+ ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep );
+ }
+ // Lower half
+ for( sal_uInt16 i = 0; i < nSteps; i++ )
+ {
+ Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / (double) nSteps );
+ ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep );
+ aColor = ImplGetGradientColor( aStartColor, aEndColor, (i + 1 ) / (double) nSteps );
+ ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep );
+ }
+ }
+ else
+ {
+ ImplWriteGradientStop( aEndColor, fBorderOffset );
+ ImplWriteGradientStop( aStartColor, 0.5 );
+ ImplWriteGradientStop( aEndColor, 1.0 - fBorderOffset );
+ }
+ }
+ }
+ }
+
- FastString aGradientStyle;
++ ::rtl::OUString aGradientStyle;
+ aGradientStyle += B2UCONST( "fill:" );
+ aGradientStyle += B2UCONST( "url(#" );
+ aGradientStyle += aGradientId.GetString();
+ aGradientStyle += B2UCONST( ")" );
+
+ {
+ ImplWritePolyPolygon( rPolyPoly, sal_False, &aGradientStyle.GetString() );
+ }
+ }
+}
+
+void SVGActionWriter::ImplWriteGradientStop( const Color& rColor, double fOffset )
+{
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, NMSP_RTL::OUString::valueOf( fOffset ) );
+
- FastString aStyle;
++ ::rtl::OUString aStyle;
+ aStyle += B2UCONST( "stop-color:" );
+ aStyle += mpContext->GetColorStyle ( rColor );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
+ {
+ SvXMLElementExport aElemStartStop( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
+ }
+}
+
+Color SVGActionWriter::ImplGetColorWithIntensity( const Color& rColor,
+ sal_uInt16 nIntensity )
+{
+ sal_uInt8 nNewRed = (sal_uInt8)( (long)rColor.GetRed() * nIntensity / 100L );
+ sal_uInt8 nNewGreen = (sal_uInt8)( (long)rColor.GetGreen() * nIntensity / 100L );
+ sal_uInt8 nNewBlue = (sal_uInt8)( (long)rColor.GetBlue() * nIntensity / 100L );
+ return Color( nNewRed, nNewGreen, nNewBlue);
+}
+
+Color SVGActionWriter::ImplGetGradientColor( const Color& rStartColor,
+ const Color& rEndColor,
+ double fOffset )
+{
+ long nRedStep = rEndColor.GetRed() - rStartColor.GetRed();
+ long nNewRed = rStartColor.GetRed() + (long)( nRedStep * fOffset );
+ nNewRed = ( nNewRed < 0 ) ? 0 : ( nNewRed > 0xFF) ? 0xFF : nNewRed;
+
+ long nGreenStep = rEndColor.GetGreen() - rStartColor.GetGreen();
+ long nNewGreen = rStartColor.GetGreen() + (long)( nGreenStep * fOffset );
+ nNewGreen = ( nNewGreen < 0 ) ? 0 : ( nNewGreen > 0xFF) ? 0xFF : nNewGreen;
+
+ long nBlueStep = rEndColor.GetBlue() - rStartColor.GetBlue();
+ long nNewBlue = rStartColor.GetBlue() + (long)( nBlueStep * fOffset );
+ nNewBlue = ( nNewBlue < 0 ) ? 0 : ( nNewBlue > 0xFF) ? 0xFF : nNewBlue;
+
+ return Color( (sal_uInt8)nNewRed, (sal_uInt8)nNewGreen, (sal_uInt8)nNewBlue );
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf,
+ const Point& rDestPt,
+ const Size& rDestSize,
+ const Gradient& rGradient,
+ const NMSP_RTL::OUString* pStyle,
+ sal_uInt32 nWriteFlags )
+{
+ Point aSrcPt( rMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( rMtf.GetPrefSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) rDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) rDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ rMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = rDestPt.X() - aSrcPt.X(), nMoveY = rDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ rMtf.Move( nMoveX, nMoveY );
+
- FastString aMaskId;
++ ::rtl::OUString aMaskId;
+ aMaskId += B2UCONST( "mask" );
+ aMaskId += GetValueString( ImplGetNextMaskId() );
+
+ {
+ SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aMaskId.GetString() );
+ {
+ SvXMLElementExport aElemMask( mrExport, XML_NAMESPACE_NONE, aXMLElemMask, sal_True, sal_True );
+
+ const PolyPolygon aPolyPolygon( PolyPolygon( Rectangle( rDestPt, rDestSize ) ) );
+ Gradient aGradient( rGradient );
+
+ // swap gradient stops to adopt SVG mask
+ Color aTmpColor( aGradient.GetStartColor() );
+ sal_uInt16 nTmpIntensity( aGradient.GetStartIntensity() );
+ aGradient.SetStartColor( aGradient.GetEndColor() );
+ aGradient.SetStartIntensity( aGradient.GetEndIntensity() ) ;
+ aGradient.SetEndColor( aTmpColor );
+ aGradient.SetEndIntensity( nTmpIntensity );
+
+ ImplWriteGradientEx( aPolyPolygon, aGradient, pStyle, nWriteFlags );
+ }
+ }
+
- FastString aMaskStyle;
++ ::rtl::OUString aMaskStyle;
+ aMaskStyle += B2UCONST( "mask:url(#" );
+ aMaskStyle += aMaskId.GetString();
+ aMaskStyle += B2UCONST( ")" );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aMaskStyle.GetString() );
+
+ {
+ SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
+
+ mpVDev->Push();
+ ImplWriteActions( rMtf, pStyle, nWriteFlags );
+ mpVDev->Pop();
}
}
@@@ -980,251 -745,135 +1017,223 @@@
void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
const sal_Int32* pDXArray, long nWidth,
- const NMSP_RTL::OUString* pStyle )
+ sal_Bool bApplyMapping )
{
+ const FontMetric aMetric( mpVDev->GetFontMetric() );
+
+ bool bTextSpecial = aMetric.IsShadow() || aMetric.IsOutline() || (aMetric.GetRelief() != RELIEF_NONE);
+
+ if( !bTextSpecial )
+ {
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( rPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ }
+ else
+ {
+ if( aMetric.GetRelief() != RELIEF_NONE )
+ {
+ Color aReliefColor( COL_LIGHTGRAY );
+ Color aTextColor( mpVDev->GetTextColor() );
+
+ if ( aTextColor.GetColor() == COL_BLACK )
+ aTextColor = Color( COL_WHITE );
+
+ if ( aTextColor.GetColor() == COL_WHITE )
+ aReliefColor = Color( COL_BLACK );
+
+
+ Point aPos( rPos );
+ Point aOffset( 6, 6 );
+
+ if ( aMetric.GetRelief() == RELIEF_ENGRAVED )
+ {
+ aPos -= aOffset;
+ }
+ else
+ {
+ aPos += aOffset;
+ }
+
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, aReliefColor );
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, aTextColor );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, aReliefColor );
++ ImplWriteText( rPos, rText, pDXArray, nWidth, aTextColor );
+ }
+ else
+ {
+ if( aMetric.IsShadow() )
+ {
+ long nOff = 1 + ((aMetric.GetLineHeight()-24)/24);
+ if ( aMetric.IsOutline() )
+ nOff += 6;
+
+ Color aTextColor( mpVDev->GetTextColor() );
+ Color aShadowColor = Color( COL_BLACK );
+
+ if ( (aTextColor.GetColor() == COL_BLACK) || (aTextColor.GetLuminance() < 8) )
+ aShadowColor = Color( COL_LIGHTGRAY );
+
+ Point aPos( rPos );
+ aPos += Point( nOff, nOff );
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, aShadowColor );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, aShadowColor );
+
+ if( !aMetric.IsOutline() )
+ {
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, aTextColor );
++ ImplWriteText( rPos, rText, pDXArray, nWidth, aTextColor );
+ }
+ }
+
+ if( aMetric.IsOutline() )
+ {
+ Point aPos = rPos + Point( -6, -6 );
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point( +6, +6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point( -6, +0);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point( -6, +6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point( +0, +6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point( +0, -6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point( +6, -1);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+ aPos = rPos + Point( +6, +0);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
++ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor() );
+
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, Color( COL_WHITE ) );
++ ImplWriteText( rPos, rText, pDXArray, nWidth, Color( COL_WHITE ) );
+ }
+ }
+ }
+}
+
+void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
+ const sal_Int32* pDXArray, long nWidth,
- const NMSP_RTL::OUString* pStyle,
+ Color aTextColor )
+{
- long nLen = rText.Len();
-
- if( nLen )
- {
- Size aNormSize;
- sal_Int32* pOwnArray;
- sal_Int32* pDX;
-
- // get text sizes
- if( pDXArray )
- {
- pOwnArray = NULL;
- aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 );
- pDX = (sal_Int32*) pDXArray;
- }
- else
- {
- pOwnArray = new sal_Int32[ nLen ];
- aNormSize = Size( mpVDev->GetTextArray( rText, pOwnArray ), 0 );
- pDX = pOwnArray;
- }
+ sal_Int32 nLen = rText.Len(), i;
+ Size aNormSize;
+ ::std::auto_ptr< sal_Int32 > apTmpArray;
- ::std::auto_ptr< SvXMLElementExport > apTransform;
+ sal_Int32* pDX;
+ Point aPos;
+ Point aBaseLinePos( rPos );
+ const FontMetric aMetric( mpVDev->GetFontMetric() );
+ const Font& rFont = mpVDev->GetFont();
+
+ if( rFont.GetAlign() == ALIGN_TOP )
+ aBaseLinePos.Y() += aMetric.GetAscent();
+ else if( rFont.GetAlign() == ALIGN_BOTTOM )
+ aBaseLinePos.Y() -= aMetric.GetDescent();
- if( nLen > 1 )
- {
- aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( sal::static_int_cast<sal_uInt16>( nLen - 1 ) ) );
+ if( bApplyMapping )
+ ImplMap( rPos, aPos );
+ else
+ aPos = rPos;
- if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
- {
- const double fFactor = (double) nWidth / aNormSize.Width();
+ // get text sizes
+ if( pDXArray )
+ {
+ aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 );
+ pDX = const_cast< sal_Int32* >( pDXArray );
+ }
+ else
+ {
+ apTmpArray.reset( new sal_Int32[ nLen ] );
+ aNormSize = Size( mpVDev->GetTextArray( rText, apTmpArray.get() ), 0 );
+ pDX = apTmpArray.get();
+ }
- for(long i = 0; i < ( nLen - 1 ); i++ )
- pDX[ i ] = FRound( pDX[ i ] * fFactor );
- }
- }
+ // if text is rotated, set transform matrix at new g element
+ if( rFont.GetOrientation() )
+ {
+ Point aRot( aPos );
+ String aTransform;
+
- aTransform = String( ::rtl::OUString::createFromAscii( "translate" ) );
++ aTransform = String( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "translate" ) ) );
+ aTransform += '(';
+ aTransform += String( ::rtl::OUString::valueOf( aRot.X() ) );
+ aTransform += ',';
+ aTransform += String( ::rtl::OUString::valueOf( aRot.Y() ) );
+ aTransform += ')';
+
- aTransform += String( ::rtl::OUString::createFromAscii( " rotate" ) );
++ aTransform += String( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " rotate" ) ) );
+ aTransform += '(';
+ aTransform += String( ::rtl::OUString::valueOf( rFont.GetOrientation() * -0.1 ) );
+ aTransform += ')';
+
- aTransform += String( ::rtl::OUString::createFromAscii( " translate" ) );
++ aTransform += String( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " translate" ) ) );
+ aTransform += '(';
+ aTransform += String( ::rtl::OUString::valueOf( -aRot.X() ) );
+ aTransform += ',';
+ aTransform += String( ::rtl::OUString::valueOf( -aRot.Y() ) );
+ aTransform += ')';
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
- apTransform.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True ) );
+ }
- FastString aStyle;
- const Font& rFont = mpVDev->GetFont();
- const FontMetric aMetric( mpVDev->GetFontMetric() );
- Point aBaseLinePos( rPos );
+ if( nLen > 1 )
+ {
+ aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( nLen - 1 ) );
- // always adjust text position to match baseline alignment
- switch( rFont.GetAlign() )
+ if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
{
- case( ALIGN_TOP ):
- aBaseLinePos.Y() += aMetric.GetAscent();
- break;
-
- case( ALIGN_BOTTOM ):
- aBaseLinePos.Y() -= aMetric.GetDescent();
- break;
+ const double fFactor = (double) nWidth / aNormSize.Width();
- default:
- break;
- for( i = 0; i < ( nLen - 1 ); i++ )
++ for(long i = 0; i < ( nLen - 1 ); i++ )
+ pDX[ i ] = FRound( pDX[ i ] * fFactor );
}
-
- mpContext->SetPaintAttr( COL_TRANSPARENT, aTextColor );
-
- // get mapped text position
- const Point aPt( ImplMap( aBaseLinePos ) );
-
- // if text is italic, set transform at new g element
- if( ( rFont.GetItalic() != ITALIC_NONE ) || rFont.GetOrientation() )
+ else
{
- String aTransform;
-
- aTransform = NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( "translate" ));
- aTransform += '(';
- aTransform += String( GetValueString( aPt.X() ) );
- aTransform += ',';
- aTransform += String( GetValueString( aPt.Y() ) );
- aTransform += ')';
-
- if( rFont.GetOrientation() )
- {
- aTransform += String( NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( " rotate" )) );
- aTransform += '(';
- aTransform += String( NMSP_RTL::OUString::valueOf( rFont.GetOrientation() * -0.1 ) );
- aTransform += ')';
- }
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBI( ::vcl::unohelper::CreateBreakIterator() );
+ const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale();
+ sal_Int32 nCurPos = 0, nLastPos = 0, nX = aPos.X();
- if( rFont.GetItalic() != ITALIC_NONE )
+ // write single glyphs at absolute text positions
+ for( sal_Bool bCont = sal_True; bCont; )
{
- aTransform += String( NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( " skewX" )) );
- aTransform += '(';
- aTransform += String( NMSP_RTL::OUString::valueOf( (sal_Int32) -10 ) );
- aTransform += ')';
- }
+ sal_Int32 nCount = 1;
- aTransform += String( NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( " translate" )) );
- aTransform += '(';
- aTransform += String( GetValueString( -aPt.X() ) );
- aTransform += ',';
- aTransform += String( GetValueString( -aPt.Y() ) );
- aTransform += ')';
+ nLastPos = nCurPos;
+ nCurPos = xBI->nextCharacters( rText, nCurPos, rLocale,
+ ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL,
+ nCount, nCount );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
- }
-
- // add additional style if requested
- if( pStyle && pStyle->getLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- // write text element
- {
- #ifdef _SVG_USE_TSPANS
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
- FastString aTSpanX;
- const NMSP_RTL::OUString aSpace( ' ' );
- String aOutputText( rText );
- long nCurPos = 0;
- bool bIgnoreWhitespace = true;
-
- for( long j = 0, nX = aPt.X(); j < nLen; ++j )
- {
- const sal_Unicode cCode = rText.GetChar( sal::static_int_cast<sal_uInt16>( j ) );
+ nCount = nCurPos - nLastPos;
+ bCont = ( nCurPos < rText.Len() ) && nCount;
- // don't take more than one whitespace into account
- if( !bIgnoreWhitespace || ( ' ' != cCode ) )
+ if( nCount )
{
- aOutputText.SetChar( sal::static_int_cast<sal_uInt16>( nCurPos++ ), cCode );
- ( aTSpanX += GetValueString( nX + ( ( j > 0 ) ? pDX[ j - 1 ] : 0 ) ) ) += aSpace;
- bIgnoreWhitespace = ( ' ' == cCode );
+ const ::rtl::OUString aGlyph( rText.Copy( nLastPos, nCount ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( nX ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False );
+ mrExport.GetDocHandler()->characters( aGlyph );
+ }
+
+ if( bCont )
+ nX = aPos.X() + pDXArray[ nCurPos - 1 ];
}
}
-
- if( nCurPos < nLen )
- aOutputText.Erase( sal::static_int_cast<sal_uInt16>( nCurPos ) );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aTSpanX.GetString() );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
-
- {
- SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemTSpan, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( aOutputText );
- }
- #else
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
-
- {
- SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( rText );
- }
- #endif
}
+ }
+ else
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( aPos.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False );
+ mrExport.GetDocHandler()->characters( rText );
+ }
+ }
- #ifndef _SVG_USE_NATIVE_TEXTDECORATION
- // write strikeout if neccessary
- if( rFont.GetStrikeout() || rFont.GetUnderline() )
+ if( !mrExport.IsUseNativeTextDecoration() )
+ {
+ if( rFont.GetStrikeout() != STRIKEOUT_NONE || rFont.GetUnderline() != UNDERLINE_NONE )
{
- Polygon aPoly( 4 );
- const long nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
+ Polygon aPoly( 4 );
+ const long nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
if( rFont.GetStrikeout() )
{
@@@ -1279,21 -925,115 +1285,31 @@@ void SVGActionWriter::ImplWriteBmp( con
if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE )
{
- const Point aPt( ImplMap( rPt ) );
- const Size aSz( ImplMap( rSz ) );
- Point aPt;
- Size aSz;
- ::rtl::OUString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell(), RTL_TEXTENCODING_ASCII_US );
- REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( mrExport.GetDocHandler(), NMSP_UNO::UNO_QUERY );
-
++ Point aPt;
++ Size aSz;
+ Sequence< sal_Int8 > aSeq( (sal_Int8*) aOStm.GetData(), aOStm.Tell() );
+ NMSP_RTL::OUStringBuffer aBuffer;
+ aBuffer.appendAscii( "data:image/png;base64," );
+ SvXMLUnitConverter::encodeBase64( aBuffer, aSeq );
+
+ if( bApplyMapping )
+ {
+ ImplMap( rPt, aPt );
+ ImplMap( rSz, aSz );
+ }
+ else
+ {
+ aPt = rPt;
+ aSz = rSz;
+ }
+
- if( xExtDocHandler.is() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aSz.Width() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aSz.Height() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, aBuffer.makeStringAndClear() );
-
{
- static const sal_uInt32 nPartLen = 64;
- const ::rtl::OUString aSpace( ' ' );
- const ::rtl::OUString aLineFeed( ::rtl::OUString::valueOf( (sal_Unicode) 0x0a ) );
- ::rtl::OUString aString;
-
- aString = aLineFeed;
- aString += B2UCONST( "<" );
- aString += ::rtl::OUString::createFromAscii( aXMLElemImage );
- aString += aSpace;
-
- aString += ::rtl::OUString::createFromAscii( aXMLAttrX );
- aString += B2UCONST( "=\"" );
- aString += ::rtl::OUString::valueOf( aPt.X() );
- aString += B2UCONST( "\" " );
-
- aString += ::rtl::OUString::createFromAscii( aXMLAttrY );
- aString += B2UCONST( "=\"" );
- aString += ::rtl::OUString::valueOf( aPt.Y() );
- aString += B2UCONST( "\" " );
-
- aString += ::rtl::OUString::createFromAscii( aXMLAttrWidth );
- aString += B2UCONST( "=\"" );
- aString += ::rtl::OUString::valueOf( aSz.Width() );
- aString += B2UCONST( "\" " );
-
- aString += ::rtl::OUString::createFromAscii( aXMLAttrHeight );
- aString += B2UCONST( "=\"" );
- aString += ::rtl::OUString::valueOf( aSz.Height() );
- aString += B2UCONST( "\" " );
-
- aString += ::rtl::OUString::createFromAscii( aXMLAttrXLinkHRef );
- aString += B2UCONST( "=\"data:image/png;base64," );
-
- xExtDocHandler->unknown( aString );
-
- const sal_uInt32 nQuadCount = aImageData.getLength() / 3;
- const sal_uInt32 nRest = aImageData.getLength() % 3;
-
- if( nQuadCount || nRest )
- {
- sal_Int32 nBufLen = ( ( nQuadCount + ( nRest ? 1 : 0 ) ) << 2 );
- const sal_Unicode* pSrc = (const sal_Unicode*) aImageData;
- sal_Unicode* pBuffer = new sal_Unicode[ nBufLen * sizeof( sal_Unicode ) ];
- sal_Unicode* pTmpDst = pBuffer;
-
- for( sal_uInt32 i = 0; i < nQuadCount; ++i )
- {
- const sal_Int32 nA = *pSrc++;
- const sal_Int32 nB = *pSrc++;
- const sal_Int32 nC = *pSrc++;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
- *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
- *pTmpDst++ = pBase64[ ( ( nB << 2 ) & 0x3c ) + ( ( nC >> 6 ) & 0x3 ) ];
- *pTmpDst++ = pBase64[ nC & 0x3f ];
- }
-
- if( nRest )
- {
- const sal_Int32 nA = *pSrc++;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
-
- if( 2 == nRest )
- {
- const sal_Int32 nB = *pSrc;
-
- *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
- *pTmpDst++ = pBase64[ ( nB << 2 ) & 0x3c ];
- }
- else
- {
- *pTmpDst++ = pBase64[ ( nA << 4 ) & 0x30 ];
- *pTmpDst++ = '=';
- }
-
- *pTmpDst = '=';
- }
-
- for( sal_Int32 nCurPos = 0; nCurPos < nBufLen; nCurPos += nPartLen )
- {
- const ::rtl::OUString aPart( pBuffer + nCurPos, ::std::min< sal_Int32 >( nPartLen, nBufLen - nCurPos ) );
-
- xExtDocHandler->unknown( aLineFeed );
- xExtDocHandler->unknown( aPart );
- }
-
- delete[] pBuffer;
- }
-
- xExtDocHandler->unknown( B2UCONST( "\"/>" ) );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemImage, sal_True, sal_True );
}
}
}
@@@ -1850,10 -1751,19 +1995,21 @@@ void SVGActionWriter::WriteMetaFile( co
aMapMode.SetOrigin( aOffset += aMapMode.GetOrigin() );
mpVDev->SetMapMode( aMapMode );
+ ImplAcquireContext();
+
+ mapCurShape.reset();
+
+ ImplWriteActions( rMtf, nWriteFlags, pElementId );
- ImplWriteActions( rMtf, NULL, nWriteFlags );
+ // draw open shape that doesn't have a border
+ if( mapCurShape.get() )
+ {
+ ImplWriteShape( *mapCurShape );
+ mapCurShape.reset();
+ }
+ ImplReleaseContext();
mpVDev->Pop();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc filter/source/svg/svgwriter.hxx
index bb2c1bb,32c6648..b8bc2e2
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@@ -36,15 -38,28 +39,17 @@@
#include <tools/string.hxx>
#include <tools/urlobj.hxx>
#include <tools/stack.hxx>
-#ifndef _SALBTYPE_HXX
#include <vcl/salbtype.hxx>
-#endif
-#ifndef _GDIMTF_HXX
#include <vcl/gdimtf.hxx>
-#endif
-#ifndef _METAACT_HXX
#include <vcl/metaact.hxx>
-#endif
-#ifndef _METAACT_HXX
#include <vcl/metric.hxx>
-#endif
-#ifndef _VIRDEV_HXX
#include <vcl/virdev.hxx>
-#endif
-#ifndef _CVTGRF_HXX
#include <vcl/cvtgrf.hxx>
-#endif
+ #include <vcl/graphictools.hxx>
+ #include <vcl/rendergraphicrasterizer.hxx>
#include <xmloff/xmlexp.hxx>
#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/RuntimeException.hpp>
@@@ -77,41 -92,14 +82,15 @@@
#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
- #define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
+ #define B2UCONST( _def_pChar ) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
#define SVG_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" )
+ #define SVG_TINY_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG Tiny 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd\">" )
- #define SVGWRITER_WRITE_NONE 0x00000000
- #define SVGWRITER_WRITE_FILL 0x00000001
- #define SVGWRITER_WRITE_TEXT 0x00000002
- #define SVGWRITER_WRITE_ALL 0xFFFFFFFF
-
- // --------------
- // - FastString -
- // --------------
-
- class FastString
- {
- private:
-
- sal_uInt32 mnBufLen;
- sal_uInt32 mnCurLen;
- sal_uInt32 mnBufInc;
- sal_Unicode* mpBuffer;
- sal_uInt32 mnPartPos;
- rtl::OUString maString;
-
- public:
-
- FastString( sal_uInt32 nInitLen = 2048, sal_uInt32 nIncrement = 2048 );
- ~FastString();
-
- FastString& operator+=( const ::rtl::OUString& rStr );
-
- const ::rtl::OUString& GetString() const;
-
- sal_uInt32 GetLength() const { return mnCurLen; }
- void Clear() { mnCurLen = 0, maString = ::rtl::OUString(); }
- };
+ #define SVGWRITER_WRITE_NONE 0x00000000
+ #define SVGWRITER_WRITE_FILL 0x00000001
+ #define SVGWRITER_WRITE_TEXT 0x00000002
+ #define SVGWRITER_NO_SHAPE_COMMENTS 0x01000000
++#define SVGWRITER_WRITE_ALL 0xFFFFFFFF
// ----------------------
// - SVGAttributeWriter -
@@@ -131,20 -120,47 +111,46 @@@ private
SVGFontExport& mrFontExport;
SvXMLElementExport* mpElemFont;
SvXMLElementExport* mpElemPaint;
-
+
SVGAttributeWriter();
-
+
+ void ImplGetColorStr( const Color& rColor, ::rtl::OUString& rColorStr );
+ double ImplRound( double fVal, sal_Int32 nDecs = 3 );
+
public:
- SVGAttributeWriter( SvXMLExport& rExport, SVGFontExport& rFontExport );
+ SVGAttributeWriter( SVGExport& rExport, SVGFontExport& rFontExport );
virtual ~SVGAttributeWriter();
+ ::rtl::OUString GetFontStyle( const Font& rFont );
+ ::rtl::OUString GetColorStyle( const Color& rColor );
+ ::rtl::OUString GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo );
+ void AddColorAttr( const char* pColorAttrName, const char* pColorOpacityAttrName, const Color& rColor );
+ void AddGradientDef( const Rectangle& rObjRect,const Gradient& rGradient, ::rtl::OUString& rGradientId );
+ void AddPaintAttr( const Color& rLineColor, const Color& rFillColor,
+ const Rectangle* pObjBoundRect = NULL, const Gradient* pFillGradient = NULL );
+
+ void SetFontAttr( const Font& rFont );
+ };
- void SetFontAttr( const Font& rFont );
- void SetPaintAttr( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo = 0);
-// ----------------------
-// - SVGShapeDescriptor -
-// ----------------------
-
+ struct SVGShapeDescriptor
+ {
+ PolyPolygon maShapePolyPoly;
+ Color maShapeFillColor;
+ Color maShapeLineColor;
+ sal_Int32 mnStrokeWidth;
+ SvtGraphicStroke::DashArray maDashArray;
+ ::std::auto_ptr< Gradient > mapShapeGradient;
+ ::rtl::OUString maId;
+
+ // -------------------------------------------------------------------------
+
+ SVGShapeDescriptor() :
+ maShapeFillColor( Color( COL_TRANSPARENT ) ),
+ maShapeLineColor( Color( COL_TRANSPARENT ) ),
+ mnStrokeWidth( 0 )
+ {
+ }
};
// -------------------
@@@ -201,11 -217,7 +207,11 @@@ private
void ImplCheckFontAttributes();
void ImplCheckPaintAttributes();
- void ImplWriteActions( const GDIMetaFile& rMtf, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags );
+ void ImplWriteActions( const GDIMetaFile& rMtf, sal_uInt32 nWriteFlags, const ::rtl::OUString* pElementId );
+ sal_Int32 ImplGetNextClipId() { return mnCurClipId++; }
+ sal_Int32 ImplGetNextPatternId() { return mnCurPatternId++; }
+ sal_Int32 ImplGetNextGradientId() { return mnCurGradientId++; }
+ sal_Int32 ImplGetNextMaskId() { return mnCurMaskId++; }
public:
diff --cc oox/inc/oox/core/contexthandler.hxx
index 6885a97,ce15394..0bcc3d8
--- a/oox/inc/oox/core/contexthandler.hxx
+++ b/oox/inc/oox/core/contexthandler.hxx
@@@ -117,5 -116,3 +117,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/core/fasttokenhandler.hxx
index db01157,ad1746d..891f69a
--- a/oox/inc/oox/core/fasttokenhandler.hxx
+++ b/oox/inc/oox/core/fasttokenhandler.hxx
@@@ -72,5 -71,3 +72,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/core/filterbase.hxx
index def9ec2,409152f..de49389
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@@ -317,5 -308,3 +317,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/core/fragmenthandler.hxx
index c99f56b,3ee6c24..a563607
--- a/oox/inc/oox/core/fragmenthandler.hxx
+++ b/oox/inc/oox/core/fragmenthandler.hxx
@@@ -135,5 -134,3 +135,5 @@@ typedef ::rtl::Reference< FragmentHandl
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/core/relations.hxx
index 4dccb9d,138faa3..49767d3
mode 100644,100755..100644
--- a/oox/inc/oox/core/relations.hxx
+++ b/oox/inc/oox/core/relations.hxx
@@@ -106,6 -105,4 +106,6 @@@ private
} // namespace core
} // namespace oox
-#endif
+#endif // OOX_CORE_RELATIONS
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/core/relationshandler.hxx
index a6f60d2,4d813e4..739ceb4
--- a/oox/inc/oox/core/relationshandler.hxx
+++ b/oox/inc/oox/core/relationshandler.hxx
@@@ -58,6 -57,4 +58,6 @@@ private
} // namespace core
} // namespace oox
-#endif
+#endif // OOX_CORE_RELATIONSHANDLER
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
index 37a4983,9b495c7..502563e
--- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
+++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
@@@ -121,5 -119,3 +120,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/drawingml/chart/converterbase.hxx
index 25238ab,af4530e..ade53fe
--- a/oox/inc/oox/drawingml/chart/converterbase.hxx
+++ b/oox/inc/oox/drawingml/chart/converterbase.hxx
@@@ -157,5 -155,3 +156,5 @@@ public
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/helper/binaryinputstream.hxx
index e593ded,062ff6b..e2c4f7d
--- a/oox/inc/oox/helper/binaryinputstream.hxx
+++ b/oox/inc/oox/helper/binaryinputstream.hxx
@@@ -289,5 -453,3 +454,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/helper/binaryoutputstream.hxx
index c99cac2,8fd5ca4..6cc7909
--- a/oox/inc/oox/helper/binaryoutputstream.hxx
+++ b/oox/inc/oox/helper/binaryoutputstream.hxx
@@@ -159,5 -176,3 +177,5 @@@ public
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/helper/binarystreambase.hxx
index 2525c21,2573f69..ffa3c0b
--- a/oox/inc/oox/helper/binarystreambase.hxx
+++ b/oox/inc/oox/helper/binarystreambase.hxx
@@@ -145,5 -190,3 +191,5 @@@ protected
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/helper/helper.hxx
index 6747367,0431ec9..28b1c0d
--- a/oox/inc/oox/helper/helper.hxx
+++ b/oox/inc/oox/helper/helper.hxx
@@@ -327,5 -334,3 +339,5 @@@ inline void ByteOrderConverter::swap8(
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/helper/modelobjecthelper.hxx
index bddad57,86729f3..15bb9bf
--- a/oox/inc/oox/helper/modelobjecthelper.hxx
+++ b/oox/inc/oox/helper/modelobjecthelper.hxx
@@@ -128,5 -127,3 +128,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/helper/propertyset.hxx
index f03a941,22c78fe..6db094a
--- a/oox/inc/oox/helper/propertyset.hxx
+++ b/oox/inc/oox/helper/propertyset.hxx
@@@ -92,15 -95,13 +96,12 @@@ public
/** Gets the specified property from the property set.
@return true, if the passed variable could be filled with the property value. */
template< typename Type >
- inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const;
-
- /** Gets the specified property from the property set.
- @return the property value, or an empty Any, if the property is missing. */
- ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
+ inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const
+ { return getAnyProperty( nPropId ) >>= orValue; }
/** Gets the specified boolean property from the property set.
- @return true = property contains true; false = property contains false or error occured. */
- inline bool getBoolProperty( sal_Int32 nPropId ) const
- { bool bValue = false; return getProperty( bValue, nPropId ) && bValue; }
+ @return true = property contains true; false = property contains false or error occurred. */
+ bool getBoolProperty( sal_Int32 nPropId ) const;
/** Gets the specified properties from the property set. Tries to use the XMultiPropertySet interface.
@param orValues (out-parameter) The related property values.
diff --cc oox/inc/oox/helper/textinputstream.hxx
index b3256bd,e4358a8..545ba50
mode 100644,100755..100755
--- a/oox/inc/oox/helper/textinputstream.hxx
+++ b/oox/inc/oox/helper/textinputstream.hxx
@@@ -56,5 -126,3 +127,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/ole/axbinaryreader.hxx
index 7a05eeb,7322624..9dcae3a
--- a/oox/inc/oox/ole/axbinaryreader.hxx
+++ b/oox/inc/oox/ole/axbinaryreader.hxx
@@@ -297,5 -302,3 +303,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/ole/oleobjecthelper.hxx
index b82f850,17c0a39..131eeca
--- a/oox/inc/oox/ole/oleobjecthelper.hxx
+++ b/oox/inc/oox/ole/oleobjecthelper.hxx
@@@ -84,5 -83,3 +84,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/ole/olestorage.hxx
index 315b948,f3ffaec..6f57565
mode 100644,100755..100755
--- a/oox/inc/oox/ole/olestorage.hxx
+++ b/oox/inc/oox/ole/olestorage.hxx
diff --cc oox/inc/oox/ole/vbacontrol.hxx
index 9f7ef22,9adf204..0c7d880
--- a/oox/inc/oox/ole/vbacontrol.hxx
+++ b/oox/inc/oox/ole/vbacontrol.hxx
@@@ -197,14 -200,13 +197,14 @@@ public
/** Imports the form and its embedded controls, and inserts the form with
all its controls into the passed dialog library. */
void importForm(
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxDialogLib,
- StorageBase& rVbaFormStrg,
- const ::rtl::OUString& rModuleName,
- rtl_TextEncoding eTextEnc );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxDialogLib,
+ StorageBase& rVbaFormStrg,
+ const ::rtl::OUString& rModuleName,
+ rtl_TextEncoding eTextEnc );
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
ControlConverter maConverter;
};
diff --cc oox/inc/oox/ole/vbainputstream.hxx
index 84edca6,6b40d6c..1a696d4
--- a/oox/inc/oox/ole/vbainputstream.hxx
+++ b/oox/inc/oox/ole/vbainputstream.hxx
@@@ -70,5 -78,3 +79,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/ole/vbamodule.hxx
index a0fc68a,57a1de3..2e83b3e
mode 100644,100755..100755
--- a/oox/inc/oox/ole/vbamodule.hxx
+++ b/oox/inc/oox/ole/vbamodule.hxx
diff --cc oox/inc/oox/vml/vmldrawing.hxx
index 42abebf,af5b196..521d8ef
--- a/oox/inc/oox/vml/vmldrawing.hxx
+++ b/oox/inc/oox/vml/vmldrawing.hxx
@@@ -215,5 -214,3 +215,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/vml/vmlformatting.hxx
index c4fd894,b85ec9c..0abc86e
--- a/oox/inc/oox/vml/vmlformatting.hxx
+++ b/oox/inc/oox/vml/vmlformatting.hxx
@@@ -218,5 -214,3 +215,5 @@@ struct FillMode
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/vml/vmlinputstream.hxx
index 9f38d72,415b8c3..177028e
--- a/oox/inc/oox/vml/vmlinputstream.hxx
+++ b/oox/inc/oox/vml/vmlinputstream.hxx
@@@ -67,5 -102,3 +103,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/xls/biffhelper.hxx
index d65b586,5ed0180..46d1775
--- a/oox/inc/oox/xls/biffhelper.hxx
+++ b/oox/inc/oox/xls/biffhelper.hxx
@@@ -667,5 -667,3 +668,5 @@@ inline SequenceInputStream& operator>>
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/xls/biffinputstream.hxx
index a5a1c0d,078f782..1f7ba3f
--- a/oox/inc/oox/xls/biffinputstream.hxx
+++ b/oox/inc/oox/xls/biffinputstream.hxx
@@@ -445,5 -434,3 +435,5 @@@ public
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/xls/biffoutputstream.hxx
index 0158605,b2e96ce..eb5d0f6
--- a/oox/inc/oox/xls/biffoutputstream.hxx
+++ b/oox/inc/oox/xls/biffoutputstream.hxx
@@@ -163,5 -156,3 +157,5 @@@ private
} // namespace oox
#endif
+
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc oox/inc/oox/xls/chartsheetfragment.hxx
index ddf2859,3d89ace..e96060a
--- a/oox/inc/oox/xls/chartsheetfragment.hxx
+++ b/oox/inc/oox/xls/chartsheetfragment.hxx
@@@ -82,5 -78,3 +79,5 @@@ public
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list