summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Walvekar <nikhil.walvekar@synerzip.com>2013-12-12 17:47:55 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-19 03:55:05 +0100
commitba76bf5c7b705d3f5e8d807346a34d9da34127d3 (patch)
treea9508935c79156952509169b6509f6467a0eff23
parent20bb1e6854c42df50536238414d93993ad764999 (diff)
fdo#72304 Added properties to store Chart data table information, during import.
Change-Id: I77c458828b86bc31fae533e2e632d57237e44e6f
-rw-r--r--include/oox/drawingml/chart/plotareacontext.hxx15
-rw-r--r--include/oox/drawingml/chart/plotareaconverter.hxx15
-rw-r--r--include/oox/drawingml/chart/plotareamodel.hxx13
-rw-r--r--oox/source/drawingml/chart/plotareacontext.cxx37
-rw-r--r--oox/source/drawingml/chart/plotareaconverter.cxx24
-rw-r--r--oox/source/drawingml/chart/plotareamodel.cxx13
-rw-r--r--oox/source/token/properties.txt3
7 files changed, 120 insertions, 0 deletions
diff --git a/include/oox/drawingml/chart/plotareacontext.hxx b/include/oox/drawingml/chart/plotareacontext.hxx
index da337c74e0e7..9caec48c0d73 100644
--- a/include/oox/drawingml/chart/plotareacontext.hxx
+++ b/include/oox/drawingml/chart/plotareacontext.hxx
@@ -59,6 +59,21 @@ public:
// ============================================================================
+struct DataTableModel;
+
+/** Handler for a data table context (c:dTable element).
+ */
+class DataTableContext : public ContextBase< DataTableModel >
+{
+public:
+ explicit DataTableContext( ::oox::core::ContextHandler2Helper& rParent, DataTableModel& rModel );
+ virtual ~DataTableContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
struct PlotAreaModel;
/** Handler for a chart plot area context (c:plotArea element).
diff --git a/include/oox/drawingml/chart/plotareaconverter.hxx b/include/oox/drawingml/chart/plotareaconverter.hxx
index 2185d21c3298..aa38194c0ffe 100644
--- a/include/oox/drawingml/chart/plotareaconverter.hxx
+++ b/include/oox/drawingml/chart/plotareaconverter.hxx
@@ -65,6 +65,21 @@ public:
// ============================================================================
+struct DataTableModel;
+
+class DataTableConverter : public ConverterBase< DataTableModel >
+{
+public:
+ explicit DataTableConverter( const ConverterRoot& rParent, DataTableModel& rModel );
+ virtual ~DataTableConverter();
+
+ /** Converts the OOXML data table model to a chart2 diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram);
+};
+
+// ============================================================================
+
struct PlotAreaModel;
class PlotAreaConverter : public ConverterBase< PlotAreaModel >
diff --git a/include/oox/drawingml/chart/plotareamodel.hxx b/include/oox/drawingml/chart/plotareamodel.hxx
index 262bf19df922..7852ba868278 100644
--- a/include/oox/drawingml/chart/plotareamodel.hxx
+++ b/include/oox/drawingml/chart/plotareamodel.hxx
@@ -60,17 +60,30 @@ struct WallFloorModel
// ============================================================================
+struct DataTableModel
+{
+ bool mbShowHBorder; /// Show Horizontal Border
+ bool mbShowVBorder; /// Show Verticle Border
+ bool mbShowOutline; /// Show outline
+ explicit DataTableModel();
+ ~DataTableModel();
+};
+
+// ============================================================================
+
struct PlotAreaModel
{
typedef ModelVector< TypeGroupModel > TypeGroupVector;
typedef ModelVector< AxisModel > AxisVector;
typedef ModelRef< Shape > ShapeRef;
typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< DataTableModel > DataTableRef;
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.
+ DataTableRef mxDataTable; /// Data table of the plot area.
explicit PlotAreaModel();
~PlotAreaModel();
diff --git a/oox/source/drawingml/chart/plotareacontext.cxx b/oox/source/drawingml/chart/plotareacontext.cxx
index 4b2288da1d87..939bbc1cd16f 100644
--- a/oox/source/drawingml/chart/plotareacontext.cxx
+++ b/oox/source/drawingml/chart/plotareacontext.cxx
@@ -110,6 +110,41 @@ ContextHandlerRef WallFloorContext::onCreateContext( sal_Int32 nElement, const A
return 0;
}
+
+// ============================================================================
+
+DataTableContext::DataTableContext( ContextHandler2Helper& rParent, DataTableModel& rModel ) :
+ ContextBase< DataTableModel >( rParent, rModel )
+{
+}
+
+DataTableContext::~DataTableContext()
+{
+}
+
+ContextHandlerRef DataTableContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs)
+{
+ switch( getCurrentElement() )
+ {
+ case C_TOKEN( dTable ):
+ switch( nElement )
+ {
+ case C_TOKEN( showHorzBorder ):
+ mrModel.mbShowHBorder = rAttribs.getBool( XML_val, false );
+ break;
+ case C_TOKEN( showVertBorder ):
+ mrModel.mbShowVBorder = rAttribs.getBool( XML_val, false );
+ break;
+ case C_TOKEN( showOutline ):
+ mrModel.mbShowOutline = rAttribs.getBool( XML_val, false );
+ break;
+ }
+ break;
+ }
+ return 0;
+}
+
+// ============================================================================
// ============================================================================
PlotAreaContext::PlotAreaContext( ContextHandler2Helper& rParent, PlotAreaModel& rModel ) :
@@ -166,6 +201,8 @@ ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const At
return new LayoutContext( *this, mrModel.mxLayout.create() );
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+ case C_TOKEN(dTable):
+ return new DataTableContext( *this, mrModel.mxDataTable.create() );
}
break;
}
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx
index ff67b5fb3a1e..c069078db404 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -299,6 +299,28 @@ void WallFloorConverter::convertFromModel( const Reference< XDiagram >& rxDiagra
// ============================================================================
+DataTableConverter::DataTableConverter( const ConverterRoot& rParent, DataTableModel& rModel ) :
+ ConverterBase< DataTableModel >( rParent, rModel )
+{
+}
+
+DataTableConverter::~DataTableConverter()
+{
+}
+
+void DataTableConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
+{
+ PropertySet aPropSet( rxDiagram );
+ if (mrModel.mbShowHBorder)
+ aPropSet.setProperty( PROP_DataTableHBorder, mrModel.mbShowHBorder );
+ if (mrModel.mbShowVBorder)
+ aPropSet.setProperty( PROP_DataTableVBorder, mrModel.mbShowVBorder);
+ if (mrModel.mbShowOutline)
+ aPropSet.setProperty( PROP_DataTableOutline, mrModel.mbShowOutline );
+}
+
+// ============================================================================
+
PlotAreaConverter::PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel ) :
ConverterBase< PlotAreaModel >( rParent, rModel ),
mb3dChart( false ),
@@ -398,6 +420,8 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel )
}
}
+ DataTableConverter dataTableConverter (*this, mrModel.mxDataTable.getOrCreate());
+ dataTableConverter.convertFromModel(xDiagram);
// plot area formatting
if( xDiagram.is() && !mb3dChart )
{
diff --git a/oox/source/drawingml/chart/plotareamodel.cxx b/oox/source/drawingml/chart/plotareamodel.cxx
index 5c533778e595..08133236611f 100644
--- a/oox/source/drawingml/chart/plotareamodel.cxx
+++ b/oox/source/drawingml/chart/plotareamodel.cxx
@@ -48,6 +48,19 @@ WallFloorModel::~WallFloorModel()
// ============================================================================
+DataTableModel::DataTableModel() :
+ mbShowHBorder(false),
+ mbShowVBorder(false),
+ mbShowOutline(false)
+{
+}
+
+DataTableModel::~DataTableModel()
+{
+}
+
+// ============================================================================
+
PlotAreaModel::PlotAreaModel()
{
}
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index b0001e3160de..57b427046f06 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -120,6 +120,9 @@ D3DScenePerspective
D3DSceneShadeMode
DDELinks
DatabaseRanges
+DataTableHBorder
+DataTableVBorder
+DataTableOutline
Decoration
DefaultScrollValue
DefaultSpinValue