summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-04-18 19:06:48 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-04-18 19:06:48 +0000
commite6222bc0083360f5b5d055cd2423c8cd643b5336 (patch)
tree95294f9a17a0e8206015234b1ee05f60e291331b
parent3f334a2c2bd292a034d5ceb0b899c9acd2afcdde (diff)
Correct integration of CWS xmlfilter04
-rw-r--r--oox/inc/oox/core/contexthandler.hxx5
-rw-r--r--oox/inc/oox/core/contexthandler2.hxx11
-rw-r--r--oox/inc/oox/drawingml/chart/axiscontext.hxx54
-rw-r--r--oox/inc/oox/drawingml/chart/axismodel.hxx78
-rw-r--r--oox/inc/oox/drawingml/chart/chartcontextbase.hxx39
-rw-r--r--oox/inc/oox/drawingml/chart/modelbase.hxx110
-rw-r--r--oox/inc/oox/drawingml/chart/plotareacontext.hxx27
-rw-r--r--oox/inc/oox/drawingml/chart/plotareamodel.hxx56
-rw-r--r--oox/inc/oox/drawingml/chart/seriescontext.hxx203
-rw-r--r--oox/inc/oox/drawingml/chart/seriesmodel.hxx180
-rw-r--r--oox/inc/oox/drawingml/chart/typegroupcontext.hxx69
-rw-r--r--oox/inc/oox/drawingml/chart/typegroupmodel.hxx57
-rw-r--r--oox/inc/oox/xls/excelhandlers.hxx4
-rw-r--r--oox/source/core/contexthandler.cxx15
-rw-r--r--oox/source/core/contexthandler2.cxx20
-rw-r--r--oox/source/drawingml/chart/axiscontext.cxx315
-rw-r--r--oox/source/drawingml/chart/axismodel.cxx36
-rw-r--r--oox/source/drawingml/chart/makefile.mk27
-rw-r--r--oox/source/drawingml/chart/plotareacontext.cxx79
-rw-r--r--oox/source/drawingml/chart/plotareamodel.cxx31
-rw-r--r--oox/source/drawingml/chart/seriescontext.cxx646
-rw-r--r--oox/source/drawingml/chart/seriesmodel.cxx86
-rw-r--r--oox/source/drawingml/chart/typegroupcontext.cxx392
-rw-r--r--oox/source/drawingml/chart/typegroupmodel.cxx30
-rw-r--r--oox/source/xls/drawingfragment.cxx9
25 files changed, 1827 insertions, 752 deletions
diff --git a/oox/inc/oox/core/contexthandler.hxx b/oox/inc/oox/core/contexthandler.hxx
index cd855d4cca72..5fc0b6557c2c 100644
--- a/oox/inc/oox/core/contexthandler.hxx
+++ b/oox/inc/oox/core/contexthandler.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: contexthandler.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -67,8 +67,6 @@ public:
/** Returns the filter instance. */
XmlFilterBase& getFilter() const;
- /** Returns the parent context handler of this context handler. */
- ContextHandler* getParentHandler() const;
/** Returns the relations of the current fragment. */
const Relations& getRelations() const;
/** Returns the full path of the current fragment. */
@@ -110,7 +108,6 @@ private:
private:
FragmentBaseDataRef mxBaseData; /// Base data of the fragment.
- ContextHandler* mpParentHandler; /// Pointer to parent context handler.
};
// ============================================================================
diff --git a/oox/inc/oox/core/contexthandler2.hxx b/oox/inc/oox/core/contexthandler2.hxx
index ec868cbd523f..fb9613ab825a 100644
--- a/oox/inc/oox/core/contexthandler2.hxx
+++ b/oox/inc/oox/core/contexthandler2.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: contexthandler2.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -42,10 +42,6 @@
namespace oox {
namespace core {
-// Constants ==================================================================
-
-const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32;
-
// ============================================================================
class ContextHandler2Helper;
@@ -105,6 +101,7 @@ class ContextHandler2Helper
{
public:
explicit ContextHandler2Helper();
+ explicit ContextHandler2Helper( const ContextHandler2Helper& rParent );
virtual ~ContextHandler2Helper();
virtual void SAL_CALL acquire() throw() = 0;
@@ -178,6 +175,9 @@ public:
inline sal_Int32 isPreviousElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const
{ return getPreviousElement( nCountBack ) == nElement; }
+ /** Returns true, if the current element is the root element. */
+ bool isRootElement() const;
+
// implementation ---------------------------------------------------------
protected:
@@ -219,6 +219,7 @@ private:
typedef ::boost::shared_ptr< ContextStack > ContextStackRef;
ContextStackRef mxContextStack; /// Stack of processed contexts.
+ size_t mnRootStackSize; /// Stack size on construction time.
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/axiscontext.hxx b/oox/inc/oox/drawingml/chart/axiscontext.hxx
index 68e36925a7fa..cdaee210e4f1 100644
--- a/oox/inc/oox/drawingml/chart/axiscontext.hxx
+++ b/oox/inc/oox/drawingml/chart/axiscontext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: axiscontext.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -39,17 +39,31 @@ namespace chart {
// ============================================================================
-class AxisModel;
+struct AxisDispUnitsModel;
-class AxisContextBase : public ChartContextBase< AxisModel >
+/** Handler for a value axis display units context (c:dispUnits element).
+ */
+class AxisDispUnitsContext : public ContextBase< AxisDispUnitsModel >
{
public:
- explicit AxisContextBase(
- ::oox::core::ContextHandler2Helper& rParent,
- AxisModel& rModel );
- virtual ~AxisContextBase();
+ explicit AxisDispUnitsContext( ::oox::core::ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel );
+ virtual ~AxisDispUnitsContext();
+
+ virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct AxisModel;
- // oox.core.ContextHandler2Helper interface -------------------------------
+/** 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::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -61,13 +75,9 @@ public:
class CatAxisContext : public AxisContextBase
{
public:
- explicit CatAxisContext(
- ::oox::core::ContextHandler2Helper& rParent,
- AxisModel& rModel );
+ explicit CatAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~CatAxisContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -78,13 +88,9 @@ public:
class DateAxisContext : public AxisContextBase
{
public:
- explicit DateAxisContext(
- ::oox::core::ContextHandler2Helper& rParent,
- AxisModel& rModel );
+ explicit DateAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~DateAxisContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -95,13 +101,9 @@ public:
class SerAxisContext : public AxisContextBase
{
public:
- explicit SerAxisContext(
- ::oox::core::ContextHandler2Helper& rParent,
- AxisModel& rModel );
+ explicit SerAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~SerAxisContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -112,13 +114,9 @@ public:
class ValAxisContext : public AxisContextBase
{
public:
- explicit ValAxisContext(
- ::oox::core::ContextHandler2Helper& rParent,
- AxisModel& rModel );
+ explicit ValAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~ValAxisContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
diff --git a/oox/inc/oox/drawingml/chart/axismodel.hxx b/oox/inc/oox/drawingml/chart/axismodel.hxx
index 83d19ba0b28b..0c59786d3949 100644
--- a/oox/inc/oox/drawingml/chart/axismodel.hxx
+++ b/oox/inc/oox/drawingml/chart/axismodel.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: axismodel.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,7 +31,8 @@
#ifndef OOX_DRAWINGML_CHART_AXISMODEL_HXX
#define OOX_DRAWINGML_CHART_AXISMODEL_HXX
-#include "oox/drawingml/chart/modelbase.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
namespace oox {
namespace drawingml {
@@ -39,20 +40,49 @@ namespace chart {
// ============================================================================
-struct AxisData
+struct AxisDispUnitsModel
{
- ::rtl::OUString maFormatCode; /// Number format code for tick mark labels.
- double mfCrossesAt; /// Position on this axis where another axis crosses.
+ 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.
- double mfMajorUnit; /// Unit for major tick marks on date/value axis.
- double mfMinorUnit; /// Unit for minor tick marks on date/value axis.
- double mfLogBase; /// Logarithmic base for logarithmic axes.
- double mfMax; /// Maximum axis value.
- double mfMin; /// Minimum axis value.
+ 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.
+ ::rtl::OUString maFormatCode; /// Number format code for tick mark labels.
+ OptDouble mofCrossesAt; /// Position on this axis where another axis crosses.
+ OptDouble mofMajorUnit; /// Unit for major tick marks on date/value axis.
+ OptDouble mofMinorUnit; /// Unit for minor tick marks on date/value axis.
+ OptDouble mofLogBase; /// Logarithmic base for logarithmic axes.
+ OptDouble mofMax; /// Maximum axis value.
+ OptDouble 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 mnBuiltInUnit; /// Built-in unit on value 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).
@@ -67,35 +97,13 @@ struct AxisData
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; /// Automatic axis settings.
+ bool mbAuto; /// True = automatic axis settings.
bool mbDeleted; /// True = axis has been deleted manually.
bool mbNoMultiLevel; /// True = no multi-level categories supported.
bool mbSourceLinked; /// True = number format linked to source data.
- explicit AxisData( sal_Int32 nTypeId );
-};
-
-// ----------------------------------------------------------------------------
-
-class LayoutModel;
-
-class AxisModel : public ModelData< AxisData >
-{
-public:
explicit AxisModel( sal_Int32 nTypeId );
- virtual ~AxisModel();
-
- /** Returns true, if this chart model contains a layout object for unit labels. */
- inline bool hasUnitLabelsLayout() const { return mxLayout.get() != 0; }
- /** Returns a pointer to an existing unit labels layout object, or null if not present. */
- inline LayoutModel* getUnitLabelsLayout() const { return mxLayout.get(); }
- /** Creates and returns a new layout model object for unit labels. */
- LayoutModel& createUnitLabelsLayout();
-
-private:
- typedef ::boost::shared_ptr< LayoutModel > LayoutRef;
-
- LayoutRef mxLayout;
+ ~AxisModel();
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
index ce042b80ae69..d9e956431a59 100644
--- a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
+++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: chartcontextbase.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -35,6 +35,8 @@
#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token)
+namespace oox { namespace drawingml { class Shape; } }
+
namespace oox {
namespace drawingml {
namespace chart {
@@ -42,39 +44,42 @@ namespace chart {
// ============================================================================
template< typename ModelType >
-class ModelAccess
+class ContextBase : public ::oox::core::ContextHandler2
{
public:
- inline explicit ModelAccess( ModelType& rModel ) : mrModel( rModel ) {}
- virtual ~ModelAccess() {}
-
- inline ModelType& getModel() { return mrModel; }
- inline const ModelType& getModel() const { return mrModel; }
+ inline explicit ContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) :
+ ::oox::core::ContextHandler2( rParent ), mrModel( rModel ) {}
+ virtual ~ContextBase() {}
-private:
+protected:
ModelType& mrModel;
};
// ============================================================================
template< typename ModelType >
-class ChartContextBase : public ::oox::core::ContextHandler2, public ModelAccess< ModelType >
+class FragmentBase : public ::oox::core::FragmentHandler2
{
public:
- inline explicit ChartContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) :
- ::oox::core::ContextHandler2( rParent ), ModelAccess< ModelType >( rModel ) {}
- virtual ~ChartContextBase() {}
+ explicit FragmentBase( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, ModelType& rModel ) :
+ ::oox::core::FragmentHandler2( rFilter, rFragmentPath ), mrModel( rModel ) {}
+ virtual ~FragmentBase() {}
+
+protected:
+ ModelType& mrModel;
};
// ============================================================================
-template< typename ModelType >
-class ChartFragmentBase : public ::oox::core::FragmentHandler2, public ModelAccess< ModelType >
+/** Help class for all contexts that have only the c:spPr child element.
+ */
+class ShapePrWrapperContext : public ContextBase< Shape >
{
public:
- explicit ChartFragmentBase( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, ModelType& rModel ) :
- ::oox::core::FragmentHandler2( rFilter, rFragmentPath ), ModelAccess< ModelType >( rModel ) {}
- virtual ~ChartFragmentBase() {}
+ explicit ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel );
+ virtual ~ShapePrWrapperContext();
+
+ virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/modelbase.hxx b/oox/inc/oox/drawingml/chart/modelbase.hxx
index 66615aeb2f0d..9ca64aed480f 100644
--- a/oox/inc/oox/drawingml/chart/modelbase.hxx
+++ b/oox/inc/oox/drawingml/chart/modelbase.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: modelbase.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,8 +31,7 @@
#ifndef OOX_DRAWINGML_CHART_MODELBASE_HXX
#define OOX_DRAWINGML_CHART_MODELBASE_HXX
-#include <boost/shared_ptr.hpp>
-#include "oox/helper/helper.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "tokens.hxx"
namespace oox {
@@ -41,42 +40,93 @@ namespace chart {
// ============================================================================
-/** Inserts a data struct into a model class and provides accessor functions to the data.
- */
-template< typename DataStruct >
-class ModelData
+template< typename Type >
+class OptValue
{
public:
- inline explicit ModelData() {}
- inline explicit ModelData( const DataStruct& rData ) : maData( rData ) {}
- template< typename Param1 >
- inline explicit ModelData( const Param1& rParam1 ) : maData( rParam1 ) {}
- template< typename Param1, typename Param2 >
- inline explicit ModelData( const Param1& rParam1, const Param2& rParam2 ) : maData( rParam1, rParam2 ) {}
- virtual ~ModelData() {}
-
- /** Provides read access to the data struct of this model. */
- inline const DataStruct& getData() const { return maData; }
- /** Provides read/write access to the data struct of this model. */
- inline DataStruct& getData() { return maData; }
-
- /** Sets the passed data struct for this model. */
- inline void setData( const DataStruct& rData ) { maData = rData; }
+ inline explicit OptValue() : mbHasValue( false ) {}
+ inline explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {}
+
+ inline bool has() const { return mbHasValue; }
+ inline bool operator!() const { return !mbHasValue; }
+
+ inline const Type& get() const { return maValue; }
+ inline const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; }
+
+ inline void reset() { mbHasValue = false; }
+ inline void set( const Type& rValue ) { maValue = rValue; mbHasValue = true; }
+ inline OptValue& operator=( const Type& rValue ) { set( rValue ); return *this; }
private:
- DataStruct maData;
+ Type maValue;
+ bool mbHasValue;
};
+typedef OptValue< bool > OptBool;
+typedef OptValue< sal_Int32 > OptInt32;
+typedef OptValue< double > OptDouble;
+typedef OptValue< ::rtl::OUString > OptString;
+
// ============================================================================
-#define IMPL_MODEL_MEMBER( ClassName, MemberName ) \
-public: \
- inline bool has##MemberName() const { return mx##MemberName.get() != 0; } \
- inline const ClassName* get##MemberName() const { return mx##MemberName.get(); } \
- inline ClassName& create##MemberName() const { mx##MemberName.rset( new ClassName ); return *mx##MemberName; } \
-private: \
- ::boost::shared_ptr< ClassName > mx##MemberName
+template< typename ModelType >
+class ModelRef : public ::boost::shared_ptr< ModelType >
+{
+public:
+ inline explicit ModelRef() {}
+ 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; }
+};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/plotareacontext.hxx b/oox/inc/oox/drawingml/chart/plotareacontext.hxx
index c350ebc8b166..e8a02f204512 100644
--- a/oox/inc/oox/drawingml/chart/plotareacontext.hxx
+++ b/oox/inc/oox/drawingml/chart/plotareacontext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: plotareacontext.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -39,19 +39,30 @@ namespace chart {
// ============================================================================
-class PlotAreaModel;
+struct View3DModel;
/** Handler for a chart plot area context (c:plotArea element).
*/
-class PlotAreaContext : public ChartContextBase< PlotAreaModel >
+class View3DContext : public ContextBase< View3DModel >
{
public:
- explicit PlotAreaContext(
- ::oox::core::ContextHandler2Helper& rParent,
- PlotAreaModel& rModel );
- virtual ~PlotAreaContext();
+ explicit View3DContext( ::oox::core::ContextHandler2Helper& rParent, View3DModel& rModel );
+ virtual ~View3DContext();
+
+ virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
- // oox.core.ContextHandler2Helper interface -------------------------------
+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::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
diff --git a/oox/inc/oox/drawingml/chart/plotareamodel.hxx b/oox/inc/oox/drawingml/chart/plotareamodel.hxx
index 72db8e5e65d1..6d07da62d75b 100644
--- a/oox/inc/oox/drawingml/chart/plotareamodel.hxx
+++ b/oox/inc/oox/drawingml/chart/plotareamodel.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: plotareamodel.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,8 +31,10 @@
#ifndef OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
#define OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
-#include "oox/helper/containerhelper.hxx"
-#include "oox/drawingml/chart/modelbase.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/axismodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+#include "oox/drawingml/chart/typegroupmodel.hxx"
namespace oox {
namespace drawingml {
@@ -40,37 +42,35 @@ namespace chart {
// ============================================================================
-class TypeGroupModel;
-class AxisModel;
-class LayoutModel;
-
-class PlotAreaModel
+struct View3DModel
{
-public:
- explicit PlotAreaModel();
- virtual ~PlotAreaModel();
+ sal_Int32 mnDepthPercent; /// Depth of the 3D view, relative to chart width.
+ sal_Int32 mnHeightPercent; /// Height of the 3D view, relative to chart width.
+ sal_Int32 mnPerspective; /// Eye distance to the §D objects.
+ sal_Int32 mnRotationX; /// Horizontal rotation in degrees.
+ sal_Int32 mnRotationY; /// Vertical rotation in degrees.
+ bool mbRightAngled; /// True = right-angled axes in 3D view.
- /** Creates and returns a new chart type model object. */
- TypeGroupModel& createTypeGroup( sal_Int32 nTypeId );
+ explicit View3DModel();
+ ~View3DModel();
+};
- /** Creates and returns a new axis model object. */
- AxisModel& createAxis( sal_Int32 nTypeId );
+// ============================================================================
- /** Returns true, if this chart model contains a layout object. */
- inline bool hasLayout() const { return mxLayout.get() != 0; }
- /** Returns a pointer to an existing layout object, or null if not present. */
- inline LayoutModel* getLayout() const { return mxLayout.get(); }
- /** Creates and returns a new layout model object. */
- LayoutModel& createLayout();
+struct PlotAreaModel
+{
+ typedef ModelVector< TypeGroupModel > TypeGroupVector;
+ typedef ModelVector< AxisModel > AxisVector;
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
-private:
- typedef RefVector< TypeGroupModel > TypeGroupVector;
- typedef RefVector< AxisModel > AxisVector;
- typedef ::boost::shared_ptr< 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.
- TypeGroupVector maTypeGroups; /// List of all chart types.
- AxisVector maAxes; /// All axes used in the chart.
- LayoutRef mxLayout; /// Plot area position.
+ explicit PlotAreaModel();
+ ~PlotAreaModel();
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/seriescontext.hxx b/oox/inc/oox/drawingml/chart/seriescontext.hxx
index c1976855ba80..216e16f4dfab 100644
--- a/oox/inc/oox/drawingml/chart/seriescontext.hxx
+++ b/oox/inc/oox/drawingml/chart/seriescontext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: seriescontext.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -39,28 +39,201 @@ namespace chart {
// ============================================================================
-class SeriesModel;
+struct DataLabelModel;
-/** Handler for a data series context (c:ser element).
+/** Handler for a chart data point label context (c:dLbl element).
*/
-class SeriesContext : public ChartContextBase< SeriesModel >
+class DataLabelContext : public ContextBase< DataLabelModel >
{
public:
- explicit SeriesContext(
- ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel,
- sal_Int32 nTitleSrcId, sal_Int32 nCategSrcId,
- sal_Int32 nValueSrcId, sal_Int32 nPointSrcId = XML_TOKEN_INVALID );
- virtual ~SeriesContext();
+ explicit DataLabelContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelModel& rModel );
+ virtual ~DataLabelContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
+ virtual ::oox::core::ContextWrapper 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::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onEndElement( const ::rtl::OUString& rChars );
+};
+
+// ============================================================================
+
+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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper 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::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
-private:
- sal_Int32 mnTitleSrcId; /// XML element identifier for title source values.
- sal_Int32 mnCategSrcId; /// XML element identifier for category source values.
- sal_Int32 mnValueSrcId; /// XML element identifier for series source values.
- sal_Int32 mnPointSrcId; /// XML element identifier for point source values (e.g. bubble sizes).
+// ============================================================================
+
+/** 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::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/seriesmodel.hxx b/oox/inc/oox/drawingml/chart/seriesmodel.hxx
index 05e8efb71354..00f924037a02 100644
--- a/oox/inc/oox/drawingml/chart/seriesmodel.hxx
+++ b/oox/inc/oox/drawingml/chart/seriesmodel.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: seriesmodel.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,7 +31,8 @@
#ifndef OOX_DRAWINGML_CHART_SERIESMODEL_HXX
#define OOX_DRAWINGML_CHART_SERIESMODEL_HXX
-#include "oox/drawingml/chart/modelbase.hxx"
+#include "oox/drawingml/chart/datasourcemodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
namespace oox {
namespace drawingml {
@@ -39,40 +40,163 @@ namespace chart {
// ============================================================================
-struct SeriesData
+struct DataLabelModelBase
{
- sal_Int32 mnIndex; /// Unique series index.
- sal_Int32 mnOrder; /// Series order used for automatic formatting.
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+
+ ShapeRef mxShapeProp; /// Data label frame formatting.
+ TextBodyRef mxTextProp; /// Data label text formatting.
+ OptString moaFormatCode; /// Number format for numeric labels.
+ OptString moaSeparator; /// Separator between label components.
+ OptInt32 monLabelPos; /// Data label position.
+ OptBool mobShowBubbleSize; /// True = show size of bubbles in bubble charts.
+ OptBool mobShowCatName; /// True = show category name of data points.
+ OptBool mobShowLegendKey; /// True = show legend key of data series.
+ OptBool mobShowPercent; /// True = show percentual value in pie/doughnut charts.
+ OptBool mobShowSerName; /// True = show series name.
+ OptBool mobShowVal; /// True = show data point value.
+ OptBool mobSourceLinked; /// True = number format linked to source data.
+ bool mbDeleted; /// True = data label(s) deleted.
+
+ explicit DataLabelModelBase();
+ ~DataLabelModelBase();
+};
+
+// ============================================================================
- explicit SeriesData();
+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();
};
-// ----------------------------------------------------------------------------
+// ============================================================================
-class SeriesSourceModel;
+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.
+ OptBool mobShowLeaderLines; /// True = show connector lines between data points and labels.
+
+ explicit DataLabelsModel();
+ ~DataLabelsModel();
+};
-class SeriesModel : public ModelData< SeriesData >
+// ============================================================================
+
+struct ErrorBarModel
{
-public:
+ 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 TrendlineModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+
+ ShapeRef mxShapeProp; /// Trendline formatting.
+ ::rtl::OUString maName; /// User-defined name of the trendline.
+ OptDouble mfBackward; /// Size of trendline before first data point.
+ OptDouble mfForward; /// Size of trendline behind last data point.
+ OptDouble 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;
+
+ ShapeRef mxShapeProp; /// Data point formatting.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ OptInt32 monExplosion; /// Pie slice moved from pie center.
+ OptInt32 monMarkerSize; /// Size of the series line marker (2...72).
+ OptInt32 monMarkerSymbol; /// Series line marker symbol.
+ OptBool mobBubble3d; /// True = show bubbles with 3D shade.
+ OptBool mobInvertNeg; /// True = invert negative data points.
+ sal_Int32 mnIndex; /// Unique data point index.
+
+ 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< 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.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ TextRef mxText; /// Series title source.
+ DataLabelsRef mxLabels; /// Data point label settings for all points.
+ OptInt32 monShape; /// 3D bar shape type.
+ OptBool mobBubble3d; /// True = show bubbles with 3D shade.
+ OptBool mobSmooth; /// True = smooth series line.
+ sal_Int32 mnExplosion; /// Pie slice moved from pie center.
+ sal_Int32 mnIndex; /// Unique series index.
+ sal_Int32 mnMarkerSize; /// Size of the series line marker (2...72).
+ sal_Int32 mnMarkerSymbol; /// Series line marker symbol.
+ sal_Int32 mnOrder; /// Series order used for automatic formatting.
+ bool mbInvertNeg; /// True = invert negative data points.
+
explicit SeriesModel();
- virtual ~SeriesModel();
-
- /** Creates and returns a new source data model object for the series title. */
- SeriesSourceModel& createTitleSource();
- /** Creates and returns a new source data model object for the category values. */
- SeriesSourceModel& createCategorySource();
- /** Creates and returns a new source data model object for the series values. */
- SeriesSourceModel& createValueSource();
- /** Creates and returns a new source data model object for the point values (e.g. bubble sizes). */
- SeriesSourceModel& createPointSource();
-
-private:
- typedef ::boost::shared_ptr< SeriesSourceModel > SeriesSourceRef;
-
- SeriesSourceRef mxTitleSource;
- SeriesSourceRef mxCategSource;
- SeriesSourceRef mxValueSource;
- SeriesSourceRef mxPointSource;
+ ~SeriesModel();
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
index 0611a0a34afd..92b0fc5992fa 100644
--- a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
+++ b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: typegroupcontext.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -39,8 +39,23 @@ namespace chart {
// ============================================================================
-class TypeGroupModel;
-typedef ChartContextBase< TypeGroupModel > TypeGroupContextBase;
+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::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TypeGroupModel;
+typedef ContextBase< TypeGroupModel > TypeGroupContextBase;
// ============================================================================
@@ -49,13 +64,9 @@ typedef ChartContextBase< TypeGroupModel > TypeGroupContextBase;
class AreaTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit AreaTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit AreaTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~AreaTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -66,13 +77,9 @@ public:
class BarTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit BarTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit BarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~BarTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -83,13 +90,9 @@ public:
class BubbleTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit BubbleTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit BubbleTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~BubbleTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -101,13 +104,9 @@ public:
class LineTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit LineTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit LineTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~LineTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -119,13 +118,9 @@ public:
class PieTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit PieTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit PieTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~PieTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -136,13 +131,9 @@ public:
class RadarTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit RadarTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit RadarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~RadarTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -153,13 +144,9 @@ public:
class ScatterTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit ScatterTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit ScatterTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~ScatterTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
@@ -171,13 +158,9 @@ public:
class SurfaceTypeGroupContext : public TypeGroupContextBase
{
public:
- explicit SurfaceTypeGroupContext(
- ::oox::core::ContextHandler2Helper& rParent,
- TypeGroupModel& rModel );
+ explicit SurfaceTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~SurfaceTypeGroupContext();
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
diff --git a/oox/inc/oox/drawingml/chart/typegroupmodel.hxx b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx
index 58625cf998e4..0fafda699b4b 100644
--- a/oox/inc/oox/drawingml/chart/typegroupmodel.hxx
+++ b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: typegroupmodel.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,8 +31,7 @@
#ifndef OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
#define OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
-#include "oox/helper/containerhelper.hxx"
-#include "oox/drawingml/chart/modelbase.hxx"
+#include "oox/drawingml/chart/seriesmodel.hxx"
namespace oox {
namespace drawingml {
@@ -40,11 +39,35 @@ namespace chart {
// ============================================================================
-struct TypeGroupData
+struct UpDownBarsModel
{
- typedef ::std::vector< sal_Int32 > AxisIdVector;
+ 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).
@@ -56,9 +79,9 @@ struct TypeGroupData
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 (
+ 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.
+ 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.
@@ -69,26 +92,8 @@ struct TypeGroupData
bool mbVaryColors; /// True = different automatic colors for each point.
bool mbWireframe; /// True = wireframe surface chart, false = filled surface chart.
- explicit TypeGroupData( sal_Int32 nTypeId );
-};
-
-// ----------------------------------------------------------------------------
-
-class SeriesModel;
-
-class TypeGroupModel : public ModelData< TypeGroupData >
-{
-public:
explicit TypeGroupModel( sal_Int32 nTypeId );
- virtual ~TypeGroupModel();
-
- /** Creates a new data series attached to this type group. */
- SeriesModel& createSeries();
-
-private:
- typedef RefVector< SeriesModel > SeriesVector;
-
- SeriesVector maSeries; /// Series attached to this chart type group.
+ ~TypeGroupModel();
};
// ============================================================================
diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx
index f31a2182ce6e..5a9f7fecc90c 100644
--- a/oox/inc/oox/xls/excelhandlers.hxx
+++ b/oox/inc/oox/xls/excelhandlers.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: excelhandlers.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -43,8 +43,6 @@
namespace oox {
namespace xls {
-const sal_Int32 XML_ROOT_CONTEXT = ::oox::core::XML_ROOT_CONTEXT;
-
typedef ::oox::core::ContextWrapper ContextWrapper;
// ============================================================================
diff --git a/oox/source/core/contexthandler.cxx b/oox/source/core/contexthandler.cxx
index bb94de652e65..d1f8050d7945 100644
--- a/oox/source/core/contexthandler.cxx
+++ b/oox/source/core/contexthandler.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: contexthandler.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -45,15 +45,13 @@ namespace core {
// ============================================================================
ContextHandler::ContextHandler( ContextHandler& rParent ) :
- ContextHandlerImplBase( rParent ),
- mxBaseData( rParent.mxBaseData ),
- mpParentHandler( &rParent )
+ ContextHandlerImplBase(),
+ mxBaseData( rParent.mxBaseData )
{
}
ContextHandler::ContextHandler( const FragmentBaseDataRef& rxBaseData ) :
- mxBaseData( rxBaseData ),
- mpParentHandler( 0 )
+ mxBaseData( rxBaseData )
{
}
@@ -66,11 +64,6 @@ XmlFilterBase& ContextHandler::getFilter() const
return mxBaseData->mrFilter;
}
-ContextHandler* ContextHandler::getParentHandler() const
-{
- return mpParentHandler;
-}
-
const Relations& ContextHandler::getRelations() const
{
return *mxBaseData->mxRelations;
diff --git a/oox/source/core/contexthandler2.cxx b/oox/source/core/contexthandler2.cxx
index 6b30cd7a96e0..9bead2f25084 100644
--- a/oox/source/core/contexthandler2.cxx
+++ b/oox/source/core/contexthandler2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: contexthandler2.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -71,7 +71,15 @@ ContextInfo::ContextInfo() :
// ============================================================================
ContextHandler2Helper::ContextHandler2Helper() :
- mxContextStack( new ContextStack )
+ mxContextStack( new ContextStack ),
+ mnRootStackSize( 0 )
+{
+ pushContextInfo( XML_ROOT_CONTEXT );
+}
+
+ContextHandler2Helper::ContextHandler2Helper( const ContextHandler2Helper& rParent ) :
+ mxContextStack( rParent.mxContextStack ),
+ mnRootStackSize( rParent.mxContextStack->size() )
{
}
@@ -92,10 +100,14 @@ sal_Int32 ContextHandler2Helper::getPreviousElement( sal_Int32 nCountBack ) cons
XML_ROOT_CONTEXT : (*mxContextStack)[ mxContextStack->size() - nCountBack - 1 ].mnElement;
}
+bool ContextHandler2Helper::isRootElement() const
+{
+ return mxContextStack->size() == mnRootStackSize + 1;
+}
+
Reference< XFastContextHandler > ContextHandler2Helper::implCreateChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
{
- if( !mxContextStack->empty() )
- appendCollectedChars();
+ appendCollectedChars();
ContextWrapper aWrapper = onCreateContext( nElement, AttributeList( rxAttribs ) );
return aWrapper.getContextHandler( *this );
}
diff --git a/oox/source/drawingml/chart/axiscontext.cxx b/oox/source/drawingml/chart/axiscontext.cxx
index 8c5555d36dec..925381e21337 100644
--- a/oox/source/drawingml/chart/axiscontext.cxx
+++ b/oox/source/drawingml/chart/axiscontext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: axiscontext.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -29,8 +29,10 @@
************************************************************************/
#include "oox/drawingml/chart/axiscontext.hxx"
+#include "oox/drawingml/shapepropertiescontext.hxx"
+#include "oox/drawingml/textbodycontext.hxx"
#include "oox/drawingml/chart/axismodel.hxx"
-#include "oox/drawingml/chart/layoutcontext.hxx"
+#include "oox/drawingml/chart/titlecontext.hxx"
using ::oox::core::ContextHandler2Helper;
using ::oox::core::ContextWrapper;
@@ -41,8 +43,54 @@ namespace chart {
// ============================================================================
+AxisDispUnitsContext::AxisDispUnitsContext( ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel ) :
+ ContextBase< AxisDispUnitsModel >( rParent, rModel )
+{
+}
+
+AxisDispUnitsContext::~AxisDispUnitsContext()
+{
+}
+
+ContextWrapper AxisDispUnitsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( dispUnits ):
+ switch( nElement )
+ {
+ case C_TOKEN( builtInUnit ):
+ mrModel.mnBuiltInUnit = rAttribs.getToken( XML_val, XML_thousands );
+ return false;
+ case C_TOKEN( custUnit ):
+ mrModel.mfCustomUnit = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( dispUnitsLbl ):
+ return true;
+ }
+ break;
+
+ case C_TOKEN( dispUnitsLbl ):
+ switch( nElement )
+ {
+ case C_TOKEN( layout ):
+ return new LayoutContext( *this, mrModel.mxLayout.create() );
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+ case C_TOKEN( tx ):
+ return new TextContext( *this, mrModel.mxText.create() );
+ case C_TOKEN( txPr ):
+ return new TextBodyContext( *this, mrModel.mxTextProp.create() );
+ }
+ break;
+ }
+ return false;
+}
+
+// ============================================================================
+
AxisContextBase::AxisContextBase( ContextHandler2Helper& rParent, AxisModel& rModel ) :
- ChartContextBase< AxisModel >( rParent, rModel )
+ ContextBase< AxisModel >( rParent, rModel )
{
}
@@ -50,62 +98,73 @@ AxisContextBase::~AxisContextBase()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper AxisContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
- {
- switch( nElement )
- {
- case C_TOKEN( axId ):
- getModel().getData().mnAxisId = rAttribs.getInteger( XML_val, -1 );
- return false;
- case C_TOKEN( crossAx ):
- getModel().getData().mnCrossAxisId = rAttribs.getInteger( XML_val, -1 );
- return false;
- case C_TOKEN( crosses ):
- getModel().getData().mnCrossMode = rAttribs.getToken( XML_val, XML_autoZero );
- return false;
- case C_TOKEN( crossesAt ):
- getModel().getData().mfCrossesAt = rAttribs.getDouble( XML_val, 0.0 );
- return false;
- case C_TOKEN( delete ):
- getModel().getData().mbDeleted = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( majorTickMark ):
- getModel().getData().mnMajorTickMark = rAttribs.getToken( XML_val, XML_cross );
- return false;
- case C_TOKEN( minorTickMark ):
- getModel().getData().mnMinorTickMark = rAttribs.getToken( XML_val, XML_cross );
- return false;
- case C_TOKEN( numFmt ):
- getModel().getData().maFormatCode = rAttribs.getString( XML_formatCode );
- getModel().getData().mbSourceLinked = rAttribs.getBool( XML_sourceLinked, true );
- return false;
- case C_TOKEN( scaling ):
- return true;
- case C_TOKEN( tickLblPos ):
- getModel().getData().mnTickLabelPos = rAttribs.getToken( XML_val, XML_nextTo );
- return false;
- }
- }
- else switch( getCurrentElement() )
+ switch( getCurrentElement() )
{
+ case C_TOKEN( catAx ):
+ case C_TOKEN( dateAx ):
+ case C_TOKEN( serAx ):
+ case C_TOKEN( valAx ):
+ switch( nElement )
+ {
+ case C_TOKEN( axId ):
+ mrModel.mnAxisId = rAttribs.getInteger( XML_val, -1 );
+ return false;
+ case C_TOKEN( crossAx ):
+ mrModel.mnCrossAxisId = rAttribs.getInteger( XML_val, -1 );
+ return false;
+ case C_TOKEN( crosses ):
+ mrModel.mnCrossMode = rAttribs.getToken( XML_val, XML_autoZero );
+ return false;
+ case C_TOKEN( crossesAt ):
+ mrModel.mofCrossesAt = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( delete ):
+ mrModel.mbDeleted = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( majorGridlines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxMajorGridLines.create() );
+ case C_TOKEN( majorTickMark ):
+ mrModel.mnMajorTickMark = rAttribs.getToken( XML_val, XML_cross );
+ return false;
+ case C_TOKEN( minorGridlines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxMinorGridLines.create() );
+ case C_TOKEN( minorTickMark ):
+ mrModel.mnMinorTickMark = rAttribs.getToken( XML_val, XML_cross );
+ return false;
+ case C_TOKEN( numFmt ):
+ mrModel.maFormatCode = rAttribs.getString( XML_formatCode );
+ mrModel.mbSourceLinked = rAttribs.getBool( XML_sourceLinked, true );
+ return false;
+ case C_TOKEN( scaling ):
+ return true;
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+ case C_TOKEN( tickLblPos ):
+ mrModel.mnTickLabelPos = rAttribs.getToken( XML_val, XML_nextTo );
+ return false;
+ case C_TOKEN( title ):
+ return new TitleContext( *this, mrModel.mxTitle.create() );
+ case C_TOKEN( txPr ):
+ return new TextBodyContext( *this, mrModel.mxTextProp.create() );
+ }
+ break;
+
case C_TOKEN( scaling ):
switch( nElement )
{
case C_TOKEN( logBase ):
- getModel().getData().mfLogBase = rAttribs.getDouble( XML_val, 0.0 );
+ mrModel.mofLogBase = rAttribs.getDouble( XML_val, 0.0 );
return false;
case C_TOKEN( max ):
- getModel().getData().mfMax = rAttribs.getDouble( XML_val, 0.0 );
+ mrModel.mofMax = rAttribs.getDouble( XML_val, 0.0 );
return false;
case C_TOKEN( min ):
- getModel().getData().mfMin = rAttribs.getDouble( XML_val, 0.0 );
+ mrModel.mofMin = rAttribs.getDouble( XML_val, 0.0 );
return false;
case C_TOKEN( orientation ):
- getModel().getData().mnOrientation = rAttribs.getToken( XML_val, XML_minMax );
+ mrModel.mnOrientation = rAttribs.getToken( XML_val, XML_minMax );
return false;
}
break;
@@ -124,36 +183,31 @@ CatAxisContext::~CatAxisContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper CatAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( auto ):
- getModel().getData().mbAuto = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( axPos ):
- getModel().getData().mnAxisPos = rAttribs.getToken( XML_val );
- return false;
- case C_TOKEN( lblAlgn ):
- getModel().getData().mnLabelAlign = rAttribs.getToken( XML_val, XML_ctr );
- return false;
- case C_TOKEN( lblOffset ):
- getModel().getData().mnLabelOffset = rAttribs.getInteger( XML_val, 100 );
- return false;
- case C_TOKEN( noMultiLvlLbl ):
- getModel().getData().mbNoMultiLevel = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( tickLblSkip ):
- getModel().getData().mnTickLabelSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
- case C_TOKEN( tickMarkSkip ):
- getModel().getData().mnTickMarkSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
- }
+ case C_TOKEN( auto ):
+ mrModel.mbAuto = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( axPos ):
+ mrModel.mnAxisPos = rAttribs.getToken( XML_val );
+ return false;
+ case C_TOKEN( lblAlgn ):
+ mrModel.mnLabelAlign = rAttribs.getToken( XML_val, XML_ctr );
+ return false;
+ case C_TOKEN( lblOffset ):
+ mrModel.mnLabelOffset = rAttribs.getInteger( XML_val, 100 );
+ return false;
+ case C_TOKEN( noMultiLvlLbl ):
+ mrModel.mbNoMultiLevel = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( tickLblSkip ):
+ mrModel.mnTickLabelSkip = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ case C_TOKEN( tickMarkSkip ):
+ mrModel.mnTickMarkSkip = rAttribs.getInteger( XML_val, 0 );
+ return false;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
}
@@ -169,36 +223,31 @@ DateAxisContext::~DateAxisContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper DateAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( auto ):
- getModel().getData().mbAuto = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( baseTimeUnit ):
- getModel().getData().mnBaseTimeUnit = rAttribs.getToken( XML_val, XML_days );
- return false;
- case C_TOKEN( lblOffset ):
- getModel().getData().mnLabelOffset = rAttribs.getInteger( XML_val, 100 );
- return false;
- case C_TOKEN( majorTimeUnit ):
- getModel().getData().mnMajorTimeUnit = rAttribs.getToken( XML_val, XML_days );
- return false;
- case C_TOKEN( majorUnit ):
- getModel().getData().mfMajorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
- case C_TOKEN( minorTimeUnit ):
- getModel().getData().mnMinorTimeUnit = rAttribs.getToken( XML_val, XML_days );
- return false;
- case C_TOKEN( minorUnit ):
- getModel().getData().mfMinorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
- }
+ case C_TOKEN( auto ):
+ mrModel.mbAuto = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( baseTimeUnit ):
+ mrModel.mnBaseTimeUnit = rAttribs.getToken( XML_val, XML_days );
+ return false;
+ case C_TOKEN( lblOffset ):
+ mrModel.mnLabelOffset = rAttribs.getInteger( XML_val, 100 );
+ return false;
+ case C_TOKEN( majorTimeUnit ):
+ mrModel.mnMajorTimeUnit = rAttribs.getToken( XML_val, XML_days );
+ return false;
+ case C_TOKEN( majorUnit ):
+ mrModel.mofMajorUnit = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( minorTimeUnit ):
+ mrModel.mnMinorTimeUnit = rAttribs.getToken( XML_val, XML_days );
+ return false;
+ case C_TOKEN( minorUnit ):
+ mrModel.mofMinorUnit = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
}
@@ -214,21 +263,16 @@ SerAxisContext::~SerAxisContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper SerAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( tickLblSkip ):
- getModel().getData().mnTickLabelSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
- case C_TOKEN( tickMarkSkip ):
- getModel().getData().mnTickMarkSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
- }
+ case C_TOKEN( tickLblSkip ):
+ mrModel.mnTickLabelSkip = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ case C_TOKEN( tickMarkSkip ):
+ mrModel.mnTickMarkSkip = rAttribs.getInteger( XML_val, 0 );
+ return false;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
}
@@ -244,47 +288,20 @@ ValAxisContext::~ValAxisContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper ValAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
- {
- switch( nElement )
- {
- case C_TOKEN( crossBetween ):
- getModel().getData().mnCrossBetween = rAttribs.getToken( XML_val, XML_between );
- return false;
- case C_TOKEN( dispUnits ):
- return true;
- case C_TOKEN( majorUnit ):
- getModel().getData().mfMajorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
- case C_TOKEN( minorUnit ):
- getModel().getData().mfMinorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
- }
- }
- else switch( getCurrentElement() )
+ if( isRootElement() ) switch( nElement )
{
+ case C_TOKEN( crossBetween ):
+ mrModel.mnCrossBetween = rAttribs.getToken( XML_val, XML_between );
+ return false;
case C_TOKEN( dispUnits ):
- switch( nElement )
- {
- case C_TOKEN( builtInUnit ):
- getModel().getData().mnBuiltInUnit = rAttribs.getToken( XML_val, XML_thousands );
- return false;
- case C_TOKEN( custUnit ):
- getModel().getData().mfCustomUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
- }
- return (nElement == C_TOKEN( dispUnitsLbl ));
-
- case C_TOKEN( dispUnitsLbl ):
- switch( nElement )
- {
- case C_TOKEN( layout ):
- return new LayoutContext( *this, getModel().createUnitLabelsLayout() );
- }
+ return new AxisDispUnitsContext( *this, mrModel.mxDispUnits.create() );
+ case C_TOKEN( majorUnit ):
+ mrModel.mofMajorUnit = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( minorUnit ):
+ mrModel.mofMinorUnit = rAttribs.getDouble( XML_val, 0.0 );
return false;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
diff --git a/oox/source/drawingml/chart/axismodel.cxx b/oox/source/drawingml/chart/axismodel.cxx
index 0cf65fab64f6..411c5e8ee0f1 100644
--- a/oox/source/drawingml/chart/axismodel.cxx
+++ b/oox/source/drawingml/chart/axismodel.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: axismodel.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
************************************************************************/
#include "oox/drawingml/chart/axismodel.hxx"
-#include "oox/drawingml/chart/layoutmodel.hxx"
namespace oox {
namespace drawingml {
@@ -37,18 +36,22 @@ namespace chart {
// ============================================================================
-AxisData::AxisData( sal_Int32 nTypeId ) :
- mfCrossesAt( 0.0 ),
+AxisDispUnitsModel::AxisDispUnitsModel() :
mfCustomUnit( 0.0 ),
- mfMajorUnit( 0.0 ),
- mfMinorUnit( 0.0 ),
- mfLogBase( 0.0 ),
- mfMax( 0.0 ),
- mfMin( 0.0 ),
+ mnBuiltInUnit( XML_TOKEN_INVALID )
+{
+}
+
+AxisDispUnitsModel::~AxisDispUnitsModel()
+{
+}
+
+// ============================================================================
+
+AxisModel::AxisModel( sal_Int32 nTypeId ) :
mnAxisId( -1 ),
mnAxisPos( XML_TOKEN_INVALID ),
mnBaseTimeUnit( XML_days ),
- mnBuiltInUnit( XML_TOKEN_INVALID ),
mnCrossAxisId( -1 ),
mnCrossBetween( XML_between ),
mnCrossMode( XML_autoZero ),
@@ -70,23 +73,10 @@ AxisData::AxisData( sal_Int32 nTypeId ) :
{
}
-// ----------------------------------------------------------------------------
-
-AxisModel::AxisModel( sal_Int32 nTypeId ) :
- ModelData< AxisData >( nTypeId )
-{
-}
-
AxisModel::~AxisModel()
{
}
-LayoutModel& AxisModel::createUnitLabelsLayout()
-{
- mxLayout.reset( new LayoutModel );
- return *mxLayout;
-}
-
// ============================================================================
} // namespace chart
diff --git a/oox/source/drawingml/chart/makefile.mk b/oox/source/drawingml/chart/makefile.mk
index c12e30b18de0..74ff85621c60 100644
--- a/oox/source/drawingml/chart/makefile.mk
+++ b/oox/source/drawingml/chart/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.3 $
+# $Revision: 1.4 $
#
# This file is part of OpenOffice.org.
#
@@ -46,23 +46,30 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES = \
$(SLO)$/axiscontext.obj \
+ $(SLO)$/axisconverter.obj \
$(SLO)$/axismodel.obj \
+ $(SLO)$/chartcontextbase.obj \
+ $(SLO)$/chartconverter.obj \
$(SLO)$/chartformatinfo.obj \
- $(SLO)$/chartfragment.obj \
- $(SLO)$/chartmodel.obj \
$(SLO)$/chartobjecttable.obj \
- $(SLO)$/charttypeinfo.obj \
- $(SLO)$/layoutcontext.obj \
- $(SLO)$/layoutmodel.obj \
- $(SLO)$/legendcontext.obj \
- $(SLO)$/legendmodel.obj \
+ $(SLO)$/chartspaceconverter.obj \
+ $(SLO)$/chartspacefragment.obj \
+ $(SLO)$/chartspacemodel.obj \
+ $(SLO)$/converterbase.obj \
+ $(SLO)$/datasourcecontext.obj \
+ $(SLO)$/datasourceconverter.obj \
+ $(SLO)$/datasourcemodel.obj \
$(SLO)$/plotareacontext.obj \
+ $(SLO)$/plotareaconverter.obj \
$(SLO)$/plotareamodel.obj \
$(SLO)$/seriescontext.obj \
+ $(SLO)$/seriesconverter.obj \
$(SLO)$/seriesmodel.obj \
- $(SLO)$/seriessourcecontext.obj \
- $(SLO)$/seriessourcemodel.obj \
+ $(SLO)$/titlecontext.obj \
+ $(SLO)$/titleconverter.obj \
+ $(SLO)$/titlemodel.obj \
$(SLO)$/typegroupcontext.obj \
+ $(SLO)$/typegroupconverter.obj \
$(SLO)$/typegroupmodel.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/drawingml/chart/plotareacontext.cxx b/oox/source/drawingml/chart/plotareacontext.cxx
index 867ecbe3ec0f..89c204c4ac42 100644
--- a/oox/source/drawingml/chart/plotareacontext.cxx
+++ b/oox/source/drawingml/chart/plotareacontext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: plotareacontext.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -29,9 +29,10 @@
************************************************************************/
#include "oox/drawingml/chart/plotareacontext.hxx"
+#include "oox/drawingml/shapepropertiescontext.hxx"
#include "oox/drawingml/chart/axiscontext.hxx"
-#include "oox/drawingml/chart/layoutcontext.hxx"
#include "oox/drawingml/chart/plotareamodel.hxx"
+#include "oox/drawingml/chart/titlecontext.hxx"
#include "oox/drawingml/chart/typegroupcontext.hxx"
using ::oox::core::ContextHandler2Helper;
@@ -43,8 +44,50 @@ namespace chart {
// ============================================================================
+View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) :
+ ContextBase< View3DModel >( rParent, rModel )
+{
+}
+
+View3DContext::~View3DContext()
+{
+}
+
+ContextWrapper View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( view3D ):
+ switch( nElement )
+ {
+ case C_TOKEN( depthPercent ):
+ mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
+ return false;
+ case C_TOKEN( hPercent ):
+ mrModel.mnHeightPercent = rAttribs.getInteger( XML_val, 100 );
+ return false;
+ case C_TOKEN( perspective ):
+ mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
+ return false;
+ case C_TOKEN( rAngAx ):
+ mrModel.mbRightAngled = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( rotX ):
+ mrModel.mnRotationX = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ case C_TOKEN( rotY ):
+ mrModel.mnRotationY = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ }
+ break;
+ }
+ return false;
+}
+
+// ============================================================================
+
PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) :
- ChartContextBase< PlotAreaModel >( rParent, rModel )
+ ContextBase< PlotAreaModel >( rParent, rModel )
{
}
@@ -52,8 +95,6 @@ PlotAreaContext::~PlotAreaContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
@@ -63,40 +104,42 @@ ContextWrapper PlotAreaContext::onCreateContext( sal_Int32 nElement, const Attri
{
case C_TOKEN( area3DChart ):
case C_TOKEN( areaChart ):
- return new AreaTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new AreaTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( bar3DChart ):
case C_TOKEN( barChart ):
- return new BarTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new BarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( bubbleChart ):
- return new BubbleTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new BubbleTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( line3DChart ):
case C_TOKEN( lineChart ):
case C_TOKEN( stockChart ):
- return new LineTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new LineTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( doughnutChart ):
case C_TOKEN( ofPieChart ):
case C_TOKEN( pie3DChart ):
case C_TOKEN( pieChart ):
- return new PieTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new PieTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( radarChart ):
- return new RadarTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new RadarTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( scatterChart ):
- return new ScatterTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new ScatterTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( surface3DChart ):
case C_TOKEN( surfaceChart ):
- return new SurfaceTypeGroupContext( *this, getModel().createTypeGroup( nElement ) );
+ return new SurfaceTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement ) );
case C_TOKEN( catAx ):
- return new CatAxisContext( *this, getModel().createAxis( nElement ) );
+ return new CatAxisContext( *this, mrModel.maAxes.create( nElement ) );
case C_TOKEN( dateAx ):
- return new DateAxisContext( *this, getModel().createAxis( nElement ) );
+ return new DateAxisContext( *this, mrModel.maAxes.create( nElement ) );
case C_TOKEN( serAx ):
- return new SerAxisContext( *this, getModel().createAxis( nElement ) );
+ return new SerAxisContext( *this, mrModel.maAxes.create( nElement ) );
case C_TOKEN( valAx ):
- return new ValAxisContext( *this, getModel().createAxis( nElement ) );
+ return new ValAxisContext( *this, mrModel.maAxes.create( nElement ) );
case C_TOKEN( layout ):
- return new LayoutContext( *this, getModel().createLayout() );
+ return new LayoutContext( *this, mrModel.mxLayout.create() );
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
}
break;
}
diff --git a/oox/source/drawingml/chart/plotareamodel.cxx b/oox/source/drawingml/chart/plotareamodel.cxx
index f70aae05f64a..1d042a14872d 100644
--- a/oox/source/drawingml/chart/plotareamodel.cxx
+++ b/oox/source/drawingml/chart/plotareamodel.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: plotareamodel.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -29,9 +29,6 @@
************************************************************************/
#include "oox/drawingml/chart/plotareamodel.hxx"
-#include "oox/drawingml/chart/axismodel.hxx"
-#include "oox/drawingml/chart/layoutmodel.hxx"
-#include "oox/drawingml/chart/typegroupmodel.hxx"
namespace oox {
namespace drawingml {
@@ -39,32 +36,28 @@ namespace chart {
// ============================================================================
-PlotAreaModel::PlotAreaModel()
+View3DModel::View3DModel() :
+ mnDepthPercent( 100 ),
+ mnHeightPercent( 100 ),
+ mnPerspective( 30 ),
+ mnRotationX( 0 ),
+ mnRotationY( 0 ),
+ mbRightAngled( false )
{
}
-PlotAreaModel::~PlotAreaModel()
+View3DModel::~View3DModel()
{
}
-TypeGroupModel& PlotAreaModel::createTypeGroup( sal_Int32 nTypeId )
-{
- TypeGroupVector::value_type xTypeGroup( new TypeGroupModel( nTypeId ) );
- maTypeGroups.push_back( xTypeGroup );
- return *xTypeGroup;
-}
+// ============================================================================
-AxisModel& PlotAreaModel::createAxis( sal_Int32 nTypeId )
+PlotAreaModel::PlotAreaModel()
{
- AxisVector::value_type xAxis( new AxisModel( nTypeId ) );
- maAxes.push_back( xAxis );
- return *xAxis;
}
-LayoutModel& PlotAreaModel::createLayout()
+PlotAreaModel::~PlotAreaModel()
{
- mxLayout.reset( new LayoutModel );
- return *mxLayout;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/seriescontext.cxx b/oox/source/drawingml/chart/seriescontext.cxx
index 5551bb0d8d2d..39d0b0f2e559 100644
--- a/oox/source/drawingml/chart/seriescontext.cxx
+++ b/oox/source/drawingml/chart/seriescontext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: seriescontext.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -29,9 +29,14 @@
************************************************************************/
#include "oox/drawingml/chart/seriescontext.hxx"
+#include "oox/drawingml/shapepropertiescontext.hxx"
+#include "oox/drawingml/textbodycontext.hxx"
+#include "oox/drawingml/chart/datasourcecontext.hxx"
#include "oox/drawingml/chart/seriesmodel.hxx"
-#include "oox/drawingml/chart/seriessourcecontext.hxx"
+#include "oox/drawingml/chart/titlecontext.hxx"
+using ::rtl::OUString;
+using ::oox::core::ContextHandler2;
using ::oox::core::ContextHandler2Helper;
using ::oox::core::ContextWrapper;
@@ -41,42 +46,338 @@ namespace chart {
// ============================================================================
-SeriesContext::SeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel,
- sal_Int32 nTitleSrcId, sal_Int32 nCategSrcId, sal_Int32 nValueSrcId, sal_Int32 nPointSrcId ) :
- ChartContextBase< SeriesModel >( rParent, rModel ),
- mnTitleSrcId( nTitleSrcId ),
- mnCategSrcId( nCategSrcId ),
- mnValueSrcId( nValueSrcId ),
- mnPointSrcId( nPointSrcId )
+namespace {
+
+ContextWrapper lclDataLabelSharedCreateContext(
+ ContextHandler2& rContext, sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel )
+{
+ if( rContext.isRootElement() ) switch( nElement )
+ {
+ case C_TOKEN( deleted ):
+ orModel.mbDeleted = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( numFmt ):
+ orModel.moaFormatCode = rAttribs.getString( XML_formatCode );
+ orModel.mobSourceLinked = rAttribs.getBool( XML_sourceLinked, true );
+ return false;
+ case C_TOKEN( dLblPos ):
+ orModel.monLabelPos = rAttribs.getToken( XML_val );
+ return false;
+ case C_TOKEN( showBubbleSize ):
+ orModel.mobShowBubbleSize = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( showCatName ):
+ orModel.mobShowCatName = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( showLegendKey ):
+ orModel.mobShowLegendKey = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( showPercent ):
+ orModel.mobShowPercent = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( showSerName ):
+ orModel.mobShowSerName = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( showVal ):
+ orModel.mobShowVal = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( separator ):
+ // collect separator text in onEndElement()
+ return true;
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( rContext, orModel.mxShapeProp.create() );
+ case C_TOKEN( txPr ):
+ return new TextBodyContext( rContext, orModel.mxTextProp.create() );
+ }
+ return false;
+}
+
+void lclDataLabelSharedEndElement( ContextHandler2& rContext, const OUString& rChars, DataLabelModelBase& orModel )
+{
+ switch( rContext.getCurrentElement() )
+ {
+ case C_TOKEN( separator ):
+ orModel.moaSeparator = rChars;
+ break;
+ }
+}
+
+} // namespace
+
+// ============================================================================
+
+DataLabelContext::DataLabelContext( ContextHandler2Helper& rParent, DataLabelModel& rModel ) :
+ ContextBase< DataLabelModel >( rParent, rModel )
+{
+}
+
+DataLabelContext::~DataLabelContext()
+{
+}
+
+ContextWrapper DataLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( dLbl ):
+ switch( nElement )
+ {
+ case C_TOKEN( index ):
+ mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
+ return false;
+ case C_TOKEN( layout ):
+ return new LayoutContext( *this, mrModel.mxLayout.create() );
+ case C_TOKEN( tx ):
+ return new TextContext( *this, mrModel.mxText.create() );
+ }
+ break;
+ }
+ return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
+}
+
+void DataLabelContext::onEndElement( const OUString& rChars )
+{
+ lclDataLabelSharedEndElement( *this, rChars, mrModel );
+}
+
+// ============================================================================
+
+DataLabelsContext::DataLabelsContext( ContextHandler2Helper& rParent, DataLabelsModel& rModel ) :
+ ContextBase< DataLabelsModel >( rParent, rModel )
+{
+}
+
+DataLabelsContext::~DataLabelsContext()
+{
+}
+
+ContextWrapper DataLabelsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( dLbls ):
+ switch( nElement )
+ {
+ case C_TOKEN( dLbl ):
+ return new DataLabelContext( *this, mrModel.maPointLabels.create() );
+ case C_TOKEN( leaderLines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxLeaderLines.create() );
+ case C_TOKEN( showLeaderLines ):
+ mrModel.mobShowLeaderLines = rAttribs.getBool( XML_val, true );
+ return false;
+ }
+ break;
+ }
+ return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
+}
+
+void DataLabelsContext::onEndElement( const OUString& rChars )
+{
+ lclDataLabelSharedEndElement( *this, rChars, mrModel );
+}
+
+// ============================================================================
+
+ErrorBarContext::ErrorBarContext( ContextHandler2Helper& rParent, ErrorBarModel& rModel ) :
+ ContextBase< ErrorBarModel >( rParent, rModel )
+{
+}
+
+ErrorBarContext::~ErrorBarContext()
+{
+}
+
+ContextWrapper ErrorBarContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( errBars ):
+ switch( nElement )
+ {
+ case C_TOKEN( errBarType ):
+ mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_both );
+ return false;
+ case C_TOKEN( errDir ):
+ mrModel.mnDirection = rAttribs.getToken( XML_val );
+ return false;
+ case C_TOKEN( errValType ):
+ mrModel.mnValueType = rAttribs.getToken( XML_val, XML_fixedVal );
+ return false;
+ case C_TOKEN( minus ):
+ return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::MINUS ) );
+ case C_TOKEN( noEndCap ):
+ mrModel.mbNoEndCap = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( plus ):
+ return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::PLUS ) );
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+ case C_TOKEN( val ):
+ mrModel.mfValue = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ }
+ break;
+ }
+ return false;
+}
+
+// ============================================================================
+
+TrendlineContext::TrendlineContext( ContextHandler2Helper& rParent, TrendlineModel& rModel ) :
+ ContextBase< TrendlineModel >( rParent, rModel )
+{
+}
+
+TrendlineContext::~TrendlineContext()
+{
+}
+
+ContextWrapper TrendlineContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( trendline ):
+ switch( nElement )
+ {
+ case C_TOKEN( backward ):
+ mrModel.mfBackward = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( dispEq ):
+ mrModel.mbDispEquation = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( dispRSqr ):
+ mrModel.mbDispRSquared = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( forward ):
+ mrModel.mfForward = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( intercept ):
+ mrModel.mfIntercept = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( name ):
+ return true;
+ case C_TOKEN( order ):
+ mrModel.mnOrder = rAttribs.getInteger( XML_val, 2 );
+ return false;
+ case C_TOKEN( period ):
+ mrModel.mnPeriod = rAttribs.getInteger( XML_val, 2 );
+ return false;
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+ case C_TOKEN( trendlineType ):
+ mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_linear );
+ return false;
+ }
+ break;
+ }
+ return false;
+}
+
+void TrendlineContext::onEndElement( const ::rtl::OUString& rChars )
{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( name ):
+ mrModel.maName = rChars;
+ break;
+ }
}
-SeriesContext::~SeriesContext()
+// ============================================================================
+
+DataPointContext::DataPointContext( ContextHandler2Helper& rParent, DataPointModel& rModel ) :
+ ContextBase< DataPointModel >( rParent, rModel )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
+DataPointContext::~DataPointContext()
+{
+}
-ContextWrapper SeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextWrapper DataPointContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( dPt ):
+ switch( nElement )
+ {
+ case C_TOKEN( bubble3D ):
+ mrModel.mobBubble3d = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( explosion ):
+ mrModel.monExplosion = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ case C_TOKEN( idx ):
+ mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
+ return false;
+ case C_TOKEN( invertIfNegative ):
+ mrModel.mobInvertNeg = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( marker ):
+ return true;
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+ }
+ break;
+
+ case C_TOKEN( marker ):
+ switch( nElement )
+ {
+ case C_TOKEN( size ):
+ mrModel.monMarkerSize = rAttribs.getInteger( XML_val, 5 );
+ return false;
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
+ case C_TOKEN( symbol ):
+ mrModel.monMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
+ return false;
+ }
+ break;
+ }
+ return false;
+}
+
+// ============================================================================
+
+SeriesContextBase::SeriesContextBase( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ ContextBase< SeriesModel >( rParent, rModel )
+{
+}
+
+SeriesContextBase::~SeriesContextBase()
+{
+}
+
+ContextWrapper SeriesContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case C_TOKEN( ser ):
- if( nElement == mnTitleSrcId )
- return new SeriesSourceContext( *this, getModel().createTitleSource() );
- if( nElement == mnCategSrcId )
- return new SeriesSourceContext( *this, getModel().createCategorySource() );
- if( nElement == mnValueSrcId )
- return new SeriesSourceContext( *this, getModel().createValueSource() );
- if( nElement == mnPointSrcId )
- return new SeriesSourceContext( *this, getModel().createPointSource() );
switch( nElement )
{
case C_TOKEN( idx ):
- getModel().getData().mnIndex = rAttribs.getInteger( XML_val, -1 );
+ mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
return false;
case C_TOKEN( order ):
- getModel().getData().mnOrder = rAttribs.getInteger( XML_val, -1 );
+ mrModel.mnOrder = rAttribs.getInteger( XML_val, -1 );
+ return false;
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+ case C_TOKEN( tx ):
+ return new TextContext( *this, mrModel.mxText.create() );
+ }
+ break;
+
+ case C_TOKEN( marker ):
+ switch( nElement )
+ {
+ case C_TOKEN( size ):
+ mrModel.mnMarkerSize = rAttribs.getInteger( XML_val, 5 );
+ return false;
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
+ case C_TOKEN( symbol ):
+ mrModel.mnMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
return false;
}
break;
@@ -86,6 +387,307 @@ ContextWrapper SeriesContext::onCreateContext( sal_Int32 nElement, const Attribu
// ============================================================================
+AreaSeriesContext::AreaSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+AreaSeriesContext::~AreaSeriesContext()
+{
+}
+
+ContextWrapper AreaSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( cat ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( errBars ):
+ return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dPt ):
+ return new DataPointContext( *this, mrModel.maPoints.create() );
+ case C_TOKEN( trendline ):
+ return new TrendlineContext( *this, mrModel.maTrendlines.create() );
+ case C_TOKEN( val ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
+BarSeriesContext::BarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+BarSeriesContext::~BarSeriesContext()
+{
+}
+
+ContextWrapper BarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( cat ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dPt ):
+ return new DataPointContext( *this, mrModel.maPoints.create() );
+ case C_TOKEN( errBars ):
+ return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
+ case C_TOKEN( invertIfNegative ):
+ mrModel.mbInvertNeg = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( shape ):
+ mrModel.monShape = rAttribs.getToken( XML_val, XML_box );
+ return false;
+ case C_TOKEN( trendline ):
+ return new TrendlineContext( *this, mrModel.maTrendlines.create() );
+ case C_TOKEN( val ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
+BubbleSeriesContext::BubbleSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+BubbleSeriesContext::~BubbleSeriesContext()
+{
+}
+
+ContextWrapper BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( bubble3D ):
+ mrModel.mobBubble3d = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( bubbleSize ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::POINTS ) );
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dPt ):
+ return new DataPointContext( *this, mrModel.maPoints.create() );
+ case C_TOKEN( errBars ):
+ return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
+ case C_TOKEN( invertIfNegative ):
+ mrModel.mbInvertNeg = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( trendline ):
+ return new TrendlineContext( *this, mrModel.maTrendlines.create() );
+ case C_TOKEN( xVal ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( yVal ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
+LineSeriesContext::LineSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+LineSeriesContext::~LineSeriesContext()
+{
+}
+
+ContextWrapper LineSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( cat ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dPt ):
+ return new DataPointContext( *this, mrModel.maPoints.create() );
+ case C_TOKEN( errBars ):
+ return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
+ case C_TOKEN( marker ):
+ return true;
+ case C_TOKEN( smooth ):
+ mrModel.mobSmooth = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( trendline ):
+ return new TrendlineContext( *this, mrModel.maTrendlines.create() );
+ case C_TOKEN( val ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
+PieSeriesContext::PieSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+PieSeriesContext::~PieSeriesContext()
+{
+}
+
+ContextWrapper PieSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( cat ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dPt ):
+ return new DataPointContext( *this, mrModel.maPoints.create() );
+ case C_TOKEN( explosion ):
+ mrModel.mnExplosion = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ case C_TOKEN( val ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
+RadarSeriesContext::RadarSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+RadarSeriesContext::~RadarSeriesContext()
+{
+}
+
+ContextWrapper RadarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( cat ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dPt ):
+ return new DataPointContext( *this, mrModel.maPoints.create() );
+ case C_TOKEN( marker ):
+ return true;
+ case C_TOKEN( val ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
+ScatterSeriesContext::ScatterSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+ScatterSeriesContext::~ScatterSeriesContext()
+{
+}
+
+ContextWrapper ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dPt ):
+ return new DataPointContext( *this, mrModel.maPoints.create() );
+ case C_TOKEN( errBars ):
+ return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
+ case C_TOKEN( marker ):
+ return true;
+ case C_TOKEN( smooth ):
+ mrModel.mobSmooth = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( trendline ):
+ return new TrendlineContext( *this, mrModel.maTrendlines.create() );
+ case C_TOKEN( xVal ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( yVal ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
+SurfaceSeriesContext::SurfaceSeriesContext( ContextHandler2Helper& rParent, SeriesModel& rModel ) :
+ SeriesContextBase( rParent, rModel )
+{
+}
+
+SurfaceSeriesContext::~SurfaceSeriesContext()
+{
+}
+
+ContextWrapper SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( ser ):
+ switch( nElement )
+ {
+ case C_TOKEN( cat ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::CATEGORIES ) );
+ case C_TOKEN( val ):
+ return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
+ }
+ break;
+ }
+ return SeriesContextBase::onCreateContext( nElement, rAttribs );
+}
+
+// ============================================================================
+
} // namespace chart
} // namespace drawingml
} // namespace oox
diff --git a/oox/source/drawingml/chart/seriesmodel.cxx b/oox/source/drawingml/chart/seriesmodel.cxx
index 63009e4b4c25..e35881eaca4e 100644
--- a/oox/source/drawingml/chart/seriesmodel.cxx
+++ b/oox/source/drawingml/chart/seriesmodel.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: seriesmodel.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
************************************************************************/
#include "oox/drawingml/chart/seriesmodel.hxx"
-#include "oox/drawingml/chart/seriessourcemodel.hxx"
namespace oox {
namespace drawingml {
@@ -37,44 +36,91 @@ namespace chart {
// ============================================================================
-SeriesData::SeriesData() :
- mnIndex( -1 ),
- mnOrder( -1 )
+DataLabelModelBase::DataLabelModelBase() :
+ mbDeleted( false )
{
}
-// ----------------------------------------------------------------------------
+DataLabelModelBase::~DataLabelModelBase()
+{
+}
+
+// ============================================================================
-SeriesModel::SeriesModel()
+DataLabelModel::DataLabelModel() :
+ mnIndex( -1 )
{
}
-SeriesModel::~SeriesModel()
+DataLabelModel::~DataLabelModel()
+{
+}
+
+// ============================================================================
+
+DataLabelsModel::DataLabelsModel()
+{
+}
+
+DataLabelsModel::~DataLabelsModel()
+{
+}
+
+// ============================================================================
+
+ErrorBarModel::ErrorBarModel() :
+ mfValue( 0.0 ),
+ mnDirection( XML_TOKEN_INVALID ),
+ mnTypeId( XML_both ),
+ mnValueType( XML_fixedVal ),
+ mbNoEndCap( false )
+{
+}
+
+ErrorBarModel::~ErrorBarModel()
+{
+}
+
+// ============================================================================
+
+TrendlineModel::TrendlineModel() :
+ mnOrder( 2 ),
+ mnPeriod( 2 ),
+ mnTypeId( XML_linear ),
+ mbDispEquation( false ),
+ mbDispRSquared( false )
{
}
-SeriesSourceModel& SeriesModel::createTitleSource()
+TrendlineModel::~TrendlineModel()
{
- mxTitleSource.reset( new SeriesSourceModel );
- return *mxTitleSource;
}
-SeriesSourceModel& SeriesModel::createCategorySource()
+// ============================================================================
+
+DataPointModel::DataPointModel() :
+ mnIndex( -1 )
{
- mxCategSource.reset( new SeriesSourceModel );
- return *mxCategSource;
}
-SeriesSourceModel& SeriesModel::createValueSource()
+DataPointModel::~DataPointModel()
{
- mxValueSource.reset( new SeriesSourceModel );
- return *mxValueSource;
}
-SeriesSourceModel& SeriesModel::createPointSource()
+// ============================================================================
+
+SeriesModel::SeriesModel() :
+ mnExplosion( 0 ),
+ mnIndex( -1 ),
+ mnMarkerSize( 5 ),
+ mnMarkerSymbol( XML_auto ),
+ mnOrder( -1 ),
+ mbInvertNeg( false )
+{
+}
+
+SeriesModel::~SeriesModel()
{
- mxPointSource.reset( new SeriesSourceModel );
- return *mxPointSource;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/typegroupcontext.cxx b/oox/source/drawingml/chart/typegroupcontext.cxx
index af173d9c83be..8bc0353849be 100644
--- a/oox/source/drawingml/chart/typegroupcontext.cxx
+++ b/oox/source/drawingml/chart/typegroupcontext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: typegroupcontext.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -41,6 +41,37 @@ namespace chart {
// ============================================================================
+UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
+ ContextBase< UpDownBarsModel >( rParent, rModel )
+{
+}
+
+UpDownBarsContext::~UpDownBarsContext()
+{
+}
+
+ContextWrapper UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( upDownBars ):
+ switch( nElement )
+ {
+ case C_TOKEN( downBars ):
+ return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
+ case C_TOKEN( gapWidth ):
+ mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
+ return false;
+ case C_TOKEN( upBars ):
+ return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
+ }
+ break;
+ }
+ return false;
+}
+
+// ============================================================================
+
AreaTypeGroupContext::AreaTypeGroupContext( ContextHandler2Helper& rParent, TypeGroupModel& rModel ) :
TypeGroupContextBase( rParent, rModel )
{
@@ -50,29 +81,28 @@ AreaTypeGroupContext::~AreaTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( cat ), C_TOKEN( val ) );
- case C_TOKEN( axId ):
- getModel().getData().maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
- case C_TOKEN( gapDepth ):
- getModel().getData().mnGapDepth = rAttribs.getInteger( XML_val, 150 );
- return false;
- case C_TOKEN( grouping ):
- getModel().getData().mnGrouping = rAttribs.getToken( XML_val, XML_standard );
- return false;
- case C_TOKEN( varyColors ):
- getModel().getData().mbVaryColors = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( axId ):
+ mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
+ return false;
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dropLines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
+ case C_TOKEN( gapDepth ):
+ mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
+ return false;
+ case C_TOKEN( grouping ):
+ mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
+ return false;
+ case C_TOKEN( ser ):
+ return new AreaSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( varyColors ):
+ mrModel.mbVaryColors = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
@@ -88,42 +118,41 @@ BarTypeGroupContext::~BarTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( cat ), C_TOKEN( val ) );
- case C_TOKEN( axId ):
- getModel().getData().maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
- case C_TOKEN( barDir ):
- getModel().getData().mnBarDir = rAttribs.getToken( XML_val, XML_col );
- return false;
- case C_TOKEN( gapDepth ):
- getModel().getData().mnGapDepth = rAttribs.getInteger( XML_val, 150 );
- return false;
- case C_TOKEN( gapWidth ):
- getModel().getData().mnGapWidth = rAttribs.getInteger( XML_val, 150 );
- return false;
- case C_TOKEN( grouping ):
- // default is XML_standard and *not* XML_clustered as specified
- getModel().getData().mnGrouping = rAttribs.getToken( XML_val, XML_standard );
- return false;
- case C_TOKEN( overlap ):
- getModel().getData().mnOverlap = rAttribs.getInteger( XML_val, 0 );
- return false;
- case C_TOKEN( shape ):
- getModel().getData().mnShape = rAttribs.getToken( XML_val, XML_box );
- return false;
- case C_TOKEN( varyColors ):
- getModel().getData().mbVaryColors = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( axId ):
+ mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
+ return false;
+ case C_TOKEN( barDir ):
+ mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
+ return false;
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( gapDepth ):
+ mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
+ return false;
+ case C_TOKEN( gapWidth ):
+ mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
+ return false;
+ case C_TOKEN( grouping ):
+ // default is XML_standard and *not* XML_clustered as specified
+ mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
+ return false;
+ case C_TOKEN( overlap ):
+ mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ case C_TOKEN( ser ):
+ return new BarSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( serLines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
+ case C_TOKEN( shape ):
+ mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
+ return false;
+ case C_TOKEN( varyColors ):
+ mrModel.mbVaryColors = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
@@ -139,35 +168,32 @@ BubbleTypeGroupContext::~BubbleTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( xVal ), C_TOKEN( yVal ), C_TOKEN( bubbleSize ) );
- case C_TOKEN( axId ):
- getModel().getData().maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
- case C_TOKEN( bubble3D ):
- getModel().getData().mbBubble3d = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( bubbleScale ):
- getModel().getData().mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
- return false;
- case C_TOKEN( showNegBubbles ):
- getModel().getData().mbShowNegBubbles = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( sizeRepresents ):
- getModel().getData().mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
- return false;
- case C_TOKEN( varyColors ):
- getModel().getData().mbVaryColors = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( axId ):
+ mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
+ return false;
+ case C_TOKEN( bubble3D ):
+ mrModel.mbBubble3d = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( bubbleScale ):
+ mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
+ return false;
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( ser ):
+ return new BubbleSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( showNegBubbles ):
+ mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( sizeRepresents ):
+ mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
+ return false;
+ case C_TOKEN( varyColors ):
+ mrModel.mbVaryColors = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
@@ -183,35 +209,41 @@ LineTypeGroupContext::~LineTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( cat ), C_TOKEN( val ) );
- case C_TOKEN( axId ):
- getModel().getData().maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
- case C_TOKEN( gapDepth ):
- getModel().getData().mnGapDepth = rAttribs.getInteger( XML_val, 150 );
- return false;
- case C_TOKEN( grouping ):
- getModel().getData().mnGrouping = rAttribs.getToken( XML_val, XML_standard );
- return false;
- case C_TOKEN( marker ):
- getModel().getData().mbShowMarker = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( smooth ):
- getModel().getData().mbSmooth = rAttribs.getBool( XML_val, true );
- return false;
- case C_TOKEN( varyColors ):
- getModel().getData().mbVaryColors = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( axId ):
+ mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
+ return false;
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( dropLines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
+ case C_TOKEN( gapDepth ):
+ mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
+ return false;
+ case C_TOKEN( grouping ):
+ mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
+ return false;
+ case C_TOKEN( hiLowLines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
+ case C_TOKEN( marker ):
+ /* This value is *ignored* by Excel. Markers can be switched off
+ only by setting the <c:ser> -> <c:marker> -> <c:symbol> element
+ to 'none'. */
+ mrModel.mbShowMarker = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( ser ):
+ return new LineSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( smooth ):
+ /* This value is *ignored* by Excel. Line smoothing is always
+ controlled by the series. */
+ mrModel.mbSmooth = rAttribs.getBool( XML_val, true );
+ return false;
+ case C_TOKEN( varyColors ):
+ mrModel.mbVaryColors = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
@@ -227,41 +259,40 @@ PieTypeGroupContext::~PieTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( cat ), C_TOKEN( val ) );
- case C_TOKEN( firstSliceAng ):
- getModel().getData().mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
- return false;
- case C_TOKEN( gapWidth ):
- getModel().getData().mnGapWidth = rAttribs.getInteger( XML_val, 150 );
- return false;
- case C_TOKEN( holeSize ):
- getModel().getData().mnHoleSize = rAttribs.getInteger( XML_val, 10 );
- return false;
- case C_TOKEN( ofPieType ):
- getModel().getData().mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
- return false;
- case C_TOKEN( secondPieSize ):
- getModel().getData().mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
- return false;
- case C_TOKEN( splitPos ):
- getModel().getData().mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
- return false;
- case C_TOKEN( splitType ):
- getModel().getData().mnSplitType = rAttribs.getToken( XML_val, XML_auto );
- return false;
- case C_TOKEN( varyColors ):
- getModel().getData().mbVaryColors = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( firstSliceAng ):
+ mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
+ return false;
+ case C_TOKEN( gapWidth ):
+ mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
+ return false;
+ case C_TOKEN( holeSize ):
+ mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
+ return false;
+ case C_TOKEN( ofPieType ):
+ mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
+ return false;
+ case C_TOKEN( secondPieSize ):
+ mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
+ return false;
+ case C_TOKEN( ser ):
+ return new PieSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( serLines ):
+ return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
+ case C_TOKEN( splitPos ):
+ mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
+ return false;
+ case C_TOKEN( splitType ):
+ mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
+ return false;
+ case C_TOKEN( varyColors ):
+ mrModel.mbVaryColors = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
@@ -277,26 +308,23 @@ RadarTypeGroupContext::~RadarTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( cat ), C_TOKEN( val ) );
- case C_TOKEN( axId ):
- getModel().getData().maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
- case C_TOKEN( radarStyle ):
- getModel().getData().mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
- return false;
- case C_TOKEN( varyColors ):
- getModel().getData().mbVaryColors = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( axId ):
+ mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
+ return false;
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( radarStyle ):
+ mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
+ return false;
+ case C_TOKEN( ser ):
+ return new RadarSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( varyColors ):
+ mrModel.mbVaryColors = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
@@ -312,26 +340,23 @@ ScatterTypeGroupContext::~ScatterTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( xVal ), C_TOKEN( yVal ) );
- case C_TOKEN( axId ):
- getModel().getData().maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
- case C_TOKEN( scatterStyle ):
- getModel().getData().mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
- return false;
- case C_TOKEN( varyColors ):
- getModel().getData().mbVaryColors = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( axId ):
+ mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
+ return false;
+ case C_TOKEN( dLbls ):
+ return new DataLabelsContext( *this, mrModel.mxLabels.create() );
+ case C_TOKEN( scatterStyle ):
+ mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
+ return false;
+ case C_TOKEN( ser ):
+ return new ScatterSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( varyColors ):
+ mrModel.mbVaryColors = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
@@ -347,23 +372,18 @@ SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
ContextWrapper SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( getCurrentElement() == getModel().getData().mnTypeId )
+ if( isRootElement() ) switch( nElement )
{
- switch( nElement )
- {
- case C_TOKEN( ser ):
- return new SeriesContext( *this, getModel().createSeries(), C_TOKEN( tx ), C_TOKEN( cat ), C_TOKEN( val ) );
- case C_TOKEN( axId ):
- getModel().getData().maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
- case C_TOKEN( wireframe ):
- getModel().getData().mbWireframe = rAttribs.getBool( XML_val, true );
- return false;
- }
+ case C_TOKEN( axId ):
+ mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
+ return false;
+ case C_TOKEN( ser ):
+ return new SurfaceSeriesContext( *this, mrModel.maSeries.create() );
+ case C_TOKEN( wireframe ):
+ mrModel.mbWireframe = rAttribs.getBool( XML_val, true );
+ return false;
}
return false;
}
diff --git a/oox/source/drawingml/chart/typegroupmodel.cxx b/oox/source/drawingml/chart/typegroupmodel.cxx
index 6192bb2c7bdc..9ad254ddf6aa 100644
--- a/oox/source/drawingml/chart/typegroupmodel.cxx
+++ b/oox/source/drawingml/chart/typegroupmodel.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: typegroupmodel.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
************************************************************************/
#include "oox/drawingml/chart/typegroupmodel.hxx"
-#include "oox/drawingml/chart/seriesmodel.hxx"
namespace oox {
namespace drawingml {
@@ -37,7 +36,18 @@ namespace chart {
// ============================================================================
-TypeGroupData::TypeGroupData( sal_Int32 nTypeId ) :
+UpDownBarsModel::UpDownBarsModel() :
+ mnGapWidth( 150 )
+{
+}
+
+UpDownBarsModel::~UpDownBarsModel()
+{
+}
+
+// ============================================================================
+
+TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId ) :
mfSplitPos( 0.0 ),
mnBarDir( XML_col ),
mnBubbleScale( 100 ),
@@ -64,24 +74,10 @@ TypeGroupData::TypeGroupData( sal_Int32 nTypeId ) :
{
}
-// ----------------------------------------------------------------------------
-
-TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId ) :
- ModelData< TypeGroupData >( nTypeId )
-{
-}
-
TypeGroupModel::~TypeGroupModel()
{
}
-SeriesModel& TypeGroupModel::createSeries()
-{
- SeriesVector::value_type xSeries( new SeriesModel );
- maSeries.push_back( xSeries );
- return *xSeries;
-}
-
// ============================================================================
} // namespace chart
diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx
index 70c017296752..2a272aca540d 100644
--- a/oox/source/xls/drawingfragment.cxx
+++ b/oox/source/xls/drawingfragment.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drawingfragment.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -325,9 +325,12 @@ Rectangle ShapeAnchor::calcEmuLocation( const OoxAnchorSize& rEmuSheetSize ) con
break;
}
- // add 1 mm (36K EMUs) in X direction to correct display error
+ // add 0.75 mm (27,000 EMUs) in X direction to correct display error
if( aLoc.X >= 0 )
- aLoc.X += 36000;
+ aLoc.X += 27000;
+ // remove 0.25 mm (9,000 EMUs) in Y direction to correct display error
+ if( aLoc.Y >= 9000 )
+ aLoc.Y -= 9000;
return aLoc;
}