Files
libreoffice/xmloff/source/chart/SchXMLTools.cxx

875 lines
36 KiB
C++
Raw Normal View History

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
#include "SchXMLTools.hxx"
/*
#include <tools/debug.hxx>
*/
#include <rtl/ustrbuf.hxx>
#include <comphelper/InlineContainer.hxx>
// header for class SvXMLUnitConverter
#include <xmloff/xmluconv.hxx>
// header for struct SvXMLEnumMapEntry
#include <xmloff/xmlement.hxx>
// header for define __FAR_DATA
#include <tools/solar.h>
// header for class SvXMLImportPropertyMapper
#include <xmloff/xmlimppr.hxx>
// header for class XMLPropStyleContext
#include <xmloff/prstylei.hxx>
// header for class XMLPropertySetMapper
#include <xmloff/xmlprmap.hxx>
#include <xmloff/xmlexp.hxx>
#include "xmlnmspe.hxx"
#include <xmloff/xmlmetai.hxx>
CWS-TOOLING: integrate CWS chart39 2009-06-30 16:55:46 +0200 iha r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-30 16:45:59 +0200 iha r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again 2009-06-30 16:32:32 +0200 iha r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-29 10:04:34 +0200 iha r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-26 19:31:16 +0200 iha r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-25 10:36:28 +0200 iha r273367 : #i101968# text values in data range cause incorrect x values 2009-06-24 17:34:18 +0200 iha r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values 2009-06-24 10:16:25 +0200 iha r273317 : #i99915# wrong matrix translation causes broken chart display for small values 2009-06-19 17:20:06 +0200 iha r273174 : #i78025# charts own borders are not completely visible 2009-06-19 17:18:41 +0200 iha r273172 : #i102950# don't paint additional borders for charts 2009-06-11 16:27:54 +0200 iha r272884 : CWS-TOOLING: rebase CWS chart39 to trunk@272827 (milestone: DEV300:m50) 2009-06-09 17:50:10 +0200 iha r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong 2009-06-09 16:00:27 +0200 iha r272775 : #i98319# data point properties get lost while copying charts from calc to impress 2009-06-09 10:26:51 +0200 iha r272755 : #i98392# correct orienation of gradient fillings on 3D walls 2009-05-29 10:35:16 +0200 iha r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines 2009-05-04 18:20:31 +0200 iha r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing 2009-05-04 18:03:01 +0200 iha r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline 2009-05-04 16:45:18 +0200 iha r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon
2009-07-28 10:25:31 +00:00
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
CWS-TOOLING: integrate CWS chart39 2009-06-30 16:55:46 +0200 iha r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-30 16:45:59 +0200 iha r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again 2009-06-30 16:32:32 +0200 iha r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-29 10:04:34 +0200 iha r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-26 19:31:16 +0200 iha r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-25 10:36:28 +0200 iha r273367 : #i101968# text values in data range cause incorrect x values 2009-06-24 17:34:18 +0200 iha r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values 2009-06-24 10:16:25 +0200 iha r273317 : #i99915# wrong matrix translation causes broken chart display for small values 2009-06-19 17:20:06 +0200 iha r273174 : #i78025# charts own borders are not completely visible 2009-06-19 17:18:41 +0200 iha r273172 : #i102950# don't paint additional borders for charts 2009-06-11 16:27:54 +0200 iha r272884 : CWS-TOOLING: rebase CWS chart39 to trunk@272827 (milestone: DEV300:m50) 2009-06-09 17:50:10 +0200 iha r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong 2009-06-09 16:00:27 +0200 iha r272775 : #i98319# data point properties get lost while copying charts from calc to impress 2009-06-09 10:26:51 +0200 iha r272755 : #i98392# correct orienation of gradient fillings on 3D walls 2009-05-29 10:35:16 +0200 iha r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines 2009-05-04 18:20:31 +0200 iha r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing 2009-05-04 18:03:01 +0200 iha r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline 2009-05-04 16:45:18 +0200 iha r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon
2009-07-28 10:25:31 +00:00
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
#include <comphelper/processfactory.hxx>
using namespace com::sun::star;
using namespace ::xmloff::token;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
namespace
{
Reference< uno::XComponentContext > lcl_getComponentContext()
{
Reference< uno::XComponentContext > xContext;
try
{
Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
if( xFactProp.is())
xFactProp->getPropertyValue(OUString::createFromAscii("DefaultContext")) >>= xContext;
}
catch( uno::Exception& )
{}
return xContext;
}
rtl::OUString lcl_getGeneratorFromModel( const uno::Reference< frame::XModel >& xChartModel )
{
::rtl::OUString aGenerator;
uno::Reference< document::XDocumentPropertiesSupplier> xChartDocumentPropertiesSupplier( xChartModel, uno::UNO_QUERY );
if( xChartDocumentPropertiesSupplier.is() )
{
uno::Reference< document::XDocumentProperties > xChartDocumentProperties(
xChartDocumentPropertiesSupplier->getDocumentProperties());
if( xChartDocumentProperties.is() )
aGenerator = xChartDocumentProperties->getGenerator();
}
return aGenerator;
}
rtl::OUString lcl_getGeneratorFromModelOrItsParent( const uno::Reference< frame::XModel >& xChartModel )
{
::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
if( !aGenerator.getLength() ) //try to get the missing info from the parent document
{
uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
if( xChild.is() )
aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
}
return aGenerator;
}
2008-12-12 12:17:17 +00:00
sal_Int32 lcl_getBuildIDFromGenerator( const ::rtl::OUString& rGenerator )
{
//returns -1 if nothing found
sal_Int32 nBuildId = -1;
const OUString sBuildCompare( RTL_CONSTASCII_USTRINGPARAM( "$Build-" ) );
sal_Int32 nEnd = -1;
sal_Int32 nBegin = rGenerator.indexOf( sBuildCompare, nEnd );
if( nBegin != -1 )
{
OUString sBuildId( rGenerator.copy( nBegin + sBuildCompare.getLength() ) );
nBuildId = sBuildId.toInt32();
}
return nBuildId;
}
OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::data::XDataProvider >& xDataProvider )
{
OUString aResult = rRange;
Reference< chart2::data::XRangeXMLConversion > xRangeConversion( xDataProvider, uno::UNO_QUERY );
if( xRangeConversion.is())
aResult = xRangeConversion->convertRangeFromXML( rRange );
return aResult;
}
CWS-TOOLING: integrate CWS chart39 2009-06-30 16:55:46 +0200 iha r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-30 16:45:59 +0200 iha r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again 2009-06-30 16:32:32 +0200 iha r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-29 10:04:34 +0200 iha r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-26 19:31:16 +0200 iha r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-25 10:36:28 +0200 iha r273367 : #i101968# text values in data range cause incorrect x values 2009-06-24 17:34:18 +0200 iha r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values 2009-06-24 10:16:25 +0200 iha r273317 : #i99915# wrong matrix translation causes broken chart display for small values 2009-06-19 17:20:06 +0200 iha r273174 : #i78025# charts own borders are not completely visible 2009-06-19 17:18:41 +0200 iha r273172 : #i102950# don't paint additional borders for charts 2009-06-11 16:27:54 +0200 iha r272884 : CWS-TOOLING: rebase CWS chart39 to trunk@272827 (milestone: DEV300:m50) 2009-06-09 17:50:10 +0200 iha r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong 2009-06-09 16:00:27 +0200 iha r272775 : #i98319# data point properties get lost while copying charts from calc to impress 2009-06-09 10:26:51 +0200 iha r272755 : #i98392# correct orienation of gradient fillings on 3D walls 2009-05-29 10:35:16 +0200 iha r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines 2009-05-04 18:20:31 +0200 iha r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing 2009-05-04 18:03:01 +0200 iha r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline 2009-05-04 16:45:18 +0200 iha r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon
2009-07-28 10:25:31 +00:00
Reference< chart2::data::XDataSequence > lcl_createNewSequenceFromCachedXMLRange( const Reference< chart2::data::XDataSequence >& xSeq, const Reference< chart2::data::XDataProvider >& xDataProvider )
{
Reference< chart2::data::XDataSequence > xRet;
OUString aRange;
if( xSeq.is() && SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) )
CWS-TOOLING: integrate CWS chart39 2009-06-30 16:55:46 +0200 iha r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-30 16:45:59 +0200 iha r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again 2009-06-30 16:32:32 +0200 iha r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-29 10:04:34 +0200 iha r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-26 19:31:16 +0200 iha r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-25 10:36:28 +0200 iha r273367 : #i101968# text values in data range cause incorrect x values 2009-06-24 17:34:18 +0200 iha r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values 2009-06-24 10:16:25 +0200 iha r273317 : #i99915# wrong matrix translation causes broken chart display for small values 2009-06-19 17:20:06 +0200 iha r273174 : #i78025# charts own borders are not completely visible 2009-06-19 17:18:41 +0200 iha r273172 : #i102950# don't paint additional borders for charts 2009-06-11 16:27:54 +0200 iha r272884 : CWS-TOOLING: rebase CWS chart39 to trunk@272827 (milestone: DEV300:m50) 2009-06-09 17:50:10 +0200 iha r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong 2009-06-09 16:00:27 +0200 iha r272775 : #i98319# data point properties get lost while copying charts from calc to impress 2009-06-09 10:26:51 +0200 iha r272755 : #i98392# correct orienation of gradient fillings on 3D walls 2009-05-29 10:35:16 +0200 iha r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines 2009-05-04 18:20:31 +0200 iha r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing 2009-05-04 18:03:01 +0200 iha r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline 2009-05-04 16:45:18 +0200 iha r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon
2009-07-28 10:25:31 +00:00
{
xRet.set( xDataProvider->createDataSequenceByRangeRepresentation(
lcl_ConvertRange( aRange, xDataProvider )) );
SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ),
Reference< beans::XPropertySet >( xRet, uno::UNO_QUERY ));
CWS-TOOLING: integrate CWS chart39 2009-06-30 16:55:46 +0200 iha r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-30 16:45:59 +0200 iha r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again 2009-06-30 16:32:32 +0200 iha r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-29 10:04:34 +0200 iha r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-26 19:31:16 +0200 iha r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-25 10:36:28 +0200 iha r273367 : #i101968# text values in data range cause incorrect x values 2009-06-24 17:34:18 +0200 iha r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values 2009-06-24 10:16:25 +0200 iha r273317 : #i99915# wrong matrix translation causes broken chart display for small values 2009-06-19 17:20:06 +0200 iha r273174 : #i78025# charts own borders are not completely visible 2009-06-19 17:18:41 +0200 iha r273172 : #i102950# don't paint additional borders for charts 2009-06-11 16:27:54 +0200 iha r272884 : CWS-TOOLING: rebase CWS chart39 to trunk@272827 (milestone: DEV300:m50) 2009-06-09 17:50:10 +0200 iha r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong 2009-06-09 16:00:27 +0200 iha r272775 : #i98319# data point properties get lost while copying charts from calc to impress 2009-06-09 10:26:51 +0200 iha r272755 : #i98392# correct orienation of gradient fillings on 3D walls 2009-05-29 10:35:16 +0200 iha r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines 2009-05-04 18:20:31 +0200 iha r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing 2009-05-04 18:03:01 +0200 iha r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline 2009-05-04 16:45:18 +0200 iha r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon
2009-07-28 10:25:31 +00:00
}
return xRet;
}
} // anonymous namespace
// ----------------------------------------
namespace SchXMLTools
{
static __FAR_DATA SvXMLEnumMapEntry aXMLChartClassMap[] =
{
{ XML_LINE, XML_CHART_CLASS_LINE },
{ XML_AREA, XML_CHART_CLASS_AREA },
{ XML_CIRCLE, XML_CHART_CLASS_CIRCLE },
{ XML_RING, XML_CHART_CLASS_RING },
{ XML_SCATTER, XML_CHART_CLASS_SCATTER },
{ XML_RADAR, XML_CHART_CLASS_RADAR },
{ XML_FILLED_RADAR, XML_CHART_CLASS_FILLED_RADAR },
{ XML_BAR, XML_CHART_CLASS_BAR },
{ XML_STOCK, XML_CHART_CLASS_STOCK },
{ XML_BUBBLE, XML_CHART_CLASS_BUBBLE },
{ XML_SURFACE, XML_CHART_CLASS_BAR }, //@todo change this if a surface chart is available
{ XML_ADD_IN, XML_CHART_CLASS_ADDIN },
{ XML_TOKEN_INVALID, XML_CHART_CLASS_UNKNOWN }
};
SchXMLChartTypeEnum GetChartTypeEnum( const OUString& rClassName )
{
USHORT nEnumVal = XML_CHART_CLASS_UNKNOWN;
if( !SvXMLUnitConverter::convertEnum(
nEnumVal, rClassName, aXMLChartClassMap ) )
nEnumVal = XML_CHART_CLASS_UNKNOWN;
return SchXMLChartTypeEnum(nEnumVal);
}
typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap;
//static
const tMakeStringStringMap& lcl_getChartTypeNameMap()
{
//shape property -- chart model object property
static tMakeStringStringMap g_aChartTypeNameMap =
tMakeStringStringMap
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.LineDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.LineChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.AreaDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.AreaChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.BarDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ColumnChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.PieDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.PieChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.DonutDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.DonutChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" ) )
CWS-TOOLING: integrate CWS bubblechart 2009-06-17 08:41:14 +0200 hde r273051 : i101635: added new charttype bubble 2009-06-17 08:39:37 +0200 hde r273050 : i101635: created new testcase tCreateNewBubbleChart 2009-06-17 08:38:07 +0200 hde r273049 : i101635: created new testcase tCreateNewBubbleChart 2009-06-15 15:22:32 +0200 hde r272991 : 101635 2009-06-11 12:44:01 +0200 iha r272864 : rebase to dev300m50 2009-06-10 23:27:54 +0200 iha r272841 : CWS-TOOLING: rebase CWS bubblechart to trunk@272827 (milestone: DEV300:m50) 2009-06-04 18:07:35 +0200 iha r272649 : #i64689# Bubble Chart 2009-06-04 17:26:44 +0200 iha r272647 : #i64689# Bubble Chart 2009-06-04 11:24:25 +0200 iha r272618 : #i64689# add more spacing between bubbles and data labels 2009-05-26 18:05:23 +0200 ufi r272314 : i101637 2009-04-22 14:37:50 +0200 iha r271115 : #i64689# bubble chart 2009-04-21 17:52:23 +0200 iha r271052 : #i64689# bubble chart 2009-04-21 17:50:48 +0200 iha r271051 : #i76728# type icon for xy chart 2009-04-21 17:25:52 +0200 iha r271049 : #i76728# type icon for xy chart 2009-04-09 11:18:09 +0200 iha r270685 : #i100977# autoscaling works not correct if missing values should be treated as zero 2009-04-08 16:39:43 +0200 iha r270656 : #i64689# bubble chart - missing value treatment 2009-04-08 15:13:25 +0200 iha r270655 : #i64689# bubble chart - remove unused code 2009-04-08 15:12:19 +0200 iha r270653 : #i64689# bubble chart - determine sereis length correctly on export 2009-04-08 14:22:43 +0200 iha r270650 : #i64689# bubble chart - remove unused code 2009-04-08 14:12:09 +0200 iha r270646 : #i64689# bubble chart - export domains even if no main sequence was found 2009-04-08 14:11:07 +0200 iha r270645 : #i64689# bubble chart - don't replace missing size values with 1.0 2009-04-07 16:20:22 +0200 iha r270602 : #i64689# bubble chart - do not offer percent values for data label display for xy and bubble chart 2009-04-07 16:17:42 +0200 iha r270601 : remove superfluous code 2009-04-06 16:39:32 +0200 iha r270569 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-02 17:33:33 +0200 iha r270427 : use input string for formatting in data table during edit 2009-04-02 16:00:29 +0200 iha r270413 : #i64689# bubble chart - when creating a new series within the data table give it the same number format as the former series, thus the new bubble size values can be edited with the same format immidiately 2009-04-02 11:25:33 +0200 iha r270385 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-01 11:32:03 +0200 iha r270312 : #i64689# bubble chart - add further parameter for view creation 2009-03-31 17:52:08 +0200 iha r270291 : #i64689# bubble chart - scale bubble size with diagram size 2009-03-31 13:38:13 +0200 iha r270278 : #i64689# bubble chart - wrong size for small values < 1 2009-03-27 19:11:07 +0100 iha r270169 : #i64689# bubble chart 2009-03-27 19:07:11 +0100 iha r270168 : #i64689# bubble chart - remove unused code 2009-03-27 18:33:57 +0100 iha r270167 : #i64689# bubble chart - create no shape for invalid sizes 2009-03-27 15:18:21 +0100 iha r270157 : #i76728# type icon for xy chart 2009-03-27 14:34:38 +0100 iha r270156 : #i64689# bubble chart - correct scaling 2009-03-27 14:27:27 +0100 iha r270155 : #i64689# bubble chart - images 2009-03-27 14:25:45 +0100 iha r270154 : #i64689# bubble chart - images 2009-03-27 11:38:57 +0100 iha r270142 : #i64689# bubble chart - values-size is the main series 2009-03-27 11:30:20 +0100 iha r270140 : #i64689# correct order of sequences after load thus switching charttypes afterwards produces expected results now 2009-03-26 10:22:55 +0100 iha r270056 : #i64689# bubble chart 2009-03-24 17:45:15 +0100 iha r269984 : #i64689# bubble chart - user properties from points (not only from the series) 2009-03-24 15:10:57 +0100 dr r269954 : #i64989# export bubble charts to xls 2009-03-24 14:55:29 +0100 dr r269952 : #i64989# import bubble charts from xls 2009-03-24 14:54:46 +0100 dr r269950 : #i64989# import bubble charts from ooxml 2009-03-23 18:59:08 +0100 iha r269895 : further cleanups possible with new member m_aGlobalSeriesImportInfo 2009-03-23 16:54:04 +0100 iha r269886 : #i64689# bubble chart - a single sequence must be interpreted as sizes because of ODF specification 2009-03-23 16:50:43 +0100 iha r269885 : #i64689# save&load bubble chart 2009-03-20 19:30:29 +0100 iha r269826 : CWS-TOOLING: rebase CWS bubblechart to trunk@269781 (milestone: DEV300:m44) 2009-03-19 11:30:33 +0100 iha r269732 : #i64689# rename SchXMLCategoriesDomainContext to SchXMLCategoriesContext avoid confusion with domains 2009-03-18 17:11:13 +0100 iha r269693 : #i64689# add charttype bubble 2009-03-18 17:09:22 +0100 iha r269692 : #i64689# remove unused code 2009-03-13 12:18:26 +0100 iha r269467 : #i64689# corrected lineends 2009-03-12 11:25:14 +0100 iha r269376 : #i64689# bubble chart (part 1)
2009-07-02 19:17:43 +00:00
( ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" ) )
;
return g_aChartTypeNameMap;
}
OUString GetNewChartTypeName( const OUString & rOldChartTypeName )
{
OUString aNew(rOldChartTypeName);
const tMakeStringStringMap& rMap = lcl_getChartTypeNameMap();
tMakeStringStringMap::const_iterator aIt( rMap.find( rOldChartTypeName ));
if( aIt != rMap.end())
{
aNew = aIt->second;
}
return aNew;
}
OUString GetChartTypeByClassName(
const OUString & rClassName, bool bUseOldNames )
{
OUStringBuffer aResultBuffer;
bool bInternalType = false;
if( bUseOldNames )
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart."));
else
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2."));
bInternalType = true;
if( IsXMLToken( rClassName, XML_LINE ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Line"));
else if( IsXMLToken( rClassName, XML_AREA ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Area"));
else if( IsXMLToken( rClassName, XML_BAR ))
{
if( bUseOldNames )
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bar"));
else
{
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Column"));
// @todo: might be Bar
}
}
else if( IsXMLToken( rClassName, XML_CIRCLE ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Pie"));
else if( IsXMLToken( rClassName, XML_RING ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Donut"));
else if( IsXMLToken( rClassName, XML_SCATTER ))
{
if( bUseOldNames )
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("XY"));
else
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Scatter"));
}
CWS-TOOLING: integrate CWS bubblechart 2009-06-17 08:41:14 +0200 hde r273051 : i101635: added new charttype bubble 2009-06-17 08:39:37 +0200 hde r273050 : i101635: created new testcase tCreateNewBubbleChart 2009-06-17 08:38:07 +0200 hde r273049 : i101635: created new testcase tCreateNewBubbleChart 2009-06-15 15:22:32 +0200 hde r272991 : 101635 2009-06-11 12:44:01 +0200 iha r272864 : rebase to dev300m50 2009-06-10 23:27:54 +0200 iha r272841 : CWS-TOOLING: rebase CWS bubblechart to trunk@272827 (milestone: DEV300:m50) 2009-06-04 18:07:35 +0200 iha r272649 : #i64689# Bubble Chart 2009-06-04 17:26:44 +0200 iha r272647 : #i64689# Bubble Chart 2009-06-04 11:24:25 +0200 iha r272618 : #i64689# add more spacing between bubbles and data labels 2009-05-26 18:05:23 +0200 ufi r272314 : i101637 2009-04-22 14:37:50 +0200 iha r271115 : #i64689# bubble chart 2009-04-21 17:52:23 +0200 iha r271052 : #i64689# bubble chart 2009-04-21 17:50:48 +0200 iha r271051 : #i76728# type icon for xy chart 2009-04-21 17:25:52 +0200 iha r271049 : #i76728# type icon for xy chart 2009-04-09 11:18:09 +0200 iha r270685 : #i100977# autoscaling works not correct if missing values should be treated as zero 2009-04-08 16:39:43 +0200 iha r270656 : #i64689# bubble chart - missing value treatment 2009-04-08 15:13:25 +0200 iha r270655 : #i64689# bubble chart - remove unused code 2009-04-08 15:12:19 +0200 iha r270653 : #i64689# bubble chart - determine sereis length correctly on export 2009-04-08 14:22:43 +0200 iha r270650 : #i64689# bubble chart - remove unused code 2009-04-08 14:12:09 +0200 iha r270646 : #i64689# bubble chart - export domains even if no main sequence was found 2009-04-08 14:11:07 +0200 iha r270645 : #i64689# bubble chart - don't replace missing size values with 1.0 2009-04-07 16:20:22 +0200 iha r270602 : #i64689# bubble chart - do not offer percent values for data label display for xy and bubble chart 2009-04-07 16:17:42 +0200 iha r270601 : remove superfluous code 2009-04-06 16:39:32 +0200 iha r270569 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-02 17:33:33 +0200 iha r270427 : use input string for formatting in data table during edit 2009-04-02 16:00:29 +0200 iha r270413 : #i64689# bubble chart - when creating a new series within the data table give it the same number format as the former series, thus the new bubble size values can be edited with the same format immidiately 2009-04-02 11:25:33 +0200 iha r270385 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-01 11:32:03 +0200 iha r270312 : #i64689# bubble chart - add further parameter for view creation 2009-03-31 17:52:08 +0200 iha r270291 : #i64689# bubble chart - scale bubble size with diagram size 2009-03-31 13:38:13 +0200 iha r270278 : #i64689# bubble chart - wrong size for small values < 1 2009-03-27 19:11:07 +0100 iha r270169 : #i64689# bubble chart 2009-03-27 19:07:11 +0100 iha r270168 : #i64689# bubble chart - remove unused code 2009-03-27 18:33:57 +0100 iha r270167 : #i64689# bubble chart - create no shape for invalid sizes 2009-03-27 15:18:21 +0100 iha r270157 : #i76728# type icon for xy chart 2009-03-27 14:34:38 +0100 iha r270156 : #i64689# bubble chart - correct scaling 2009-03-27 14:27:27 +0100 iha r270155 : #i64689# bubble chart - images 2009-03-27 14:25:45 +0100 iha r270154 : #i64689# bubble chart - images 2009-03-27 11:38:57 +0100 iha r270142 : #i64689# bubble chart - values-size is the main series 2009-03-27 11:30:20 +0100 iha r270140 : #i64689# correct order of sequences after load thus switching charttypes afterwards produces expected results now 2009-03-26 10:22:55 +0100 iha r270056 : #i64689# bubble chart 2009-03-24 17:45:15 +0100 iha r269984 : #i64689# bubble chart - user properties from points (not only from the series) 2009-03-24 15:10:57 +0100 dr r269954 : #i64989# export bubble charts to xls 2009-03-24 14:55:29 +0100 dr r269952 : #i64989# import bubble charts from xls 2009-03-24 14:54:46 +0100 dr r269950 : #i64989# import bubble charts from ooxml 2009-03-23 18:59:08 +0100 iha r269895 : further cleanups possible with new member m_aGlobalSeriesImportInfo 2009-03-23 16:54:04 +0100 iha r269886 : #i64689# bubble chart - a single sequence must be interpreted as sizes because of ODF specification 2009-03-23 16:50:43 +0100 iha r269885 : #i64689# save&load bubble chart 2009-03-20 19:30:29 +0100 iha r269826 : CWS-TOOLING: rebase CWS bubblechart to trunk@269781 (milestone: DEV300:m44) 2009-03-19 11:30:33 +0100 iha r269732 : #i64689# rename SchXMLCategoriesDomainContext to SchXMLCategoriesContext avoid confusion with domains 2009-03-18 17:11:13 +0100 iha r269693 : #i64689# add charttype bubble 2009-03-18 17:09:22 +0100 iha r269692 : #i64689# remove unused code 2009-03-13 12:18:26 +0100 iha r269467 : #i64689# corrected lineends 2009-03-12 11:25:14 +0100 iha r269376 : #i64689# bubble chart (part 1)
2009-07-02 19:17:43 +00:00
else if( IsXMLToken( rClassName, XML_BUBBLE ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bubble"));
else if( IsXMLToken( rClassName, XML_RADAR ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Net"));
else if( IsXMLToken( rClassName, XML_FILLED_RADAR ))
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("FilledNet"));
else if( IsXMLToken( rClassName, XML_STOCK ))
{
if( bUseOldNames )
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Stock"));
else
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("CandleStick"));
}
else if( IsXMLToken( rClassName, XML_SURFACE ))
{
//@todo change this if a surface chart is available
if( bUseOldNames )
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bar"));
else
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Column"));
}
else
bInternalType = false;
if( ! bInternalType )
return OUString();
if( bUseOldNames )
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Diagram"));
else
aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("ChartType"));
return aResultBuffer.makeStringAndClear();
}
XMLTokenEnum getTokenByChartType(
const OUString & rChartTypeService, bool bUseOldNames )
{
XMLTokenEnum eResult = XML_TOKEN_INVALID;
OUString aPrefix, aPostfix;
if( bUseOldNames )
{
aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart."));
aPostfix = OUString( RTL_CONSTASCII_USTRINGPARAM("Diagram"));
}
else
{
aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2."));
aPostfix = OUString( RTL_CONSTASCII_USTRINGPARAM("ChartType"));
}
if( rChartTypeService.match( aPrefix ))
{
sal_Int32 nSkip = aPrefix.getLength();
OSL_ASSERT( rChartTypeService.getLength() >= nSkip );
sal_Int32 nTypeLength = rChartTypeService.getLength() - nSkip - aPostfix.getLength();
// if postfix matches and leaves a non-empty type
if( nTypeLength > 0 && rChartTypeService.match( aPostfix, nSkip + nTypeLength ))
{
OUString aServiceName( rChartTypeService.copy( nSkip, nTypeLength ));
if( aServiceName.equalsAscii("Line"))
eResult = XML_LINE;
else if( aServiceName.equalsAscii("Area"))
eResult = XML_AREA;
else if( aServiceName.equalsAscii("Bar") ||
(!bUseOldNames && aServiceName.equalsAscii("Column")))
eResult = XML_BAR;
else if( aServiceName.equalsAscii("Pie"))
eResult = XML_CIRCLE;
else if( aServiceName.equalsAscii("Donut"))
eResult = XML_RING;
else if( (bUseOldNames && aServiceName.equalsAscii("XY")) ||
(!bUseOldNames && aServiceName.equalsAscii("Scatter")))
eResult = XML_SCATTER;
CWS-TOOLING: integrate CWS bubblechart 2009-06-17 08:41:14 +0200 hde r273051 : i101635: added new charttype bubble 2009-06-17 08:39:37 +0200 hde r273050 : i101635: created new testcase tCreateNewBubbleChart 2009-06-17 08:38:07 +0200 hde r273049 : i101635: created new testcase tCreateNewBubbleChart 2009-06-15 15:22:32 +0200 hde r272991 : 101635 2009-06-11 12:44:01 +0200 iha r272864 : rebase to dev300m50 2009-06-10 23:27:54 +0200 iha r272841 : CWS-TOOLING: rebase CWS bubblechart to trunk@272827 (milestone: DEV300:m50) 2009-06-04 18:07:35 +0200 iha r272649 : #i64689# Bubble Chart 2009-06-04 17:26:44 +0200 iha r272647 : #i64689# Bubble Chart 2009-06-04 11:24:25 +0200 iha r272618 : #i64689# add more spacing between bubbles and data labels 2009-05-26 18:05:23 +0200 ufi r272314 : i101637 2009-04-22 14:37:50 +0200 iha r271115 : #i64689# bubble chart 2009-04-21 17:52:23 +0200 iha r271052 : #i64689# bubble chart 2009-04-21 17:50:48 +0200 iha r271051 : #i76728# type icon for xy chart 2009-04-21 17:25:52 +0200 iha r271049 : #i76728# type icon for xy chart 2009-04-09 11:18:09 +0200 iha r270685 : #i100977# autoscaling works not correct if missing values should be treated as zero 2009-04-08 16:39:43 +0200 iha r270656 : #i64689# bubble chart - missing value treatment 2009-04-08 15:13:25 +0200 iha r270655 : #i64689# bubble chart - remove unused code 2009-04-08 15:12:19 +0200 iha r270653 : #i64689# bubble chart - determine sereis length correctly on export 2009-04-08 14:22:43 +0200 iha r270650 : #i64689# bubble chart - remove unused code 2009-04-08 14:12:09 +0200 iha r270646 : #i64689# bubble chart - export domains even if no main sequence was found 2009-04-08 14:11:07 +0200 iha r270645 : #i64689# bubble chart - don't replace missing size values with 1.0 2009-04-07 16:20:22 +0200 iha r270602 : #i64689# bubble chart - do not offer percent values for data label display for xy and bubble chart 2009-04-07 16:17:42 +0200 iha r270601 : remove superfluous code 2009-04-06 16:39:32 +0200 iha r270569 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-02 17:33:33 +0200 iha r270427 : use input string for formatting in data table during edit 2009-04-02 16:00:29 +0200 iha r270413 : #i64689# bubble chart - when creating a new series within the data table give it the same number format as the former series, thus the new bubble size values can be edited with the same format immidiately 2009-04-02 11:25:33 +0200 iha r270385 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-01 11:32:03 +0200 iha r270312 : #i64689# bubble chart - add further parameter for view creation 2009-03-31 17:52:08 +0200 iha r270291 : #i64689# bubble chart - scale bubble size with diagram size 2009-03-31 13:38:13 +0200 iha r270278 : #i64689# bubble chart - wrong size for small values < 1 2009-03-27 19:11:07 +0100 iha r270169 : #i64689# bubble chart 2009-03-27 19:07:11 +0100 iha r270168 : #i64689# bubble chart - remove unused code 2009-03-27 18:33:57 +0100 iha r270167 : #i64689# bubble chart - create no shape for invalid sizes 2009-03-27 15:18:21 +0100 iha r270157 : #i76728# type icon for xy chart 2009-03-27 14:34:38 +0100 iha r270156 : #i64689# bubble chart - correct scaling 2009-03-27 14:27:27 +0100 iha r270155 : #i64689# bubble chart - images 2009-03-27 14:25:45 +0100 iha r270154 : #i64689# bubble chart - images 2009-03-27 11:38:57 +0100 iha r270142 : #i64689# bubble chart - values-size is the main series 2009-03-27 11:30:20 +0100 iha r270140 : #i64689# correct order of sequences after load thus switching charttypes afterwards produces expected results now 2009-03-26 10:22:55 +0100 iha r270056 : #i64689# bubble chart 2009-03-24 17:45:15 +0100 iha r269984 : #i64689# bubble chart - user properties from points (not only from the series) 2009-03-24 15:10:57 +0100 dr r269954 : #i64989# export bubble charts to xls 2009-03-24 14:55:29 +0100 dr r269952 : #i64989# import bubble charts from xls 2009-03-24 14:54:46 +0100 dr r269950 : #i64989# import bubble charts from ooxml 2009-03-23 18:59:08 +0100 iha r269895 : further cleanups possible with new member m_aGlobalSeriesImportInfo 2009-03-23 16:54:04 +0100 iha r269886 : #i64689# bubble chart - a single sequence must be interpreted as sizes because of ODF specification 2009-03-23 16:50:43 +0100 iha r269885 : #i64689# save&load bubble chart 2009-03-20 19:30:29 +0100 iha r269826 : CWS-TOOLING: rebase CWS bubblechart to trunk@269781 (milestone: DEV300:m44) 2009-03-19 11:30:33 +0100 iha r269732 : #i64689# rename SchXMLCategoriesDomainContext to SchXMLCategoriesContext avoid confusion with domains 2009-03-18 17:11:13 +0100 iha r269693 : #i64689# add charttype bubble 2009-03-18 17:09:22 +0100 iha r269692 : #i64689# remove unused code 2009-03-13 12:18:26 +0100 iha r269467 : #i64689# corrected lineends 2009-03-12 11:25:14 +0100 iha r269376 : #i64689# bubble chart (part 1)
2009-07-02 19:17:43 +00:00
else if( aServiceName.equalsAscii("Bubble"))
eResult = XML_BUBBLE;
else if( aServiceName.equalsAscii("Net"))
eResult = XML_RADAR;
else if( aServiceName.equalsAscii("FilledNet"))
eResult = XML_FILLED_RADAR;
else if( (bUseOldNames && aServiceName.equalsAscii("Stock")) ||
(!bUseOldNames && aServiceName.equalsAscii("CandleStick")))
eResult = XML_STOCK;
}
}
if( eResult == XML_TOKEN_INVALID && rChartTypeService.getLength() > 0 )
eResult = XML_ADD_IN;
return eResult;
}
Reference< chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence()
{
Reference< chart2::data::XLabeledDataSequence > xResult;
Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
if( xContext.is() )
xResult.set(
xContext->getServiceManager()->createInstanceWithContext(
OUString::createFromAscii("com.sun.star.chart2.data.LabeledDataSequence"),
xContext ), uno::UNO_QUERY_THROW );
return xResult;
}
Reference< chart2::data::XDataSequence > CreateDataSequence(
const OUString & rRange,
const Reference< chart2::XChartDocument >& xChartDoc )
{
Reference< chart2::data::XDataSequence > xRet;
if( !xChartDoc.is() )
{
DBG_ERROR( "need a chart document" );
return xRet;
}
Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
if( !xDataProvider.is() )
{
DBG_ERROR( "need a data provider" );
return xRet;
}
try
{
xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider )));
SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
}
catch( const lang::IllegalArgumentException & )
{
DBG_ERROR( "could not create data sequence" );
}
if( !xRet.is() && !xChartDoc->hasInternalDataProvider() )
{
//#i103911# switch to internal data in case the parent cannot provide the requested data
xChartDoc->createInternalDataProvider( sal_True /* bCloneExistingData */ );
xDataProvider = xChartDoc->getDataProvider();
try
{
xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider )));
SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
}
catch( const lang::IllegalArgumentException & )
{
DBG_ERROR( "could not create data sequence" );
}
}
return xRet;
}
void CreateCategories(
const uno::Reference< chart2::data::XDataProvider > & xDataProvider,
const uno::Reference< chart2::XChartDocument > & xNewDoc,
const OUString & rRangeAddress,
sal_Int32 nCooSysIndex,
sal_Int32 nDimensionIndex,
tSchXMLLSequencesPerIndex * pLSequencesPerIndex )
{
try
{
if( xNewDoc.is() && rRangeAddress.getLength())
{
if( xDataProvider.is())
{
uno::Reference< chart2::XDiagram > xDia( xNewDoc->getFirstDiagram());
if( !xDia.is())
return;
uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDia, uno::UNO_QUERY_THROW );
uno::Sequence< uno::Reference< chart2::XCoordinateSystem > >
aCooSysSeq( xCooSysCnt->getCoordinateSystems());
if( nCooSysIndex < aCooSysSeq.getLength())
{
uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] );
OSL_ASSERT( xCooSys.is());
if( nDimensionIndex < xCooSys->getDimension() )
{
const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
for(sal_Int32 nI=0; nI<=nMaxAxisIndex; ++nI)
{
uno::Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nI ));
if( xAxis.is() )
{
chart2::ScaleData aData( xAxis->getScaleData());
uno::Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
GetNewLabeledDataSequence());
try
{
OUString aConvertedRange( rRangeAddress );
bool bRangeConverted = false;
if( ! (xNewDoc->hasInternalDataProvider() &&
aConvertedRange.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("categories"))))
{
Reference< chart2::data::XRangeXMLConversion > xXMLConv( xDataProvider, uno::UNO_QUERY );
if( xXMLConv.is())
{
aConvertedRange = xXMLConv->convertRangeFromXML( rRangeAddress );
bRangeConverted = true;
}
}
Reference< chart2::data::XDataSequence > xSeq(
xDataProvider->createDataSequenceByRangeRepresentation( aConvertedRange ));
xLabeledSeq->setValues( xSeq );
if( bRangeConverted )
setXMLRangePropertyAtDataSequence( xSeq, rRangeAddress );
}
catch( const lang::IllegalArgumentException & ex )
{
(void)ex; // avoid warning for pro build
OSL_ENSURE( false, ::rtl::OUStringToOString(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IllegalArgumentException caught, Message: " )) +
ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
}
aData.Categories.set( xLabeledSeq );
if( pLSequencesPerIndex )
{
// register for setting local data if external data provider is not present
pLSequencesPerIndex->insert(
tSchXMLLSequencesPerIndex::value_type(
tSchXMLIndexWithPart( SCH_XML_CATEGORIES_INDEX, SCH_XML_PART_VALUES ), xLabeledSeq ));
}
xAxis->setScaleData( aData );
}
}
}
}
}
}
}
catch( uno::Exception & )
{
OSL_ENSURE( false, "Exception caught while creating Categories" );
}
}
uno::Any getPropertyFromContext( const rtl::OUString& rPropertyName, const XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
{
uno::Any aRet;
if( !pPropStyleContext || !pStylesCtxt )
return aRet;
const ::std::vector< XMLPropertyState >& rProperties = pPropStyleContext->GetProperties();
const UniReference< XMLPropertySetMapper >& rMapper = pStylesCtxt->GetImportPropertyMapper( pPropStyleContext->GetFamily()/*XML_STYLE_FAMILY_SCH_CHART_ID*/ )->getPropertySetMapper();
::std::vector< XMLPropertyState >::const_iterator aEnd( rProperties.end() );
::std::vector< XMLPropertyState >::const_iterator aPropIter( rProperties.begin() );
for( aPropIter = rProperties.begin(); aPropIter != aEnd; ++aPropIter )
{
sal_Int32 nIdx = aPropIter->mnIndex;
if( nIdx == -1 )
continue;
OUString aPropName = rMapper->GetEntryAPIName( nIdx );
if(rPropertyName.equals(aPropName))
return aPropIter->maValue;
}
return aRet;
}
void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsLFs )
{
SvXMLElementExport aPara( rExport, XML_NAMESPACE_TEXT,
::xmloff::token::GetXMLToken( ::xmloff::token::XML_P ),
sal_True, sal_False );
if( bConvertTabsLFs )
{
sal_Int32 nStartPos = 0;
sal_Int32 nEndPos = rText.getLength();
sal_Unicode cChar;
for( sal_Int32 nPos = 0; nPos < nEndPos; nPos++ )
{
cChar = rText[ nPos ];
switch( cChar )
{
case 0x0009: // tabulator
{
if( nPos > nStartPos )
rExport.GetDocHandler()->characters( rText.copy( nStartPos, (nPos - nStartPos)) );
nStartPos = nPos + 1;
SvXMLElementExport aElem( rExport, XML_NAMESPACE_TEXT,
::xmloff::token::GetXMLToken( ::xmloff::token::XML_TAB_STOP ),
sal_False, sal_False );
}
break;
case 0x000A: // linefeed
{
if( nPos > nStartPos )
rExport.GetDocHandler()->characters( rText.copy( nStartPos, (nPos - nStartPos)) );
nStartPos = nPos + 1;
SvXMLElementExport aElem( rExport, XML_NAMESPACE_TEXT,
::xmloff::token::GetXMLToken( ::xmloff::token::XML_LINE_BREAK ),
sal_False, sal_False );
}
break;
}
}
if( nEndPos > nStartPos )
{
if( nStartPos == 0 )
rExport.GetDocHandler()->characters( rText );
else
rExport.GetDocHandler()->characters( rText.copy( nStartPos, (nEndPos - nStartPos)) );
}
}
else // do not convert tabs and linefeeds (eg for numbers coming from unit converter)
{
rExport.GetDocHandler()->characters( rText );
}
}
Reference< chart2::XRegressionCurve > getRegressionCurve(
const Reference< chart2::XDataSeries > & xDataSeries )
{
Reference< chart2::XRegressionCurve > xResult;
Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xDataSeries, uno::UNO_QUERY );
if( xRegCurveCnt.is())
{
// find equation properties of first regression curve
Sequence< Reference< chart2::XRegressionCurve > > aCurveSeq(
xRegCurveCnt->getRegressionCurves() );
for( sal_Int32 nI=0; nI<aCurveSeq.getLength(); ++nI )
{
// skip mean-value line
Reference< lang::XServiceName > xServiceName( aCurveSeq[nI], uno::UNO_QUERY );
if( xServiceName.is())
{
OUString aServiceName( xServiceName->getServiceName());
if( aServiceName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.MeanValueRegressionCurve" )))
continue;
}
// take first non-empty curve
if( aCurveSeq[nI].is())
{
xResult.set( aCurveSeq[nI] );
break;
}
}
}
return xResult;
}
void setXMLRangePropertyAtDataSequence(
const Reference< chart2::data::XDataSequence > & xDataSequence,
const OUString & rXMLRange )
{
if( !xDataSequence.is())
return;
try
{
const OUString aXMLRangePropName( RTL_CONSTASCII_USTRINGPARAM( "CachedXMLRange" ));
Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY_THROW );
Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo());
if( xInfo.is() && xInfo->hasPropertyByName( aXMLRangePropName ))
xProp->setPropertyValue( aXMLRangePropName, uno::makeAny( rXMLRange ));
}
catch( const uno::Exception & ex )
{
(void)ex; // avoid warning for pro build
OSL_ENSURE( false, ::rtl::OUStringToOString(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught, Message: " )) +
ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
}
}
bool getXMLRangePropertyFromDataSequence(
const Reference< chart2::data::XDataSequence > & xDataSequence,
OUString & rOutXMLRange,
bool bClearProp /* = false */)
{
bool bResult = false;
if( xDataSequence.is())
{
try
{
const OUString aXMLRangePropName( RTL_CONSTASCII_USTRINGPARAM( "CachedXMLRange" ));
Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY_THROW );
Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo());
bResult =
( xInfo.is() && xInfo->hasPropertyByName( aXMLRangePropName ) &&
( xProp->getPropertyValue( aXMLRangePropName ) >>= rOutXMLRange ) &&
rOutXMLRange.getLength());
// clear the property after usage
if( bClearProp && bResult )
xProp->setPropertyValue( aXMLRangePropName, uno::Any( OUString()));
}
catch( const uno::Exception & ex )
{
(void)ex; // avoid warning for pro build
OSL_ENSURE( false, ::rtl::OUStringToOString(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught, Message: " )) +
ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
}
}
return bResult;
}
CWS-TOOLING: integrate CWS chart39 2009-06-30 16:55:46 +0200 iha r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-30 16:45:59 +0200 iha r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again 2009-06-30 16:32:32 +0200 iha r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-29 10:04:34 +0200 iha r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-26 19:31:16 +0200 iha r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-25 10:36:28 +0200 iha r273367 : #i101968# text values in data range cause incorrect x values 2009-06-24 17:34:18 +0200 iha r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values 2009-06-24 10:16:25 +0200 iha r273317 : #i99915# wrong matrix translation causes broken chart display for small values 2009-06-19 17:20:06 +0200 iha r273174 : #i78025# charts own borders are not completely visible 2009-06-19 17:18:41 +0200 iha r273172 : #i102950# don't paint additional borders for charts 2009-06-11 16:27:54 +0200 iha r272884 : CWS-TOOLING: rebase CWS chart39 to trunk@272827 (milestone: DEV300:m50) 2009-06-09 17:50:10 +0200 iha r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong 2009-06-09 16:00:27 +0200 iha r272775 : #i98319# data point properties get lost while copying charts from calc to impress 2009-06-09 10:26:51 +0200 iha r272755 : #i98392# correct orienation of gradient fillings on 3D walls 2009-05-29 10:35:16 +0200 iha r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines 2009-05-04 18:20:31 +0200 iha r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing 2009-05-04 18:03:01 +0200 iha r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline 2009-05-04 16:45:18 +0200 iha r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon
2009-07-28 10:25:31 +00:00
void copyProperties(
const Reference< beans::XPropertySet > & xSource,
const Reference< beans::XPropertySet > & xDestination )
{
if( ! (xSource.is() && xDestination.is()) )
return;
try
{
Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW );
Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW );
Sequence< beans::Property > aProperties( xSrcInfo->getProperties());
const sal_Int32 nLength = aProperties.getLength();
for( sal_Int32 i = 0; i < nLength; ++i )
{
OUString aName( aProperties[i].Name);
if( xDestInfo->hasPropertyByName( aName ))
{
beans::Property aProp( xDestInfo->getPropertyByName( aName ));
if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 )
xDestination->setPropertyValue(
aName, xSource->getPropertyValue( aName ));
}
}
}
catch( const uno::Exception & )
{
OSL_ENSURE( false, "Copying property sets failed!" );
}
}
bool switchBackToDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex )
{
//return whether the switch is successful
if( !xChartDoc.is() || !xChartDoc->hasInternalDataProvider() )
return false;
Reference< chart2::data::XDataProvider > xDataProviderFromParent( SchXMLTools::getDataProviderFromParent( xChartDoc ) );
if( !xDataProviderFromParent.is() )
return false;
uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartDoc, uno::UNO_QUERY );
if( !xDataReceiver.is() )
return false;
xDataReceiver->attachDataProvider( xDataProviderFromParent );
for( tSchXMLLSequencesPerIndex::const_iterator aLSeqIt( rLSequencesPerIndex.begin() );
aLSeqIt != rLSequencesPerIndex.end(); ++aLSeqIt )
{
Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( aLSeqIt->second );
if( !xLabeledSeq.is() )
continue;
Reference< chart2::data::XDataSequence > xNewSeq;
xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getValues(), xDataProviderFromParent );
if( xNewSeq.is() )
xLabeledSeq->setValues( xNewSeq );
xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getLabel(), xDataProviderFromParent );
if( xNewSeq.is() )
xLabeledSeq->setLabel( xNewSeq );
}
return true;
}
void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference< beans::XPropertySet > xImportInfo )
{
::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xModel) );
if( aGenerator.getLength() )
SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo );
}
bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame::XModel >& xChartModel )
{
bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel );
if( !bResult )
{
::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/3") ) ) != -1 )
{
if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/300m") ) ) != -1 )
{
sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) );
if( nBuilId>0 && nBuilId<9491 ) //9491 is build id of dev300m76
bResult= true;
}
else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/310m") ) ) != -1 )
bResult= true;
else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/320m") ) ) != -1 )
bResult= true;
}
}
return bResult;
}
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel )
{
bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel );
if( !bResult )
{
::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/680m") ) ) != -1 )
bResult= true;
}
return bResult;
}
2008-12-12 12:17:17 +00:00
bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const uno::Reference< frame::XModel >& xChartModel )
{
if( isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel ) )
return true;
if( isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel ) )
{
sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) );
if( nBuilId>0 && nBuilId<=9238 ) //9238 is build id of OpenOffice.org 2.3.1
return true;
}
return false;
}
bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame::XModel >& xChartModel )
{
bool bResult = false;
::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
//if there is a meta stream at the chart object it was not written with an older OpenOffice version < 2.3
if( !aGenerator.getLength() )
{
//if there is no meta stream at the chart object we need to check whether the parent document is OpenOffice at all
uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
if( xChild.is() )
{
aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project") ) ) != -1 )
{
//the chart application has not created files without a meta stream since OOo 2.3 (OOo 2.3 has written a metastream already)
//only the report builder extension has created some files with OOo 3.1 that do not have a meta stream
if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/31") ) ) != -1 )
bResult = false;//#i100102# probably generated with OOo 3.1 by the report designer
else
bResult= true; //in this case the OLE chart was created by an older version, as OLE objects are sometimes stream copied the version can differ from the parents version, so the parents version is not a reliable indicator
}
else if( isDocumentGeneratedWithOpenOfficeOlderThan2_0(xChartModel) )
bResult= true;
}
}
return bResult;
}
bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel)
{
bool bResult = false;
::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xChartModel) );
if( ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org 1") ) ) == 0 )
|| ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 6") ) ) == 0 )
|| ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 7") ) ) == 0 )
|| ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 6") ) ) == 0 )
|| ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 7") ) ) == 0 )
)
bResult= true;
return bResult;
}
CWS-TOOLING: integrate CWS chart39 2009-06-30 16:55:46 +0200 iha r273522 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-30 16:45:59 +0200 iha r273521 : #i102701# apply patch for P1 issue on dev300m50 to be able to save again 2009-06-30 16:32:32 +0200 iha r273520 : #i103209# im-/export attribute xlink:href at chart:chart element + some cleanup in naming 2009-06-29 10:04:34 +0200 iha r273454 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-26 19:31:16 +0200 iha r273437 : #i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area 2009-06-25 10:36:28 +0200 iha r273367 : #i101968# text values in data range cause incorrect x values 2009-06-24 17:34:18 +0200 iha r273357 : #i102428# x values are wrong in xy-scatter-chart with own data table if empty cells are contained in x values 2009-06-24 10:16:25 +0200 iha r273317 : #i99915# wrong matrix translation causes broken chart display for small values 2009-06-19 17:20:06 +0200 iha r273174 : #i78025# charts own borders are not completely visible 2009-06-19 17:18:41 +0200 iha r273172 : #i102950# don't paint additional borders for charts 2009-06-11 16:27:54 +0200 iha r272884 : CWS-TOOLING: rebase CWS chart39 to trunk@272827 (milestone: DEV300:m50) 2009-06-09 17:50:10 +0200 iha r272790 : #i97222# when converting a chart via API to 3D categories get lost and for line,area&xy the stacking mode is wrong 2009-06-09 16:00:27 +0200 iha r272775 : #i98319# data point properties get lost while copying charts from calc to impress 2009-06-09 10:26:51 +0200 iha r272755 : #i98392# correct orienation of gradient fillings on 3D walls 2009-05-29 10:35:16 +0200 iha r272436 : #i100529# Plot missing values - leave gap fails for smoothed lines 2009-05-04 18:20:31 +0200 iha r271478 : #i99841# Title with Vertically stacked attribute is wrong after editing 2009-05-04 18:03:01 +0200 iha r271477 : #i101050# avoid a corner in closed lines, which are smoothed by spline 2009-05-04 16:45:18 +0200 iha r271472 : #i101050# avoid crash in case the normals sequence has less points than the polygon
2009-07-28 10:25:31 +00:00
Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc )
{
Reference< chart2::data::XDataProvider > xRet;
uno::Reference< container::XChild > xChild( xChartDoc, uno::UNO_QUERY );
if( xChild.is() )
{
Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
if( xFact.is() )
{
const OUString aDataProviderServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"));
const uno::Sequence< OUString > aServiceNames( xFact->getAvailableServiceNames());
const OUString * pBegin = aServiceNames.getConstArray();
const OUString * pEnd = pBegin + aServiceNames.getLength();
if( ::std::find( pBegin, pEnd, aDataProviderServiceName ) != pEnd )
{
xRet = Reference< chart2::data::XDataProvider >(
xFact->createInstance( aDataProviderServiceName ), uno::UNO_QUERY );
}
}
}
return xRet;
}
} // namespace SchXMLTools