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;
|
struct AxisModel;
|
||||||
class TypeGroupConverter;
|
class TypeGroupConverter;
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ struct AxisDispUnitsModel
|
|||||||
LayoutRef mxLayout; /// Layout/position of the axis units label.
|
LayoutRef mxLayout; /// Layout/position of the axis units label.
|
||||||
TextRef mxText; /// Text source of the axis units label.
|
TextRef mxText; /// Text source of the axis units label.
|
||||||
double mfCustomUnit; /// Custom unit size on value axis.
|
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();
|
explicit AxisDispUnitsModel();
|
||||||
~AxisDispUnitsModel();
|
~AxisDispUnitsModel();
|
||||||
|
@@ -52,7 +52,7 @@ ContextHandlerRef AxisDispUnitsContext::onCreateContext( sal_Int32 nElement, con
|
|||||||
switch( nElement )
|
switch( nElement )
|
||||||
{
|
{
|
||||||
case C_TOKEN( builtInUnit ):
|
case C_TOKEN( builtInUnit ):
|
||||||
mrModel.mnBuiltInUnit = rAttribs.getToken( XML_val, XML_thousands );
|
mrModel.mnBuiltInUnit = rAttribs.getString( XML_val, "thousands" );
|
||||||
return 0;
|
return 0;
|
||||||
case C_TOKEN( custUnit ):
|
case C_TOKEN( custUnit ):
|
||||||
mrModel.mfCustomUnit = rAttribs.getDouble( XML_val, 0.0 );
|
mrModel.mfCustomUnit = rAttribs.getDouble( XML_val, 0.0 );
|
||||||
|
@@ -342,6 +342,10 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
|
|||||||
TitleConverter aTitleConv( *this, *mrModel.mxTitle );
|
TitleConverter aTitleConv( *this, *mrModel.mxTitle );
|
||||||
aTitleConv.convertFromModel( xTitled, "Axis Title", OBJECTTYPE_AXISTITLE, nAxesSetIdx, nAxisIdx );
|
aTitleConv.convertFromModel( xTitled, "Axis Title", OBJECTTYPE_AXISTITLE, nAxesSetIdx, nAxisIdx );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// axis data unit label -----------------------------------------------
|
||||||
|
AxisDispUnitsConverter axisDispUnitsConverter (*this, mrModel.mxDispUnits.getOrCreate());
|
||||||
|
axisDispUnitsConverter.convertFromModel(xAxis);
|
||||||
}
|
}
|
||||||
catch( Exception& )
|
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 chart
|
||||||
} // namespace drawingml
|
} // namespace drawingml
|
||||||
} // namespace oox
|
} // namespace oox
|
||||||
|
@@ -26,8 +26,7 @@ namespace chart {
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
AxisDispUnitsModel::AxisDispUnitsModel() :
|
AxisDispUnitsModel::AxisDispUnitsModel() :
|
||||||
mfCustomUnit( 0.0 ),
|
mfCustomUnit( 0.0 )
|
||||||
mnBuiltInUnit( XML_TOKEN_INVALID )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@ BorderWidth
|
|||||||
BottomBorder
|
BottomBorder
|
||||||
BottomBorderDistance
|
BottomBorderDistance
|
||||||
BottomMargin
|
BottomMargin
|
||||||
|
BuiltInUnit
|
||||||
BulletChar
|
BulletChar
|
||||||
BulletColor
|
BulletColor
|
||||||
BulletFont
|
BulletFont
|
||||||
@@ -135,6 +136,7 @@ DialogLibraries
|
|||||||
DisableComplexChartTypes
|
DisableComplexChartTypes
|
||||||
DisableDataTableDialog
|
DisableDataTableDialog
|
||||||
DisplayLabels
|
DisplayLabels
|
||||||
|
DisplayUnits
|
||||||
DrillDownOnDoubleClick
|
DrillDownOnDoubleClick
|
||||||
Dropdown
|
Dropdown
|
||||||
Duration
|
Duration
|
||||||
|
Reference in New Issue
Block a user