[Libreoffice-commits] core.git: include/oox oox/source
sushil_shinde
sushil.shinde at synerzip.com
Tue Feb 11 15:25:05 PST 2014
include/oox/drawingml/chart/axisconverter.hxx | 15 +++++++++++++++
include/oox/drawingml/chart/axismodel.hxx | 2 +-
oox/source/drawingml/chart/axiscontext.cxx | 2 +-
oox/source/drawingml/chart/axisconverter.cxx | 24 ++++++++++++++++++++++++
oox/source/drawingml/chart/axismodel.cxx | 3 +--
oox/source/token/properties.txt | 2 ++
6 files changed, 44 insertions(+), 4 deletions(-)
New commits:
commit 3ec8d33e46046b13abad2daf850e23f896ad05bc
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date: Wed Jan 29 13:33:23 2014 +0530
fdo#74112 Added properties to store chart display unit information in import.
- added display unit properties.
- added axis display unit converter class.
Change-Id: Iaa1f9a175b1109c8da7321a1567a04fb981568d1
Reviewed-on: https://gerrit.libreoffice.org/7720
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/include/oox/drawingml/chart/axisconverter.hxx b/include/oox/drawingml/chart/axisconverter.hxx
index e107057..7224b97 100644
--- a/include/oox/drawingml/chart/axisconverter.hxx
+++ b/include/oox/drawingml/chart/axisconverter.hxx
@@ -33,6 +33,21 @@ namespace chart {
// ============================================================================
+struct AxisDispUnitsModel;
+
+class AxisDispUnitsConverter : public ConverterBase< AxisDispUnitsModel >
+{
+public:
+ explicit AxisDispUnitsConverter(
+ const ConverterRoot& rParent,
+ AxisDispUnitsModel& rModel );
+ virtual ~AxisDispUnitsConverter();
+
+ /** Creates a chart2 axis and inserts it into the passed coordinate system. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& rxAxis);
+};
+
struct AxisModel;
class TypeGroupConverter;
diff --git a/include/oox/drawingml/chart/axismodel.hxx b/include/oox/drawingml/chart/axismodel.hxx
index dd543d0..d29af7f 100644
--- a/include/oox/drawingml/chart/axismodel.hxx
+++ b/include/oox/drawingml/chart/axismodel.hxx
@@ -41,7 +41,7 @@ struct AxisDispUnitsModel
LayoutRef mxLayout; /// Layout/position of the axis units label.
TextRef mxText; /// Text source of the axis units label.
double mfCustomUnit; /// Custom unit size on value axis.
- sal_Int32 mnBuiltInUnit; /// Built-in unit on value axis.
+ OUString mnBuiltInUnit; /// Built-in unit on value axis.
explicit AxisDispUnitsModel();
~AxisDispUnitsModel();
diff --git a/oox/source/drawingml/chart/axiscontext.cxx b/oox/source/drawingml/chart/axiscontext.cxx
index cf023f2..2160354 100644
--- a/oox/source/drawingml/chart/axiscontext.cxx
+++ b/oox/source/drawingml/chart/axiscontext.cxx
@@ -52,7 +52,7 @@ ContextHandlerRef AxisDispUnitsContext::onCreateContext( sal_Int32 nElement, con
switch( nElement )
{
case C_TOKEN( builtInUnit ):
- mrModel.mnBuiltInUnit = rAttribs.getToken( XML_val, XML_thousands );
+ mrModel.mnBuiltInUnit = rAttribs.getString( XML_val, "thousands" );
return 0;
case C_TOKEN( custUnit ):
mrModel.mfCustomUnit = rAttribs.getDouble( XML_val, 0.0 );
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 5efa7d9..23e4829 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -342,6 +342,10 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
TitleConverter aTitleConv( *this, *mrModel.mxTitle );
aTitleConv.convertFromModel( xTitled, "Axis Title", OBJECTTYPE_AXISTITLE, nAxesSetIdx, nAxisIdx );
}
+
+ // axis data unit label -----------------------------------------------
+ AxisDispUnitsConverter axisDispUnitsConverter (*this, mrModel.mxDispUnits.getOrCreate());
+ axisDispUnitsConverter.convertFromModel(xAxis);
}
catch( Exception& )
{
@@ -360,6 +364,26 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
// ============================================================================
+AxisDispUnitsConverter::AxisDispUnitsConverter( const ConverterRoot& rParent, AxisDispUnitsModel& rModel ) :
+ ConverterBase< AxisDispUnitsModel >( rParent, rModel )
+{
+}
+
+AxisDispUnitsConverter::~AxisDispUnitsConverter()
+{
+}
+
+void AxisDispUnitsConverter::convertFromModel( const Reference< XAxis >& rxAxis )
+{
+ PropertySet aPropSet( rxAxis );
+ if (!(mrModel.mnBuiltInUnit).isEmpty() )
+ {
+ aPropSet.setProperty(PROP_DisplayUnits, true);
+ aPropSet.setProperty( PROP_BuiltInUnit, mrModel.mnBuiltInUnit );
+ }
+}
+// ============================================================================
+
} // namespace chart
} // namespace drawingml
} // namespace oox
diff --git a/oox/source/drawingml/chart/axismodel.cxx b/oox/source/drawingml/chart/axismodel.cxx
index b628146..e91c2ec 100644
--- a/oox/source/drawingml/chart/axismodel.cxx
+++ b/oox/source/drawingml/chart/axismodel.cxx
@@ -26,8 +26,7 @@ namespace chart {
// ============================================================================
AxisDispUnitsModel::AxisDispUnitsModel() :
- mfCustomUnit( 0.0 ),
- mnBuiltInUnit( XML_TOKEN_INVALID )
+ mfCustomUnit( 0.0 )
{
}
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 7080d9b..7a41af2 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -37,6 +37,7 @@ BorderWidth
BottomBorder
BottomBorderDistance
BottomMargin
+BuiltInUnit
BulletChar
BulletColor
BulletFont
@@ -135,6 +136,7 @@ DialogLibraries
DisableComplexChartTypes
DisableDataTableDialog
DisplayLabels
+DisplayUnits
DrillDownOnDoubleClick
Dropdown
Duration
More information about the Libreoffice-commits
mailing list