[Libreoffice-commits] .: 78 commits - binfilter/bf_svtools filter/inc filter/prj filter/source oox/inc oox/Library_oox.mk oox/prj oox/source oox/workben unoxml/qa writerfilter/Makefile writerfilter/source

Jan Holesovsky kendy at kemper.freedesktop.org
Fri May 27 12:16:01 PDT 2011


 binfilter/bf_svtools/source/filter.vcl/jpeg/makefile.mk              |    2 
 binfilter/bf_svtools/source/filter.vcl/jpeg/svt_jpeg.cxx             |    4 
 filter/inc/filter/msfilter/msvbahelper.hxx                           |    2 
 filter/prj/build.lst                                                 |    6 
 filter/source/config/fragments/fcfg_drawgraphics.mk                  |    1 
 filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu |    4 
 filter/source/flash/swfwriter1.cxx                                   |   14 
 filter/source/graphicfilter/eos2met/eos2met.cxx                      |   79 
 filter/source/graphicfilter/epict/epict.cxx                          |   24 
 filter/source/graphicfilter/eps/eps.cxx                              |   25 
 filter/source/msfilter/msvbahelper.cxx                               |   58 
 filter/source/pdf/impdialog.src                                      |    4 
 filter/source/svg/impsvgdialog.cxx                                   |  150 
 filter/source/svg/impsvgdialog.hxx                                   |   96 
 filter/source/svg/makefile.mk                                        |   10 
 filter/source/svg/svgdialog.cxx                                      |  275 +
 filter/source/svg/svgdialog.hxx                                      |  120 
 filter/source/svg/svgexport.cxx                                      |  316 +
 filter/source/svg/svgfilter.cxx                                      |   20 
 filter/source/svg/svgfilter.hxx                                      |   96 
 filter/source/svg/svgfontexport.cxx                                  |  252 +
 filter/source/svg/svgfontexport.hxx                                  |   28 
 filter/source/svg/svguno.cxx                                         |   79 
 filter/source/svg/svgwriter.cxx                                      | 1593 +++++-----
 filter/source/svg/svgwriter.hxx                                      |  186 -
 oox/Library_oox.mk                                                   |    5 
 oox/inc/oox/core/contexthandler.hxx                                  |    4 
 oox/inc/oox/core/fasttokenhandler.hxx                                |    4 
 oox/inc/oox/core/filterbase.hxx                                      |    4 
 oox/inc/oox/core/fragmenthandler.hxx                                 |    4 
 oox/inc/oox/core/relations.hxx                                       |    4 
 oox/inc/oox/core/relationshandler.hxx                                |    4 
 oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx                 |    5 
 oox/inc/oox/drawingml/chart/converterbase.hxx                        |    1 
 oox/inc/oox/drawingml/color.hxx                                      |    8 
 oox/inc/oox/drawingml/drawingmltypes.hxx                             |   23 
 oox/inc/oox/drawingml/fillproperties.hxx                             |   55 
 oox/inc/oox/drawingml/lineproperties.hxx                             |   48 
 oox/inc/oox/drawingml/shapepropertymap.hxx                           |  148 
 oox/inc/oox/dump/biffdumper.hxx                                      |    4 
 oox/inc/oox/dump/dumperbase.hxx                                      |  134 
 oox/inc/oox/dump/oledumper.hxx                                       |   10 
 oox/inc/oox/dump/pptxdumper.hxx                                      |    4 
 oox/inc/oox/dump/xlsbdumper.hxx                                      |    4 
 oox/inc/oox/helper/binaryinputstream.hxx                             |  323 +-
 oox/inc/oox/helper/binaryoutputstream.hxx                            |   86 
 oox/inc/oox/helper/binarystreambase.hxx                              |  130 
 oox/inc/oox/helper/containerhelper.hxx                               |   56 
 oox/inc/oox/helper/graphichelper.hxx                                 |    2 
 oox/inc/oox/helper/helper.hxx                                        |   30 
 oox/inc/oox/helper/modelobjecthelper.hxx                             |   22 
 oox/inc/oox/helper/propertymap.hxx                                   |   16 
 oox/inc/oox/helper/propertyset.hxx                                   |   46 
 oox/inc/oox/helper/textinputstream.hxx                               |   89 
 oox/inc/oox/helper/zipstorage.hxx                                    |   11 
 oox/inc/oox/ole/axbinaryreader.hxx                                   |   16 
 oox/inc/oox/ole/oleobjecthelper.hxx                                  |    2 
 oox/inc/oox/ole/olestorage.hxx                                       |   10 
 oox/inc/oox/ole/vbacontrol.hxx                                       |    2 
 oox/inc/oox/ole/vbainputstream.hxx                                   |   17 
 oox/inc/oox/ole/vbamodule.hxx                                        |    4 
 oox/inc/oox/ole/vbaproject.hxx                                       |    2 
 oox/inc/oox/ppt/slidepersist.hxx                                     |    4 
 oox/inc/oox/vml/vmldrawing.hxx                                       |    2 
 oox/inc/oox/vml/vmlformatting.hxx                                    |   11 
 oox/inc/oox/vml/vmlinputstream.hxx                                   |   70 
 oox/inc/oox/xls/biffhelper.hxx                                       |    3 
 oox/inc/oox/xls/biffinputstream.hxx                                  |   28 
 oox/inc/oox/xls/biffoutputstream.hxx                                 |   32 
 oox/inc/oox/xls/chartsheetfragment.hxx                               |   11 
 oox/inc/oox/xls/commentsbuffer.hxx                                   |   13 
 oox/inc/oox/xls/condformatbuffer.hxx                                 |    4 
 oox/inc/oox/xls/defnamesbuffer.hxx                                   |   23 
 oox/inc/oox/xls/drawingbase.hxx                                      |  148 
 oox/inc/oox/xls/drawingfragment.hxx                                  |   97 
 oox/inc/oox/xls/drawingmanager.hxx                                   |  521 +++
 oox/inc/oox/xls/excelfilter.hxx                                      |   10 
 oox/inc/oox/xls/excelhandlers.hxx                                    |   82 
 oox/inc/oox/xls/formulabase.hxx                                      |  136 
 oox/inc/oox/xls/formulaparser.hxx                                    |   35 
 oox/inc/oox/xls/ooxformulaparser.hxx                                 |    4 
 oox/inc/oox/xls/pivotcachebuffer.hxx                                 |   11 
 oox/inc/oox/xls/pivotcachefragment.hxx                               |   10 
 oox/inc/oox/xls/richstring.hxx                                       |   45 
 oox/inc/oox/xls/sharedformulabuffer.hxx                              |  114 
 oox/inc/oox/xls/sharedstringsbuffer.hxx                              |   11 
 oox/inc/oox/xls/sheetdatabuffer.hxx                                  |  354 ++
 oox/inc/oox/xls/sheetdatacontext.hxx                                 |   89 
 oox/inc/oox/xls/stylesbuffer.hxx                                     |    5 
 oox/inc/oox/xls/workbookhelper.hxx                                   |   70 
 oox/inc/oox/xls/worksheetfragment.hxx                                |   15 
 oox/inc/oox/xls/worksheethelper.hxx                                  |  241 -
 oox/prj/d.lst                                                        |    3 
 oox/source/core/binaryfilterbase.cxx                                 |    4 
 oox/source/core/contexthandler.cxx                                   |    2 
 oox/source/core/filterdetect.cxx                                     |  188 -
 oox/source/core/fragmenthandler.cxx                                  |    4 
 oox/source/core/xmlfilterbase.cxx                                    |    4 
 oox/source/drawingml/chart/chartdrawingfragment.cxx                  |   54 
 oox/source/drawingml/chart/objectformatter.cxx                       |  212 -
 oox/source/drawingml/color.cxx                                       |    4 
 oox/source/drawingml/fillproperties.cxx                              |  122 
 oox/source/drawingml/lineproperties.cxx                              |  172 -
 oox/source/drawingml/shape.cxx                                       |   31 
 oox/source/drawingml/shapepropertymap.cxx                            |  194 +
 oox/source/drawingml/table/tablecell.cxx                             |    6 
 oox/source/dump/biffdumper.cxx                                       |   56 
 oox/source/dump/biffdumper.ini                                       |   28 
 oox/source/dump/dffdumper.ini                                        |   53 
 oox/source/dump/dumperbase.cxx                                       |  358 +-
 oox/source/dump/oledumper.cxx                                        |   46 
 oox/source/dump/pptxdumper.cxx                                       |   23 
 oox/source/dump/xlsbdumper.cxx                                       |   29 
 oox/source/dump/xlsbdumper.ini                                       |    1 
 oox/source/export/ooxml-export-notes.txt                             |  220 +
 oox/source/helper/binaryinputstream.cxx                              |  182 -
 oox/source/helper/binaryoutputstream.cxx                             |   75 
 oox/source/helper/binarystreambase.cxx                               |   63 
 oox/source/helper/containerhelper.cxx                                |   68 
 oox/source/helper/graphichelper.cxx                                  |   11 
 oox/source/helper/modelobjecthelper.cxx                              |   29 
 oox/source/helper/propertymap.cxx                                    |    4 
 oox/source/helper/propertyset.cxx                                    |   67 
 oox/source/helper/textinputstream.cxx                                |  225 +
 oox/source/helper/zipstorage.cxx                                     |   38 
 oox/source/ole/axbinaryreader.cxx                                    |   57 
 oox/source/ole/axcontrol.cxx                                         |   12 
 oox/source/ole/axcontrolfragment.cxx                                 |    2 
 oox/source/ole/oleobjecthelper.cxx                                   |   18 
 oox/source/ole/olestorage.cxx                                        |   59 
 oox/source/ole/vbacontrol.cxx                                        |   12 
 oox/source/ole/vbainputstream.cxx                                    |   51 
 oox/source/ole/vbamodule.cxx                                         |    6 
 oox/source/ole/vbaproject.cxx                                        |   27 
 oox/source/ppt/slidefragmenthandler.cxx                              |    2 
 oox/source/ppt/slidepersist.cxx                                      |   25 
 oox/source/token/namespaces.hxx.tail                                 |   37 
 oox/source/token/properties.txt                                      |    5 
 oox/source/vml/vmldrawing.cxx                                        |    4 
 oox/source/vml/vmldrawingfragment.cxx                                |    3 
 oox/source/vml/vmlformatting.cxx                                     |   32 
 oox/source/vml/vmlinputstream.cxx                                    |  300 +
 oox/source/vml/vmlshape.cxx                                          |   21 
 oox/source/vml/vmltextboxcontext.cxx                                 |   31 
 oox/source/xls/addressconverter.cxx                                  |    4 
 oox/source/xls/autofilterbuffer.cxx                                  |    2 
 oox/source/xls/biffdetector.cxx                                      |    7 
 oox/source/xls/biffhelper.cxx                                        |   15 
 oox/source/xls/biffinputstream.cxx                                   |  137 
 oox/source/xls/biffoutputstream.cxx                                  |   92 
 oox/source/xls/chartsheetfragment.cxx                                |   10 
 oox/source/xls/commentsbuffer.cxx                                    |  179 -
 oox/source/xls/condformatbuffer.cxx                                  |   38 
 oox/source/xls/defnamesbuffer.cxx                                    |  184 -
 oox/source/xls/drawingbase.cxx                                       |  325 ++
 oox/source/xls/drawingfragment.cxx                                   |  354 --
 oox/source/xls/drawingmanager.cxx                                    | 1414 ++++++++
 oox/source/xls/excelchartconverter.cxx                               |   11 
 oox/source/xls/excelfilter.cxx                                       |   53 
 oox/source/xls/excelhandlers.cxx                                     |   81 
 oox/source/xls/externallinkbuffer.cxx                                |   10 
 oox/source/xls/formulabase.cxx                                       |   91 
 oox/source/xls/formulaparser.cxx                                     |  323 +-
 oox/source/xls/numberformatsbuffer.cxx                               |    2 
 oox/source/xls/ooxformulaparser.cxx                                  |   20 
 oox/source/xls/pagesettings.cxx                                      |    3 
 oox/source/xls/pivotcachebuffer.cxx                                  |   79 
 oox/source/xls/pivotcachefragment.cxx                                |   49 
 oox/source/xls/richstring.cxx                                        |  109 
 oox/source/xls/sharedformulabuffer.cxx                               |    2 
 oox/source/xls/sharedstringsbuffer.cxx                               |    6 
 oox/source/xls/sheetdatabuffer.cxx                                   |  935 +++++
 oox/source/xls/sheetdatacontext.cxx                                  |  871 ++---
 oox/source/xls/stylesbuffer.cxx                                      |   35 
 oox/source/xls/viewsettings.cxx                                      |    4 
 oox/source/xls/workbookfragment.cxx                                  |  102 
 oox/source/xls/workbookhelper.cxx                                    |  247 -
 oox/source/xls/workbooksettings.cxx                                  |    2 
 oox/source/xls/worksheetfragment.cxx                                 |  104 
 oox/source/xls/worksheethelper.cxx                                   | 1313 ++------
 oox/workben/ooxml-export-notes.txt                                   |  220 -
 unoxml/qa/complex/unoxml/RDFRepositoryTest.java                      |   18 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx                    |   87 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx                    |    3 
 writerfilter/source/filter/ImportFilter.cxx                          |    2 
 writerfilter/source/ooxml/OOXMLFactory.hxx                           |    1 
 writerfilter/source/ooxml/dummyannotate.xsl                          |    2 
 writerfilter/source/ooxml/model.xml                                  |   52 
 writerfilter/source/ooxml/modelcleanup.xsl                           |   19 
 189 files changed, 11271 insertions(+), 6606 deletions(-)

New commits:
commit 6735b52eb73204681703c41b367dbab0572c4b40
Merge: fa83bdc... f4cc7f8...
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri May 27 20:49:36 2011 +0200

    Merge branch 'master' of git://anongit.freedesktop.org/libreoffice/filters

commit fa83bdc06fc281233597c55b6790181045777947
Merge: dbc0ea9... 001e516...
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri May 27 20:45:30 2011 +0200

    Merge remote-tracking branch 'origin/integration/dev300_m106'
    
    Conflicts:
    	filter/source/graphicfilter/epict/epict.cxx
    	filter/source/svg/svgexport.cxx
    	filter/source/svg/svgfontexport.cxx
    	filter/source/svg/svgwriter.cxx
    	lotuswordpro/source/filter/lwpchartstreamtools.cxx
    	lotuswordpro/source/filter/lwpfrib.cxx
    	lotuswordpro/source/filter/lwpgrfobj.cxx
    	lotuswordpro/source/filter/lwpidxmgr.cxx
    	lotuswordpro/source/filter/lwpobjid.cxx
    	lotuswordpro/source/filter/lwpparaproperty.cxx
    	lotuswordpro/util/makefile.mk
    	oox/prj/d.lst
    	oox/source/drawingml/chart/chartdrawingfragment.cxx
    	oox/source/drawingml/makefile.mk
    	oox/source/drawingml/shape.cxx
    	oox/source/ppt/slidepersist.cxx
    	oox/source/token/namespaces.hxx.tail
    	oox/source/xls/drawingfragment.cxx
    	oox/source/xls/excelfilter.cxx
    	oox/source/xls/makefile.mk
    	oox/source/xls/workbookhelper.cxx
    	writerfilter/source/ooxml/makefile.mk
    	writerfilter/source/resourcemodel/makefile.mk

diff --cc filter/source/svg/svgexport.cxx
index 8c2f21f,4e91dd8..e21165e
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@@ -2,8 -2,8 +2,8 @@@
   /*************************************************************************
   *
   * 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
   *
@@@ -48,12 -54,14 +54,14 @@@ using ::rtl::OUString
  // - SVGExport -
  // -------------
  
- // #110680#
 -SVGExport::SVGExport( 
 +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();
  }
  
@@@ -284,20 -451,27 +451,27 @@@ sal_Bool SVGFilter::implExportDocument
      const sal_Int32 nFirstPage = ( ( SVG_EXPORT_ALLPAGES == nPageToExport ) ? 0 : nPageToExport );
      sal_Int32       nCurPage = nFirstPage, nLastPage = ( bSinglePage ? nFirstPage : ( rxDrawPages->getCount() - 1 ) );
  
-     const Reference< XPropertySet > 			xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
+     const Reference< XPropertySet >             xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
      const Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
 -     
 +
      if( xDefaultPagePropertySet.is() )
      {
          xDefaultPagePropertySet->getPropertyValue( B2UCONST( "Width" ) ) >>= nDocWidth;
          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 ); 
 +    aAttr = OUString::valueOf( nDocWidth * 0.01 );
      aAttr += B2UCONST( "mm" );
      mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
  
@@@ -323,9 -500,10 +500,11 @@@
          mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "onkeypress", B2UCONST( "onKeyPress(evt)" ) );
      }
  
 +
      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 );
  
@@@ -497,17 -676,28 +677,28 @@@ sal_Bool SVGFilter::implExportPages( co
          {
              Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
  
 -            if( xShapes.is() ) 
 +            if( xShapes.is() )
              {
-                 OUString aAttr;
+                 OUString aVisibility, aId, aSlideName( implGetValidIDFromInterface( xShapes, sal_True ) );
  
+                 // add visibility attribute			
                  if( i == nVisiblePage )
-                     aAttr = B2UCONST( "visible" );
+                     aVisibility = B2UCONST( "visible" );
                  else
-                     aAttr = B2UCONST( "hidden" );
+                     aVisibility = B2UCONST( "hidden" );
  
-                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttr );
-                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", implGetValidIDFromInterface( xShapes ) );
+                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aVisibility );
+                 
+                 // add id attribute         
+                 if( bMaster )
+                     aId = ( B2UCONST( "MasterSlide_" ) ) += ::rtl::OUString::valueOf( ++mnMasterSlideId );
+                 else
+                     aId = ( B2UCONST( "Slide_" ) ) += ::rtl::OUString::valueOf( ++mnSlideId );
+ 
+                 if( aSlideName.getLength() )
+                     ( ( aId += B2UCONST( "(" ) ) += aSlideName ) += B2UCONST( ")" );
+                 
+                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId );
  
                  {
                      {
@@@ -572,56 -762,56 +763,56 @@@ sal_Bool SVGFilter::implExportShape( co
      if( xShapePropSet.is() )
      {
          const ::rtl::OUString   aShapeType( rxShape->getShapeType() );
-         bool                    bHideObj = false;
+         sal_Bool                    bHideObj = sal_False;
 -        
 +
          if( mbPresentation )
 -        {    
 +        {
              xShapePropSet->getPropertyValue( B2UCONST( "IsEmptyPresentationObject" ) )  >>= bHideObj;
 -            
 +
              if( !bHideObj )
              {
                  const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
                  Reference< XPropertySetInfo > 	xPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() );
 -                
 +
                  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;
 -                    }   
 -                } 
 +                    }
 +                }
              }
          }
  
@@@ -650,11 -835,13 +836,13 @@@
                   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.GetActionCount() )
++                if( rMtf.GetActionSize() )
                  {
                      mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", implGetClassFromShape( rxShape ) );
                      SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
@@@ -920,14 -1129,14 +1130,14 @@@ IMPL_LINK( SVGFilter, CalcFieldHdl, Edi
  
      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() );
 -        
 +
          if( xDefaultPagePropSetInfo.is() )
          {
              const SvxFieldData* pField = pInfo->GetField().GetField();
@@@ -956,13 -1165,13 +1166,13 @@@
              {
                  String     aPageNumValue;
                  sal_Int16  nPageNumber = 0;
 -                
 +
                  xDefaultPagePropertySet->getPropertyValue( aPageNumberText ) >>= nPageNumber;
 -                
 +
                  if( mpSdrModel )
 -                {  
 +                {
-                     bool bUpper = false;
+                     sal_Bool bUpper = sal_False;
 -                
 +
                      switch( mpSdrModel->GetPageNumType() )
                      {
                          case SVX_CHARS_UPPER_LETTER:
@@@ -983,18 -1192,18 +1193,18 @@@
                          default : break;
                      }
                     }
 -                
 +
                  if( !aPageNumValue.Len() )
                      aPageNumValue += String::CreateFromInt32( nPageNumber );
 -                
 +
                  aRepresentation = aPageNumValue;
-                 bFieldProcessed = true;
+                 bFieldProcessed = sal_True;
              }
          }
 -    
 +
          pInfo->SetRepresentation( aRepresentation );
      }
 -    
 +
      return( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) );
  }
  
diff --cc filter/source/svg/svgfontexport.cxx
index 777cbbf,2461543..84db3fa
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@@ -2,8 -2,8 +2,8 @@@
   /*************************************************************************
   *
   * 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
   *
@@@ -128,57 -181,81 +181,81 @@@ 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 ) );
- 
-         aVDev.SetMapMode( MAP_100TH_MM );
-         aFont.SetAlign( ALIGN_BASELINE );
-         aVDev.SetFont( aFont );
- 
-         mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += SVGActionWriter::GetValueString( ++mnCurFontId ) );
-         mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM );
- 
+         GlyphSet& rGlyphSet = implGetGlyphSet( rFont );
+         
+         if( !rGlyphSet.empty() )
          {
-             SvXMLElementExport  aExp2( mrExport, XML_NAMESPACE_NONE, "font", sal_True, sal_True );
-             Point               aPos;
-             Size                aSize( nFontEM, nFontEM );
-             PolyPolygon         aMissingGlyphPolyPoly( Rectangle( aPos, aSize ) );
- 
-             aMissingGlyphPolyPoly.Move( 0, -nFontEM );
-             aMissingGlyphPolyPoly.Scale( 1.0, -1.0 );
- 
-             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() ) );
- 
-             {
-                 SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", sal_True, sal_True );
-             }
- 
-             mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", SVGActionWriter::GetValueString( aSize.Width() ) );
- 
-             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 ) );
- 
+             GlyphSet::const_iterator    aIter( rGlyphSet.begin() );
+             const ::rtl::OUString       aEmbeddedFontStr( B2UCONST( "EmbeddedFont_" ) );
+         
              {
-                 SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "missing-glyph", sal_True, sal_True );
-             }
+                 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 );
+     
+                 aFont.SetSize( Size( 0, nFontEM ) );
+                 aFont.SetAlign( ALIGN_BASELINE );
+             
+                 aVDev.SetMapMode( MAP_100TH_MM );
+                 aVDev.SetFont( aFont );
+     
+                 mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += ::rtl::OUString::valueOf( ++mnCurFontId ) );
+                 mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM );
+     
+                 {
+                     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() ) );
+     
+                     {   
+                         SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", sal_True, sal_True );
+                     }
+     
+                     mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", ::rtl::OUString::valueOf( aSize.Width() ) );
+     
+                     {
+                         const Point         aPos;
+                         const PolyPolygon   aMissingGlyphPolyPoly( Rectangle( aPos, aSize ) );
+     
+                         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 != rGlyphs.end() )
-             {
-                 implEmbedGlyph( aVDev, ::rtl::OUString( *aIter ) );
-                 ++aIter;
+                     while( aIter != rGlyphSet.end() )
+                     {
+                         implEmbedGlyph( aVDev, *aIter );
+                         ++aIter;
+                     }
+                 }
              }
          }
      }
@@@ -199,18 -274,17 +274,17 @@@ void SVGFontExport::implEmbedGlyph( Out
  
          aPolyPoly.Scale( 1.0, -1.0 );
  
-         if( !rOut.GetTextBoundRect( aBoundRect, aStr ) )
-             aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( aStr ), 0 ) );
+         if( !rOut.GetTextBoundRect( aBoundRect, rCellStr ) )
+             aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( rCellStr ), 0 ) );
 -    
 +
-         mrExport.AddAttribute( XML_NAMESPACE_NONE, "unicode", aStr );
+         mrExport.AddAttribute( XML_NAMESPACE_NONE, "unicode", rCellStr );
 -        
 +
-         if( rGlyphs[ 0 ] == nSpace )
-             aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( sal_Unicode( 'x' ) ), 0 ) );
+         if( rCellStr[ 0 ] == nSpace && rCellStr.getLength() == 1 )
+             aBoundRect = Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( sal_Unicode( ' ' ) ), 0 ) );
 -        
 +
-         mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", SVGActionWriter::GetValueString( aBoundRect.GetWidth() ) );
+         mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", ::rtl::OUString::valueOf( aBoundRect.GetWidth() ) );
  
          const ::rtl::OUString aPathString( SVGActionWriter::GetPathString( aPolyPoly, sal_False ) );
- 
          if( aPathString.getLength() )
          {
              mrExport.AddAttribute( XML_NAMESPACE_NONE, "d", aPathString );
diff --cc filter/source/svg/svgwriter.cxx
index b29f886,b8fa4d7..7669d91
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@@ -2,8 -2,8 +2,8 @@@
  /*************************************************************************
   *
   * 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
   *
@@@ -156,78 -120,48 +120,48 @@@ SVGAttributeWriter::~SVGAttributeWriter
  
  // -----------------------------------------------------------------------------
  
- NMSP_RTL::OUString SVGAttributeWriter::GetFontStyle( const Font& rFont )
+ double SVGAttributeWriter::ImplRound( double fValue, sal_Int32 nDecs )
  {
-     FastString aStyle;
- 
-     // font family
-     aStyle += B2UCONST( "font-family:" );
-     aStyle += mrFontExport.GetMappedFontName( rFont.GetName() );
- 
-     // font size
-     aStyle += B2UCONST( ";" );
-     aStyle += B2UCONST( "font-size:" );
-     aStyle += SVGActionWriter::GetValueString( rFont.GetHeight() );
-     aStyle += B2UCONST( "px" );
- 
-     // font style
- /*
-     if( rFont.GetItalic() != ITALIC_NONE )
-     {
-         aStyle += B2UCONST( ";" );
-         aStyle += B2UCONST( "font-style:" );
- 
-         if( rFont.GetItalic() == ITALIC_OBLIQUE )
-             aStyle += B2UCONST( "oblique" );
-         else
-             aStyle += B2UCONST( "italic" );
-     }
- */
+       return( floor( fValue * pow( 10.0, (int)nDecs ) + 0.5 ) / pow( 10.0, (int)nDecs ) );
+ }
  
-     // font weight
-     sal_Int32 nFontWeight;
+ // -----------------------------------------------------------------------------
  
-     switch( rFont.GetWeight() )
+ void SVGAttributeWriter::ImplGetColorStr( const Color& rColor, ::rtl::OUString& rColorStr )
+ {
+     if( rColor.GetTransparency() == 255 )
+         rColorStr = B2UCONST( "none" );
+     else
      {
-         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;
+         ::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();
      }
+ }
  
-     aStyle += B2UCONST( ";" );
-     aStyle += B2UCONST( "font-weight:" );
-     aStyle += NMSP_RTL::OUString::valueOf( nFontWeight );
- 
-     // !!!
-     // font-variant
-     // font-stretch
-     // font-size-adjust
- 
- #ifdef _SVG_USE_NATIVE_TEXTDECORATION
- 
-     if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
-     {
-         aStyle += B2UCONST( ";" );
-         aStyle += B2UCONST( "text-decoration:" );
- 
-         if( rFont.GetUnderline() != UNDERLINE_NONE )
-             aStyle += B2UCONST( " underline" );
+ // -----------------------------------------------------------------------------
  
-         if( rFont.GetStrikeout() != STRIKEOUT_NONE )
-              aStyle += B2UCONST( " line-through" );
-     }
+ void SVGAttributeWriter::AddColorAttr( const char* pColorAttrName, 
+                                        const char* pColorOpacityAttrName,
+                                        const Color& rColor )
+ {
+     ::rtl::OUString aColor, aColorOpacity;
+     
+     ImplGetColorStr( rColor, aColor );
 -    
 +
- #endif // _SVG_USE_NATIVE_TEXTDECORATION
+     if( rColor.GetTransparency() > 0 && rColor.GetTransparency() < 255 )
+         aColorOpacity = ::rtl::OUString::valueOf( ImplRound( ( 255.0 - rColor.GetTransparency() ) / 255.0 ) );
  
-     return aStyle.GetString();
+     mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorAttrName, aColor );
+     
+     if( aColorOpacity.getLength() && mrExport.IsUseOpacity() )
+         mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorOpacityAttrName, aColorOpacity );
  }
  
  // -----------------------------------------------------------------------------
@@@ -247,86 -191,119 +191,119 @@@ void SVGAttributeWriter::AddPaintAttr( 
  
  // -----------------------------------------------------------------------------
  
- NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo )
+ void SVGAttributeWriter::AddGradientDef( const Rectangle& rObjRect, const Gradient& rGradient, ::rtl::OUString& rGradientId )
  {
-     FastString aStyle;
- 
-     // line color
-     aStyle += B2UCONST( "stroke:" );
- 
-     if( rLineColor.GetTransparency() == 255 )
-         aStyle += B2UCONST( "none" );
-     else
+     if( rObjRect.GetWidth() && rObjRect.GetHeight() &&
+         ( rGradient.GetStyle() == GRADIENT_LINEAR || rGradient.GetStyle() == GRADIENT_AXIAL ||
+           rGradient.GetStyle() == GRADIENT_RADIAL || rGradient.GetStyle() == GRADIENT_ELLIPTICAL ) )
      {
-         // line color value in rgb
-         aStyle += GetColorStyle( rLineColor );
- 
-         // line color opacity in percent if neccessary
-         if( rLineColor.GetTransparency() )
+         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() );
+         
+         // 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 );
+         
+         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 );
+ 
+         mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId,
+                             ( rGradientId = B2UCONST( "Gradient_" ) ) += ::rtl::OUString::valueOf( nCurGradientId++ ) );
+         
          {
-             aStyle += B2UCONST( ";" );
-             aStyle += B2UCONST( "stroke-opacity:" );
-             aStyle += NMSP_RTL::OUString::valueOf( ( 255 - (double) rLineColor.GetTransparency() ) / 255.0 );
-         }
- 
-         if(pLineInfo)
-         {
-             // more infos for line needed
-             if(pLineInfo->GetWidth() > 1)
-             {
-                 aStyle += B2UCONST( ";" );
-                 aStyle += B2UCONST( "stroke-width:" );
-                 aStyle += NMSP_RTL::OUString::valueOf(pLineInfo->GetWidth());
-             }
- 
-             if(LINE_DASH == pLineInfo->GetStyle())
+             ::std::auto_ptr< SvXMLElementExport >   apGradient;
+             ::rtl::OUString                         aColorStr;
+             
+             if( rGradient.GetStyle() == GRADIENT_LINEAR || rGradient.GetStyle() == GRADIENT_AXIAL )
              {
-                 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++)
+                 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(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( 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 );
+             
+                 {
+                     SvXMLElementExport aDesc4( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, sal_True, sal_True );
                  }
              }
- 
-             if(basegfx::B2DLINEJOIN_MITER != pLineInfo->GetLineJoin())
+             else
              {
-                 aStyle += B2UCONST( ";" );
-                 aStyle += B2UCONST( "stroke-linejoin:" );
+                 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;
+ 
+                 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 ) ) );
+ 
+                 apGradient.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemRadialGradient, sal_True, sal_True ) );
+                 
+                 // write stop values
+                 ImplGetColorStr( aEndColor, aColorStr );
+                 mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, ::rtl::OUString::valueOf( 0.0 ) );
+                 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 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 );
                  }
              }
          }
@@@ -978,9 -1020,9 +1020,9 @@@ void SVGActionWriter::ImplWriteMask( GD
  
  // -----------------------------------------------------------------------------
  
 -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 )
+                                      sal_Bool bApplyMapping )
  {
      const FontMetric aMetric( mpVDev->GetFontMetric() );
  
@@@ -1070,161 -1112,135 +1112,135 @@@
  
  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 );
-                 }
-             }
- 
-             if( nCurPos < nLen )
-                 aOutputText.Erase( sal::static_int_cast<sal_uInt16>( nCurPos ) );
+                     const ::rtl::OUString aGlyph( rText.Copy( nLastPos, nCount ) );
  
-             mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aTSpanX.GetString() );
-             mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
+                     mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( nX ) );
+                     mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) );
  
-             {
-                 SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemTSpan, sal_True, sal_True );
-                 mrExport.GetDocHandler()->characters( aOutputText );
-             }
- #else
-             mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X() ) );
-             mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
+                     {
+                         SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False );
+                         mrExport.GetDocHandler()->characters( aGlyph );
+                     }
  
-             {
-                 SvXMLElementExport aElem2( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
-                 mrExport.GetDocHandler()->characters( rText );
+                     if( bCont )
+                         nX = aPos.X() + pDXArray[ nCurPos - 1 ];
+                 }
              }
- #endif
          }
+     }
+     else
+     {
+         mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( aPos.X() ) );
+         mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) );
+         
+         {
+             SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False );
+             mrExport.GetDocHandler()->characters( rText );
+         }
+     }
  
- #ifndef _SVG_USE_NATIVE_TEXTDECORATION
-         // write strikeout if neccessary
-         if( rFont.GetStrikeout() || rFont.GetUnderline() )
+     if( !mrExport.IsUseNativeTextDecoration() )
+     {
+         if( rFont.GetStrikeout() != STRIKEOUT_NONE || rFont.GetUnderline() != UNDERLINE_NONE )
          {
-             Polygon		aPoly( 4 );
-             const long	nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
+             Polygon     aPoly( 4 );
+             const long  nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
  
              if( rFont.GetStrikeout() )
              {
@@@ -1258,10 -1271,10 +1271,10 @@@
  
  // -----------------------------------------------------------------------------
  
 -void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx, 
 +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 )
      {
@@@ -1302,15 -1325,16 +1325,16 @@@
  
  // -----------------------------------------------------------------------------
  
 -void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, 
 +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.GetActionCount(); nCurAction < nCount; nCurAction++ )
++    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 )
@@@ -1344,18 -1368,9 +1368,9 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_FILL )
                  {
                      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;
@@@ -1563,10 -1534,9 +1534,9 @@@
  
                          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 );
                      }
                  }
              }
@@@ -1592,18 -1562,17 +1562,17 @@@
                      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.GetActionCount(); ( k < nCount2 ) && !bFound; ++k )
++                    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(), 
 +                            ImplWriteBmp( pBmpScaleAction->GetBitmap(),
 +                                          pA->GetPoint(), pA->GetSize(),
-                                           Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), pStyle );
+                                           Point(), pBmpScaleAction->GetBitmap().GetSizePixel() );
                          }
                      }
                  }
@@@ -1627,8 -1596,9 +1596,9 @@@
  
                          if( pAction->GetType() == META_GRADIENTEX_ACTION )
                              pGradAction = (const MetaGradientExAction*) pAction;
 -                        else if( ( pAction->GetType() == META_COMMENT_ACTION ) && 
 +                        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;
                          }
@@@ -1645,11 -1752,10 +1752,10 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_FILL )
                  {
                      const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
 -                    
 -                    ImplWriteBmp( pA->GetBitmap(), 
 -                                  pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ), 
 +
-                     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;
@@@ -1659,11 -1765,10 +1765,10 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_FILL )
                  {
                      const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
 -                
 -                    ImplWriteBmp( pA->GetBitmap(), 
 -                                  pA->GetPoint(), pA->GetSize(), 
 +
-                     mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
 +                    ImplWriteBmp( pA->GetBitmap(),
 +                                  pA->GetPoint(), pA->GetSize(),
-                                   Point(), pA->GetBitmap().GetSizePixel(), pStyle );
+                                   Point(), pA->GetBitmap().GetSizePixel() );
                  }
              }
              break;
@@@ -1673,11 -1778,10 +1778,10 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_FILL )
                  {
                      const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
 -                    
 -                    ImplWriteBmp( pA->GetBitmap(), 
 -                                  pA->GetDestPoint(), pA->GetDestSize(), 
 +
-                     mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
 +                    ImplWriteBmp( pA->GetBitmap(),
 +                                  pA->GetDestPoint(), pA->GetDestSize(),
-                                   pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+                                   pA->GetSrcPoint(), pA->GetSrcSize() );
                  }
              }
              break;
@@@ -1687,11 -1791,10 +1791,10 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_FILL )
                  {
                      const MetaBmpExAction*	pA = (const MetaBmpExAction*) pAction;
 -                    
 -                    ImplWriteBmp( pA->GetBitmapEx(), 
 -                                  pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ), 
 +
-                     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;
@@@ -1701,11 -1804,10 +1804,10 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_FILL )
                  {
                      const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
 -                
 -                    ImplWriteBmp( pA->GetBitmapEx(), 
 -                                  pA->GetPoint(), pA->GetSize(), 
 +
-                     mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
 +                    ImplWriteBmp( pA->GetBitmapEx(),
 +                                  pA->GetPoint(), pA->GetSize(),
-                                   Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
+                                   Point(), pA->GetBitmapEx().GetSizePixel() );
                  }
              }
              break;
@@@ -1715,11 -1817,10 +1817,10 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_FILL )
                  {
                      const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
 -                    
 -                    ImplWriteBmp( pA->GetBitmapEx(), 
 -                                  pA->GetDestPoint(), pA->GetDestSize(), 
 +
-                     mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
 +                    ImplWriteBmp( pA->GetBitmapEx(),
 +                                  pA->GetDestPoint(), pA->GetDestSize(),
-                                   pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+                                   pA->GetSrcPoint(), pA->GetSrcSize() );
                  }
              }
              break;
@@@ -1729,13 -1830,22 +1830,22 @@@
                  if( nWriteFlags & SVGWRITER_WRITE_TEXT )
                  {
                      const MetaTextAction*   pA = (const MetaTextAction*) pAction;
-                     Font                    aFont( mpVDev->GetFont() );
- 
-                     aFont.SetHeight( ImplMap( Size( 0, aFont.GetHeight() ) ).Height() );
-                     mpContext->SetFontAttr( aFont );
-                     ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, 0, pStyle );
+                     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( aSz.Height() );
+                         mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+                         mpContext->SetFontAttr( aFont );
+                         ImplWriteText( pA->GetPoint(), aText, NULL, 0 );
+                     }
                  }
 -            }			
 +            }
              break;
  
              case( META_TEXTRECT_ACTION ):
@@@ -1839,9 -1991,9 +1991,9 @@@ void SVGActionWriter::WriteMetaFile( co
      Size        aPrefSize( rMtf.GetPrefSize() );
      Fraction    aFractionX( aMapMode.GetScaleX() );
      Fraction    aFractionY( aMapMode.GetScaleY() );
- 
+     
      mpVDev->Push();
 -    
 +
      Size aSize( OutputDevice::LogicToLogic( rSize100thmm, MAP_100TH_MM, aMapMode ) );
      aMapMode.SetScaleX( aFractionX *= Fraction( aSize.Width(), aPrefSize.Width() ) );
      aMapMode.SetScaleY( aFractionY *= Fraction( aSize.Height(), aPrefSize.Height() ) );
@@@ -1850,9 -2002,20 +2002,20 @@@
      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 --cc oox/Library_oox.mk
index 6fcbf00,0000000..99bbdc6
mode 100644,000000..100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@@ -1,393 -1,0 +1,396 @@@
 +# Version: MPL 1.1 / GPLv3+ / LGPLv3+
 +#
 +# The contents of this file are subject to the Mozilla Public License Version
 +# 1.1 (the "License"); you may not use this file except in compliance with
 +# the License or as specified alternatively below. You may obtain a copy of
 +# the License at http://www.mozilla.org/MPL/
 +#
 +# Software distributed under the License is distributed on an "AS IS" basis,
 +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 +# for the specific language governing rights and limitations under the
 +# License.
 +#
 +# The Initial Developer of the Original Code is
 +#       David Tardon, Red Hat Inc. <dtardon at redhat.com>
 +# Portions created by the Initial Developer are Copyright (C) 2010 the
 +# Initial Developer. All Rights Reserved.
 +#
 +# Major Contributor(s):
 +#
 +# For minor contributions see the git repository.
 +#
 +# Alternatively, the contents of this file may be used under the terms of
 +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
 +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
 +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
 +# instead of those above.
 +
 +$(eval $(call gb_Library_Library,oox))
 +
 +$(eval $(call gb_Library_add_package_headers,oox,\
 +    oox_inc \
 +))
 +
 +$(eval $(call gb_Library_set_include,oox,\
 +    $$(INCLUDE) \
 +    -I$(OUTDIR)/inc \
 +    -I$(OUTDIR)/inc/offuh \
 +    -I$(realpath $(SRCDIR)/oox/inc) \
 +    $(if $(filter YES,$(SYSTEM_OPENSSL)),$(filter -I%,$(OPENSSL_CFLAGS))) \
 +))
 +
 +$(eval $(call gb_Library_set_defs,oox,\
 +    $$(DEFS) \
 +    -DOOX_DLLIMPLEMENTATION \
 +    $(if $(filter YES,$(SYSTEM_OPENSSL)),$(filter-out -I%,$(OPENSSL_CFLAGS))) \
 +))
 +
 +$(eval $(call gb_Library_add_linked_libs,oox,\
 +    basegfx \
 +    comphelper \
 +    cppu \
 +    cppuhelper \
 +    msfilter \
 +    sal \
 +    sax \
 +    svl \
 +    svt \
 +    svxcore \
 +    tl \
 +    utl \
 +    vcl \
 +    xo \
 +    xcr \
 +    $(if $(filter SOLARIS,$(OS)),dl nsl socket) \
 +    $(gb_STDLIBS) \
 +))
 +
 +ifeq ($(SYSTEM_OPENSSL),YES)
 +$(eval $(call gb_Library_add_linked_libs,oox,\
 +    crypto \
 +    ssl \
 +))
 +else
 +ifeq ($(OS),WNT)
 +$(eval $(call gb_Library_add_linked_static_libs,oox,\
 +    libeay32 \
 +    ssleay32 \
 +))
 +else
 +$(eval $(call gb_Library_add_linked_static_libs,oox,\
 +    crypto \
 +    ssl \
 +))
 +endif
 +endif
 +
 +$(eval $(call gb_Library_set_ldflags,oox,\
 +	$$(LDFLAGS) \
 +	$(if $(filter YES,$(SYSTEM_OPENSSL)),$(OPENSSL_LIBS)) \
 +))
 +
 +$(eval $(call gb_Library_set_componentfile,oox,oox/util/oox))
 +
 +$(eval $(call gb_Library_add_exception_objects,oox,\
 +    oox/source/core/binarycodec \
 +    oox/source/core/binaryfilterbase \
 +    oox/source/core/contexthandler2 \
 +    oox/source/core/contexthandler \
 +    oox/source/core/fastparser \
 +    oox/source/core/fasttokenhandler \
 +    oox/source/core/filterbase \
 +    oox/source/core/filterdetect \
 +    oox/source/core/fragmenthandler2 \
 +    oox/source/core/fragmenthandler \
 +    oox/source/core/recordparser \
 +    oox/source/core/relations \
 +    oox/source/core/relationshandler \
 +    oox/source/core/services \
 +    oox/source/core/xmlfilterbase \
 +    oox/source/docprop/docprophandler \
 +    oox/source/docprop/ooxmldocpropimport \
 +    oox/source/drawingml/chart/axiscontext \
 +    oox/source/drawingml/chart/axisconverter \
 +    oox/source/drawingml/chart/axismodel \
 +    oox/source/drawingml/chart/chartcontextbase \
 +    oox/source/drawingml/chart/chartconverter \
 +    oox/source/drawingml/chart/chartdrawingfragment \
 +    oox/source/drawingml/chart/chartspaceconverter \
 +    oox/source/drawingml/chart/chartspacefragment \
 +    oox/source/drawingml/chart/chartspacemodel \
 +    oox/source/drawingml/chart/converterbase \
 +    oox/source/drawingml/chart/datasourcecontext \
 +    oox/source/drawingml/chart/datasourceconverter \
 +    oox/source/drawingml/chart/datasourcemodel \
 +    oox/source/drawingml/chart/modelbase \
 +    oox/source/drawingml/chart/objectformatter \
 +    oox/source/drawingml/chart/plotareacontext \
 +    oox/source/drawingml/chart/plotareaconverter \
 +    oox/source/drawingml/chart/plotareamodel \
 +    oox/source/drawingml/chart/seriescontext \
 +    oox/source/drawingml/chart/seriesconverter \
 +    oox/source/drawingml/chart/seriesmodel \
 +    oox/source/drawingml/chart/titlecontext \
 +    oox/source/drawingml/chart/titleconverter \
 +    oox/source/drawingml/chart/titlemodel \
 +    oox/source/drawingml/chart/typegroupcontext \
 +    oox/source/drawingml/chart/typegroupconverter \
 +    oox/source/drawingml/chart/typegroupmodel \
 +    oox/source/drawingml/clrschemecontext \
 +    oox/source/drawingml/clrscheme \
 +    oox/source/drawingml/colorchoicecontext \
 +    oox/source/drawingml/color \
 +    oox/source/drawingml/connectorshapecontext \
 +    oox/source/drawingml/customshapegeometry \
 +    oox/source/drawingml/customshapeproperties \
 +    oox/source/drawingml/diagram/datamodelcontext \
 +    oox/source/drawingml/diagram/diagram \
 +    oox/source/drawingml/diagram/diagramdefinitioncontext \
 +    oox/source/drawingml/diagram/diagramfragmenthandler \
 +    oox/source/drawingml/diagram/diagramlayoutatoms \
 +    oox/source/drawingml/diagram/layoutnodecontext \
 +    oox/source/drawingml/drawingmltypes \
 +    oox/source/drawingml/embeddedwavaudiofile \
 +    oox/source/drawingml/fillproperties \
 +    oox/source/drawingml/fillpropertiesgroupcontext \
 +    oox/source/drawingml/graphicshapecontext \
 +    oox/source/drawingml/guidcontext \
 +    oox/source/drawingml/hyperlinkcontext \
 +    oox/source/drawingml/linepropertiescontext \
 +    oox/source/drawingml/lineproperties \
 +    oox/source/drawingml/objectdefaultcontext \
 +    oox/source/drawingml/shapecontext \
 +    oox/source/drawingml/shape \
 +    oox/source/drawingml/shapegroupcontext \
 +    oox/source/drawingml/shapepropertiescontext \
++    oox/source/drawingml/shapepropertymap \
 +    oox/source/drawingml/shapestylecontext \
 +    oox/source/drawingml/spdefcontext \
 +    oox/source/drawingml/table/tablebackgroundstylecontext \
 +    oox/source/drawingml/table/tablecellcontext \
 +    oox/source/drawingml/table/tablecell \
 +    oox/source/drawingml/table/tablecontext \
 +    oox/source/drawingml/table/tablepartstylecontext \
 +    oox/source/drawingml/table/tableproperties \
 +    oox/source/drawingml/table/tablerowcontext \
 +    oox/source/drawingml/table/tablerow \
 +    oox/source/drawingml/table/tablestylecellstylecontext \
 +    oox/source/drawingml/table/tablestylecontext \
 +    oox/source/drawingml/table/tablestyle \
 +    oox/source/drawingml/table/tablestylelist \
 +    oox/source/drawingml/table/tablestylelistfragmenthandler \
 +    oox/source/drawingml/table/tablestylepart \
 +    oox/source/drawingml/table/tablestyletextstylecontext \
 +    oox/source/drawingml/textbodycontext \
 +    oox/source/drawingml/textbody \
 +    oox/source/drawingml/textbodypropertiescontext \
 +    oox/source/drawingml/textbodyproperties \
 +    oox/source/drawingml/textcharacterpropertiescontext \
 +    oox/source/drawingml/textcharacterproperties \
 +    oox/source/drawingml/textfieldcontext \
 +    oox/source/drawingml/textfield \
 +    oox/source/drawingml/textfont \
 +    oox/source/drawingml/textliststylecontext \
 +    oox/source/drawingml/textliststyle \
 +    oox/source/drawingml/textparagraph \
 +    oox/source/drawingml/textparagraphpropertiescontext \
 +    oox/source/drawingml/textparagraphproperties \
 +    oox/source/drawingml/textrun \
 +    oox/source/drawingml/textspacingcontext \
 +    oox/source/drawingml/texttabstoplistcontext \
 +    oox/source/drawingml/theme \
 +    oox/source/drawingml/themeelementscontext \
 +    oox/source/drawingml/themefragmenthandler \
 +    oox/source/drawingml/transform2dcontext \
 +    oox/source/dump/biffdumper \
 +    oox/source/dump/dffdumper \
 +    oox/source/dump/dumperbase \
 +    oox/source/dump/oledumper \
 +    oox/source/dump/pptxdumper \
 +    oox/source/dump/xlsbdumper \
 +    oox/source/export/chartexport \
 +    oox/source/export/ColorPropertySet \
 +    oox/source/export/drawingml \
 +    oox/source/export/SchXMLSeriesHelper \
 +    oox/source/export/shapes \
 +    oox/source/export/vmlexport \
 +    oox/source/helper/attributelist \
 +    oox/source/helper/binaryinputstream \
 +    oox/source/helper/binaryoutputstream \
 +    oox/source/helper/binarystreambase \
 +    oox/source/helper/containerhelper \
 +    oox/source/helper/graphichelper \
 +    oox/source/helper/modelobjecthelper \
 +    oox/source/helper/progressbar \
 +    oox/source/helper/propertymap \
 +    oox/source/helper/propertyset \
 +    oox/source/helper/storagebase \
 +    oox/source/helper/textinputstream \
 +    oox/source/helper/zipstorage \
 +    oox/source/ole/axbinaryreader \
 +    oox/source/ole/axcontrol \
 +    oox/source/ole/axcontrolfragment \
 +    oox/source/ole/olehelper \
 +    oox/source/ole/oleobjecthelper \
 +    oox/source/ole/olestorage \
 +    oox/source/ole/vbacontrol \
 +    oox/source/ole/vbahelper \
 +    oox/source/ole/vbainputstream \
 +    oox/source/ole/vbamodule \
 +    oox/source/ole/vbaproject \
 +    oox/source/ole/vbaprojectfilter \
 +    oox/source/ppt/animationspersist \
 +    oox/source/ppt/animationtypes \
 +    oox/source/ppt/animvariantcontext \
 +    oox/source/ppt/backgroundproperties \
 +    oox/source/ppt/buildlistcontext \
 +    oox/source/ppt/commonbehaviorcontext \
 +    oox/source/ppt/commontimenodecontext \
 +    oox/source/ppt/conditioncontext \
 +    oox/source/ppt/customshowlistcontext \
 +    oox/source/ppt/headerfootercontext \
 +    oox/source/ppt/layoutfragmenthandler \
 +    oox/source/ppt/pptfilterhelpers \
 +    oox/source/ppt/pptgraphicshapecontext \
 +    oox/source/ppt/pptimport \
 +    oox/source/ppt/pptshapecontext \
 +    oox/source/ppt/pptshape \
 +    oox/source/ppt/pptshapegroupcontext \
 +    oox/source/ppt/pptshapepropertiescontext \
 +    oox/source/ppt/presentationfragmenthandler \
 +    oox/source/ppt/slidefragmenthandler \
 +    oox/source/ppt/slidemastertextstylescontext \
 +    oox/source/ppt/slidepersist \
 +    oox/source/ppt/slidetimingcontext \
 +    oox/source/ppt/slidetransitioncontext \
 +    oox/source/ppt/slidetransition \
 +    oox/source/ppt/soundactioncontext \
 +    oox/source/ppt/timeanimvaluecontext \
 +    oox/source/ppt/timenode \
 +    oox/source/ppt/timenodelistcontext \
 +    oox/source/ppt/timetargetelementcontext \
 +    oox/source/shape/ShapeContextHandler \
 +    oox/source/shape/ShapeFilterBase \
 +    oox/source/token/namespacemap \
 +    oox/source/token/propertynames \
 +    oox/source/token/tokenmap \
 +    oox/source/vml/vmldrawing \
 +    oox/source/vml/vmldrawingfragment \
 +    oox/source/vml/vmlformatting \
 +    oox/source/vml/vmlinputstream \
 +    oox/source/vml/vmlshapecontainer \
 +    oox/source/vml/vmlshapecontext \
 +    oox/source/vml/vmlshape \
 +    oox/source/vml/vmltextboxcontext \
 +    oox/source/vml/vmltextbox \
 +    oox/source/xls/addressconverter \
 +    oox/source/xls/autofilterbuffer \
 +    oox/source/xls/autofiltercontext \
 +    oox/source/xls/biffcodec \
 +    oox/source/xls/biffdetector \
 +    oox/source/xls/biffhelper \
 +    oox/source/xls/biffinputstream \
 +    oox/source/xls/biffoutputstream \
 +    oox/source/xls/chartsheetfragment \
 +    oox/source/xls/commentsbuffer \
 +    oox/source/xls/commentsfragment \
 +    oox/source/xls/condformatbuffer \
 +    oox/source/xls/condformatcontext \
 +    oox/source/xls/connectionsbuffer \
 +    oox/source/xls/connectionsfragment \
 +    oox/source/xls/defnamesbuffer \
++    oox/source/xls/drawingbase \
 +    oox/source/xls/drawingfragment \
++    oox/source/xls/drawingmanager \
 +    oox/source/xls/excelchartconverter \
 +    oox/source/xls/excelfilter \
 +    oox/source/xls/excelhandlers \
 +    oox/source/xls/excelvbaproject \
 +    oox/source/xls/externallinkbuffer \
 +    oox/source/xls/externallinkfragment \
 +    oox/source/xls/formulabase \
 +    oox/source/xls/formulaparser \
 +    oox/source/xls/numberformatsbuffer \
 +    oox/source/xls/ooxformulaparser \
 +    oox/source/xls/pagesettings \
 +    oox/source/xls/pivotcachebuffer \
 +    oox/source/xls/pivotcachefragment \
 +    oox/source/xls/pivottablebuffer \
 +    oox/source/xls/pivottablefragment \
 +    oox/source/xls/querytablebuffer \
 +    oox/source/xls/querytablefragment \
 +    oox/source/xls/richstringcontext \
 +    oox/source/xls/richstring \
 +    oox/source/xls/scenariobuffer \
 +    oox/source/xls/scenariocontext \
-     oox/source/xls/sharedformulabuffer \
 +    oox/source/xls/sharedstringsbuffer \
 +    oox/source/xls/sharedstringsfragment \
++    oox/source/xls/sheetdatabuffer \
 +    oox/source/xls/sheetdatacontext \
 +    oox/source/xls/stylesbuffer \
 +    oox/source/xls/stylesfragment \
 +    oox/source/xls/tablebuffer \
 +    oox/source/xls/tablefragment \
 +    oox/source/xls/themebuffer \
 +    oox/source/xls/unitconverter \
 +    oox/source/xls/viewsettings \
 +    oox/source/xls/workbookfragment \
 +    oox/source/xls/workbookhelper \
 +    oox/source/xls/workbooksettings \
 +    oox/source/xls/worksheetbuffer \
 +    oox/source/xls/worksheetfragment \
 +    oox/source/xls/worksheethelper \
 +    oox/source/xls/worksheetsettings \
 +))
 +
 +$(eval $(call gb_Library_add_generated_exception_objects,oox,\
 +    oox/source/export/vmlexport-shape-types \
 +))
 +
 +$(call gb_GenCxxObject_get_source,oox/source/export/vmlexport-shape-types) : $(SRCDIR)/oox/source/export/preset-definitions-to-shape-types.pl $(SRCDIR)/oox/source/export/presetShapeDefinitions.xml $(SRCDIR)/oox/source/export/presetTextWarpDefinitions.xml
 +	mkdir -p $(dir $@)
 +	perl $^ > $@.in_progress 2> $@.log && mv $@.in_progress $@
 +
 +oox_SRC := $(SRCDIR)/oox/source/token
 +oox_MISC := $(WORKDIR)/oox/misc
 +oox_INC := $(WORKDIR)/oox/inc
 +oox_GENHEADERPATH := $(oox_INC)/oox/token
 +
 +# these three generated headers are included from just about everywhere--might
 +# just as well make them before everything else...
 +$(call gb_Package_get_target,oox_inc) : $(oox_GENHEADERPATH)/namespaces.hxx
 +$(call gb_Package_get_target,oox_inc) : $(oox_GENHEADERPATH)/properties.hxx
 +$(call gb_Package_get_target,oox_inc) : $(oox_GENHEADERPATH)/tokens.hxx
 +
 +$(call gb_CxxObject_get_target,oox/source/token/tokenmap) : $(oox_INC)/tokenhash.inc
 +
 +$(eval $(call gb_Library_set_include,oox,\
 +    $$(INCLUDE) \
 +    -I$(oox_INC) \
 +))
 +
 +$(oox_INC)/tokenhash.inc : $(oox_MISC)/tokenhash.gperf
 +	gperf --compare-strncmp $< | sed -e 's/(char\*)0/(char\*)0, 0/g' | grep -v '^#line' > $@
 +
 +oox_GenTarget_get_target = $(oox_MISC)/$(1)
 +
 +define oox_GenTarget_GenTarget
 +$(oox_GENHEADERPATH)/$(1).hxx $(oox_MISC)/$(2)ids.inc $(oox_INC)/$(2)names.inc $(if $(3),$(oox_MISC)/$(3)) : $(call oox_GenTarget_get_target,$(1))
 +$(call oox_GenTarget_get_target,$(1)) : $(oox_SRC)/$(1).pl $(oox_SRC)/$(1).txt $(oox_SRC)/$(1).hxx.head $(oox_SRC)/$(1).hxx.tail
 +	mkdir -p $(oox_MISC) $(oox_INC) $(oox_GENHEADERPATH)
 +	perl $(oox_SRC)/$(1).pl $(oox_SRC)/$(1).txt $(oox_MISC)/$(2)ids.inc $(oox_INC)/$(2)names.inc $(if $(3),$(oox_MISC)/$(3)) \
 +		&& cat $(oox_SRC)/$(1).hxx.head $(oox_MISC)/$(2)ids.inc $(oox_SRC)/$(1).hxx.tail > $(oox_GENHEADERPATH)/$(1).hxx \
 +		&& touch $$@
 +endef
 +
 +$(eval $(call oox_GenTarget_GenTarget,namespaces,namespace,namespaces.txt))
 +$(eval $(call oox_GenTarget_GenTarget,properties,property,))
 +$(eval $(call oox_GenTarget_GenTarget,tokens,token,tokenhash.gperf))
 +
 +$(call gb_Library_get_clean_target,oox) : oox_clean
 +
 +oox_clean :
 +	rm -rf $(WORKDIR)/oox
 +.PHONY: oox_clean
 +
 +# vim: set noet ts=4 sw=4:
diff --cc oox/inc/oox/xls/sharedformulabuffer.hxx
index 95e22bf,19e10c4..0000000
deleted file mode 100644,100644
--- a/oox/inc/oox/xls/sharedformulabuffer.hxx
+++ /dev/null
diff --cc oox/prj/d.lst
index e69de29,b1cffae..73cf0ba
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@@ -1,0 -1,54 +1,3 @@@
+ 
 -mkdir: %_DEST%\inc%_EXT%\oox
 -mkdir: %_DEST%\inc%_EXT%\oox\core
 -mkdir: %_DEST%\inc%_EXT%\oox\drawingml
 -mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart
 -mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
 -mkdir: %_DEST%\inc%_EXT%\oox\export
 -mkdir: %_DEST%\inc%_EXT%\oox\helper
 -mkdir: %_DEST%\inc%_EXT%\oox\ole
 -mkdir: %_DEST%\inc%_EXT%\oox\token
 -mkdir: %_DEST%\inc%_EXT%\oox\vml
 -mkdir: %_DEST%\inc%_EXT%\oox\xls
 -..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
 -..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib
 -..\%__SRC%\lib\xol.lib %_DEST%\lib%_EXT%\xol.lib
 -..\%__SRC%\lib\libxol.a %_DEST%\lib%_EXT%\libxol.a
 -..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
 -..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
 -..\%__SRC%\lib\i*.lib %_DEST%\lib%_EXT%\i*.lib
 -..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+ 
 -..\%__SRC%\inc\oox\token\tokens.hxx %_DEST%\inc%_EXT%\oox\token\tokens.hxx
 -..\%__SRC%\misc\namespaces.txt %_DEST%\inc%_EXT%\oox\token\namespaces.txt
 -
 -..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token\tokens.txt
 -
 -..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
 -..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx
 -..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
 -..\inc\oox\helper\refmap.hxx %_DEST%\inc%_EXT%\oox\helper\refmap.hxx
 -..\inc\oox\helper\containerhelper.hxx %_DEST%\inc%_EXT%\oox\helper\containerhelper.hxx
 -..\inc\oox\helper\graphichelper.hxx %_DEST%\inc%_EXT%\oox\helper\graphichelper.hxx
 -..\inc\oox\helper\refvector.hxx %_DEST%\inc%_EXT%\oox\helper\refvector.hxx
 -..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx
 -..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx
 -..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
 -..\inc\oox\core\filterdetect.hxx %_DEST%\inc%_EXT%\oox\core\filterdetect.hxx
 -..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx
 -..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx
 -..\inc\oox\drawingml\chart\chartconverter.hxx %_DEST%\inc%_EXT%\oox\drawingml\chart\chartconverter.hxx
 -..\inc\oox\drawingml\table\tablestylelist.hxx %_DEST%\inc%_EXT%\oox\drawingml\table\tablestylelist.hxx
 -..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx
 -..\inc\oox\ole\oleobjecthelper.hxx %_DEST%\inc%_EXT%\oox\ole\oleobjecthelper.hxx
 -..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx
 -..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx
 -..\inc\oox\export\*.hxx %_DEST%\inc%_EXT%\oox\export\*.hxx
 -..\inc\oox\xls\excelvbaproject.hxx %_DEST%\inc%_EXT%\oox\xls\excelvbaproject.hxx
 -..\inc\oox\ole\oleobjecthelper.hxx %_DEST%\inc%_EXT%\oox\ole\oleobjecthelper.hxx
 -..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx
 -..\inc\oox\ole\olestorage.hxx %_DEST%\inc%_EXT%\oox\ole\olestorage.hxx
 -dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
 -
 -..\xml\components.xml %_DEST%\xml%_EXT%\components.xml
 -..\%__SRC%\misc\oox.component %_DEST%\xml%_EXT%\oox.component
++..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token\tokens.txt
diff --cc oox/source/drawingml/chart/chartdrawingfragment.cxx
index 912f641,10a8bd1..4d0109b
--- a/oox/source/drawingml/chart/chartdrawingfragment.cxx
+++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx
@@@ -217,10 -216,16 +216,17 @@@ void ChartDrawingFragment::onEndElement
      {
          if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() )
          {
-             Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuChartRect );
-             if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) ) {
+             EmuRectangle aShapeRectEmu = mxAnchor->calcAnchorRectEmu( maChartRectEmu );
+             if( (aShapeRectEmu.X >= 0) && (aShapeRectEmu.Y >= 0) && (aShapeRectEmu.Width >= 0) && (aShapeRectEmu.Height >= 0) )
+             {
+                 // TODO: DrawingML implementation expects 32-bit coordinates for EMU rectangles (change that to EmuRectangle)
+                 Rectangle aShapeRectEmu32(
+                     getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, 0, SAL_MAX_INT32 ),
+                     getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, 0, SAL_MAX_INT32 ),
+                     getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Width, 0, SAL_MAX_INT32 ),
+                     getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) );
 -                mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, &aShapeRectEmu32 );
 +                basegfx::B2DHomMatrix aMatrix;
-                 mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, aMatrix, &aLoc );
++                mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, aMatrix, &aShapeRectEmu32 );
              }
          }
          mxShape.reset();
diff --cc oox/source/token/namespaces.hxx.tail
index 67ddce9,90c2a4e..47702d9
--- a/oox/source/token/namespaces.hxx.tail
+++ b/oox/source/token/namespaces.hxx.tail
@@@ -10,24 -10,26 +10,27 @@@ inline sal_Int32 getBaseToken( sal_Int3
  /** Returns the namespace without token identifier of the passed token. */
  inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
  
+ 
  // defines for tokens with specific namespaces
- #define A_TOKEN( token )            (::oox::NMSP_dml | XML_##token)
- #define AX_TOKEN( token )           (::oox::NMSP_ax | XML_##token)
- #define C_TOKEN( token )            (::oox::NMSP_dmlChart | XML_##token)
- #define CDR_TOKEN( token )          (::oox::NMSP_dmlChartDr | XML_##token)
- #define DGM_TOKEN( token )          (::oox::NMSP_dmlDiagram | XML_##token)
- #define O_TOKEN( token )            (::oox::NMSP_vmlOffice | XML_##token)
- #define PC_TOKEN( token )           (::oox::NMSP_packageContentTypes | XML_##token)
- #define PPT_TOKEN( token )          (::oox::NMSP_ppt | XML_##token)
- #define PR_TOKEN( token )           (::oox::NMSP_packageRel | XML_##token)
- #define R_TOKEN( token )            (::oox::NMSP_officeRel | XML_##token)
- #define VML_TOKEN( token )          (::oox::NMSP_vml | XML_##token)
- #define VMLX_TOKEN( token )         (::oox::NMSP_vmlExcel | XML_##token)
- #define XDR_TOKEN( token )          (::oox::NMSP_dmlSpreadDr | XML_##token)
- #define XLS_TOKEN( token )          (::oox::NMSP_xls | XML_##token)
- #define XM_TOKEN( token )           (::oox::NMSP_xm | XML_##token)
- #define XML_TOKEN( token )          (::oox::NMSP_xml | XML_##token)
- #define MCE_TOKEN( token )          (::oox::NMSP_mce | XML_##token)
+ #define OOX_TOKEN( namespace, token ) (::oox::NMSP_##namespace | ::oox::XML_##token)
+ 
+ #define A_TOKEN( token )        OOX_TOKEN( dml, token )
+ #define AX_TOKEN( token )       OOX_TOKEN( ax, token )
+ #define C_TOKEN( token )        OOX_TOKEN( dmlChart, token )
+ #define CDR_TOKEN( token )      OOX_TOKEN( dmlChartDr, token )
+ #define DGM_TOKEN( token )      OOX_TOKEN( dmlDiagram, token )
++#define MCE_TOKEN( token )      OOX_TOKEN( mce, token)
+ #define O_TOKEN( token )        OOX_TOKEN( vmlOffice, token )
+ #define PC_TOKEN( token )       OOX_TOKEN( packageContentTypes, token )
+ #define PPT_TOKEN( token )      OOX_TOKEN( ppt, token )
+ #define PR_TOKEN( token )       OOX_TOKEN( packageRel, token )
+ #define R_TOKEN( token )        OOX_TOKEN( officeRel, token )
+ #define VML_TOKEN( token )      OOX_TOKEN( vml, token )
+ #define VMLX_TOKEN( token )     OOX_TOKEN( vmlExcel, token )
+ #define XDR_TOKEN( token )      OOX_TOKEN( dmlSpreadDr, token )
+ #define XLS_TOKEN( token )      OOX_TOKEN( xls, token )
+ #define XM_TOKEN( token )       OOX_TOKEN( xm, token )
+ #define XML_TOKEN( token )      OOX_TOKEN( xml, token )
  
  // ============================================================================
  
diff --cc oox/source/xls/drawingbase.cxx
index 0000000,592d432..15032e4
mode 000000,100755..100755
--- a/oox/source/xls/drawingbase.cxx
+++ b/oox/source/xls/drawingbase.cxx
@@@ -1,0 -1,323 +1,325 @@@
+ /*************************************************************************
+  *
+  * 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.
+  *
+  ************************************************************************/
+ 
+ #include "oox/xls/drawingbase.hxx"
+ 
+ #include <com/sun/star/awt/Rectangle.hpp>
+ #include "oox/helper/attributelist.hxx"
+ #include "oox/helper/binaryinputstream.hxx"
+ #include "oox/xls/unitconverter.hxx"
+ 
+ namespace oox {
+ namespace xls {
+ 
+ // ============================================================================
+ 
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::table;
+ using namespace ::oox::drawingml;
+ 
+ using ::rtl::OUString;
+ 
+ // ============================================================================
+ 
+ namespace {
+ 
+ /** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
+ inline sal_Int64 lclHmmToEmu( sal_Int32 nValue )
+ {
+     return (nValue < 0) ? -1 : convertHmmToEmu( nValue );
+ }
+ 
+ /** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
+ inline sal_Int32 lclEmuToHmm( sal_Int64 nValue )
+ {
+     return (nValue < 0) ? -1 : convertEmuToHmm( nValue );
+ }
+ 
+ /** Reads the cell anchor model from a BIFF or DFF stream. */
+ BinaryInputStream& operator>>( BinaryInputStream& rStrm, CellAnchorModel& rModel )
+ {
+     // all members are given as 16-bit unsigned values
+     rModel.mnCol = rStrm.readuInt16();
+     rModel.mnColOffset = rStrm.readuInt16();
+     rModel.mnRow = rStrm.readuInt16();
+     rModel.mnRowOffset = rStrm.readuInt16();
+     return rStrm;
+ }
+ 
+ } // namespace
+ 
+ // ============================================================================
+ 
+ CellAnchorModel::CellAnchorModel() :
+     mnCol( -1 ),
+     mnRow( -1 ),
+     mnColOffset( 0 ),
+     mnRowOffset( 0 )
+ {
+ }
+ 
+ // ----------------------------------------------------------------------------
+ 
+ AnchorClientDataModel::AnchorClientDataModel() :
+     mbLocksWithSheet( true ),
+     mbPrintsWithSheet( true )
+ {
+ }
+ 
+ // ============================================================================
+ 
+ ShapeAnchor::ShapeAnchor( const WorksheetHelper& rHelper ) :
+     WorksheetHelper( rHelper ),
+     meAnchorType( ANCHOR_INVALID ),
+     meCellAnchorType( CELLANCHOR_EMU ),
+     mnEditAs( XML_twoCell )
+ {
+ }
+ 
+ void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttribs )
+ {
+     switch( nElement )
+     {
+         case XDR_TOKEN( absoluteAnchor ):
+             meAnchorType = ANCHOR_ABSOLUTE;
+         break;
+         case XDR_TOKEN( oneCellAnchor ):
+             meAnchorType = ANCHOR_ONECELL;
+         break;
+         case XDR_TOKEN( twoCellAnchor ):
+             meAnchorType = ANCHOR_TWOCELL;
+             mnEditAs = rAttribs.getToken( XML_editAs, XML_twoCell );
+         break;
+         default:
+             OSL_ENSURE( false, "ShapeAnchor::importAnchor - unexpected element" );
+     }
+     meCellAnchorType = CELLANCHOR_EMU;
+ }
+ 
+ void ShapeAnchor::importPos( const AttributeList& rAttribs )
+ {
+     OSL_ENSURE( meAnchorType == ANCHOR_ABSOLUTE, "ShapeAnchor::importPos - unexpected 'xdr:pos' element" );
+     maPos.X = rAttribs.getHyper( XML_x, 0 );
+     maPos.Y = rAttribs.getHyper( XML_y, 0 );
+ }
+ 
+ void ShapeAnchor::importExt( const AttributeList& rAttribs )
+ {
+     OSL_ENSURE( (meAnchorType == ANCHOR_ABSOLUTE) || (meAnchorType == ANCHOR_ONECELL), "ShapeAnchor::importExt - unexpected 'xdr:ext' element" );
+     maSize.Width = rAttribs.getHyper( XML_cx, 0 );
+     maSize.Height = rAttribs.getHyper( XML_cy, 0 );
+ }
+ 
+ void ShapeAnchor::importClientData( const AttributeList& rAttribs )
+ {
+     maClientData.mbLocksWithSheet  = rAttribs.getBool( XML_fLocksWithSheet, true );
+     maClientData.mbPrintsWithSheet = rAttribs.getBool( XML_fPrintsWithSheet, true );
+ }
+ 
+ void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue )
+ {
+     CellAnchorModel* pCellAnchor = 0;
+     switch( nParentContext )
+     {
+         case XDR_TOKEN( from ):
+             OSL_ENSURE( (meAnchorType == ANCHOR_ONECELL) || (meAnchorType == ANCHOR_TWOCELL), "ShapeAnchor::setCellPos - unexpected 'xdr:from' element" );
+             pCellAnchor = &maFrom;
+         break;
+         case XDR_TOKEN( to ):
+             OSL_ENSURE( meAnchorType == ANCHOR_TWOCELL, "ShapeAnchor::setCellPos - unexpected 'xdr:to' element" );
+             pCellAnchor = &maTo;
+         break;
+         default:
+             OSL_ENSURE( false, "ShapeAnchor::setCellPos - unexpected parent element" );
+     }
+     if( pCellAnchor ) switch( nElement )
+     {
+         case XDR_TOKEN( col ):      pCellAnchor->mnCol = rValue.toInt32();          break;
+         case XDR_TOKEN( row ):      pCellAnchor->mnRow = rValue.toInt32();          break;
+         case XDR_TOKEN( colOff ):   pCellAnchor->mnColOffset = rValue.toInt64();    break;
+         case XDR_TOKEN( rowOff ):   pCellAnchor->mnRowOffset = rValue.toInt64();    break;
+         default:    OSL_ENSURE( false, "ShapeAnchor::setCellPos - unexpected element" );
+     }
+ }
+ 
+ void ShapeAnchor::importVmlAnchor( const OUString& rAnchor )
+ {
+     meAnchorType = ANCHOR_VML;
+ 
+     ::std::vector< OUString > aTokens;
+     sal_Int32 nIndex = 0;
+     while( nIndex >= 0 )
+         aTokens.push_back( rAnchor.getToken( 0, ',', nIndex ).trim() );
+ 
+     OSL_ENSURE( aTokens.size() >= 8, "ShapeAnchor::importVmlAnchor - missing anchor tokens" );
+     if( aTokens.size() >= 8 )
+     {
+         maFrom.mnCol       = aTokens[ 0 ].toInt32();
+         maFrom.mnColOffset = aTokens[ 1 ].toInt32();
+         maFrom.mnRow       = aTokens[ 2 ].toInt32();
+         maFrom.mnRowOffset = aTokens[ 3 ].toInt32();
+         maTo.mnCol         = aTokens[ 4 ].toInt32();
+         maTo.mnColOffset   = aTokens[ 5 ].toInt32();
+         maTo.mnRow         = aTokens[ 6 ].toInt32();
+         maTo.mnRowOffset   = aTokens[ 7 ].toInt32();
+     }
+ }
+ 
+ void ShapeAnchor::importBiffAnchor( BinaryInputStream& rStrm )
+ {
+     meAnchorType = ANCHOR_TWOCELL;          /// BIFF/DFF use two-cell anchors only
+     meCellAnchorType = CELLANCHOR_COLROW;   /// BIFF/DFF use fraction of column/row for offset values
+     rStrm >> maFrom >> maTo;
+ }
+ 
+ EmuRectangle ShapeAnchor::calcAnchorRectEmu( const Size& rPageSizeHmm ) const
+ {
+     AddressConverter& rAddrConv = getAddressConverter();
+     EmuSize aPageSize( lclHmmToEmu( rPageSizeHmm.Width ), lclHmmToEmu( rPageSizeHmm.Height ) );
+     EmuRectangle aAnchorRect( -1, -1, -1, -1 );
+ 
+     // calculate shape position
+     switch( meAnchorType )
+     {
+         case ANCHOR_ABSOLUTE:
+             OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid position" );
+             if( maPos.isValid() && (maPos.X < aPageSize.Width) && (maPos.Y < aPageSize.Height) )
+                 aAnchorRect.setPos( maPos );
+         break;
+         case ANCHOR_ONECELL:
+         case ANCHOR_TWOCELL:
++        case ANCHOR_VML:
+             OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid position" );
+             if( maFrom.isValid() && rAddrConv.checkCol( maFrom.mnCol, true ) && rAddrConv.checkRow( maFrom.mnRow, true ) )
+             {
+                 EmuPoint aPoint = calcCellAnchorEmu( maFrom );
+                 if( (aPoint.X < aPageSize.Width) && (aPoint.Y < aPageSize.Height) )
+                     aAnchorRect.setPos( aPoint );
+             }
+         break;
+         case ANCHOR_INVALID:
+             OSL_ENSURE( false, "ShapeAnchor::calcAnchorRectEmu - invalid anchor" );
+         break;
+     }
+ 
+     // calculate shape size
+     if( (aAnchorRect.X >= 0) && (aAnchorRect.Y >= 0) ) switch( meAnchorType )
+     {
+         case ANCHOR_ABSOLUTE:
+         case ANCHOR_ONECELL:
+             OSL_ENSURE( maSize.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid size" );
+             if( maSize.isValid() )
+             {
+                 aAnchorRect.Width = ::std::min< sal_Int64 >( maSize.Width, aPageSize.Width - aAnchorRect.X );
+                 aAnchorRect.Height = ::std::min< sal_Int64 >( maSize.Height, aPageSize.Height - aAnchorRect.Y );
+             }
+         break;
+         case ANCHOR_TWOCELL:
++        case ANCHOR_VML:
+             OSL_ENSURE( maTo.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid position" );
+             if( maTo.isValid() )
+             {
+                 /*  Pass a valid cell address to calcCellAnchorEmu(), otherwise
+                     nothing useful is returned, even if either row or column is valid. */
+                 CellAddress aToCell = rAddrConv.createValidCellAddress( BinAddress( maTo.mnCol, maTo.mnRow ), getSheetIndex(), true );
+                 CellAnchorModel aValidTo = maTo;
+                 aValidTo.mnCol = aToCell.Column;
+                 aValidTo.mnRow = aToCell.Row;
+                 EmuPoint aPoint = calcCellAnchorEmu( aValidTo );
+                 // width (if column index is valid, use the calculated offset, otherwise stretch to maximum available X position)
+                 aAnchorRect.Width = aPageSize.Width - aAnchorRect.X;
+                 if( aToCell.Column == maTo.mnCol )
+                     aAnchorRect.Width = ::std::min< sal_Int64 >( aPoint.X - aAnchorRect.X + 1, aAnchorRect.Width );
+                 // height (if row index is valid, use the calculated offset, otherwise stretch to maximum available Y position)
+                 aAnchorRect.Height = aPageSize.Height - aAnchorRect.Y;
+                 if( aToCell.Row == maTo.mnRow )
+                     aAnchorRect.Height = ::std::min< sal_Int64 >( aPoint.Y - aAnchorRect.Y + 1, aAnchorRect.Height );
+             }
+         break;
+         case ANCHOR_INVALID:
+         break;
+     }
+ 
+     // add 0.75 mm (27,000 EMUs) in X direction to correct display error
+     if( aAnchorRect.X >= 0 )
+         aAnchorRect.X += 27000;
+     // remove 0.25 mm (9,000 EMUs) in Y direction to correct display error
+     if( aAnchorRect.Y >= 9000 )
+         aAnchorRect.Y -= 9000;
+ 
+     return aAnchorRect;
+ }
+ 
+ Rectangle ShapeAnchor::calcAnchorRectHmm( const Size& rPageSizeHmm ) const
+ {
+     EmuRectangle aAnchorRect = calcAnchorRectEmu( rPageSizeHmm );
+     return Rectangle( lclEmuToHmm( aAnchorRect.X ), lclEmuToHmm( aAnchorRect.Y ), lclEmuToHmm( aAnchorRect.Width ), lclEmuToHmm( aAnchorRect.Height ) );
+ }
+ 
+ // private --------------------------------------------------------------------
+ 
+ EmuPoint ShapeAnchor::calcCellAnchorEmu( const CellAnchorModel& rModel ) const
+ {
+     // calculate position of top-left edge of the cell
+     Point aPoint = getCellPosition( rModel.mnCol, rModel.mnRow );
+     EmuPoint aEmuPoint( lclHmmToEmu( aPoint.X ), lclHmmToEmu( aPoint.Y ) );
+ 
+     // add the offset inside the cell
+     switch( meCellAnchorType )
+     {
+         case CELLANCHOR_EMU:
+             aEmuPoint.X += rModel.mnColOffset;
+             aEmuPoint.Y += rModel.mnRowOffset;
+         break;
+ 
+         case CELLANCHOR_PIXEL:
+         {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list