summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/inc/filter/msfilter/msvbahelper.hxx2
-rw-r--r--filter/prj/build.lst6
-rw-r--r--filter/source/config/fragments/fcfg_drawgraphics.mk1
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu4
-rw-r--r--filter/source/flash/swfwriter1.cxx14
-rw-r--r--filter/source/graphicfilter/eos2met/eos2met.cxx79
-rw-r--r--filter/source/graphicfilter/epict/epict.cxx24
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx25
-rw-r--r--filter/source/msfilter/msvbahelper.cxx58
-rw-r--r--filter/source/pdf/impdialog.src4
-rw-r--r--filter/source/svg/impsvgdialog.cxx150
-rw-r--r--filter/source/svg/impsvgdialog.hxx96
-rw-r--r--filter/source/svg/makefile.mk10
-rw-r--r--filter/source/svg/svgdialog.cxx275
-rw-r--r--filter/source/svg/svgdialog.hxx120
-rw-r--r--filter/source/svg/svgexport.cxx308
-rw-r--r--filter/source/svg/svgfilter.cxx12
-rw-r--r--filter/source/svg/svgfilter.hxx90
-rw-r--r--filter/source/svg/svgfontexport.cxx230
-rw-r--r--filter/source/svg/svgfontexport.hxx26
-rw-r--r--filter/source/svg/svguno.cxx79
-rw-r--r--filter/source/svg/svgwriter.cxx1537
-rw-r--r--filter/source/svg/svgwriter.hxx172
23 files changed, 2265 insertions, 1057 deletions
diff --git a/filter/inc/filter/msfilter/msvbahelper.hxx b/filter/inc/filter/msfilter/msvbahelper.hxx
index 04fb21c57a14..affc8b227346 100644
--- a/filter/inc/filter/msfilter/msvbahelper.hxx
+++ b/filter/inc/filter/msfilter/msvbahelper.hxx
@@ -51,6 +51,8 @@ struct MSFILTER_DLLPUBLIC MacroResolvedInfo
MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName );
MSFILTER_DLLPUBLIC ::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl );
+MSFILTER_DLLPUBLIC ::rtl::OUString getDefaultProjectName( SfxObjectShell* pShell );
+MSFILTER_DLLPUBLIC ::rtl::OUString resolveVBAMacro( SfxObjectShell* pShell, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModuleName, const ::rtl::OUString& rMacroName );
MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const ::rtl::OUString& rMacroName, bool bSearchGlobalTemplates = false );
MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
diff --git a/filter/prj/build.lst b/filter/prj/build.lst
index 0c8d77bed28f..95cfeb906e75 100644
--- a/filter/prj/build.lst
+++ b/filter/prj/build.lst
@@ -9,12 +9,12 @@ fl filter\source\msfilter\powerpoint nmake - all fl_powerpoint fl_inc NULL
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 --git a/filter/source/config/fragments/fcfg_drawgraphics.mk b/filter/source/config/fragments/fcfg_drawgraphics.mk
index 41a46254b871..40e6f3fde303 100644
--- a/filter/source/config/fragments/fcfg_drawgraphics.mk
+++ b/filter/source/config/fragments/fcfg_drawgraphics.mk
@@ -53,6 +53,7 @@ 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 \
diff --git a/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu
index 339323757332..5e21c033947f 100644
--- a/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu
@@ -1,7 +1,7 @@
<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>
- <prop oor:name="RealFilterName"/>
+ <prop oor:name="FormatName"><value>SVISVG</value></prop>
+ <prop oor:name="RealFilterName"><value>SVG - Scalable Vector Graphics</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="UIName">
<value xml:lang="en-US">SVG - Scalable Vector Graphics</value>
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 6d562f042a61..ebb5238cc954 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -41,6 +41,7 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svtools/filter.hxx>
#include <vcl/graphictools.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
#ifndef _ZLIB_H
#ifdef SYSTEM_ZLIB
@@ -1863,6 +1864,19 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
}
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 ):
{
bMap++;
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index 1c34d7a28d09..8d1fd7449300 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -45,8 +45,10 @@
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
#include <svl/solar.hrc>
+
// -----------------------------Feld-Typen-------------------------------
#define BegDocumnMagic 0xA8A8 /* Begin Document */
@@ -165,6 +167,9 @@ private:
sal_uLong nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps
sal_uLong nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist.
+ ::std::auto_ptr< VirtualDevice > apDummyVDev;
+ OutputDevice* pCompDev;
+
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
void MayCallback();
@@ -204,7 +209,7 @@ private:
void METSetAndPushLineInfo( const LineInfo& rLineInfo );
void METPopLineInfo( const LineInfo& rLineInfo );
- void METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap);
+ void METBitBlt(Point aPt, Size aSize, const Size& rSizePixel);
void METBeginArea(sal_Bool bBoundaryLine);
void METEndArea();
void METBeginPath(sal_uInt32 nPathId);
@@ -243,7 +248,18 @@ private:
public:
- METWriter() {}
+ METWriter() :
+ pCompDev( NULL )
+ {
+#ifndef NO_GETAPPWINDOW
+ pCompDev = reinterpret_cast< OutputDevice* >( Application::GetAppWindow() );
+#endif
+ if( !pCompDev )
+ {
+ apDummyVDev.reset( new VirtualDevice );
+ pCompDev = apDummyVDev.get();
+ }
+ }
sal_Bool WriteMET( const GDIMetaFile & rMTF, SvStream & rTargetStream,
FilterConfigItem* pConfigItem );
@@ -312,6 +328,7 @@ void METWriter::CountActionsAndBitmaps(const GDIMetaFile * pMTF)
case META_BMPEX_ACTION:
case META_BMPEXSCALE_ACTION:
case META_BMPEXSCALEPART_ACTION:
+ case META_RENDERGRAPHIC_ACTION:
nNumberOfBitmaps++;
break;
}
@@ -335,7 +352,7 @@ void METWriter::WriteBigEndianLong(sal_uLong nLong)
void METWriter::WritePoint(Point aPt)
{
- Point aNewPt = OutputDevice::LogicToLogic( aPt, aPictureMapMode, aTargetMapMode );
+ Point aNewPt = pCompDev->LogicToLogic( aPt, aPictureMapMode, aTargetMapMode );
*pMET << (long) ( aNewPt.X() - aPictureRect.Left() )
<< (long) ( aPictureRect.Bottom() - aNewPt.Y() );
@@ -784,6 +801,17 @@ void METWriter::WriteImageObjects(const GDIMetaFile * pMTF)
}
}
break;
+
+ case( META_RENDERGRAPHIC_ACTION ):
+ {
+ const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
+ const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
+ const BitmapEx aBmpEx( aRasterizer.Rasterize( pCompDev->LogicToPixel( pA->GetSize() ) ) );
+
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( Graphic( aBmpEx ).GetBitmap() );
+ }
+ break;
}
if (bStatus==sal_False)
@@ -1128,7 +1156,7 @@ void METWriter::WillWriteOrder(sal_uLong nNextOrderMaximumLength)
-void METWriter::METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap)
+void METWriter::METBitBlt(Point aPt, Size aSize, const Size& rBmpSizePixel)
{
WillWriteOrder(46);
*pMET << (sal_uInt8)0xd6 << (sal_uInt8)44 << (sal_uInt16)0 << (sal_uInt16) 0x00cc;
@@ -1137,13 +1165,13 @@ void METWriter::METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap)
WritePoint(Point(aPt.X(),aPt.Y()+aSize.Height()));
WritePoint(Point(aPt.X()+aSize.Width(),aPt.Y()));
*pMET << (sal_uInt32)0 << (sal_uInt32)0
- << (sal_uInt32)(rBitmap.GetSizePixel().Width())
- << (sal_uInt32)(rBitmap.GetSizePixel().Height());
+ << (sal_uInt32)(rBmpSizePixel.Width())
+ << (sal_uInt32)(rBmpSizePixel.Height());
}
void METWriter::METSetAndPushLineInfo( const LineInfo& rLineInfo )
{
- sal_Int32 nWidth = OutputDevice::LogicToLogic( Size( rLineInfo.GetWidth(),0 ), aPictureMapMode, aTargetMapMode ).Width();
+ sal_Int32 nWidth = pCompDev->LogicToLogic( Size( rLineInfo.GetWidth(),0 ), aPictureMapMode, aTargetMapMode ).Width();
WillWriteOrder( 8 ); // set stroke linewidth
*pMET << (sal_uInt8)0x15
@@ -1969,10 +1997,11 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
case META_BMP_ACTION:
{
- const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
+ const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
+ const Size aSizePixel( pA->GetBitmap().GetSizePixel() );
METSetMix(eGDIRasterOp);
- METBitBlt( pA->GetPoint(), pA->GetBitmap().GetSizePixel(), pA->GetBitmap() );
+ METBitBlt( pA->GetPoint(), pCompDev->PixelToLogic( aSizePixel, aPictureMapMode ), aSizePixel );
}
break;
@@ -1981,7 +2010,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA;
METSetMix(eGDIRasterOp);
- METBitBlt( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() );
+ METBitBlt( pA->GetPoint(), pA->GetSize(), pA->GetBitmap().GetSizePixel() );
}
break;
@@ -1992,27 +2021,27 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
METSetMix( eGDIRasterOp );
- METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
+ METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), pA->GetBitmap().GetSizePixel() );
}
break;
case META_BMPEX_ACTION:
{
const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA;
- Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+ const Size aSizePixel( pA->GetBitmapEx().GetSizePixel() );
- METSetMix(eGDIRasterOp);
- METBitBlt( pA->GetPoint(), aTmp.GetSizePixel(), aTmp );
+ METSetMix( eGDIRasterOp );
+ METBitBlt( pA->GetPoint(), pCompDev->PixelToLogic( aSizePixel, aPictureMapMode ), aSizePixel );
}
break;
case META_BMPEXSCALE_ACTION:
{
const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
- Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+ const Size aSizePixel( pA->GetBitmapEx().GetSizePixel() );
- METSetMix(eGDIRasterOp);
- METBitBlt( pA->GetPoint(), pA->GetSize(), aTmp );
+ METSetMix( eGDIRasterOp );
+ METBitBlt( pA->GetPoint(), pA->GetSize(), aSizePixel );
}
break;
@@ -2022,8 +2051,8 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
- METSetMix(eGDIRasterOp);
- METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
+ METSetMix( eGDIRasterOp );
+ METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp.GetSizePixel() );
}
break;
@@ -2040,7 +2069,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
{
const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct;
METSetMix(eGDIRasterOp);
- METBitBlt( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() );
+ METBitBlt( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap().GetSizePixel() );
break;
}
}
@@ -2306,6 +2335,15 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
WriteOrders( &aTmpMtf );
}
break;
+
+ case( META_RENDERGRAPHIC_ACTION ):
+ {
+ const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
+
+ METSetMix( eGDIRasterOp );
+ METBitBlt( pA->GetPoint(), pA->GetSize(), pCompDev->LogicToPixel( pA->GetSize(), pMTF->GetPrefMapMode() ) );
+ }
+ break;
}
nWrittenActions++;
@@ -2569,5 +2607,4 @@ extern "C" sal_Bool __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic &
}
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index 2e8488df3fb4..3d48fdb74640 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -47,6 +47,7 @@
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/gdimtf.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
#include <tools/bigint.hxx>
@@ -227,6 +228,7 @@ void PictWriter::CountActionsAndBitmaps(const GDIMetaFile & rMTF)
case META_BMPEX_ACTION:
case META_BMPEXSCALE_ACTION:
case META_BMPEXSCALEPART_ACTION:
+ case META_RENDERGRAPHIC_ACTION:
nNumberOfBitmaps++;
break;
}
@@ -1808,8 +1810,11 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
case META_BMP_ACTION:
{
- const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
- WriteOpcode_BitsRect( pA->GetPoint(),pA->GetBitmap().GetSizePixel(), pA->GetBitmap() );
+ const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
+ const Bitmap aBmp( pA->GetBitmap() );
+ VirtualDevice aVirDev;
+
+ WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
}
break;
@@ -1834,8 +1839,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
{
const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA;
const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+ VirtualDevice aVirDev;
- WriteOpcode_BitsRect( pA->GetPoint(), aBmp.GetSizePixel(), aBmp );
+ WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
}
break;
@@ -2151,6 +2157,18 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
WriteOpcodes( aTmpMtf );
}
break;
+
+ case( META_RENDERGRAPHIC_ACTION ):
+ {
+ const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
+ const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
+ VirtualDevice aVirDev;
+ const Bitmap aBmp( Graphic( aRasterizer.Rasterize(
+ aVirDev.LogicToPixel( pA->GetSize() ) ) ).GetBitmap() );
+
+ WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), aBmp );
+ }
+ break;
}
nWrittenActions++;
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 76a904948b34..b277f7000b9b 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -49,6 +49,7 @@
#include <svtools/fltcall.hxx>
#include <svtools/FilterConfigItem.hxx>
#include <vcl/graphictools.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
#include "strings.hrc"
#include <math.h>
@@ -815,7 +816,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
if ( mbGrayScale )
aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
Point aPoint = ( (const MetaBmpAction*) pMA )->GetPoint();
- Size aSize = aBitmap.GetSizePixel();
+ Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) );
ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() );
}
break;
@@ -851,8 +852,8 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
if ( mbGrayScale )
aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
Bitmap aMask( aBitmapEx.GetMask() );
- Point aPoint = ( (const MetaBmpExAction*) pMA)->GetPoint();
- Size aSize = ( aBitmap.GetSizePixel() );
+ Point aPoint( ( (const MetaBmpExAction*) pMA )->GetPoint() );
+ Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) );
ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
}
break;
@@ -1365,6 +1366,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
case META_BMPSCALEPART_ACTION :
case META_BMPEXSCALE_ACTION :
case META_BMPEXSCALEPART_ACTION :
+ case META_RENDERGRAPHIC_ACTION :
{
nBitmapCount++;
nBitmapAction = nCurAction;
@@ -1423,6 +1425,23 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
}
}
break;
+
+ case( META_RENDERGRAPHIC_ACTION ):
+ {
+ const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
+ const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
+ const BitmapEx aBmpEx( aRasterizer.Rasterize( rVDev.LogicToPixel( pA->GetSize() ) ) );
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+
+ if ( mbGrayScale )
+ aBmp.Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ Bitmap aMask( aBmpEx.GetMask() );
+ Size aSize( pA->GetSize() );
+
+ ImplBmp( &aBmp, &aMask, pA->GetPoint(), aSize.Width(), aSize.Height() );
+ }
+ break;
}
}
}
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 91fb81c96153..4da876016481 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -39,6 +39,7 @@
#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>
@@ -172,6 +173,7 @@ SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
// sMod can be empty ( but we really need the library to search in )
// if sMod is empty and a macro is found then sMod is updated
+// if sMod is empty, only standard modules will be searched (no class, document, form modules)
bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro )
{
bool bFound = false;
@@ -211,8 +213,12 @@ bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, con
{
if( SbModule* pModule = pMethod->GetModule() )
{
- sMod = pModule->GetName();
- bFound = true;
+ // when searching for a macro without module name, do not search in class/document/form modules
+ if( pModule->GetModuleType() == script::ModuleType::NORMAL )
+ {
+ sMod = pModule->GetName();
+ bFound = true;
+ }
}
}
}
@@ -220,6 +226,19 @@ bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, con
}
return bFound;
}
+
+::rtl::OUString getDefaultProjectName( SfxObjectShell* pShell )
+{
+ ::rtl::OUString aPrjName;
+ if( BasicManager* pBasicMgr = pShell ? pShell->GetBasicManager() : 0 )
+ {
+ aPrjName = pBasicMgr->GetName();
+ if( aPrjName.getLength() == 0 )
+ aPrjName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ }
+ return aPrjName;
+}
+
void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModule, String& sProcedure )
{
sal_Int32 nMacroDot = sMacro.lastIndexOf( '.' );
@@ -241,6 +260,18 @@ void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModul
sProcedure = sMacro;
}
+::rtl::OUString resolveVBAMacro( SfxObjectShell* pShell, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModuleName, const ::rtl::OUString& rMacroName )
+{
+ if( pShell )
+ {
+ ::rtl::OUString aLibName = (rLibName.getLength() > 0) ? rLibName : getDefaultProjectName( pShell );
+ String aModuleName = rModuleName;
+ if( hasMacro( pShell, aLibName, aModuleName, rMacroName ) )
+ return ::rtl::OUStringBuffer( aLibName ).append( sal_Unicode( '.' ) ).append( aModuleName ).append( sal_Unicode( '.' ) ).append( rMacroName ).makeStringAndClear();
+ }
+ return ::rtl::OUString();
+}
+
MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& MacroName, bool bSearchGlobalTemplates )
{
if( !pShell )
@@ -284,18 +315,27 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString&
// macro format = Container.Module.Procedure
String sContainer, sModule, sProcedure;
parseMacro( aMacroName, sContainer, sModule, sProcedure );
- uno::Reference< container::XNameContainer > xPrjNameCache;
+#if 0
// As long as service VBAProjectNameProvider isn't supported in the model, disable the createInstance call
// (the ServiceNotRegisteredException is wrongly caught in ScModelObj::createInstance)
- //uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY);
- //if ( xSF.is() )
- // xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xPrjNameCache;
+ uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY);
+ if ( xSF.is() ) try
+ {
+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
+ }
+ catch( uno::Exception& ) // createInstance may throw
+ {
+ }
+#endif
std::vector< rtl::OUString > sSearchList;
if ( sContainer.Len() > 0 )
{
+// service VBAProjectNameProvider not implemented
+#if 0
// get the Project associated with the Container
if ( xPrjNameCache.is() )
{
@@ -306,6 +346,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString&
sContainer = sProject;
}
}
+#endif
sSearchList.push_back( sContainer ); // First Lib to search
}
else
@@ -322,6 +363,9 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString&
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?
@@ -378,7 +422,9 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString&
}
}
+#endif
}
+
std::vector< rtl::OUString >::iterator it_end = sSearchList.end();
for ( std::vector< rtl::OUString >::iterator it = sSearchList.begin(); !aRes.mbFound && (it != it_end); ++it )
{
diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src
index 35cfa93dd854..e65e4dd5da57 100644
--- a/filter/source/pdf/impdialog.src
+++ b/filter/source/pdf/impdialog.src
@@ -615,7 +615,7 @@ TabPage RID_PDF_TAB_SECURITY
String STR_USER_PWD_PDFA
{
- Text [en-US] = "PDF doument will not be encrypted due to PDF/A export.";
+ Text [en-US] = "PDF document will not be encrypted due to PDF/A export.";
};
FixedText FT_OWNER_PWD
@@ -646,7 +646,7 @@ TabPage RID_PDF_TAB_SECURITY
String STR_OWNER_PWD_PDFA
{
- Text [en-US] = "PDF doument will not be restricted due to PDF/A export.";
+ Text [en-US] = "PDF document will not be restricted due to PDF/A export.";
};
//////////////////////////////
diff --git a/filter/source/svg/impsvgdialog.cxx b/filter/source/svg/impsvgdialog.cxx
new file mode 100644
index 000000000000..7a4f083160a3
--- /dev/null
+++ b/filter/source/svg/impsvgdialog.cxx
@@ -0,0 +1,150 @@
+ /*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: impsvgdialog.cxx,v $
+ *
+ * $Revision: 1.1.2.3 $
+ *
+ * last change: $Author: ka $ $Date: 2007/06/15 14:36:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "impsvgdialog.hxx"
+#include <cstdio>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+inline sal_Int32 implMap( Window& /*rWnd*/, sal_Int32 nVal )
+{
+ //return( rWnd.LogicToLogic( Size( nVal, nVal ) ).Height(), MAP_APPFONT, MAP_APPFONT );
+ return( nVal << 1 );
+}
+
+// ----------------
+// - ImpSVGDialog -
+// ----------------
+
+ImpSVGDialog::ImpSVGDialog( Window* pParent/*, ResMgr& rResMgr*/, Sequence< PropertyValue >& rFilterData ) :
+ ModalDialog( pParent/*KA, ResId( DLG_OPTIONS, &rResMgr*/ ),
+ maFI( this ),
+ maCBTinyProfile( this ),
+ maCBEmbedFonts( this ),
+ maCBUseNativeDecoration( this ),
+ maBTOK( this, WB_DEF_OK ),
+ maBTCancel( this ),
+ maBTHelp( this ),
+ maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( SVG_EXPORTFILTER_CONFIGPATH ) ), &rFilterData ),
+ mbOldNativeDecoration( sal_False )
+{
+ SetText( String( RTL_CONSTASCII_USTRINGPARAM( "SVG Export Options" ) ) );
+ SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) );
+
+ maFI.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Export" ) ) );
+ maFI.SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
+ Size( implMap( *this, 165 ), implMap( *this, 8 ) ) );
+
+ maCBTinyProfile.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Use SVG Tiny profile" ) ) );
+ maCBTinyProfile.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
+ Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
+
+ maCBEmbedFonts.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Embed fonts" ) ) );
+ maCBEmbedFonts.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
+ Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
+
+ maCBUseNativeDecoration.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Use SVG native text decoration" ) ) );
+ maCBUseNativeDecoration.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
+ Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
+
+ maCBTinyProfile.Check( maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_TINYPROFILE ) ), sal_False ) );
+ maCBEmbedFonts.Check( maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_EMBEDFONTS ) ), sal_True ) );
+ maCBUseNativeDecoration.Check( maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_NATIVEDECORATION ) ), sal_True ) );
+
+ maBTOK.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
+ Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
+ maBTCancel.SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
+ Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
+ maBTHelp.SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
+ Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
+
+ maCBTinyProfile.SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
+ OnToggleCheckbox( &maCBTinyProfile );
+
+ maFI.Show();
+
+ maCBTinyProfile.Show();
+ maCBEmbedFonts.Show();
+ maCBUseNativeDecoration.Show();
+
+ maBTOK.Show();
+ maBTCancel.Show();
+ maBTHelp.Show();
+}
+
+// -----------------------------------------------------------------------------
+
+ImpSVGDialog::~ImpSVGDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
+{
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_TINYPROFILE ) ), maCBTinyProfile.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_EMBEDFONTS ) ), maCBEmbedFonts.IsChecked() );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_NATIVEDECORATION ) ), maCBUseNativeDecoration.IsChecked() );
+
+ return( maConfigItem.GetFilterData() );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ImpSVGDialog, OnToggleCheckbox, CheckBox*, pBox )
+{
+ if( pBox == &maCBTinyProfile )
+ {
+ if( pBox->IsChecked() )
+ {
+ mbOldNativeDecoration = maCBUseNativeDecoration.IsChecked();
+
+ maCBUseNativeDecoration.Check( sal_False );
+ maCBUseNativeDecoration.Disable();
+ }
+ else
+ {
+ maCBUseNativeDecoration.Enable();
+ maCBUseNativeDecoration.Check( mbOldNativeDecoration );
+ }
+ }
+
+ return 0;
+}
diff --git a/filter/source/svg/impsvgdialog.hxx b/filter/source/svg/impsvgdialog.hxx
new file mode 100644
index 000000000000..f7849c994b9e
--- /dev/null
+++ b/filter/source/svg/impsvgdialog.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: impsvgdialog.hxx,v $
+ *
+ * $Revision: 1.1.2.5 $
+ *
+ * last change: $Author: ka $ $Date: 2006/03/24 10:57:24 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef IMPSVGDIALOG_HXX
+#define IMPSVGDIALOG_HXX
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svtools/FilterConfigItem.hxx>
+
+#define SVG_EXPORTFILTER_CONFIGPATH "Office.Common/Filter/SVG/Export/"
+#define SVG_PROP_TINYPROFILE "TinyMode"
+#define SVG_PROP_EMBEDFONTS "EmbedFonts"
+#define SVG_PROP_NATIVEDECORATION "UseNativeTextDecoration"
+#define SVG_PROP_GLYPHPLACEMENT "GlyphPlacement"
+#define SVG_PROP_OPACITY "Opacity"
+#define SVG_PROP_GRADIENT "Gradient"
+
+// ----------------
+// - ImpSVGDialog -
+// ----------------
+
+class ResMgr;
+class Window;
+
+class ImpSVGDialog : public ModalDialog
+{
+private:
+
+ FixedLine maFI;
+ CheckBox maCBTinyProfile;
+ CheckBox maCBEmbedFonts;
+ CheckBox maCBUseNativeDecoration;
+
+ OKButton maBTOK;
+ CancelButton maBTCancel;
+ HelpButton maBTHelp;
+
+ FilterConfigItem maConfigItem;
+ sal_Bool mbOldNativeDecoration;
+
+ DECL_LINK( OnToggleCheckbox, CheckBox* );
+
+public:
+
+ ImpSVGDialog( Window* pParent, /*ResMgr& rResMgr,*/
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData );
+ ~ImpSVGDialog();
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetFilterData();
+};
+
+#endif // IMPSVGDIALOG_HXX
diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk
index 6b30190d5d33..4c914539299d 100644
--- a/filter/source/svg/makefile.mk
+++ b/filter/source/svg/makefile.mk
@@ -2,10 +2,14 @@
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
+# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.10.110.6 $
+#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
@@ -42,6 +46,8 @@ VISIBILITY_HIDDEN=TRUE
SLOFILES= \
$(SLO)$/b2dellipse.obj \
$(SLO)$/parserfragments.obj \
+ $(SLO)$/svgdialog.obj \
+ $(SLO)$/impsvgdialog.obj \
$(SLO)$/svgexport.obj \
$(SLO)$/svgfilter.obj \
$(SLO)$/svgfontexport.obj \
@@ -65,11 +71,11 @@ CFLAGS+=-DUSE_MODERN_SPIRIT
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS=\
- $(EDITENGLIB) \
$(SVXCORELIB) \
$(BASEGFXLIB) \
$(XMLOFFLIB) \
$(SVTOOLLIB) \
+ $(EDITENGLIB) \
$(VCLLIB) \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
diff --git a/filter/source/svg/svgdialog.cxx b/filter/source/svg/svgdialog.cxx
new file mode 100644
index 000000000000..a3054537b7b4
--- /dev/null
+++ b/filter/source/svg/svgdialog.cxx
@@ -0,0 +1,275 @@
+ /*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: svgdialog.cxx,v $
+ *
+ * $Revision: 1.1.2.3 $
+ *
+ * last change: $Author: ka $ $Date: 2008/05/19 10:12:43 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "svgdialog.hxx"
+#include "impsvgdialog.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/dialog.hxx>
+
+#ifndef _COM_SUN_STAR_VIEW_XRENDERABLE_HPP_
+#include <com/sun/star/view/XRenderable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
+#include <com/sun/star/frame/XController.hpp>
+#endif
+#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#endif
+
+#define SVG_DIALOG_SERVICE_NAME "com.sun.star.comp.Draw.SVGFilterDialog"
+#define SVG_DIALOG_IMPLEMENTATION_NAME SVG_DIALOG_SERVICE_NAME
+#define SVG_FILTER_DATA_NAME "FilterData"
+
+using namespace ::rtl;
+using namespace ::vcl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::document;
+
+// -----------------------
+// - SVGDialog functions -
+// -----------------------
+
+OUString SVGDialog_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( SVG_DIALOG_IMPLEMENTATION_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL SVGDialog_getImplementationId()
+ throw(RuntimeException)
+{
+ static const ::cppu::OImplementationId aId;
+
+ return( aId.getImplementationId() );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SVGDialog_getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ Sequence< OUString > aRet( 1 );
+
+ aRet.getArray()[ 0 ] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SVG_DIALOG_SERVICE_NAME ) );
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SVGDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr )
+ throw( Exception )
+{
+ return( static_cast< cppu::OWeakObject* >( new SVGDialog( rSMgr ) ) );
+}
+
+// -------------
+// - SVGDialog -
+// -------------
+
+SVGDialog::SVGDialog( const Reference< XMultiServiceFactory > &rxMSF ) :
+ OGenericUnoDialog( rxMSF )
+{
+ ByteString aResMgrName( "svgfilter" );
+
+ aResMgrName.Append( ByteString::CreateFromInt32( 0/*SOLARUPD*/ ) );
+
+ // !!! KA: enable ResMgr
+ // mapResMgr.reset( ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ) );
+}
+
+// -----------------------------------------------------------------------------
+
+SVGDialog::~SVGDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL SVGDialog::queryInterface( const Type& rType )
+ throw (RuntimeException)
+{
+ Any aReturn( OGenericUnoDialog::queryInterface( rType ) );
+
+ if( !aReturn.hasValue() )
+ {
+ aReturn = ::cppu::queryInterface( rType, static_cast< XPropertyAccess* >( this ),
+ static_cast< XExporter* >( this ) );
+ }
+
+ return( aReturn );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGDialog::acquire()
+ throw ()
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGDialog::release()
+ throw ()
+{
+ OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL SVGDialog::getImplementationId()
+ throw(RuntimeException)
+{
+ return SVGDialog_getImplementationId();
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL SVGDialog::getImplementationName()
+ throw (RuntimeException)
+{
+ return SVGDialog_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ return SVGDialog_getSupportedServiceNames();
+}
+
+// -----------------------------------------------------------------------------
+
+Dialog* SVGDialog::createDialog( Window* pParent )
+{
+ return( ( /*KA: *mapResMgr.get() &&*/ mxSrcDoc.is() ) ?
+ new ImpSVGDialog( pParent/*KA: , *mapResMgr*/, maFilterData ) :
+ NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGDialog::executedDialog( sal_Int16 nExecutionResult )
+{
+ if( nExecutionResult && m_pDialog )
+ maFilterData = static_cast< ImpSVGDialog* >( m_pDialog )->GetFilterData();
+
+ destroyDialog();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XPropertySetInfo > SAL_CALL SVGDialog::getPropertySetInfo()
+ throw(RuntimeException)
+{
+ return( Reference< XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) ) );
+}
+
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& SVGDialog::getInfoHelper()
+{
+ return( *const_cast< SVGDialog *>(this)->getArrayHelper() );
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* SVGDialog::createArrayHelper() const
+{
+ Sequence< Property > aProps;
+
+ describeProperties(aProps);
+
+ return new ::cppu::OPropertyArrayHelper( aProps );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > SAL_CALL SVGDialog::getPropertyValues()
+ throw ( RuntimeException )
+{
+ sal_Int32 i, nCount;
+
+ for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; ++i )
+ {
+ if( maMediaDescriptor[ i ].Name.equalsAscii( SVG_FILTER_DATA_NAME ) )
+ break;
+ }
+
+ if( i == nCount )
+ {
+ maMediaDescriptor.realloc( ++nCount );
+ maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( SVG_FILTER_DATA_NAME ) );
+ }
+
+ maMediaDescriptor[ i ].Value <<= maFilterData;
+
+ return( maMediaDescriptor );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
+ throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
+{
+ maMediaDescriptor = rProps;
+
+ for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+ {
+ if( maMediaDescriptor[ i ].Name.equalsAscii( SVG_FILTER_DATA_NAME ) )
+ {
+ maMediaDescriptor[ i ].Value >>= maFilterData;
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGDialog::setSourceDocument( const Reference< XComponent >& xDoc )
+ throw(IllegalArgumentException, RuntimeException)
+{
+ mxSrcDoc = xDoc;
+}
diff --git a/filter/source/svg/svgdialog.hxx b/filter/source/svg/svgdialog.hxx
new file mode 100644
index 000000000000..e0eff6494fb7
--- /dev/null
+++ b/filter/source/svg/svgdialog.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: svgdialog.hxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: ka $ $Date: 2006/03/08 08:18:10 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef SVGDIALOG_HXX
+#define SVGDIALOG_HXX
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XEXPORTER_HPP_
+#include <com/sun/star/document/XExporter.hpp>
+#endif
+
+#include <svtools/genericunodialog.hxx>
+#include <memory>
+
+// -------------
+// - SVGDialog -
+// -------------
+
+class ResMgr;
+
+class SVGDialog : public ::svt::OGenericUnoDialog,
+ public ::comphelper::OPropertyArrayUsageHelper< SVGDialog >,
+ public ::com::sun::star::beans::XPropertyAccess,
+ public ::com::sun::star::document::XExporter
+{
+private:
+
+ ::std::auto_ptr< ResMgr > mapResMgr;
+ com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > maMediaDescriptor;
+ com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > maFilterData;
+ com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxSrcDoc;
+
+protected:
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type& aType ) throw (com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // OGenericUnoDialog
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(com::sun::star::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
+ virtual Dialog* createDialog( Window* pParent );
+ virtual void executedDialog( sal_Int16 nExecutionResult );
+ virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // XPropertyAccess
+ using cppu::OPropertySetHelper::getPropertyValues;
+ virtual com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues( ) throw (com::sun::star::uno::RuntimeException);
+ using cppu::OPropertySetHelper::setPropertyValues;
+ virtual void SAL_CALL setPropertyValues( const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xDoc ) throw(com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
+
+public:
+
+ SVGDialog( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ virtual ~SVGDialog();
+};
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SVGDialog_getImplementationName ()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SVGDialog_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SVGDialog_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ SAL_CALL SVGDialog_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
+
+#endif // SVGDialog_HXX
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 19a6ce61eec6..6a523541c221 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -3,10 +3,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svgexport.cxx,v $
+ * $Revision: 1.12.62.15 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -34,8 +37,11 @@
#include "svgwriter.hxx"
#include "svgfontexport.hxx"
#include "svgfilter.hxx"
+#include "impsvgdialog.hxx"
+#include <svtools/FilterConfigItem.hxx>
#include <svx/unopage.hxx>
+#include <svx/unoshape.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdoutl.hxx>
#include <editeng/outliner.hxx>
@@ -48,12 +54,14 @@ using ::rtl::OUString;
// - SVGExport -
// -------------
-// #110680#
SVGExport::SVGExport(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const Reference< XDocumentHandler >& rxHandler )
-: SvXMLExport( xServiceFactory, OUString(), rxHandler )
+ const Reference< XDocumentHandler >& rxHandler,
+ const Sequence< PropertyValue >& rFilterData ) :
+ SvXMLExport( xServiceFactory, MAP_100TH_MM ),
+ mrFilterData( rFilterData )
{
+ SetDocHandler( rxHandler );
GetDocHandler()->startDocument();
}
@@ -64,6 +72,109 @@ SVGExport::~SVGExport()
GetDocHandler()->endDocument();
}
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGExport::IsUseTinyProfile() const
+{
+ sal_Bool bRet = sal_False;
+
+ if( mrFilterData.getLength() > 0 )
+ mrFilterData[ 0 ].Value >>= bRet;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGExport::IsEmbedFonts() const
+{
+ sal_Bool bRet = sal_False;
+
+ if( mrFilterData.getLength() > 1 )
+ mrFilterData[ 1 ].Value >>= bRet;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGExport::IsUseNativeTextDecoration() const
+{
+ sal_Bool bRet = !IsUseTinyProfile();
+
+ if( bRet && ( mrFilterData.getLength() > 2 ) )
+ mrFilterData[ 2 ].Value >>= bRet;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SVGExport::GetGlyphPlacement() const
+{
+ ::rtl::OUString aRet;
+
+ if( mrFilterData.getLength() > 3 )
+ mrFilterData[ 3 ].Value >>= aRet;
+ else
+ aRet = B2UCONST( "abs" );
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGExport::IsUseOpacity() const
+{
+ sal_Bool bRet = !IsUseTinyProfile();
+
+ if( !bRet && ( mrFilterData.getLength() > 4 ) )
+ mrFilterData[ 4 ].Value >>= bRet;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGExport::IsUseGradient() const
+{
+ sal_Bool bRet = !IsUseTinyProfile();
+
+ if( !bRet && ( mrFilterData.getLength() > 5 ) )
+ mrFilterData[ 5 ].Value >>= bRet;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGExport::pushClip( const ::basegfx::B2DPolyPolygon& rPolyPoly )
+{
+ maClipList.push_front( ::basegfx::tools::correctOrientations( rPolyPoly ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGExport::popClip()
+{
+ if( !maClipList.empty() )
+ maClipList.pop_front();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGExport::hasClip() const
+{
+ return( !maClipList.empty() );
+}
+
+// -----------------------------------------------------------------------------
+
+const ::basegfx::B2DPolyPolygon* SVGExport::getCurClip() const
+{
+ return( maClipList.empty() ? NULL : &( *maClipList.begin() ) );
+}
+
// ------------------------
// - ObjectRepresentation -
// ------------------------
@@ -109,7 +220,7 @@ ObjectRepresentation& ObjectRepresentation::operator=( const ObjectRepresentatio
// -----------------------------------------------------------------------------
-bool ObjectRepresentation::operator==( const ObjectRepresentation& rPresentation ) const
+sal_Bool ObjectRepresentation::operator==( const ObjectRepresentation& rPresentation ) const
{
return( ( mxObject == rPresentation.mxObject ) &&
( *mpMtf == *rPresentation.mpMtf ) );
@@ -130,6 +241,9 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OutputStream" ) ) )
@@ -146,7 +260,61 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
}
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() )
{
@@ -158,8 +326,7 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY );
Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
- if( xMasterPages.is() && xDrawPages->getCount() &&
- xDrawPages.is() && xDrawPages->getCount() )
+ if( xMasterPages.is() && xMasterPages->getCount() && xDrawPages.is() && xDrawPages->getCount() )
{
Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) );
@@ -170,7 +337,7 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
// #110680#
// mpSVGExport = new SVGExport( xDocHandler );
- mpSVGExport = new SVGExport( xServiceFactory, xDocHandler );
+ mpSVGExport = new SVGExport( xServiceFactory, xDocHandler, maFilterData );
if( nPageToExport < 0 || nPageToExport >= xDrawPages->getCount() )
nPageToExport = SVG_EXPORT_ALLPAGES;
@@ -293,8 +460,15 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP
xDefaultPagePropertySet->getPropertyValue( B2UCONST( "Height" ) ) >>= nDocHeight;
}
- if( xExtDocHandler.is() )
+ if( xExtDocHandler.is() && !mpSVGExport->IsUseTinyProfile() )
+ {
xExtDocHandler->unknown( SVG_DTD_STRING );
+ }
+
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "version", B2UCONST( "1.2" ) );
+
+ if( mpSVGExport->IsUseTinyProfile() )
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "baseProfile", B2UCONST( "tiny" ) );
#ifdef _SVG_WRITE_EXTENTS
aAttr = OUString::valueOf( nDocWidth * 0.01 );
@@ -311,11 +485,14 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP
aAttr += B2UCONST( " " );
aAttr += OUString::valueOf( nDocHeight );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "version", B2UCONST( "1.1" ) );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "preserveAspectRatio", B2UCONST( "xMidYMid" ) );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "fill-rule", B2UCONST( "evenodd" ) );
+ // standard line width is based on 1 pixel on a 90 DPI device (0.28222mmm)
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-width", OUString::valueOf( 28.222 ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-linejoin", B2UCONST( "round" ) );
+
if( !bSinglePage )
{
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:ooo", B2UCONST( "http://xml.openoffice.org/svg/export" ) );
@@ -327,6 +504,8 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns", B2UCONST( "http://www.w3.org/2000/svg" ) );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:xlink", B2UCONST( "http://www.w3.org/1999/xlink" ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xml:space", B2UCONST( "preserve" ) );
+
mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, "svg", sal_True, sal_True );
while( ( nCurPage <= nLastPage ) && ( -1 == nVisible ) )
@@ -373,9 +552,10 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP
++nCurPage;
}
-#ifdef _SVG_EMBED_FONTS
- mpSVGFontExport->EmbedFonts();
-#endif
+ if( mpSVGExport->IsEmbedFonts() )
+ {
+ mpSVGFontExport->EmbedFonts();
+ }
if( -1 != nVisible )
{
@@ -499,15 +679,26 @@ sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages,
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", aVisibility );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttr );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", implGetValidIDFromInterface( xShapes ) );
+ // 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 );
{
{
@@ -572,7 +763,7 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
if( xShapePropSet.is() )
{
const ::rtl::OUString aShapeType( rxShape->getShapeType() );
- bool bHideObj = false;
+ sal_Bool bHideObj = sal_False;
if( mbPresentation )
{
@@ -585,41 +776,41 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
if( xPagePropSetInfo.is() )
{
- static const ::rtl::OUString aHeaderString( B2UCONST( "IsHeaderVisible" ) );
- static const ::rtl::OUString aFooterString( B2UCONST( "IsFooterVisible" ) );
- static const ::rtl::OUString aDateTimeString( B2UCONST( "IsDateTimeVisible" ) );
- static const ::rtl::OUString aPageNumberString( B2UCONST( "IsPageNumberVisible" ) );
+ const ::rtl::OUString aHeaderString( B2UCONST( "IsHeaderVisible" ) );
+ const ::rtl::OUString aFooterString( B2UCONST( "IsFooterVisible" ) );
+ const ::rtl::OUString aDateTimeString( B2UCONST( "IsDateTimeVisible" ) );
+ const ::rtl::OUString aPageNumberString( B2UCONST( "IsPageNumberVisible" ) );
Any aProperty;
- bool bValue = sal_False;
+ sal_Bool bValue = sal_False;
if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.HeaderShape" ) ) != -1 ) &&
xPagePropSetInfo->hasPropertyByName( aHeaderString ) &&
( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aHeaderString ) ) >>= bValue ) &&
!bValue )
{
- bHideObj = true;
+ bHideObj = sal_True;
}
else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.FooterShape" ) ) != -1 ) &&
xPagePropSetInfo->hasPropertyByName( aFooterString ) &&
( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aFooterString ) ) >>= bValue ) &&
!bValue )
{
- bHideObj = true;
+ bHideObj = sal_True;
}
else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.DateTimeShape" ) ) != -1 ) &&
xPagePropSetInfo->hasPropertyByName( aDateTimeString ) &&
( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aDateTimeString ) ) >>= bValue ) &&
!bValue )
{
- bHideObj = true;
+ bHideObj = sal_True;
}
else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 ) &&
xPagePropSetInfo->hasPropertyByName( aPageNumberString ) &&
( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aPageNumberString ) ) >>= bValue ) &&
!bValue )
{
- bHideObj = true;
+ bHideObj = sal_True;
}
}
}
@@ -627,11 +818,6 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
if( !bHideObj )
{
- OUString aObjName( implGetValidIDFromInterface( rxShape ) ), aObjDesc;
-
- if( aObjName.getLength() )
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aObjName );
-
if( aShapeType.lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 )
{
Reference< XShapes > xShapes( rxShape, UNO_QUERY );
@@ -645,19 +831,23 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
}
}
- if( !bRet )
+ if( !bRet && mpObjects->find( rxShape ) != mpObjects->end() )
{
Reference< XText > xText( rxShape, UNO_QUERY );
::com::sun::star::awt::Rectangle aBoundRect;
const GDIMetaFile& rMtf = (*mpObjects)[ rxShape ].GetRepresentation();
xShapePropSet->getPropertyValue( B2UCONST( "BoundRect" ) ) >>= aBoundRect;
+
const Point aTopLeft( aBoundRect.X, aBoundRect.Y );
const Size aSize( aBoundRect.Width, aBoundRect.Height );
+ if( rMtf.GetActionSize() )
{
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", implGetClassFromShape( rxShape ) );
SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+ OUString aId( B2UCONST( "DrawingGroup_" ) );
+ OUString aObjName( implGetValidIDFromInterface( rxShape, true ) ), aObjDesc;
Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
@@ -677,7 +867,9 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
xExtDocHandler->characters( aDescription );
}
- if( rMtf.GetActionSize() )
+ if( aObjName.getLength() )
+ ( ( aId += B2UCONST( "(" ) ) += aObjName ) += B2UCONST( ")" );
+
{
SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_ALL);
@@ -900,13 +1092,31 @@ OUString SVGFilter::implGetClassFromShape( const Reference< XShape >& rxShape )
// -----------------------------------------------------------------------------
-OUString SVGFilter::implGetValidIDFromInterface( const Reference< XInterface >& rxIf )
+OUString SVGFilter::implGetValidIDFromInterface( const Reference< XInterface >& rxIf, sal_Bool bUnique )
{
Reference< XNamed > xNamed( rxIf, UNO_QUERY );
OUString aRet;
if( xNamed.is() )
- aRet = xNamed->getName().replace( ' ', '_' );
+ {
+ aRet = xNamed->getName().replace( ' ', '_' ).
+ replace( ':', '_' ).
+ replace( ',', '_' ).
+ replace( ';', '_' ).
+ replace( '&', '_' ).
+ replace( '!', '_' ).
+ replace( '|', '_' );
+ }
+
+ if( ( aRet.getLength() > 0 ) && bUnique )
+ {
+ while( ::std::find( maUniqueIdVector.begin(), maUniqueIdVector.end(), aRet ) != maUniqueIdVector.end() )
+ {
+ aRet += B2UCONST( "_" );
+ }
+
+ maUniqueIdVector.push_back( aRet );
+ }
return aRet;
}
@@ -916,14 +1126,14 @@ OUString SVGFilter::implGetValidIDFromInterface( const Reference< XInterface >&
IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
{
OUString aRepresentation;
- bool bFieldProcessed = false;
+ sal_Bool bFieldProcessed = sal_False;
if( pInfo )
{
- static const ::rtl::OUString aHeaderText( B2UCONST( "HeaderText" ) );
- static const ::rtl::OUString aFooterText( B2UCONST( "FooterText" ) );
- static const ::rtl::OUString aDateTimeText( B2UCONST( "DateTimeText" ) );
- static const ::rtl::OUString aPageNumberText( B2UCONST( "Number" ) );
+ const ::rtl::OUString aHeaderText( B2UCONST( "HeaderText" ) );
+ const ::rtl::OUString aFooterText( B2UCONST( "FooterText" ) );
+ const ::rtl::OUString aDateTimeText( B2UCONST( "DateTimeText" ) );
+ const ::rtl::OUString aPageNumberText( B2UCONST( "Number" ) );
const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
Reference< XPropertySetInfo > xDefaultPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() );
@@ -937,19 +1147,19 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
xDefaultPagePropSetInfo->hasPropertyByName( aHeaderText ) )
{
xDefaultPagePropertySet->getPropertyValue( aHeaderText ) >>= aRepresentation;
- bFieldProcessed = true;
+ bFieldProcessed = sal_True;
}
else if( pField->ISA( SvxFooterField ) &&
xDefaultPagePropSetInfo->hasPropertyByName( aFooterText ) )
{
xDefaultPagePropertySet->getPropertyValue( aFooterText ) >>= aRepresentation;
- bFieldProcessed = true;
+ bFieldProcessed = sal_True;
}
else if( pField->ISA( SvxDateTimeField ) &&
xDefaultPagePropSetInfo->hasPropertyByName( aDateTimeText ) )
{
xDefaultPagePropertySet->getPropertyValue( aDateTimeText ) >>= aRepresentation;
- bFieldProcessed = true;
+ bFieldProcessed = sal_True;
}
else if( pField->ISA( SvxPageField ) &&
xDefaultPagePropSetInfo->hasPropertyByName( aPageNumberText ) )
@@ -961,7 +1171,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
if( mpSdrModel )
{
- bool bUpper = false;
+ sal_Bool bUpper = sal_False;
switch( mpSdrModel->GetPageNumType() )
{
@@ -972,7 +1182,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
aPageNumValue += (sal_Unicode)(char)( ( nPageNumber- 1 ) % 26 + 'a' );
break;
case SVX_ROMAN_UPPER:
- bUpper = true;
+ bUpper = sal_True;
case SVX_ROMAN_LOWER:
aPageNumValue += SvxNumberFormat::CreateRomanString( nPageNumber, bUpper );
break;
@@ -988,7 +1198,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
aPageNumValue += String::CreateFromInt32( nPageNumber );
aRepresentation = aPageNumValue;
- bFieldProcessed = true;
+ bFieldProcessed = sal_True;
}
}
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index e5c66218c701..61fbdc06d61c 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -86,7 +86,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
pFocusWindow->EnterWait();
if( mxDstDoc.is() )
- bRet = implImport( rDescriptor );
+ bRet = sal_False;//implImport( rDescriptor );
else
if( mxSrcDoc.is() )
{
@@ -118,18 +118,18 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
}
}
- Sequence< PropertyValue > aNewDescritor( rDescriptor );
+ Sequence< PropertyValue > aNewDescriptor( rDescriptor );
if( nCurrentPageNumber > 0 )
{
const sal_uInt32 nOldLength = rDescriptor.getLength();
- aNewDescritor.realloc( nOldLength + 1 );
- aNewDescritor[ nOldLength ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PagePos" ) );
- aNewDescritor[ nOldLength ].Value <<= static_cast< sal_Int16 >( nCurrentPageNumber - 1 );
+ aNewDescriptor.realloc( nOldLength + 1 );
+ aNewDescriptor[ nOldLength ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PagePos" ) );
+ aNewDescriptor[ nOldLength ].Value <<= static_cast< sal_Int16 >( nCurrentPageNumber - 1 );
}
- bRet = implExport( aNewDescritor );
+ bRet = implExport( aNewDescriptor );
}
else
bRet = sal_False;
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index b214e8451042..8ef5b626042f 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -3,10 +3,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svgfilter.hxx,v $
+ * $Revision: 1.10.110.11 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -59,6 +62,9 @@
#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>
@@ -79,6 +85,8 @@
#include "svgfilter.hxx"
#include "svgscript.hxx"
+#include <cstdio>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
@@ -105,25 +113,42 @@ using namespace ::std;
// #110680#
class SVGExport : public SvXMLExport
{
-private:
+ typedef ::std::list< ::basegfx::B2DPolyPolygon > B2DPolyPolygonList;
+
+public:
+
+ SVGExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const Reference< XDocumentHandler >& rxHandler,
+ const Sequence< PropertyValue >& rFilterData );
- SVGExport();
+ virtual ~SVGExport();
+
+ sal_Bool IsUseTinyProfile() const;
+ sal_Bool IsEmbedFonts() const;
+ sal_Bool IsUseNativeTextDecoration() const;
+ ::rtl::OUString GetGlyphPlacement() const;
+ sal_Bool IsUseOpacity() const;
+ sal_Bool IsUseGradient() const;
+
+ void pushClip( const ::basegfx::B2DPolyPolygon& rPolyPoly );
+ void popClip();
+ sal_Bool hasClip() const;
+ const ::basegfx::B2DPolyPolygon* getCurClip() const;
protected:
- virtual void _ExportMeta() {}
- virtual void _ExportStyles( sal_Bool /* bUsed */ ) {}
- virtual void _ExportAutoStyles() {}
- virtual void _ExportContent() {}
- virtual void _ExportMasterStyles() {}
- virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) { return 0; }
+virtual void _ExportStyles( sal_Bool /* bUsed */ ) {}
+virtual void _ExportAutoStyles() {}
+virtual void _ExportContent() {}
+virtual void _ExportMasterStyles() {}
+virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) { return 0; }
-public:
+private:
+
+ const Sequence< PropertyValue >& mrFilterData;
+ B2DPolyPolygonList maClipList;
- SVGExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const Reference< XDocumentHandler >& rxHandler );
- virtual ~SVGExport();
+ SVGExport();
};
// ------------------------
@@ -146,7 +171,7 @@ public:
~ObjectRepresentation();
ObjectRepresentation& operator=( const ObjectRepresentation& rPresentation );
- bool operator==( const ObjectRepresentation& rPresentation ) const;
+ sal_Bool operator==( const ObjectRepresentation& rPresentation ) const;
const Reference< XInterface >& GetObject() const { return mxObject; }
sal_Bool HasRepresentation() const { return mpMtf != NULL; }
@@ -159,7 +184,10 @@ public:
struct HashReferenceXInterface
{
- size_t operator()( const Reference< XInterface >& rxIf ) const { return reinterpret_cast< size_t >( rxIf.get() ); }
+ size_t operator()( const Reference< XInterface >& rxIf ) const
+ {
+ return reinterpret_cast< size_t >( rxIf.get() );
+ }
};
// -------------
@@ -176,6 +204,7 @@ class SVGFilter : public cppu::WeakImplHelper4 < XFilter,
XExtendedFilterDetection >
{
typedef ::boost::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
+ typedef ::std::vector< ::rtl::OUString > UniqueIdVector;
private:
@@ -192,6 +221,12 @@ private:
Reference< XComponent > mxSrcDoc;
Reference< XComponent > mxDstDoc;
Reference< XDrawPage > mxDefaultPage;
+ Sequence< PropertyValue > maFilterData;
+ UniqueIdVector maUniqueIdVector;
+ sal_Int32 mnMasterSlideId;
+ sal_Int32 mnSlideId;
+ sal_Int32 mnDrawingGroupId;
+ sal_Int32 mnDrawingId;
Link maOldFieldHdl;
sal_Bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
@@ -223,7 +258,7 @@ private:
sal_Bool implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage );
::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 );
DECL_LINK( CalcFieldHdl, EditFieldInfo* );
@@ -250,27 +285,6 @@ public:
// -----------------------------------------------------------------------------
-::rtl::OUString SVGFilter_getImplementationName ()
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// -----------------------------------------------------------------------------
-
-sal_Bool SAL_CALL SVGFilter_supportsService( const ::rtl::OUString& ServiceName )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// -----------------------------------------------------------------------------
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SVGFilter_getSupportedServiceNames( )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// -----------------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-SAL_CALL SVGFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
- throw ( ::com::sun::star::uno::Exception );
-
-// -----------------------------------------------------------------------------
-
class SvStream;
class Graphic;
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index dc340595b08e..d796234133d8 100644
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@ -3,10 +3,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svgfontexport.cxx,v $
+ * $Revision: 1.6.64.10 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -29,16 +32,16 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_filter.hxx"
-
#include "svgfontexport.hxx"
+#include <vcl/unohelp.hxx>
-static const sal_Int32 nFontEM = 2048;
+static const sal_Int32 nFontEM = 2048;
// -----------------
// - SVGFontExport -
// -----------------
-SVGFontExport::SVGFontExport( SvXMLExport& rExport, const ::std::vector< ObjectRepresentation >& rObjects ) :
+SVGFontExport::SVGFontExport( SVGExport& rExport, const ::std::vector< ObjectRepresentation >& rObjects ) :
mrExport( rExport ),
maObjects( rObjects ),
mnCurFontId( 0 )
@@ -53,6 +56,33 @@ SVGFontExport::~SVGFontExport()
// -----------------------------------------------------------------------------
+SVGFontExport::GlyphSet& SVGFontExport::implGetGlyphSet( const Font& rFont )
+{
+ FontWeight eWeight( WEIGHT_NORMAL );
+ FontItalic eItalic( ITALIC_NONE );
+ ::rtl::OUString aFontName( rFont.GetName() );
+ sal_Int32 nNextTokenPos( 0 );
+
+ switch( rFont.GetWeight() )
+ {
+ case WEIGHT_BOLD:
+ case WEIGHT_ULTRABOLD:
+ case WEIGHT_BLACK:
+ eWeight = WEIGHT_BOLD;
+ break;
+
+ default:
+ break;
+ }
+
+ if( rFont.GetItalic() != ITALIC_NONE )
+ eItalic = ITALIC_NORMAL;
+
+ return( maGlyphTree[ aFontName.getToken( 0, ';', nNextTokenPos ) ][ eWeight ][ eItalic ] );
+}
+
+// -----------------------------------------------------------------------------
+
void SVGFontExport::implCollectGlyphs()
{
VirtualDevice aVDev;
@@ -72,7 +102,7 @@ void SVGFontExport::implCollectGlyphs()
{
::rtl::OUString aText;
MetaAction* pAction = rMtf.GetAction( i );
- const sal_uInt16 nType = pAction->GetType();
+ const sal_uInt16 nType = pAction->GetType();
switch( nType )
{
@@ -111,11 +141,34 @@ void SVGFontExport::implCollectGlyphs()
if( aText.getLength() )
{
- const String& rFontName = aVDev.GetFont().GetName();
- const sal_Unicode* pStr = aText.getStr();
+ GlyphSet& rGlyphSet = implGetGlyphSet( aVDev.GetFont() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBI(
+ ::vcl::unohelper::CreateBreakIterator() );
+
+ if( xBI.is() )
+ {
+ const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale();
+ sal_Int32 nCurPos = 0, nLastPos = -1;
+
+ while( ( nCurPos < aText.getLength() ) && ( nCurPos > nLastPos ) )
+ {
+ sal_Int32 nCount2 = 1;
- for( sal_uInt32 j = 0, nLen = aText.getLength(); j < nLen; ++j )
- maGlyphs[ rFontName ].insert( pStr[ j ] );
+ nLastPos = nCurPos;
+ nCurPos = xBI->nextCharacters( aText, nCurPos, rLocale,
+ ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL,
+ nCount2, nCount2 );
+
+ rGlyphSet.insert( aText.copy( nLastPos, nCurPos - nLastPos ) );
+ }
+ }
+ else
+ {
+ const sal_Unicode* pStr = aText.getStr();
+
+ for( sal_uInt32 k = 0, nLen = aText.getLength(); k < nLen; ++k )
+ rGlyphSet.insert( rtl::OUString( pStr[ k ] ) );
+ }
}
}
@@ -128,96 +181,117 @@ void SVGFontExport::implCollectGlyphs()
// -----------------------------------------------------------------------------
-void SVGFontExport::implEmbedFont( const ::rtl::OUString& rFontName, const ::std::set< sal_Unicode >& rGlyphs )
+void SVGFontExport::implEmbedFont( const Font& rFont )
{
-#ifdef _SVG_EMBED_FONTS
- ::std::set< sal_Unicode >::const_iterator aIter( rGlyphs.begin() );
- const ::rtl::OUString aEmbeddedFontStr( B2UCONST( "EmbeddedFont_" ) );
-
+ if( mrExport.IsEmbedFonts() )
{
- SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True );
- ::rtl::OUString aCurIdStr( aEmbeddedFontStr );
- ::rtl::OUString aUnitsPerEM( SVGActionWriter::GetValueString( nFontEM ) );
- VirtualDevice aVDev;
- Font aFont( rFontName, Size( 0, nFontEM ) );
+ GlyphSet& rGlyphSet = implGetGlyphSet( rFont );
- aVDev.SetMapMode( MAP_100TH_MM );
- aFont.SetAlign( ALIGN_BASELINE );
- aVDev.SetFont( aFont );
+ if( !rGlyphSet.empty() )
+ {
+ GlyphSet::const_iterator aIter( rGlyphSet.begin() );
+ const ::rtl::OUString aEmbeddedFontStr( B2UCONST( "EmbeddedFont_" ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += SVGActionWriter::GetValueString( ++mnCurFontId ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM );
+ {
+ SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True );
+ ::rtl::OUString aCurIdStr( aEmbeddedFontStr );
+ ::rtl::OUString aUnitsPerEM( ::rtl::OUString::valueOf( nFontEM ) );
+ VirtualDevice aVDev;
+ Font aFont( rFont );
- {
- SvXMLElementExport aExp2( mrExport, XML_NAMESPACE_NONE, "font", sal_True, sal_True );
- Point aPos;
- Size aSize( nFontEM, nFontEM );
- PolyPolygon aMissingGlyphPolyPoly( Rectangle( aPos, aSize ) );
+ aFont.SetSize( Size( 0, nFontEM ) );
+ aFont.SetAlign( ALIGN_BASELINE );
- aMissingGlyphPolyPoly.Move( 0, -nFontEM );
- aMissingGlyphPolyPoly.Scale( 1.0, -1.0 );
+ aVDev.SetMapMode( MAP_100TH_MM );
+ aVDev.SetFont( aFont );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-family", GetMappedFontName( rFontName ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "units-per-em", aUnitsPerEM );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", SVGActionWriter::GetValueString( aVDev.GetFontMetric().GetAscent() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", SVGActionWriter::GetValueString( aVDev.GetFontMetric().GetDescent() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += ::rtl::OUString::valueOf( ++mnCurFontId ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM );
- {
- SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", sal_True, sal_True );
- }
+ {
+ SvXMLElementExport aExp2( mrExport, XML_NAMESPACE_NONE, "font", sal_True, sal_True );
+ ::rtl::OUString aFontWeight;
+ ::rtl::OUString aFontStyle;
+ const Size aSize( nFontEM, nFontEM );
+
+ // Font Weight
+ if( aFont.GetWeight() != WEIGHT_NORMAL )
+ aFontWeight = B2UCONST( "bold" );
+ else
+ aFontWeight = B2UCONST( "normal" );
+
+ // Font Italic
+ if( aFont.GetItalic() != ITALIC_NONE )
+ aFontStyle = B2UCONST( "italic" );
+ else
+ aFontStyle = B2UCONST( "normal" );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-family", GetMappedFontName( rFont.GetName() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "units-per-em", aUnitsPerEM );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-weight", aFontWeight );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-style", aFontStyle );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", ::rtl::OUString::valueOf( aVDev.GetFontMetric().GetAscent() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", ::rtl::OUString::valueOf( aVDev.GetFontMetric().GetDescent() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", SVGActionWriter::GetValueString( aSize.Width() ) );
+ {
+ SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", sal_True, sal_True );
+ }
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "style", B2UCONST( "fill:none;stroke:black;stroke-width:33" ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "d", SVGActionWriter::GetPathString( aMissingGlyphPolyPoly, sal_False ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", ::rtl::OUString::valueOf( aSize.Width() ) );
- {
- SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "missing-glyph", sal_True, sal_True );
- }
+ {
+ const Point aPos;
+ const PolyPolygon aMissingGlyphPolyPoly( Rectangle( aPos, aSize ) );
- while( aIter != rGlyphs.end() )
- {
- implEmbedGlyph( aVDev, ::rtl::OUString( *aIter ) );
- ++aIter;
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "d", SVGActionWriter::GetPathString( aMissingGlyphPolyPoly, sal_False ) );
+
+ {
+ SvXMLElementExport aExp4( mrExport, XML_NAMESPACE_NONE, "missing-glyph", sal_True, sal_True );
+ }
+ }
+
+ while( aIter != rGlyphSet.end() )
+ {
+ implEmbedGlyph( aVDev, *aIter );
+ ++aIter;
+ }
+ }
}
}
}
-#endif
}
// -----------------------------------------------------------------------------
-void SVGFontExport::implEmbedGlyph( OutputDevice& rOut, const ::rtl::OUString& rGlyphs )
+void SVGFontExport::implEmbedGlyph( OutputDevice& rOut, const ::rtl::OUString& rCellStr )
{
PolyPolygon aPolyPoly;
- ::rtl::OUString aStr( rGlyphs );
const sal_Unicode nSpace = ' ';
- if( rOut.GetTextOutline( aPolyPoly, aStr ) )
+ if( rOut.GetTextOutline( aPolyPoly, rCellStr ) )
{
Rectangle aBoundRect;
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 );
}
{
- SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "glyph", sal_True, sal_True );
+ SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "glyph", sal_True, sal_True );
}
}
}
@@ -228,12 +302,35 @@ void SVGFontExport::EmbedFonts()
{
implCollectGlyphs();
- GlyphMap::const_iterator aIter( maGlyphs.begin() );
+ GlyphTree::const_iterator aGlyphTreeIter( maGlyphTree.begin() );
- while( aIter != maGlyphs.end() )
+ while( aGlyphTreeIter != maGlyphTree.end() )
{
- implEmbedFont( (*aIter).first, (*aIter).second );
- ++aIter;
+ const FontWeightMap& rFontWeightMap = (*aGlyphTreeIter).second;
+ FontWeightMap::const_iterator aFontWeightIter( rFontWeightMap.begin() );
+
+ while( aFontWeightIter != rFontWeightMap.end() )
+ {
+ const FontItalicMap& rFontItalicMap = (*aFontWeightIter).second;
+ FontItalicMap::const_iterator aFontItalicIter( rFontItalicMap.begin() );
+
+ while( aFontItalicIter != rFontItalicMap.end() )
+ {
+ Font aFont;
+
+ aFont.SetName( (*aGlyphTreeIter).first );
+ aFont.SetWeight( (*aFontWeightIter).first );
+ aFont.SetItalic( (*aFontItalicIter).first );
+
+ implEmbedFont( aFont );
+
+ ++aFontItalicIter;
+ }
+
+ ++aFontWeightIter;
+ }
+
+ ++aGlyphTreeIter;
}
}
@@ -241,12 +338,11 @@ void SVGFontExport::EmbedFonts()
::rtl::OUString SVGFontExport::GetMappedFontName( const ::rtl::OUString& rFontName ) const
{
- ::rtl::OUString aRet( String( rFontName ).GetToken( 0, ';' ) );
+ sal_Int32 nNextTokenPos( 0 );
+ ::rtl::OUString aRet( rFontName.getToken( 0, ';', nNextTokenPos ) );
-#ifdef _SVG_EMBED_FONTS
if( mnCurFontId )
aRet += B2UCONST( " embedded" );
-#endif
return aRet;
}
diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx
index 45a27e7aeaec..a5ebd677e6bc 100644
--- a/filter/source/svg/svgfontexport.hxx
+++ b/filter/source/svg/svgfontexport.hxx
@@ -3,10 +3,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svgfontexport.hxx,v $
+ * $Revision: 1.2.110.3 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -39,23 +42,28 @@
class SVGFontExport
{
- typedef ::boost::unordered_map< ::rtl::OUString, ::std::set< sal_Unicode >, ::comphelper::UStringHash > GlyphMap;
- typedef ::std::vector< ObjectRepresentation > ObjectVector;
+ typedef ::std::vector< ObjectRepresentation > ObjectVector;
+ typedef ::std::set< ::rtl::OUString, ::std::greater< ::rtl::OUString > > GlyphSet;
+ typedef ::std::map< FontItalic, GlyphSet > FontItalicMap;
+ typedef ::std::map< FontWeight, FontItalicMap > FontWeightMap;
+ typedef ::std::map< ::rtl::OUString, FontWeightMap > FontNameMap;
+ typedef FontNameMap GlyphTree;
private:
- SvXMLExport& mrExport;
- GlyphMap maGlyphs;
+ SVGExport& mrExport;
+ GlyphTree maGlyphTree;
ObjectVector maObjects;
- sal_uInt32 mnCurFontId;
+ sal_Int32 mnCurFontId;
+ GlyphSet& implGetGlyphSet( const Font& rFont );
void implCollectGlyphs();
- void implEmbedFont( const ::rtl::OUString& rFontName, const ::std::set< sal_Unicode >& rGlyphs );
- void implEmbedGlyph( OutputDevice& rOut, const ::rtl::OUString& rGlyphs );
+ void implEmbedFont( const Font& rFont );
+ void implEmbedGlyph( OutputDevice& rOut, const ::rtl::OUString& rCellStr );
public:
- SVGFontExport( SvXMLExport& rExport, const ::std::vector< ObjectRepresentation >& rObjects );
+ SVGFontExport( SVGExport& rExport, const ::std::vector< ObjectRepresentation >& rObjects );
~SVGFontExport();
void EmbedFonts();
diff --git a/filter/source/svg/svguno.cxx b/filter/source/svg/svguno.cxx
deleted file mode 100644
index 5b7c1df9ccb4..000000000000
--- a/filter/source/svg/svguno.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_filter.hxx"
-
-#include <stdio.h>
-#include <osl/mutex.hxx>
-#include <osl/thread.h>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include <svgfilter.hxx>
-
-using ::rtl::OUString;
-using namespace ::cppu;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-extern "C"
-{
- //==================================================================================================
- SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
- const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
- {
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
- }
- //==================================================================================================
- SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
- {
- void * pRet = 0;
-
- OUString implName = OUString::createFromAscii( pImplName );
- if ( pServiceManager && implName.equals(SVGFilter_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- SVGFilter_createInstance, SVGFilter_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index d2a0f7ba9332..56b5af4fba0d 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3,10 +3,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svgwriter.cxx,v $
+ * $Revision: 1.7.64.23 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -31,6 +34,9 @@
#include "svgfontexport.hxx"
#include "svgwriter.hxx"
+#include <vcl/unohelp.hxx>
+
+using ::rtl::OUString;
// -----------
// - statics -
@@ -38,11 +44,6 @@
static const char aXMLElemG[] = "g";
static const char aXMLElemDefs[] = "defs";
-static const char aXMLElemClipPath[] = "clipPath";
-static const char aXMLElemMask[] = "mask";
-static const char aXMLElemPattern[] = "pattern";
-static const char aXMLElemLinearGradient[] = "linearGradient";
-static const char aXMLElemStop[] = "stop";
static const char aXMLElemLine[] = "line";
static const char aXMLElemRect[] = "rect";
static const char aXMLElemEllipse[] = "ellipse";
@@ -52,6 +53,13 @@ static const char aXMLElemPolyLine[] = "polyline";
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";
@@ -65,80 +73,36 @@ static const char aXMLAttrX2[] = "x2";
static const char aXMLAttrY2[] = "y2";
static const char aXMLAttrCX[] = "cx";
static const char aXMLAttrCY[] = "cy";
+static const char aXMLAttrR[] = "r";
static const char aXMLAttrRX[] = "rx";
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 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";
static const char aXMLAttrGradientUnits[] = "gradientUnits";
+static const char aXMLAttrPatternUnits[] = "patternUnits";
static const char aXMLAttrOffset[] = "offset";
-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" );
-}
+static const char aXMLAttrStopColor[] = "stop-color";
// -----------------------------------------------------------------------------
-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;
-}
-
-// -----------------------------------------------------------------------------
-
-const NMSP_RTL::OUString& FastString::GetString() const
-{
- if( !maString.getLength() && mnCurLen )
- ( (FastString*) this )->maString = NMSP_RTL::OUString( mpBuffer, mnCurLen );
-
- return maString;
-}
-
// ----------------------
// - SVGAttributeWriter -
// ----------------------
-SVGAttributeWriter::SVGAttributeWriter( SvXMLExport& rExport, SVGFontExport& rFontExport ) :
+SVGAttributeWriter::SVGAttributeWriter( SVGExport& rExport, SVGFontExport& rFontExport ) :
mrExport( rExport ),
mrFontExport( rFontExport ),
mpElemFont( NULL ),
@@ -156,203 +120,196 @@ 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() );
+ return( floor( fValue * pow( 10.0, (int)nDecs ) + 0.5 ) / pow( 10.0, (int)nDecs ) );
+}
- // font size
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-size:" );
- aStyle += SVGActionWriter::GetValueString( rFont.GetHeight() );
- aStyle += B2UCONST( "px" );
+// -----------------------------------------------------------------------------
- // font style
-/*
- if( rFont.GetItalic() != ITALIC_NONE )
+void SVGAttributeWriter::ImplGetColorStr( const Color& rColor, ::rtl::OUString& rColorStr )
+{
+ if( rColor.GetTransparency() == 255 )
+ rColorStr = B2UCONST( "none" );
+ else
{
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-style:" );
-
- if( rFont.GetItalic() == ITALIC_OBLIQUE )
- aStyle += B2UCONST( "oblique" );
- else
- aStyle += B2UCONST( "italic" );
+ ::rtl::OUStringBuffer aStyle;
+ aStyle.appendAscii( "rgb(" );
+ aStyle.append( (sal_Int32) rColor.GetRed() );
+ aStyle.appendAscii( "," );
+ aStyle.append( (sal_Int32) rColor.GetGreen() );
+ aStyle.appendAscii( "," );
+ aStyle.append( (sal_Int32) rColor.GetBlue() );
+ aStyle.appendAscii( ")" );
+ rColorStr = aStyle.makeStringAndClear();
}
-*/
+}
- // 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;
- }
+void SVGAttributeWriter::AddColorAttr( const char* pColorAttrName,
+ const char* pColorOpacityAttrName,
+ const Color& rColor )
+{
+ ::rtl::OUString aColor, aColorOpacity;
+
+ ImplGetColorStr( rColor, aColor );
+
+ if( rColor.GetTransparency() > 0 && rColor.GetTransparency() < 255 )
+ aColorOpacity = ::rtl::OUString::valueOf( ImplRound( ( 255.0 - rColor.GetTransparency() ) / 255.0 ) );
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-weight:" );
- aStyle += NMSP_RTL::OUString::valueOf( nFontWeight );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorAttrName, aColor );
- // !!!
- // font-variant
- // font-stretch
- // font-size-adjust
+ if( aColorOpacity.getLength() && mrExport.IsUseOpacity() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorOpacityAttrName, aColorOpacity );
+}
-#ifdef _SVG_USE_NATIVE_TEXTDECORATION
+// -----------------------------------------------------------------------------
- if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
+void SVGAttributeWriter::AddPaintAttr( const Color& rLineColor, const Color& rFillColor,
+ const Rectangle* pObjBoundRect, const Gradient* pFillGradient )
+{
+ // Fill
+ if( pObjBoundRect && pFillGradient )
{
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "text-decoration:" );
+ ::rtl::OUString aGradientId;
- if( rFont.GetUnderline() != UNDERLINE_NONE )
- aStyle += B2UCONST( " underline" );
+ AddGradientDef( *pObjBoundRect, *pFillGradient, aGradientId );
- if( rFont.GetStrikeout() != STRIKEOUT_NONE )
- aStyle += B2UCONST( " line-through" );
+ if( aGradientId.getLength() )
+ {
+ ::rtl::OUString aGradientURL( B2UCONST( "url(#" ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFill, ( aGradientURL += aGradientId ) += B2UCONST( ")" ) );
+ }
}
+ else
+ AddColorAttr( aXMLAttrFill, aXMLAttrFillOpacity, rFillColor );
-#endif // _SVG_USE_NATIVE_TEXTDECORATION
-
- return aStyle.GetString();
+ // Stroke
+ AddColorAttr( aXMLAttrStroke, aXMLAttrStrokeOpacity, rLineColor );
}
// -----------------------------------------------------------------------------
-NMSP_RTL::OUString SVGAttributeWriter::GetColorStyle( const Color& rColor )
+void SVGAttributeWriter::AddGradientDef( const Rectangle& rObjRect, const Gradient& rGradient, ::rtl::OUString& rGradientId )
{
- FastString aStyle;
- aStyle += B2UCONST( "rgb(" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetRed() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetGreen() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetBlue() );
- aStyle += B2UCONST( ")" );
- return aStyle.GetString();
-}
+ if( rObjRect.GetWidth() && rObjRect.GetHeight() &&
+ ( rGradient.GetStyle() == GRADIENT_LINEAR || rGradient.GetStyle() == GRADIENT_AXIAL ||
+ rGradient.GetStyle() == GRADIENT_RADIAL || rGradient.GetStyle() == GRADIENT_ELLIPTICAL ) )
+ {
+ SvXMLElementExport aDesc( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
+ Color aStartColor( rGradient.GetStartColor() ), aEndColor( rGradient.GetEndColor() );
+ sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+ Point aObjRectCenter( rObjRect.Center() );
+ Polygon aPoly( rObjRect );
+ static sal_Int32 nCurGradientId = 1;
-// -----------------------------------------------------------------------------
+ aPoly.Rotate( aObjRectCenter, nAngle );
+ Rectangle aRect( aPoly.GetBoundRect() );
-NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo )
-{
- FastString aStyle;
+ // adjust start/end colors with intensities
+ aStartColor.SetRed( (sal_uInt8)( (long) aStartColor.GetRed() * rGradient.GetStartIntensity() ) / 100 );
+ aStartColor.SetGreen( (sal_uInt8)( (long) aStartColor.GetGreen() * rGradient.GetStartIntensity() ) / 100 );
+ aStartColor.SetBlue( (sal_uInt8)( (long) aStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100 );
- // line color
- aStyle += B2UCONST( "stroke:" );
+ aEndColor.SetRed( (sal_uInt8)( (long) aEndColor.GetRed() * rGradient.GetEndIntensity() ) / 100 );
+ aEndColor.SetGreen( (sal_uInt8)( (long) aEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100 );
+ aEndColor.SetBlue( (sal_uInt8)( (long) aEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100 );
- if( rLineColor.GetTransparency() == 255 )
- aStyle += B2UCONST( "none" );
- else
- {
- // line color value in rgb
- aStyle += GetColorStyle( rLineColor );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId,
+ ( rGradientId = B2UCONST( "Gradient_" ) ) += ::rtl::OUString::valueOf( nCurGradientId++ ) );
- // line color opacity in percent if neccessary
- if( rLineColor.GetTransparency() )
{
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "stroke-opacity:" );
- aStyle += NMSP_RTL::OUString::valueOf( ( 255 - (double) rLineColor.GetTransparency() ) / 255.0 );
- }
+ ::std::auto_ptr< SvXMLElementExport > apGradient;
+ ::rtl::OUString aColorStr;
- if(pLineInfo)
- {
- // more infos for line needed
- if(pLineInfo->GetWidth() > 1)
+ if( rGradient.GetStyle() == GRADIENT_LINEAR || rGradient.GetStyle() == GRADIENT_AXIAL )
{
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "stroke-width:" );
- aStyle += NMSP_RTL::OUString::valueOf(pLineInfo->GetWidth());
- }
+ Polygon aLinePoly( 2 );
+
+ aLinePoly[ 0 ] = Point( aObjRectCenter.X(), aRect.Top() );
+ aLinePoly[ 1 ] = Point( aObjRectCenter.X(), aRect.Bottom() );
+
+ aLinePoly.Rotate( aObjRectCenter, nAngle );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits, B2UCONST( "userSpaceOnUse" ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, ::rtl::OUString::valueOf( aLinePoly[ 0 ].X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, ::rtl::OUString::valueOf( aLinePoly[ 0 ].Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, ::rtl::OUString::valueOf( aLinePoly[ 1 ].X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, ::rtl::OUString::valueOf( aLinePoly[ 1 ].Y() ) );
+
+ apGradient.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemLinearGradient, sal_True, sal_True ) );
+
+ // write stop values
+ double fBorder = static_cast< double >( rGradient.GetBorder() ) *
+ ( ( rGradient.GetStyle() == GRADIENT_AXIAL ) ? 0.005 : 0.01 );
+
+ ImplGetColorStr( ( rGradient.GetStyle() == GRADIENT_AXIAL ) ? aEndColor : aStartColor, aColorStr );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, ::rtl::OUString::valueOf( fBorder ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr );
- if(LINE_DASH == pLineInfo->GetStyle())
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "stroke-dasharray:" );
- const long nDashLen(pLineInfo->GetDashLen());
- const long nDotLen(pLineInfo->GetDotLen());
- const long nDistance(pLineInfo->GetDistance());
- bool bIsFirst(true);
-
- for(sal_uInt16 a(0); a < pLineInfo->GetDashCount(); a++)
{
- if(bIsFirst)
- aStyle += B2UCONST(" "), bIsFirst = false;
- else
- aStyle += B2UCONST(",");
- aStyle += NMSP_RTL::OUString::valueOf(nDashLen);
- aStyle += B2UCONST(",");
- aStyle += NMSP_RTL::OUString::valueOf(nDistance);
+ SvXMLElementExport aDesc2( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
}
- for(sal_uInt16 b(0); b < pLineInfo->GetDotCount(); b++)
+ if( rGradient.GetStyle() == GRADIENT_AXIAL )
{
- if(bIsFirst)
- aStyle += B2UCONST(" "), bIsFirst = false;
- else
- aStyle += B2UCONST(",");
- aStyle += NMSP_RTL::OUString::valueOf(nDotLen);
- aStyle += B2UCONST(",");
- aStyle += NMSP_RTL::OUString::valueOf(nDistance);
+ ImplGetColorStr( aStartColor, aColorStr );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, ::rtl::OUString::valueOf( 0.5 ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr );
+
+ {
+ SvXMLElementExport aDesc3( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
+ }
}
- }
- if(basegfx::B2DLINEJOIN_MITER != pLineInfo->GetLineJoin())
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "stroke-linejoin:" );
+ if( rGradient.GetStyle() != GRADIENT_AXIAL )
+ fBorder = 0.0;
+
+ ImplGetColorStr( aEndColor, aColorStr );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, ::rtl::OUString::valueOf( ImplRound( 1.0 - fBorder ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr );
- switch(pLineInfo->GetLineJoin())
{
- default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE, B2DLINEJOIN_MITER
- aStyle += B2UCONST( "miter" );
- break;
- case basegfx::B2DLINEJOIN_ROUND:
- aStyle += B2UCONST( "round" );
- break;
- case basegfx::B2DLINEJOIN_BEVEL:
- aStyle += B2UCONST( "bevel" );
- break;
+ SvXMLElementExport aDesc4( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
}
}
- }
- }
+ else
+ {
+ const double fCenterX = rObjRect.Left() + rObjRect.GetWidth() * rGradient.GetOfsX() * 0.01;
+ const double fCenterY = rObjRect.Top() + rObjRect.GetHeight() * rGradient.GetOfsY() * 0.01;
+ const double fRadius = sqrt( static_cast< double >( rObjRect.GetWidth() ) * rObjRect.GetWidth() +
+ rObjRect.GetHeight() * rObjRect.GetHeight() ) * 0.5;
- // fill color
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "fill:" );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits, B2UCONST( "userSpaceOnUse" ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, ::rtl::OUString::valueOf( ImplRound( fCenterX ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, ::rtl::OUString::valueOf( ImplRound( fCenterY ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrR, ::rtl::OUString::valueOf( ImplRound( fRadius ) ) );
- if( rFillColor.GetTransparency() == 255 )
- aStyle += B2UCONST( "none" );
- else
- {
- // fill color value in rgb
- aStyle += GetColorStyle( rFillColor );
+ apGradient.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemRadialGradient, sal_True, sal_True ) );
- // fill color opacity in percent if neccessary
- if( rFillColor.GetTransparency() )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "fill-opacity:" );
- aStyle += NMSP_RTL::OUString::valueOf( ( 255 - (double) rFillColor.GetTransparency() ) / 255.0 );
+ // write stop values
+ ImplGetColorStr( aEndColor, aColorStr );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, ::rtl::OUString::valueOf( 0.0 ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr );
+
+ {
+ SvXMLElementExport aDesc5( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
+ }
+
+ ImplGetColorStr( aStartColor, aColorStr );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset,
+ ::rtl::OUString::valueOf( ImplRound( 1.0 - rGradient.GetBorder() * 0.01 ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr );
+
+ {
+ SvXMLElementExport aDesc6( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
+ }
+ }
}
}
-
- return aStyle.GetString();
+ else
+ rGradientId = ::rtl::OUString();
}
// -----------------------------------------------------------------------------
@@ -361,22 +318,68 @@ void SVGAttributeWriter::SetFontAttr( const Font& rFont )
{
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() ) );
-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 Size
+ 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 );
+
+ // 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 );
}
}
@@ -384,15 +387,15 @@ void SVGAttributeWriter::SetPaintAttr( const Color& rLineColor, const Color& rFi
// - SVGActionWriter -
// -------------------
-SVGActionWriter::SVGActionWriter( SvXMLExport& rExport, SVGFontExport& rFontExport ) :
+SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport ) :
+ mnCurGradientId( 1 ),
+ mnCurMaskId( 1 ),
+ mnCurPatternId( 1 ),
mrExport( rExport ),
mrFontExport( rFontExport ),
mpContext( NULL ),
- mbClipAttrChanged( sal_False ),
- mnCurClipId( 1 ),
- mnCurPatternId( 1 ),
- mnCurGradientId( 1 ),
- mnCurMaskId( 1 )
+ mnInnerMtfCount( 0 ),
+ mbClipAttrChanged( sal_False )
{
mpVDev = new VirtualDevice;
mpVDev->EnableOutput( sal_False );
@@ -411,80 +414,75 @@ SVGActionWriter::~SVGActionWriter()
long SVGActionWriter::ImplMap( sal_Int32 nVal ) const
{
- return ImplMap( Size( nVal, nVal ) ).Width();
+ Size aSz( nVal, nVal );
+
+ return( ImplMap( aSz, aSz ).Width() );
}
// -----------------------------------------------------------------------------
-Point SVGActionWriter::ImplMap( const Point& rPt ) const
+Point& SVGActionWriter::ImplMap( const Point& rPt, Point& rDstPt ) const
{
- return mpVDev->LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode );
+ return( rDstPt = mpVDev->LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode ) );
}
// -----------------------------------------------------------------------------
-Size SVGActionWriter::ImplMap( const Size& rSz ) const
+Size& SVGActionWriter::ImplMap( const Size& rSz, Size& rDstSz ) const
{
- return mpVDev->LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode );
+ return( rDstSz = mpVDev->LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode ) );
}
// -----------------------------------------------------------------------------
-LineInfo SVGActionWriter::ImplMap( const LineInfo& rLineInfo ) const
+Rectangle& SVGActionWriter::ImplMap( const Rectangle& rRect, Rectangle& rDstRect ) const
{
- LineInfo aInfo(rLineInfo);
- long aTemp(0);
+ Point aTL( rRect.TopLeft() );
+ Size aSz( rRect.GetSize() );
- if(aInfo.GetStyle() == LINE_DASH)
- {
- if(aInfo.GetDotCount() && aInfo.GetDotLen())
- {
- aTemp = aInfo.GetDotLen();
- mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
- aInfo.SetDotLen(Max(aTemp, 1L));
- }
- else
- aInfo.SetDotCount(0);
+ return( rDstRect = Rectangle( ImplMap( aTL, aTL ), ImplMap( aSz, aSz ) ) );
+}
- if(aInfo.GetDashCount() && aInfo.GetDashLen())
- {
- aTemp = aInfo.GetDashLen();
- mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
- aInfo.SetDashLen(Max(aTemp, 1L));
- }
- else
- aInfo.SetDashCount(0);
- aTemp = aInfo.GetDistance();
- mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
- aInfo.SetDistance(aTemp);
+// -----------------------------------------------------------------------------
- if((!aInfo.GetDashCount() && !aInfo.GetDotCount()) || !aInfo.GetDistance())
- aInfo.SetStyle(LINE_SOLID);
- }
+Polygon& SVGActionWriter::ImplMap( const Polygon& rPoly, Polygon& rDstPoly ) const
+{
+ rDstPoly = Polygon( rPoly.GetSize() );
- aTemp = aInfo.GetWidth();
- mpVDev->LogicToLogic(&aTemp, 1, &mpVDev->GetMapMode(), &maTargetMapMode);
- aInfo.SetWidth(aTemp);
+ for( sal_uInt16 i = 0, nSize = rPoly.GetSize(); i < nSize; ++i )
+ {
+ ImplMap( rPoly[ i ], rDstPoly[ i ] );
+ rDstPoly.SetFlags( i, rPoly.GetFlags( i ) );
+ }
- return aInfo;
+ return( rDstPoly );
}
// -----------------------------------------------------------------------------
-NMSP_RTL::OUString SVGActionWriter::GetValueString( sal_Int32 nVal )
+PolyPolygon& SVGActionWriter::ImplMap( const PolyPolygon& rPolyPoly, PolyPolygon& rDstPolyPoly ) const
{
- return ::rtl::OUString::valueOf( nVal );
+ Polygon aPoly;
+
+ rDstPolyPoly = PolyPolygon();
+
+ for( sal_uInt16 i = 0, nCount = rPolyPoly.Count(); i < nCount; ++i )
+ {
+ rDstPolyPoly.Insert( ImplMap( rPolyPoly[ i ], aPoly ) );
+ }
+
+ return( rDstPolyPoly );
}
// -----------------------------------------------------------------------------
-NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine )
+::rtl::OUString SVGActionWriter::GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine )
{
- FastString aPathData;
- const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
- const NMSP_RTL::OUString aComma( B2UCONST( "," ) );
- Point aPolyPoint;
+ ::rtl::OUString aPathData;
+ const ::rtl::OUString aBlank( B2UCONST( " " ) );
+ const ::rtl::OUString aComma( B2UCONST( "," ) );
+ Point aPolyPoint;
for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
{
@@ -494,15 +492,17 @@ NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon& rPolyPoly
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 )
{
aPathData += aBlank;
+
if ( ( rPoly.GetFlags( n ) == POLY_CONTROL ) && ( ( n + 2 ) < nSize ) )
{
if ( nCurrentMode != 'C' )
@@ -514,9 +514,9 @@ NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon& rPolyPoly
{
if ( j )
aPathData += aBlank;
- aPathData += GetValueString( ( aPolyPoint = rPoly[ n++ ] ).X() );
+ aPathData += ::rtl::OUString::valueOf( ( aPolyPoint = rPoly[ n++ ] ).X() );
aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y() );
+ aPathData += ::rtl::OUString::valueOf( aPolyPoint.Y() );
}
}
else
@@ -526,9 +526,9 @@ NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon& rPolyPoly
nCurrentMode = 'L';
aPathData += B2UCONST( "L " );
}
- aPathData += GetValueString( ( aPolyPoint = rPoly[ n++ ] ).X() );
+ aPathData += ::rtl::OUString::valueOf( ( aPolyPoint = rPoly[ n++ ] ).X() );
aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y() );
+ aPathData += ::rtl::OUString::valueOf( aPolyPoint.Y() );
}
}
@@ -540,25 +540,31 @@ NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon& rPolyPoly
}
}
- return aPathData.GetString();
+ return aPathData;
}
// -----------------------------------------------------------------------------
-void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor,
- const NMSP_RTL::OUString* pStyle )
+void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2,
+ const Color* pLineColor, sal_Bool bApplyMapping )
{
- const Point aPt1( ImplMap( rPt1 ) );
- const Point aPt2( ImplMap( rPt2 ) );
+ Point aPt1, aPt2;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, GetValueString( aPt1.X() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, GetValueString( aPt1.Y() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, GetValueString( aPt2.X() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, GetValueString( aPt2.Y() ) );
+ if( bApplyMapping )
+ {
+ ImplMap( rPt1, aPt1 );
+ ImplMap( rPt2, aPt2 );
+ }
+ else
+ {
+ aPt1 = rPt1;
+ aPt2 = rPt2;
+ }
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, ::rtl::OUString::valueOf( aPt1.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, ::rtl::OUString::valueOf( aPt1.Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, ::rtl::OUString::valueOf( aPt2.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, ::rtl::OUString::valueOf( aPt2.Y() ) );
if( pLineColor )
{
@@ -574,24 +580,25 @@ void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const
// -----------------------------------------------------------------------------
void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nRadY,
- const NMSP_RTL::OUString* pStyle )
+ sal_Bool bApplyMapping )
{
- const Rectangle aRect( ImplMap( rRect ) );
+ Rectangle aRect;
- 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() ) );
+ if( bApplyMapping )
+ ImplMap( rRect, aRect );
+ else
+ aRect = rRect;
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( aRect.Left() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aRect.Top() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, ::rtl::OUString::valueOf( aRect.GetWidth() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, ::rtl::OUString::valueOf( aRect.GetHeight() ) );
if( nRadX )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, ::rtl::OUString::valueOf( bApplyMapping ? ImplMap( nRadX ) : nRadX ) );
if( nRadY )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ) ) );
-
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, ::rtl::OUString::valueOf( bApplyMapping ? ImplMap( nRadY ) : nRadY ) );
{
SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemRect, sal_True, sal_True );
@@ -601,18 +608,19 @@ void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nR
// -----------------------------------------------------------------------------
void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY,
- const NMSP_RTL::OUString* pStyle )
+ sal_Bool bApplyMapping )
{
- const Point aCenter( ImplMap( rCenter ) );
+ Point aCenter;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, GetValueString( aCenter.X() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, GetValueString( aCenter.Y() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ) ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ) ) );
+ if( bApplyMapping )
+ ImplMap( rCenter, aCenter );
+ else
+ aCenter = rCenter;
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, ::rtl::OUString::valueOf( aCenter.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, ::rtl::OUString::valueOf( aCenter.Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, ::rtl::OUString::valueOf( bApplyMapping ? ImplMap( nRadX ) : nRadX ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, ::rtl::OUString::valueOf( bApplyMapping ? ImplMap( nRadY ) : nRadY ) );
{
SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemEllipse, sal_True, sal_True );
@@ -622,53 +630,78 @@ void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long n
// -----------------------------------------------------------------------------
void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly,
- const NMSP_RTL::OUString* pStyle )
+ sal_Bool bApplyMapping )
{
- if( rPolyPoly.Count() )
+ PolyPolygon aPolyPoly;
+
+ if( bApplyMapping )
+ ImplMap( rPolyPoly, aPolyPoly );
+ else
+ aPolyPoly = rPolyPoly;
+
+ if( mrExport.hasClip() )
{
- PolyPolygon aMappedPolyPoly;
- FastString aStyle;
+ const ::basegfx::B2DPolyPolygon aB2DPolyPoly( ::basegfx::tools::correctOrientations( aPolyPoly.getB2DPolyPolygon() ) );
- for( sal_uInt16 i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
- {
- const Polygon& rPoly = rPolyPoly[ i ];
- const sal_uInt16 nSize = rPoly.GetSize();
+ aPolyPoly = PolyPolygon( ::basegfx::tools::clipPolyPolygonOnPolyPolygon(
+ *mrExport.getCurClip(), aB2DPolyPoly, sal_False, sal_False ) );
+ }
- // #i102224# congratulations, this throws away the curve flags
- // and makes ANY curved polygon look bad. The Flags HAVE to be
- // copied, too. It's NOT enough to copy the mapped points. Just
- // copy the original polygon completely and REPLACE the points
+ // add path data attribute
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrD, GetPathString( aPolyPoly, bLineOnly ) );
- // old: Polygon aMappedPoly( nSize );
- // new:
- Polygon aMappedPoly(rPoly);
+ {
+ // write polyline/polygon element
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemPath, sal_True, sal_True );
+ }
+}
- for( sal_uInt16 n = 0; n < nSize; n++ )
- aMappedPoly[ n ] = ImplMap( rPoly[ n ] );
+// -----------------------------------------------------------------------------
- aMappedPolyPoly.Insert( aMappedPoly );
- }
+void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape, sal_Bool bApplyMapping )
+{
+ PolyPolygon aPolyPoly;
- if( bLineOnly )
- {
- aStyle += B2UCONST( "fill:none" );
- if( pStyle )
- aStyle += B2UCONST( ";" );
- }
- if( pStyle )
- aStyle += *pStyle;
+ if( bApplyMapping )
+ ImplMap( rShape.maShapePolyPoly, aPolyPoly );
+ else
+ aPolyPoly = rShape.maShapePolyPoly;
- // add style attribute
- if( aStyle.GetLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
+ const sal_Bool bLineOnly = ( rShape.maShapeFillColor == Color( COL_TRANSPARENT ) ) && ( !rShape.mapShapeGradient.get() );
+ Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
+
+ mpContext->AddPaintAttr( rShape.maShapeLineColor, rShape.maShapeFillColor, &aBoundRect, rShape.mapShapeGradient.get() );
+
+ if( rShape.maId.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, rShape.maId );
+
+ if( rShape.mnStrokeWidth )
+ {
+ sal_Int32 nStrokeWidth = ( bApplyMapping ? ImplMap( rShape.mnStrokeWidth ) : rShape.mnStrokeWidth );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStrokeWidth, ::rtl::OUString::valueOf( nStrokeWidth ) );
+ }
- // add path data attribute
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrD, GetPathString( aMappedPolyPoly, bLineOnly ) );
+ if( rShape.maDashArray.size() )
+ {
+ const ::rtl::OUString aComma( B2UCONST( "," ) );
+ ::rtl::OUString aDashArrayStr;
+
+ for( unsigned int k = 0; k < rShape.maDashArray.size(); ++k )
{
- // write polyline/polygon element
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemPath, sal_True, sal_True );
+ const sal_Int32 nDash = ( bApplyMapping ?
+ ImplMap( FRound( rShape.maDashArray[ k ] ) ) :
+ FRound( rShape.maDashArray[ k ] ) );
+
+ if( k )
+ aDashArrayStr += aComma;
+
+ aDashArrayStr += ::rtl::OUString::valueOf( nDash );
}
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStrokeDashArray, aDashArrayStr );
}
+
+ ImplWritePolyPolygon( aPolyPoly, bLineOnly, sal_False );
}
// -----------------------------------------------------------------------------
@@ -676,43 +709,44 @@ void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bo
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() );
+ aPatternId += OUString::valueOf( mnCurPatternId++ );
{
SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aPatternId.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aPatternId );
- 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() ) );
+ Rectangle aRect;
+ ImplMap( rPolyPoly.GetBoundRect(), aRect );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrPatternUnits, NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( "userSpaceOnUse") ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, OUString::valueOf( aRect.Left() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, OUString::valueOf( aRect.Top() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, OUString::valueOf( aRect.GetWidth() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, OUString::valueOf( aRect.GetHeight() ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrPatternUnits, 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 += OUString::valueOf( -aRect.Left() );
aTransform += B2UCONST( "," );
- aTransform += GetValueString( -aRect.Top() );
+ aTransform += OUString::valueOf( -aRect.Top() );
aTransform += B2UCONST( ")" );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
{
SvXMLElementExport aElemG2( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
@@ -722,38 +756,46 @@ void SVGActionWriter::ImplWritePattern( const PolyPolygon& rPolyPoly,
mpVDev->AddHatchActions( rPolyPoly, *pHatch, aTmpMtf );
else if ( pGradient )
mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), *pGradient, aTmpMtf );
- ImplWriteActions( aTmpMtf, pStyle, nWriteFlags );
+ ImplWriteActions( aTmpMtf, nWriteFlags, NULL );
}
}
}
- FastString aPatternStyle;
+ ::rtl::OUString aPatternStyle;
aPatternStyle += B2UCONST( "fill:url(#" );
- aPatternStyle += aPatternId.GetString();
+ aPatternStyle += aPatternId;
aPatternStyle += B2UCONST( ")" );
- {
- ImplWritePolyPolygon( rPolyPoly, sal_False, &aPatternStyle.GetString() );
- }
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aPatternStyle );
+ ImplWritePolyPolygon( rPolyPoly, sal_False );
}
}
// -----------------------------------------------------------------------------
void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
- const NMSP_RTL::OUString* pStyle, sal_uInt32 nWriteFlags )
+ 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 )
{
- ImplWriteGradientLinear( rPolyPoly, rGradient );
+ ImplWriteGradientLinear( aPolyPoly, rGradient );
}
else
{
- ImplWritePattern( rPolyPoly, NULL, &rGradient, pStyle, nWriteFlags );
+ ImplWritePattern( aPolyPoly, NULL, &rGradient, nWriteFlags );
}
}
+// -----------------------------------------------------------------------------
+
void SVGActionWriter::ImplWriteGradientLinear( const PolyPolygon& rPolyPoly,
const Gradient& rGradient )
{
@@ -761,20 +803,21 @@ void SVGActionWriter::ImplWriteGradientLinear( const PolyPolygon& rPolyPoly,
{
SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- FastString aGradientId;
+ ::rtl::OUString aGradientId;
aGradientId += B2UCONST( "gradient" );
- aGradientId += GetValueString( ImplGetNextGradientId() );
+ aGradientId += OUString::valueOf( mnCurGradientId++ );
{
SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aGradientId.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aGradientId );
{
- Rectangle aTmpRect;
- Point aTmpCenter;
+ Rectangle aTmpRect, aRect;
+ Point aTmpCenter, aCenter;
+
rGradient.GetBoundRect( rPolyPoly.GetBoundRect(), aTmpRect, aTmpCenter );
- const Rectangle aRect( ImplMap( aTmpRect) );
- const Point aCenter( ImplMap( aTmpCenter) );
+ ImplMap( aTmpRect, aRect );
+ ImplMap( aTmpCenter, aCenter );
const sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
Polygon aPoly( 2 );
@@ -786,13 +829,13 @@ void SVGActionWriter::ImplWriteGradientLinear( const PolyPolygon& rPolyPoly,
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, aXMLAttrX1, OUString::valueOf( aPoly[ 0 ].X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, OUString::valueOf( aPoly[ 0 ].Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, OUString::valueOf( aPoly[ 1 ].X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, OUString::valueOf( aPoly[ 1 ].Y() ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits,
- NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( "userSpaceOnUse" ) ) );
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "userSpaceOnUse" ) ) );
}
{
@@ -855,27 +898,27 @@ void SVGActionWriter::ImplWriteGradientLinear( const PolyPolygon& rPolyPoly,
}
}
- FastString aGradientStyle;
+ ::rtl::OUString aGradientStyle;
aGradientStyle += B2UCONST( "fill:" );
aGradientStyle += B2UCONST( "url(#" );
- aGradientStyle += aGradientId.GetString();
+ aGradientStyle += aGradientId;
aGradientStyle += B2UCONST( ")" );
- {
- ImplWritePolyPolygon( rPolyPoly, sal_False, &aGradientStyle.GetString() );
- }
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aGradientStyle );
+ ImplWritePolyPolygon( rPolyPoly, sal_False );
}
}
void SVGActionWriter::ImplWriteGradientStop( const Color& rColor, double fOffset )
{
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, NMSP_RTL::OUString::valueOf( fOffset ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, rtl::OUString::valueOf( fOffset ) );
- FastString aStyle;
+ ::rtl::OUString aStyle, aColor;
aStyle += B2UCONST( "stop-color:" );
- aStyle += mpContext->GetColorStyle ( rColor );
+ SVGAttributeWriter::ImplGetColorStr ( rColor, aColor );
+ aStyle += aColor;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle );
{
SvXMLElementExport aElemStartStop( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
}
@@ -915,7 +958,6 @@ 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() );
@@ -935,14 +977,14 @@ void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf,
if( nMoveX || nMoveY )
rMtf.Move( nMoveX, nMoveY );
- FastString aMaskId;
+ ::rtl::OUString aMaskId;
aMaskId += B2UCONST( "mask" );
- aMaskId += GetValueString( ImplGetNextMaskId() );
+ aMaskId += OUString::valueOf( mnCurMaskId++ );
{
SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aMaskId.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aMaskId );
{
SvXMLElementExport aElemMask( mrExport, XML_NAMESPACE_NONE, aXMLElemMask, sal_True, sal_True );
@@ -957,21 +999,21 @@ void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf,
aGradient.SetEndColor( aTmpColor );
aGradient.SetEndIntensity( nTmpIntensity );
- ImplWriteGradientEx( aPolyPolygon, aGradient, pStyle, nWriteFlags );
+ ImplWriteGradientEx( aPolyPolygon, aGradient, nWriteFlags );
}
}
- FastString aMaskStyle;
+ ::rtl::OUString aMaskStyle;
aMaskStyle += B2UCONST( "mask:url(#" );
- aMaskStyle += aMaskId.GetString();
+ aMaskStyle += aMaskId;
aMaskStyle += B2UCONST( ")" );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aMaskStyle.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aMaskStyle );
{
SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
mpVDev->Push();
- ImplWriteActions( rMtf, pStyle, nWriteFlags );
+ ImplWriteActions( rMtf, nWriteFlags, NULL );
mpVDev->Pop();
}
}
@@ -980,7 +1022,7 @@ void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf,
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() );
@@ -988,7 +1030,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
if( !bTextSpecial )
{
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( rPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
}
else
{
@@ -1016,8 +1058,8 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
aPos += aOffset;
}
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, aReliefColor );
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, aTextColor );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, aReliefColor, bApplyMapping );
+ ImplWriteText( rPos, rText, pDXArray, nWidth, aTextColor, bApplyMapping );
}
else
{
@@ -1035,34 +1077,34 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
Point aPos( rPos );
aPos += Point( nOff, nOff );
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, aShadowColor );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, aShadowColor, bApplyMapping );
if( !aMetric.IsOutline() )
{
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, aTextColor );
+ ImplWriteText( rPos, rText, pDXArray, nWidth, aTextColor, bApplyMapping );
}
}
if( aMetric.IsOutline() )
{
Point aPos = rPos + Point( -6, -6 );
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
aPos = rPos + Point( +6, +6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
aPos = rPos + Point( -6, +0);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
aPos = rPos + Point( -6, +6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
aPos = rPos + Point( +0, +6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
aPos = rPos + Point( +0, -6);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
aPos = rPos + Point( +6, -1);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
aPos = rPos + Point( +6, +0);
- ImplWriteText( aPos, rText, pDXArray, nWidth, pStyle, mpVDev->GetTextColor() );
+ ImplWriteText( aPos, rText, pDXArray, nWidth, mpVDev->GetTextColor(), bApplyMapping );
- ImplWriteText( rPos, rText, pDXArray, nWidth, pStyle, Color( COL_WHITE ) );
+ ImplWriteText( rPos, rText, pDXArray, nWidth, Color( COL_WHITE ), bApplyMapping );
}
}
}
@@ -1070,165 +1112,139 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
const sal_Int32* pDXArray, long nWidth,
- const NMSP_RTL::OUString* pStyle,
- Color aTextColor )
+ Color aTextColor, sal_Bool bApplyMapping )
{
- long nLen = rText.Len();
+ sal_Int32 nLen = rText.Len();
+ Size aNormSize;
+ ::std::auto_ptr< sal_Int32 > apTmpArray;
+ 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( bApplyMapping )
+ ImplMap( rPos, aPos );
+ else
+ aPos = rPos;
- if( nLen )
+ // get text sizes
+ if( pDXArray )
{
- 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;
- }
-
- if( nLen > 1 )
- {
- aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( sal::static_int_cast<sal_uInt16>( nLen - 1 ) ) );
+ 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();
+ }
- if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
- {
- const double fFactor = (double) nWidth / aNormSize.Width();
+ // if text is rotated, set transform matrix at new g element
+ if( rFont.GetOrientation() )
+ {
+ Point aRot( aPos );
+ String aTransform;
+
+ 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( RTL_CONSTASCII_USTRINGPARAM( " rotate" ) ) );
+ aTransform += '(';
+ aTransform += String( ::rtl::OUString::valueOf( rFont.GetOrientation() * -0.1 ) );
+ aTransform += ')';
+
+ 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 );
+ }
- for(long i = 0; i < ( nLen - 1 ); i++ )
- pDX[ i ] = FRound( pDX[ i ] * fFactor );
- }
- }
+ mpContext->AddPaintAttr( COL_TRANSPARENT, aTextColor );
- 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( 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 += ')';
- }
-
- aTransform += String( NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( " translate" )) );
- aTransform += '(';
- aTransform += String( GetValueString( -aPt.X() ) );
- aTransform += ',';
- aTransform += String( GetValueString( -aPt.Y() ) );
- aTransform += ')';
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
- }
+ sal_Int32 nCount = 1;
- // add additional style if requested
- if( pStyle && pStyle->getLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+ nLastPos = nCurPos;
+ nCurPos = xBI->nextCharacters( rText, nCurPos, rLocale,
+ ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL,
+ nCount, nCount );
- // 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 ) );
- if( nCurPos < nLen )
- aOutputText.Erase( sal::static_int_cast<sal_uInt16>( nCurPos ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( nX ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aTSpanX.GetString() );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False );
+ mrExport.GetDocHandler()->characters( aGlyph );
+ }
- {
- SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemTSpan, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( aOutputText );
+ if( bCont )
+ nX = aPos.X() + pDXArray[ nCurPos - 1 ];
+ }
}
-#else
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
+ }
+ }
+ else
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( aPos.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) );
- {
- SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( rText );
- }
-#endif
+ {
+ 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 );
if( rFont.GetStrikeout() )
{
- const long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
+ const long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYLinePos - ( nLineHeight >> 1 );
aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
@@ -1250,9 +1266,6 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
ImplWritePolyPolygon( aPoly, sal_False );
}
}
-#endif // _SVG_USE_NATIVE_TEXTDECORATION
-
- delete[] pOwnArray;
}
}
@@ -1261,7 +1274,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
const Point& rPt, const Size& rSz,
const Point& rSrcPt, const Size& rSrcSz,
- const NMSP_RTL::OUString* /* pStyle */ )
+ sal_Bool bApplyMapping )
{
if( !!rBmpEx )
{
@@ -1279,19 +1292,29 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE )
{
- const Point aPt( ImplMap( rPt ) );
- const Size aSz( ImplMap( rSz ) );
+ Point aPt;
+ Size aSz;
Sequence< sal_Int8 > aSeq( (sal_Int8*) aOStm.GetData(), aOStm.Tell() );
- NMSP_RTL::OUStringBuffer aBuffer;
+ rtl::OUStringBuffer aBuffer;
aBuffer.appendAscii( "data:image/png;base64," );
SvXMLUnitConverter::encodeBase64( aBuffer, aSeq );
- 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() );
+ if( bApplyMapping )
+ {
+ ImplMap( rPt, aPt );
+ ImplMap( rSz, aSz );
+ }
+ else
+ {
+ aPt = rPt;
+ aSz = rSz;
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, OUString::valueOf( aPt.X() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, OUString::valueOf( aPt.Y() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, OUString::valueOf( aSz.Width() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, OUString::valueOf( aSz.Height() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, aBuffer.makeStringAndClear() );
{
SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemImage, sal_True, sal_True );
}
@@ -1303,14 +1326,15 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
// -----------------------------------------------------------------------------
void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
- const NMSP_RTL::OUString* pStyle,
- sal_uInt32 nWriteFlags )
+ sal_uInt32 nWriteFlags,
+ const ::rtl::OUString* pElementId )
{
- ImplAcquireContext();
+ if( mnInnerMtfCount )
+ nWriteFlags |= SVGWRITER_NO_SHAPE_COMMENTS;
- for( size_t i = 0, nCount = rMtf.GetActionSize(); i < nCount; i++ )
+ for( sal_uLong nCurAction = 0, nCount = rMtf.GetActionSize(); nCurAction < nCount; nCurAction++ )
{
- const MetaAction* pAction = rMtf.GetAction( i );
+ const MetaAction* pAction = rMtf.GetAction( nCurAction );
const sal_uInt16 nType = pAction->GetType();
switch( nType )
@@ -1321,8 +1345,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
- mpContext->SetPaintAttr( pA->GetColor(), pA->GetColor() );
- ImplWriteLine( pA->GetPoint(), pA->GetPoint(), &pA->GetColor(), pStyle );
+ mpContext->AddPaintAttr( pA->GetColor(), pA->GetColor() );
+ ImplWriteLine( pA->GetPoint(), pA->GetPoint(), &pA->GetColor() );
}
}
break;
@@ -1333,8 +1357,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaPointAction* pA = (const MetaPointAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
- ImplWriteLine( pA->GetPoint(), pA->GetPoint(), NULL, pStyle );
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
+ ImplWriteLine( pA->GetPoint(), pA->GetPoint(), NULL );
}
}
break;
@@ -1345,17 +1369,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaLineAction* pA = (const MetaLineAction*) pAction;
- if(pA->GetLineInfo().IsDefault())
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
- }
- else
- {
- const LineInfo aMappedLineInfo(ImplMap(pA->GetLineInfo()));
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor(), &aMappedLineInfo );
- }
-
- ImplWriteLine( pA->GetStartPoint(), pA->GetEndPoint(), NULL, pStyle );
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
+ ImplWriteLine( pA->GetStartPoint(), pA->GetEndPoint(), NULL );
}
}
break;
@@ -1364,8 +1379,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
if( nWriteFlags & SVGWRITER_WRITE_FILL )
{
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteRect( ( (const MetaRectAction*) pAction )->GetRect(), 0, 0, pStyle );
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteRect( ( (const MetaRectAction*) pAction )->GetRect(), 0, 0 );
}
}
break;
@@ -1376,8 +1391,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound(), pStyle );
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
}
}
break;
@@ -1389,8 +1404,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
const Rectangle& rRect = pA->GetRect();
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteEllipse( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1, pStyle );
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteEllipse( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1 );
}
}
break;
@@ -1434,8 +1449,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( aPoly.GetSize() )
{
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolyPolygon( aPoly, sal_False, pStyle );
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWritePolyPolygon( aPoly, sal_False );
}
}
}
@@ -1450,51 +1465,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( rPoly.GetSize() )
{
- bool bNoLineJoin(false);
-
- if(pA->GetLineInfo().IsDefault())
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- }
- else
- {
- const LineInfo aMappedLineInfo(ImplMap(pA->GetLineInfo()));
- bNoLineJoin = basegfx::B2DLINEJOIN_NONE == aMappedLineInfo.GetLineJoin();
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor(), &aMappedLineInfo );
- }
-
- if(bNoLineJoin)
- {
- // emulate B2DLINEJOIN_NONE by creating single edges
- const sal_uInt16 nPoints(rPoly.GetSize());
- const bool bCurve(rPoly.HasFlags());
-
- for(sal_uInt16 a(0); a + 1 < nPoints; a++)
- {
- if(bCurve
- && POLY_NORMAL != rPoly.GetFlags(a + 1)
- && a + 2 < nPoints
- && POLY_NORMAL != rPoly.GetFlags(a + 2)
- && a + 3 < nPoints)
- {
- const Polygon aSnippet(4,
- rPoly.GetConstPointAry() + a,
- rPoly.GetConstFlagAry() + a);
- ImplWritePolyPolygon( aSnippet, sal_True, pStyle );
- a += 2;
- }
- else
- {
- const Polygon aSnippet(2,
- rPoly.GetConstPointAry() + a);
- ImplWritePolyPolygon( aSnippet, sal_True, pStyle );
- }
- }
- }
- else
- {
- ImplWritePolyPolygon( rPoly, sal_True, pStyle );
- }
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), Color( COL_TRANSPARENT ) );
+ ImplWritePolyPolygon( rPoly, sal_True );
}
}
}
@@ -1509,8 +1481,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( rPolyPoly.Count() )
{
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
+ mpContext->AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWritePolyPolygon( rPolyPoly, sal_False );
}
}
}
@@ -1524,7 +1496,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const Polygon aRectPoly( pA->GetRect() );
const PolyPolygon aRectPolyPoly( aRectPoly );
- ImplWriteGradientEx( aRectPolyPoly, pA->GetGradient(), pStyle, nWriteFlags );
+ ImplWriteGradientEx( aRectPolyPoly, pA->GetGradient(), nWriteFlags );
}
}
break;
@@ -1534,7 +1506,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( nWriteFlags & SVGWRITER_WRITE_FILL )
{
const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
- ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), pStyle, nWriteFlags );
+ ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), nWriteFlags );
}
}
break;
@@ -1544,7 +1516,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( nWriteFlags & SVGWRITER_WRITE_FILL )
{
const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
- ImplWritePattern( pA->GetPolyPolygon(), &pA->GetHatch(), NULL, pStyle, nWriteFlags );
+ ImplWritePattern( pA->GetPolyPolygon(), &pA->GetHatch(), NULL, nWriteFlags );
}
}
break;
@@ -1558,15 +1530,13 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( rPolyPoly.Count() )
{
- const Color aOldLineColor( mpVDev->GetLineColor() ), aOldFillColor( mpVDev->GetFillColor() );
- Color aNewLineColor( aOldLineColor ), aNewFillColor( aOldFillColor );
+ Color aNewLineColor( mpVDev->GetLineColor() ), aNewFillColor( mpVDev->GetFillColor() );
aNewLineColor.SetTransparency( sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
aNewFillColor.SetTransparency( sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
- mpContext->SetPaintAttr( aNewLineColor, aNewFillColor );
- ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
- mpContext->SetPaintAttr( aOldLineColor, aOldFillColor );
+ mpContext->AddPaintAttr( aNewLineColor, aNewFillColor );
+ ImplWritePolyPolygon( rPolyPoly, sal_False );
}
}
}
@@ -1579,7 +1549,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
ImplWriteMask( aTmpMtf, pA->GetPoint(), pA->GetSize(),
- pA->GetGradient(), pStyle, nWriteFlags );
+ pA->GetGradient(), nWriteFlags );
}
}
break;
@@ -1592,18 +1562,17 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
sal_Bool bFound = sal_False;
- for( size_t j = 0, nC = aGDIMetaFile.GetActionSize(); ( j < nC ) && !bFound; j++ )
+ for( sal_uInt32 k = 0, nCount2 = aGDIMetaFile.GetActionSize(); ( k < nCount2 ) && !bFound; ++k )
{
- const MetaAction* pSubstAct = aGDIMetaFile.GetAction( j );
+ const MetaAction* pSubstAct = aGDIMetaFile.GetAction( k );
if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
{
bFound = sal_True;
const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pSubstAct;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
ImplWriteBmp( pBmpScaleAction->GetBitmap(),
pA->GetPoint(), pA->GetSize(),
- Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), pStyle );
+ Point(), pBmpScaleAction->GetBitmap().GetSizePixel() );
}
}
}
@@ -1621,21 +1590,159 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const MetaGradientExAction* pGradAction = NULL;
sal_Bool bDone = sal_False;
- while( !bDone && ( ++i < nCount ) )
+ while( !bDone && ( ++nCurAction < nCount ) )
{
- pAction = rMtf.GetAction( i );
+ pAction = rMtf.GetAction( nCurAction );
if( pAction->GetType() == META_GRADIENTEX_ACTION )
pGradAction = (const MetaGradientExAction*) pAction;
else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
- ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+ ( ( (const MetaCommentAction*) pAction )->GetComment().
+ CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
{
bDone = sal_True;
}
}
if( pGradAction )
- ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pStyle, nWriteFlags );
+ ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), nWriteFlags );
+ }
+ else if( ( pA->GetComment().CompareIgnoreCaseToAscii( "XPATHFILL_SEQ_BEGIN" ) == COMPARE_EQUAL ) &&
+ ( nWriteFlags & SVGWRITER_WRITE_FILL ) && !( nWriteFlags & SVGWRITER_NO_SHAPE_COMMENTS ) &&
+ pA->GetDataSize() )
+ {
+ // write open shape in every case
+ if( mapCurShape.get() )
+ {
+ ImplWriteShape( *mapCurShape );
+ mapCurShape.reset();
+ }
+
+ SvMemoryStream aMemStm( (void*) pA->GetData(), pA->GetDataSize(), STREAM_READ );
+ SvtGraphicFill aFill;
+
+ aMemStm >> aFill;
+
+ sal_Bool bGradient = SvtGraphicFill::fillGradient == aFill.getFillType() &&
+ ( SvtGraphicFill::gradientLinear == aFill.getGradientType() ||
+ SvtGraphicFill::gradientRadial == aFill.getGradientType() );
+ sal_Bool bSkip = ( SvtGraphicFill::fillSolid == aFill.getFillType() || bGradient );
+
+ if( bSkip )
+ {
+ PolyPolygon aShapePolyPoly;
+
+ aFill.getPath( aShapePolyPoly );
+
+ if( aShapePolyPoly.Count() )
+ {
+ mapCurShape.reset( new SVGShapeDescriptor );
+
+ if( pElementId )
+ mapCurShape->maId = *pElementId;
+
+ mapCurShape->maShapePolyPoly = aShapePolyPoly;
+ mapCurShape->maShapeFillColor = aFill.getFillColor();
+ mapCurShape->maShapeFillColor.SetTransparency( (sal_uInt8) FRound( 255.0 * aFill.getTransparency() ) );
+
+ if( bGradient )
+ {
+ // step through following actions until the first Gradient/GradientEx action is found
+ while( !mapCurShape->mapShapeGradient.get() && bSkip && ( ++nCurAction < nCount ) )
+ {
+ pAction = rMtf.GetAction( nCurAction );
+
+ if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().
+ CompareIgnoreCaseToAscii( "XPATHFILL_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bSkip = sal_False;
+ }
+ else if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ {
+ mapCurShape->mapShapeGradient.reset( new Gradient(
+ static_cast< const MetaGradientExAction* >( pAction )->GetGradient() ) );
+ }
+ else if( pAction->GetType() == META_GRADIENT_ACTION )
+ {
+ mapCurShape->mapShapeGradient.reset( new Gradient(
+ static_cast< const MetaGradientAction* >( pAction )->GetGradient() ) );
+ }
+ }
+ }
+ }
+ else
+ bSkip = sal_False;
+ }
+
+ // skip rest of comment
+ while( bSkip && ( ++nCurAction < nCount ) )
+ {
+ pAction = rMtf.GetAction( nCurAction );
+
+ if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().
+ CompareIgnoreCaseToAscii( "XPATHFILL_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bSkip = sal_False;
+ }
+ }
+ }
+ else if( ( pA->GetComment().CompareIgnoreCaseToAscii( "XPATHSTROKE_SEQ_BEGIN" ) == COMPARE_EQUAL ) &&
+ ( nWriteFlags & SVGWRITER_WRITE_FILL ) && !( nWriteFlags & SVGWRITER_NO_SHAPE_COMMENTS ) &&
+ pA->GetDataSize() )
+ {
+ SvMemoryStream aMemStm( (void*) pA->GetData(), pA->GetDataSize(), STREAM_READ );
+ SvtGraphicStroke aStroke;
+ PolyPolygon aStartArrow, aEndArrow;
+
+ aMemStm >> aStroke;
+ aStroke.getStartArrow( aStartArrow );
+ aStroke.getEndArrow( aEndArrow );
+
+ // Currently no support for strokes with start/end arrow(s)
+ sal_Bool bSkip = ( !aStartArrow.Count() && !aEndArrow.Count() );
+
+ if( bSkip )
+ {
+ if( !mapCurShape.get() )
+ {
+ Polygon aPoly;
+
+ mapCurShape.reset( new SVGShapeDescriptor );
+
+ if( pElementId )
+ mapCurShape->maId = *pElementId;
+
+ aStroke.getPath( aPoly );
+ mapCurShape->maShapePolyPoly = aPoly;
+ }
+
+ mapCurShape->maShapeLineColor = mpVDev->GetLineColor();
+ mapCurShape->maShapeLineColor.SetTransparency( (sal_uInt8) FRound( aStroke.getTransparency() * 255.0 ) );
+ mapCurShape->mnStrokeWidth = FRound( aStroke.getStrokeWidth() );
+ aStroke.getDashArray( mapCurShape->maDashArray );
+ }
+
+ // write open shape in every case
+ if( mapCurShape.get() )
+ {
+ ImplWriteShape( *mapCurShape );
+ mapCurShape.reset();
+ }
+
+ // skip rest of comment
+ while( bSkip && ( ++nCurAction < nCount ) )
+ {
+ pAction = rMtf.GetAction( nCurAction );
+
+ if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().
+ CompareIgnoreCaseToAscii( "XPATHSTROKE_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bSkip = sal_False;
+ }
+ }
}
}
break;
@@ -1646,10 +1753,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
ImplWriteBmp( pA->GetBitmap(),
pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ),
- Point(), pA->GetBitmap().GetSizePixel(), pStyle );
+ Point(), pA->GetBitmap().GetSizePixel() );
}
}
break;
@@ -1660,10 +1766,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
ImplWriteBmp( pA->GetBitmap(),
pA->GetPoint(), pA->GetSize(),
- Point(), pA->GetBitmap().GetSizePixel(), pStyle );
+ Point(), pA->GetBitmap().GetSizePixel() );
}
}
break;
@@ -1674,10 +1779,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
ImplWriteBmp( pA->GetBitmap(),
pA->GetDestPoint(), pA->GetDestSize(),
- pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+ pA->GetSrcPoint(), pA->GetSrcSize() );
}
}
break;
@@ -1688,10 +1792,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
ImplWriteBmp( pA->GetBitmapEx(),
pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
- Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
+ Point(), pA->GetBitmapEx().GetSizePixel() );
}
}
break;
@@ -1702,10 +1805,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
ImplWriteBmp( pA->GetBitmapEx(),
pA->GetPoint(), pA->GetSize(),
- Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
+ Point(), pA->GetBitmapEx().GetSizePixel() );
}
}
break;
@@ -1716,10 +1818,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
ImplWriteBmp( pA->GetBitmapEx(),
pA->GetDestPoint(), pA->GetDestSize(),
- pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+ pA->GetSrcPoint(), pA->GetSrcSize() );
}
}
break;
@@ -1729,11 +1830,20 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( nWriteFlags & SVGWRITER_WRITE_TEXT )
{
const MetaTextAction* pA = (const MetaTextAction*) pAction;
- Font aFont( mpVDev->GetFont() );
+ const String aText( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+
+ if( aText.Len() )
+ {
+ Font aFont( mpVDev->GetFont() );
+ Size aSz;
+
+ ImplMap( Size( 0, aFont.GetHeight() ), aSz );
- aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
- mpContext->SetFontAttr( aFont );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, 0, pStyle );
+ aFont.SetHeight( aSz.Height() );
+ mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ mpContext->SetFontAttr( aFont );
+ ImplWriteText( pA->GetPoint(), aText, NULL, 0 );
+ }
}
}
break;
@@ -1742,12 +1852,20 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
if( nWriteFlags & SVGWRITER_WRITE_TEXT )
{
- const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
- Font aFont( mpVDev->GetFont() );
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
- aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
- mpContext->SetFontAttr( aFont );
- ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0, pStyle );
+ if( pA->GetText().Len() )
+ {
+ Font aFont( mpVDev->GetFont() );
+ Size aSz;
+
+ ImplMap( Size( 0, aFont.GetHeight() ), aSz );
+
+ aFont.SetHeight( aSz.Height() );
+ mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ mpContext->SetFontAttr( aFont );
+ ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0 );
+ }
}
}
break;
@@ -1757,12 +1875,20 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( nWriteFlags & SVGWRITER_WRITE_TEXT )
{
const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
- const Point aPos( ImplMap( pA->GetPoint() ) );
- Font aFont( mpVDev->GetFont() );
+ const String aText( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+
+ if( aText.Len() )
+ {
+ Font aFont( mpVDev->GetFont() );
+ Size aSz;
+
+ ImplMap( Size( 0, aFont.GetHeight() ), aSz );
- aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
- mpContext->SetFontAttr( aFont );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), pA->GetDXArray(), 0, pStyle );
+ aFont.SetHeight( aSz.Height() );
+ mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ mpContext->SetFontAttr( aFont );
+ ImplWriteText( pA->GetPoint(), aText, pA->GetDXArray(), 0 );
+ }
}
}
break;
@@ -1772,11 +1898,38 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( nWriteFlags & SVGWRITER_WRITE_TEXT )
{
const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
- Font aFont( mpVDev->GetFont() );
+ const String aText( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+
+ if( aText.Len() )
+ {
+ Font aFont( mpVDev->GetFont() );
+ Size aSz;
+
+ ImplMap( Size( 0, aFont.GetHeight() ), aSz );
- aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
- mpContext->SetFontAttr( aFont );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, pA->GetWidth(), pStyle );
+ aFont.SetHeight( aSz.Height() );
+ mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ mpContext->SetFontAttr( aFont );
+ ImplWriteText( pA->GetPoint(), aText, NULL, pA->GetWidth() );
+ }
+ }
+ }
+ break;
+
+ case( META_RENDERGRAPHIC_ACTION ):
+ {
+ if( nWriteFlags & SVGWRITER_WRITE_FILL )
+ {
+ // TODO KA: try to embed the native data in case the RenderGraphic
+ // contains valid SVG data (MimeType "image/svg+xml")
+ // => incorporate 'use' or 'image' element (KA 01/2011)
+ 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 ) );
+
+ ImplWriteBmp( aBmpEx, pA->GetPoint(), pA->GetSize(), aPointPixel, aBmpEx.GetSizePixel() );
}
}
break;
@@ -1824,8 +1977,6 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
break;
}
}
-
- ImplReleaseContext();
}
// -----------------------------------------------------------------------------
@@ -1833,7 +1984,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm,
const Size& rSize100thmm,
const GDIMetaFile& rMtf,
- sal_uInt32 nWriteFlags )
+ sal_uInt32 nWriteFlags,
+ const ::rtl::OUString* pElementId )
{
MapMode aMapMode( rMtf.GetPrefMapMode() );
Size aPrefSize( rMtf.GetPrefSize() );
@@ -1850,9 +2002,20 @@ void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm,
aMapMode.SetOrigin( aOffset += aMapMode.GetOrigin() );
mpVDev->SetMapMode( aMapMode );
+ ImplAcquireContext();
- ImplWriteActions( rMtf, NULL, nWriteFlags );
+ mapCurShape.reset();
+ ImplWriteActions( rMtf, nWriteFlags, pElementId );
+
+ // draw open shape that doesn't have a border
+ if( mapCurShape.get() )
+ {
+ ImplWriteShape( *mapCurShape );
+ mapCurShape.reset();
+ }
+
+ ImplReleaseContext();
mpVDev->Pop();
}
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index 70db30c2948d..b21d86095700 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -3,10 +3,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: svgwriter.hxx,v $
+ * $Revision: 1.5.86.14 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -42,6 +45,8 @@
#include <vcl/metric.hxx>
#include <vcl/virdev.hxx>
#include <vcl/cvtgrf.hxx>
+#include <vcl/graphictools.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
#include <xmloff/xmlexp.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmluconv.hxx>
@@ -56,18 +61,18 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
// -----------------------------------------------------------------------------
-#define _SVG_USE_NATIVE_TEXTDECORATION
-#define _SVG_USE_TSPANS 1
-#undef _SVG_WRITE_EXTENTS
-#define _SVG_EMBED_FONTS 1
+#define _SVG_WRITE_EXTENTS 1
+#undef _SVG_WRITE_TEXT_DESC
+#undef _SVG_USE_CONFIG
// -----------------------------------------------------------------------------
#define NMSP_CPPU cppu
-#define NMSP_RTL rtl
#define NMSP_UNO com::sun::star::uno
#define NMSP_LANG com::sun::star::lang
#define NMSP_SAX com::sun::star::xml::sax
@@ -77,47 +82,22 @@
#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 -
// ----------------------
class SVGActionWriter;
+class SVGExport;
class SVGFontExport;
class SVGAttributeWriter
@@ -127,24 +107,50 @@ private:
Font maCurFont;
Color maCurLineColor;
Color maCurFillColor;
- SvXMLExport& mrExport;
+ SVGExport& mrExport;
SVGFontExport& mrFontExport;
SvXMLElementExport* mpElemFont;
SvXMLElementExport* mpElemPaint;
SVGAttributeWriter();
+ 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 SetPaintAttr( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo = 0);
+
+ static void ImplGetColorStr( const Color& rColor, ::rtl::OUString& rColorStr );
+};
+
+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 )
+ {
+ }
};
// -------------------
@@ -159,68 +165,74 @@ class SVGActionWriter
{
private:
- SvXMLExport& mrExport;
- SVGFontExport& mrFontExport;
- SVGAttributeWriter* mpContext;
- sal_Bool mbClipAttrChanged;
- sal_Int32 mnCurClipId;
- sal_Int32 mnCurPatternId;
- sal_Int32 mnCurGradientId;
- sal_Int32 mnCurMaskId;
- Stack maContextStack;
- VirtualDevice* mpVDev;
- MapMode maTargetMapMode;
- sal_Bool mbDestroyVDev;
- sal_Bool mbPaintAttrChanged;
- sal_Bool mbFontAttrChanged;
+ sal_Int32 mnCurGradientId;
+ sal_Int32 mnCurMaskId;
+ sal_Int32 mnCurPatternId;
+ Stack maContextStack;
+ ::std::auto_ptr< SVGShapeDescriptor > mapCurShape;
+ SVGExport& mrExport;
+ SVGFontExport& mrFontExport;
+ SVGAttributeWriter* mpContext;
+ VirtualDevice* mpVDev;
+ MapMode maTargetMapMode;
+ sal_uInt32 mnInnerMtfCount;
+ sal_Bool mbDestroyVDev;
+ sal_Bool mbPaintAttrChanged;
+ sal_Bool mbFontAttrChanged;
+ sal_Bool mbClipAttrChanged;
SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( mrExport, mrFontExport ) ); return mpContext; }
void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
long ImplMap( sal_Int32 nVal ) const;
- Point ImplMap( const Point& rPt ) const;
- Size ImplMap( const Size& rSz ) const;
- LineInfo ImplMap( const LineInfo& rLineInfo ) const;
- inline Rectangle ImplMap( const Rectangle& rRect ) const { return Rectangle( ImplMap( rRect.TopLeft() ), ImplMap( rRect.GetSize() ) ); }
-
- void ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = NULL, const ::rtl::OUString* pStyle = NULL );
- void ImplWriteRect( const Rectangle& rRect, long nRadX = 0, long nRadY = 0, const ::rtl::OUString* pStyle = NULL );
- void ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY, const ::rtl::OUString* pStyle = NULL );
- void ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly, const ::rtl::OUString* pStyle = NULL );
- void ImplWritePattern( const PolyPolygon& rPolyPoly, const Hatch* pHatch, const Gradient* pGradient, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags );
- void ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags );
+ Point& ImplMap( const Point& rPt, Point& rDstPt ) const;
+ Size& ImplMap( const Size& rSz, Size& rDstSz ) const;
+ Rectangle& ImplMap( const Rectangle& rRect, Rectangle& rDstRect ) const;
+ Polygon& ImplMap( const Polygon& rPoly, Polygon& rDstPoly ) const;
+ PolyPolygon& ImplMap( const PolyPolygon& rPolyPoly, PolyPolygon& rDstPolyPoly ) const;
+
+ void ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = NULL,
+ sal_Bool bApplyMapping = sal_True );
+ void ImplWriteRect( const Rectangle& rRect, long nRadX = 0, long nRadY = 0,
+ sal_Bool bApplyMapping = sal_True );
+ void ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY,
+ sal_Bool bApplyMapping = sal_True );
+ void ImplWritePattern( const PolyPolygon& rPolyPoly, const Hatch* pHatch, const Gradient* pGradient, sal_uInt32 nWriteFlags );
+ void ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly,
+ sal_Bool bApplyMapping = sal_True );
+ void ImplWriteShape( const SVGShapeDescriptor& rShape, sal_Bool bApplyMapping = sal_True );
+ void ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, sal_uInt32 nWriteFlags,
+ sal_Bool bApplyMapping = sal_True );
void ImplWriteGradientLinear( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
void ImplWriteGradientStop( const Color& rColor, double fOffset );
Color ImplGetColorWithIntensity( const Color& rColor, sal_uInt16 nIntensity );
Color ImplGetGradientColor( const Color& rStartColor, const Color& rEndColor, double fOffset );
- void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags );
- void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, const ::rtl::OUString* pStyle = NULL );
- void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, const ::rtl::OUString* pStyle, Color aTextColor );
- void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const ::rtl::OUString* pStyle = NULL );
+ void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, sal_uInt32 nWriteFlags );
+ void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth,
+ sal_Bool bApplyMapping = sal_True );
+ void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, Color aTextColor, sal_Bool bApplyMapping );
+ void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz,
+ sal_Bool bApplyMapping = sal_True );
void ImplCheckFontAttributes();
void ImplCheckPaintAttributes();
- void ImplWriteActions( const GDIMetaFile& rMtf, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags );
- sal_Int32 ImplGetNextClipId() { return mnCurClipId++; }
- sal_Int32 ImplGetNextPatternId() { return mnCurPatternId++; }
- sal_Int32 ImplGetNextGradientId() { return mnCurGradientId++; }
- sal_Int32 ImplGetNextMaskId() { return mnCurMaskId++; }
+ void ImplWriteActions( const GDIMetaFile& rMtf, sal_uInt32 nWriteFlags, const ::rtl::OUString* pElementId );
public:
- static ::rtl::OUString GetValueString( sal_Int32 nVal );
static ::rtl::OUString GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine );
public:
- SVGActionWriter( SvXMLExport& rExport, SVGFontExport& rFontExport );
+ SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport );
virtual ~SVGActionWriter();
void WriteMetaFile( const Point& rPos100thmm,
const Size& rSize100thmm,
const GDIMetaFile& rMtf,
- sal_uInt32 nWriteFlags = SVGWRITER_WRITE_ALL );
+ sal_uInt32 nWriteFlags,
+ const ::rtl::OUString* pElementId = NULL );
};
#endif