diff options
Diffstat (limited to 'oox/inc/oox/drawingml/chart')
27 files changed, 3310 insertions, 0 deletions
diff --git a/oox/inc/oox/drawingml/chart/axiscontext.hxx b/oox/inc/oox/drawingml/chart/axiscontext.hxx new file mode 100644 index 000000000000..13c550e881d4 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/axiscontext.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_AXISCONTEXT_HXX +#define OOX_DRAWINGML_CHART_AXISCONTEXT_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct AxisDispUnitsModel; + +/** Handler for a value axis display units context (c:dispUnits element). + */ +class AxisDispUnitsContext : public ContextBase< AxisDispUnitsModel > +{ +public: + explicit AxisDispUnitsContext( ::oox::core::ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel ); + virtual ~AxisDispUnitsContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct AxisModel; + +/** Base class for axis context handlers (c:catAx, c:dateAx, c:serAx, c:valAx + elements). + */ +class AxisContextBase : public ContextBase< AxisModel > +{ +public: + explicit AxisContextBase( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~AxisContextBase(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a category axis context (c:catAx element). + */ +class CatAxisContext : public AxisContextBase +{ +public: + explicit CatAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~CatAxisContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a date axis context (c:dateAx element). + */ +class DateAxisContext : public AxisContextBase +{ +public: + explicit DateAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~DateAxisContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a series axis context (c:serAx element). + */ +class SerAxisContext : public AxisContextBase +{ +public: + explicit SerAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~SerAxisContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a value axis context (c:valAx element). + */ +class ValAxisContext : public AxisContextBase +{ +public: + explicit ValAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~ValAxisContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/axisconverter.hxx b/oox/inc/oox/drawingml/chart/axisconverter.hxx new file mode 100644 index 000000000000..9e083f69d253 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/axisconverter.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_AXISCONVERTER_HXX +#define OOX_DRAWINGML_CHART_AXISCONVERTER_HXX + +#include "oox/drawingml/chart/converterbase.hxx" + +namespace com { namespace sun { namespace star { + namespace chart2 { class XAxis; } + namespace chart2 { class XCoordinateSystem; } +} } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct AxisModel; +class TypeGroupConverter; + +class AxisConverter : public ConverterBase< AxisModel > +{ +public: + explicit AxisConverter( + const ConverterRoot& rParent, + AxisModel& rModel ); + virtual ~AxisConverter(); + + /** Creates a chart2 axis and inserts it into the passed coordinate system. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem, + TypeGroupConverter& rTypeGroup, + const AxisModel* pCrossingAxis, + sal_Int32 nAxesSetIdx, + sal_Int32 nAxisIdx ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/axismodel.hxx b/oox/inc/oox/drawingml/chart/axismodel.hxx new file mode 100644 index 000000000000..0ce24d6ff515 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/axismodel.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_AXISMODEL_HXX +#define OOX_DRAWINGML_CHART_AXISMODEL_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/chart/titlemodel.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct AxisDispUnitsModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + ShapeRef mxShapeProp; /// Label frame formatting. + TextBodyRef mxTextProp; /// Label text formatting. + LayoutRef mxLayout; /// Layout/position of the axis units label. + TextRef mxText; /// Text source of the axis units label. + double mfCustomUnit; /// Custom unit size on value axis. + sal_Int32 mnBuiltInUnit; /// Built-in unit on value axis. + + explicit AxisDispUnitsModel(); + ~AxisDispUnitsModel(); +}; + +// ============================================================================ + +struct AxisModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< TitleModel > TitleRef; + typedef ModelRef< AxisDispUnitsModel > AxisDispUnitsRef; + + ShapeRef mxShapeProp; /// Axis line formatting. + TextBodyRef mxTextProp; /// Axis label text formatting. + TitleRef mxTitle; /// Axis title. + AxisDispUnitsRef mxDispUnits; /// Axis units label. + ShapeRef mxMajorGridLines; /// Major grid lines formatting. + ShapeRef mxMinorGridLines; /// Minor grid lines formatting. + NumberFormat maNumberFormat; /// Number format for axis tick labels. + OptValue< double > mofCrossesAt; /// Position on this axis where another axis crosses. + OptValue< double > mofMajorUnit; /// Unit for major tick marks on date/value axis. + OptValue< double > mofMinorUnit; /// Unit for minor tick marks on date/value axis. + OptValue< double > mofLogBase; /// Logarithmic base for logarithmic axes. + OptValue< double > mofMax; /// Maximum axis value. + OptValue< double > mofMin; /// Minimum axis value. + OptValue< sal_Int32 > monBaseTimeUnit; /// Base time unit shown on a date axis. + sal_Int32 mnAxisId; /// Unique axis identifier. + sal_Int32 mnAxisPos; /// Position of the axis (top/bottom/left/right). + sal_Int32 mnCrossAxisId; /// Identifier of a crossing axis. + sal_Int32 mnCrossBetween; /// This value axis crosses between or inside category. + sal_Int32 mnCrossMode; /// Mode this axis crosses another axis (min, max, auto). + sal_Int32 mnLabelAlign; /// Tick mark label alignment. + sal_Int32 mnLabelOffset; /// Tick mark label distance from axis. + sal_Int32 mnMajorTickMark; /// Major tick mark style. + sal_Int32 mnMajorTimeUnit; /// Time unit for major tick marks on date axis. + sal_Int32 mnMinorTickMark; /// Mainor tick mark style. + sal_Int32 mnMinorTimeUnit; /// Time unit for minor tick marks on date axis. + sal_Int32 mnOrientation; /// Axis orientation (value order min to max, or max to min). + sal_Int32 mnTickLabelPos; /// Position of tick mark labels relative to the axis. + sal_Int32 mnTickLabelSkip; /// Number of tick mark labels to skip. + sal_Int32 mnTickMarkSkip; /// Number of tick marks to skip. + sal_Int32 mnTypeId; /// Type identifier of this axis. + bool mbAuto; /// True = automatic selection of text/date axis type. + bool mbDeleted; /// True = axis has been deleted manually. + bool mbNoMultiLevel; /// True = no multi-level categories supported. + + explicit AxisModel( sal_Int32 nTypeId ); + ~AxisModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx new file mode 100644 index 000000000000..76ddeafddb80 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX +#define OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX + +#include "oox/core/fragmenthandler2.hxx" + +namespace oox { namespace drawingml { class Shape; } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +template< typename ModelType > +class ContextBase : public ::oox::core::ContextHandler2 +{ +public: + inline explicit ContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) : + ::oox::core::ContextHandler2( rParent ), mrModel( rModel ) {} + virtual ~ContextBase() {} + +protected: + ModelType& mrModel; +}; + +// ============================================================================ + +template< typename ModelType > +class FragmentBase : public ::oox::core::FragmentHandler2 +{ +public: + explicit FragmentBase( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, ModelType& rModel ) : + ::oox::core::FragmentHandler2( rFilter, rFragmentPath, false ), mrModel( rModel ) {} + virtual ~FragmentBase() {} + +protected: + ModelType& mrModel; +}; + +// ============================================================================ + +/** Help class for all contexts that have only the c:spPr child element. + */ +class ShapePrWrapperContext : public ContextBase< Shape > +{ +public: + explicit ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel ); + virtual ~ShapePrWrapperContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct LayoutModel; + +/** Handler for a chart layout context (c:layout element). + */ +class LayoutContext : public ContextBase< LayoutModel > +{ +public: + explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel ); + virtual ~LayoutContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/chartconverter.hxx b/oox/inc/oox/drawingml/chart/chartconverter.hxx new file mode 100644 index 000000000000..de8572ab168b --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartconverter.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX +#define OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <oox/dllapi.h> + +namespace com { namespace sun { namespace star { + namespace awt { struct Point; } + namespace awt { struct Size; } + namespace drawing { class XShapes; } + namespace chart2 { class XChartDocument; } + namespace chart2 { namespace data { class XDataProvider; } } + namespace chart2 { namespace data { class XDataSequence; } } +} } } + +namespace oox { namespace core { class XmlFilterBase; } } + +namespace oox { +namespace drawingml { +namespace chart { + +struct ChartSpaceModel; +struct DataSequenceModel; + +// ============================================================================ + +class OOX_DLLPUBLIC ChartConverter +{ +public: + explicit ChartConverter(); + virtual ~ChartConverter(); + + /** Converts the passed OOXML chart model to the passed chart2 document. + + @param rChartModel The filled MSOOXML chart model structure. + + @param rxChartDoc The UNO chart document model to be initialized. + + @param rxExternalPage If null, all embedded shapes will be inserted + into the internal drawing page of the chart document. If not null, + all embedded shapes will be inserted into this shapes collection. + + @param rChartPos The position of the chart shape in its drawing page, + in 1/100 mm. Will be used only, if parameter rxExternalPage is not + null, for correct positioning of the embedded shapes in the + external drawing page. + + @param rChartSize The size of the chart shape in 1/100 mm. Needed for + calculation of position and size of the chart elements (diagram, + titles, legend, etc.) and embedded shapes. + */ + void convertFromModel( + ::oox::core::XmlFilterBase& rFilter, + ChartSpaceModel& rChartModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage, + const ::com::sun::star::awt::Point& rChartPos, + const ::com::sun::star::awt::Size& rChartSize ); + + /** Creates an internal data provider. Derived classes may override this + function to create an external data provider. */ + virtual void createDataProvider( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc ); + + /** Creates a data sequence from a formula. Dummy implementation. Derived + classes have to override this function to actually parse the formula. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > + createDataSequence( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >& rxDataProvider, + const DataSequenceModel& rDataSeq ); + +private: + ChartConverter( const ChartConverter& ); + ChartConverter& operator=( const ChartConverter& ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx new file mode 100644 index 000000000000..3ff545cda295 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX +#define OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX + +#include "oox/core/fragmenthandler2.hxx" +#include "oox/drawingml/shape.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +/** Relative shape position in a chart object. */ +struct AnchorPosModel +{ + double mfX; /// X coordinate relative to chart object (0.0 to 1.0). + double mfY; /// Y coordinate relative to chart object (0.0 to 1.0). + + inline explicit AnchorPosModel() : mfX( -1.0 ), mfY( -1.0 ) {} + inline bool isValid() const { return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); } +}; + +// ---------------------------------------------------------------------------- + +/** Absolute shape size in a chart object (in EMUs). */ +struct AnchorSizeModel : public EmuSize +{ + inline explicit AnchorSizeModel() : EmuSize( -1, -1 ) {} + inline bool isValid() const { return (Width >= 0) && (Height >= 0); } +}; + +// ============================================================================ + +/** Contains the position of a shape in the chart object. Supports different + shape anchor modes (absolute, relative). + */ +class ShapeAnchor +{ +public: + explicit ShapeAnchor( bool bRelSize ); + + /** Imports the absolute anchor size from the cdr:ext element. */ + void importExt( const AttributeList& rAttribs ); + /** Sets an the relative anchor position from the cdr:from or cdr:to element. */ + void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue ); + + /** Calculates the resulting shape anchor in EMUs. */ + ::com::sun::star::awt::Rectangle + calcEmuLocation( const EmuRectangle& rEmuChartRect ) const; + +private: + AnchorPosModel maFrom; /// Top-left position relative to chart object. + AnchorPosModel maTo; /// Bottom-right position relative to chart object. + AnchorSizeModel maSize; /// Shape size, if anchor has absolute size. + bool mbRelSize; /// True = relative size, false = absolute size. +}; + +typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef; + +// ============================================================================ + +/** Handler for a chart drawing fragment (c:userShapes root element). + */ +class ChartDrawingFragment : public ::oox::core::FragmentHandler2 +{ +public: + explicit ChartDrawingFragment( + ::oox::core::XmlFilterBase& rFilter, + const ::rtl::OUString& rFragmentPath, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxDrawPage, + const ::com::sun::star::awt::Size& rChartSize, + const ::com::sun::star::awt::Point& rShapesOffset, + bool bOleSupport ); + virtual ~ChartDrawingFragment(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + virtual void onEndElement(); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > + mxDrawPage; /// Drawing page of this sheet. + ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape. + ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape. + EmuRectangle maEmuChartRect; /// Position and size of the chart object for embedded shapes (in EMUs). + bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page. +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx new file mode 100644 index 000000000000..91e622552aa7 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX +#define OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX + +#include "oox/drawingml/chart/converterbase.hxx" + +namespace com { namespace sun { namespace star { + namespace drawing { class XShapes; } +} } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct ChartSpaceModel; + +class ChartSpaceConverter : public ConverterBase< ChartSpaceModel > +{ +public: + explicit ChartSpaceConverter( const ConverterRoot& rParent, ChartSpaceModel& rModel ); + virtual ~ChartSpaceConverter(); + + /** Converts the contained OOXML chart model to a chart2 document. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage, + const ::com::sun::star::awt::Point& rChartPos ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/chartspacefragment.hxx b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx new file mode 100644 index 000000000000..e51c1c1fcc1b --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX +#define OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct ChartSpaceModel; + +/** Handler for a chart fragment (c:chartSpace root element). + */ +class ChartSpaceFragment : public FragmentBase< ChartSpaceModel > +{ +public: + explicit ChartSpaceFragment( + ::oox::core::XmlFilterBase& rFilter, + const ::rtl::OUString& rFragmentPath, + ChartSpaceModel& rModel ); + virtual ~ChartSpaceFragment(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx new file mode 100644 index 000000000000..79390c8b8022 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX +#define OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/chart/plotareamodel.hxx" +#include "oox/drawingml/chart/titlemodel.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct ChartSpaceModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< PlotAreaModel > PlotAreaRef; + typedef ModelRef< WallFloorModel > WallFloorRef; + typedef ModelRef< View3DModel > View3DRef; + typedef ModelRef< TitleModel > TitleRef; + typedef ModelRef< LegendModel > LegendRef; + + ShapeRef mxShapeProp; /// Chart frame formatting. + TextBodyRef mxTextProp; /// Global chart text formatting. + PlotAreaRef mxPlotArea; /// Plot area of the chart. + WallFloorRef mxFloor; /// Floor formatting in 3D charts. + WallFloorRef mxBackWall; /// Back wall formatting in 3D charts. + WallFloorRef mxSideWall; /// Side wall formatting in 3D charts. + View3DRef mxView3D; /// 3D settings. + TitleRef mxTitle; /// Chart main title. + LegendRef mxLegend; /// Chart legend. + ::rtl::OUString maDrawingPath; /// Path to drawing fragment with embedded shapes. + sal_Int32 mnDispBlanksAs; /// Mode how to display blank values. + sal_Int32 mnStyle; /// Index to default formatting. + bool mbAutoTitleDel; /// True = automatic title deleted manually. + bool mbPlotVisOnly; /// True = plot visible cells in a sheet only. + bool mbShowLabelsOverMax;/// True = show labels over chart maximum. + bool mbPivotChart; /// True = pivot chart. + + explicit ChartSpaceModel(); + ~ChartSpaceModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx new file mode 100644 index 000000000000..12c6c2294b32 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_CONVERTERBASE_HXX +#define OOX_DRAWINGML_CHART_CONVERTERBASE_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" +#include "oox/drawingml/chart/objectformatter.hxx" + +namespace com { namespace sun { namespace star { + namespace awt { struct Rectangle; } + namespace awt { struct Size; } + namespace lang { class XMultiServiceFactory; } + namespace chart2 { class XChartDocument; } + namespace chart2 { class XTitle; } + namespace drawing { class XShape; } +} } } + +namespace oox { namespace core { + class XmlFilterBase; +} } + +namespace oox { +namespace drawingml { +namespace chart { + +class ChartConverter; +struct ChartSpaceModel; +struct ConverterData; + +// ============================================================================ + +const sal_Int32 API_PRIM_AXESSET = 0; +const sal_Int32 API_SECN_AXESSET = 1; + +const sal_Int32 API_X_AXIS = 0; +const sal_Int32 API_Y_AXIS = 1; +const sal_Int32 API_Z_AXIS = 2; + +// ============================================================================ + +class ConverterRoot +{ +public: + explicit ConverterRoot( + ::oox::core::XmlFilterBase& rFilter, + ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, + const ::com::sun::star::awt::Size& rChartSize ); + virtual ~ConverterRoot(); + + /** Creates an instance for the passed service name, using the process service factory. */ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + createInstance( const ::rtl::OUString& rServiceName ) const; + +protected: + /** Returns the filter object of the imported/exported document. */ + ::oox::core::XmlFilterBase& getFilter() const; + /** Returns the chart converter. */ + ChartConverter& getChartConverter() const; + /** Returns the API chart document model. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > + getChartDocument() const; + /** Returns the position and size of the chart shape in 1/100 mm. */ + const ::com::sun::star::awt::Size& getChartSize() const; + /** Returns the object formatter. */ + ObjectFormatter& getFormatter() const; + + /** Registers a title object and its layout data, needed for conversion of + the title position using the old Chart1 API. */ + void registerTitleLayout( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >& rxTitle, + const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType, + sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ); + /** Converts the positions of the main title and all axis titles. */ + void convertTitlePositions(); + +private: + ::boost::shared_ptr< ConverterData > mxData; +}; + +// ============================================================================ + +/** Base class of all converter classes. Holds a reference to a model structure + of the specified type. + */ +template< typename ModelType > +class ConverterBase : public ConverterRoot +{ +public: + inline const ModelType& getModel() const { return mrModel; } + +protected: + inline explicit ConverterBase( const ConverterRoot& rParent, ModelType& rModel ) : + ConverterRoot( rParent ), mrModel( rModel ) {} + virtual ~ConverterBase() {} + +protected: + ModelType& mrModel; +}; + +// ============================================================================ + +/** A layout converter calculates positions and sizes for various chart objects. + */ +class LayoutConverter : public ConverterBase< LayoutModel > +{ +public: + explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel ); + virtual ~LayoutConverter(); + + /** Tries to calculate the absolute position and size from the contained + OOXML layout model. Returns true, if returned rectangle is valid. */ + bool calcAbsRectangle( ::com::sun::star::awt::Rectangle& orRect ) const; + + /** Tries to set the position and size from the contained OOXML layout model. + Returns true, if a manual position and size could be calculated. */ + bool convertFromModel( PropertySet& rPropSet ); + + /** Tries to set the position from the contained OOXML layout model. + Returns true, if a manual position could be calculated. */ + bool convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, + double fRotationAngle ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx new file mode 100644 index 000000000000..1cffa32e382a --- /dev/null +++ b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX +#define OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct DataSequenceModel; + +typedef ContextBase< DataSequenceModel > DataSequenceContextBase; + +// ============================================================================ + +/** Handler for a double sequence context (c:numLit, c:numRef elements). + */ +class DoubleSequenceContext : public DataSequenceContextBase +{ +public: + explicit DoubleSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel ); + virtual ~DoubleSequenceContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + +private: + sal_Int32 mnPtIndex; /// Current data point index. +}; + +// ============================================================================ + +/** Handler for a string sequence context (c:multiLvlStrRef, c:strLit, + c:strRef elements). + */ +class StringSequenceContext : public DataSequenceContextBase +{ +public: + explicit StringSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel ); + virtual ~StringSequenceContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); + +private: + sal_Int32 mnPtIndex; /// Current data point index. +}; + +// ============================================================================ + +struct DataSourceModel; + +/** Handler for a data source context (c:bubbleSize, c:cat, c:minus, c:plus, + c:val, c:xVal, c:yVal elements). + */ +class DataSourceContext : public ContextBase< DataSourceModel > +{ +public: + explicit DataSourceContext( ::oox::core::ContextHandler2Helper& rParent, DataSourceModel& rModel ); + virtual ~DataSourceContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/datasourceconverter.hxx b/oox/inc/oox/drawingml/chart/datasourceconverter.hxx new file mode 100644 index 000000000000..9d16f4e85882 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/datasourceconverter.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX +#define OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX + +#include "oox/drawingml/chart/converterbase.hxx" + +namespace com { namespace sun { namespace star { + namespace chart2 { namespace data { class XDataSequence; } } +} } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct DataSequenceModel; + +class DataSequenceConverter : public ConverterBase< DataSequenceModel > +{ +public: + explicit DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel ); + virtual ~DataSequenceConverter(); + + /** Creates a data sequence object from the contained formula link. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > + createDataSequence( const ::rtl::OUString& rRole ); +}; + +// ============================================================================ + +struct DataSourceModel; + +class DataSourceConverter : public ConverterBase< DataSourceModel > +{ +public: + explicit DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel ); + virtual ~DataSourceConverter(); + + /** Creates a data sequence object from the contained series data. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > + createDataSequence( const ::rtl::OUString& rRole ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/datasourcemodel.hxx b/oox/inc/oox/drawingml/chart/datasourcemodel.hxx new file mode 100644 index 000000000000..04e79b831049 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/datasourcemodel.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX +#define OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX + +#include <com/sun/star/uno/Any.hxx> +#include "oox/drawingml/chart/modelbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct DataSequenceModel +{ + typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > AnyMap; + + AnyMap maData; /// Map of values, indexed by point identifier. + ::rtl::OUString maFormula; /// Formula reference, e.g. into a spreadsheet. + ::rtl::OUString maFormatCode; /// Number format for double values. + sal_Int32 mnPointCount; /// Number of points in this series source. + + explicit DataSequenceModel(); + ~DataSequenceModel(); +}; + +// ============================================================================ + +struct DataSourceModel +{ + typedef ModelRef< DataSequenceModel > DataSequenceRef; + + DataSequenceRef mxDataSeq; /// The data sequence or formula link of this source. + + explicit DataSourceModel(); + ~DataSourceModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/modelbase.hxx b/oox/inc/oox/drawingml/chart/modelbase.hxx new file mode 100644 index 000000000000..278a8af9fed3 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/modelbase.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_MODELBASE_HXX +#define OOX_DRAWINGML_CHART_MODELBASE_HXX + +#include "oox/helper/helper.hxx" +#include "oox/helper/refmap.hxx" +#include "oox/helper/refvector.hxx" + +namespace oox { class AttributeList; } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +template< typename ModelType > +class ModelRef : public ::boost::shared_ptr< ModelType > +{ +public: + inline explicit ModelRef() {} + inline ModelRef( const ::boost::shared_ptr< ModelType >& rxModel ) : ::boost::shared_ptr< ModelType >( rxModel ) {} + inline ~ModelRef() {} + + inline bool is() const { return this->get() != 0; } + + inline ModelType& create() { reset( new ModelType ); return **this; } + template< typename Param1Type > + inline ModelType& create( const Param1Type& rParam1 ) { reset( new ModelType( rParam1 ) ); return **this; } + + inline ModelType& getOrCreate() { if( !*this ) reset( new ModelType ); return **this; } + template< typename Param1Type > + inline ModelType& getOrCreate( const Param1Type& rParam1 ) { if( !*this ) reset( new ModelType( rParam1 ) ); return **this; } +}; + +// ============================================================================ + +template< typename ModelType > +class ModelVector : public RefVector< ModelType > +{ +public: + typedef typename RefVector< ModelType >::value_type value_type; + typedef typename RefVector< ModelType >::size_type size_type; + + inline explicit ModelVector() {} + inline ~ModelVector() {} + + inline ModelType& create() { return append( new ModelType ); } + template< typename Param1Type > + inline ModelType& create( const Param1Type& rParam1 ) { return append( new ModelType( rParam1 ) ); } + +private: + inline ModelType& append( ModelType* pModel ) { this->push_back( value_type( pModel ) ); return *pModel; } +}; + +// ============================================================================ + +template< typename KeyType, typename ModelType > +class ModelMap : public RefMap< KeyType, ModelType > +{ +public: + typedef typename RefMap< KeyType, ModelType >::key_type key_type; + typedef typename RefMap< KeyType, ModelType >::mapped_type mapped_type; + typedef typename RefMap< KeyType, ModelType >::value_type value_type; + + inline explicit ModelMap() {} + inline ~ModelMap() {} + + inline ModelType& create( KeyType eKey ) { return insert( eKey, new ModelType ); } + template< typename Param1Type > + inline ModelType& create( KeyType eKey, const Param1Type& rParam1 ) { return insert( eKey, new ModelType( rParam1 ) ); } + +private: + inline ModelType& insert( KeyType eKey, ModelType* pModel ) { (*this)[ eKey ].reset( pModel ); return *pModel; } +}; + +// ============================================================================ + +struct NumberFormat +{ + ::rtl::OUString maFormatCode; /// Number format code. + bool mbSourceLinked; /// True = number format linked to source data. + + explicit NumberFormat(); + + void setAttributes( const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct LayoutModel +{ + double mfX; /// Left position of this object. + double mfY; /// Top position of this object. + double mfW; /// Width of this object. + double mfH; /// Height of this object. + sal_Int32 mnXMode; /// Mode for left position. + sal_Int32 mnYMode; /// Mode for top position. + sal_Int32 mnWMode; /// Mode for width. + sal_Int32 mnHMode; /// Mode for height. + sal_Int32 mnTarget; /// Layout target for plot area. + bool mbAutoLayout; /// True = automatic positioning. + + explicit LayoutModel(); + ~LayoutModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/objectformatter.hxx b/oox/inc/oox/drawingml/chart/objectformatter.hxx new file mode 100644 index 000000000000..c35cd66f65e1 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/objectformatter.hxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX +#define OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX + +#include "oox/helper/propertyset.hxx" +#include "oox/drawingml/drawingmltypes.hxx" +#include "oox/drawingml/chart/modelbase.hxx" + +namespace com { namespace sun { namespace star { + namespace chart2 { class XChartDocument; } +} } } + +namespace oox { namespace core { class XmlFilterBase; } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +/** Enumerates different object types for specific automatic formatting behaviour. */ +enum ObjectType +{ + OBJECTTYPE_CHARTSPACE, /// Chart background. + OBJECTTYPE_CHARTTITLE, /// Chart title. + OBJECTTYPE_LEGEND, /// Legend. + OBJECTTYPE_PLOTAREA2D, /// Plot area containing axes and data series in 2D charts. + OBJECTTYPE_PLOTAREA3D, /// Plot area containing axes and data series in 3D charts. + OBJECTTYPE_WALL, /// Background and side wall in 3D charts. + OBJECTTYPE_FLOOR, /// Floor in 3D charts. + OBJECTTYPE_AXIS, /// Axis line, labels, tick marks. + OBJECTTYPE_AXISTITLE, /// Axis title. + OBJECTTYPE_AXISUNIT, /// Axis unit label. + OBJECTTYPE_MAJORGRIDLINE, /// Axis major grid line. + OBJECTTYPE_MINORGRIDLINE, /// Axis minor grid line. + OBJECTTYPE_LINEARSERIES2D, /// Linear series in 2D line/radarline/scatter charts. + OBJECTTYPE_FILLEDSERIES2D, /// Filled series in 2D bar/area/radararea/bubble/pie/surface charts. + OBJECTTYPE_FILLEDSERIES3D, /// Filled series in 3D charts. + OBJECTTYPE_DATALABEL, /// Labels for data points. + OBJECTTYPE_TRENDLINE, /// Data series trend line. + OBJECTTYPE_TRENDLINELABEL, /// Trend line label. + OBJECTTYPE_ERRORBAR, /// Data series error indicator line. + OBJECTTYPE_SERLINE, /// Data point connector lines. + OBJECTTYPE_LEADERLINE, /// Leader lines between pie slice and data label. + OBJECTTYPE_DROPLINE, /// Drop lines between data points and X axis. + OBJECTTYPE_HILOLINE, /// High/low lines in line/stock charts. + OBJECTTYPE_UPBAR, /// Up-bar in line/stock charts. + OBJECTTYPE_DOWNBAR, /// Down-bar in line/stock charts. + OBJECTTYPE_DATATABLE /// Data table. +}; + +// ============================================================================ + +struct ChartSpaceModel; +struct ObjectFormatterData; +struct PictureOptionsModel; + +class ObjectFormatter +{ +public: + explicit ObjectFormatter( + const ::oox::core::XmlFilterBase& rFilter, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, + const ChartSpaceModel& rChartSpace ); + ~ObjectFormatter(); + + /** Sets the maximum series index used for color cycling/fading. */ + void setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx ); + /** Returns the current maximum series index used for color cycling/fading. */ + sal_Int32 getMaxSeriesIndex() const; + + /** Sets frame formatting properties to the passed property set. */ + void convertFrameFormatting( + PropertySet& rPropSet, + const ModelRef< Shape >& rxShapeProp, + ObjectType eObjType, + sal_Int32 nSeriesIdx = -1 ); + + /** Sets frame formatting properties to the passed property set. */ + void convertFrameFormatting( + PropertySet& rPropSet, + const ModelRef< Shape >& rxShapeProp, + const PictureOptionsModel& rPicOptions, + ObjectType eObjType, + sal_Int32 nSeriesIdx = -1 ); + + /** Sets text formatting properties to the passed property set. */ + void convertTextFormatting( + PropertySet& rPropSet, + const ModelRef< TextBody >& rxTextProp, + ObjectType eObjType ); + + /** Sets frame/text formatting properties to the passed property set. */ + void convertFormatting( + PropertySet& rPropSet, + const ModelRef< Shape >& rxShapeProp, + const ModelRef< TextBody >& rxTextProp, + ObjectType eObjType ); + + /** Sets text formatting properties to the passed property set. */ + void convertTextFormatting( + PropertySet& rPropSet, + const TextCharacterProperties& rTextProps, + ObjectType eObjType ); + + /** Sets text rotation properties to the passed property set. */ + void convertTextRotation( + PropertySet& rPropSet, + const ModelRef< TextBody >& rxTextProp, + bool bSupportsStacked ); + + /** Sets number format properties to the passed property set. */ + void convertNumberFormat( + PropertySet& rPropSet, + const NumberFormat& rNumberFormat, + bool bPercentFormat = false ); + + /** Sets automatic line properties to the passed property set. */ + void convertAutomaticLine( + PropertySet& rPropSet, + ObjectType eObjType, + sal_Int32 nSeriesIdx = -1 ); + + /** Sets automatic fill properties to the passed property set. */ + void convertAutomaticFill( + PropertySet& rPropSet, + ObjectType eObjType, + sal_Int32 nSeriesIdx = -1 ); + + /** Returns true, if the passed shape properties have automatic line mode. */ + static bool isAutomaticLine( const ModelRef< Shape >& rxShapeProp ); + /** Returns true, if the passed shape properties have automatic fill mode. */ + static bool isAutomaticFill( const ModelRef< Shape >& rxShapeProp ); + +private: + ::boost::shared_ptr< ObjectFormatterData > mxData; +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/plotareacontext.hxx b/oox/inc/oox/drawingml/chart/plotareacontext.hxx new file mode 100644 index 000000000000..5d3358c1147c --- /dev/null +++ b/oox/inc/oox/drawingml/chart/plotareacontext.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX +#define OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct View3DModel; + +/** Handler for a chart plot area context (c:plotArea element). + */ +class View3DContext : public ContextBase< View3DModel > +{ +public: + explicit View3DContext( ::oox::core::ContextHandler2Helper& rParent, View3DModel& rModel ); + virtual ~View3DContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct WallFloorModel; + +/** Handler for a chart wall/floor context (c:backWall, c:floor, c:sideWall + elements). + */ +class WallFloorContext : public ContextBase< WallFloorModel > +{ +public: + explicit WallFloorContext( ::oox::core::ContextHandler2Helper& rParent, WallFloorModel& rModel ); + virtual ~WallFloorContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct PlotAreaModel; + +/** Handler for a chart plot area context (c:plotArea element). + */ +class PlotAreaContext : public ContextBase< PlotAreaModel > +{ +public: + explicit PlotAreaContext( ::oox::core::ContextHandler2Helper& rParent, PlotAreaModel& rModel ); + virtual ~PlotAreaContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx new file mode 100644 index 000000000000..9089c0180024 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX +#define OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX + +#include "oox/drawingml/chart/converterbase.hxx" + +namespace com { namespace sun { namespace star { + namespace chart2 { class XDiagram; } +} } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct View3DModel; +class TypeGroupConverter; + +class View3DConverter : public ConverterBase< View3DModel > +{ +public: + explicit View3DConverter( const ConverterRoot& rParent, View3DModel& rModel ); + virtual ~View3DConverter(); + + /** Converts the OOXML plot area model to a chart2 diagram. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram, + TypeGroupConverter& rTypeGroup ); +}; + +// ============================================================================ + +struct WallFloorModel; + +class WallFloorConverter : public ConverterBase< WallFloorModel > +{ +public: + explicit WallFloorConverter( const ConverterRoot& rParent, WallFloorModel& rModel ); + virtual ~WallFloorConverter(); + + /** Converts the OOXML wall/floor model to a chart2 diagram. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram, + ObjectType eObjType ); +}; + +// ============================================================================ + +struct PlotAreaModel; + +class PlotAreaConverter : public ConverterBase< PlotAreaModel > +{ +public: + explicit PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel ); + virtual ~PlotAreaConverter(); + + /** Converts the OOXML plot area model to a chart2 diagram. */ + void convertFromModel( View3DModel& rView3DModel ); + /** Converts the manual plot area position and size, if set. */ + void convertPositionFromModel(); + + /** Returns the automatic chart title if the chart contains only one series. */ + inline const ::rtl::OUString& getAutomaticTitle() const { return maAutoTitle; } + /** Returns true, if the chart is three-dimensional. */ + inline bool is3dChart() const { return mb3dChart; } + /** Returns true, if chart type supports wall and floor format in 3D mode. */ + inline bool isWall3dChart() const { return mbWall3dChart; } + +private: + ::rtl::OUString maAutoTitle; + bool mb3dChart; + bool mbWall3dChart; + bool mbPieChart; +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/plotareamodel.hxx b/oox/inc/oox/drawingml/chart/plotareamodel.hxx new file mode 100644 index 000000000000..ef29a72f4b09 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/plotareamodel.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX +#define OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/chart/axismodel.hxx" +#include "oox/drawingml/chart/seriesmodel.hxx" +#include "oox/drawingml/chart/typegroupmodel.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct View3DModel +{ + OptValue< sal_Int32 > monHeightPercent; /// Height of the 3D view, relative to chart width. + OptValue< sal_Int32 > monRotationX; /// Horizontal rotation in degrees. + OptValue< sal_Int32 > monRotationY; /// Vertical rotation in degrees. + sal_Int32 mnDepthPercent; /// Depth of the 3D view, relative to chart width. + sal_Int32 mnPerspective; /// Eye distance to the 3D objects. + bool mbRightAngled; /// True = right-angled axes in 3D view. + + explicit View3DModel(); + ~View3DModel(); +}; + +// ============================================================================ + +struct WallFloorModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< PictureOptionsModel > PictureOptionsRef; + + ShapeRef mxShapeProp; /// Wall/floor frame formatting. + PictureOptionsRef mxPicOptions; /// Fill bitmap settings. + + explicit WallFloorModel(); + ~WallFloorModel(); +}; + +// ============================================================================ + +struct PlotAreaModel +{ + typedef ModelVector< TypeGroupModel > TypeGroupVector; + typedef ModelVector< AxisModel > AxisVector; + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< LayoutModel > LayoutRef; + + TypeGroupVector maTypeGroups; /// All chart type groups contained in the chart. + AxisVector maAxes; /// All axes contained in the chart. + ShapeRef mxShapeProp; /// Plot area frame formatting. + LayoutRef mxLayout; /// Layout/position of the plot area. + + explicit PlotAreaModel(); + ~PlotAreaModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/seriescontext.hxx b/oox/inc/oox/drawingml/chart/seriescontext.hxx new file mode 100644 index 000000000000..ef50bc94866c --- /dev/null +++ b/oox/inc/oox/drawingml/chart/seriescontext.hxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX +#define OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct DataLabelModel; + +/** Handler for a chart data point label context (c:dLbl element). + */ +class DataLabelContext : public ContextBase< DataLabelModel > +{ +public: + explicit DataLabelContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelModel& rModel ); + virtual ~DataLabelContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); +}; + +// ============================================================================ + +struct DataLabelsModel; + +/** Handler for a chart data point label context (c:dLbl element). + */ +class DataLabelsContext : public ContextBase< DataLabelsModel > +{ +public: + explicit DataLabelsContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelsModel& rModel ); + virtual ~DataLabelsContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); +}; + +// ============================================================================ + +struct PictureOptionsModel; + +/** Handler for fill bitmap settings (c:pictureOptions element). + */ +class PictureOptionsContext : public ContextBase< PictureOptionsModel > +{ +public: + explicit PictureOptionsContext( ::oox::core::ContextHandler2Helper& rParent, PictureOptionsModel& rModel ); + virtual ~PictureOptionsContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct ErrorBarModel; + +/** Handler for a series error bar context (c:errBars element). + */ +class ErrorBarContext : public ContextBase< ErrorBarModel > +{ +public: + explicit ErrorBarContext( ::oox::core::ContextHandler2Helper& rParent, ErrorBarModel& rModel ); + virtual ~ErrorBarContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct TrendlineLabelModel; + +/** Handler for a series trendline label context (c:trendlineLbl element). + */ +class TrendlineLabelContext : public ContextBase< TrendlineLabelModel > +{ +public: + explicit TrendlineLabelContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineLabelModel& rModel ); + virtual ~TrendlineLabelContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct TrendlineModel; + +/** Handler for a series trendline context (c:trendline element). + */ +class TrendlineContext : public ContextBase< TrendlineModel > +{ +public: + explicit TrendlineContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineModel& rModel ); + virtual ~TrendlineContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); +}; + +// ============================================================================ + +struct DataPointModel; + +/** Handler for a chart data point context (c:dPt element). + */ +class DataPointContext : public ContextBase< DataPointModel > +{ +public: + explicit DataPointContext( ::oox::core::ContextHandler2Helper& rParent, DataPointModel& rModel ); + virtual ~DataPointContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct SeriesModel; + +/** Handler base class for chart data series contexts (c:ser element). + */ +class SeriesContextBase : public ContextBase< SeriesModel > +{ +public: + explicit SeriesContextBase( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~SeriesContextBase(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for area chart types (c:ser element). + */ +class AreaSeriesContext : public SeriesContextBase +{ +public: + explicit AreaSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~AreaSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for bar chart types (c:ser element). + */ +class BarSeriesContext : public SeriesContextBase +{ +public: + explicit BarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~BarSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for bubble chart types (c:ser element). + */ +class BubbleSeriesContext : public SeriesContextBase +{ +public: + explicit BubbleSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~BubbleSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for line and stock chart types (c:ser + element). + */ +class LineSeriesContext : public SeriesContextBase +{ +public: + explicit LineSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~LineSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for pie and doughnut chart types (c:ser + element). + */ +class PieSeriesContext : public SeriesContextBase +{ +public: + explicit PieSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~PieSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for radar chart types (c:ser element). + */ +class RadarSeriesContext : public SeriesContextBase +{ +public: + explicit RadarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~RadarSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for scatter chart types (c:ser element). + */ +class ScatterSeriesContext : public SeriesContextBase +{ +public: + explicit ScatterSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~ScatterSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for a data series context for scatter chart types (c:ser element). + */ +class SurfaceSeriesContext : public SeriesContextBase +{ +public: + explicit SurfaceSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~SurfaceSeriesContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/seriesconverter.hxx b/oox/inc/oox/drawingml/chart/seriesconverter.hxx new file mode 100644 index 000000000000..6874298487d4 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/seriesconverter.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX +#define OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX + +#include "oox/drawingml/chart/converterbase.hxx" +#include "oox/drawingml/chart/seriesmodel.hxx" + +namespace com { namespace sun { namespace star { + namespace chart2 { class XDataSeries; } + namespace chart2 { namespace data { class XLabeledDataSequence; } } +} } } + +namespace oox { +namespace drawingml { +namespace chart { + +class TypeGroupConverter; + +// #i66858# enable this when Chart2 supports smoothed lines per data series +#define OOX_CHART_SMOOTHED_PER_SERIES 0 + +// ============================================================================ + +class DataLabelConverter : public ConverterBase< DataLabelModel > +{ +public: + explicit DataLabelConverter( const ConverterRoot& rParent, DataLabelModel& rModel ); + virtual ~DataLabelConverter(); + + /** Converts OOXML data label settings for the passed data point. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries, + const TypeGroupConverter& rTypeGroup ); + + /** Conversion helper for data series and data points. */ + static void convertLabelFormatting( + PropertySet& rPropSet, + ObjectFormatter& rFormatter, + const DataLabelModelBase& rDataLabel, + const TypeGroupConverter& rTypeGroup, + bool bDataSeriesLabel ); +}; + +// ============================================================================ + +class DataLabelsConverter : public ConverterBase< DataLabelsModel > +{ +public: + explicit DataLabelsConverter( const ConverterRoot& rParent, DataLabelsModel& rModel ); + virtual ~DataLabelsConverter(); + + /** Converts OOXML data label settings for the passed data series. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries, + const TypeGroupConverter& rTypeGroup ); +}; + +// ============================================================================ + +class ErrorBarConverter : public ConverterBase< ErrorBarModel > +{ +public: + explicit ErrorBarConverter( const ConverterRoot& rParent, ErrorBarModel& rModel ); + virtual ~ErrorBarConverter(); + + /** Converts an OOXML errorbar and inserts it into the passed data series. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries ); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( ErrorBarModel::SourceType eSourceType ); +}; + +// ============================================================================ + +class TrendlineLabelConverter : public ConverterBase< TrendlineLabelModel > +{ +public: + explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel ); + virtual ~TrendlineLabelConverter(); + + /** Converts the OOXML trendline label. */ + void convertFromModel( PropertySet& rPropSet ); +}; + +// ============================================================================ + +class TrendlineConverter : public ConverterBase< TrendlineModel > +{ +public: + explicit TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel ); + virtual ~TrendlineConverter(); + + /** Converts an OOXML trendline and inserts it into the passed data series. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries ); +}; + +// ============================================================================ + +class DataPointConverter : public ConverterBase< DataPointModel > +{ +public: + explicit DataPointConverter( const ConverterRoot& rParent, DataPointModel& rModel ); + virtual ~DataPointConverter(); + + /** Converts settings for a data point in the passed series. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries, + const TypeGroupConverter& rTypeGroup, + const SeriesModel& rSeries ); +}; + +// ============================================================================ + +class SeriesConverter : public ConverterBase< SeriesModel > +{ +public: + explicit SeriesConverter( const ConverterRoot& rParent, SeriesModel& rModel ); + virtual ~SeriesConverter(); + + /** Creates a labeled data sequence object from category data link. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createCategorySequence( const ::rtl::OUString& rRole ); + /** Creates a labeled data sequence object from value data link. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createValueSequence( const ::rtl::OUString& rRole ); + /** Creates a data series object with initialized source links. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > + createDataSeries( const TypeGroupConverter& rTypeGroup, bool bVaryColorsByPoint ); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( + SeriesModel::SourceType eSourceType, + const ::rtl::OUString& rRole, + bool bUseTextLabel ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/seriesmodel.hxx b/oox/inc/oox/drawingml/chart/seriesmodel.hxx new file mode 100644 index 000000000000..d4b9ab3c9715 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/seriesmodel.hxx @@ -0,0 +1,243 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_SERIESMODEL_HXX +#define OOX_DRAWINGML_CHART_SERIESMODEL_HXX + +#include "oox/drawingml/chart/datasourcemodel.hxx" +#include "oox/drawingml/chart/titlemodel.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct DataLabelModelBase +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + + ShapeRef mxShapeProp; /// Data label frame formatting. + TextBodyRef mxTextProp; /// Data label text formatting. + NumberFormat maNumberFormat; /// Number format for numeric data labels. + OptValue< ::rtl::OUString > moaSeparator;/// Separator between label components. + OptValue< sal_Int32 > monLabelPos; /// Data label position. + OptValue< bool > mobShowBubbleSize; /// True = show size of bubbles in bubble charts. + OptValue< bool > mobShowCatName; /// True = show category name of data points. + OptValue< bool > mobShowLegendKey; /// True = show legend key of data series. + OptValue< bool > mobShowPercent; /// True = show percentual value in pie/doughnut charts. + OptValue< bool > mobShowSerName; /// True = show series name. + OptValue< bool > mobShowVal; /// True = show data point value. + bool mbDeleted; /// True = data label(s) deleted. + + explicit DataLabelModelBase(); + ~DataLabelModelBase(); +}; + +// ============================================================================ + +struct DataLabelModel : public DataLabelModelBase +{ + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + LayoutRef mxLayout; /// Layout/position of the data point label frame. + TextRef mxText; /// Manual or linked text for this data point label. + sal_Int32 mnIndex; /// Data point index for this data label. + + explicit DataLabelModel(); + ~DataLabelModel(); +}; + +// ============================================================================ + +struct DataLabelsModel : public DataLabelModelBase +{ + typedef ModelVector< DataLabelModel > DataLabelVector; + typedef ModelRef< Shape > ShapeRef; + + DataLabelVector maPointLabels; /// Settings for individual data point labels. + ShapeRef mxLeaderLines; /// Formatting of connector lines between data points and labels. + bool mbShowLeaderLines; /// True = show connector lines between data points and labels. + + explicit DataLabelsModel(); + ~DataLabelsModel(); +}; + +// ============================================================================ + +struct PictureOptionsModel +{ + double mfStackUnit; /// Bitmap stacking unit. + sal_Int32 mnPictureFormat; /// Bitmap mode (stretch/tile). + bool mbApplyToFront; /// True = draw picture at front/back side of 3D data points. + bool mbApplyToSides; /// True = draw picture at left/right side of 3D data points. + bool mbApplyToEnd; /// True = draw picture at top/bottom side of 3D data points. + + explicit PictureOptionsModel(); + ~PictureOptionsModel(); +}; + +// ============================================================================ + +struct ErrorBarModel +{ + enum SourceType + { + PLUS, /// Plus error bar values. + MINUS /// Minus error bar values. + }; + + typedef ModelMap< SourceType, DataSourceModel > DataSourceMap; + typedef ModelRef< Shape > ShapeRef; + + DataSourceMap maSources; /// Source ranges for manual error bar values. + ShapeRef mxShapeProp; /// Error line formatting. + double mfValue; /// Fixed value for several error bar types. + sal_Int32 mnDirection; /// Direction of the error bars (x/y). + sal_Int32 mnTypeId; /// Type of the error bars (plus/minus/both). + sal_Int32 mnValueType; /// Type of the values. + bool mbNoEndCap; /// True = no end cap at error bar lines. + + explicit ErrorBarModel(); + ~ErrorBarModel(); +}; + +// ============================================================================ + +struct TrendlineLabelModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + ShapeRef mxShapeProp; /// Label frame formatting. + TextBodyRef mxTextProp; /// Label text formatting. + LayoutRef mxLayout; /// Layout/position of the frame. + TextRef mxText; /// Text source of the label. + NumberFormat maNumberFormat; /// Number format for coefficients. + + explicit TrendlineLabelModel(); + ~TrendlineLabelModel(); +}; + +// ============================================================================ + +struct TrendlineModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TrendlineLabelModel > TrendlineLabelRef; + + ShapeRef mxShapeProp; /// Trendline formatting. + TrendlineLabelRef mxLabel; /// Trendline label text object. + ::rtl::OUString maName; /// User-defined name of the trendline. + OptValue< double > mfBackward; /// Size of trendline before first data point. + OptValue< double > mfForward; /// Size of trendline behind last data point. + OptValue< double > mfIntercept; /// Crossing point with Y axis. + sal_Int32 mnOrder; /// Polynomial order in range [2, 6]. + sal_Int32 mnPeriod; /// Moving average period in range [2, 255]. + sal_Int32 mnTypeId; /// Type of the trendline. + bool mbDispEquation; /// True = show equation of the trendline. + bool mbDispRSquared; /// True = show R-squared of the trendline. + + explicit TrendlineModel(); + ~TrendlineModel(); +}; + +// ============================================================================ + +struct DataPointModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< PictureOptionsModel > PictureOptionsRef; + + ShapeRef mxShapeProp; /// Data point formatting. + PictureOptionsRef mxPicOptions; /// Fill bitmap settings. + ShapeRef mxMarkerProp; /// Data point marker formatting. + OptValue< sal_Int32 > monExplosion; /// Pie slice moved from pie center. + OptValue< sal_Int32 > monMarkerSize; /// Size of the series line marker (2...72). + OptValue< sal_Int32 > monMarkerSymbol; /// Series line marker symbol. + OptValue< bool > mobBubble3d; /// True = show bubbles with 3D shade. + sal_Int32 mnIndex; /// Unique data point index. + bool mbInvertNeg; /// True = invert negative data points (not derived from series!). + + explicit DataPointModel(); + ~DataPointModel(); +}; + +// ============================================================================ + +struct SeriesModel +{ + enum SourceType + { + CATEGORIES, /// Data point categories. + VALUES, /// Data point values. + POINTS /// Data point size (e.g. bubble size in bubble charts). + }; + + typedef ModelMap< SourceType, DataSourceModel > DataSourceMap; + typedef ModelVector< ErrorBarModel > ErrorBarVector; + typedef ModelVector< TrendlineModel > TrendlineVector; + typedef ModelVector< DataPointModel > DataPointVector; + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< PictureOptionsModel > PictureOptionsRef; + typedef ModelRef< TextModel > TextRef; + typedef ModelRef< DataLabelsModel > DataLabelsRef; + + DataSourceMap maSources; /// Series source ranges. + ErrorBarVector maErrorBars; /// All error bars of this series. + TrendlineVector maTrendlines; /// All trendlines of this series. + DataPointVector maPoints; /// Explicit formatted data points. + ShapeRef mxShapeProp; /// Series formatting. + PictureOptionsRef mxPicOptions; /// Fill bitmap settings. + ShapeRef mxMarkerProp; /// Data point marker formatting. + TextRef mxText; /// Series title source. + DataLabelsRef mxLabels; /// Data point label settings for all points. + OptValue< sal_Int32 > monShape; /// 3D bar shape type. + sal_Int32 mnExplosion; /// Pie slice moved from pie center. + sal_Int32 mnIndex; /// Series index used for automatic formatting. + sal_Int32 mnMarkerSize; /// Size of the series line marker (2...72). + sal_Int32 mnMarkerSymbol; /// Series line marker symbol. + sal_Int32 mnOrder; /// Series order. + bool mbBubble3d; /// True = show bubbles with 3D shade. + bool mbInvertNeg; /// True = invert negative data points. + bool mbSmooth; /// True = smooth series line. + + explicit SeriesModel(); + ~SeriesModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/titlecontext.hxx b/oox/inc/oox/drawingml/chart/titlecontext.hxx new file mode 100644 index 000000000000..45969bf150c2 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/titlecontext.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_TITLECONTEXT_HXX +#define OOX_DRAWINGML_CHART_TITLECONTEXT_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct TextModel; + +/** Handler for a chart text context (c:tx element). + */ +class TextContext : public ContextBase< TextModel > +{ +public: + explicit TextContext( ::oox::core::ContextHandler2Helper& rParent, TextModel& rModel ); + virtual ~TextContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onCharacters( const ::rtl::OUString& rChars ); +}; + +// ============================================================================ + +struct TitleModel; + +/** Handler for a chart title context (c:title element). + */ +class TitleContext : public ContextBase< TitleModel > +{ +public: + explicit TitleContext( ::oox::core::ContextHandler2Helper& rParent, TitleModel& rModel ); + virtual ~TitleContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct LegendModel; + +/** Handler for a chart legend context (c:legend element). + */ +class LegendContext : public ContextBase< LegendModel > +{ +public: + explicit LegendContext( ::oox::core::ContextHandler2Helper& rParent, LegendModel& rModel ); + virtual ~LegendContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/titleconverter.hxx b/oox/inc/oox/drawingml/chart/titleconverter.hxx new file mode 100644 index 000000000000..2a452ae6c96b --- /dev/null +++ b/oox/inc/oox/drawingml/chart/titleconverter.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_TITLECONVERTER_HXX +#define OOX_DRAWINGML_CHART_TITLECONVERTER_HXX + +#include "oox/drawingml/chart/converterbase.hxx" + +namespace com { namespace sun { namespace star { + namespace chart2 { class XDiagram; } + namespace chart2 { class XFormattedString; } + namespace chart2 { class XTitled; } + namespace chart2 { namespace data { class XDataSequence; } } +} } } + +namespace oox { namespace drawingml { struct TextCharacterProperties; } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct TextModel; + +class TextConverter : public ConverterBase< TextModel > +{ +public: + explicit TextConverter( const ConverterRoot& rParent, TextModel& rModel ); + virtual ~TextConverter(); + + /** Creates a data sequence object from the contained text data. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > + createDataSequence( const ::rtl::OUString& rRole ); + /** Creates a sequence of formatted string objects. */ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > > + createStringSequence( + const ::rtl::OUString& rDefaultText, + const ModelRef< TextBody >& rxTextProp, + ObjectType eObjType ); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > + appendFormattedString( + ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >& orStringVec, + const ::rtl::OUString& rString, + bool bAddNewLine ) const; +}; + +// ============================================================================ + +struct TitleModel; + +class TitleConverter : public ConverterBase< TitleModel > +{ +public: + explicit TitleConverter( const ConverterRoot& rParent, TitleModel& rModel ); + virtual ~TitleConverter(); + + /** Creates a title text object and attaches it at the passed interface. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitled >& rxTitled, + const ::rtl::OUString& rAutoTitle, ObjectType eObjType, + sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ); +}; + +// ============================================================================ + +struct LegendModel; + +class LegendConverter : public ConverterBase< LegendModel > +{ +public: + explicit LegendConverter( const ConverterRoot& rParent, LegendModel& rModel ); + virtual ~LegendConverter(); + + /** Creates a legend object and attaches it at the passed diagram. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/titlemodel.hxx b/oox/inc/oox/drawingml/chart/titlemodel.hxx new file mode 100644 index 000000000000..fc47d684c6dc --- /dev/null +++ b/oox/inc/oox/drawingml/chart/titlemodel.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_TITLEMODEL_HXX +#define OOX_DRAWINGML_CHART_TITLEMODEL_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/chart/datasourcemodel.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct TextModel +{ + typedef ModelRef< DataSequenceModel > DataSequenceRef; + typedef ModelRef< TextBody > TextBodyRef; + + DataSequenceRef mxDataSeq; /// The string data or formula link of this text. + TextBodyRef mxTextBody; /// Rich-formatted literal text (for title objects only). + + explicit TextModel(); + ~TextModel(); +}; + +// ============================================================================ + +struct TitleModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + ShapeRef mxShapeProp; /// Title shape formatting. + TextBodyRef mxTextProp; /// Title text formatting. + LayoutRef mxLayout; /// Layout/position of the frame. + TextRef mxText; /// Text source of the title. + bool mbOverlay; /// True = title may overlay other objects. + + explicit TitleModel(); + ~TitleModel(); +}; + +// ============================================================================ + +struct LegendModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + + ShapeRef mxShapeProp; /// Legend shape formatting. + TextBodyRef mxTextProp; /// Legend text formatting. + LayoutRef mxLayout; /// Layout/position of the legend. + sal_Int32 mnPosition; /// Legend position. + bool mbOverlay; /// True = legend may overlay other objects. + + explicit LegendModel(); + ~LegendModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx new file mode 100644 index 000000000000..d58cb7e1c4f7 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX +#define OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX + +#include "oox/drawingml/chart/chartcontextbase.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct UpDownBarsModel; + +/** Handler for an up/down bars context (c:upDownBars element). + */ +class UpDownBarsContext : public ContextBase< UpDownBarsModel > +{ +public: + explicit UpDownBarsContext( ::oox::core::ContextHandler2Helper& rParent, UpDownBarsModel& rModel ); + virtual ~UpDownBarsContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +struct TypeGroupModel; +typedef ContextBase< TypeGroupModel > TypeGroupContextBase; + +// ============================================================================ + +/** Handler for area type group contexts (c:area3DChart, c:areaChart elements). + */ +class AreaTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit AreaTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~AreaTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for bar type group contexts (c:bar3DChart, c:barChart elements). + */ +class BarTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit BarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~BarTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for bubble type group context (c:bubbleChart element). + */ +class BubbleTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit BubbleTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~BubbleTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for line type group contexts (c:line3DChart, c:lineChart, + c:stockChart elements). + */ +class LineTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit LineTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~LineTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for pie type group contexts (c:doughnutChart, c:ofPieChart, + c:pie3DChart, c:pieChart elements). + */ +class PieTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit PieTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~PieTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for radar type group context (c:radarChart element). + */ +class RadarTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit RadarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~RadarTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for scatter type group context (c:scatterChart element). + */ +class ScatterTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit ScatterTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~ScatterTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +/** Handler for surface type group contexts (c:surface3DChart, c:surfaceChart + elements). + */ +class SurfaceTypeGroupContext : public TypeGroupContextBase +{ +public: + explicit SurfaceTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~SurfaceTypeGroupContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/typegroupconverter.hxx b/oox/inc/oox/drawingml/chart/typegroupconverter.hxx new file mode 100644 index 000000000000..58375a4c2b1f --- /dev/null +++ b/oox/inc/oox/drawingml/chart/typegroupconverter.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX +#define OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX + +#include "oox/drawingml/chart/converterbase.hxx" + +namespace com { namespace sun { namespace star { + namespace chart2 { class XChartType; } + namespace chart2 { class XCoordinateSystem; } + namespace chart2 { class XDataSeries; } + namespace chart2 { class XDiagram; } + namespace chart2 { namespace data { class XLabeledDataSequence; } } +} } } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +/** Enumerates different chart types. */ +enum TypeId +{ + TYPEID_BAR, /// Vertical bar chart. + TYPEID_HORBAR, /// Horizontal bar chart. + TYPEID_LINE, /// Line chart. + TYPEID_AREA, /// Area chart. + TYPEID_STOCK, /// Stock chart. + TYPEID_RADARLINE, /// Linear radar chart. + TYPEID_RADARAREA, /// Filled radar chart. + TYPEID_PIE, /// Pie chart. + TYPEID_DOUGHNUT, /// Doughnut (ring) chart. + TYPEID_OFPIE, /// Pie-to-pie or pie-to-bar chart. + TYPEID_SCATTER, /// Scatter (XY) chart. + TYPEID_BUBBLE, /// Bubble chart. + TYPEID_SURFACE, /// Surface chart. + TYPEID_UNKNOWN /// Default for unknown chart types. +}; + +// ---------------------------------------------------------------------------- + +/** Enumerates different categories of similar chart types. */ +enum TypeCategory +{ + TYPECATEGORY_BAR, /// Bar charts (horizontal or vertical). + TYPECATEGORY_LINE, /// Line charts (line, area, stock charts). + TYPECATEGORY_RADAR, /// Radar charts (linear or filled). + TYPECATEGORY_PIE, /// Pie and donut charts. + TYPECATEGORY_SCATTER, /// Scatter and bubble charts. + TYPECATEGORY_SURFACE /// Surface charts. +}; + +// ---------------------------------------------------------------------------- + +/** Enumerates modes for varying point colors in a series. */ +enum VarPointMode +{ + VARPOINTMODE_NONE, /// No varied colors supported. + VARPOINTMODE_SINGLE, /// Only supported, if type group contains only one series. + VARPOINTMODE_MULTI /// Supported for multiple series in a chart type group. +}; + +// ============================================================================ + +/** Contains info for a chart type related to the OpenOffice.org chart module. */ +struct TypeGroupInfo +{ + TypeId meTypeId; /// Unique chart type identifier. + TypeCategory meTypeCategory; /// Category this chart type belongs to. + const sal_Char* mpcServiceName; /// Service name of the type. + VarPointMode meVarPointMode; /// Mode for varying point colors. + sal_Int32 mnDefLabelPos; /// Default data label position (API constant). + bool mbCombinable2d; /// True = types can be combined in one axes set. + bool mbSupports3d; /// True = 3D type allowed, false = only 2D type. + bool mbPolarCoordSystem; /// True = polar, false = cartesian. + bool mbSeriesIsFrame2d; /// True = 2D type series with area formatting. + bool mbSingleSeriesVis; /// True = only first series visible (e.g. pie charts). + bool mbCategoryAxis; /// True = X axis contains categories. + bool mbSwappedAxesSet; /// True = X axis and Y axis are swapped. + bool mbSupportsStacking; /// True = data points can be stacked on each other. + bool mbReverseSeries; /// True = insert unstacked series in reverse order. + bool mbTicksBetweenCateg; /// True = X axis ticks between categories. + bool mbPictureOptions; /// True = bitmaps support options from c:pictureOptions. +}; + +// ============================================================================ + +struct UpDownBarsModel; + +class UpDownBarsConverter : public ConverterBase< UpDownBarsModel > +{ +public: + explicit UpDownBarsConverter( const ConverterRoot& rParent, UpDownBarsModel& rModel ); + virtual ~UpDownBarsConverter(); + + /** Converts the OOXML up/down bars. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType ); +}; + +// ============================================================================ + +struct TypeGroupModel; +struct View3DModel; + +class TypeGroupConverter : public ConverterBase< TypeGroupModel > +{ +public: + explicit TypeGroupConverter( const ConverterRoot& rParent, TypeGroupModel& rModel ); + virtual ~TypeGroupConverter(); + + /** Returns the type info struct that describes this chart type group. */ + inline const TypeGroupInfo& getTypeInfo() const { return maTypeInfo; } + + /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */ + bool isStacked() const; + /** Returns true, if the series in this chart type group are stacked on each other as percentage. */ + bool isPercent() const; + /** Returns true, if the chart is three-dimensional. */ + bool is3dChart() const; + /** Returns true, if chart type supports wall and floor format in 3D mode. */ + bool isWall3dChart() const; + /** Returns true, if the series in this chart type group are ordered on the Z axis. */ + bool isDeep3dChart() const; + + /** Returns true, if this chart type supports area formatting for its series. */ + bool isSeriesFrameFormat() const; + /** Returns the object type for a series depending on the chart type. */ + ObjectType getSeriesObjectType() const; + + /** Returns true, if this chart type has to reverse its series order. */ + bool isReverseSeries() const; + /** Returns series title, if the chart type group contains only one single series. */ + ::rtl::OUString getSingleSeriesTitle() const; + + /** Creates a coordinate system according to the contained chart type. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > + createCoordinateSystem(); + /** Creates a labeled data sequence object for axis categories. */ + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createCategorySequence(); + + /** Converts the OOXML type group model into a chart2 coordinate system. */ + void convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem, + sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint ); + + /** Sets the passed OOXML marker style at the passed property set. */ + void convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSymbol, sal_Int32 nOoxSize ) const; + /** Sets the passed OOXML line smoothing at the passed property set. */ + void convertLineSmooth( PropertySet& rPropSet, bool bOoxSmooth ) const; + /** Sets the passed OOXML bar 3D geometry at the passed property set. */ + void convertBarGeometry( PropertySet& rPropSet, sal_Int32 nOoxShape ) const; + /** Sets the passed OOXML pie rotation at the passed property set. */ + void convertPieRotation( PropertySet& rPropSet, sal_Int32 nOoxAngle ) const; + /** Sets the passed OOXML pie explosion at the passed property set. */ + void convertPieExplosion( PropertySet& rPropSet, sal_Int32 nOoxExplosion ) const; + +private: + /** Inserts the passed series into the chart type. Adds additional properties to the series. */ + void insertDataSeries( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxSeries, + sal_Int32 nAxesSetIdx ); + +private: + TypeGroupInfo maTypeInfo; /// Extended type info for contained chart type model. + bool mb3dChart; /// True = type is a 3D chart type. +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/drawingml/chart/typegroupmodel.hxx b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx new file mode 100644 index 000000000000..9af01210d585 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX +#define OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX + +#include "oox/drawingml/chart/seriesmodel.hxx" + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +struct UpDownBarsModel +{ + typedef ModelRef< Shape > ShapeRef; + + ShapeRef mxDownBars; /// Formatting of down bars. + ShapeRef mxUpBars; /// Formatting of up bars. + sal_Int32 mnGapWidth; /// Space between up/down bars. + + explicit UpDownBarsModel(); + ~UpDownBarsModel(); +}; + +// ============================================================================ + +struct TypeGroupModel +{ + typedef ModelVector< SeriesModel > SeriesVector; + typedef ::std::vector< sal_Int32 > AxisIdVector; + typedef ModelRef< DataLabelsModel > DataLabelsRef; + typedef ModelRef< UpDownBarsModel > UpDownBarsRef; + typedef ModelRef< Shape > ShapeRef; + + SeriesVector maSeries; /// Series attached to this chart type group. + AxisIdVector maAxisIds; /// List of axis identifiers used by this chart type. + DataLabelsRef mxLabels; /// Data point label settings for all series. + UpDownBarsRef mxUpDownBars; /// Up/down bars in stock charts. + ShapeRef mxSerLines; /// Connector lines in stacked bar charts. + ShapeRef mxDropLines; /// Drop lines connecting data points with X axis. + ShapeRef mxHiLowLines; /// High/low lines connecting lowest and highest data points. + double mfSplitPos; /// Threshold value in pie-to charts. + sal_Int32 mnBarDir; /// Bar direction in bar charts (vertical/horizontal). + sal_Int32 mnBubbleScale; /// Relative scaling of bubble size (percent). + sal_Int32 mnFirstAngle; /// Rotation angle of first slice in pie charts. + sal_Int32 mnGapDepth; /// Space between series in deep 3D charts. + sal_Int32 mnGapWidth; /// Space between bars in bar charts, or space in pie-to charts. + sal_Int32 mnGrouping; /// Series grouping mode. + sal_Int32 mnHoleSize; /// Hole size in doughnut charts. + sal_Int32 mnOfPieType; /// Pie-to-pie or pie-to-bar chart. + sal_Int32 mnOverlap; /// Bar overlap per category (2D bar charts only). + sal_Int32 mnRadarStyle; /// Type of radar chart (lines, markers, filled). + sal_Int32 mnScatterStyle; /// Type of scatter chart (lines, markers, smooth). + sal_Int32 mnSecondPieSize; /// relative size of second pie/bar in pie-to charts (percent). + sal_Int32 mnShape; /// 3D bar shape type. + sal_Int32 mnSizeRepresents; /// Bubble size represents area or width. + sal_Int32 mnSplitType; /// Split type in pie-to charts. + sal_Int32 mnTypeId; /// Chart type identifier. + bool mbBubble3d; /// True = show bubbles with 3D shade. + bool mbShowMarker; /// True = show point markers in line charts. + bool mbShowNegBubbles; /// True = show absolute value of negative bubbles. + bool mbSmooth; /// True = smooth lines in line charts. + bool mbVaryColors; /// True = different automatic colors for each point. + bool mbWireframe; /// True = wireframe surface chart, false = filled surface chart. + + explicit TypeGroupModel( sal_Int32 nTypeId ); + ~TypeGroupModel(); +}; + +// ============================================================================ + +} // namespace chart +} // namespace drawingml +} // namespace oox + +#endif |