[Libreoffice-commits] core.git: 7 commits - chart2/qa include/oox oox/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue May 12 11:05:22 PDT 2015
chart2/qa/extras/chart2export.cxx | 1
include/oox/export/chartexport.hxx | 4 +
oox/source/export/chartexport.cxx | 76 +++++++++++++++++++++++--------------
3 files changed, 54 insertions(+), 27 deletions(-)
New commits:
commit b34b648fc3262c5d9aa295f621e8fe9c97d4c6b2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 12 03:13:41 2015 +0200
uno::Sequence provides now begin and end
Change-Id: I7af0db5381737c7d28a491e4aca673d9cc4b1e19
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 4fcf803..8a9c30f 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -161,7 +161,7 @@ template< typename T >
void lcl_SequenceToVectorAppend( const Sequence< T > & rSource, ::std::vector< T > & rDestination )
{
rDestination.reserve( rDestination.size() + rSource.getLength());
- ::std::copy( rSource.getConstArray(), rSource.getConstArray() + rSource.getLength(),
+ ::std::copy( rSource.begin(), rSource.end(),
::std::back_inserter( rDestination ));
}
@@ -377,7 +377,7 @@ void lcl_fillCategoriesIntoStringVector(
{
rOutCategories.clear();
Sequence< OUString > aTextData( xTextualDataSequence->getTextualData());
- ::std::copy( aTextData.getConstArray(), aTextData.getConstArray() + aTextData.getLength(),
+ ::std::copy( aTextData.begin(), aTextData.end(),
::std::back_inserter( rOutCategories ));
}
else
@@ -399,7 +399,7 @@ void lcl_fillCategoriesIntoStringVector(
if( xNumSeq.is())
{
Sequence< double > aValues( xNumSeq->getNumericalData());
- ::std::copy( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(),
+ ::std::copy( aValues.begin(), aValues.end(),
::std::back_inserter( aResult ));
}
else if( xSeq.is())
commit ceac38106de4f2657e854d5e1d657d6df9321032
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 12 02:54:19 2015 +0200
add test to make sure only one x axis is non-deleted in exported doc
Change-Id: I8172015668cc43b4383276f2cd20cce4b0704277
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 7e4491c..d90cb64 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -1457,6 +1457,7 @@ void Chart2ExportTest::testMultipleAxisXLSX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart[1]/c:ser", 1);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart[2]/c:ser", 1);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx", 4);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:delete[@val='1']", 1);
}
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
commit 1573315ec978b7f53a8babeb7ad44e104896209e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 12 02:33:08 2015 +0200
export each axis only once non-deleted, related tdf#84347
Change-Id: Ia0e23faf43fd266b8314f807b77423e9a3e15797
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 186ea75..c043fd7 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -30,6 +30,8 @@
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <set>
+
namespace com { namespace sun { namespace star {
namespace chart {
class XDiagram;
@@ -103,6 +105,8 @@ private:
bool mbStacked;
bool mbPercent;
+ std::set<sal_Int32> maExportedAxis;
+
private:
sal_Int32 getChartType();
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 9c56a7e..4fcf803 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2611,6 +2611,7 @@ void ChartExport::_exportAxis(
pFS->startElement( FSNS( XML_c, XML_scaling ),
FSEND );
+
// logBase, min, max
if(GetProperty( xAxisProp, "Logarithmic" ) )
{
@@ -2671,8 +2672,15 @@ void ChartExport::_exportAxis(
OUString ("Visible")) >>= bVisible;
}
+ // only export each axis only once non-deleted
+ bool bDeleted = std::find(maExportedAxis.begin(),
+ maExportedAxis.end(), rAxisIdPair.nAxisType) != maExportedAxis.end();
+
+ if (!bDeleted)
+ maExportedAxis.insert(rAxisIdPair.nAxisType);
+
pFS->singleElement( FSNS( XML_c, XML_delete ),
- XML_val, bVisible ? "0" : "1",
+ XML_val, !bDeleted && bVisible ? "0" : "1",
FSEND );
// FIXME: axPos, need to check the property "ReverseDirection"
commit aec34850ed7d27938bee2a3a7b8761e9eb74acdc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 12 02:14:54 2015 +0200
remove and replace old OSL_TRACE messages
Change-Id: Id6de1425c03be8552d1dd2597001bf0632292e90
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 467c7ca..9c56a7e 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -494,9 +494,11 @@ OUString ChartExport::parseFormula( const OUString& rRange )
{
}
}
+
+ SAL_WARN_IF(!xParser.is(), "oox", "creating formula parser failed");
+
if( xParser.is() )
{
- OSL_TRACE("ChartExport::parseFormula, parser is valid");
Reference< XPropertySet > xParserProps( xParser, uno::UNO_QUERY );
if( xParserProps.is() )
{
@@ -511,7 +513,6 @@ OUString ChartExport::parseFormula( const OUString& rRange )
}
else
{
- OSL_TRACE("ChartExport::parseFormula, parser is invalid");
//FIXME: currently just using simple converter, e.g $Sheet1.$A$1:$C$1 -> Sheet1!$A$1:$C$1
OUString aRange( rRange );
if( aRange.startsWith("$") )
@@ -520,13 +521,11 @@ OUString ChartExport::parseFormula( const OUString& rRange )
aResult = aRange;
}
- OSL_TRACE("ChartExport::parseFormula, the originla formula is %s, the new formula is %s ", OUStringToOString( rRange, RTL_TEXTENCODING_UTF8 ).getStr(), OUStringToOString( aResult, RTL_TEXTENCODING_UTF8 ).getStr());
return aResult;
}
ChartExport& ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nChartCount )
{
- OSL_TRACE("ChartExport::WriteChartObj -- writer chart object");
FSHelperPtr pFS = GetFS();
pFS->startElementNS( mnXmlNamespace, XML_graphicFrame, FSEND );
@@ -1299,7 +1298,7 @@ void ChartExport::exportPlotArea( )
}
default:
{
- OSL_TRACE("ChartExport::exportPlotArea -- not support chart type");
+ SAL_WARN("oox", "ChartExport::exportPlotArea -- not support chart type");
break;
}
}
@@ -3162,7 +3161,6 @@ void ChartExport::exportDataPoints(
if( xPropSet.is() )
{
- OSL_TRACE("ChartExport::exportDataPoints -- writer data points ");
FSHelperPtr pFS = GetFS();
pFS->startElement( FSNS( XML_c, XML_dPt ),
FSEND );
commit 69c7625f6da8c6a2f97d7a26b6b7cba83238d978
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 12 02:04:44 2015 +0200
use r prefix for reference
Change-Id: Iad76b7263526da4e50ef3c0b6933a8833f567790
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index a5257b6..467c7ca 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1973,7 +1973,7 @@ void ChartExport::exportSurfaceChart( Reference< chart2::XChartType > xChartType
pFS->endElement( FSNS( XML_c, nTypeId ) );
}
-void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, sal_Int32& nAttachedAxis)
+void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, sal_Int32& rAttachedAxis)
{
Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
if( ! xDSCnt.is())
@@ -1981,11 +1981,11 @@ void ChartExport::exportAllSeries(Reference<chart2::XChartType> xChartType, sal_
// export dataseries for current chart-type
Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
- exportSeries(xChartType, aSeriesSeq, nAttachedAxis);
+ exportSeries(xChartType, aSeriesSeq, rAttachedAxis);
}
void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
- Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, sal_Int32& nAttachedAxis )
+ Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, sal_Int32& rAttachedAxis )
{
OUString aLabelRole = xChartType->getRoleOfSequenceForSeriesLabel();
OUString aChartType( xChartType->getChartType());
@@ -2053,7 +2053,7 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
{
sal_Int32 nLocalAttachedAxis;
mAny >>= nLocalAttachedAxis;
- nAttachedAxis = translateFromChart2AxisIndexToOox(nLocalAttachedAxis);
+ rAttachedAxis = translateFromChart2AxisIndexToOox(nLocalAttachedAxis);
}
// export shape properties
@@ -2186,12 +2186,12 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
void ChartExport::exportCandleStickSeries(
const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq,
bool /*bJapaneseCandleSticks*/,
- sal_Int32& nAttachedAxis )
+ sal_Int32& rAttachedAxis )
{
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
{
Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nSeriesIdx] );
- nAttachedAxis = lcl_isSeriesAttachedToFirstAxis( xSeries ) ? AXIS_PRIMARY_Y : AXIS_SECONDARY_Y;
+ rAttachedAxis = lcl_isSeriesAttachedToFirstAxis( xSeries ) ? AXIS_PRIMARY_Y : AXIS_SECONDARY_Y;
Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
if( xSource.is())
commit 9ec0633e3179cbe3c50260d0ba46826264ef5f68
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 12 02:01:27 2015 +0200
use chart2 API for attached axis export
Change-Id: Ide1a30307711e3857d83b691c95d984439359005
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 6af0092..a5257b6 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -117,6 +117,22 @@ namespace cssc = css::chart;
namespace oox { namespace drawingml {
+namespace {
+
+sal_Int32 translateFromChart2AxisIndexToOox(sal_Int32 nIndex)
+{
+ assert(nIndex == 0 || nIndex == 1);
+ if (nIndex == 0)
+ return AXIS_PRIMARY_Y;
+ else if (nIndex == 1)
+ return AXIS_SECONDARY_Y;
+
+ // good default value for release builds
+ return AXIS_PRIMARY_Y;
+}
+
+}
+
class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
{
public:
@@ -2032,19 +2048,19 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
if( xLabelSeq.is() )
exportSeriesText( xLabelSeq );
+ Reference<XPropertySet> xPropSet(xDataSeries, UNO_QUERY_THROW);
+ if( GetProperty( xPropSet, "AttachedAxisIndex") )
+ {
+ sal_Int32 nLocalAttachedAxis;
+ mAny >>= nLocalAttachedAxis;
+ nAttachedAxis = translateFromChart2AxisIndexToOox(nLocalAttachedAxis);
+ }
+
// export shape properties
Reference< XPropertySet > xOldPropSet = SchXMLSeriesHelper::createOldAPISeriesPropertySet(
rSeriesSeq[nSeriesIdx], getModel() );
if( xOldPropSet.is() )
{
- if( GetProperty( xOldPropSet, "Axis") )
- {
- mAny >>= nAttachedAxis;
- if( nAttachedAxis == css::chart::ChartAxisAssign::SECONDARY_Y )
- nAttachedAxis = AXIS_SECONDARY_Y;
- else
- nAttachedAxis = AXIS_PRIMARY_Y;
- }
exportShapeProps( xOldPropSet );
}
commit cafbd676785b5238f584982654c279f29d2393e0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 12 01:48:31 2015 +0200
rename variable
Change-Id: I6606ca56c28569b6b2ceb1607c8dc570ce50bba7
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index c7d5d64..6af0092 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2033,11 +2033,11 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
exportSeriesText( xLabelSeq );
// export shape properties
- Reference< XPropertySet > xPropSet = SchXMLSeriesHelper::createOldAPISeriesPropertySet(
+ Reference< XPropertySet > xOldPropSet = SchXMLSeriesHelper::createOldAPISeriesPropertySet(
rSeriesSeq[nSeriesIdx], getModel() );
- if( xPropSet.is() )
+ if( xOldPropSet.is() )
{
- if( GetProperty( xPropSet, "Axis") )
+ if( GetProperty( xOldPropSet, "Axis") )
{
mAny >>= nAttachedAxis;
if( nAttachedAxis == css::chart::ChartAxisAssign::SECONDARY_Y )
@@ -2045,7 +2045,7 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
else
nAttachedAxis = AXIS_PRIMARY_Y;
}
- exportShapeProps( xPropSet );
+ exportShapeProps( xOldPropSet );
}
switch( eChartType )
@@ -2067,7 +2067,7 @@ void ChartExport::exportSeries( Reference<chart2::XChartType> xChartType,
case chart::TYPEID_PIE:
case chart::TYPEID_DOUGHNUT:
{
- if( xPropSet.is() && GetProperty( xPropSet, "SegmentOffset") )
+ if( xOldPropSet.is() && GetProperty( xOldPropSet, "SegmentOffset") )
{
sal_Int32 nOffset = 0;
mAny >>= nOffset;
More information about the Libreoffice-commits
mailing list