diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/oox/export | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/oox/export')
-rw-r--r-- | include/oox/export/chartexport.hxx | 204 | ||||
-rw-r--r-- | include/oox/export/drawingml.hxx | 160 | ||||
-rw-r--r-- | include/oox/export/shapes.hxx | 170 | ||||
-rw-r--r-- | include/oox/export/utils.hxx | 59 | ||||
-rw-r--r-- | include/oox/export/vmlexport.hxx | 132 |
5 files changed, 725 insertions, 0 deletions
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx new file mode 100644 index 000000000000..10fc8922dc4a --- /dev/null +++ b/include/oox/export/chartexport.hxx @@ -0,0 +1,204 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _OOX_EXPORT_CHART_HXX_ +#define _OOX_EXPORT_CHART_HXX_ + +#include <oox/dllapi.h> +#include <com/sun/star/uno/XReference.hpp> +#include <oox/export/drawingml.hxx> +#include <oox/token/tokens.hxx> +#include <sax/fshelper.hxx> +#include <vcl/mapmod.hxx> +#include <boost/unordered_map.hpp> +#include <map> + +namespace com { namespace sun { namespace star { + namespace chart { + class XDiagram; + class XChartDocument; + class XChartDataArray; + struct ChartSeriesAddress; + } + namespace chart2 { + class XDiagram; + class XChartDocument; + class XDataSeries; + class XChartType; + namespace data + { + class XDataProvider; + class XDataSequence; + } + } + namespace drawing { + class XShape; + class XShapes; + } + namespace task { + class XStatusIndicator; + } + namespace frame { + class XModel; + } +}}} + +namespace oox { namespace drawingml { + +const sal_Int32 AXIS_PRIMARY_X = 1; +const sal_Int32 AXIS_PRIMARY_Y = 2; +const sal_Int32 AXIS_PRIMARY_Z = 3; +const sal_Int32 AXIS_SECONDARY_X = 4; +const sal_Int32 AXIS_SECONDARY_Y = 5; + +struct AxisIdPair{ + sal_Int32 nAxisType; + sal_Int32 nAxisId; + sal_Int32 nCrossAx; + + AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {} +}; + +class OOX_DLLPUBLIC ChartExport : public DrawingML { + +public: + // first: data sequence for label, second: data sequence for values. + typedef ::std::vector< AxisIdPair > AxisVector; + +private: + sal_Int32 mnXmlNamespace; + Fraction maFraction; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel; + com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram; + com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram; + + OUString msTableName; + OUStringBuffer msStringBuffer; + OUString msString; + + // members filled by InitRangeSegmentationProperties (retrieved from DataProvider) + sal_Bool mbHasSeriesLabels; + sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false + sal_Bool mbRowSourceColumns; + OUString msChartAddress; + OUString msTableNumberList; + ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping; + + //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues; + + AxisVector maAxes; + sal_Bool mbHasXAxis; + sal_Bool mbHasYAxis; + sal_Bool mbHasZAxis; + sal_Bool mbHasSecondaryXAxis; + sal_Bool mbHasSecondaryYAxis; + sal_Bool mbIs3DChart; + + +private: + sal_Int32 getChartType( + ); + + OUString parseFormula( const OUString& rRange ); + void InitPlotArea(); + + void _ExportContent(); + void exportChartSpace( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument > rChartDoc, + sal_Bool bIncludeTable ); + void exportChart( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument > rChartDoc ); + void exportLegend( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument > rChartDoc ); + void exportTitle( com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape > xShape ); + void exportPlotArea( ); + + void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + void exportSuffaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType ); + + void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis ); + void exportCandleStickSeries( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq, + sal_Bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis ); + void exportSeriesText( + const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq ); + void exportSeriesCategory( + const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq ); + void exportSeriesValues( + const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val ); + void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet ); + void exportDataPoints( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties, + sal_Int32 nSeriesLength ); + void exportDataLabels( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties, + sal_Int32 nSeriesLength ); + void exportGrouping( sal_Bool isBar = sal_False ); + void exportMarker(); + void exportSmooth(); + void exportFirstSliceAng(); + + void exportAxes( ); + void exportAxis( AxisIdPair aAxisIdPair ); + void _exportAxis( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid, + sal_Int32 nAxisType, + const char* sAxisPos, + AxisIdPair aAxisIdPair ); + void exportAxesId( sal_Int32 nAttachedAxis ); + void exportView3D(); + sal_Bool isDeep3dChart(); + +public: + + ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ); + virtual ~ChartExport() {} + + sal_Int32 GetChartID( ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; } + + virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount ); + + void ExportContent(); + void InitRangeSegmentationProperties( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ); +}; + +}} + +#endif /* ndef _OOX_EXPORT_CHART_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx new file mode 100644 index 000000000000..fa13a49ea090 --- /dev/null +++ b/include/oox/export/drawingml.hxx @@ -0,0 +1,160 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _OOX_EXPORT_DRAWINGML_HXX_ +#define _OOX_EXPORT_DRAWINGML_HXX_ + +#include <oox/dllapi.h> +#include <sax/fshelper.hxx> +#include <rtl/strbuf.hxx> +#include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/uno/XReference.hpp> +#include <tools/poly.hxx> +#include <filter/msfilter/escherex.hxx> +#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY +#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000) +#endif + +class Graphic; +class String; + +namespace com { namespace sun { namespace star { +namespace beans { + class XPropertySet; + class XPropertyState; +} +namespace drawing { + class XShape; +} +namespace style { + struct LineSpacing; +} +namespace text { + class XTextContent; + class XTextRange; +} +namespace io { + class XOutputStream; +} +}}} + +namespace oox { +namespace core { + class XmlFilterBase; +} + +namespace drawingml { + +class OOX_DLLPUBLIC DrawingML { +public: + enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX }; + +private: + static int mnImageCounter; + + /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC). + DocumentType meDocumentType; + +protected: + ::com::sun::star::uno::Any mAny; + ::sax_fastparser::FSHelperPtr mpFS; + ::oox::core::XmlFilterBase* mpFB; + + bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString aName ); + bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState, + String aName, ::com::sun::star::beans::PropertyState& eState ); + const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool& bIsField ); + + OUString WriteImage( const OUString& rURL ); + + const char* GetComponentDir(); + const char* GetRelationCompPrefix(); + +public: + DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {} + void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; } + ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; } + ::oox::core::XmlFilterBase* GetFB() { return mpFB; } + DocumentType GetDocumentType() { return meDocumentType; } + + OUString WriteImage( const Graphic &rGraphic ); + + void WriteColor( sal_uInt32 nColor ); + void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor ); + void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, sal_Bool bLineStart ); + void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); + + void WriteSolidFill( sal_uInt32 nColor ); + void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); + void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); + void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, sal_Int32 nXmlNamespace ); + void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName ); + void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& ); + void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); + void WriteStretch(); + void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing ); + + OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString& rURL, const Graphic *pGraphic=NULL ); + void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); + + void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape, + sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Bool bSuppressRotation = false ); + void WriteTransformation( const Rectangle& rRectangle, + sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 ); + + void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface ); + void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph ); + void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph ); + void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, + sal_Int16 nLevel ); + void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun ); + void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, sal_Bool bIsField ); + + void WritePresetShape( const char* pShape ); + void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp ); + void WritePolyPolygon( const PolyPolygon& rPolyPolygon ); + void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet ); + + static void ResetCounters(); + + void GetUUID( OStringBuffer& rBuffer ); + + static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc ); + + sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity ); + + static const char* GetAlignment( sal_Int32 nAlignment ); + + sax_fastparser::FSHelperPtr CreateOutputStream ( + const OUString& sFullStream, + const OUString& sRelativeStream, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation, + const char* sContentType, + const char* sRelationshipType, + OUString* pRelationshipId = NULL ); + +}; + +} +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx new file mode 100644 index 000000000000..39b4c0d9ec72 --- /dev/null +++ b/include/oox/export/shapes.hxx @@ -0,0 +1,170 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _OOX_EXPORT_SHAPES_HXX_ +#define _OOX_EXPORT_SHAPES_HXX_ + +#include <oox/dllapi.h> +#include <com/sun/star/uno/XReference.hpp> +#include <oox/export/drawingml.hxx> +#include <sax/fshelper.hxx> +#include <vcl/mapmod.hxx> +#include <boost/unordered_map.hpp> + +namespace com { namespace sun { namespace star { +namespace beans { + class XPropertySet; +} +namespace drawing { + class XShape; + class XShapes; +} +}}} + +namespace oox { namespace drawingml { + +class OOX_DLLPUBLIC ShapeExport : public DrawingML { + +private: + static int mnSpreadsheetCounter; + struct ShapeCheck + { + bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const + { + return s1 == s2; + } + }; + + struct ShapeHash + { + size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const; + }; + +public: + typedef boost::unordered_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap; + +protected: + sal_Int32 mnShapeIdMax, mnPictureIdMax; + + void WriteGraphicObjectShapePart( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const Graphic *pGraphic=NULL ); + +private: + sal_Int32 mnXmlNamespace; + Fraction maFraction; + MapMode maMapModeSrc, maMapModeDest; + + ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const; + + ShapeHashMap maShapeMap; + ShapeHashMap* mpShapeMap; + +public: + + ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ); + virtual ~ShapeExport() {} + + static sal_Bool NonEmptyText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface ); + + virtual ShapeExport& + WriteBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, sal_Bool bClosed ); + virtual ShapeExport& + WriteClosedBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteConnectorShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteCustomShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteEllipseShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteGraphicObjectShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteLineShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteNonVisualDrawingProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const char* sName ); + virtual ShapeExport& + WriteNonVisualProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteOpenBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteRectangleShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + + /** + * Write the DrawingML for a particular shape. + * + * <p>This is the member function you want. It performs the type lookup and + * invokes the appropriate corresponding Write*() method for the specific + * type.</p> + * + * <p>To write an XShape, XShape::getShapeType() is called to determine + * the shape type, and the corresponding method in this table is + * invoked:</p> + * + * <table> + * <tr><th>Shape Type</th><th>Method</th></tr> + * <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td> <td>ShapeExport::WriteClosedBezierShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.CustomShape</tt></td> <td>ShapeExport::WriteCustomShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.EllipseShape</tt></td> <td>ShapeExport::WriteEllipseShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.GraphicObjectShape</tt></td> <td>ShapeExport::WriteGraphicObjectShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.LineShape</tt></td> <td>ShapeExport::WriteLineShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td> <td>ShapeExport::WriteOpenBezierShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.RectangleShape</tt></td> <td>ShapeExport::WriteRectangleShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.TableShape</tt></td> <td>ShapeExport::WriteTableShape</td></tr> + * <tr><td><tt>com.sun.star.drawing.TextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr> + * <tr><td><tt>com.sun.star.presentation.DateTimeShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr> + * <tr><td><tt>com.sun.star.presentation.FooterShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr> + * <tr><td><tt>com.sun.star.presentation.HeaderShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr> + * <tr><td><tt>com.sun.star.presentation.NotesShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr> + * <tr><td><tt>com.sun.star.presentation.OutlinerShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr> + * <tr><td><tt>com.sun.star.presentation.SlideNumberShape</tt></td><td>ShapeExport::WriteTextShape</td></tr> + * <tr><td><tt>com.sun.star.presentation.TitleTextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr> + * </table> + * + * <p>If the shape type is not recognized, then + * <tt>ShapeExport::WriteUnknownShape</tt> is called.</p> + * + * @param xShape The shape to export as DrawingML. + * @return <tt>*this</tt> + */ + virtual ShapeExport& + WriteShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteTextBox( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface, sal_Int32 nXmlNamespace ); + virtual ShapeExport& + WriteTextShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteTableShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteOLE2Shape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& + WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + + void WriteTable( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape ); + + + 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 ); +}; + +}} + +#endif /* ndef _OOX_EXPORT_SHAPES_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx new file mode 100644 index 000000000000..04c3b3375742 --- /dev/null +++ b/include/oox/export/utils.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _OOX_EXPORT_UTILS_HXX_ +#define _OOX_EXPORT_UTILS_HXX_ + +#define I32S(x) OString::valueOf( (sal_Int32) x ).getStr() +#define I64S(x) OString::valueOf( (sal_Int64) x ).getStr() +#define IS(x) OString::valueOf( x ).getStr() +#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() + +#ifndef DBG +# if OSL_DEBUG_LEVEL > 0 +# define DBG(x) x +# else +# define DBG(x) +# endif +#endif + +// --------------------------------------------------------------------------------------------- + +static inline sal_Int64 PPTtoEMU( sal_Int32 nPPT ) +{ + return (sal_Int64)( (double)nPPT * 1587.5 ); +} + +// --------------------------------------------------------------------------------------------- + +static inline sal_Int64 MM100toEMU( sal_Int32 nMM100 ) +{ + return (sal_Int64)nMM100 * 360; +} + +// --------------------------------------------------------------------------------------------- + +static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips ) +{ + return sal_Int64( nTwips ) * 635; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx new file mode 100644 index 000000000000..54212a65bccf --- /dev/null +++ b/include/oox/export/vmlexport.hxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _OOX_EXPORT_VMLEXPORT_HXX_ +#define _OOX_EXPORT_VMLEXPORT_HXX_ + +#include <oox/dllapi.h> +#include <oox/export/drawingml.hxx> +#include <sax/fshelper.hxx> +#include <filter/msfilter/escherex.hxx> +#include <editeng/outlobj.hxx> + + +namespace oox { + +namespace vml { + +/// Interface to be implemented by the parent exporter that knows how to handle shape text. +class OOX_DLLPUBLIC VMLTextExport +{ +public: + virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0; + virtual oox::drawingml::DrawingML& GetDrawingML() = 0; +protected: + VMLTextExport() {} + virtual ~VMLTextExport() {} +}; + +class OOX_DLLPUBLIC VMLExport : public EscherEx +{ + /// Fast serializer to output the data + ::sax_fastparser::FSHelperPtr m_pSerializer; + + /// Parent exporter, used for text callback. + VMLTextExport* m_pTextExport; + + /// The object we're exporting. + const SdrObject* m_pSdrObject; + + /// Fill the shape attributes as they come. + ::sax_fastparser::FastAttributeList *m_pShapeAttrList; + + /// Remember the shape type. + sal_uInt32 m_nShapeType; + + /// Remember the shape flags. + sal_uInt32 m_nShapeFlags; + + /// Remember style, the most important shape attribute ;-) + OStringBuffer *m_pShapeStyle; + + /// Remember which shape types we had already written. + bool *m_pShapeTypeWritten; + +public: + VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = 0 ); + virtual ~VMLExport(); + + ::sax_fastparser::FSHelperPtr + GetFS() { return m_pSerializer; } + + /// Export the sdr object as VML. + /// + /// Call this when you need to export the object as VML. + sal_uInt32 AddSdrObject( const SdrObject& rObj ); + +protected: + /// Add an attribute to the generated <v:shape/> element. + /// + /// This should be called from within StartShape() to ensure that the + /// added attribute is preserved. + void AddShapeAttribute( sal_Int32 nAttribute, const OString& sValue ); + + using EscherEx::StartShape; + using EscherEx::EndShape; + + /// Start the shape for which we just collected the information. + /// + /// Returns the element's tag number, -1 means we wrote nothing. + virtual sal_Int32 StartShape(); + + /// End the shape. + /// + /// The parameter is just what we got from StartShape(). + virtual void EndShape( sal_Int32 nShapeElement ); + + virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); + +private: + + virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 ); + virtual void CloseContainer(); + + virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 ); + virtual void LeaveGroup(); + + virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0 ); + +private: + /// Create an OString representing the id from a numerical id. + static OString ShapeIdString( sal_uInt32 nId ); + + /// Add starting and ending point of a line to the m_pShapeAttrList. + void AddLineDimensions( const Rectangle& rRectangle ); + + /// Add position and size to the OStringBuffer. + void AddRectangleDimensions( OStringBuffer& rBuffer, const Rectangle& rRectangle ); +}; + +} // namespace vml + +} // namespace oox + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |