Index: filter/inc/filter/msfilter/escherex.hxx =================================================================== --- filter/inc/filter/msfilter/escherex.hxx (revision 1570392) +++ filter/inc/filter/msfilter/escherex.hxx (working copy) @@ -1255,7 +1255,7 @@ static sal_Bool GetLineArrow( const sal_Bool bLineStart, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, ESCHER_LineEnd& reLineEnd, sal_Int32& rnArrowLength, sal_Int32& rnArrowWidth ); - static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape, const MSO_SPT eShapeType ); + static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape ); static void LookForPolarHandles( const MSO_SPT eShapeType, sal_Int32& nAdjustmentsWhichNeedsToBeConverted ); static sal_Bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue ); }; Index: filter/source/msfilter/escherex.cxx =================================================================== --- filter/source/msfilter/escherex.cxx (revision 1570392) +++ filter/source/msfilter/escherex.cxx (working copy) @@ -2613,19 +2613,10 @@ } } } - -sal_Bool EscherPropertyContainer::IsDefaultObject( SdrObjCustomShape* pCustoShape , const MSO_SPT eShapeType ) +//zhaosz_xml +sal_Bool EscherPropertyContainer::IsDefaultObject( SdrObjCustomShape* pCustoShape ) { sal_Bool bIsDefaultObject = sal_False; - switch(eShapeType) - { - //if the custom shape is not default shape of ppt, return sal_Fasle; - case mso_sptTearDrop: - return bIsDefaultObject; - - default: - break; - } if ( pCustoShape ) { @@ -2714,7 +2705,7 @@ sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0; uno::Sequence< beans::PropertyValues > aHandlesPropSeq; sal_Bool bPredefinedHandlesUsed = sal_True; - sal_Bool bIsDefaultObject = IsDefaultObject( pCustoShape , eShapeType); + sal_Bool bIsDefaultObject = IsDefaultObject( pCustoShape); // convert property "Equations" into std::vector< EnhancedCustomShapeEquationEquation > std::vector< EnhancedCustomShapeEquation > aEquations; Index: oox/inc/oox/export/drawingml.hxx =================================================================== --- oox/inc/oox/export/drawingml.hxx (revision 1570392) +++ oox/inc/oox/export/drawingml.hxx (working copy) @@ -28,7 +28,9 @@ #include #include #include -#include +//zhaosz_xml +//#include +#include class Graphic; class String; Index: oox/inc/oox/export/shapes.hxx =================================================================== --- oox/inc/oox/export/shapes.hxx (revision 1570392) +++ oox/inc/oox/export/shapes.hxx (working copy) @@ -69,9 +69,13 @@ typedef std::hash_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap; ShapeHashMap maShapeMap; - + ShapeHashMap* mpShapeMap; public: - ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ); + //ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ); + + ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, + ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, + DocumentType eDocumentType = DOCUMENT_PPTX ); virtual ~ShapeExport() {} sal_Int32 GetXmlNamespace() const; @@ -149,9 +153,12 @@ virtual ShapeExport& WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); - sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape ); - sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape ); -}; + //zhaosz_xml + sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape ); + sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB ); + sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape ); + static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ShapeHashMap* pShapeMap ); + }; }} Index: oox/inc/oox/export/utils.hxx =================================================================== --- oox/inc/oox/export/utils.hxx (revision 1570392) +++ oox/inc/oox/export/utils.hxx (working copy) @@ -43,8 +43,8 @@ #endif // --------------------------------------------------------------------------------------------- - -static inline sal_Int64 PPTtoEMU( INT32 nPPT ) +//zhaosz_xml, INT32 to sal_Int32 +static inline sal_Int64 PPTtoEMU( sal_Int32 nPPT ) { return (sal_Int64)( (double)nPPT * 1587.5 ); } @@ -51,7 +51,7 @@ // --------------------------------------------------------------------------------------------- -static inline sal_Int64 MM100toEMU( INT32 nMM100 ) +static inline sal_Int64 MM100toEMU( sal_Int32 nMM100 ) { return (sal_Int64)nMM100 * 360; } Index: oox/inc/oox/export/vmlexport.hxx =================================================================== --- oox/inc/oox/export/vmlexport.hxx (revision 1570392) +++ oox/inc/oox/export/vmlexport.hxx (working copy) @@ -23,7 +23,7 @@ #include #include -#include +#include //zhaosz_xml namespace rtl { class OString; @@ -87,13 +87,13 @@ private: - virtual void OpenContainer( UINT16 nEscherContainer, int nRecInstance = 0 ); + virtual void OpenContainer( sal_Int16 nEscherContainer, int nRecInstance = 0 ); virtual void CloseContainer(); - virtual UINT32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 ); + virtual sal_uInt32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 ); virtual void LeaveGroup(); - virtual void AddShape( UINT32 nShapeType, UINT32 nShapeFlags, UINT32 nShapeId = 0 ); + virtual void AddShape( sal_Int32 nShapeType, sal_Int32 nShapeFlags, sal_Int32 nShapeId = 0 ); private: /// Create an OString representing the id from a numerical id. Index: oox/prj/build.lst =================================================================== --- oox/prj/build.lst (revision 1570392) +++ oox/prj/build.lst (working copy) @@ -1,4 +1,4 @@ -oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx xmlscript tools vcl BOOST:boost OPENSSL:openssl LIBXSLT:libxslt NULL +oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx xmlscript tools vcl BOOST:boost OPENSSL:openssl LIBXSLT:libxslt svx NULL oox oox usr1 - all oox_mkout NULL oox oox\prj get - all oox_prj NULL oox oox\source\token nmake - all oox_token NULL @@ -15,4 +15,5 @@ oox oox\source\xls nmake - all oox_xls oox_token NULL oox oox\source\dump nmake - all oox_dump oox_token NULL oox oox\source\shape nmake - all oox_shape oox_token NULL -oox oox\util nmake - all oox_util oox_token oox_helper oox_core oox_ole oox_vml oox_drawingml oox_diagram oox_chart oox_table oox_ppt oox_xls oox_dump oox_shape oox_docprop NULL +oox oox\source\export nmake - all oox_export oox_token NULL +oox oox\util nmake - all oox_util oox_token oox_helper oox_core oox_ole oox_vml oox_drawingml oox_diagram oox_chart oox_table oox_ppt oox_xls oox_dump oox_export oox_shape oox_docprop NULL Index: oox/prj/d.lst =================================================================== --- oox/prj/d.lst (revision 1570392) +++ oox/prj/d.lst (working copy) @@ -8,6 +8,7 @@ mkdir: %_DEST%\inc%_EXT%\oox\token mkdir: %_DEST%\inc%_EXT%\oox\vml mkdir: %_DEST%\inc%_EXT%\oox\xls +mkdir: %_DEST%\inc%_EXT%\oox\export ..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map ..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib @@ -35,6 +36,7 @@ ..\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\*.hxx %_DEST%\inc%_EXT%\oox\drawingml\*.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 @@ -41,7 +43,7 @@ ..\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\xls\excelvbaproject.hxx %_DEST%\inc%_EXT%\oox\xls\excelvbaproject.hxx - +..\inc\oox\export\*.hxx %_DEST%\inc%_EXT%\oox\export\*.hxx dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" ..\xml\components.xml %_DEST%\xml%_EXT%\components.xml Index: oox/source/export/drawingml.cxx =================================================================== --- oox/source/export/drawingml.cxx (revision 1570392) +++ oox/source/export/drawingml.cxx (working copy) @@ -24,6 +24,8 @@ #include "oox/core/xmlfilterbase.hxx" #include "oox/export/drawingml.hxx" #include "oox/export/utils.hxx" +//zhaosz_xml +#include "oox/token/tokens.hxx" #include #include @@ -35,6 +37,9 @@ #include #include #include +//zhaosz_xml +#include + #include #include #include @@ -42,6 +47,12 @@ #include #include #include + +//zhaosz_xml +#include +#include + + #include #include #include @@ -58,13 +69,23 @@ #include #include #include -#include -#include +//zhaosz_xml +//#include +#include +#include +#include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::i18n; +//zhaosz_xml +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::style; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::drawing; + using ::com::sun::star::beans::PropertyState; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::beans::XPropertySet; @@ -313,10 +334,10 @@ sal_uInt32 nLineWidth = 0; sal_uInt32 nColor = 0; - sal_Bool bColorSet = FALSE; + sal_Bool bColorSet = sal_False; //zhaosz_xml const char* cap = NULL; drawing::LineDash aLineDash; - sal_Bool bDashSet = FALSE; + sal_Bool bDashSet = sal_False; GET( nLineWidth, LineWidth ); @@ -324,7 +345,7 @@ case drawing::LineStyle_DASH: if( GETA( LineDash ) ) { aLineDash = *(drawing::LineDash*) mAny.getValue(); - bDashSet = TRUE; + bDashSet = sal_True; if( aLineDash.Style == DashStyle_ROUND || aLineDash.Style == DashStyle_ROUNDRELATIVE ) cap = "rnd"; @@ -336,7 +357,7 @@ default: if ( GETA( LineColor ) ) { nColor = *((sal_uInt32*) mAny.getValue()) & 0xffffff; - bColorSet = TRUE; + bColorSet = sal_True; } break; } @@ -466,7 +487,9 @@ } aData = aStream.GetData(); - nDataSize = aStream.GetSize(); + //nDataSize = aStream.GetSize(); + //zhaosz_xml + nDataSize = aStream.GetEndOfData();//just function replacing break; } } @@ -478,8 +501,8 @@ case DOCUMENT_PPTX: pComponent = "ppt"; break; case DOCUMENT_XLSX: pComponent = "xl"; break; } - - Reference< XOutputStream > xOutStream = mpFB->openOutputStream( OUStringBuffer() +//zhaosz_xml + /*Reference< XOutputStream > xOutStream = mpFB->openOutputStream( OUStringBuffer() .appendAscii( pComponent ) .appendAscii( "/media/image" ) .append( (sal_Int32) mnImageCounter ) @@ -486,6 +509,25 @@ .appendAscii( sExtension ) .makeStringAndClear(), sMediaType ); + */ + /* + + Reference< XOutputStream > XmlFilterBase::openFragmentStream( const OUString& rStreamName, const OUString& rMediaType ) + { + Reference< XOutputStream > xOutputStream = openOutputStream( rStreamName ); + PropertySet aPropSet( xOutputStream ); + aPropSet.setProperty( PROP_MediaType, rMediaType ); + return xOutputStream; + } + + */ + Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer() + .appendAscii( pComponent ) + .appendAscii( "/media/image" ) + .append( (sal_Int32) mnImageCounter ) + .appendAscii( sExtension ) + .makeStringAndClear(), + sMediaType ); xOutStream->writeBytes( Sequence< sal_Int8 >( (const sal_Int8*) aData, nDataSize ) ); xOutStream->closeOutput(); @@ -791,7 +833,7 @@ if( rXTextField.is() ) { rXPropSet.set( rXTextField, UNO_QUERY ); if( rXPropSet.is() ) { - String aFieldKind( rXTextField->getPresentation( TRUE ) ); + String aFieldKind( rXTextField->getPresentation( sal_True ) ); DBG(printf ("field kind: %s\n", ST(aFieldKind) )); if( aFieldKind == S( "Page" ) ) { return "slidenum"; @@ -1092,7 +1134,7 @@ mpFS->startElementNS( XML_a, XML_p, FSEND ); - sal_Bool bPropertiesWritten = FALSE; + sal_Bool bPropertiesWritten = sal_False; while( enumeration->hasMoreElements() ) { Reference< XTextRange > run; Any any ( enumeration->nextElement() ); @@ -1100,7 +1142,7 @@ if (any >>= run) { if( !bPropertiesWritten && run->getString().getLength() ) { WriteParagraphProperties( rParagraph ); - bPropertiesWritten = TRUE; + bPropertiesWritten = sal_True; } WriteRun( run ); } @@ -1152,11 +1194,11 @@ if( eHorizontalAlignment == TextHorizontalAdjust_CENTER ) bHorizontalCenter = true; - sal_Bool bHasWrap = FALSE; - sal_Bool bWrap = FALSE; + sal_Bool bHasWrap = sal_False; + sal_Bool bWrap = sal_False; if( GETA( TextWordWrap ) ) { mAny >>= bWrap; - bHasWrap = TRUE; + bHasWrap = sal_True; //DBG(printf("wrap: %d\n", bWrap)); } @@ -1241,11 +1283,11 @@ mpFS->startElementNS( XML_a, XML_pathLst, FSEND ); - for( USHORT i = 0; i < rPolyPolygon.Count(); i ++ ) { + for( sal_uInt16 i = 0; i < rPolyPolygon.Count(); i ++ ) { const Polygon& rPoly = rPolyPolygon[ i ]; Rectangle aRect( rPoly.GetBoundRect() ); - sal_Bool bBezier = FALSE; + sal_Bool bBezier = sal_False; mpFS->startElementNS( XML_a, XML_path, XML_w, I64S( aRect.GetWidth() ), @@ -1264,13 +1306,13 @@ mpFS->endElementNS( XML_a, XML_moveTo ); } - for( USHORT j = 1; j < rPoly.GetSize(); j ++ ) + for( sal_uInt16 j = 1; j < rPoly.GetSize(); j ++ ) { enum PolyFlags flags = rPoly.GetFlags(j); if( flags == POLY_CONTROL && !bBezier ) { mpFS->startElementNS( XML_a, XML_cubicBezTo, FSEND ); - bBezier = TRUE; + bBezier = sal_True; } else if( flags == POLY_NORMAL && !bBezier ) mpFS->startElementNS( XML_a, XML_lnTo, FSEND ); @@ -1283,7 +1325,7 @@ if( ( flags == POLY_NORMAL || flags == POLY_SYMMTR ) && bBezier ) { mpFS->endElementNS( XML_a, XML_cubicBezTo ); - bBezier = FALSE; + bBezier = sal_False; } else if( flags == POLY_NORMAL && !bBezier ) mpFS->endElementNS( XML_a, XML_lnTo ); @@ -1323,11 +1365,11 @@ { mpFS->singleElementNS( XML_a, XML_stCxn, XML_id, I32S( nStartID ), - XML_idx, I64S( rConnectorEntry.GetConnectorRule( TRUE ) ), + XML_idx, I64S( rConnectorEntry.GetConnectorRule( sal_True ) ), FSEND ); mpFS->singleElementNS( XML_a, XML_endCxn, XML_id, I32S( nEndID ), - XML_idx, I64S( rConnectorEntry.GetConnectorRule( FALSE ) ), + XML_idx, I64S( rConnectorEntry.GetConnectorRule( sal_False ) ), FSEND ); } Index: oox/source/export/makefile.mk =================================================================== --- oox/source/export/makefile.mk (revision 1570392) +++ oox/source/export/makefile.mk (working copy) @@ -35,9 +35,9 @@ SLOFILES = \ $(SLO)$/drawingml.obj \ - $(SLO)$/shapes.obj \ - $(SLO)$/vmlexport.obj \ - $(SLO)$/vmlexport-shape-types.obj + $(SLO)$/shapes.obj +# $(SLO)$/vmlexport.obj \ +# $(SLO)$/vmlexport-shape-types.obj # --- Targets ------------------------------------------------------- Index: oox/source/export/shapes.cxx =================================================================== --- oox/source/export/shapes.cxx (revision 1570392) +++ oox/source/export/shapes.cxx (working copy) @@ -61,9 +61,14 @@ #include #include #include -#include +//#include +//zhaosz_xml +#include +#include +#include "oox/token/tokens.hxx" + #include -#include +//#include #include using namespace ::com::sun::star; @@ -89,7 +94,10 @@ using ::rtl::OUString; using ::rtl::OUStringBuffer; using ::sax_fastparser::FSHelperPtr; +//zhaosz_xml +using ::oox::core::XmlFilterBase; + DBG(extern void dump_pset(Reference< XPropertySet > rXPropSet)); #define IDS(x) (OString(#x " ") + OString::valueOf( mnShapeIdMax++ )).getStr() @@ -306,7 +314,22 @@ { "mso-spt201", "hostControl" }, { "mso-spt202", "rect" } }; +//zhaosz_xml +struct ShapeHash +{ + size_t operator()( const char* s ) const + { + return rtl_str_hashCode(s); + } +}; +struct ShapeCheck +{ + bool operator()( const char* s1, const char* s2 ) const + { + return strcmp( s1, s2 ) == 0; + } +}; typedef std::hash_map< const char*, const char*, CStringHash, CStringEqual> CustomShapeTypeTranslationHashMap; static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL; @@ -344,14 +367,16 @@ if ( GETA(propName) ) \ mAny >>= variable; -ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType ) +ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, + ShapeHashMap* pShapeMap, XmlFilterBase* pFB, DocumentType eDocumentType ) : DrawingML( pFS, pFB, eDocumentType ) - , mnXmlNamespace( nXmlNamespace ) , mnShapeIdMax( 1 ) , mnPictureIdMax( 1 ) + , mnXmlNamespace( nXmlNamespace ) , maFraction( 1, 576 ) , maMapModeSrc( MAP_100TH_MM ) , maMapModeDest( MAP_INCH, Point(), maFraction, maFraction ) + , mpShapeMap( pShapeMap ? pShapeMap : &maShapeMap ) { } @@ -430,12 +455,12 @@ ShapeExport& ShapeExport::WriteClosedBezierShape( Reference< XShape > xShape ) { - return WriteBezierShape( xShape, TRUE ); + return WriteBezierShape( xShape, sal_True ); } ShapeExport& ShapeExport::WriteOpenBezierShape( Reference< XShape > xShape ) { - return WriteBezierShape( xShape, FALSE ); + return WriteBezierShape( xShape, sal_False ); } ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape ) @@ -445,7 +470,7 @@ Reference< XPropertySet > rXPropSet( xShape, UNO_QUERY ); SdrObjCustomShape* pShape = (SdrObjCustomShape*) GetSdrObjectFromXShape( xShape ); sal_Bool bIsDefaultObject = EscherPropertyContainer::IsDefaultObject( pShape ); - sal_Bool bPredefinedHandlesUsed = TRUE; + sal_Bool bPredefinedHandlesUsed = sal_True; OUString sShapeType; sal_uInt32 nMirrorFlags = 0; MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( xShape, nMirrorFlags, sShapeType ); @@ -468,7 +493,7 @@ nAdjustmentValuesIndex = i; else if( rProp.Name.equalsAscii( "Handles" )) { if( !bIsDefaultObject ) - bPredefinedHandlesUsed = FALSE; + bPredefinedHandlesUsed = sal_False; // TODO: update nAdjustmentsWhichNeedsToBeConverted here } } @@ -702,13 +727,13 @@ Rectangle aRect( Point( aStartPoint.X, aStartPoint.Y ), Point( aEndPoint.X, aEndPoint.Y ) ); if( aRect.getWidth() < 0 ) { - bFlipH = TRUE; + bFlipH = sal_True; aRect.setX( aEndPoint.X ); aRect.setWidth( aStartPoint.X - aEndPoint.X ); } if( aRect.getHeight() < 0 ) { - bFlipV = TRUE; + bFlipV = sal_True; aRect.setY( aEndPoint.Y ); aRect.setHeight( aStartPoint.Y - aEndPoint.Y ); } @@ -861,7 +886,7 @@ } typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > ); -typedef std::hash_map< const char*, ShapeConverter, CStringHash, CStringEqual> NameToConvertMapType; +typedef std::hash_map< const char*, ShapeConverter, ShapeHash, ShapeCheck> NameToConvertMapType; static const NameToConvertMapType& lcl_GetConverters() { Index: oox/source/export/vmlexport.cxx =================================================================== --- oox/source/export/vmlexport.cxx (revision 1570392) +++ oox/source/export/vmlexport.cxx (working copy) @@ -23,7 +23,9 @@ #include -#include +//#include +//zhaosz_xml +#include "oox/token/tokens.hxx" #include #include @@ -60,7 +62,9 @@ }; VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer ) - : EscherEx( *( new SvNullStream ), 0 ), + //: EscherEx( *( new SvNullStream ), 0 ), + //zhaosz_xml + : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), *( new SvNullStream ) ), m_pSerializer( pSerializer ), m_pShapeAttrList( NULL ), m_nShapeType( ESCHER_ShpInst_Nil ), @@ -78,7 +82,7 @@ delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = NULL; } -void VMLExport::OpenContainer( UINT16 nEscherContainer, int nRecInstance ) +void VMLExport::OpenContainer( sal_Int16 nEscherContainer, int nRecInstance ) { EscherEx::OpenContainer( nEscherContainer, nRecInstance ); @@ -122,9 +126,9 @@ EscherEx::CloseContainer(); } -UINT32 VMLExport::EnterGroup( const String& rShapeName, const Rectangle* pRect ) +sal_uInt32 VMLExport::EnterGroup( const String& rShapeName, const Rectangle* pRect ) { - UINT32 nShapeId = GetShapeID(); + sal_Int32 nShapeId = GenerateShapeId();//zhaosz_xml,just function replacing OStringBuffer aStyle( 200 ); FastAttributeList *pAttrList = m_pSerializer->createAttrList(); @@ -167,7 +171,7 @@ m_pSerializer->endElementNS( XML_v, XML_group ); } -void VMLExport::AddShape( UINT32 nShapeType, UINT32 nShapeFlags, UINT32 nShapeId ) +void VMLExport::AddShape( sal_Int32 nShapeType, sal_Int32 nShapeFlags, sal_Int32 nShapeId ) { m_nShapeType = nShapeType; m_nShapeFlags = nShapeFlags; Index: oox/util/makefile.mk =================================================================== --- oox/util/makefile.mk (revision 1570392) +++ oox/util/makefile.mk (working copy) @@ -49,7 +49,8 @@ $(SLB)$/table.lib\ $(SLB)$/shape.lib\ $(SLB)$/dump.lib\ - $(SLB)$/docprop.lib + $(SLB)$/docprop.lib\ + $(SLB)$/export.lib # --- Shared-Library ----------------------------------------------- @@ -62,9 +63,17 @@ $(CPPUHELPERLIB)\ $(COMPHELPERLIB)\ $(RTLLIB) \ + $(TOOLSLIB) \ $(SALLIB) \ $(BASEGFXLIB) \ + $(VCLLIB) \ $(SAXLIB) \ + $(MSFILTERLIB) \ + $(SVTOOLLIB) \ + $(SVXLIB) \ + $(SVXCORELIB) \ + $(UNOTOOLSLIB) \ + $(SVLLIB) \ $(XMLSCRIPTLIB) # link openssl, copied this bit from ucb/source/ucp/webdav/makefile.mk Index: sc/inc/drwlayer.hxx =================================================================== --- sc/inc/drwlayer.hxx (revision 1570392) +++ sc/inc/drwlayer.hxx (working copy) @@ -208,6 +208,8 @@ // Verankerung setzen und ermitteln static void SetAnchor( SdrObject*, ScAnchorType ); static ScAnchorType GetAnchor( const SdrObject* ); +//zhaosz_xml + static ScAnchorType GetAnchorType( const SdrObject& ); // Positionen fuer Detektivlinien static ScDrawObjData* GetObjData( SdrObject* pObj, sal_Bool bCreate=sal_False ); Index: sc/source/core/data/drwlayer.cxx =================================================================== --- sc/source/core/data/drwlayer.cxx (revision 1570392) +++ sc/source/core/data/drwlayer.cxx (working copy) @@ -1891,6 +1891,13 @@ Point aAnchor( pObj->GetAnchorPos() ); return ( aAnchor.Y() != 0 ) ? SCA_PAGE : SCA_CELL; } +//zhaosz_xml +ScAnchorType ScDrawLayer::GetAnchorType( const SdrObject &rObj ) +{ + //If this object has a cell anchor associated with it + //then its cell-anchored, otherwise its page-anchored + return ScDrawLayer::GetObjData(const_cast(&rObj)) ? SCA_CELL : SCA_PAGE; +} ScDrawObjData* ScDrawLayer::GetObjData( SdrObject* pObj, sal_Bool bCreate ) // static { Index: sc/source/filter/excel/excdoc.cxx =================================================================== --- sc/source/filter/excel/excdoc.cxx (revision 1570392) +++ sc/source/filter/excel/excdoc.cxx (working copy) @@ -80,6 +80,8 @@ #include +#include +#include using namespace ::oox; using ::rtl::OString; @@ -403,8 +405,9 @@ Add( new XclExpRecalcId ); - // MSODRAWINGGROUP per-document data - aRecList.AppendRecord( GetObjectManager().CreateDrawingGroup() ); + // MSODRAWINGGROUP per-document data + // if( GetOutput() == EXC_OUTPUT_BINARY ) + aRecList.AppendRecord( GetObjectManager().CreateDrawingGroup() ); // Shared string table: SST, EXTSST aRecList.AppendRecord( CreateRecord( EXC_ID_SST ) ); @@ -422,13 +425,15 @@ RootData& rR = GetOldRoot(); XclBiff eBiff = GetBiff(); ScDocument& rDoc = GetDoc(); - + XclOutput eOutput = GetOutput();//zhaosz_xml DBG_ASSERT( (mnScTab >= 0L) && (mnScTab <= MAXTAB), "-ExcTable::Table(): mnScTab - no ordinary table!" ); DBG_ASSERT( nExcTab <= static_cast(MAXTAB), "-ExcTable::Table(): nExcTab - no ordinary table!" ); // create a new OBJ list for this sheet (may be used by notes, autofilter, data validation) - if( eBiff == EXC_BIFF8 ) - GetObjectManager().StartSheet(); + if( eBiff == EXC_BIFF8 /*&& GetOutput() == EXC_OUTPUT_BINARY */)//zhaosz_xml + { + GetObjectManager().StartSheet();//make the mxObjList + } // cell table: DEFROWHEIGHT, DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records mxCellTable.reset( new XclExpCellTable( GetRoot() ) ); @@ -629,6 +634,9 @@ Add( new XclExpUsersViewEnd ); } } + //zhaosz_xml + if (GetOutput() == EXC_OUTPUT_XML_2007 )//call mxObjList->EndSheet(); + aRecList.AppendRecord( GetObjectManager().ProcessDrawing( GetSdrPage( mnScTab ) ) ); // EOF Add( new ExcEof ); @@ -737,9 +745,9 @@ xTab->FillAsEmptyTable( nCodeNameIdx ); } - if ( GetBiff() == EXC_BIFF8 ) - { - // complete temporary Escher stream + if ( GetOutput() == EXC_OUTPUT_BINARY && GetBiff() == EXC_BIFF8 ) + { + // complete temporary Escher stream GetObjectManager().EndDocument(); // change tracking @@ -780,48 +788,45 @@ pExpChangeTrack->Write(); } -void ExcDocument::WriteXml( SvStream& rStrm ) +void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) { + SfxObjectShell* pDocShell = GetDocShell(); + + using namespace ::com::sun::star; + uno::Reference xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW ); + uno::Reference xDocProps = xDPS->getDocumentProperties(); + + rStrm.exportDocumentProperties( xDocProps ); + + sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream(); + rWorkbook->startElement( XML_workbook, + XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", + FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + FSEND ); + rWorkbook->singleElement( XML_fileVersion, + XML_appName, "Calc", + // OOXTODO: XML_codeName + // OOXTODO: XML_lastEdited + // OOXTODO: XML_lowestEdited + // OOXTODO: XML_rupBuild + FSEND ); + if( !maTableList.IsEmpty() ) { InitializeSave(); - XclExpXmlStream aStrm( ::comphelper::getProcessComponentContext(), rStrm, GetRoot() ); + aHeader.WriteXml( rStrm ); - sax_fastparser::FSHelperPtr& rWorkbook = aStrm.GetCurrentStream(); - rWorkbook->startElement( XML_workbook, - XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main", - FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", - FSEND ); - rWorkbook->singleElement( XML_fileVersion, - XML_appName, "Calc", - // OOXTODO: XML_codeName - // OOXTODO: XML_lastEdited - // OOXTODO: XML_lowestEdited - // OOXTODO: XML_rupBuild - FSEND ); - - aHeader.WriteXml( aStrm ); - for( size_t nTab = 0, nTabCount = maTableList.GetSize(); nTab < nTabCount; ++nTab ) { - // set current stream position in BOUNDSHEET record -#if 0 - ExcBoundsheetRef xBoundsheet = maBoundsheetList.GetRecord( nTab ); - if( xBoundsheet.get() ) - xBoundsheet->SetStreamPos( aXclStrm.GetSvStreamPos() ); -#endif // write the table - maTableList.GetRecord( nTab )->WriteXml( aStrm ); + maTableList.GetRecord( nTab )->WriteXml( rStrm ); } + } - rWorkbook->endElement( XML_workbook ); - rWorkbook.reset(); - aStrm.commitStorage(); - } -#if 0 - if( pExpChangeTrack ) - pExpChangeTrack->WriteXml(); -#endif + rWorkbook->endElement( XML_workbook ); + rWorkbook.reset(); + + rStrm.commitStorage(); } Index: sc/source/filter/excel/expop2.cxx =================================================================== --- sc/source/filter/excel/expop2.cxx (revision 1570392) +++ sc/source/filter/excel/expop2.cxx (working copy) @@ -188,7 +188,7 @@ } pExcDoc->ReadDoc(); // ScDoc -> ExcDoc - pExcDoc->WriteXml( aOut ); // wechstreamen +// pExcDoc->WriteXml( aOut ); // wechstreamen if( pDocShell && xRootStrg.Is() ) { Index: sc/source/filter/excel/xestream.cxx =================================================================== --- sc/source/filter/excel/xestream.cxx (revision 1570392) +++ sc/source/filter/excel/xestream.cxx (working copy) @@ -40,6 +40,7 @@ #include "xlstring.hxx" #include "xeroot.hxx" #include "xestyle.hxx" +#include "xcl97rec.hxx" #include "rangelst.hxx" #include "compiler.hxx" @@ -814,31 +815,41 @@ { return b ? "true" : "false"; } +//zhaosz_xml +sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int32 nValue ) +{ + pStream->startElement( nElement, FSEND ); + pStream->write( nValue ); + pStream->endElement( nElement ); -// ============================================================================ + return pStream; +} -XclExpXmlStream::XclExpXmlStream( const Reference< XComponentContext >& rxContext, SvStream& rStrm, const XclExpRoot& rRoot ) - : XmlFilterBase( rxContext ) - , mrRoot( rRoot ) +sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int64 nValue ) { - Sequence< PropertyValue > aArgs( 1 ); - const OUString sStream( RTL_CONSTASCII_USTRINGPARAM( "StreamForOutput" ) ); - aArgs[0].Name = sStream; - aArgs[0].Value <<= Reference< XStream > ( new OStreamWrapper( rStrm ) ); + pStream->startElement( nElement, FSEND ); + pStream->write( nValue ); + pStream->endElement( nElement ); - XServiceInfo* pInfo = rRoot.GetDocModelObj(); - Reference< XComponent > aComponent( pInfo, UNO_QUERY ); - setSourceDocument( aComponent ); - filter( aArgs ); + return pStream; +} - PushStream( CreateOutputStream( - OUString::createFromAscii( "xl/workbook.xml" ), - OUString::createFromAscii( "xl/workbook.xml" ), - Reference< XOutputStream >(), - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ) ); +sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const char* sValue ) +{ + pStream->startElement( nElement, FSEND ); + pStream->write( sValue ); + pStream->endElement( nElement ); + + return pStream; } +// ============================================================================ +XclExpXmlStream::XclExpXmlStream( const Reference< XComponentContext >& rxContext ) + : XmlFilterBase( rxContext ) + , mpRoot( NULL ) +{ +} + XclExpXmlStream::~XclExpXmlStream() { } @@ -961,7 +972,8 @@ // OOXTODO: XML_theme, index into // OOXTODO: XML_tint, double FSEND ); - lcl_WriteValue( rStream, XML_sz, OString::valueOf( (double) (rFontData.mnHeight / 20.0) ).getStr() ); // Twips->Points + //lcl_WriteValue( rStream, XML_sz, OString::valueOf( ((double) (rFontData.mnHeight / 20.0)).getStr() ) ); // Twips->Pt + lcl_WriteValue( rStream, XML_sz, OString::valueOf( (double) (rFontData.mnHeight / 20.0) ).getStr() ); lcl_WriteValue( rStream, XML_u, bHaveUnderline ? pUnderline : NULL ); lcl_WriteValue( rStream, XML_vertAlign, bHaveVertAlign ? pVertAlign : NULL ); Index: sc/source/filter/excel/xestyle.cxx =================================================================== --- sc/source/filter/excel/xestyle.cxx (revision 1570392) +++ sc/source/filter/excel/xestyle.cxx (working copy) @@ -2271,6 +2271,11 @@ else sName = XclXmlUtils::ToOString( maName ); sal_Int32 nXFId = rStrm.GetRoot().GetXFBuffer().GetXmlStyleIndex( maXFId.mnXFId ); + //zhaosz_xml + const sal_Int32 maxId = 53;//this value gotten from ooxml validator + sal_uInt8 nSI = mnStyleId; + if(nSI > maxId) + nSI = maxId; rStrm.GetCurrentStream()->singleElement( XML_cellStyle, XML_name, sName.getStr(), XML_xfId, OString::valueOf( nXFId ).getStr(), Index: sc/source/filter/inc/excdoc.hxx =================================================================== --- sc/source/filter/inc/excdoc.hxx (revision 1570392) +++ sc/source/filter/inc/excdoc.hxx (working copy) @@ -104,9 +104,9 @@ explicit ExcDocument( const XclExpRoot& rRoot ); virtual ~ExcDocument(); - void ReadDoc( void ); - void Write( SvStream& rSvStrm ); - void WriteXml( SvStream& rSvStrm ); + void ReadDoc( void ); + void Write( SvStream& rSvStrm ); + void WriteXml( XclExpXmlStream& ); }; Index: sc/source/filter/inc/xcl97rec.hxx =================================================================== --- sc/source/filter/inc/xcl97rec.hxx (revision 1570392) +++ sc/source/filter/inc/xcl97rec.hxx (working copy) @@ -52,11 +52,17 @@ void EndSheet(); virtual void Save( XclExpStream& rStrm ); + virtual void SaveXml( XclExpXmlStream& rStrm ); + //zhaosz_xml + static void ResetCounters(); private: XclEscherEx& mrEscherEx; XclExpMsoDrawing* pMsodrawingPerSheet; XclExpMsoDrawing* pSolverContainer; + //zhaosz_xml + static int mnDrawingMLCount, mnVmlCount; + SCTAB mnScTab; }; @@ -78,6 +84,8 @@ sal_Bool bFirstOnSheet; bool mbOwnEscher; /// true = Escher part created on the fly. +//zhaosz_xml + SCTAB mnScTab; /** @param bOwnEscher If set to true, this object will create its escher data. See SetOwnEscher() for details. */ @@ -96,6 +104,10 @@ inline sal_uInt16 GetObjType() const { return mnObjType; } inline void SetId( sal_uInt16 nId ) { nObjId = nId; } + //zhaosz_xml + inline void SetTab( SCTAB nScTab ) { mnScTab = nScTab; } + + inline SCTAB GetTab() const { return mnScTab; } inline void SetLocked( sal_Bool b ) { b ? nGrbit |= 0x0001 : nGrbit &= ~0x0001; } @@ -217,13 +229,23 @@ class XclObjAny : public XclObj { private: + //zhaosz_xml + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape; virtual void WriteSubRecs( XclExpStream& rStrm ); public: XclObjAny( XclExpObjectManager& rObjMgr ); + XclObjAny( XclExpObjectManager& rObjMgr , + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape); virtual ~XclObjAny(); virtual void Save( XclExpStream& rStrm ); + //zhaosz_xml + + void SaveXml( XclExpXmlStream& rStrm ); + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > GetShape() const { return mxShape; } + static void WriteFromTo( XclExpXmlStream& rStrm, const XclObjAny& rObj ); + static void WriteFromTo( XclExpXmlStream& rStrm, const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape, SCTAB nTab ); }; Index: sc/source/filter/inc/xestream.hxx =================================================================== --- sc/source/filter/inc/xestream.hxx (revision 1570392) +++ sc/source/filter/inc/xestream.hxx (working copy) @@ -264,6 +264,7 @@ (s.Len() && s.GetChar( 0 ) != 0 ? XclXmlUtils::ToOString( s ).getStr() : NULL) class ScAddress; +class ScDocShell; class ScDocument; class ScRange; class ScRangeList; @@ -298,6 +299,11 @@ static ::rtl::OUString ToOUString( ScDocument& rDocument, const ScAddress& rAddress, ScTokenArray* pTokenArray ); static ::rtl::OUString ToOUString( const XclExpString& s ); static const char* ToPsz( bool b ); + //zhaosz_xml + static sax_fastparser::FSHelperPtr WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int32 nValue ); + static sax_fastparser::FSHelperPtr WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int64 nValue ); + static sax_fastparser::FSHelperPtr WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const char* sValue ); + }; class XclExpXmlStream : public oox::core::XmlFilterBase Index: sc/source/filter/xcl97/xcl97esc.cxx =================================================================== --- sc/source/filter/xcl97/xcl97esc.cxx (revision 1570392) +++ sc/source/filter/xcl97/xcl97esc.cxx (working copy) @@ -270,7 +270,7 @@ { // #107540# ignore permanent note shapes // #i12190# do not ignore callouts (do not filter by object type ID) - pCurrXclObj = new XclObjAny( mrObjMgr ); // just a metafile + pCurrXclObj = new XclObjAny( mrObjMgr ,rxShape ); // just a metafile } } if ( pCurrXclObj ) Index: sc/source/filter/xcl97/xcl97rec.cxx =================================================================== --- sc/source/filter/xcl97/xcl97rec.cxx (revision 1570392) +++ sc/source/filter/xcl97/xcl97rec.cxx (working copy) @@ -72,6 +72,11 @@ #include "docoptio.hxx" #include "patattr.hxx" #include "tabprotection.hxx" +//zhaosz_xml +#include +#include +#include +#include "oox/token/tokens.hxx" using namespace ::oox; @@ -82,11 +87,25 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::drawing::XShape; +//zhaosz_xml +using ::oox::drawingml::ShapeExport; +using ::oox::drawingml::DrawingML; +//zhaosz_xml + int XclExpObjList::mnDrawingMLCount=0; + int XclExpObjList::mnVmlCount=0; + +void XclExpObjList::ResetCounters() +{ + mnDrawingMLCount = 0; + mnVmlCount = 0; +} + // ============================================================================ XclExpObjList::XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx ) : XclExpRoot( rRoot ), + mnScTab( rRoot.GetCurrScTab() ),//zhaosz_xml mrEscherEx( rEscherEx ), pSolverContainer( 0 ) { @@ -114,6 +133,9 @@ Insert( pObj, LIST_APPEND ); sal_uInt16 nCnt = (sal_uInt16) Count(); pObj->SetId( nCnt ); + //zhaosz_xml + pObj->SetTab( mnScTab ); + return nCnt; } else @@ -144,7 +166,70 @@ if( pSolverContainer ) pSolverContainer->Save( rStrm ); } +//zhaosz_xml +static bool IsVmlObject( const XclObj& rObj ) +{ + switch( rObj.GetObjType() ) + { + case EXC_OBJTYPE_NOTE: + return true; + default: + return false; + } +} +static void SaveDrawingMLObjects( XclExpObjList& rList, XclExpXmlStream& rStrm, int& nDrawingMLCount ) +{ + + + sal_Int32 nDrawing = ++nDrawingMLCount; + OUString sId; + sax_fastparser::FSHelperPtr pDrawing = rStrm.CreateOutputStream( + XclXmlUtils::GetStreamName( "xl/", "drawings/drawing", nDrawing ), + XclXmlUtils::GetStreamName( "../", "drawings/drawing", nDrawing ), + rStrm.GetCurrentStream()->getOutputStream(), + "application/vnd.openxmlformats-officedocument.drawing+xml", + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", + &sId ); + + rStrm.GetCurrentStream()->singleElement( XML_drawing, + FSNS( XML_r, XML_id ), XclXmlUtils::ToOString( sId ).getStr(), + FSEND ); + + rStrm.PushStream( pDrawing ); + pDrawing->startElement( FSNS( XML_xdr, XML_wsDr ), + FSNS( XML_xmlns, XML_xdr ), "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing", + FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main", + FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + FSEND ); + + for ( XclObj* p = rList.First(); p; p = rList.Next() ) + { + // if( p->GetObjType() != 0 )//zhaosz_xml, obj is a group + if( IsVmlObject( *p ) || p->GetObjType()==0) + continue; + p->SaveXml( rStrm ); + } + + pDrawing->endElement( FSNS( XML_xdr, XML_wsDr ) ); + + rStrm.PopStream(); +} + +void XclExpObjList::SaveXml( XclExpXmlStream& rStrm ) +{ + + if( pSolverContainer ) + pSolverContainer->SaveXml( rStrm ); + + if( Count() == 0 ) + return; + + SaveDrawingMLObjects( *this, rStrm, mnDrawingMLCount ); + //SaveVmlObjects( *this, rStrm, mnVmlCount ); + +} + // --- class XclObj -------------------------------------------------- XclObj::XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher ) : @@ -672,6 +757,12 @@ XclObj( rObjMgr, EXC_OBJTYPE_UNKNOWN ) { } +//zhaosz_xml +XclObjAny::XclObjAny( XclExpObjectManager& rObjMgr,Reference< XShape > xShape ) : + XclObj( rObjMgr, EXC_OBJTYPE_UNKNOWN ), + mxShape( xShape) +{ +} XclObjAny::~XclObjAny() { @@ -693,7 +784,87 @@ // content of this record XclObj::Save( rStrm ); } +//zhaosz_xml +static const char* GetEditAs( XclObjAny& rObj ) +{ + if( const SdrObject* pShape = EscherEx::GetSdrObject( rObj.GetShape() ) ) + { + // OOXTODO: returning "twoCell" + switch( ScDrawLayer::GetAnchorType( *pShape ) ) + { + case SCA_CELL: return "oneCell"; + default: break; + } + } + return "absolute"; +} +void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& rShape, SCTAB nTab ) +{ + sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream(); + + awt::Point aTopLeft = rShape->getPosition(); + awt::Size aSize = rShape->getSize(); + Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height ); + ScRange aRange = rStrm.GetRoot().GetDoc().GetRange( nTab, aLocation ); + Rectangle aRangeRect = rStrm.GetRoot().GetDoc().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), + aRange.aEnd.Col()-1, aRange.aEnd.Row()-1, + nTab ); + + + pDrawing->startElement( FSNS( XML_xdr, XML_from ), + FSEND ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_col ), (sal_Int32) aRange.aStart.Col() ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_colOff ), + MM100toEMU( aLocation.Left() - aRangeRect.Left() ) ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_row ), (sal_Int32) aRange.aStart.Row() ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_rowOff ), + MM100toEMU( aLocation.Top() - aRangeRect.Top() ) ); + pDrawing->endElement( FSNS( XML_xdr, XML_from ) ); + + pDrawing->startElement( FSNS( XML_xdr, XML_to ), + FSEND ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_col ), (sal_Int32) aRange.aEnd.Col() ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_colOff ), + MM100toEMU( aLocation.Right() - aRangeRect.Right() ) ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_row ), (sal_Int32) aRange.aEnd.Row() ); + XclXmlUtils::WriteElement( pDrawing, FSNS( XML_xdr, XML_rowOff ), + MM100toEMU( aLocation.Bottom() - aRangeRect.Bottom() ) ); + pDrawing->endElement( FSNS( XML_xdr, XML_to ) ); +} + +void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const XclObjAny& rObj ) +{ + WriteFromTo( rStrm, rObj.GetShape(), rObj.GetTab() ); +} + +void XclObjAny::SaveXml( XclExpXmlStream& rStrm ) +{ + if( !mxShape.is() ) + return; + + sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream(); + + ShapeExport aDML( XML_xdr, pDrawing, NULL, &rStrm, DrawingML::DOCUMENT_XLSX ); + + pDrawing->startElement( FSNS( XML_xdr, XML_twoCellAnchor ), // OOXTODO: oneCellAnchor, absoluteAnchor + XML_editAs, GetEditAs( *this ), + FSEND ); + Reference< XPropertySet > xPropSet( mxShape, UNO_QUERY ); + if (xPropSet.is()) + { + WriteFromTo( rStrm, *this ); + //zhaosz_xml + aDML.WriteShape( mxShape ); + } + + pDrawing->singleElement( FSNS( XML_xdr, XML_clientData), + // OOXTODO: XML_fLocksWithSheet + // OOXTODO: XML_fPrintsWithSheet + FSEND ); + pDrawing->endElement( FSNS( XML_xdr, XML_twoCellAnchor ) ); +} + // --- class ExcBof8_Base -------------------------------------------- ExcBof8_Base::ExcBof8_Base()