Kaydet (Commit) 4327c20f authored tarafından Björn Milcke's avatar Björn Milcke

#86215# export table if flag of MemChart-ChartRange is set

üst 70b57048
......@@ -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;
}
......
......@@ -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" );
}
}
......
......@@ -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 );
......
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