diff options
Diffstat (limited to 'oox/inc/oox/drawingml')
87 files changed, 8241 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..b80dd2e6f9ef --- /dev/null +++ b/oox/inc/oox/drawingml/chart/axiscontext.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * 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..4e8f86279133 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/axisconverter.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 { + +// ============================================================================ + +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; + +// ============================================================================ + +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..8bab84257eee --- /dev/null +++ b/oox/inc/oox/drawingml/chart/axismodel.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_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. + sal_Int32 mnAxisId; /// Unique axis identifier. + sal_Int32 mnAxisPos; /// Position of the axis (top/bottom/left/right). + sal_Int32 mnBaseTimeUnit; /// Base time unit shown on a date axis. + 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 axis settings. + 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..470596a5228e --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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 ); +}; + +// ============================================================================ + +} // 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..d45a5c95c388 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartconverter.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_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 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. */ + void convertFromModel( + ::oox::core::XmlFilterBase& rFilter, + ChartSpaceModel& rModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc ); + + /** 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/chartspaceconverter.hxx b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx new file mode 100644 index 000000000000..edeb24f0022f --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 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(); +}; + +// ============================================================================ + +} // 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..898bc2ea15e8 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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..5955dd9aef51 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/chartspacemodel.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_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. + 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. + + 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..683e1cd8f05d --- /dev/null +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * 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 lang { class XMultiServiceFactory; } + namespace chart2 { class XChartDocument; } +} } } + +namespace oox { namespace core { + class XmlFilterBase; +} } + +namespace oox { +namespace drawingml { +namespace chart { + +// ============================================================================ + +class ChartConverter; +class ObjectFormatter; +struct ChartSpaceModel; +struct ConverterData; + +class ConverterRoot +{ +public: + explicit ConverterRoot( + ::oox::core::XmlFilterBase& rFilter, + ChartConverter& rChartConverter, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc, + const ChartSpaceModel& rChartSpace ); + virtual ~ConverterRoot(); + + /** Creates an instance for the passed service name, using the passed service factory. */ + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + createInstance( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::rtl::OUString& rServiceName ); + + /** 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 object formatter. */ + ObjectFormatter& getFormatter() const; + +private: + ::boost::shared_ptr< ConverterData > mxData; +}; + +// ============================================================================ + +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; +}; + +// ============================================================================ + +} // 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..9b832a0209ab --- /dev/null +++ b/oox/inc/oox/drawingml/chart/datasourcecontext.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_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 onEndElement( 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 onEndElement( 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..7cdd6ab4a175 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/datasourceconverter.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_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..3de2278e5a71 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/datasourcemodel.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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..113d6f686fd1 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/modelbase.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_MODELBASE_HXX +#define OOX_DRAWINGML_CHART_MODELBASE_HXX + +#include "oox/helper/containerhelper.hxx" +#include "oox/helper/helper.hxx" +#include "tokens.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 ); +}; + +// ============================================================================ + +} // 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..9f83a6bc0391 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/objectformatter.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_OBJECTFORMATTER_HXX +#define OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX + +#include "oox/helper/containerhelper.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..75ebed545956 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/plotareacontext.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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..b2583b2e57a1 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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 ); + + /** 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; +}; + +// ============================================================================ + +} // 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..2dfe1c33f4e3 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/plotareamodel.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_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/titlemodel.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..024e9754781c --- /dev/null +++ b/oox/inc/oox/drawingml/chart/seriescontext.hxx @@ -0,0 +1,273 @@ +/************************************************************************* + * + * 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 onEndElement( 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 onEndElement( 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 onEndElement( 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..7f6a08655b17 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/seriesconverter.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * 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 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..2b72eb0f2bcf --- /dev/null +++ b/oox/inc/oox/drawingml/chart/seriesmodel.hxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * 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..b5743cc78f42 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/titlecontext.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * 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 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 ); +}; + +// ============================================================================ + +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 onEndElement( 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..d1fcfcfcfebc --- /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 ); +}; + +// ============================================================================ + +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..f5d46957b450 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/titlemodel.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * 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 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. + + explicit LayoutModel(); + ~LayoutModel(); +}; + +// ============================================================================ + +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..aa5f2a47c4a0 --- /dev/null +++ b/oox/inc/oox/drawingml/chart/typegroupcontext.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_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..46018696baef --- /dev/null +++ b/oox/inc/oox/drawingml/chart/typegroupconverter.hxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * 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..b51b8e5d4a7c --- /dev/null +++ b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 + diff --git a/oox/inc/oox/drawingml/clrscheme.hxx b/oox/inc/oox/drawingml/clrscheme.hxx new file mode 100644 index 000000000000..22eab1a892a1 --- /dev/null +++ b/oox/inc/oox/drawingml/clrscheme.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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_CLRSCHEME_HXX +#define OOX_DRAWINGML_CLRSCHEME_HXX + +#include <boost/shared_ptr.hpp> +#include <map> +#include <vector> +#include "oox/core/namespaces.hxx" +#include "oox/drawingml/color.hxx" + +namespace oox { namespace drawingml { + +class ClrMap +{ + std::map < sal_Int32, sal_Int32 > maClrMap; + +public: + + sal_Bool getColorMap( sal_Int32& nClrToken ); + void setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken ); +}; + +typedef boost::shared_ptr< ClrMap > ClrMapPtr; + +class ClrScheme +{ + std::map < sal_Int32, sal_Int32 > maClrScheme; + +public: + + ClrScheme(); + ~ClrScheme(); + + sal_Bool getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const; + void setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor ); +}; + +typedef boost::shared_ptr< ClrScheme > ClrSchemePtr; + +} } + +#endif // OOX_DRAWINGML_CLRSCHEME_HXX diff --git a/oox/inc/oox/drawingml/clrschemecontext.hxx b/oox/inc/oox/drawingml/clrschemecontext.hxx new file mode 100644 index 000000000000..2ecc588716e0 --- /dev/null +++ b/oox/inc/oox/drawingml/clrschemecontext.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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_CLRSCHEMECONTEXT_HXX +#define OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/clrscheme.hxx" +#include "oox/drawingml/color.hxx" +#include "oox/drawingml/colorchoicecontext.hxx" + +namespace oox { namespace drawingml { + +class clrMapContext : public oox::core::ContextHandler +{ +public: + clrMapContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, ClrMap& rClrMap ); +}; + +class clrSchemeColorContext : private Color, public ColorContext +{ +public: + clrSchemeColorContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken ); + virtual ~clrSchemeColorContext(); + +private: + ClrScheme& mrClrScheme; + sal_Int32 mnColorToken; +}; + +class clrSchemeContext : public oox::core::ContextHandler +{ +public: + clrSchemeContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + ClrScheme& mrClrScheme; +}; + +} } + +#endif // OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX diff --git a/oox/inc/oox/drawingml/color.hxx b/oox/inc/oox/drawingml/color.hxx new file mode 100644 index 000000000000..830959b77db9 --- /dev/null +++ b/oox/inc/oox/drawingml/color.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * 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_COLOR_HXX +#define OOX_DRAWINGML_COLOR_HXX + +#include <vector> +#include <boost/shared_ptr.hpp> +#include <sal/types.h> +#include <rtl/instance.hxx> +#include <rtl/ustring.hxx> +#include "oox/helper/helper.hxx" + +namespace oox { namespace core { class FilterBase; } } + +namespace oox { +namespace drawingml { + +// ============================================================================ + +class Color +{ +public: + Color(); + ~Color(); + + /** Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. */ + static sal_Int32 getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb ); + /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */ + static sal_Int32 getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb ); + + /** Sets the color to unused state. */ + void setUnused(); + /** Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. */ + void setSrgbClr( sal_Int32 nRgb ); + /** Sets the percentual RGB values from the a:scrgbClr element. */ + void setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB ); + /** Sets the HSL values from the a:hslClr element. */ + void setHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum ); + /** Sets a predefined color from the a:prstClr element. */ + void setPrstClr( sal_Int32 nToken ); + /** Sets a scheme color from the a:schemeClr element. */ + void setSchemeClr( sal_Int32 nToken ); + /** Sets a system color from the a:sysClr element. */ + void setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb ); + /** Sets a palette color index. */ + void setPaletteClr( sal_Int32 nPaletteIdx ); + + /** Inserts the passed color transformation. */ + void addTransformation( sal_Int32 nElement, sal_Int32 nValue = -1 ); + /** Inserts Chart specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */ + void addChartTintTransformation( double fTint ); + /** Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */ + void addExcelTintTransformation( double fTint ); + /** Removes all color transformations. */ + void clearTransformations(); + /** Removes transparence from the color. */ + void clearTransparence(); + + /** Overwrites this color with the passed color, if it is used. */ + inline void assignIfUsed( const Color& rColor ) { if( rColor.isUsed() ) *this = rColor; } + + /** Returns true, if the color is initialized. */ + bool isUsed() const { return meMode != COLOR_UNUSED; } + /** Returns true, if the color is a placeholder color in theme style lists. */ + bool isPlaceHolder() const { return meMode == COLOR_PH; } + /** Returns the final RGB color value. + @param nPhClr Actual color for the phClr placeholder color used in theme style lists. */ + sal_Int32 getColor( const ::oox::core::FilterBase& rFilter, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; + + /** Returns true, if the color has a transparence set. */ + bool hasTransparence() const; + /** Returns the transparence of the color (0 = opaque, 100 = full transparent). */ + sal_Int16 getTransparence() const; + +private: + /** Internal helper for getColor(). */ + void setResolvedRgb( sal_Int32 nRgb ) const; + + /** Converts the color components to RGB values. */ + void toRgb() const; + /** Converts the color components to CRGB values (gamma corrected percentage). */ + void toCrgb() const; + /** Converts the color components to HSL values. */ + void toHsl() const; + +private: + enum ColorMode + { + COLOR_UNUSED, /// Color is not used, or undefined. + COLOR_RGB, /// Absolute RGB (r/g/b: 0...255). + COLOR_CRGB, /// Relative RGB (r/g/b: 0...100000). + COLOR_HSL, /// HSL (hue: 0...21600000, sat/lum: 0...100000). + COLOR_SCHEME, /// Color from scheme. + COLOR_PALETTE, /// Color from application defined palette. + COLOR_SYSTEM, /// Color from system palette. + COLOR_PH, /// Placeholder color in theme style lists. + COLOR_FINAL /// Finalized RGB color. + }; + + struct Transformation + { + sal_Int32 mnToken; + sal_Int32 mnValue; + + explicit Transformation( sal_Int32 nToken, sal_Int32 nValue ) : mnToken( nToken ), mnValue( nValue ) {} + }; + typedef ::std::vector< Transformation > TransformVec; + + mutable ColorMode meMode; /// Current color mode. + mutable TransformVec maTransforms; /// Color transformations. + mutable sal_Int32 mnC1; /// Red, red%, hue, scheme token, palette index, system token, or final RGB. + mutable sal_Int32 mnC2; /// Green, green%, saturation, or system default RGB. + mutable sal_Int32 mnC3; /// Blue, blue%, or luminance. + sal_Int32 mnAlpha; /// Alpha value (color opacity). +}; + +typedef boost::shared_ptr< Color > ColorPtr; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/colorchoicecontext.hxx b/oox/inc/oox/drawingml/colorchoicecontext.hxx new file mode 100644 index 000000000000..8b42a2e74c15 --- /dev/null +++ b/oox/inc/oox/drawingml/colorchoicecontext.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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_COLORCHOICECONTEXT_HXX +#define OOX_DRAWINGML_COLORCHOICECONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { +namespace drawingml { + +class Color; + +// ============================================================================ + +/** Context handler for the different color value elements (a:scrgbClr, + a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */ +class ColorValueContext : public ::oox::core::ContextHandler +{ +public: + explicit ColorValueContext( ::oox::core::ContextHandler& rParent, Color& rColor ); + + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + Color& mrColor; +}; + +// ============================================================================ + +/** Context handler for elements that *contain* a color value element + (a:scrgbClr, a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */ +class ColorContext : public ::oox::core::ContextHandler +{ +public: + explicit ColorContext( ::oox::core::ContextHandler& rParent, Color& rColor ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + Color& mrColor; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/connectorshapecontext.hxx b/oox/inc/oox/drawingml/connectorshapecontext.hxx new file mode 100644 index 000000000000..f20624c55efc --- /dev/null +++ b/oox/inc/oox/drawingml/connectorshapecontext.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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_CONNECTORSHAPECONTEXT_HXX +#define OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/shapecontext.hxx" + +namespace oox { namespace drawingml { + +class ConnectorShapeContext : public ShapeContext +{ +public: + ConnectorShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr ); + virtual ~ConnectorShapeContext(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); +}; + +} } + +#endif // OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX diff --git a/oox/inc/oox/drawingml/customshapegeometry.hxx b/oox/inc/oox/drawingml/customshapegeometry.hxx new file mode 100644 index 000000000000..4fec38cf09eb --- /dev/null +++ b/oox/inc/oox/drawingml/customshapegeometry.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_CUSTOMSHAPEGEOMETRY_HXX +#define OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include "oox/helper/propertymap.hxx" +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/shape.hxx" + +namespace oox { namespace drawingml { + + +// --------------------------------------------------------------------- +// CT_CustomGeometry2D +class CustomShapeGeometryContext : public ::oox::core::ContextHandler +{ +public: + CustomShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + CustomShapeProperties& mrCustomShapeProperties; +}; + +// --------------------------------------------------------------------- +// CT_PresetGeometry2D +class PresetShapeGeometryContext : public ::oox::core::ContextHandler +{ +public: + PresetShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + CustomShapeProperties& mrCustomShapeProperties; +}; + +// --------------------------------------------------------------------- +// CT_PresetTextShape +class PresetTextShapeContext : public ::oox::core::ContextHandler +{ +public: + PresetTextShapeContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + CustomShapeProperties& mrCustomShapeProperties; +}; + +} } + +#endif // OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx new file mode 100644 index 000000000000..4e4b82cd5acd --- /dev/null +++ b/oox/inc/oox/drawingml/customshapeproperties.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_CUSTOMSHAPEPROPERTIES_HXX +#define OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX + +#include "oox/helper/propertymap.hxx" +#include "oox/drawingml/color.hxx" +#include <com/sun/star/graphic/XGraphic.hpp> +#include <boost/shared_ptr.hpp> +#include "tokens.hxx" +#include <vector> +#include <map> +#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> +#ifndef __com_sun_star_beans_PropertyValues_hpp__ +#include <com/sun/star/beans/PropertyValues.hpp> +#endif +#include <com/sun/star/drawing/ProjectionMode.hpp> +#include <com/sun/star/drawing/XShape.hpp> + +namespace oox { namespace drawingml { + +class CustomShapeProperties; + +typedef boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr; + +struct CustomShapeGuide +{ + rtl::OUString maName; + rtl::OUString maFormula; +}; + +class CustomShapeProperties +{ +public: + + CustomShapeProperties(); + virtual ~CustomShapeProperties(); + + void apply( const CustomShapePropertiesPtr& ); + void pushToPropSet( const ::oox::core::FilterBase& rFilterBase, + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, + const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape) const; + + void setShapePresetType( const rtl::OUString& rShapePresetType ){ maShapePresetType = rShapePresetType; }; + std::vector< CustomShapeGuide >& getAdjustmentValues(){ return maAdjustmentValues; }; + + double getValue( const std::vector< CustomShapeGuide >&, sal_uInt32 nIndex ) const; + +private: + + rtl::OUString maShapePresetType; + std::vector< CustomShapeGuide > maAdjustmentValues; +}; + +} } + +#endif // OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX diff --git a/oox/inc/oox/drawingml/diagram/datamodelcontext.hxx b/oox/inc/oox/drawingml/diagram/datamodelcontext.hxx new file mode 100644 index 000000000000..a09f7b100e2e --- /dev/null +++ b/oox/inc/oox/drawingml/diagram/datamodelcontext.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_SHAPECONTEXT_HXX +#define OOX_DRAWINGML_SHAPECONTEXT_HXX + +#include <com/sun/star/drawing/XShapes.hpp> + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/diagram/diagram.hxx" + +namespace oox { namespace drawingml { + +// CT_DataModel +class DataModelContext : public ::oox::core::ContextHandler +{ +public: + DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr ); + virtual ~DataModelContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + DiagramDataPtr mpDataModel; +}; + +} } + +#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/diagram/diagram.hxx b/oox/inc/oox/drawingml/diagram/diagram.hxx new file mode 100644 index 000000000000..f9c74246e558 --- /dev/null +++ b/oox/inc/oox/drawingml/diagram/diagram.hxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * 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_DIAGRAM_HXX +#define OOX_DRAWINGML_DIAGRAM_HXX + +#include <vector> +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/diagram/diagramlayoutatoms.hxx" + +namespace oox { namespace drawingml { + +namespace dgm { + +/** A Connection + */ +class Connection +{ +public: + Connection() + : mnType( 0 ) + , mnSourceOrder( 0 ) + , mnDestOrder( 0 ) + { + } + + void dump(); + + sal_Int32 mnType; + ::rtl::OUString msModelId; + ::rtl::OUString msSourceId; + ::rtl::OUString msDestId; + ::rtl::OUString msParTransId; + ::rtl::OUString msPresId; + ::rtl::OUString msSibTransId; + sal_Int32 mnSourceOrder; + sal_Int32 mnDestOrder; + +}; + +typedef boost::shared_ptr< Connection > ConnectionPtr; +typedef std::vector< ConnectionPtr > Connections; + +class Point; + +typedef boost::shared_ptr< Point > PointPtr; +typedef std::vector< PointPtr > Points; +/** A point + */ +class Point +{ +public: + Point(); + ShapePtr & getShape( ) + { return mpShape; } + + void setCnxId( const ::rtl::OUString & sCnxId ) + { msCnxId = sCnxId; } + void setModelId( const ::rtl::OUString & sModelId ); + const ::rtl::OUString & getModelId() const + { return msModelId; } + void setType( const sal_Int32 nType ) + { mnType = nType; } + sal_Int32 getType() const + { return mnType; } + + void dump(); +private: + ShapePtr mpShape; + ::rtl::OUString msCnxId; + ::rtl::OUString msModelId; + sal_Int32 mnType; +}; + + +class PointsTree; +typedef boost::shared_ptr< PointsTree > PointsTreePtr; + +/** a points tree node */ +class PointsTree + : public boost::enable_shared_from_this< PointsTree > +{ +public: + typedef std::vector< PointsTreePtr > Childrens; + PointsTree() + {}; + PointsTree( const PointPtr & pPoint ) + : mpNode( pPoint ) + { } + bool addChild( const PointsTreePtr & pChild ); + const PointPtr & getPoint() const + { return mpNode; } + PointsTreePtr getParent() const; + Childrens::const_iterator beginChild() const + { return maChildrens.begin(); } + Childrens::const_iterator endChild() const + { return maChildrens.end(); } +private: + PointPtr mpNode; + boost::weak_ptr< PointsTree > mpParent; + Childrens maChildrens; +}; + +} + +//////////////////// + +class DiagramData +{ +public: + + DiagramData(); + FillPropertiesPtr & getFillProperties() + { return mpFillProperties; } + dgm::Connections & getConnections() + { return maConnections; } + dgm::Points & getPoints() + { return maPoints; } + void dump(); +private: + FillPropertiesPtr mpFillProperties; + dgm::Connections maConnections; + dgm::Points maPoints; +}; + +typedef boost::shared_ptr< DiagramData > DiagramDataPtr; + + + +//////////////////// + +class DiagramLayout +{ +public: + void setDefStyle( const ::rtl::OUString & sDefStyle ) + { msDefStyle = sDefStyle; } + void setMinVer( const ::rtl::OUString & sMinVer ) + { msMinVer = sMinVer; } + void setUniqueId( const ::rtl::OUString & sUniqueId ) + { msUniqueId = sUniqueId; } + const ::rtl::OUString & getUniqueId() + { return msUniqueId; } + void setTitle( const ::rtl::OUString & sTitle ) + { msTitle = sTitle; } + void setDesc( const ::rtl::OUString & sDesc ) + { msDesc = sDesc; } + + LayoutNodePtr & getNode() + { return mpNode; } + const LayoutNodePtr & getNode() const + { return mpNode; } + DiagramDataPtr & getSampData() + { return mpSampData; } + const DiagramDataPtr & getSampData() const + { return mpSampData; } + DiagramDataPtr & getStyleData() + { return mpStyleData; } + const DiagramDataPtr & getStyleData() const + { return mpStyleData; } + + void layout( const dgm::PointsTreePtr & pTree, const com::sun::star::awt::Point & pt ); +private: + ::rtl::OUString msDefStyle; + ::rtl::OUString msMinVer; + ::rtl::OUString msUniqueId; + + ::rtl::OUString msTitle; + ::rtl::OUString msDesc; + LayoutNodePtr mpNode; + DiagramDataPtr mpSampData; + DiagramDataPtr mpStyleData; + // TODO + // catLst + // clrData +}; + +typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr; + +/////////////////////// + +class DiagramQStyles +{ + +}; + +typedef boost::shared_ptr< DiagramQStyles > DiagramQStylesPtr; + +/////////////////////// + +class DiagramColors +{ + +}; + +typedef boost::shared_ptr< DiagramColors > DiagramColorsPtr; + +/////////////////////// + +class Diagram +{ +public: + void setData( const DiagramDataPtr & ); + void setLayout( const DiagramLayoutPtr & ); + DiagramLayoutPtr getLayout() const + { + return mpLayout; + } + void setQStyles( const DiagramQStylesPtr & ); + void setColors( const DiagramColorsPtr & ); + + void addTo( const ShapePtr & pShape ); + ::rtl::OUString getLayoutId() const; +private: + void build( ); + DiagramDataPtr mpData; + DiagramLayoutPtr mpLayout; + DiagramQStylesPtr mpQStyles; + DiagramColorsPtr mpColors; + std::map< ::rtl::OUString, ShapePtr > maShapeMap; + dgm::PointsTreePtr mpRoot; +}; + + +typedef boost::shared_ptr< Diagram > DiagramPtr; + +} } + +#endif diff --git a/oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx b/oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx new file mode 100644 index 000000000000..f9fd32dc71d6 --- /dev/null +++ b/oox/inc/oox/drawingml/diagram/diagramfragmenthandler.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_DIAGRAMFRAGMENTHANDLER +#define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER + +#include "oox/core/fragmenthandler.hxx" +#include "oox/drawingml/diagram/diagram.hxx" + +namespace oox { namespace drawingml { + + +class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler +{ +public: + DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw(); + virtual ~DiagramDataFragmentHandler() throw(); + + virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + DiagramDataPtr mpDataPtr; +}; + + + +class DiagramLayoutFragmentHandler : public ::oox::core::FragmentHandler +{ +public: + DiagramLayoutFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramLayoutPtr pDataPtr ) throw(); + virtual ~DiagramLayoutFragmentHandler() throw(); + + virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + DiagramLayoutPtr mpDataPtr; +}; + +class DiagramQStylesFragmentHandler : public ::oox::core::FragmentHandler +{ +public: + DiagramQStylesFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramQStylesPtr pDataPtr ) throw(); + virtual ~DiagramQStylesFragmentHandler() throw(); + + virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + DiagramQStylesPtr mpDataPtr; +}; + + +class DiagramColorsFragmentHandler : public ::oox::core::FragmentHandler +{ +public: + DiagramColorsFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramColorsPtr pDataPtr ) throw(); + virtual ~DiagramColorsFragmentHandler() throw(); + + virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + DiagramColorsPtr mpDataPtr; +}; + +} } + + +#endif diff --git a/oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx b/oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx new file mode 100644 index 000000000000..7df2deddfa83 --- /dev/null +++ b/oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * 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_DIAGRAMLAYOUTATOMS_HXX +#define OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX + +#include <map> +#include <string> + +#include <boost/shared_ptr.hpp> +#include <boost/array.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> + +#include "oox/drawingml/shape.hxx" + + +namespace oox { namespace drawingml { + + +// AG_IteratorAttributes +class IteratorAttr +{ +public: + IteratorAttr(); + + // not sure this belong here, but wth + void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes ); + +private: + sal_Int32 mnAxis; + sal_Int32 mnCnt; + sal_Bool mbHideLastTrans; + sal_Int32 mnPtType; + sal_Int32 mnSt; + sal_Int32 mnStep; +}; + +class ConditionAttr +{ +public: + ConditionAttr(); + + // not sure this belong here, but wth + void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes ); + +private: + sal_Int32 mnFunc; + sal_Int32 mnArg; + sal_Int32 mnOp; + ::rtl::OUString msVal; +}; + +class LayoutAtom; + +typedef boost::shared_ptr< LayoutAtom > LayoutAtomPtr; + +/** abstract Atom for the layout */ +class LayoutAtom +{ +public: + virtual ~LayoutAtom() + {} + // TODO change signature to the proper one + virtual void processAtom() = 0; + void setName( const ::rtl::OUString & sName ) + { msName = sName; } + void addChild( const LayoutAtomPtr & pNode ) + { mpChildNodes.push_back( pNode ); } + + // dump for debug + virtual void dump(int level = 0); +protected: + std::vector< LayoutAtomPtr > mpChildNodes; + ::rtl::OUString msName; +}; + +class AlgAtom + : public LayoutAtom +{ +public: + virtual ~AlgAtom() + {} + typedef std::map< std::string, ::com::sun::star::uno::Any > ParamMap; + + virtual void processAtom() + {} +private: + ParamMap mParams; +}; + + +class ForEachAtom + : public LayoutAtom +{ +public: + virtual ~ForEachAtom() + {} + + IteratorAttr & iterator() + { return maIter; } + virtual void processAtom(); +private: + IteratorAttr maIter; +}; + +typedef boost::shared_ptr< ForEachAtom > ForEachAtomPtr; + + +class ConditionAtom + : public LayoutAtom +{ +public: + ConditionAtom( bool bElse = false ) + : LayoutAtom( ) + , mbElse( bElse ) + {} + virtual ~ConditionAtom() + {} + bool test(); + virtual void processAtom() + {} + IteratorAttr & iterator() + { return maIter; } + ConditionAttr & cond() + { return maCond; } +private: + bool mbElse; + IteratorAttr maIter; + ConditionAttr maCond; +}; + +typedef boost::shared_ptr< ConditionAtom > ConditionAtomPtr; + + +/** "choose" statements. Atoms will be tested in order. */ +class ChooseAtom + : public LayoutAtom +{ +public: + virtual ~ChooseAtom() + {} + virtual void processAtom(); +}; + +class LayoutNode + : public LayoutAtom +{ +public: + enum { + VAR_animLvl = 0, + VAR_animOne, + VAR_bulletEnabled, + VAR_chMax, + VAR_chPref, + VAR_dir, + VAR_hierBranch, + VAR_orgChart, + VAR_resizeHandles + }; + // we know that the array is of fixed size + // the use of Any allow having empty values + typedef boost::array< ::com::sun::star::uno::Any, 9 > VarMap; + + virtual ~LayoutNode() + {} + virtual void processAtom() + {} + VarMap & variables() + { return mVariables; } +private: + VarMap mVariables; + std::vector< ShapePtr > mpShapes; +}; + +typedef boost::shared_ptr< LayoutNode > LayoutNodePtr; + +} } + +#endif diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx new file mode 100644 index 000000000000..37d8804bfb62 --- /dev/null +++ b/oox/inc/oox/drawingml/drawingmltypes.hxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * 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_TYPES_HXX +#define OOX_DRAWINGML_TYPES_HXX + +#include <boost/shared_ptr.hpp> +#include <com/sun/star/style/TabAlign.hpp> +#include <com/sun/star/geometry/IntegerRectangle2D.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> + +namespace oox { +namespace drawingml { + +// ============================================================================ + +const sal_Int32 PER_PERCENT = 1000; +const sal_Int32 MAX_PERCENT = 100 * PER_PERCENT; + +const sal_Int32 PER_DEGREE = 60000; +const sal_Int32 MAX_DEGREE = 360 * PER_DEGREE; + +// ============================================================================ + +struct LineProperties; +typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr; + +struct FillProperties; +typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr; + +struct GraphicProperties; +typedef ::boost::shared_ptr< GraphicProperties > GraphicPropertiesPtr; + +struct TextCharacterProperties; +typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr; + +struct TextBodyProperties; +typedef ::boost::shared_ptr< TextBodyProperties > TextBodyPropertiesPtr; + +class TextBody; +typedef ::boost::shared_ptr< TextBody > TextBodyPtr; + +class Shape; +typedef ::boost::shared_ptr< Shape > ShapePtr; + +class Theme; +typedef ::boost::shared_ptr< Theme > ThemePtr; + +// --------------------------------------------------------------------------- + +namespace table { + +class TableProperties; +typedef ::boost::shared_ptr< TableProperties > TablePropertiesPtr; + +} // namespace table + +// ============================================================================ + +/** converts the attributes from an CT_Point2D into an awt Point with 1/100th mm */ +com::sun::star::awt::Point GetPoint2D( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes ); + +/** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */ +com::sun::star::awt::Point GetPointPercent( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ); + + +/** converts the attributes from an CT_Size2D into an awt Size with 1/100th mm */ +com::sun::star::awt::Size GetSize2D( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes ); + +/** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */ +com::sun::star::geometry::IntegerRectangle2D GetRelativeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes ); + +/** converts an emu string into 1/100th mmm but constrain as per ST_TextMargin + * see 5.1.12.73 + */ +sal_Int32 GetTextMargin( const ::rtl::OUString& sValue ); + +/** converts EMUs into 1/100th mmm */ +sal_Int32 GetCoordinate( sal_Int32 nValue ); + +/** converts an emu string into 1/100th mmm */ +sal_Int32 GetCoordinate( const ::rtl::OUString& sValue ); + +/** converts a ST_Percentage % string into 1/1000th of % */ +sal_Int32 GetPercent( const ::rtl::OUString& sValue ); + +/** Converts a ST_PositiveFixedPercentage to a float. 1.0 == 100% */ +double GetPositiveFixedPercentage( const ::rtl::OUString& sValue ); + +/** converts the ST_TextFontSize to point */ +float GetTextSize( const ::rtl::OUString& rValue ); + +/** converts the ST_TextSpacingPoint to 1/100mm */ +sal_Int32 GetTextSpacingPoint( const ::rtl::OUString& sValue ); + +/** */ +::com::sun::star::style::TabAlign GetTabAlign( ::sal_Int32 aToken ); + +float GetFontHeight( sal_Int32 nHeight ); + +sal_Int16 GetFontUnderline( sal_Int32 nToken ); + +sal_Int16 GetFontStrikeout( sal_Int32 nToken ); + +sal_Int16 GetCaseMap( sal_Int32 nToken ); + +/** converts a paragraph align to a ParaAdjust */ +sal_Int16 GetParaAdjust( sal_Int32 nAlign ); + +// ============================================================================ + +// CT_IndexRange +struct IndexRange { + sal_Int32 start; + sal_Int32 end; +}; + +/** retrieve the content of CT_IndexRange */ +IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes ); + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/embeddedwavaudiofile.hxx b/oox/inc/oox/drawingml/embeddedwavaudiofile.hxx new file mode 100644 index 000000000000..d724254b4263 --- /dev/null +++ b/oox/inc/oox/drawingml/embeddedwavaudiofile.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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_EMBEDDEDWAVAUDIOFILE_HXX +#define OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX + +#include <rtl/ustring.hxx> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> + +#include "oox/core/fragmenthandler.hxx" + +namespace oox { namespace drawingml { + + struct EmbeddedWAVAudioFile + { + EmbeddedWAVAudioFile() + : mbBuiltIn(false) + { + } + bool mbBuiltIn; + ::rtl::OUString msName; + ::rtl::OUString msEmbed; + }; + + void getEmbeddedWAVAudioFile( + const ::oox::core::Relations& rRelations, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, + EmbeddedWAVAudioFile & aAudio ); + +} } + + +#endif diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx new file mode 100644 index 000000000000..be6561c970d3 --- /dev/null +++ b/oox/inc/oox/drawingml/fillproperties.hxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * 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_FILLPROPERTIES_HXX +#define OOX_DRAWINGML_FILLPROPERTIES_HXX + +#include <map> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/geometry/IntegerRectangle2D.hpp> +#include "oox/drawingml/color.hxx" +#include "oox/helper/helper.hxx" + +namespace oox { + class ModelObjectHelper; + class PropertyMap; + class PropertySet; +} + +namespace oox { +namespace drawingml { + +// ============================================================================ + +enum FillPropertyId +{ + FillStyleId, + FillColorId, + FillTransparenceId, + FillGradientId, + FillBitmapUrlId, + FillBitmapModeId, + FillBitmapSizeXId, + FillBitmapSizeYId, + FillBitmapOffsetXId, + FillBitmapOffsetYId, + FillBitmapRectanglePointId, + FillId_END +}; + +struct FillPropertyIds +{ + const sal_Int32* mpnPropertyIds; + bool mbNamedFillGradient; + bool mbNamedFillBitmap; + + explicit FillPropertyIds( + const sal_Int32* pnPropertyIds, + bool bNamedFillGradient, + bool bNamedFillBitmap ); + + inline bool has( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; } + inline sal_Int32 operator[]( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; } +}; + +// ============================================================================ + +struct GradientFillProperties +{ + typedef ::std::map< double, Color > GradientStopMap; + + GradientStopMap maGradientStops; /// Gradient stops (colors/transparence). + OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillToRect; + OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moTileRect; + OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape. + OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients. + OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape. + OptValue< bool > moShadeScaled; /// True = scale gradient into shape. + OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const GradientFillProperties& rSourceProps ); +}; + +// ============================================================================ + +struct PatternFillProperties +{ + Color maPattFgColor; /// Pattern foreground color. + Color maPattBgColor; /// Pattern background color. + OptValue< sal_Int32 > moPattPreset; /// Preset pattern type. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const PatternFillProperties& rSourceProps ); +}; + +// ============================================================================ + +struct BlipFillProperties +{ + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > + mxGraphic; /// The fill graphic. + OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch. + OptValue< ::com::sun::star::geometry::IntegerRectangle2D > + moFillRect; /// Stretch fill offsets. + OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs). + OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs). + OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent). + OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent). + OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap. + OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles. + OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape. + // effects + OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect. + OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000]. + OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000]. + Color maColorChangeFrom; /// Start color of color transformation. + Color maColorChangeTo; /// Destination color of color transformation. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const BlipFillProperties& rSourceProps ); +}; + +// ============================================================================ + +struct FillProperties +{ + OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token). + Color maFillColor; /// Solid fill color and transparence. + GradientFillProperties maGradientProps; /// Properties for gradient fills. + PatternFillProperties maPatternProps; /// Properties for pattern fills. + BlipFillProperties maBlipProps; /// Properties for bitmap fills. + + static FillPropertyIds DEFAULT_IDS; /// Default fill property identifiers for shape fill. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const FillProperties& rSourceProps ); + + /** Tries to resolve current settings to a solid color, e.g. returns the + start color of a gradient. */ + Color getBestSolidColor() const; + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + PropertyMap& rPropMap, + const ::oox::core::FilterBase& rFilter, + ModelObjectHelper& rModelObjHelper, + const FillPropertyIds& rPropIds = DEFAULT_IDS, + sal_Int32 nShapeRotation = 0, + sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; + + /** Writes the properties to the passed property set. */ + void pushToPropSet( + PropertySet& rPropSet, + const ::oox::core::FilterBase& rFilter, + ModelObjectHelper& rModelObjHelper, + const FillPropertyIds& rPropIds = DEFAULT_IDS, + sal_Int32 nShapeRotation = 0, + sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; +}; + +// ============================================================================ + +struct GraphicProperties +{ + BlipFillProperties maBlipProps; /// Properties for the graphic. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const GraphicProperties& rSourceProps ); + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + PropertyMap& rPropMap, + const ::oox::core::FilterBase& rFilter, + sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; + + /** Writes the properties to the passed property set. */ + void pushToPropSet( + PropertySet& rPropSet, + const ::oox::core::FilterBase& rFilter, + sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx b/oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx new file mode 100644 index 000000000000..86c790795f25 --- /dev/null +++ b/oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx @@ -0,0 +1,215 @@ +/************************************************************************* + * + * 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_FILLPROPERTIESGROUPCONTEXT_HPP +#define OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP + +#include "oox/drawingml/colorchoicecontext.hxx" +#include "oox/drawingml/fillproperties.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +/** Context handler that imports the a:solidFill element. */ +class SolidFillContext : public ColorContext +{ +public: + explicit SolidFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + FillProperties& rFillProps ); +}; + +// ============================================================================ + +/** Context handler that imports the a:gradFill element. */ +class GradientFillContext : public ::oox::core::ContextHandler +{ +public: + explicit GradientFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + GradientFillProperties& rGradientProps ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + GradientFillProperties& mrGradientProps; +}; + +// ============================================================================ + +/** Context handler that imports the a:pattFill element. */ +class PatternFillContext : public ::oox::core::ContextHandler +{ +public: + explicit PatternFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + PatternFillProperties& rPatternProps ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + PatternFillProperties& mrPatternProps; +}; + +// ============================================================================ +// ============================================================================ + +/** Context handler that imports the a:clrChange element containing the colors + of a bitmap color change transformation. */ +class ColorChangeContext : public ::oox::core::ContextHandler +{ +public: + explicit ColorChangeContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + BlipFillProperties& rBlipProps ); + virtual ~ColorChangeContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + BlipFillProperties& mrBlipProps; + bool mbUseAlpha; +}; + +// ============================================================================ + +/** Context handler that imports the a:blip element containing the fill bitmap + and bitmap color transformation settings. */ +class BlipContext : public ::oox::core::ContextHandler +{ +public: + explicit BlipContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + BlipFillProperties& rBlipProps ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + BlipFillProperties& mrBlipProps; +}; + +// ============================================================================ + +/** Context handler that imports the a:blipFill element. */ +class BlipFillContext : public ::oox::core::ContextHandler +{ +public: + explicit BlipFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + BlipFillProperties& rBlipProps ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + BlipFillProperties& mrBlipProps; +}; + +// ============================================================================ +// ============================================================================ + +/** Context handler for elements that contain a fill property element + (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */ +class FillPropertiesContext : public ::oox::core::ContextHandler +{ +public: + explicit FillPropertiesContext( + ::oox::core::ContextHandler& rParent, + FillProperties& rFillProps ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > + createFillContext( + ::oox::core::ContextHandler& rParent, + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + FillProperties& rFillProps ); + +protected: + FillProperties& mrFillProps; +}; + +// ============================================================================ + +/** Context handler for elements that contain a fill property element + (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). + + This context handler takes a simple color instead of a fill properties + struct. The imported fill properties are converted automatically to the + best fitting solid color. + */ +class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext +{ +public: + explicit SimpleFillPropertiesContext( + ::oox::core::ContextHandler& rParent, + Color& rColor ); + virtual ~SimpleFillPropertiesContext(); + +protected: + Color& mrColor; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/graphicshapecontext.hxx b/oox/inc/oox/drawingml/graphicshapecontext.hxx new file mode 100644 index 000000000000..0452ed30e895 --- /dev/null +++ b/oox/inc/oox/drawingml/graphicshapecontext.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_GRAPHICSHAPECONTEXT_HXX +#define OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/shapecontext.hxx" +#include "oox/drawingml/diagram/diagram.hxx" + +namespace oox { namespace vml { struct OleObjectInfo; } } + +namespace oox { namespace drawingml { + +class GraphicShapeContext : public ShapeContext +{ +public: + GraphicShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +}; + +// ==================================================================== + +class GraphicalObjectFrameContext : public ShapeContext +{ +public: + GraphicalObjectFrameContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +}; + +// ==================================================================== + +class OleObjectGraphicDataContext : public ShapeContext +{ +public: + OleObjectGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr ); + ~OleObjectGraphicDataContext(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + ::boost::shared_ptr< ::oox::vml::OleObjectInfo > mxOleObjectInfo; +}; + +// ==================================================================== + +class DiagramGraphicDataContext + : public ShapeContext +{ +public: + DiagramGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr ); + virtual ~DiagramGraphicDataContext(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + DiagramPtr loadDiagram(); + + ::rtl::OUString msDm; + ::rtl::OUString msLo; + ::rtl::OUString msQs; + ::rtl::OUString msCs; +}; + +// ==================================================================== + +class ChartGraphicDataContext : public ShapeContext +{ +public: + explicit ChartGraphicDataContext( + ::oox::core::ContextHandler& rParent, + const ShapePtr& rxShape ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); +}; + +// ==================================================================== + +} } + +#endif // OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX diff --git a/oox/inc/oox/drawingml/guidcontext.hxx b/oox/inc/oox/drawingml/guidcontext.hxx new file mode 100644 index 000000000000..20dff63fc373 --- /dev/null +++ b/oox/inc/oox/drawingml/guidcontext.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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_GUIDCONTEXT_HXX +#define OOX_DRAWINGML_GUIDCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + + class GuidContext : public ::oox::core::ContextHandler + { + + public: + GuidContext( ::oox::core::ContextHandler& rParent, rtl::OUString& rGuidId ); + virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + + private: + + rtl::OUString& mrGuidId; + }; + +} } + +#endif diff --git a/oox/inc/oox/drawingml/lineproperties.hxx b/oox/inc/oox/drawingml/lineproperties.hxx new file mode 100644 index 000000000000..9a538db30156 --- /dev/null +++ b/oox/inc/oox/drawingml/lineproperties.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * 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_LINEPROPERTIES_HXX +#define OOX_DRAWINGML_LINEPROPERTIES_HXX + +#include "oox/drawingml/fillproperties.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +enum LinePropertyId +{ + LineStyleId, + LineWidthId, + LineColorId, + LineTransparenceId, + LineDashId, + LineJointId, + LineStartId, + LineStartWidthId, + LineStartCenterId, + LineEndId, + LineEndWidthId, + LineEndCenterId, + LineId_END +}; + +struct LinePropertyIds +{ + const sal_Int32* mpnPropertyIds; + bool mbNamedLineDash; + bool mbNamedLineMarker; + + explicit LinePropertyIds( + const sal_Int32* pnPropertyIds, + bool bNamedLineDash, + bool bNamedLineMarker ); + + inline bool has( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; } + inline sal_Int32 operator[]( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; } +}; + +// ============================================================================ + +struct LineArrowProperties +{ + OptValue< sal_Int32 > moArrowType; + OptValue< sal_Int32 > moArrowWidth; + OptValue< sal_Int32 > moArrowLength; + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const LineArrowProperties& rSourceProps ); +}; + +// ============================================================================ + +struct LineProperties +{ + typedef ::std::pair< sal_Int32, sal_Int32 > DashStop; + typedef ::std::vector< DashStop > DashStopVector; + + LineArrowProperties maStartArrow; /// Start line arrow style. + LineArrowProperties maEndArrow; /// End line arrow style. + FillProperties maLineFill; /// Line fill (solid, gradient, ...). + DashStopVector maCustomDash; /// User-defined line dash style. + OptValue< sal_Int32 > moLineWidth; /// Line width (EMUs). + OptValue< sal_Int32 > moPresetDash; /// Preset dash (OOXML token). + OptValue< sal_Int32 > moLineCompound; /// Line compound type (OOXML token). + OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token). + OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token). + + static LinePropertyIds DEFAULT_IDS; /// Default line property identifiers. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const LineProperties& rSourceProps ); + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + PropertyMap& rPropMap, + const ::oox::core::FilterBase& rFilter, + ModelObjectHelper& rModelObjHelper, + const LinePropertyIds& rPropIds = DEFAULT_IDS, + sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; + + /** Writes the properties to the passed property map. */ + void pushToPropSet( + PropertySet& rPropSet, + const ::oox::core::FilterBase& rFilter, + ModelObjectHelper& rModelObjHelper, + const LinePropertyIds& rPropIds = DEFAULT_IDS, + sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/linepropertiescontext.hxx b/oox/inc/oox/drawingml/linepropertiescontext.hxx new file mode 100644 index 000000000000..617e3fa67c93 --- /dev/null +++ b/oox/inc/oox/drawingml/linepropertiescontext.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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_LINEPROPERTIESCONTEXT_HXX +#define OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +// --------------------------------------------------------------------- + +struct LineProperties; + +class LinePropertiesContext : public ::oox::core::ContextHandler +{ +public: + LinePropertiesContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, + LineProperties& rLineProperties ) throw(); + ~LinePropertiesContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + LineProperties& mrLineProperties; +}; + +} } + +#endif // OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/objectdefaultcontext.hxx b/oox/inc/oox/drawingml/objectdefaultcontext.hxx new file mode 100644 index 000000000000..b572637ec047 --- /dev/null +++ b/oox/inc/oox/drawingml/objectdefaultcontext.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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_OBJECTDEFAULTCONTEXT_HXX +#define OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +class Theme; + +class objectDefaultContext : public oox::core::ContextHandler +{ +public: + objectDefaultContext( ::oox::core::ContextHandler& rParent, Theme& rTheme ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + Theme& mrTheme; +}; + +} } + +#endif // OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx new file mode 100644 index 000000000000..b6c015f73938 --- /dev/null +++ b/oox/inc/oox/drawingml/shape.hxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * 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_SHAPE_HXX +#define OOX_DRAWINGML_SHAPE_HXX + +#include "oox/helper/propertymap.hxx" +#include "oox/drawingml/drawingmltypes.hxx" +#include "oox/drawingml/customshapeproperties.hxx" +#include "oox/drawingml/textliststyle.hxx" + +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> +#include <vector> +#include <map> + +namespace oox { namespace drawingml { + +typedef ::std::map< ::rtl::OUString, ShapePtr > ShapeIdMap; + +struct ShapeStyleRef +{ + Color maPhClr; + sal_Int32 mnThemedIdx; +}; + +typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap; + +// ============================================================================ + +/** A callback that will be called before and after the API shape is created + from the imported shape. + + An instance of a derived class of this callback can be set at every + ::oox::drawingml::Shape instance to implement anything that needs a created + and inserted XShape. + */ +class CreateShapeCallback +{ +public: + virtual ::rtl::OUString onCreateXShape( + const ::rtl::OUString& rServiceName, + const ::com::sun::star::awt::Rectangle& rShapeRect ); + + virtual void onXShapeCreated( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ) const; + + inline const PropertyMap& getShapeProperties() const { return maShapeProps; } + +protected: + explicit CreateShapeCallback( ::oox::core::XmlFilterBase& rFilter ); + virtual ~CreateShapeCallback(); + +protected: + ::oox::core::XmlFilterBase& mrFilter; + PropertyMap maShapeProps; +}; + +typedef ::boost::shared_ptr< CreateShapeCallback > CreateShapeCallbackRef; + +// ============================================================================ + +class Shape + : public boost::enable_shared_from_this< Shape > +{ +public: + + Shape( const sal_Char* pServiceType = NULL ); + virtual ~Shape(); + + rtl::OUString& getServiceName(){ return msServiceName; } + void setServiceName( const sal_Char* pServiceName ); + + PropertyMap& getShapeProperties(){ return maShapeProperties; } + + inline LineProperties& getLineProperties() { return *mpLinePropertiesPtr; } + inline const LineProperties& getLineProperties() const { return *mpLinePropertiesPtr; } + + inline FillProperties& getFillProperties() { return *mpFillPropertiesPtr; } + inline const FillProperties& getFillProperties() const { return *mpFillPropertiesPtr; } + + inline GraphicProperties& getGraphicProperties() { return *mpGraphicPropertiesPtr; } + inline const GraphicProperties& getGraphicProperties() const { return *mpGraphicPropertiesPtr; } + + CustomShapePropertiesPtr getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; } + + table::TablePropertiesPtr getTableProperties(); + + void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; } + void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; } + void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; } + void setFlip( sal_Bool bFlipH, sal_Bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; } + void addChild( const ShapePtr pChildPtr ) { maChildren.push_back( pChildPtr ); } + std::vector< ShapePtr >& getChildren() { return maChildren; } + + void setName( const rtl::OUString& rName ) { msName = rName; } + ::rtl::OUString getName( ) { return msName; } + void setId( const rtl::OUString& rId ) { msId = rId; } + void setSubType( sal_uInt32 nSubType ) { mnSubType = nSubType; } + sal_Int32 getSubType() const { return mnSubType; } + void setIndex( sal_uInt32 nIndex ) { mnIndex = nIndex; } + + // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value) + void setDefaults(); + + void setTextBody(const TextBodyPtr & pTextBody); + TextBodyPtr getTextBody(); + void setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle ); + TextListStylePtr getMasterTextListStyle() const { return mpMasterTextListStyle; } + + inline ShapeStyleRefMap& getShapeStyleRefs() { return maShapeStyleRefs; } + inline const ShapeStyleRefMap& getShapeStyleRefs() const { return maShapeStyleRefs; } + const ShapeStyleRef* getShapeStyleRef( sal_Int32 nRefType ) const; + + inline void setCreateShapeCallback( CreateShapeCallbackRef xCallback ) { mxCreateCallback = xCallback; } + + // addShape is creating and inserting the corresponding XShape. + void addShape( + const oox::core::XmlFilterBase& rFilterBase, + const ThemePtr& rxTheme, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle* pShapeRect = 0, + ShapeIdMap* pShapeMap = 0 ); + + void setXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape ) + { mxShape = rXShape; }; + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & + getXShape() const { return mxShape; } + + virtual void applyShapeReference( const Shape& rReferencedShape ); + +protected: + + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + createAndInsert( + const ::oox::core::XmlFilterBase& rFilterBase, + const ::rtl::OUString& rServiceName, + const ThemePtr& rxTheme, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle* pShapeRect, + sal_Bool bClearText ); + + void addChildren( + const ::oox::core::XmlFilterBase& rFilterBase, + Shape& rMaster, + const ThemePtr& rxTheme, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rClientRect, + ShapeIdMap* pShapeMap ); + + std::vector< ShapePtr > maChildren; // only used for group shapes + TextBodyPtr mpTextBody; + LinePropertiesPtr mpLinePropertiesPtr; + FillPropertiesPtr mpFillPropertiesPtr; + GraphicPropertiesPtr mpGraphicPropertiesPtr; + CustomShapePropertiesPtr mpCustomShapePropertiesPtr; + table::TablePropertiesPtr mpTablePropertiesPtr; + PropertyMap maShapeProperties; + TextListStylePtr mpMasterTextListStyle; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape; + + rtl::OUString msServiceName; + rtl::OUString msName; + rtl::OUString msId; + sal_uInt32 mnSubType; // if this type is not zero, then the shape is a placeholder + sal_uInt32 mnIndex; + + ShapeStyleRefMap maShapeStyleRefs; + + com::sun::star::awt::Size maSize; + com::sun::star::awt::Point maPosition; + +private: + CreateShapeCallbackRef mxCreateCallback; + sal_Int32 mnRotation; + sal_Bool mbFlipH; + sal_Bool mbFlipV; +}; + +::rtl::OUString GetShapeType( sal_Int32 nType ); + +} } + +#endif // OOX_DRAWINGML_SHAPE_HXX diff --git a/oox/inc/oox/drawingml/shapecontext.hxx b/oox/inc/oox/drawingml/shapecontext.hxx new file mode 100644 index 000000000000..68ef45ac92cc --- /dev/null +++ b/oox/inc/oox/drawingml/shapecontext.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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_SHAPECONTEXT_HXX +#define OOX_DRAWINGML_SHAPECONTEXT_HXX + +#include <com/sun/star/drawing/XShapes.hpp> + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/shapepropertiescontext.hxx" + +namespace oox { namespace drawingml { + +class ShapeContext : public ::oox::core::ContextHandler +{ +public: + ShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr ); + virtual ~ShapeContext(); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + + ShapePtr getShape(); + +protected: + + ShapePtr mpMasterShapePtr; + ShapePtr mpShapePtr; +}; + +} } + +#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/shapegroupcontext.hxx b/oox/inc/oox/drawingml/shapegroupcontext.hxx new file mode 100644 index 000000000000..681c527c0635 --- /dev/null +++ b/oox/inc/oox/drawingml/shapegroupcontext.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_SHAPEGROUPCONTEXT_HXX +#define OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/shapecontext.hxx" + +namespace oox { namespace drawingml { + +class ShapeGroupContext : public ::oox::core::ContextHandler +{ +public: + ShapeGroupContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr ); + virtual ~ShapeGroupContext(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + + ShapePtr mpGroupShapePtr; + ShapePtr mpMasterShapePtr; +}; + +} } + +#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/shapepropertiescontext.hxx b/oox/inc/oox/drawingml/shapepropertiescontext.hxx new file mode 100644 index 000000000000..8cb4a3276918 --- /dev/null +++ b/oox/inc/oox/drawingml/shapepropertiescontext.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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_SHAPEPROPERTIESCONTEXT_HXX +#define OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/shape.hxx" + +namespace oox { namespace drawingml { + +class ShapePropertiesContext : public ::oox::core::ContextHandler +{ +public: + ShapePropertiesContext( ::oox::core::ContextHandler& rParent, Shape& rShape ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + Shape& mrShape; +}; + +} } + +#endif // OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/shapestylecontext.hxx b/oox/inc/oox/drawingml/shapestylecontext.hxx new file mode 100644 index 000000000000..71fc8b33b7c6 --- /dev/null +++ b/oox/inc/oox/drawingml/shapestylecontext.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_SHAPESTYLECONTEXT_HXX +#define OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +class ShapeStyleContext : public ::oox::core::ContextHandler +{ +public: + ShapeStyleContext( ::oox::core::ContextHandler& rParent, Shape& rShape ); + ~ShapeStyleContext(); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + Shape& mrShape; +}; + +} } + +#endif // OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX diff --git a/oox/inc/oox/drawingml/spdefcontext.hxx b/oox/inc/oox/drawingml/spdefcontext.hxx new file mode 100644 index 000000000000..dced46eaa700 --- /dev/null +++ b/oox/inc/oox/drawingml/spdefcontext.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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_SPDEFCONTEXT_HXX +#define OOX_DRAWINGML_SPDEFCONTEXT_HXX + +#include "oox/drawingml/shape.hxx" +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +class spDefContext : public oox::core::ContextHandler +{ +public: + spDefContext( ::oox::core::ContextHandler& rParent, Shape& rDefaultObject ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + Shape& mrDefaultObject; +}; + +} } + +#endif // OOX_DRAWINGML_SPDEFCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/table/tablebackgroundstylecontext.hxx b/oox/inc/oox/drawingml/table/tablebackgroundstylecontext.hxx new file mode 100644 index 000000000000..541fc2333234 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablebackgroundstylecontext.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_TABLEBACKGROUNDSTYLECONTEXT +#define OOX_DRAWINGML_TABLEBACKGROUNDSTYLECONTEXT + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/table/tablestyle.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableBackgroundStyleContext : public ::oox::core::ContextHandler +{ +public: + TableBackgroundStyleContext( ::oox::core::ContextHandler& rParent, TableStyle& rTableStyle ); + ~TableBackgroundStyleContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableStyle& mrTableStyle; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/table/tablecell.hxx b/oox/inc/oox/drawingml/table/tablecell.hxx new file mode 100644 index 000000000000..cf70e1d155c0 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablecell.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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_TABLECELL_HXX +#define OOX_DRAWINGML_TABLECELL_HXX + +#include "oox/helper/propertymap.hxx" +#include "oox/drawingml/color.hxx" +#include "oox/drawingml/drawingmltypes.hxx" +#include "oox/drawingml/lineproperties.hxx" +#include "oox/drawingml/fillproperties.hxx" +#include "oox/drawingml/textliststyle.hxx" +#include <com/sun/star/table/XCell.hpp> + +#include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> +#include <vector> +#include <map> + +namespace oox { namespace drawingml { namespace table { + +class TableCellContext; +class TableProperties; +class TableStyle; + +class TableCell +{ + friend class TableCellContext; + +public: + + TableCell(); + ~TableCell(); + + sal_Int32 getRowSpan() const { return mnRowSpan; }; + void setRowSpan( sal_Int32 nRowSpan ){ mnRowSpan = nRowSpan; }; + sal_Int32 getGridSpan() const { return mnGridSpan; }; + void setGridSpan( sal_Int32 nGridSpan ){ mnGridSpan = nGridSpan; }; + sal_Bool gethMerge() const { return mbhMerge; }; + void sethMerge( sal_Bool bhMerge ){ mbhMerge = bhMerge; }; + sal_Bool getvMerge() const { return mbvMerge; }; + void setvMerge( sal_Bool bvMerge ){ mbvMerge = bvMerge; }; + sal_Int32 getLeftMargin() const { return mnMarL; }; + void setLeftMargin( sal_Int32 nMargin ){ mnMarL = nMargin; }; + sal_Int32 getRightMargin() const { return mnMarR; }; + void setRightMargin( sal_Int32 nMargin ){ mnMarR = nMargin; }; + sal_Int32 getTopMargin() const { return mnMarT; }; + void setTopMargin( sal_Int32 nMargin ){ mnMarT = nMargin; }; + sal_Int32 getBottomMargin() const { return mnMarB; }; + void setBottomMargin( sal_Int32 nMargin ){ mnMarB = nMargin; }; + sal_Int32 getVertToken() const { return mnVertToken; }; + void setVertToken( sal_Int32 nToken ){ mnVertToken = nToken; }; + sal_Int32 getAnchorToken() const { return mnAnchorToken; }; + void setAnchorToken( sal_Int32 nToken ){ mnAnchorToken = nToken; }; + sal_Bool getAnchorCtr() const { return mbAnchorCtr; }; + void setAnchorCtr( sal_Bool bAnchorCtr ){ mbAnchorCtr = bAnchorCtr; }; + sal_Int32 getHorzOverflowToken() const { return mnHorzOverflowToken; }; + void setHorzOverflowToken( sal_Int32 nToken ){ mnHorzOverflowToken = nToken; }; + + void setTextBody( const oox::drawingml::TextBodyPtr& pTextBody ){ mpTextBody = pTextBody; }; + oox::drawingml::TextBodyPtr getTextBody(){ return mpTextBody; }; + + void pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle, + const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties, + const TableStyle& rTable, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow ); + +private: + + oox::drawingml::TextBodyPtr mpTextBody; + + oox::drawingml::LineProperties maLinePropertiesLeft; + oox::drawingml::LineProperties maLinePropertiesRight; + oox::drawingml::LineProperties maLinePropertiesTop; + oox::drawingml::LineProperties maLinePropertiesBottom; + oox::drawingml::LineProperties maLinePropertiesTopLeftToBottomRight; + oox::drawingml::LineProperties maLinePropertiesBottomLeftToTopRight; + + oox::drawingml::FillProperties maFillProperties; + + sal_Int32 mnRowSpan; + sal_Int32 mnGridSpan; + sal_Bool mbhMerge; + sal_Bool mbvMerge; + + sal_Int32 mnMarL; + sal_Int32 mnMarR; + sal_Int32 mnMarT; + sal_Int32 mnMarB; + sal_Int32 mnVertToken; + sal_Int32 mnAnchorToken; + sal_Bool mbAnchorCtr; + sal_Int32 mnHorzOverflowToken; +}; + +} } } + +#endif // OOX_DRAWINGML_TABLECELL_HXX diff --git a/oox/inc/oox/drawingml/table/tablecellcontext.hxx b/oox/inc/oox/drawingml/table/tablecellcontext.hxx new file mode 100644 index 000000000000..02ab8d93ff76 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablecellcontext.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_TABLECELLCONTEXT +#define OOX_DRAWINGML_TABLECELLCONTEXT + +#include "oox/drawingml/shapecontext.hxx" +#include "oox/drawingml/table/tablecell.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableCellContext : public ::oox::core::ContextHandler +{ +public: + TableCellContext( ::oox::core::ContextHandler& rParent, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableCell& rTableCell ); + ~TableCellContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableCell& mrTableCell; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/table/tablecontext.hxx b/oox/inc/oox/drawingml/table/tablecontext.hxx new file mode 100644 index 000000000000..727bf66b4185 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablecontext.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_TABLECONTEXT +#define OOX_DRAWINGML_TABLECONTEXT + +#include "oox/drawingml/shapecontext.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableProperties; + +class TableContext : public ShapeContext +{ +public: + TableContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr ); + ~TableContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableProperties& mrTableProperties; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/table/tablepartstylecontext.hxx b/oox/inc/oox/drawingml/table/tablepartstylecontext.hxx new file mode 100644 index 000000000000..902e1ad79f89 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablepartstylecontext.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_TABLEPARTSTYLECONTEXT +#define OOX_DRAWINGML_TABLEPARTSTYLECONTEXT + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/table/tablestylepart.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TablePartStyleContext : public ::oox::core::ContextHandler +{ +public: + TablePartStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart ); + ~TablePartStyleContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableStylePart& mrTableStylePart; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/table/tableproperties.hxx b/oox/inc/oox/drawingml/table/tableproperties.hxx new file mode 100644 index 000000000000..83793709da7c --- /dev/null +++ b/oox/inc/oox/drawingml/table/tableproperties.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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_TABLEPROPERTIES_HXX +#define OOX_DRAWINGML_TABLEPROPERTIES_HXX + +#include "oox/drawingml/table/tablerow.hxx" +#include "oox/drawingml/table/tablestyle.hxx" +#include "oox/helper/propertymap.hxx" +#include "oox/drawingml/color.hxx" + +#include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> +#include <vector> +#include <map> + +namespace oox { namespace drawingml { namespace table { + +class TableProperties +{ +public: + + TableProperties(); + ~TableProperties(); + + std::vector< sal_Int32 >& getTableGrid() { return mvTableGrid; }; + std::vector< TableRow >& getTableRows() { return mvTableRows; }; + + rtl::OUString& getStyleId(){ return maStyleId; }; + boost::shared_ptr< TableStyle >& getTableStyle(){ return mpTableStyle; }; + sal_Bool& isRtl(){ return mbRtl; }; + sal_Bool& isFirstRow(){ return mbFirstRow; }; + sal_Bool& isFirstCol(){ return mbFirstCol; }; + sal_Bool& isLastRow(){ return mbLastRow; }; + sal_Bool& isLastCol(){ return mbLastCol; }; + sal_Bool& isBandRow(){ return mbBandRow; }; + sal_Bool& isBandCol(){ return mbBandCol; }; + + void apply( const TablePropertiesPtr& ); + void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase, + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, ::oox::drawingml::TextListStylePtr pMasterTextListStyle ); + +private: + + const TableStyle& getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase ); + + rtl::OUString maStyleId; // either StyleId is available + boost::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle + std::vector< sal_Int32 > mvTableGrid; + std::vector< TableRow > mvTableRows; + + sal_Bool mbRtl; + sal_Bool mbFirstRow; + sal_Bool mbFirstCol; + sal_Bool mbLastRow; + sal_Bool mbLastCol; + sal_Bool mbBandRow; + sal_Bool mbBandCol; +}; + +} } } + +#endif // OOX_DRAWINGML_TABLEPROPERTIES_HXX diff --git a/oox/inc/oox/drawingml/table/tablerow.hxx b/oox/inc/oox/drawingml/table/tablerow.hxx new file mode 100644 index 000000000000..4ef12f3002ea --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablerow.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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_TABLEROW_HXX +#define OOX_DRAWINGML_TABLEROW_HXX + +#include "oox/drawingml/table/tablecell.hxx" +#include <vector> + +namespace oox { namespace drawingml { namespace table { + +class TableRow +{ +public: + + TableRow(); + ~TableRow(); + + void setHeight( sal_Int32 nHeight ){ mnHeight = nHeight; }; + sal_Int32 getHeight() const { return mnHeight; }; + std::vector< TableCell >& getTableCells() { return mvTableCells; }; + +private: + + sal_Int32 mnHeight; + std::vector< TableCell > mvTableCells; +}; + +} } } + +#endif // OOX_DRAWINGML_TABLEROW_HXX diff --git a/oox/inc/oox/drawingml/table/tablerowcontext.hxx b/oox/inc/oox/drawingml/table/tablerowcontext.hxx new file mode 100644 index 000000000000..f6cd981ddaed --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablerowcontext.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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_TABLEROWCONTEXT +#define OOX_DRAWINGML_TABLEROWCONTEXT + +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableRow; + +class TableRowContext : public ::oox::core::ContextHandler +{ +public: + TableRowContext( ::oox::core::ContextHandler& rParent, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableRow& rTableRow ); + ~TableRowContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableRow& mrTableRow; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/table/tablestyle.hxx b/oox/inc/oox/drawingml/table/tablestyle.hxx new file mode 100644 index 000000000000..4fb71d6ad5e0 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablestyle.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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_TABLESTYLE_HXX +#define OOX_DRAWINGML_TABLESTYLE_HXX + +#include "oox/drawingml/table/tablestylepart.hxx" +#include "oox/drawingml/drawingmltypes.hxx" +#include "oox/drawingml/shape.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableStyle +{ +public: + + TableStyle(); + ~TableStyle(); + + rtl::OUString& getStyleId(){ return maStyleId; } + rtl::OUString& getStyleName() { return maStyleName; } + + ::oox::drawingml::ShapeStyleRef& getBackgroundFillStyleRef(){ return maFillStyleRef; } + + ::oox::drawingml::FillPropertiesPtr& getBackgroundFillProperties(){ return mpFillProperties; } + + TableStylePart& getWholeTbl() { return maWholeTbl; } + TableStylePart& getBand1H() { return maBand1H; } + TableStylePart& getBand2H() { return maBand2H; } + TableStylePart& getBand1V() { return maBand1V; } + TableStylePart& getBand2V() { return maBand2V; } + TableStylePart& getLastCol() { return maLastCol; } + TableStylePart& getFirstCol() { return maFirstCol; } + TableStylePart& getLastRow() { return maLastRow; } + TableStylePart& getSeCell() { return maSeCell; } + TableStylePart& getSwCell() { return maSwCell; } + TableStylePart& getFirstRow() { return maFirstRow; } + TableStylePart& getNeCell() { return maNeCell; } + TableStylePart& getNwCell() { return maNwCell; } + +private: + + rtl::OUString maStyleId; + rtl::OUString maStyleName; + + ::oox::drawingml::ShapeStyleRef maFillStyleRef; + + ::oox::drawingml::FillPropertiesPtr mpFillProperties; + + TableStylePart maWholeTbl; + TableStylePart maBand1H; + TableStylePart maBand2H; + TableStylePart maBand1V; + TableStylePart maBand2V; + TableStylePart maLastCol; + TableStylePart maFirstCol; + TableStylePart maLastRow; + TableStylePart maSeCell; + TableStylePart maSwCell; + TableStylePart maFirstRow; + TableStylePart maNeCell; + TableStylePart maNwCell; +}; + +} } } + +#endif // OOX_DRAWINGML_TABLESTYLE_HXX diff --git a/oox/inc/oox/drawingml/table/tablestylecellstylecontext.hxx b/oox/inc/oox/drawingml/table/tablestylecellstylecontext.hxx new file mode 100644 index 000000000000..e63a7754845e --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablestylecellstylecontext.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_TABLESTYLECELLSTYLECONTEXT +#define OOX_DRAWINGML_TABLESTYLECELLSTYLECONTEXT + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/table/tablestylepart.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableStyleCellStyleContext : public ::oox::core::ContextHandler +{ +public: + TableStyleCellStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart ); + ~TableStyleCellStyleContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableStylePart& mrTableStylePart; + sal_Int32 mnLineType; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/table/tablestylecontext.hxx b/oox/inc/oox/drawingml/table/tablestylecontext.hxx new file mode 100644 index 000000000000..8e464b2b2744 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablestylecontext.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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_TABLESTYLECONTEXT +#define OOX_DRAWINGML_TABLESTYLECONTEXT + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/table/tablestyle.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableStyleContext : public ::oox::core::ContextHandler +{ +public: + TableStyleContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs, + TableStyle& rTableStyle ); + ~TableStyleContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableStyle& mrTableStyle; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/table/tablestylelist.hxx b/oox/inc/oox/drawingml/table/tablestylelist.hxx new file mode 100644 index 000000000000..ea82fcdc4b28 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablestylelist.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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_TABLESTYLELIST_HXX +#define OOX_DRAWINGML_TABLESTYLELIST_HXX + +#include <rtl/ustring.hxx> +#include <boost/shared_ptr.hpp> +#include <vector> + +namespace oox { namespace drawingml { namespace table { + +class TableStyle; + +class TableStyleList +{ +public: + + TableStyleList(); + ~TableStyleList(); + + rtl::OUString& getDefaultStyleId() { return maDefaultStyleId; }; + std::vector< TableStyle >& getTableStyles(){ return maTableStyles; }; + +private: + + rtl::OUString maDefaultStyleId; + std::vector< TableStyle > maTableStyles; + +}; + +typedef boost::shared_ptr< TableStyleList > TableStyleListPtr; + +} } } + +#endif // OOX_DRAWINGML_TABLESTYLELIST_HXX diff --git a/oox/inc/oox/drawingml/table/tablestylelistfragmenthandler.hxx b/oox/inc/oox/drawingml/table/tablestylelistfragmenthandler.hxx new file mode 100644 index 000000000000..7142f395d041 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablestylelistfragmenthandler.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_TABLESTYLELISTFRAGMENTHANDLER_HXX +#define OOX_DRAWINGML_TABLESTYLELISTFRAGMENTHANDLER_HXX + +#include "oox/drawingml/table/tablestylelist.hxx" +#include "oox/core/fragmenthandler2.hxx" + +namespace oox { +namespace drawingml { +namespace table { + +// ============================================================================ + +class TableStyleListFragmentHandler : public ::oox::core::FragmentHandler2 +{ +public: + explicit TableStyleListFragmentHandler( + ::oox::core::XmlFilterBase& rFilter, + const ::rtl::OUString& rFragmentPath, + TableStyleList& rTableStyleList ); + virtual ~TableStyleListFragmentHandler(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableStyleList& mrTableStyleList; +}; + +// ============================================================================ + +} // namespace table +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/table/tablestylepart.hxx b/oox/inc/oox/drawingml/table/tablestylepart.hxx new file mode 100644 index 000000000000..aebdd0245516 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablestylepart.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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_TABLESTYLEPART_HXX +#define OOX_DRAWINGML_TABLESTYLEPART_HXX + +#include <rtl/ustring.hxx> +#include <boost/optional.hpp> +#include "oox/drawingml/color.hxx" +#include "oox/drawingml/textfont.hxx" +#include "oox/drawingml/fillproperties.hxx" +#include "oox/drawingml/lineproperties.hxx" +#include "oox/drawingml/shape.hxx" +#include <map> + +namespace oox { namespace drawingml { namespace table { + +class TableStylePart +{ +public: + + TableStylePart(); + ~TableStylePart(); + + ::oox::drawingml::Color& getTextColor(){ return maTextColor; } + ::boost::optional< sal_Bool >& getTextBoldStyle(){ return maTextBoldStyle; } + ::boost::optional< sal_Bool >& getTextItalicStyle(){ return maTextItalicStyle; } + ::oox::drawingml::TextFont& getAsianFont(){ return maAsianFont; } + ::oox::drawingml::TextFont& getComplexFont(){ return maComplexFont; } + ::oox::drawingml::TextFont& getSymbolFont(){ return maSymbolFont; } + ::oox::drawingml::TextFont& getLatinFont(){ return maLatinFont; } + + ::oox::drawingml::FillPropertiesPtr& getFillProperties(){ return mpFillProperties; } + std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& getLineBorders(){ return maLineBorders; } + + ::oox::drawingml::ShapeStyleRefMap& getStyleRefs(){ return maStyleRefs; } + +private: + + ::oox::drawingml::Color maTextColor; + ::boost::optional< sal_Bool > maTextBoldStyle; + ::boost::optional< sal_Bool > maTextItalicStyle; + ::oox::drawingml::TextFont maAsianFont; + ::oox::drawingml::TextFont maComplexFont; + ::oox::drawingml::TextFont maSymbolFont; + ::oox::drawingml::TextFont maLatinFont; + + ::oox::drawingml::FillPropertiesPtr mpFillProperties; + std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr > maLineBorders; + ::oox::drawingml::ShapeStyleRefMap maStyleRefs; +}; + +} } } + +#endif // OOX_DRAWINGML_TABLESTYLEPART_HXX diff --git a/oox/inc/oox/drawingml/table/tablestyletextstylecontext.hxx b/oox/inc/oox/drawingml/table/tablestyletextstylecontext.hxx new file mode 100644 index 000000000000..cf66d93c8738 --- /dev/null +++ b/oox/inc/oox/drawingml/table/tablestyletextstylecontext.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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_TABLESTYLETEXTSTYLECONTEXT +#define OOX_DRAWINGML_TABLESTYLETEXTSTYLECONTEXT + +#include "oox/core/contexthandler.hxx" +#include "oox/drawingml/table/tablestylepart.hxx" + +namespace oox { namespace drawingml { namespace table { + +class TableStyleTextStyleContext : public ::oox::core::ContextHandler +{ +public: + TableStyleTextStyleContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs, + TableStylePart& rTableStylePart ); + ~TableStyleTextStyleContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + + TableStylePart& mrTableStylePart; +}; + +} } } + + +#endif diff --git a/oox/inc/oox/drawingml/textbody.hxx b/oox/inc/oox/drawingml/textbody.hxx new file mode 100644 index 000000000000..a2eb6106e651 --- /dev/null +++ b/oox/inc/oox/drawingml/textbody.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_TEXTBODY_HXX +#define OOX_DRAWINGML_TEXTBODY_HXX + +#include "oox/helper/containerhelper.hxx" +#include "oox/drawingml/textbodyproperties.hxx" +#include "oox/drawingml/textliststyle.hxx" + +namespace com { namespace sun { namespace star { + namespace text { class XText; } + namespace text { class XTextCursor; } +} } } + +namespace oox { namespace core { class XmlFilterBase; } } + +namespace oox { namespace drawingml { + +class TextParagraph; +typedef RefVector< TextParagraph > TextParagraphVector; + +class TextBody +{ +public: + TextBody(); + ~TextBody(); + + inline const TextParagraphVector& getParagraphs() const { return maParagraphs; } + TextParagraph& addParagraph(); + + inline const TextListStyle& getTextListStyle() const { return maTextListStyle; } + inline TextListStyle& getTextListStyle() { return maTextListStyle; } + + inline const TextBodyProperties& getTextProperties() const { return maTextProperties; } + inline TextBodyProperties& getTextProperties() { return maTextProperties; } + + /** insert the text body at the text cursor */ + void insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > & xAt, + const TextCharacterProperties& rTextStyleProperties, + const TextListStylePtr& pMasterTextListStyle ) const; +protected: + TextParagraphVector maParagraphs; + TextBodyProperties maTextProperties; + TextListStyle maTextListStyle; +}; + +} } + +#endif // OOX_DRAWINGML_TEXTBODY_HXX diff --git a/oox/inc/oox/drawingml/textbodycontext.hxx b/oox/inc/oox/drawingml/textbodycontext.hxx new file mode 100644 index 000000000000..acb12bffdac7 --- /dev/null +++ b/oox/inc/oox/drawingml/textbodycontext.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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_TEXTBODYCONTEXT_HXX +#define OOX_DRAWINGML_TEXTBODYCONTEXT_HXX + +#include <com/sun/star/text/XText.hpp> + +#include "oox/drawingml/textbody.hxx" +#include "oox/drawingml/textrun.hxx" +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +class TextBodyContext : public ::oox::core::ContextHandler +{ +public: + TextBodyContext( ::oox::core::ContextHandler& rParent, TextBody& rTextBody ); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + TextBody& mrTextBody; + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxText; +}; + +// CT_RegularTextRun +class RegularTextRunContext : public ::oox::core::ContextHandler +{ +public: + RegularTextRunContext( ::oox::core::ContextHandler& rParent, TextRunPtr pRunPtr ); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + TextRunPtr mpRunPtr; + bool mbIsInText; +}; + +} } + +#endif // OOX_DRAWINGML_TEXTBODYCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/textbodyproperties.hxx b/oox/inc/oox/drawingml/textbodyproperties.hxx new file mode 100644 index 000000000000..7b17c561e286 --- /dev/null +++ b/oox/inc/oox/drawingml/textbodyproperties.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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_TEXTBODYPROPERTIES_HXX +#define OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX + +#include "oox/helper/helper.hxx" +#include "oox/helper/propertymap.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +struct TextBodyProperties +{ + PropertyMap maPropertyMap; + OptValue< sal_Int32 > moRotation; + OptValue< sal_Int32 > moVert; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/textbodypropertiescontext.hxx b/oox/inc/oox/drawingml/textbodypropertiescontext.hxx new file mode 100644 index 000000000000..ec51d6da2b2f --- /dev/null +++ b/oox/inc/oox/drawingml/textbodypropertiescontext.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_TEXTBODYPROPERTIESCONTEXT_HXX +#define OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +struct TextBodyProperties; + +class TextBodyPropertiesContext : public ::oox::core::ContextHandler +{ +public: + TextBodyPropertiesContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, + TextBodyProperties& rTextBodyProp ); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + TextBodyProperties& mrTextBodyProp; +}; + +} } + +#endif // OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/textcharacterproperties.hxx b/oox/inc/oox/drawingml/textcharacterproperties.hxx new file mode 100644 index 000000000000..81cd95dddff2 --- /dev/null +++ b/oox/inc/oox/drawingml/textcharacterproperties.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_TEXTCHARACTERPROPERTIES_HXX +#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX + +#include "oox/helper/helper.hxx" +#include "oox/helper/propertymap.hxx" +#include "oox/drawingml/color.hxx" +#include "oox/drawingml/textfont.hxx" + +namespace oox { class PropertySet; } + +namespace oox { +namespace drawingml { + +// ============================================================================ + +struct TextCharacterProperties +{ + PropertyMap maHyperlinkPropertyMap; + TextFont maLatinFont; + TextFont maAsianFont; + TextFont maComplexFont; + TextFont maSymbolFont; + Color maCharColor; + Color maUnderlineColor; + Color maHighlightColor; + OptValue< ::rtl::OUString > moLang; + OptValue< sal_Int32 > moHeight; + OptValue< sal_Int32 > moUnderline; + OptValue< sal_Int32 > moStrikeout; + OptValue< sal_Int32 > moCaseMap; + OptValue< bool > moBold; + OptValue< bool > moItalic; + OptValue< bool > moUnderlineLineFollowText; + OptValue< bool > moUnderlineFillFollowText; + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const TextCharacterProperties& rSourceProps ); + + /** Returns the current character size. If possible the masterstyle should + have been applied before, otherwise the character size can be zero and + the default value is returned. */ + float getCharHeightPoints( float fDefault ) const; + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + PropertyMap& rPropMap, + const ::oox::core::XmlFilterBase& rFilter ) const; + + /** Writes the properties to the passed property set. */ + void pushToPropSet( + PropertySet& rPropSet, + const ::oox::core::XmlFilterBase& rFilter ) const; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/textcharacterpropertiescontext.hxx b/oox/inc/oox/drawingml/textcharacterpropertiescontext.hxx new file mode 100644 index 000000000000..0d45c7c19f2b --- /dev/null +++ b/oox/inc/oox/drawingml/textcharacterpropertiescontext.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_TEXTCHARACTERPROPERTIESCONTEXT_HXX +#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +struct TextCharacterProperties; + +class TextCharacterPropertiesContext : public ::oox::core::ContextHandler +{ +public: + TextCharacterPropertiesContext( ::oox::core::ContextHandler& rParent, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes, + TextCharacterProperties& rTextCharacterProperties ); + virtual ~TextCharacterPropertiesContext(); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + TextCharacterProperties& mrTextCharacterProperties; +}; + +} } + +#endif // OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/textfield.hxx b/oox/inc/oox/drawingml/textfield.hxx new file mode 100644 index 000000000000..a1a0ab49c141 --- /dev/null +++ b/oox/inc/oox/drawingml/textfield.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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_TEXTFIELD_HXX +#define OOX_DRAWINGML_TEXTFIELD_HXX + +#include <boost/shared_ptr.hpp> + +#include "oox/drawingml/textrun.hxx" +#include "oox/drawingml/textparagraphproperties.hxx" + +namespace oox { namespace drawingml { + +struct TextCharacterProperties; + +class TextField + : public TextRun +{ +public: + TextField(); + + inline TextParagraphProperties& getTextParagraphProperties() { return maTextParagraphProperties; } + inline const TextParagraphProperties& getTextParagraphProperties() const { return maTextParagraphProperties; } + + inline void setType( const ::rtl::OUString& sType ) { msType = sType; } + inline void setUuid( const ::rtl::OUString & sUuid ) { msUuid = sUuid; } + + virtual void insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt, + const TextCharacterProperties& rTextCharacterStyle ) const; + +private: + TextParagraphProperties maTextParagraphProperties; + ::rtl::OUString msType; + ::rtl::OUString msUuid; +}; + +typedef boost::shared_ptr< TextField > TextFieldPtr; + +} } + +#endif diff --git a/oox/inc/oox/drawingml/textfieldcontext.hxx b/oox/inc/oox/drawingml/textfieldcontext.hxx new file mode 100644 index 000000000000..b81265c9e923 --- /dev/null +++ b/oox/inc/oox/drawingml/textfieldcontext.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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_TEXTFIELDCONTEXT_HXX +#define OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +class TextField; + +class TextFieldContext + : public ::oox::core::ContextHandler +{ +public: + TextFieldContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes, + TextField& rTextField); + virtual void SAL_CALL endFastElement( sal_Int32 aElementToken ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + TextField& mrTextField; + bool mbIsInText; +}; + +} } + + +#endif diff --git a/oox/inc/oox/drawingml/textfont.hxx b/oox/inc/oox/drawingml/textfont.hxx new file mode 100644 index 000000000000..b8fd1d6f653b --- /dev/null +++ b/oox/inc/oox/drawingml/textfont.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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_DRAWINGNML_TEXTFONT_HXX +#define OOX_DRAWINGNML_TEXTFONT_HXX + +#include <rtl/ustring.hxx> + +namespace oox { class AttributeList; } +namespace oox { namespace core { class XmlFilterBase; } } + +namespace oox { +namespace drawingml { + +// ============================================================================ + +/** carries a CT_TextFont*/ +class TextFont +{ +public: + explicit TextFont(); + + /** Sets attributes from the passed attribute list. */ + void setAttributes( const AttributeList& rAttribs ); + + /** Overwrites this text font with the passed text font, if it is used. */ + void assignIfUsed( const TextFont& rTextFont ); + + /** Returns the font name, pitch, and family; tries to resolve theme + placeholder names, e.g. '+mj-lt' for the major latin theme font. */ + bool getFontData( + ::rtl::OUString& rFontName, + sal_Int16 rnFontPitch, + sal_Int16& rnFontFamily, + const ::oox::core::XmlFilterBase& rFilter ) const; + +private: + bool implGetFontData( + ::rtl::OUString& rFontName, + sal_Int16 rnFontPitch, + sal_Int16& rnFontFamily ) const; + +private: + ::rtl::OUString maTypeface; + ::rtl::OUString maPanose; + sal_Int32 mnPitch; + sal_Int32 mnCharset; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/textliststyle.hxx b/oox/inc/oox/drawingml/textliststyle.hxx new file mode 100644 index 000000000000..6ba4cdf1d62a --- /dev/null +++ b/oox/inc/oox/drawingml/textliststyle.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_TEXTLISTSTYLE_HXX +#define OOX_DRAWINGML_TEXTLISTSTYLE_HXX + +#include "oox/helper/containerhelper.hxx" +#include "oox/drawingml/textparagraphproperties.hxx" + +namespace oox { namespace drawingml { + +typedef RefVector< TextParagraphProperties > TextParagraphPropertiesVector; + +class TextListStyle +{ +public: + + TextListStyle(); + ~TextListStyle(); + + void apply( const TextListStyle& rTextListStyle ); + + inline const TextParagraphPropertiesVector& getListStyle() const { return maListStyle; }; + inline TextParagraphPropertiesVector& getListStyle() { return maListStyle; }; + + inline const TextParagraphPropertiesVector& getAggregationListStyle() const { return maAggregationListStyle; }; + inline TextParagraphPropertiesVector& getAggregationListStyle() { return maAggregationListStyle; }; + +protected: + + TextParagraphPropertiesVector maListStyle; + TextParagraphPropertiesVector maAggregationListStyle; +}; + +typedef boost::shared_ptr< TextListStyle > TextListStylePtr; + +} } + +#endif // OOX_DRAWINGML_TEXTLISTSTYLE_HXX diff --git a/oox/inc/oox/drawingml/textliststylecontext.hxx b/oox/inc/oox/drawingml/textliststylecontext.hxx new file mode 100644 index 000000000000..225bb83bf67f --- /dev/null +++ b/oox/inc/oox/drawingml/textliststylecontext.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_TEXTLISTSTYLECONTEXT_HXX +#define OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX + +#include "oox/drawingml/textliststyle.hxx" +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +class TextListStyleContext : public ::oox::core::ContextHandler +{ +public: + TextListStyleContext( ::oox::core::ContextHandler& rParent, TextListStyle& rTextListStyle ); + ~TextListStyleContext(); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + TextListStyle& mrTextListStyle; +}; + +} } + +#endif // OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX diff --git a/oox/inc/oox/drawingml/textparagraph.hxx b/oox/inc/oox/drawingml/textparagraph.hxx new file mode 100644 index 000000000000..e98232477f3b --- /dev/null +++ b/oox/inc/oox/drawingml/textparagraph.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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_TEXTPARAGRAPH_HXX +#define OOX_DRAWINGML_TEXTPARAGRAPH_HXX + +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XText.hpp> + +#include "oox/helper/containerhelper.hxx" +#include "oox/core/xmlfilterbase.hxx" +#include "oox/drawingml/textrun.hxx" +#include "oox/drawingml/textliststyle.hxx" +#include "oox/drawingml/textparagraphproperties.hxx" + +namespace oox { namespace drawingml { + +typedef RefVector< TextRun > TextRunVector; + +class TextParagraph +{ +public: + TextParagraph(); + ~TextParagraph(); + + inline TextRunVector& getRuns() { return maRuns; } + inline const TextRunVector& getRuns() const { return maRuns; } + inline void addRun( const TextRunPtr & pRun ) { maRuns.push_back( pRun ); } + + inline TextParagraphProperties& getProperties() { return maProperties; } + inline const TextParagraphProperties& getProperties() const { return maProperties; } + + inline TextParagraphProperties& getEndProperties() { return maEndProperties; } + inline const TextParagraphProperties& getEndProperties() const { return maEndProperties; } + + //inline void setProperties( TextParagraphPropertiesPtr pProps ) { mpProperties = pProps; } + + void insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt, + const TextCharacterProperties& rTextStyleProperties, + const TextListStyle& rTextListStyle, + bool bFirst = false ) const; + +private: + TextParagraphProperties maProperties; + TextParagraphProperties maEndProperties; + TextRunVector maRuns; +}; + +typedef boost::shared_ptr< TextParagraph > TextParagraphPtr; + +} } + +#endif // OOX_DRAWINGML_TEXTPARAGRAPH_HXX diff --git a/oox/inc/oox/drawingml/textparagraphproperties.hxx b/oox/inc/oox/drawingml/textparagraphproperties.hxx new file mode 100644 index 000000000000..ef80af2d1c11 --- /dev/null +++ b/oox/inc/oox/drawingml/textparagraphproperties.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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_TEXTPARAGRAPHPROPERTIES_HXX +#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include "oox/drawingml/fillpropertiesgroupcontext.hxx" +#include "oox/drawingml/textcharacterproperties.hxx" +#include <com/sun/star/style/NumberingType.hpp> +#include "oox/drawingml/textfont.hxx" +#include "textspacing.hxx" +#include <boost/optional.hpp> + +namespace com { namespace sun { namespace star { + namespace graphic { class XGraphic; } +} } } + +namespace oox { namespace drawingml { + +class TextParagraphProperties; + +typedef boost::shared_ptr< TextParagraphProperties > TextParagraphPropertiesPtr; + +class BulletList +{ +public: + BulletList( ); + bool is() const; + void apply( const BulletList& ); + void pushToPropMap( const ::oox::core::XmlFilterBase& rFilterBase, PropertyMap& rPropMap ) const; + void setBulletChar( const ::rtl::OUString & sChar ); + void setStartAt( sal_Int32 nStartAt ){ mnStartAt <<= static_cast< sal_Int16 >( nStartAt ); } + void setType( sal_Int32 nType ); + void setNone( ); + void setSuffixParenBoth(); + void setSuffixParenRight(); + void setSuffixPeriod(); + void setSuffixNone(); + void setSuffixMinusRight(); + void setBulletSize(sal_Int16 nSize); + void setFontSize(sal_Int16 nSize); + void setStyleName( const rtl::OUString& rStyleName ) { maStyleName <<= rStyleName; } + void setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic ); + + ::oox::drawingml::ColorPtr maBulletColorPtr; + ::com::sun::star::uno::Any mbBulletColorFollowText; + ::com::sun::star::uno::Any mbBulletFontFollowText; + ::oox::drawingml::TextFont maBulletFont; + ::com::sun::star::uno::Any msBulletChar; + ::com::sun::star::uno::Any mnStartAt; + ::com::sun::star::uno::Any mnNumberingType; + ::com::sun::star::uno::Any msNumberingPrefix; + ::com::sun::star::uno::Any msNumberingSuffix; + ::com::sun::star::uno::Any mnSize; + ::com::sun::star::uno::Any mnFontSize; + ::com::sun::star::uno::Any maStyleName; + ::com::sun::star::uno::Any maGraphic; + boost::optional< float > maFollowFontSize; +}; + +class TextParagraphProperties +{ +public: + + TextParagraphProperties(); + ~TextParagraphProperties(); + + void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; } + sal_Int16 getLevel( ) const { return mnLevel; } + PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; } + BulletList& getBulletList() { return maBulletList; } + TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; } + const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } + + TextSpacing& getParaTopMargin() { return maParaTopMargin; } + TextSpacing& getParaBottomMargin() { return maParaBottomMargin; } + boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; } + boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; } + + void apply( const TextParagraphProperties& rSourceProps ); + void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase, + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, + PropertyMap& rioBulletList, const BulletList* pMasterBuList, sal_Bool bApplyBulletList, float fFontSize ) const; + + /** Returns the largest character size of this paragraph. If possible the + masterstyle should have been applied before, otherwise the character + size can be zero and the default value is returned. */ + float getCharHeightPoints( float fDefault ) const; + +protected: + + TextCharacterProperties maTextCharacterProperties; + PropertyMap maTextParagraphPropertyMap; + BulletList maBulletList; + TextSpacing maParaTopMargin; + TextSpacing maParaBottomMargin; + boost::optional< sal_Int32 > moParaLeftMargin; + boost::optional< sal_Int32 > moFirstLineIndentation; + sal_Int16 mnLevel; +}; + +} } + +#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX diff --git a/oox/inc/oox/drawingml/textparagraphpropertiescontext.hxx b/oox/inc/oox/drawingml/textparagraphpropertiescontext.hxx new file mode 100644 index 000000000000..de369c622e69 --- /dev/null +++ b/oox/inc/oox/drawingml/textparagraphpropertiescontext.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX +#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX + +#include <list> + +#include <com/sun/star/style/TabStop.hpp> +#include "oox/drawingml/drawingmltypes.hxx" +#include "oox/drawingml/textparagraphproperties.hxx" +#include "oox/drawingml/textspacing.hxx" +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace drawingml { + +class TextParagraphPropertiesContext : public ::oox::core::ContextHandler +{ +public: + TextParagraphPropertiesContext( ::oox::core::ContextHandler& rParent, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes, + TextParagraphProperties& rTextParagraphProperties ); + ~TextParagraphPropertiesContext(); + + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + TextParagraphProperties& mrTextParagraphProperties; + TextSpacing maLineSpacing; + TextSpacing& mrSpaceBefore; + TextSpacing& mrSpaceAfter; + BulletList& mrBulletList; + ::std::list< ::com::sun::star::style::TabStop > maTabList; + ::boost::shared_ptr< BlipFillProperties > mxBlipProps; +}; + +} } + +#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX diff --git a/oox/inc/oox/drawingml/textrun.hxx b/oox/inc/oox/drawingml/textrun.hxx new file mode 100644 index 000000000000..2704b8e92621 --- /dev/null +++ b/oox/inc/oox/drawingml/textrun.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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_TEXTRUN_HXX +#define OOX_DRAWINGML_TEXTRUN_HXX + +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include "oox/drawingml/textcharacterproperties.hxx" + +namespace oox { namespace drawingml { + +class TextRun +{ +public: + TextRun(); + virtual ~TextRun(); + + inline ::rtl::OUString& getText() { return msText; } + inline const ::rtl::OUString& getText() const { return msText; } + + inline TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; } + inline const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } + + inline void setLineBreak() { mbIsLineBreak = true; } + + virtual void insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText >& xText, + const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor >& xAt, + const TextCharacterProperties& rTextCharacterStyle ) const; + +private: + ::rtl::OUString msText; + TextCharacterProperties maTextCharacterProperties; + bool mbIsLineBreak; +}; + +typedef boost::shared_ptr< TextRun > TextRunPtr; + +} } + +#endif // OOX_DRAWINGML_TEXTRUN_HXX diff --git a/oox/inc/oox/drawingml/textspacing.hxx b/oox/inc/oox/drawingml/textspacing.hxx new file mode 100644 index 000000000000..80c172c125ee --- /dev/null +++ b/oox/inc/oox/drawingml/textspacing.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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_DRAWINGNML__TEXTSPACING_HXX +#define OOX_DRAWINGNML__TEXTSPACING_HXX + +#include <rtl/ustring.hxx> + +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> + +namespace oox { namespace drawingml { + + + /** carries a CT_TextSpacing */ + class TextSpacing + { + public: + enum { + POINTS = 0, + PERCENT + }; + TextSpacing() + : nUnit( POINTS ), nValue( 0 ), bHasValue( sal_False ) + { + } + TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( sal_True ){}; + ::com::sun::star::style::LineSpacing toLineSpacing() const + { + ::com::sun::star::style::LineSpacing aSpacing; + aSpacing.Mode = ( nUnit == PERCENT + ? ::com::sun::star::style::LineSpacingMode::PROP + : ::com::sun::star::style::LineSpacingMode::MINIMUM ); + aSpacing.Height = static_cast< sal_Int16 >( nUnit == PERCENT ? nValue / 1000 : nValue ); + return aSpacing; + } + sal_Int32 toMargin( float fFontSize ) const + { + if ( nUnit == PERCENT ) + { + double fMargin = ( fFontSize * 2540 + 36 ) / 72; + fMargin *= nValue; + fMargin /= 100000; + return static_cast< sal_Int32 >( fMargin ); + } + else + return nValue; + } + sal_Int32 nUnit; + sal_Int32 nValue; + sal_Bool bHasValue; + }; + +} } + +#endif + diff --git a/oox/inc/oox/drawingml/theme.hxx b/oox/inc/oox/drawingml/theme.hxx new file mode 100644 index 000000000000..15f5ce82ce12 --- /dev/null +++ b/oox/inc/oox/drawingml/theme.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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_THEME_HXX +#define OOX_DRAWINGML_THEME_HXX + +#include "oox/helper/containerhelper.hxx" +#include "oox/drawingml/clrscheme.hxx" +#include "oox/drawingml/shape.hxx" +#include "oox/drawingml/textfont.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +const sal_Int32 THEMED_STYLE_SUBTLE = 1; +const sal_Int32 THEMED_STYLE_MODERATE = 2; +const sal_Int32 THEMED_STYLE_INTENSE = 3; + +typedef RefVector< FillProperties > FillStyleList; +typedef RefVector< LineProperties > LineStyleList; +typedef RefVector< PropertyMap > EffectStyleList; +typedef RefMap< sal_Int32, TextCharacterProperties > FontScheme; + +// ============================================================================ + +class Theme +{ +public: + explicit Theme(); + ~Theme(); + + inline void setStyleName( const ::rtl::OUString& rStyleName ) { maStyleName = rStyleName; } + inline const ::rtl::OUString& getStyleName() const { return maStyleName; } + + inline ClrScheme& getClrScheme() { return maClrScheme; } + inline const ClrScheme& getClrScheme() const { return maClrScheme; } + + inline FillStyleList& getFillStyleList() { return maFillStyleList; } + inline const FillStyleList& getFillStyleList() const { return maFillStyleList; } + inline FillStyleList& getBgFillStyleList() { return maBgFillStyleList; } + inline const FillStyleList& getBgFillStyleList() const { return maBgFillStyleList; } + /** Returns the fill properties of the passed one-based themed style index. */ + const FillProperties* getFillStyle( sal_Int32 nIndex ) const; + + inline LineStyleList& getLineStyleList() { return maLineStyleList; } + inline const LineStyleList& getLineStyleList() const { return maLineStyleList; } + /** Returns the line properties of the passed one-based themed style index. */ + const LineProperties* getLineStyle( sal_Int32 nIndex ) const; + + inline EffectStyleList& getEffectStyleList() { return maEffectStyleList; } + inline const EffectStyleList& getEffectStyleList() const { return maEffectStyleList; } + /** Returns the effect properties of the passed one-based themed style index. */ + const PropertyMap* getEffectStyle( sal_Int32 nIndex ) const; + + inline FontScheme& getFontScheme() { return maFontScheme; } + inline const FontScheme& getFontScheme() const { return maFontScheme; } + /** Returns theme font properties by scheme type (major/minor). */ + const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const; + /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */ + const TextFont* resolveFont( const ::rtl::OUString& rName ) const; + + inline Shape& getSpDef() { return maSpDef; } + inline const Shape& getSpDef() const { return maSpDef; } + + inline Shape& getLnDef() { return maLnDef; } + inline const Shape& getLnDef() const { return maLnDef; } + + inline Shape& getTxDef() { return maTxDef; } + inline const Shape& getTxDef() const { return maTxDef; } + +private: + ::rtl::OUString maStyleName; + ClrScheme maClrScheme; + FillStyleList maFillStyleList; + FillStyleList maBgFillStyleList; + LineStyleList maLineStyleList; + EffectStyleList maEffectStyleList; + FontScheme maFontScheme; + Shape maSpDef; + Shape maLnDef; + Shape maTxDef; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/themeelementscontext.hxx b/oox/inc/oox/drawingml/themeelementscontext.hxx new file mode 100644 index 000000000000..1dfc76b6957d --- /dev/null +++ b/oox/inc/oox/drawingml/themeelementscontext.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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_THEMEELEMENTSCONTEXT_HXX +#define OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { +namespace drawingml { + +class Theme; + +// ============================================================================ + +class ThemeElementsContext : public oox::core::ContextHandler +{ +public: + ThemeElementsContext( ::oox::core::ContextHandler& rParent, Theme& rTheme ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +private: + Theme& mrTheme; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/themefragmenthandler.hxx b/oox/inc/oox/drawingml/themefragmenthandler.hxx new file mode 100644 index 000000000000..aeaaa5378bd8 --- /dev/null +++ b/oox/inc/oox/drawingml/themefragmenthandler.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_THEMEFRAGMENTHANDLER_HXX +#define OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX + +#include "oox/core/fragmenthandler2.hxx" + +namespace oox { +namespace drawingml { + +class Theme; + +// ============================================================================ + +class ThemeFragmentHandler : public ::oox::core::FragmentHandler2 +{ +public: + explicit ThemeFragmentHandler( + ::oox::core::XmlFilterBase& rFilter, + const ::rtl::OUString& rFragmentPath, + Theme& rTheme ); + virtual ~ThemeFragmentHandler(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + +private: + Theme& mrTheme; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + diff --git a/oox/inc/oox/drawingml/transform2dcontext.hxx b/oox/inc/oox/drawingml/transform2dcontext.hxx new file mode 100644 index 000000000000..022f1dbe47c2 --- /dev/null +++ b/oox/inc/oox/drawingml/transform2dcontext.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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_TRANSFORM2DCONTEXT_HXX +#define OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX + +#include "oox/core/contexthandler.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +class Shape; + +/** context to import a CT_Transform2D */ +class Transform2DContext : public ::oox::core::ContextHandler +{ +public: + Transform2DContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, Shape& rShape ) throw(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + +protected: + Shape& mrShape; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif + |