Kaydet (Commit) 90ea1221 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert Axis constants to an enum and hilight suspicious absence

that compiler warnings then shows (which I saw manually in the first place)
of AXIS_SECONDARY_X

Change-Id: I873623141020633ea73f14f5c93322c2346b8efb
üst 6f1184df
...@@ -64,18 +64,25 @@ namespace com { namespace sun { namespace star { ...@@ -64,18 +64,25 @@ namespace com { namespace sun { namespace star {
namespace oox { namespace drawingml { namespace oox { namespace drawingml {
const sal_Int32 AXIS_PRIMARY_X = 1; enum AxesType
const sal_Int32 AXIS_PRIMARY_Y = 2; {
const sal_Int32 AXIS_PRIMARY_Z = 3; AXIS_PRIMARY_X = 1,
const sal_Int32 AXIS_SECONDARY_X = 4; AXIS_PRIMARY_Y = 2,
const sal_Int32 AXIS_SECONDARY_Y = 5; AXIS_PRIMARY_Z = 3,
AXIS_SECONDARY_X = 4,
AXIS_SECONDARY_Y = 5
};
struct AxisIdPair{ struct AxisIdPair{
sal_Int32 nAxisType; AxesType nAxisType;
sal_Int32 nAxisId; sal_Int32 nAxisId;
sal_Int32 nCrossAx; sal_Int32 nCrossAx;
AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {} AxisIdPair(AxesType nType, sal_Int32 nId, sal_Int32 nAx)
: nAxisType(nType)
, nAxisId(nId)
, nCrossAx(nAx)
{}
}; };
class OOX_DLLPUBLIC ChartExport : public DrawingML { class OOX_DLLPUBLIC ChartExport : public DrawingML {
...@@ -145,14 +152,14 @@ private: ...@@ -145,14 +152,14 @@ private:
void exportHiLowLines(); void exportHiLowLines();
void exportUpDownBars(css::uno::Reference< css::chart2::XChartType > xChartType ); void exportUpDownBars(css::uno::Reference< css::chart2::XChartType > xChartType );
void exportAllSeries(css::uno::Reference<css::chart2::XChartType> xChartType, sal_Int32& nAttachedAxis); void exportAllSeries(css::uno::Reference<css::chart2::XChartType> xChartType, AxesType& rAttachedAxis);
void exportSeries(css::uno::Reference< css::chart2::XChartType > xChartType, void exportSeries(css::uno::Reference< css::chart2::XChartType > xChartType,
css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, sal_Int32& nAttachedAxis ); css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, AxesType& rAttachedAxis );
void exportCandleStickSeries( void exportCandleStickSeries(
const css::uno::Sequence< const css::uno::Sequence<
css::uno::Reference< css::uno::Reference<
css::chart2::XDataSeries > > & aSeriesSeq, css::chart2::XDataSeries > > & aSeriesSeq,
bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis ); bool bJapaneseCandleSticks, AxesType& rAttachedAxis );
void exportSeriesText( void exportSeriesText(
const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq ); const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
void exportSeriesCategory( void exportSeriesCategory(
...@@ -186,7 +193,7 @@ private: ...@@ -186,7 +193,7 @@ private:
sal_Int32 nAxisType, sal_Int32 nAxisType,
const char* sAxisPos, const char* sAxisPos,
const AxisIdPair& rAxisIdPair ); const AxisIdPair& rAxisIdPair );
void exportAxesId( sal_Int32 nAttachedAxis ); void exportAxesId(AxesType nAttachedAxis);
void exportView3D(); void exportView3D();
bool isDeep3dChart(); bool isDeep3dChart();
......
...@@ -119,7 +119,7 @@ namespace oox { namespace drawingml { ...@@ -119,7 +119,7 @@ namespace oox { namespace drawingml {
namespace { namespace {
sal_Int32 translateFromChart2AxisIndexToOox(sal_Int32 nIndex) AxesType translateFromChart2AxisIndexToOox(sal_Int32 nIndex)
{ {
assert(nIndex == 0 || nIndex == 1); assert(nIndex == 0 || nIndex == 1);
if (nIndex == 1) if (nIndex == 1)
...@@ -1533,7 +1533,7 @@ void ChartExport::exportAreaChart( Reference< chart2::XChartType > xChartType ) ...@@ -1533,7 +1533,7 @@ void ChartExport::exportAreaChart( Reference< chart2::XChartType > xChartType )
FSEND ); FSEND );
exportGrouping( ); exportGrouping( );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportAllSeries( xChartType, nAttachedAxis ); exportAllSeries( xChartType, nAttachedAxis );
exportAxesId( nAttachedAxis ); exportAxesId( nAttachedAxis );
...@@ -1566,7 +1566,7 @@ void ChartExport::exportBarChart( Reference< chart2::XChartType > xChartType ) ...@@ -1566,7 +1566,7 @@ void ChartExport::exportBarChart( Reference< chart2::XChartType > xChartType )
XML_val, varyColors, XML_val, varyColors,
FSEND ); FSEND );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportAllSeries( xChartType, nAttachedAxis ); exportAllSeries( xChartType, nAttachedAxis );
Reference< XPropertySet > xTypeProp( xChartType, uno::UNO_QUERY ); Reference< XPropertySet > xTypeProp( xChartType, uno::UNO_QUERY );
...@@ -1642,7 +1642,7 @@ void ChartExport::exportBubbleChart( Reference< chart2::XChartType > xChartType ...@@ -1642,7 +1642,7 @@ void ChartExport::exportBubbleChart( Reference< chart2::XChartType > xChartType
XML_val, varyColors, XML_val, varyColors,
FSEND ); FSEND );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportAllSeries( xChartType, nAttachedAxis ); exportAllSeries( xChartType, nAttachedAxis );
pFS->singleElement(FSNS(XML_c, XML_bubble3D), pFS->singleElement(FSNS(XML_c, XML_bubble3D),
...@@ -1660,7 +1660,7 @@ void ChartExport::exportDoughnutChart( Reference< chart2::XChartType > xChartTyp ...@@ -1660,7 +1660,7 @@ void ChartExport::exportDoughnutChart( Reference< chart2::XChartType > xChartTyp
pFS->startElement( FSNS( XML_c, XML_doughnutChart ), pFS->startElement( FSNS( XML_c, XML_doughnutChart ),
FSEND ); FSEND );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportAllSeries( xChartType, nAttachedAxis ); exportAllSeries( xChartType, nAttachedAxis );
// firstSliceAng // firstSliceAng
exportFirstSliceAng( ); exportFirstSliceAng( );
...@@ -1734,7 +1734,7 @@ void ChartExport::exportLineChart( Reference< chart2::XChartType > xChartType ) ...@@ -1734,7 +1734,7 @@ void ChartExport::exportLineChart( Reference< chart2::XChartType > xChartType )
exportGrouping( ); exportGrouping( );
// TODO: show marker symbol in series? // TODO: show marker symbol in series?
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportSeries( xChartType, *itr, nAttachedAxis ); exportSeries( xChartType, *itr, nAttachedAxis );
// show marker? // show marker?
...@@ -1779,7 +1779,7 @@ void ChartExport::exportPieChart( Reference< chart2::XChartType > xChartType ) ...@@ -1779,7 +1779,7 @@ void ChartExport::exportPieChart( Reference< chart2::XChartType > xChartType )
XML_val, varyColors, XML_val, varyColors,
FSEND ); FSEND );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportAllSeries( xChartType, nAttachedAxis ); exportAllSeries( xChartType, nAttachedAxis );
if( !mbIs3DChart ) if( !mbIs3DChart )
...@@ -1807,7 +1807,7 @@ void ChartExport::exportRadarChart( Reference< chart2::XChartType > xChartType) ...@@ -1807,7 +1807,7 @@ void ChartExport::exportRadarChart( Reference< chart2::XChartType > xChartType)
pFS->singleElement( FSNS( XML_c, XML_radarStyle ), pFS->singleElement( FSNS( XML_c, XML_radarStyle ),
XML_val, radarStyle, XML_val, radarStyle,
FSEND ); FSEND );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportAllSeries( xChartType, nAttachedAxis ); exportAllSeries( xChartType, nAttachedAxis );
exportAxesId( nAttachedAxis ); exportAxesId( nAttachedAxis );
...@@ -1848,7 +1848,7 @@ void ChartExport::exportScatterChart( Reference< chart2::XChartType > xChartType ...@@ -1848,7 +1848,7 @@ void ChartExport::exportScatterChart( Reference< chart2::XChartType > xChartType
FSEND ); FSEND );
// FIXME: should export xVal and yVal // FIXME: should export xVal and yVal
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportSeries( xChartType, *itr, nAttachedAxis ); exportSeries( xChartType, *itr, nAttachedAxis );
exportAxesId( nAttachedAxis ); exportAxesId( nAttachedAxis );
...@@ -1862,7 +1862,7 @@ void ChartExport::exportStockChart( Reference< chart2::XChartType > xChartType ) ...@@ -1862,7 +1862,7 @@ void ChartExport::exportStockChart( Reference< chart2::XChartType > xChartType )
pFS->startElement( FSNS( XML_c, XML_stockChart ), pFS->startElement( FSNS( XML_c, XML_stockChart ),
FSEND ); FSEND );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
bool bJapaneseCandleSticks = false; bool bJapaneseCandleSticks = false;
Reference< beans::XPropertySet > xCTProp( xChartType, uno::UNO_QUERY ); Reference< beans::XPropertySet > xCTProp( xChartType, uno::UNO_QUERY );
...@@ -1961,14 +1961,14 @@ void ChartExport::exportSurfaceChart( Reference< chart2::XChartType > xChartType ...@@ -1961,14 +1961,14 @@ void ChartExport::exportSurfaceChart( Reference< chart2::XChartType > xChartType
nTypeId = XML_surface3DChart; nTypeId = XML_surface3DChart;
pFS->startElement( FSNS( XML_c, nTypeId ), pFS->startElement( FSNS( XML_c, nTypeId ),
FSEND ); FSEND );
sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y; AxesType nAttachedAxis = AXIS_PRIMARY_Y;
exportAllSeries( xChartType, nAttachedAxis ); exportAllSeries( xChartType, nAttachedAxis );
exportAxesId( nAttachedAxis ); exportAxesId( nAttachedAxis );
pFS->endElement( FSNS( XML_c, nTypeId ) ); pFS->endElement( FSNS( XML_c, nTypeId ) );
} }
void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, sal_Int32& rAttachedAxis) void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, AxesType& rAttachedAxis)
{ {
Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY ); Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
if( ! xDSCnt.is()) if( ! xDSCnt.is())
...@@ -1980,7 +1980,7 @@ void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, sal_ ...@@ -1980,7 +1980,7 @@ void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, sal_
} }
void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType, void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, sal_Int32& rAttachedAxis ) Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, AxesType& rAttachedAxis )
{ {
OUString aLabelRole = xChartType->getRoleOfSequenceForSeriesLabel(); OUString aLabelRole = xChartType->getRoleOfSequenceForSeriesLabel();
OUString aChartType( xChartType->getChartType()); OUString aChartType( xChartType->getChartType());
...@@ -2181,7 +2181,7 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType, ...@@ -2181,7 +2181,7 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
void ChartExport::exportCandleStickSeries( void ChartExport::exportCandleStickSeries(
const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq, const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq,
bool /*bJapaneseCandleSticks*/, bool /*bJapaneseCandleSticks*/,
sal_Int32& rAttachedAxis ) AxesType& rAttachedAxis )
{ {
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx ) for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
{ {
...@@ -2568,6 +2568,11 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair) ...@@ -2568,6 +2568,11 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
sAxPos = "b"; sAxPos = "b";
break; break;
} }
case AXIS_SECONDARY_X:
{
//TODO: suspicously absent
break;
}
case AXIS_SECONDARY_Y: case AXIS_SECONDARY_Y:
{ {
Reference< css::chart::XTwoAxisYSupplier > xAxisTwoYSupp( mxDiagram, uno::UNO_QUERY ); Reference< css::chart::XTwoAxisYSupplier > xAxisTwoYSupp( mxDiagram, uno::UNO_QUERY );
...@@ -3179,7 +3184,7 @@ void ChartExport::exportDataPoints( ...@@ -3179,7 +3184,7 @@ void ChartExport::exportDataPoints(
} }
} }
void ChartExport::exportAxesId( sal_Int32 nAttachedAxis ) void ChartExport::exportAxesId(AxesType nAttachedAxis)
{ {
sal_Int32 nAxisIdx = lcl_generateRandomValue(); sal_Int32 nAxisIdx = lcl_generateRandomValue();
sal_Int32 nAxisIdy = lcl_generateRandomValue(); sal_Int32 nAxisIdy = lcl_generateRandomValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment