From 04c8425e2f3d2e187445632683e5780108864e3e Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 27 Jun 2013 20:25:18 +0200 Subject: add option to debug chart odf internal data provider import Change-Id: Ife9a2d7d5f6e47a16b0572b43f20d3010d60f277 --- xmloff/source/chart/SchXMLTableContext.cxx | 118 +++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 6d50672b72c0..4834767fe1b0 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -55,6 +55,89 @@ using namespace ::xmloff::token; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; +#define DEBUG_CHART_FILTER 1 + +#if DEBUG_CHART_FILTER +#include + +namespace { + +std::ostream& operator<<(std::ostream& str, const uno::Any& aAny) +{ + OUString aString; + double aValue; + bool bVal; + if(aAny >>= aString) + { + str << aString; + } + else if(aAny >>= aValue) + { + str << aValue; + } + else if(aAny >>= bVal) + { + str << bVal; + } + else + { + str << "Unknown data in Any"; + } + + return str; +} + +template +std::ostream& operator<<(std::ostream& str, const Sequence& seq) +{ + for(sal_Int32 i = 0; i < seq.getLength(); ++i) + { + str << seq[i] << " "; + } + + return str; +} + +std::ostream& operator<<(std::ostream& str, const SchXMLCell& rCell ) +{ + switch(rCell.eType) + { + case SCH_CELL_TYPE_FLOAT: + str << rCell.fValue; + break; + case SCH_CELL_TYPE_STRING: + str << rCell.aString; + break; + case SCH_CELL_TYPE_COMPLEX_STRING: + str << "Complex String"; + break; + default: + str << "Unknown Type"; + break; + } + + return str; +} + +std::ostream& operator<<(std::ostream& str, const SchXMLTable& rTable ) +{ + for(size_t i = 0; i < rTable.aData.size(); ++i) + { + str << "Row " << i << std::endl; + for(size_t j = 0; j < rTable.aData[i].size(); ++j) + { + str << rTable.aData[i][j] << " "; + } + str << std::endl; + } + + return str; +} + +} + +#endif + namespace { @@ -886,11 +969,31 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( Reference< chart2::data::XDataProvider > xDataProv( xChartDoc->getDataProvider()); +#if DEBUG_CHART_FILTER + + if( eDataRowSource == chart::ChartDataRowSource_COLUMNS ) + { + std::cout << "data in Columns" << std::endl; + } + else + { + std::cout << "data in rows" << std::endl; + } + +#endif + // create a mapping from original ranges to new ranges lcl_tOriginalRangeToInternalRangeMap aRangeMap; lcl_fillRangeMapping( rTable, aRangeMap, eDataRowSource ); +#if DEBUG_CHART_FILTER + std::cout << "Start Table" << std::endl; + std::cout << rTable << std::endl; + std::cout << "EndTable" << std::endl; + +#endif + const OUString lcl_aCategoriesRange(aCategoriesRange); bool bCategoriesApplied = false; @@ -905,6 +1008,14 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( aLSeqIt->first.second == SCH_XML_PART_ERROR_BARS ) { Reference< chart2::data::XDataSequence > xSeq( aLSeqIt->second->getValues()); + +#if DEBUG_CHART_FILTER + std::cout << "Old Data Sequence" << std::endl; + std::cout << "Source Range Representation: " << xSeq->getSourceRangeRepresentation() <getData() << std::endl; + std::cout << "Old Data Sequence End" << std::endl; +#endif + OUString aRange; if( xSeq.is() && SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) && @@ -917,6 +1028,13 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY )); aLSeqIt->second->setValues( xNewSeq ); + +#if DEBUG_CHART_FILTER + std::cout << "Data Sequence" << std::endl; + std::cout << "Source Range Representation: " << xNewSeq->getSourceRangeRepresentation() <getData() << std::endl; + std::cout << "Data Sequence End" << std::endl; +#endif } } else -- cgit