diff options
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.cxx | 85 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTableContext.cxx | 28 |
3 files changed, 77 insertions, 44 deletions
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 16fa8bd6b770..7d15442537fd 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: SchXMLChartContext.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: bm $ $Date: 2001-05-17 15:48:47 $ + * last change: $Author: bm $ $Date: 2001-05-25 12:01:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -519,47 +519,47 @@ void SchXMLChartContext::EndElement() msCategoriesAddress = aStrSeq[ nLength * 2 ]; } } + } - // set table references at document - if( xProp.is()) + // set table references at document + // even when having own table (Writer) + if( xProp.is()) + { + try { - try + uno::Any aAny; + if( msChartAddress.getLength()) { - uno::Any aAny; - if( msChartAddress.getLength()) - { - aAny <<= msChartAddress; - xProp->setPropertyValue( ::rtl::OUString::createFromAscii( "ChartRangeAddress" ), aAny ); + aAny <<= msChartAddress; + xProp->setPropertyValue( ::rtl::OUString::createFromAscii( "ChartRangeAddress" ), aAny ); - if( msTableNumberList.getLength()) - { - aAny <<= msTableNumberList; - xProp->setPropertyValue( ::rtl::OUString::createFromAscii( "TableNumberList" ), aAny ); - } - } - else + if( msTableNumberList.getLength()) { - // deprecated - if( msCategoriesAddress.getLength()) - { - aAny <<= msCategoriesAddress; - xProp->setPropertyValue( rtl::OUString::createFromAscii( "CategoriesRangeAddress" ), aAny ); - } - - // deprecated - if( maSeriesAddresses.getLength()) - { - aAny <<= maSeriesAddresses; - xProp->setPropertyValue( rtl::OUString::createFromAscii( "SeriesAddresses" ), aAny ); - } + aAny <<= msTableNumberList; + xProp->setPropertyValue( ::rtl::OUString::createFromAscii( "TableNumberList" ), aAny ); } - } - catch( beans::UnknownPropertyException ) + else { - DBG_WARNING( "Required property not found in ChartDocument" ); + // deprecated + if( msCategoriesAddress.getLength()) + { + aAny <<= msCategoriesAddress; + xProp->setPropertyValue( rtl::OUString::createFromAscii( "CategoriesRangeAddress" ), aAny ); + } + + // deprecated + if( maSeriesAddresses.getLength()) + { + aAny <<= maSeriesAddresses; + xProp->setPropertyValue( rtl::OUString::createFromAscii( "SeriesAddresses" ), aAny ); + } } } + catch( beans::UnknownPropertyException ) + { + DBG_WARNING( "Required property not found in ChartDocument" ); + } } // allow BuildChart again @@ -581,9 +581,13 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( const rtl::OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList >& xAttrList ) { + static const sal_Bool bTrue = sal_True; + static const uno::Any aTrueBool( &bTrue, ::getBooleanCppuType()); + SvXMLImportContext* pContext = 0; const SvXMLTokenMap& rTokenMap = mrImportHelper.GetChartElemTokenMap(); uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument(); + uno::Reference< beans::XPropertySet > xProp( xDoc, uno::UNO_QUERY ); switch( rTokenMap.Get( nPrefix, rLocalName )) { @@ -596,7 +600,6 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( case XML_TOK_CHART_TITLE: if( xDoc.is()) { - uno::Reference< beans::XPropertySet > xProp( xDoc, uno::UNO_QUERY ); if( xProp.is()) { uno::Any aTrueBool; @@ -614,11 +617,8 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( case XML_TOK_CHART_SUBTITLE: if( xDoc.is()) { - uno::Reference< beans::XPropertySet > xProp( xDoc, uno::UNO_QUERY ); if( xProp.is()) { - uno::Any aTrueBool; - aTrueBool <<= (sal_Bool)(sal_True); xProp->setPropertyValue( rtl::OUString::createFromAscii( "HasSubTitle" ), aTrueBool ); SCH_BUILDCHART( xDoc ); } @@ -636,7 +636,18 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( case XML_TOK_CHART_TABLE: pContext = new SchXMLTableContext( mrImportHelper, GetImport(), rLocalName, maTable ); if( pContext ) + { mbHasOwnTable = sal_True; + if( xProp.is()) + try + { + xProp->setPropertyValue( ::rtl::OUString::createFromAscii( "ExportData" ), aTrueBool ); + } + catch( uno::Exception ) + { + DBG_ERRORFILE( "Property missing" ); + } + } break; } diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 84386d35d1ed..3deb549cb68b 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: SchXMLExport.cxx,v $ * - * $Revision: 1.38 $ + * $Revision: 1.39 $ * - * last change: $Author: bm $ $Date: 2001-05-25 08:18:35 $ + * last change: $Author: bm $ $Date: 2001-05-25 12:01:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -611,12 +611,12 @@ void SchXMLExportHelper::parseDocument( uno::Reference< chart::XChartDocument >& uno::Any aAny; try { - aAny = xDocPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "ExportForClipboard" )); + aAny = xDocPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "ExportData" )); aAny >>= bExportTable; } catch( uno::Exception ) { - DBG_ERROR( "Export for Clipboard flag not found" ); + DBG_ERROR( "Property ExportData not found" ); } } diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index d913952daa33..b69ed8e431bd 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: SchXMLTableContext.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: bm $ $Date: 2001-04-10 12:37:57 $ + * last change: $Author: bm $ $Date: 2001-05-25 12:01:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -469,6 +469,19 @@ void SchXMLTableHelper::applyTableSimple( uno::Reference< chart::XChartDataArray > xData( xChartDoc->getData(), uno::UNO_QUERY ); if( xData.is()) { + // get NaN + double fSolarNaN; + SolarMath::SetNAN( fSolarNaN, FALSE ); + double fNaN = fSolarNaN; + sal_Bool bConvertNaN = sal_False; + + uno::Reference< chart::XChartData > xChartData( xData, uno::UNO_QUERY ); + if( xChartData.is()) + { + fNaN = xChartData->getNotANumber(); + bConvertNaN = ( ! SolarMath::IsNAN( fNaN )); + } + sal_Int32 nRowCount = rTable.aData.size(); sal_Int32 nColumnCount = 0; sal_Int32 nCol = 0, nRow = 0; @@ -489,11 +502,20 @@ void SchXMLTableHelper::applyTableSimple( } xData->setColumnDescriptions( aLabels ); + double fVal; + const sal_Bool bConstConvertNan = bConvertNaN; for( ++iRow, nRow = 0; iRow != rTable.aData.end(); iRow++, nRow++ ) { aCategories[ nRow ] = (*iRow)[ 0 ].aString; for( nCol = 1; nCol < nColumnCount; nCol++ ) - aData[ nRow ][ nCol - 1 ] = (*iRow)[ nCol ].fValue; + { + fVal = (*iRow)[ nCol ].fValue; + if( bConstConvertNan && + SolarMath::IsNAN( fVal )) + aData[ nRow ][ nCol - 1 ] = fNaN; + else + aData[ nRow ][ nCol - 1 ] = fVal; + } } xData->setRowDescriptions( aCategories ); xData->setData( aData ); |