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@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
committed by
Markus Mohrhard
parent
1d497297ec
commit
3ec8d33e46
@@ -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;
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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 );
|
||||
|
@@ -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
|
||||
|
@@ -26,8 +26,7 @@ namespace chart {
|
||||
// ============================================================================
|
||||
|
||||
AxisDispUnitsModel::AxisDispUnitsModel() :
|
||||
mfCustomUnit( 0.0 ),
|
||||
mnBuiltInUnit( XML_TOKEN_INVALID )
|
||||
mfCustomUnit( 0.0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@ BorderWidth
|
||||
BottomBorder
|
||||
BottomBorderDistance
|
||||
BottomMargin
|
||||
BuiltInUnit
|
||||
BulletChar
|
||||
BulletColor
|
||||
BulletFont
|
||||
@@ -135,6 +136,7 @@ DialogLibraries
|
||||
DisableComplexChartTypes
|
||||
DisableDataTableDialog
|
||||
DisplayLabels
|
||||
DisplayUnits
|
||||
DrillDownOnDoubleClick
|
||||
Dropdown
|
||||
Duration
|
||||
|
Reference in New Issue
Block a user