[Libreoffice-commits] core.git: 4 commits - include/oox oox/source vcl/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon Sep 7 07:42:29 PDT 2015
include/oox/export/chartexport.hxx | 8 +-
oox/source/export/chartexport.cxx | 122 +++++++++++++++++++++---------------
vcl/source/opengl/OpenGLContext.cxx | 3
3 files changed, 79 insertions(+), 54 deletions(-)
New commits:
commit cfb717133c7276a7b154379d049e6fac0e5a49da
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Sep 7 16:40:43 2015 +0200
that change looked wrong
Change-Id: Id40a6802536120501133968d003267f21aaf5c27
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index bccb25d..bc216bd 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3228,7 +3228,7 @@ void ChartExport::exportAxesId(bool bPrimaryAxes)
pFS->singleElement( FSNS( XML_c, XML_axId ),
XML_val, I32S( nAxisIdy ),
FSEND );
- if (bPrimaryAxes && mbHasZAxis)
+ if (mbHasZAxis)
{
sal_Int32 nAxisIdz = 0;
if( isDeep3dChart() )
commit befef6a79feae0490bd3a1cf72b1134e5ff86111
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Sep 7 16:39:23 2015 +0200
use correct axis type in secondary x axis export
Change-Id: Ic21d88b55b22c650de4fd69479b51d0f640fec6f
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 352b13d..bccb25d 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2455,6 +2455,21 @@ void ChartExport::exportAxes( )
}
}
+namespace {
+
+sal_Int32 getXAxisType(sal_Int32 eChartType)
+{
+ if( (eChartType == chart::TYPEID_SCATTER)
+ || (eChartType == chart::TYPEID_BUBBLE) )
+ return XML_valAx;
+ else if( eChartType == chart::TYPEID_STOCK )
+ return XML_dateAx;
+
+ return XML_catAx;
+}
+
+}
+
void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
{
// get some properties from document first
@@ -2518,12 +2533,8 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
if( bHasXAxisMinorGrid )
xMinorGrid.set( xAxisXSupp->getXHelpGrid(), uno::UNO_QUERY );
- sal_Int32 eChartType = getChartType( );
- if( (eChartType == chart::TYPEID_SCATTER)
- || (eChartType == chart::TYPEID_BUBBLE) )
- nAxisType = XML_valAx;
- else if( eChartType == chart::TYPEID_STOCK )
- nAxisType = XML_dateAx;
+ sal_Int32 eChartType = getChartType();
+ nAxisType = getXAxisType(eChartType);
// FIXME: axPos, need to check axis direction
sAxPos = "b";
break;
@@ -2578,7 +2589,8 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
xAxisTitle.set( xAxisSupp->getSecondXAxisTitle(), uno::UNO_QUERY );
}
- nAxisType = XML_valAx;
+ sal_Int32 eChartType = getChartType();
+ nAxisType = getXAxisType(eChartType);
// FIXME: axPos, need to check axis direction
sAxPos = "t";
break;
commit 7ce77fcfceae8fd15c3f428deb973509da2eb424
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Sep 7 16:39:04 2015 +0200
prevent crash with non-vcl OpenGL contexts
Change-Id: Ia829b0f723c8ded1237e52d48f034da3c1ac249e
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index b1212fd..83a1811 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1422,7 +1422,8 @@ void OpenGLContext::resetCurrent()
#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
// nothing
#elif defined( UNX )
- glXMakeCurrent(m_aGLWin.dpy, None, NULL);
+ if (m_aGLWin.dpy)
+ glXMakeCurrent(m_aGLWin.dpy, None, NULL);
#endif
}
commit 24560df316de86cea93a37edd38e02a2f2d9c0c2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 3 16:25:38 2015 +0100
Related: tdf#93676 unwanted duplicate axis title exported
translateFromChart2AxisIndexToOox toggles between just two
states, so convert consumers/suppliers of that to bool
Then in exportAxesId toggle between primary/seconday pairs based on that, vs
always exporting AXIS_PRIMARY_X + primary/secondary y
Change-Id: I2649f5fc07323a73a3a215fdc52d5f1a5c31c349
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index da434b1..7a4f2f7 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -152,14 +152,14 @@ private:
void exportHiLowLines();
void exportUpDownBars(css::uno::Reference< css::chart2::XChartType > xChartType );
- void exportAllSeries(css::uno::Reference<css::chart2::XChartType> xChartType, AxesType& rAttachedAxis);
+ void exportAllSeries(css::uno::Reference<css::chart2::XChartType> xChartType, bool& rPrimaryAxes);
void exportSeries(css::uno::Reference< css::chart2::XChartType > xChartType,
- css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, AxesType& rAttachedAxis );
+ css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes);
void exportCandleStickSeries(
const css::uno::Sequence<
css::uno::Reference<
css::chart2::XDataSeries > > & aSeriesSeq,
- bool bJapaneseCandleSticks, AxesType& rAttachedAxis );
+ bool bJapaneseCandleSticks, bool& rPrimaryAxes );
void exportSeriesText(
const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
void exportSeriesCategory(
@@ -193,7 +193,7 @@ private:
sal_Int32 nAxisType,
const char* sAxisPos,
const AxisIdPair& rAxisIdPair );
- void exportAxesId(AxesType nAttachedAxis);
+ void exportAxesId(bool bPrimaryAxes);
void exportView3D();
bool isDeep3dChart();
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 5851e0c..352b13d 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -119,12 +119,12 @@ namespace oox { namespace drawingml {
namespace {
-AxesType translateFromChart2AxisIndexToOox(sal_Int32 nIndex)
+bool isPrimaryAxes(sal_Int32 nIndex)
{
assert(nIndex == 0 || nIndex == 1);
if (nIndex == 1)
- return AXIS_SECONDARY_Y;
- return AXIS_PRIMARY_Y;
+ return false;
+ return true;
}
}
@@ -1533,9 +1533,9 @@ void ChartExport::exportAreaChart( Reference< chart2::XChartType > xChartType )
FSEND );
exportGrouping( );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportAllSeries( xChartType, nAttachedAxis );
- exportAxesId( nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportAllSeries(xChartType, bPrimaryAxes);
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, nTypeId ) );
}
@@ -1566,8 +1566,8 @@ void ChartExport::exportBarChart( Reference< chart2::XChartType > xChartType )
XML_val, varyColors,
FSEND );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportAllSeries( xChartType, nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportAllSeries(xChartType, bPrimaryAxes);
Reference< XPropertySet > xTypeProp( xChartType, uno::UNO_QUERY );
@@ -1626,7 +1626,7 @@ void ChartExport::exportBarChart( Reference< chart2::XChartType > xChartType )
}
}
- exportAxesId( nAttachedAxis );
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, nTypeId ) );
}
@@ -1642,14 +1642,14 @@ void ChartExport::exportBubbleChart( Reference< chart2::XChartType > xChartType
XML_val, varyColors,
FSEND );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportAllSeries( xChartType, nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportAllSeries(xChartType, bPrimaryAxes);
pFS->singleElement(FSNS(XML_c, XML_bubble3D),
XML_val, "0",
FSEND);
- exportAxesId( nAttachedAxis );
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, XML_bubbleChart ) );
}
@@ -1660,8 +1660,8 @@ void ChartExport::exportDoughnutChart( Reference< chart2::XChartType > xChartTyp
pFS->startElement( FSNS( XML_c, XML_doughnutChart ),
FSEND );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportAllSeries( xChartType, nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportAllSeries(xChartType, bPrimaryAxes);
// firstSliceAng
exportFirstSliceAng( );
//FIXME: holeSize
@@ -1734,8 +1734,8 @@ void ChartExport::exportLineChart( Reference< chart2::XChartType > xChartType )
exportGrouping( );
// TODO: show marker symbol in series?
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportSeries( xChartType, *itr, nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportSeries(xChartType, *itr, bPrimaryAxes);
// show marker?
sal_Int32 nSymbolType = css::chart::ChartSymbolType::NONE;
@@ -1753,7 +1753,7 @@ void ChartExport::exportLineChart( Reference< chart2::XChartType > xChartType )
FSEND );
}
- exportAxesId( nAttachedAxis );
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, nTypeId ) );
}
@@ -1779,8 +1779,8 @@ void ChartExport::exportPieChart( Reference< chart2::XChartType > xChartType )
XML_val, varyColors,
FSEND );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportAllSeries( xChartType, nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportAllSeries(xChartType, bPrimaryAxes);
if( !mbIs3DChart )
{
@@ -1807,9 +1807,9 @@ void ChartExport::exportRadarChart( Reference< chart2::XChartType > xChartType)
pFS->singleElement( FSNS( XML_c, XML_radarStyle ),
XML_val, radarStyle,
FSEND );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportAllSeries( xChartType, nAttachedAxis );
- exportAxesId( nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportAllSeries(xChartType, bPrimaryAxes);
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, XML_radarChart ) );
}
@@ -1848,9 +1848,9 @@ void ChartExport::exportScatterChart( Reference< chart2::XChartType > xChartType
FSEND );
// FIXME: should export xVal and yVal
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportSeries( xChartType, *itr, nAttachedAxis );
- exportAxesId( nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportSeries(xChartType, *itr, bPrimaryAxes);
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, XML_scatterChart ) );
}
@@ -1862,8 +1862,7 @@ void ChartExport::exportStockChart( Reference< chart2::XChartType > xChartType )
pFS->startElement( FSNS( XML_c, XML_stockChart ),
FSEND );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
-
+ bool bPrimaryAxes = true;
bool bJapaneseCandleSticks = false;
Reference< beans::XPropertySet > xCTProp( xChartType, uno::UNO_QUERY );
if( xCTProp.is())
@@ -1872,7 +1871,7 @@ void ChartExport::exportStockChart( Reference< chart2::XChartType > xChartType )
Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
if(xDSCnt.is())
exportCandleStickSeries(
- xDSCnt->getDataSeries(), bJapaneseCandleSticks, nAttachedAxis );
+ xDSCnt->getDataSeries(), bJapaneseCandleSticks, bPrimaryAxes );
// export stock properties
Reference< css::chart::XStatisticDisplay > xStockPropProvider( mxDiagram, uno::UNO_QUERY );
@@ -1882,7 +1881,7 @@ void ChartExport::exportStockChart( Reference< chart2::XChartType > xChartType )
exportUpDownBars(xChartType);
}
- exportAxesId( nAttachedAxis );
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, XML_stockChart ) );
}
@@ -1961,14 +1960,14 @@ void ChartExport::exportSurfaceChart( Reference< chart2::XChartType > xChartType
nTypeId = XML_surface3DChart;
pFS->startElement( FSNS( XML_c, nTypeId ),
FSEND );
- AxesType nAttachedAxis = AXIS_PRIMARY_Y;
- exportAllSeries( xChartType, nAttachedAxis );
- exportAxesId( nAttachedAxis );
+ bool bPrimaryAxes = true;
+ exportAllSeries(xChartType, bPrimaryAxes);
+ exportAxesId(bPrimaryAxes);
pFS->endElement( FSNS( XML_c, nTypeId ) );
}
-void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, AxesType& rAttachedAxis)
+void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, bool& rPrimaryAxes)
{
Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
if( ! xDSCnt.is())
@@ -1976,11 +1975,11 @@ void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, Axes
// export dataseries for current chart-type
Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
- exportSeries(xChartType, aSeriesSeq, rAttachedAxis);
+ exportSeries(xChartType, aSeriesSeq, rPrimaryAxes);
}
void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
- Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, AxesType& rAttachedAxis )
+ Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes )
{
OUString aLabelRole = xChartType->getRoleOfSequenceForSeriesLabel();
OUString aChartType( xChartType->getChartType());
@@ -2048,7 +2047,7 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
{
sal_Int32 nLocalAttachedAxis = 0;
mAny >>= nLocalAttachedAxis;
- rAttachedAxis = translateFromChart2AxisIndexToOox(nLocalAttachedAxis);
+ rPrimaryAxes = isPrimaryAxes(nLocalAttachedAxis);
}
// export shape properties
@@ -2181,12 +2180,12 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
void ChartExport::exportCandleStickSeries(
const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq,
bool /*bJapaneseCandleSticks*/,
- AxesType& rAttachedAxis )
+ bool& rPrimaryAxes)
{
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
{
Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nSeriesIdx] );
- rAttachedAxis = lcl_isSeriesAttachedToFirstAxis( xSeries ) ? AXIS_PRIMARY_Y : AXIS_SECONDARY_Y;
+ rPrimaryAxes = lcl_isSeriesAttachedToFirstAxis(xSeries) ? true : false;
Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
if( xSource.is())
@@ -2570,7 +2569,18 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
}
case AXIS_SECONDARY_X:
{
- //TODO: suspicously absent
+ Reference< css::chart::XTwoAxisXSupplier > xAxisTwoXSupp( mxDiagram, uno::UNO_QUERY );
+ if( xAxisTwoXSupp.is())
+ xAxisProp = xAxisTwoXSupp->getSecondaryXAxis();
+ if( bHasSecondaryXAxisTitle )
+ {
+ Reference< css::chart::XSecondAxisTitleSupplier > xAxisSupp( mxDiagram, uno::UNO_QUERY );
+ xAxisTitle.set( xAxisSupp->getSecondXAxisTitle(), uno::UNO_QUERY );
+ }
+
+ nAxisType = XML_valAx;
+ // FIXME: axPos, need to check axis direction
+ sAxPos = "t";
break;
}
case AXIS_SECONDARY_Y:
@@ -3191,12 +3201,14 @@ void ChartExport::exportDataPoints(
}
}
-void ChartExport::exportAxesId(AxesType nAttachedAxis)
+void ChartExport::exportAxesId(bool bPrimaryAxes)
{
sal_Int32 nAxisIdx = lcl_generateRandomValue();
sal_Int32 nAxisIdy = lcl_generateRandomValue();
- maAxes.push_back( AxisIdPair( AXIS_PRIMARY_X, nAxisIdx, nAxisIdy ) );
- maAxes.push_back( AxisIdPair( nAttachedAxis, nAxisIdy, nAxisIdx ) );
+ AxesType eXAxis = bPrimaryAxes ? AXIS_PRIMARY_X : AXIS_SECONDARY_X;
+ AxesType eYAxis = bPrimaryAxes ? AXIS_PRIMARY_Y : AXIS_SECONDARY_Y;
+ maAxes.push_back( AxisIdPair( eXAxis, nAxisIdx, nAxisIdy ) );
+ maAxes.push_back( AxisIdPair( eYAxis, nAxisIdy, nAxisIdx ) );
FSHelperPtr pFS = GetFS();
pFS->singleElement( FSNS( XML_c, XML_axId ),
XML_val, I32S( nAxisIdx ),
@@ -3204,7 +3216,7 @@ void ChartExport::exportAxesId(AxesType nAttachedAxis)
pFS->singleElement( FSNS( XML_c, XML_axId ),
XML_val, I32S( nAxisIdy ),
FSEND );
- if( mbHasZAxis )
+ if (bPrimaryAxes && mbHasZAxis)
{
sal_Int32 nAxisIdz = 0;
if( isDeep3dChart() )
More information about the Libreoffice-commits
mailing list