LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/chart - SchXMLExport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 1820 0.8 %
Date: 2012-12-27 Functions: 7 112 6.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <sax/tools/converter.hxx>
      22             : 
      23             : #include <xmloff/xmlprmap.hxx>
      24             : 
      25             : #include "SchXMLExport.hxx"
      26             : #include "XMLChartPropertySetMapper.hxx"
      27             : #include "SchXMLSeriesHelper.hxx"
      28             : #include "ColorPropertySet.hxx"
      29             : #include "SchXMLTools.hxx"
      30             : #include "SchXMLEnumConverter.hxx"
      31             : 
      32             : #include <tools/debug.hxx>
      33             : #include <rtl/logfile.hxx>
      34             : #include <comphelper/processfactory.hxx>
      35             : #include <tools/globname.hxx>
      36             : #include <sot/clsids.hxx>
      37             : 
      38             : #include <xmloff/nmspmap.hxx>
      39             : #include "xmloff/xmlnmspe.hxx"
      40             : #include <xmloff/xmltoken.hxx>
      41             : #include <xmloff/families.hxx>
      42             : #include <xmloff/xmlaustp.hxx>
      43             : #include <xmloff/xmluconv.hxx>
      44             : #include <xmloff/xmlmetae.hxx>
      45             : #include "xexptran.hxx"
      46             : #include <rtl/math.hxx>
      47             : // header for any2enum
      48             : #include <comphelper/extract.hxx>
      49             : 
      50             : #include <list>
      51             : #include <typeinfo>
      52             : #include <algorithm>
      53             : 
      54             : #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
      55             : #include <com/sun/star/lang/XServiceInfo.hpp>
      56             : #include <com/sun/star/lang/XServiceName.hpp>
      57             : #include <com/sun/star/beans/XPropertySet.hpp>
      58             : #include <com/sun/star/uno/XComponentContext.hpp>
      59             : #include <com/sun/star/util/XRefreshable.hpp>
      60             : 
      61             : #include <com/sun/star/chart/XAxis.hpp>
      62             : #include <com/sun/star/chart/XAxisSupplier.hpp>
      63             : #include <com/sun/star/chart/XChartDocument.hpp>
      64             : #include <com/sun/star/chart/ChartLegendPosition.hpp>
      65             : #include <com/sun/star/chart/ChartLegendExpansion.hpp>
      66             : #include <com/sun/star/chart/ChartDataRowSource.hpp>
      67             : #include <com/sun/star/chart/ChartAxisAssign.hpp>
      68             : #include <com/sun/star/chart/ChartAxisType.hpp>
      69             : #include <com/sun/star/chart/TimeIncrement.hpp>
      70             : #include <com/sun/star/chart/TimeInterval.hpp>
      71             : #include <com/sun/star/chart/TimeUnit.hpp>
      72             : #include <com/sun/star/chart/ChartSeriesAddress.hpp>
      73             : #include <com/sun/star/chart/X3DDisplay.hpp>
      74             : #include <com/sun/star/chart/XStatisticDisplay.hpp>
      75             : #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
      76             : #include <com/sun/star/chart/XDiagramPositioning.hpp>
      77             : 
      78             : #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
      79             : #include <com/sun/star/chart2/AxisType.hpp>
      80             : #include <com/sun/star/chart2/XChartDocument.hpp>
      81             : #include <com/sun/star/chart2/XDiagram.hpp>
      82             : #include <com/sun/star/chart2/RelativePosition.hpp>
      83             : #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
      84             : #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
      85             : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
      86             : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
      87             : #include <com/sun/star/chart2/data/XDataSource.hpp>
      88             : #include <com/sun/star/chart2/data/XDataSink.hpp>
      89             : #include <com/sun/star/chart2/data/XDataReceiver.hpp>
      90             : #include <com/sun/star/chart2/data/XDataProvider.hpp>
      91             : #include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
      92             : #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
      93             : #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
      94             : #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
      95             : 
      96             : #include <com/sun/star/util/MeasureUnit.hpp>
      97             : #include <com/sun/star/util/XStringMapping.hpp>
      98             : #include <com/sun/star/drawing/HomogenMatrix.hpp>
      99             : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
     100             : #include <com/sun/star/drawing/XShapes.hpp>
     101             : #include <com/sun/star/embed/Aspects.hpp>
     102             : #include <com/sun/star/embed/XVisualObject.hpp>
     103             : #include <com/sun/star/container/XChild.hpp>
     104             : 
     105             : 
     106             : #include "MultiPropertySetHandler.hxx"
     107             : #include "PropertyMap.hxx"
     108             : 
     109             : using namespace com::sun::star;
     110             : using namespace ::xmloff::token;
     111             : 
     112             : using ::rtl::OUString;
     113             : using ::rtl::OUStringBuffer;
     114             : using ::rtl::OUStringToOString;
     115             : using namespace ::com::sun::star;
     116             : using ::com::sun::star::uno::Sequence;
     117             : using ::com::sun::star::uno::Reference;
     118             : using ::com::sun::star::uno::Any;
     119             : using ::std::vector;
     120             : 
     121             : // ========================================
     122             : // class SchXMLExportHelper_Impl
     123             : // ========================================
     124             : 
     125             : class SchXMLExportHelper_Impl
     126             : {
     127             : public:
     128             :     // first: data sequence for label, second: data sequence for values.
     129             :     typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >,
     130             :             ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair;
     131             :     typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont;
     132             : 
     133             : public:
     134             :     SchXMLExportHelper_Impl( SvXMLExport& rExport,
     135             :                         SvXMLAutoStylePoolP& rASPool );
     136             : 
     137             :     virtual ~SchXMLExportHelper_Impl();
     138             : 
     139             :     // auto-styles
     140             :     /// parse chart and collect all auto-styles used in current pool
     141             :     void collectAutoStyles( com::sun::star::uno::Reference<
     142             :                             com::sun::star::chart::XChartDocument > rChartDoc );
     143             : 
     144             :     /// write the styles collected into the current pool as <style:style> elements
     145             :     void exportAutoStyles();
     146             : 
     147             :     /** export the <chart:chart> element corresponding to rChartDoc
     148             :         if bIncludeTable is true, the chart data is exported as <table:table>
     149             :         element (inside the chart element).
     150             : 
     151             :         Otherwise the external references stored in the chart document are used
     152             :         for writing the corresponding attributes at series
     153             : 
     154             :         All attributes contained in xAttrList are written at the chart element,
     155             :         which ist the outer element of a chart. So these attributes can easily
     156             :         be parsed again by the container
     157             :      */
     158             :     void exportChart( com::sun::star::uno::Reference<
     159             :                           com::sun::star::chart::XChartDocument > rChartDoc,
     160             :                       sal_Bool bIncludeTable );
     161             : 
     162             :     UniReference< XMLPropertySetMapper > GetPropertySetMapper() const;
     163             : 
     164           0 :     void SetChartRangeAddress( const ::rtl::OUString& rAddress )
     165           0 :         { msChartAddress = rAddress; }
     166           0 :     void SetTableNumberList( const ::rtl::OUString& rList )
     167           0 :         { msTableNumberList = rList; }
     168             : 
     169             :     void InitRangeSegmentationProperties(
     170             :         const ::com::sun::star::uno::Reference<
     171             :             ::com::sun::star::chart2::XChartDocument > & xChartDoc );
     172             : 
     173             :     ::com::sun::star::awt::Size getPageSize(
     174             :         const ::com::sun::star::uno::Reference<
     175             :             ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const;
     176             : 
     177             :     /** first parseDocument: collect autostyles and store names in this queue
     178             :         second parseDocument: export content and use names from this queue
     179             :      */
     180             :     ::std::queue< ::rtl::OUString > maAutoStyleNameQueue;
     181             :     void CollectAutoStyle(
     182             :         const std::vector< XMLPropertyState >& aStates );
     183             :     void AddAutoStyleAttribute(
     184             :         const std::vector< XMLPropertyState >& aStates );
     185             : 
     186           0 :     SvXMLAutoStylePoolP& GetAutoStylePoolP()
     187           0 :     { return mrAutoStylePool; }
     188             : 
     189             :     /// if bExportContent is false the auto-styles are collected
     190             :     void parseDocument( com::sun::star::uno::Reference<
     191             :                             com::sun::star::chart::XChartDocument >& rChartDoc,
     192             :                         sal_Bool bExportContent,
     193             :                         sal_Bool bIncludeTable = sal_False );
     194             :     void exportTable();
     195             :     void exportPlotArea(
     196             :         com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram,
     197             :         com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram,
     198             :         const ::com::sun::star::awt::Size & rPageSize,
     199             :         sal_Bool bExportContent,
     200             :         sal_Bool bIncludeTable );
     201             :     void exportCoordinateRegion( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram );
     202             :     void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram,
     203             :                                     const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
     204             :                                     sal_Bool bExportContent );
     205             :     void exportAxis( enum XMLTokenEnum eDimension, enum XMLTokenEnum eAxisName,
     206             :                     const Reference< beans::XPropertySet > xAxisProps, const Reference< chart2::XAxis >& xChart2Axis,
     207             :                     const OUString& rCategoriesRanges,
     208             :                     bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid, bool bExportContent );
     209             :     void exportGrid( const Reference< beans::XPropertySet > xGridProperties, bool bMajor, bool bExportContent );
     210             :     void exportDateScale( const Reference< beans::XPropertySet > xAxisProps );
     211             :     void exportAxisTitle( const Reference< beans::XPropertySet > xTitleProps, bool bExportContent );
     212             : 
     213             :     void exportSeries(
     214             :         const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
     215             :         const ::com::sun::star::awt::Size & rPageSize,
     216             :         sal_Bool bExportContent,
     217             :         sal_Bool bHasTwoYAxes );
     218             :     void exportCandleStickSeries(
     219             :         const ::com::sun::star::uno::Sequence<
     220             :             ::com::sun::star::uno::Reference<
     221             :                 ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
     222             :         const ::com::sun::star::uno::Reference<
     223             :             ::com::sun::star::chart2::XDiagram > & xDiagram,
     224             :         sal_Bool bJapaneseCandleSticks,
     225             :         sal_Bool bExportContent );
     226             :     void exportDataPoints(
     227             :         const ::com::sun::star::uno::Reference<
     228             :             ::com::sun::star::beans::XPropertySet > & xSeriesProperties,
     229             :         sal_Int32 nSeriesLength,
     230             :         const ::com::sun::star::uno::Reference<
     231             :             ::com::sun::star::chart2::XDiagram > & xDiagram,
     232             :         sal_Bool bExportContent );
     233             :     void exportRegressionCurve(
     234             :         const ::com::sun::star::uno::Reference<
     235             :             ::com::sun::star::chart2::XDataSeries > & xSeries,
     236             :         const ::com::sun::star::uno::Reference<
     237             :             ::com::sun::star::beans::XPropertySet > & xSeriesProp,
     238             :         const ::com::sun::star::awt::Size & rPageSize,
     239             :         sal_Bool bExportContent );
     240             : 
     241             :     void exportErrorBar (
     242             :         const ::com::sun::star::uno::Reference<beans::XPropertySet> &xSeriesProp, bool bYError,
     243             :             bool bExportContent );
     244             : 
     245             :     /// add svg position as attribute for current element
     246             :     void addPosition( const ::com::sun::star::awt::Point & rPosition );
     247             :     void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
     248             :     /// add svg size as attribute for current element
     249             :     void addSize( const ::com::sun::star::awt::Size & rSize, bool bIsOOoNamespace = false );
     250             :     void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, bool bIsOOoNamespace = false  );
     251             :     /// fills the member msString with the appropriate String (i.e. "A3")
     252             :     void getCellAddress( sal_Int32 nCol, sal_Int32 nRow );
     253             :     /// exports a string as a paragraph element
     254             :     void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false );
     255             :     void exportErrorBarRanges();
     256             : 
     257             : private:
     258             :     SchXMLExportHelper_Impl(SchXMLExportHelper_Impl &); // not defined
     259             :     SchXMLExportHelper_Impl operator =(SchXMLExportHelper_Impl &); // not defined
     260             : 
     261             : public:
     262             :     SvXMLExport& mrExport;
     263             :     SvXMLAutoStylePoolP& mrAutoStylePool;
     264             :     UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory;
     265             :     UniReference< XMLPropertySetMapper > mxPropertySetMapper;
     266             :     UniReference< XMLChartExportPropertyMapper > mxExpPropMapper;
     267             : 
     268             :     rtl::OUString msTableName;
     269             :     rtl::OUStringBuffer msStringBuffer;
     270             :     rtl::OUString msString;
     271             : 
     272             :     // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
     273             :     sal_Bool mbHasSeriesLabels;
     274             :     sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
     275             :     sal_Bool mbRowSourceColumns;
     276             :     rtl::OUString msChartAddress;
     277             :     rtl::OUString msTableNumberList;
     278             :     ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
     279             : 
     280             :     rtl::OUString msCLSID;
     281             : 
     282             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
     283             : 
     284             :     tDataSequenceCont m_aDataSequencesToExport;
     285             :     rtl::OUString maCategoriesRange;
     286             : };
     287             : 
     288             : namespace
     289             : {
     290             : 
     291           0 : class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
     292             : {
     293             : public:
     294           0 :     explicit lcl_MatchesRole( const OUString & aRole ) :
     295           0 :             m_aRole( aRole )
     296           0 :     {}
     297             : 
     298           0 :     bool operator () ( const Reference< chart2::data::XLabeledDataSequence > & xSeq ) const
     299             :     {
     300           0 :         if( !xSeq.is() )
     301           0 :             return  false;
     302           0 :         Reference< beans::XPropertySet > xProp( xSeq->getValues(), uno::UNO_QUERY );
     303           0 :         OUString aRole;
     304             : 
     305           0 :         return ( xProp.is() &&
     306           0 :                  (xProp->getPropertyValue(
     307           0 :                      OUString(  "Role" ) ) >>= aRole ) &&
     308           0 :                  m_aRole.equals( aRole ));
     309             :     }
     310             : 
     311             : private:
     312             :     OUString m_aRole;
     313             : };
     314             : 
     315             : template< typename T >
     316           0 :     void lcl_SequenceToVectorAppend( const Sequence< T > & rSource, ::std::vector< T > & rDestination )
     317             : {
     318           0 :     rDestination.reserve( rDestination.size() + rSource.getLength());
     319           0 :     ::std::copy( rSource.getConstArray(), rSource.getConstArray() + rSource.getLength(),
     320             :                  ::std::back_inserter( rDestination ));
     321           0 : }
     322             : 
     323             : template< typename T >
     324           0 :     void lcl_SequenceToVector( const Sequence< T > & rSource, ::std::vector< T > & rDestination )
     325             : {
     326           0 :     rDestination.clear();
     327           0 :     lcl_SequenceToVectorAppend( rSource, rDestination );
     328           0 : }
     329             : 
     330           0 : Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Reference< chart2::XDiagram > & xDiagram )
     331             : {
     332           0 :     Reference< chart2::data::XLabeledDataSequence >  xResult;
     333             :     try
     334             :     {
     335             :         Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
     336           0 :             xDiagram, uno::UNO_QUERY_THROW );
     337             :         Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
     338           0 :             xCooSysCnt->getCoordinateSystems());
     339           0 :         for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
     340             :         {
     341           0 :             Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[i] );
     342             :             OSL_ASSERT( xCooSys.is());
     343           0 :             for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
     344             :             {
     345           0 :                 const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
     346           0 :                 for(sal_Int32 nI=0; nI<=nMaxAxisIndex; ++nI)
     347             :                 {
     348           0 :                     Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( nN, nI );
     349             :                     OSL_ASSERT( xAxis.is());
     350           0 :                     if( xAxis.is())
     351             :                     {
     352           0 :                         chart2::ScaleData aScaleData = xAxis->getScaleData();
     353           0 :                         if( aScaleData.Categories.is())
     354             :                         {
     355           0 :                             xResult.set( aScaleData.Categories );
     356             :                             break;
     357           0 :                         }
     358             :                     }
     359           0 :                 }
     360             :             }
     361           0 :         }
     362             :     }
     363           0 :     catch( const uno::Exception & ex )
     364             :     {
     365             :         (void)ex; // avoid warning for pro build
     366             :         OSL_FAIL( OUStringToOString(
     367             :                         OUString(  "Exception caught. Type: " ) +
     368             :                         OUString::createFromAscii( typeid( ex ).name()) +
     369             :                         OUString(  ", Message: " ) +
     370             :                         ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
     371             :     }
     372             : 
     373           0 :     return xResult;
     374             : }
     375             : 
     376           0 : Reference< chart2::data::XDataSource > lcl_createDataSource(
     377             :     const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aData )
     378             : {
     379             :     Reference< uno::XComponentContext > xContext(
     380           0 :         comphelper::getProcessComponentContext() );
     381             :     Reference< chart2::data::XDataSink > xSink(
     382           0 :         xContext->getServiceManager()->createInstanceWithContext(
     383           0 :             "com.sun.star.chart2.data.DataSource", xContext ),
     384           0 :         uno::UNO_QUERY_THROW );
     385           0 :     xSink->setData( aData );
     386             : 
     387           0 :     return Reference< chart2::data::XDataSource >( xSink, uno::UNO_QUERY );
     388             : }
     389             : 
     390           0 : Sequence< Reference< chart2::data::XLabeledDataSequence > > lcl_getAllSeriesSequences( const Reference< chart2::XChartDocument >& xChartDoc )
     391             : {
     392           0 :     ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aContainer;
     393           0 :     if( xChartDoc.is() )
     394             :     {
     395           0 :         Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
     396           0 :         ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( SchXMLSeriesHelper::getDataSeriesFromDiagram( xDiagram ));
     397           0 :         for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aSeriesIt( aSeriesVector.begin() )
     398           0 :             ; aSeriesIt != aSeriesVector.end(); ++aSeriesIt )
     399             :         {
     400           0 :             Reference< chart2::data::XDataSource > xDataSource( *aSeriesIt, uno::UNO_QUERY );
     401           0 :             if( !xDataSource.is() )
     402           0 :                 continue;
     403           0 :             uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
     404           0 :             lcl_SequenceToVectorAppend( aDataSequences, aContainer );
     405           0 :         }
     406             :     }
     407             : 
     408           0 :     Sequence< Reference< chart2::data::XLabeledDataSequence > > aRet( aContainer.size());
     409           0 :     ::std::copy( aContainer.begin(), aContainer.end(), aRet.getArray());
     410             : 
     411           0 :     return aRet;
     412             : }
     413             : 
     414             : Reference< chart2::data::XLabeledDataSequence >
     415           0 :     lcl_getDataSequenceByRole(
     416             :         const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aLabeledSeq,
     417             :         const OUString & rRole )
     418             : {
     419           0 :     Reference< chart2::data::XLabeledDataSequence > aNoResult;
     420             : 
     421           0 :     const Reference< chart2::data::XLabeledDataSequence > * pBegin = aLabeledSeq.getConstArray();
     422           0 :     const Reference< chart2::data::XLabeledDataSequence > * pEnd = pBegin + aLabeledSeq.getLength();
     423             :     const Reference< chart2::data::XLabeledDataSequence > * pMatch =
     424           0 :         ::std::find_if( pBegin, pEnd, lcl_MatchesRole( rRole ));
     425             : 
     426           0 :     if( pMatch != pEnd )
     427           0 :         return *pMatch;
     428             : 
     429           0 :     return aNoResult;
     430             : }
     431             : 
     432           0 : Reference< chart2::data::XDataSource > lcl_pressUsedDataIntoRectangularFormat( const Reference< chart2::XChartDocument >& xChartDoc, sal_Bool& rOutSourceHasCategoryLabels )
     433             : {
     434           0 :     ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aLabeledSeqVector;
     435             : 
     436             :     //categories are always the first sequence
     437           0 :     Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
     438           0 :     Reference< chart2::data::XLabeledDataSequence > xCategories( lcl_getCategories( xDiagram ) );
     439           0 :     if( xCategories.is() )
     440           0 :         aLabeledSeqVector.push_back( xCategories );
     441           0 :     rOutSourceHasCategoryLabels = sal_Bool(xCategories.is());
     442             : 
     443             :     Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeriesSeqVector(
     444           0 :             lcl_getAllSeriesSequences( xChartDoc ) );
     445             : 
     446             :     //the first x-values is always the next sequence //todo ... other x-values get lost for old format
     447             :     Reference< chart2::data::XLabeledDataSequence > xXValues(
     448           0 :         lcl_getDataSequenceByRole( aSeriesSeqVector, OUString( "values-x" ) ) );
     449           0 :     if( xXValues.is() )
     450           0 :         aLabeledSeqVector.push_back( xXValues );
     451             : 
     452             :     //add all other sequences now without x-values
     453           0 :     lcl_MatchesRole aHasXValues( OUString( "values-x" ) );
     454           0 :     for( sal_Int32 nN=0; nN<aSeriesSeqVector.getLength(); nN++ )
     455             :     {
     456           0 :         if( !aHasXValues( aSeriesSeqVector[nN] ) )
     457           0 :             aLabeledSeqVector.push_back( aSeriesSeqVector[nN] );
     458             :     }
     459             : 
     460           0 :     Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( aLabeledSeqVector.size() );
     461           0 :     ::std::copy( aLabeledSeqVector.begin(), aLabeledSeqVector.end(), aSeq.getArray() );
     462             : 
     463           0 :     return lcl_createDataSource( aSeq );
     464             : }
     465             : 
     466           0 : bool lcl_isSeriesAttachedToFirstAxis(
     467             :     const Reference< chart2::XDataSeries > & xDataSeries )
     468             : {
     469           0 :     bool bResult=true;
     470             : 
     471             :     try
     472             :     {
     473           0 :         sal_Int32 nAxisIndex = 0;
     474           0 :         Reference< beans::XPropertySet > xProp( xDataSeries, uno::UNO_QUERY_THROW );
     475           0 :         if( xProp.is() )
     476           0 :             xProp->getPropertyValue( OUString( "AttachedAxisIndex" ) ) >>= nAxisIndex;
     477           0 :         bResult = (0==nAxisIndex);
     478             :     }
     479           0 :     catch( const uno::Exception & ex )
     480             :     {
     481             :         (void)ex; // avoid warning for pro build
     482             :         OSL_FAIL( OUStringToOString(
     483             :                         OUString(  "Exception caught. Type: " ) +
     484             :                         OUString::createFromAscii( typeid( ex ).name()) +
     485             :                         OUString(  ", Message: " ) +
     486             :                         ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
     487             :     }
     488             : 
     489           0 :     return bResult;
     490             : }
     491             : 
     492           0 : OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::XChartDocument > & xDoc )
     493             : {
     494           0 :     OUString aResult = rRange;
     495           0 :     if( !xDoc.is() )
     496             :         return aResult;
     497             :     Reference< chart2::data::XRangeXMLConversion > xConversion(
     498           0 :         xDoc->getDataProvider(), uno::UNO_QUERY );
     499           0 :     if( xConversion.is())
     500           0 :         aResult = xConversion->convertRangeToXML( rRange );
     501           0 :     return aResult;
     502             : }
     503             : 
     504             : typedef ::std::pair< OUString, OUString > tLabelAndValueRange;
     505             : 
     506           0 : tLabelAndValueRange lcl_getLabelAndValueRangeByRole(
     507             :     const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aSeqCnt,
     508             :     const OUString & rRole,
     509             :     const Reference< chart2::XChartDocument > & xDoc,
     510             :     SchXMLExportHelper_Impl::tDataSequenceCont & rOutSequencesToExport )
     511             : {
     512           0 :     tLabelAndValueRange aResult;
     513             : 
     514             :     Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
     515           0 :         lcl_getDataSequenceByRole( aSeqCnt, rRole ));
     516           0 :     if( xLabeledSeq.is())
     517             :     {
     518           0 :         Reference< chart2::data::XDataSequence > xLabelSeq( xLabeledSeq->getLabel());
     519           0 :         if( xLabelSeq.is())
     520           0 :             aResult.first = lcl_ConvertRange( xLabelSeq->getSourceRangeRepresentation(), xDoc );
     521             : 
     522           0 :         Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues());
     523           0 :         if( xValueSeq.is())
     524           0 :             aResult.second = lcl_ConvertRange( xValueSeq->getSourceRangeRepresentation(), xDoc );
     525             : 
     526           0 :         if( xLabelSeq.is() || xValueSeq.is())
     527           0 :             rOutSequencesToExport.push_back( SchXMLExportHelper_Impl::tLabelValuesDataPair( xLabelSeq, xValueSeq ));
     528             :     }
     529             : 
     530           0 :     return aResult;
     531             : }
     532             : 
     533           0 : sal_Int32 lcl_getSequenceLengthByRole(
     534             :     const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aSeqCnt,
     535             :     const OUString & rRole )
     536             : {
     537             :     Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
     538           0 :         lcl_getDataSequenceByRole( aSeqCnt, rRole ));
     539           0 :     if( xLabeledSeq.is())
     540             :     {
     541           0 :         Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getValues());
     542           0 :         return xSeq->getData().getLength();
     543             :     }
     544           0 :     return 0;
     545             : }
     546             : 
     547           0 : OUString lcl_flattenStringSequence( const Sequence< OUString > & rSequence )
     548             : {
     549           0 :     OUStringBuffer aResult;
     550           0 :     bool bPrecedeWithSpace = false;
     551           0 :     for( sal_Int32 nIndex=0; nIndex<rSequence.getLength(); ++nIndex )
     552             :     {
     553           0 :         if( !rSequence[nIndex].isEmpty())
     554             :         {
     555           0 :             if( bPrecedeWithSpace )
     556           0 :                 aResult.append( static_cast< sal_Unicode >( ' ' ));
     557           0 :             aResult.append( rSequence[nIndex] );
     558           0 :             bPrecedeWithSpace = true;
     559             :         }
     560             :     }
     561           0 :     return aResult.makeStringAndClear();
     562             : }
     563             : 
     564           0 : void lcl_getLabelStringSequence( Sequence< OUString >& rOutLabels, const Reference< chart2::data::XDataSequence > & xLabelSeq )
     565             : {
     566           0 :     uno::Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xLabelSeq, uno::UNO_QUERY );
     567           0 :     if( xTextualDataSequence.is())
     568             :     {
     569           0 :         rOutLabels = xTextualDataSequence->getTextualData();
     570             :     }
     571           0 :     else if( xLabelSeq.is())
     572             :     {
     573           0 :         Sequence< uno::Any > aAnies( xLabelSeq->getData());
     574           0 :         rOutLabels.realloc( aAnies.getLength());
     575           0 :         for( sal_Int32 i=0; i<aAnies.getLength(); ++i )
     576           0 :             aAnies[i] >>= rOutLabels[i];
     577           0 :     }
     578           0 : }
     579             : 
     580           0 : sal_Int32 lcl_getMaxSequenceLength(
     581             :     const SchXMLExportHelper_Impl::tDataSequenceCont & rContainer )
     582             : {
     583           0 :     sal_Int32 nResult = 0;
     584           0 :     for( SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( rContainer.begin());
     585           0 :          aIt != rContainer.end(); ++aIt )
     586             :     {
     587           0 :         if( aIt->second.is())
     588             :         {
     589           0 :             sal_Int32 nSeqLength = aIt->second->getData().getLength();
     590           0 :             if( nSeqLength > nResult )
     591           0 :                 nResult = nSeqLength;
     592             :         }
     593             :     }
     594           0 :     return nResult;
     595             : }
     596             : 
     597           0 : uno::Sequence< rtl::OUString > lcl_DataSequenceToStringSequence(
     598             :     const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
     599             : {
     600           0 :     uno::Sequence< rtl::OUString > aResult;
     601           0 :     if(!xDataSequence.is())
     602             :         return aResult;
     603             : 
     604           0 :     uno::Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
     605           0 :     if( xTextualDataSequence.is() )
     606             :     {
     607           0 :         aResult = xTextualDataSequence->getTextualData();
     608             :     }
     609             :     else
     610             :     {
     611           0 :         uno::Sequence< uno::Any > aValues = xDataSequence->getData();
     612           0 :         aResult.realloc(aValues.getLength());
     613             : 
     614           0 :         for(sal_Int32 nN=aValues.getLength();nN--;)
     615           0 :             aValues[nN] >>= aResult[nN];
     616             :     }
     617             : 
     618           0 :     return aResult;
     619             : }
     620           0 : ::std::vector< double > lcl_getAllValuesFromSequence( const Reference< chart2::data::XDataSequence > & xSeq )
     621             : {
     622           0 :     double fNan = 0.0;
     623           0 :     ::rtl::math::setNan( &fNan );
     624           0 :     ::std::vector< double > aResult;
     625           0 :     if(!xSeq.is())
     626             :         return aResult;
     627             : 
     628           0 :     uno::Sequence< double > aValuesSequence;
     629           0 :     Reference< chart2::data::XNumericalDataSequence > xNumSeq( xSeq, uno::UNO_QUERY );
     630           0 :     if( xNumSeq.is() )
     631             :     {
     632           0 :         aValuesSequence = xNumSeq->getNumericalData();
     633             :     }
     634             :     else
     635             :     {
     636           0 :         Sequence< uno::Any > aAnies( xSeq->getData() );
     637           0 :         aValuesSequence.realloc( aAnies.getLength() );
     638           0 :         for( sal_Int32 i=0; i<aAnies.getLength(); ++i )
     639           0 :             aAnies[i] >>= aValuesSequence[i];
     640             :     }
     641             : 
     642             :     //special handling for x-values (if x-values do point to categories, indices are used instead )
     643           0 :     Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY );
     644           0 :     if( xProp.is() )
     645             :     {
     646           0 :         OUString aRole;
     647           0 :         xProp->getPropertyValue( OUString(  "Role" ) ) >>= aRole;
     648           0 :         if( aRole.match( OUString(  "values-x" ) ) )
     649             :         {
     650             :             //lcl_clearIfNoValuesButTextIsContained - replace by indices if the values are not appropriate
     651           0 :             bool bHasValue=false;
     652           0 :             bool bHasText=false;
     653           0 :             sal_Int32 nCount = aValuesSequence.getLength();
     654           0 :             for( sal_Int32 j = 0; j < nCount; ++j )
     655             :             {
     656           0 :                 if( !::rtl::math::isNan( aValuesSequence[j] ) )
     657             :                 {
     658           0 :                     bHasValue=true;
     659           0 :                     break;
     660             :                 }
     661             :             }
     662           0 :             if(!bHasValue)
     663             :             {
     664             :                 //no double value is countained
     665             :                 //is there any text?
     666           0 :                 uno::Sequence< rtl::OUString > aStrings( lcl_DataSequenceToStringSequence( xSeq ) );
     667           0 :                 sal_Int32 nTextCount = aStrings.getLength();
     668           0 :                 for( sal_Int32 j = 0; j < nTextCount; ++j )
     669             :                 {
     670           0 :                     if( !aStrings[j].isEmpty() )
     671             :                     {
     672           0 :                         bHasText=true;
     673           0 :                         break;
     674             :                     }
     675           0 :                 }
     676             :             }
     677           0 :             if( !bHasValue && bHasText )
     678             :             {
     679           0 :                 for( sal_Int32 j = 0; j < nCount; ++j )
     680           0 :                     aValuesSequence[j] = j+1;
     681             :             }
     682           0 :         }
     683             :     }
     684             : 
     685           0 :     ::std::copy( aValuesSequence.getConstArray(), aValuesSequence.getConstArray() + aValuesSequence.getLength(),
     686           0 :                      ::std::back_inserter( aResult ));
     687           0 :     return aResult;
     688             : }
     689             : 
     690           0 : bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
     691             : {
     692           0 :     if( !xDataSequence.is() )
     693           0 :         return false;
     694           0 :     uno::Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY );
     695           0 :     if( xProp.is() )
     696             :     {
     697           0 :         uno::Sequence< sal_Int32 > aHiddenValues;
     698             :         try
     699             :         {
     700           0 :             xProp->getPropertyValue( OUString(  "HiddenValues"  ) ) >>= aHiddenValues;
     701           0 :             if( !aHiddenValues.getLength() )
     702           0 :                 return true;
     703             :         }
     704           0 :         catch( const uno::Exception& )
     705             :         {
     706           0 :             return true;
     707           0 :         }
     708             :     }
     709           0 :     if( xDataSequence->getData().getLength() )
     710           0 :         return true;
     711           0 :     return false;
     712             : }
     713             : 
     714             : typedef vector< OUString > tStringVector;
     715             : typedef vector< double > tDoubleVector;
     716             : typedef vector< vector< OUString > > t2DStringVector;
     717             : typedef vector< vector< double > > t2DNumberContainer;
     718             : 
     719           0 : struct lcl_TableData
     720             : {
     721             :     t2DNumberContainer  aDataInRows;
     722             :     tStringVector       aDataRangeRepresentations;
     723             : 
     724             :     tStringVector       aColumnDescriptions;
     725             :     tStringVector       aColumnDescriptions_Ranges;
     726             : 
     727             :     tStringVector       aRowDescriptions;
     728             :     tStringVector       aRowDescriptions_Ranges;
     729             : 
     730             :     Sequence< Sequence< uno::Any > >    aComplexColumnDescriptions;//outer index is columns - inner index is level
     731             :     Sequence< Sequence< uno::Any > >    aComplexRowDescriptions;//outer index is rows - inner index is level
     732             : 
     733             :     ::std::vector< sal_Int32 > aHiddenColumns;
     734             : };
     735             : 
     736             : // ::std::bind2nd( ::std::mem_fun_ref( &T::resize ), nSize ) does not work
     737             : template< class T >
     738             :     struct lcl_resize
     739             :     {
     740           0 :         lcl_resize( typename T::size_type nSize, typename T::value_type fDefaultValue ) : m_nSize( nSize ), m_fDefaultValue( fDefaultValue ) {}
     741           0 :         void operator()( T & t )
     742           0 :         { t.resize( m_nSize, m_fDefaultValue ); }
     743             :     private:
     744             :         typename T::size_type m_nSize;
     745             :         typename T::value_type m_fDefaultValue;
     746             :     };
     747             : 
     748             : 
     749             : typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair >
     750             :     lcl_DataSequenceMap;
     751             : 
     752             : struct lcl_SequenceToMapElement :
     753             :     public ::std::unary_function< lcl_DataSequenceMap::mapped_type, lcl_DataSequenceMap::value_type >
     754             : {
     755           0 :     lcl_SequenceToMapElement()
     756           0 :     {}
     757           0 :     result_type operator() ( const argument_type & rContent )
     758             :     {
     759           0 :         sal_Int32 nIndex = -1;
     760           0 :         if( rContent.second.is()) //has values
     761             :         {
     762           0 :             OUString aRangeRep( rContent.second->getSourceRangeRepresentation());
     763           0 :             nIndex = aRangeRep.toInt32();
     764             :         }
     765           0 :         else if( rContent.first.is()) //has labels
     766           0 :             nIndex = rContent.first->getSourceRangeRepresentation().copy( sizeof("label ")).toInt32();
     767           0 :         return result_type( nIndex, rContent );
     768             :     }
     769             : };
     770             : 
     771           0 : void lcl_ReorderInternalSequencesAccordingToTheirRangeName(
     772             :     SchXMLExportHelper_Impl::tDataSequenceCont & rInOutSequences )
     773             : {
     774           0 :     lcl_DataSequenceMap aIndexSequenceMap;
     775             :     ::std::transform( rInOutSequences.begin(), rInOutSequences.end(),
     776             :                       ::std::inserter( aIndexSequenceMap, aIndexSequenceMap.begin()),
     777           0 :                       lcl_SequenceToMapElement());
     778             : 
     779           0 :     rInOutSequences.clear();
     780           0 :     sal_Int32 nIndex = 0;
     781           0 :     for( lcl_DataSequenceMap::const_iterator aIt = aIndexSequenceMap.begin();
     782           0 :          aIt != aIndexSequenceMap.end(); ++aIt, ++nIndex )
     783             :     {
     784           0 :         if( aIt->first < 0 )
     785           0 :             continue;
     786             :         // fill empty columns
     787           0 :         for( ; nIndex < aIt->first; ++nIndex )
     788             :             rInOutSequences.push_back(
     789             :                 SchXMLExportHelper_Impl::tDataSequenceCont::value_type(
     790             :                     (uno::Reference< chart2::data::XDataSequence >)0,
     791           0 :                     (uno::Reference< chart2::data::XDataSequence >)0 ));
     792             :         OSL_ASSERT( nIndex == aIt->first );
     793           0 :         rInOutSequences.push_back( aIt->second );
     794           0 :     }
     795           0 : }
     796             : 
     797             : 
     798           0 : lcl_TableData lcl_getDataForLocalTable(
     799             :     const SchXMLExportHelper_Impl::tDataSequenceCont & aSequencesToExport,
     800             :     const Reference< chart2::XAnyDescriptionAccess >& xAnyDescriptionAccess,
     801             :     const OUString& rCategoriesRange,
     802             :     bool bSeriesFromColumns,
     803             :     const Reference< chart2::data::XRangeXMLConversion > & xRangeConversion )
     804             : {
     805           0 :     lcl_TableData aResult;
     806             : 
     807             :     try
     808             :     {
     809           0 :         Sequence< OUString > aSimpleCategories;
     810           0 :         if( xAnyDescriptionAccess.is() )
     811             :         {
     812             :             //categories
     813           0 :             if( bSeriesFromColumns )
     814             :             {
     815           0 :                 aSimpleCategories = xAnyDescriptionAccess->getRowDescriptions();
     816           0 :                 aResult.aComplexRowDescriptions = xAnyDescriptionAccess->getAnyRowDescriptions();
     817             :             }
     818             :             else
     819             :             {
     820           0 :                 aSimpleCategories = xAnyDescriptionAccess->getColumnDescriptions();
     821           0 :                 aResult.aComplexColumnDescriptions = xAnyDescriptionAccess->getAnyColumnDescriptions();
     822             :             }
     823             :         }
     824             : 
     825             :         //series values and series labels
     826           0 :         SchXMLExportHelper_Impl::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size();
     827           0 :         SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin());
     828           0 :         SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end());
     829           0 :         SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( aBegin );
     830             : 
     831           0 :         size_t nMaxSequenceLength( lcl_getMaxSequenceLength( aSequencesToExport ));
     832           0 :         size_t nCategoriesLength( aSimpleCategories.getLength() );
     833           0 :         if( nCategoriesLength > nMaxSequenceLength )
     834             :         {
     835           0 :             aSimpleCategories.realloc(nMaxSequenceLength);//#i110617#
     836           0 :             nCategoriesLength = nMaxSequenceLength;
     837             :         }
     838           0 :         size_t nNumColumns( bSeriesFromColumns ? nNumSequences : nMaxSequenceLength );
     839           0 :         size_t nNumRows( bSeriesFromColumns ? nMaxSequenceLength : nNumSequences );
     840             : 
     841             :         // resize data
     842           0 :         aResult.aDataInRows.resize( nNumRows );
     843           0 :         double fNan = 0.0;
     844           0 :         ::rtl::math::setNan( &fNan );
     845             :         ::std::for_each( aResult.aDataInRows.begin(), aResult.aDataInRows.end(),
     846           0 :                          lcl_resize< t2DNumberContainer::value_type >( nNumColumns, fNan ));
     847           0 :         aResult.aColumnDescriptions.resize( nNumColumns );
     848           0 :         aResult.aComplexColumnDescriptions.realloc( nNumColumns );
     849           0 :         aResult.aRowDescriptions.resize( nNumRows );
     850           0 :         aResult.aComplexRowDescriptions.realloc( nNumRows );
     851             : 
     852           0 :         tStringVector& rCategories = bSeriesFromColumns ? aResult.aRowDescriptions    : aResult.aColumnDescriptions;
     853           0 :         tStringVector& rLabels     = bSeriesFromColumns ? aResult.aColumnDescriptions : aResult.aRowDescriptions;
     854             : 
     855             :         //categories
     856           0 :         lcl_SequenceToVector( aSimpleCategories, rCategories );
     857           0 :         if( !rCategoriesRange.isEmpty() )
     858             :         {
     859           0 :             OUString aRange(rCategoriesRange);
     860           0 :             if( xRangeConversion.is())
     861           0 :                 aRange = xRangeConversion->convertRangeToXML( aRange );
     862           0 :             if( bSeriesFromColumns )
     863           0 :                 aResult.aRowDescriptions_Ranges.push_back( aRange );
     864             :             else
     865           0 :                 aResult.aColumnDescriptions_Ranges.push_back( aRange );
     866             :         }
     867             : 
     868             :         // iterate over all sequences
     869           0 :         size_t nSeqIdx = 0;
     870           0 :         Sequence< Sequence< OUString > > aComplexLabels(nNumSequences);
     871           0 :         for( ; aIt != aEnd; ++aIt, ++nSeqIdx )
     872             :         {
     873           0 :             OUString aRange;
     874           0 :             Sequence< OUString >& rCurrentComplexLabel = aComplexLabels[nSeqIdx];
     875           0 :             if( aIt->first.is())
     876             :             {
     877           0 :                 lcl_getLabelStringSequence( rCurrentComplexLabel, aIt->first );
     878           0 :                 rLabels[nSeqIdx] = lcl_flattenStringSequence( rCurrentComplexLabel );
     879           0 :                 aRange = aIt->first->getSourceRangeRepresentation();
     880           0 :                 if( xRangeConversion.is())
     881           0 :                     aRange = xRangeConversion->convertRangeToXML( aRange );
     882             :             }
     883           0 :             else if( aIt->second.is())
     884             :             {
     885           0 :                 rCurrentComplexLabel.realloc(1);
     886           0 :                 rLabels[nSeqIdx] = rCurrentComplexLabel[0] = lcl_flattenStringSequence(
     887           0 :                     aIt->second->generateLabel( chart2::data::LabelOrigin_SHORT_SIDE ));
     888             :             }
     889           0 :             if( bSeriesFromColumns )
     890           0 :                 aResult.aColumnDescriptions_Ranges.push_back( aRange );
     891             :             else
     892           0 :                 aResult.aRowDescriptions_Ranges.push_back( aRange );
     893             : 
     894           0 :             ::std::vector< double > aNumbers( lcl_getAllValuesFromSequence( aIt->second ));
     895           0 :             if( bSeriesFromColumns )
     896             :             {
     897           0 :                 const sal_Int32 nSize( static_cast< sal_Int32 >( aNumbers.size()));
     898           0 :                 for( sal_Int32 nIdx=0; nIdx<nSize; ++nIdx )
     899           0 :                     aResult.aDataInRows[nIdx][nSeqIdx] = aNumbers[nIdx];
     900             :             }
     901             :             else
     902           0 :                 aResult.aDataInRows[nSeqIdx] = aNumbers;
     903             : 
     904           0 :             if( aIt->second.is())
     905             :             {
     906           0 :                 aRange =  aIt->second->getSourceRangeRepresentation();
     907           0 :                 if( xRangeConversion.is())
     908           0 :                     aRange = xRangeConversion->convertRangeToXML( aRange );
     909             :             }
     910           0 :             aResult.aDataRangeRepresentations.push_back( aRange );
     911             : 
     912             :             //is column hidden?
     913           0 :             if( !lcl_SequenceHasUnhiddenData(aIt->first) && !lcl_SequenceHasUnhiddenData(aIt->second) )
     914           0 :                 aResult.aHiddenColumns.push_back(nSeqIdx);
     915           0 :         }
     916           0 :         Sequence< Sequence< Any > >& rComplexAnyLabels = bSeriesFromColumns ? aResult.aComplexColumnDescriptions : aResult.aComplexRowDescriptions;//#i116544#
     917           0 :         rComplexAnyLabels.realloc(aComplexLabels.getLength());
     918           0 :         for( sal_Int32 nN=0; nN<aComplexLabels.getLength();nN++ )
     919             :         {
     920           0 :             Sequence< OUString >& rSource = aComplexLabels[nN];
     921           0 :             Sequence< Any >& rTarget = rComplexAnyLabels[nN];
     922           0 :             rTarget.realloc( rSource.getLength() );
     923           0 :             for( sal_Int32 i=0; i<rSource.getLength(); i++ )
     924           0 :                 rTarget[i] = uno::makeAny( rSource[i] );
     925           0 :         }
     926             :     }
     927           0 :     catch( const uno::Exception & rEx )
     928             :     {
     929             :         (void)rEx; // avoid warning for pro build
     930             :         OSL_TRACE( OUStringToOString( OUString(
     931             :                     "something went wrong during table data collection: " ) + rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
     932             :     }
     933             : 
     934           0 :     return aResult;
     935             : }
     936             : 
     937           0 : void lcl_exportNumberFormat( const OUString& rPropertyName, const Reference< beans::XPropertySet >& xPropSet,
     938             :                                         SvXMLExport& rExport )
     939             : {
     940           0 :     if( xPropSet.is())
     941             :     {
     942           0 :         sal_Int32 nNumberFormat = 0;
     943           0 :         Any aNumAny = xPropSet->getPropertyValue( rPropertyName );
     944           0 :         if( (aNumAny >>= nNumberFormat) && (nNumberFormat != -1) )
     945           0 :             rExport.addDataStyle( nNumberFormat );
     946             :     }
     947           0 : }
     948             : 
     949             : ::std::vector< Reference< chart2::data::XDataSequence > >
     950           0 :     lcl_getErrorBarSequences( const Reference< beans::XPropertySet > & xErrorBarProp )
     951             : {
     952           0 :     ::std::vector< Reference< chart2::data::XDataSequence > > aResult;
     953           0 :     Reference< chart2::data::XDataSource > xErrorBarDataSource( xErrorBarProp, uno::UNO_QUERY );
     954           0 :     if( !xErrorBarDataSource.is())
     955             :         return aResult;
     956             : 
     957           0 :     const OUString aRolePrefix(  "error-bars-" );
     958             : 
     959             :     Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
     960           0 :         xErrorBarDataSource->getDataSequences());
     961           0 :     for( sal_Int32 nI=0; nI< aSequences.getLength(); ++nI )
     962             :     {
     963             :         try
     964             :         {
     965           0 :             if( aSequences[nI].is())
     966             :             {
     967           0 :                 Reference< chart2::data::XDataSequence > xSequence( aSequences[nI]->getValues());
     968           0 :                 Reference< beans::XPropertySet > xSeqProp( xSequence, uno::UNO_QUERY_THROW );
     969           0 :                 OUString aRole;
     970           0 :                 if( ( xSeqProp->getPropertyValue(
     971           0 :                           OUString(  "Role" )) >>= aRole ) &&
     972           0 :                     aRole.match( aRolePrefix ))
     973             :                 {
     974           0 :                     aResult.push_back( xSequence );
     975           0 :                 }
     976             :             }
     977             :         }
     978           0 :         catch( const uno::Exception & rEx )
     979             :         {
     980             : #ifdef DBG_UTIL
     981             :             rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
     982             :             OSL_TRACE( "chart:exporting error bar ranges: %s", aBStr.getStr());
     983             : #else
     984             :             (void)rEx; // avoid warning
     985             : #endif
     986             :         }
     987             :     }
     988             : 
     989           0 :     return aResult;
     990             : }
     991             : 
     992           0 : bool lcl_exportDomainForThisSequence( const Reference< chart2::data::XDataSequence > xValues, rtl::OUString& rFirstRangeForThisDomainIndex, SvXMLExport& rExport )
     993             : {
     994           0 :     bool bDomainExported = false;
     995           0 :     if( xValues.is())
     996             :     {
     997           0 :         Reference< chart2::XChartDocument > xNewDoc( rExport.GetModel(), uno::UNO_QUERY );
     998           0 :         OUString aRange( lcl_ConvertRange( xValues->getSourceRangeRepresentation(), xNewDoc ) );
     999             : 
    1000             :         //work around error in OOo 2.0 (problems with multiple series having a domain element)
    1001           0 :         if( rFirstRangeForThisDomainIndex.isEmpty() || !aRange.equals(rFirstRangeForThisDomainIndex) )
    1002             :         {
    1003           0 :             rExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, aRange);
    1004           0 :             SvXMLElementExport aDomain( rExport, XML_NAMESPACE_CHART, XML_DOMAIN, sal_True, sal_True );
    1005           0 :             bDomainExported = true;
    1006             :         }
    1007             : 
    1008           0 :         if( rFirstRangeForThisDomainIndex.isEmpty() )
    1009           0 :             rFirstRangeForThisDomainIndex = aRange;
    1010             :     }
    1011           0 :     return bDomainExported;
    1012             : }
    1013             : 
    1014             : } // anonymous namespace
    1015             : 
    1016           0 : struct SchXMLDataPointStruct
    1017             : {
    1018             :     OUString   maStyleName;
    1019             :     sal_Int32  mnRepeat;
    1020             : 
    1021           0 :     SchXMLDataPointStruct() : mnRepeat( 1 ) {}
    1022             : };
    1023             : 
    1024             : // ========================================
    1025             : // class SchXMLExportHelper
    1026             : // ========================================
    1027             : 
    1028           0 : SchXMLExportHelper::SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool )
    1029           0 :     : m_pImpl( new SchXMLExportHelper_Impl( rExport, rASPool ) )
    1030             : {
    1031           0 : }
    1032             : 
    1033           0 : SchXMLExportHelper::~SchXMLExportHelper()
    1034             : {
    1035           0 :     delete m_pImpl;
    1036           0 : }
    1037             : 
    1038           0 : const OUString& SchXMLExportHelper::getChartCLSID()
    1039             : {
    1040           0 :     return m_pImpl->msCLSID;
    1041             : }
    1042             : 
    1043           0 : UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const
    1044             : {
    1045           0 :     return mxPropertySetMapper;
    1046             : }
    1047             : 
    1048           0 : void SchXMLExportHelper_Impl::exportAutoStyles()
    1049             : {
    1050           0 :     if( mxExpPropMapper.is())
    1051             :     {
    1052             :         //ToDo: when embedded in calc/writer this is not necessary because the
    1053             :         // numberformatter is shared between both documents
    1054           0 :         mrExport.exportAutoDataStyles();
    1055             : 
    1056             :         // export chart auto styles
    1057             :         mrAutoStylePool.exportXML(
    1058             :             XML_STYLE_FAMILY_SCH_CHART_ID
    1059           0 :             , mrExport.GetDocHandler(),
    1060           0 :             mrExport.GetMM100UnitConverter(),
    1061           0 :             mrExport.GetNamespaceMap()
    1062           0 :             );
    1063             : 
    1064             :         // export auto styles for additional shapes
    1065           0 :         mrExport.GetShapeExport()->exportAutoStyles();
    1066             :         // and for text in additional shapes
    1067           0 :         mrExport.GetTextParagraphExport()->exportTextAutoStyles();
    1068             :     }
    1069           0 : }
    1070             : 
    1071             : // private methods
    1072             : // ---------------
    1073             : 
    1074           0 : SchXMLExportHelper_Impl::SchXMLExportHelper_Impl(
    1075             :     SvXMLExport& rExport,
    1076             :     SvXMLAutoStylePoolP& rASPool ) :
    1077             :         mrExport( rExport ),
    1078             :         mrAutoStylePool( rASPool ),
    1079             :         mbHasSeriesLabels( sal_False ),
    1080             :         mbHasCategoryLabels( sal_False ),
    1081           0 :         mbRowSourceColumns( sal_True )
    1082             :         // #110680#
    1083             :         // this id depends on the ServiceManager used due to the binary filter stripping.
    1084             :         // ,msCLSID( rtl::OUString( SvGlobalName( SO3_SCH_CLASSID ).GetHexName()))
    1085             : {
    1086             :     // #110680#
    1087             :     // changed initialisation for msCLSID. Compare the ServiceInfo name with
    1088             :     // the known name of the LegacyServiceManager.
    1089           0 :     Reference<lang::XServiceInfo> xServiceInfo( mrExport.getServiceFactory(), uno::UNO_QUERY );
    1090             :     DBG_ASSERT( xServiceInfo.is(), "XMultiServiceFactory without xServiceInfo (!)" );
    1091           0 :     OUString rdbURL = xServiceInfo->getImplementationName();
    1092           0 :     OUString implLegacyServiceManagerName(  "com.sun.star.comp.office.LegacyServiceManager"  );
    1093             : 
    1094           0 :     if( rdbURL.equals( implLegacyServiceManagerName ))
    1095             :     {
    1096           0 :         msCLSID = OUString( SvGlobalName( BF_SO3_SCH_CLASSID ).GetHexName());
    1097             :     }
    1098             :     else
    1099             :     {
    1100           0 :         msCLSID = OUString( SvGlobalName( SO3_SCH_CLASSID ).GetHexName());
    1101             :     }
    1102             : 
    1103           0 :     msTableName = OUString( "local-table" );
    1104             : 
    1105             :     // create factory
    1106           0 :     mxPropertyHandlerFactory = new XMLChartPropHdlFactory;
    1107             : 
    1108           0 :     if( mxPropertyHandlerFactory.is() )
    1109             :     {
    1110             :         // create property set mapper
    1111           0 :         mxPropertySetMapper = new XMLChartPropertySetMapper;
    1112             :     }
    1113             : 
    1114           0 :     mxExpPropMapper = new XMLChartExportPropertyMapper( mxPropertySetMapper, rExport );
    1115             : 
    1116             :     // register chart auto-style family
    1117             :     mrAutoStylePool.AddFamily(
    1118             :         XML_STYLE_FAMILY_SCH_CHART_ID,
    1119             :         OUString( XML_STYLE_FAMILY_SCH_CHART_NAME ),
    1120           0 :         mxExpPropMapper.get(),
    1121           0 :         OUString( XML_STYLE_FAMILY_SCH_CHART_PREFIX ));
    1122             : 
    1123             :     // register shape family
    1124             :     mrAutoStylePool.AddFamily(
    1125             :         XML_STYLE_FAMILY_SD_GRAPHICS_ID,
    1126             :         OUString( XML_STYLE_FAMILY_SD_GRAPHICS_NAME ),
    1127           0 :         mxExpPropMapper.get(),
    1128           0 :         OUString( XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX ));
    1129             :     // register paragraph family also for shapes
    1130             :     mrAutoStylePool.AddFamily(
    1131             :         XML_STYLE_FAMILY_TEXT_PARAGRAPH,
    1132           0 :         GetXMLToken( XML_PARAGRAPH ),
    1133           0 :         mxExpPropMapper.get(),
    1134           0 :         rtl::OUString( 'P' ));
    1135             :     // register text family also for shapes
    1136             :     mrAutoStylePool.AddFamily(
    1137             :         XML_STYLE_FAMILY_TEXT_TEXT,
    1138           0 :         GetXMLToken( XML_TEXT ),
    1139           0 :         mxExpPropMapper.get(),
    1140           0 :         rtl::OUString( 'T' ));
    1141           0 : }
    1142             : 
    1143           0 : SchXMLExportHelper_Impl::~SchXMLExportHelper_Impl()
    1144             : {
    1145           0 : }
    1146             : 
    1147           0 : void SchXMLExportHelper_Impl::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc )
    1148             : {
    1149           0 :     parseDocument( rChartDoc, sal_False );
    1150           0 : }
    1151             : 
    1152           0 : void SchXMLExportHelper_Impl::exportChart( Reference< chart::XChartDocument > rChartDoc,
    1153             :                                       sal_Bool bIncludeTable )
    1154             : {
    1155           0 :     parseDocument( rChartDoc, sal_True, bIncludeTable );
    1156             :     DBG_ASSERT( maAutoStyleNameQueue.empty(), "There are still remaining autostyle names in the queue" );
    1157           0 : }
    1158             : 
    1159           0 : static ::rtl::OUString lcl_GetStringFromNumberSequence( const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping, bool bRemoveOneFromEachIndex /*should be true if having categories*/ )
    1160             : {
    1161           0 :     const sal_Int32* pArray = rSequenceMapping.getConstArray();
    1162           0 :     const sal_Int32 nSize = rSequenceMapping.getLength();
    1163           0 :     sal_Int32 i = 0;
    1164           0 :     OUStringBuffer aBuf;
    1165           0 :     bool bHasPredecessor = false;
    1166           0 :     for( i = 0; i < nSize; ++i )
    1167             :     {
    1168           0 :         sal_Int32 nIndex = pArray[ i ];
    1169           0 :         if( bRemoveOneFromEachIndex )
    1170           0 :             --nIndex;
    1171           0 :         if(nIndex>=0)
    1172             :         {
    1173           0 :             if(bHasPredecessor)
    1174           0 :                 aBuf.append( static_cast< sal_Unicode >( ' ' ));
    1175           0 :             aBuf.append( nIndex, 10 );
    1176           0 :             bHasPredecessor = true;
    1177             :         }
    1178             :     }
    1179           0 :     return aBuf.makeStringAndClear();
    1180             : }
    1181             : 
    1182             : /// if bExportContent is false the auto-styles are collected
    1183           0 : void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& rChartDoc,
    1184             :                                         sal_Bool bExportContent,
    1185             :                                         sal_Bool bIncludeTable )
    1186             : {
    1187           0 :     Reference< chart2::XChartDocument > xNewDoc( rChartDoc, uno::UNO_QUERY );
    1188           0 :     if( !rChartDoc.is() || !xNewDoc.is() )
    1189             :     {
    1190             :         OSL_FAIL( "No XChartDocument was given for export." );
    1191           0 :         return;
    1192             :     }
    1193             : 
    1194           0 :     awt::Size aPageSize( getPageSize( xNewDoc ));
    1195           0 :     if( bExportContent )
    1196           0 :         addSize( aPageSize );
    1197           0 :     Reference< chart::XDiagram > xDiagram = rChartDoc->getDiagram();
    1198           0 :     Reference< chart2::XDiagram > xNewDiagram;
    1199           0 :     if( xNewDoc.is())
    1200           0 :         xNewDiagram.set( xNewDoc->getFirstDiagram());
    1201             : 
    1202             :     //todo remove if model changes are notified and view is updated automatically
    1203           0 :     if( bExportContent )
    1204             :     {
    1205           0 :         Reference< util::XRefreshable > xRefreshable( xNewDoc, uno::UNO_QUERY );
    1206           0 :         if( xRefreshable.is() )
    1207           0 :             xRefreshable->refresh();
    1208             :     }
    1209             : 
    1210             :     // get Properties of ChartDocument
    1211           0 :     sal_Bool bHasMainTitle = sal_False;
    1212           0 :     sal_Bool bHasSubTitle = sal_False;
    1213           0 :     sal_Bool bHasLegend = sal_False;
    1214           0 :     util::DateTime aNullDate(0,0,0,0,30,12,1899);
    1215             : 
    1216           0 :     std::vector< XMLPropertyState > aPropertyStates;
    1217             : 
    1218           0 :     Reference< beans::XPropertySet > xDocPropSet( rChartDoc, uno::UNO_QUERY );
    1219           0 :     if( xDocPropSet.is())
    1220             :     {
    1221             :         try
    1222             :         {
    1223           0 :             Any aAny( xDocPropSet->getPropertyValue(
    1224           0 :                 OUString(  "HasMainTitle" )));
    1225           0 :             aAny >>= bHasMainTitle;
    1226           0 :             aAny = xDocPropSet->getPropertyValue(
    1227           0 :                 OUString(  "HasSubTitle" ));
    1228           0 :             aAny >>= bHasSubTitle;
    1229           0 :             aAny = xDocPropSet->getPropertyValue(
    1230           0 :                 OUString(  "HasLegend" ));
    1231           0 :             aAny >>= bHasLegend;
    1232           0 :             if ( bIncludeTable )
    1233             :             {
    1234           0 :                 OUString sNullDate(  "NullDate" );
    1235           0 :                 aAny = xDocPropSet->getPropertyValue(sNullDate);
    1236           0 :                 if ( !aAny.hasValue() )
    1237             :                 {
    1238           0 :                     Reference<container::XChild> xChild(rChartDoc, uno::UNO_QUERY );
    1239           0 :                     if ( xChild.is() )
    1240             :                     {
    1241           0 :                         Reference< beans::XPropertySet > xParentDoc( xChild->getParent(),uno::UNO_QUERY);
    1242           0 :                         if ( xParentDoc.is() && xParentDoc->getPropertySetInfo()->hasPropertyByName(sNullDate) )
    1243           0 :                             aAny = xParentDoc->getPropertyValue(sNullDate);
    1244           0 :                     }
    1245             :                 }
    1246             : 
    1247           0 :                 aAny >>= aNullDate;
    1248           0 :             }
    1249             :         }
    1250           0 :         catch( const beans::UnknownPropertyException & )
    1251             :         {
    1252             :             DBG_WARNING( "Required property not found in ChartDocument" );
    1253             :         }
    1254             :     }
    1255             : 
    1256           0 :     if ( bIncludeTable && (aNullDate.Day != 30 || aNullDate.Month != 12 || aNullDate.Year != 1899 ) )
    1257             :     {
    1258           0 :         SvXMLElementExport aSet( mrExport, XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, sal_True, sal_True );
    1259             :         {
    1260           0 :             ::rtl::OUStringBuffer sBuffer;
    1261           0 :             ::sax::Converter::convertDateTime(sBuffer, aNullDate);
    1262           0 :             mrExport.AddAttribute( XML_NAMESPACE_TABLE,XML_DATE_VALUE,sBuffer.makeStringAndClear());
    1263           0 :             SvXMLElementExport aNull( mrExport, XML_NAMESPACE_TABLE, XML_NULL_DATE, sal_True, sal_True );
    1264           0 :         }
    1265             :     }
    1266             : 
    1267             :     // chart element
    1268             :     // -------------
    1269             : 
    1270           0 :     SvXMLElementExport* pElChart = 0;
    1271             :     // get property states for autostyles
    1272           0 :     if( mxExpPropMapper.is())
    1273             :     {
    1274           0 :         Reference< beans::XPropertySet > xPropSet( rChartDoc->getArea(), uno::UNO_QUERY );
    1275           0 :         if( xPropSet.is())
    1276           0 :             aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    1277             :     }
    1278             : 
    1279           0 :     if( bExportContent )
    1280             :     {
    1281             :         //export data provider in xlink:href attribute
    1282           0 :         const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
    1283           0 :         if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
    1284             :         {
    1285           0 :             OUString aDataProviderURL(  ".."  );
    1286           0 :             if( xNewDoc->hasInternalDataProvider() )
    1287           0 :                 aDataProviderURL = OUString(  "."  );
    1288             :             else //special handling for data base data provider necessary
    1289             :             {
    1290           0 :                 Reference< chart2::data::XDatabaseDataProvider > xDBDataProvider( xNewDoc->getDataProvider(), uno::UNO_QUERY );
    1291           0 :                 if( xDBDataProvider.is() )
    1292           0 :                     aDataProviderURL = OUString(  "."  );
    1293             :             }
    1294           0 :             mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aDataProviderURL );
    1295           0 :             mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
    1296             :         }
    1297             : 
    1298           0 :         OUString sChartType( xDiagram->getDiagramType() );
    1299             : 
    1300             :         // attributes
    1301             :         // determine class
    1302           0 :         if( !sChartType.isEmpty())
    1303             :         {
    1304           0 :             enum XMLTokenEnum eXMLChartType = SchXMLTools::getTokenByChartType( sChartType, true /* bUseOldNames */ );
    1305             : 
    1306             :             DBG_ASSERT( eXMLChartType != XML_TOKEN_INVALID, "invalid chart class" );
    1307           0 :             if( eXMLChartType == XML_TOKEN_INVALID )
    1308           0 :                 eXMLChartType = XML_BAR;
    1309             : 
    1310           0 :             if( eXMLChartType == XML_ADD_IN )
    1311             :             {
    1312             :                 // sChartType is the servie-name of the add-in
    1313             :                 mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS,
    1314           0 :                                        mrExport.GetNamespaceMap().GetQNameByKey(
    1315           0 :                                            XML_NAMESPACE_OOO, sChartType) );
    1316             :             }
    1317           0 :             else if( eXMLChartType != XML_TOKEN_INVALID )
    1318             :             {
    1319             :                 mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS,
    1320           0 :                         mrExport.GetNamespaceMap().GetQNameByKey(
    1321           0 :                             XML_NAMESPACE_CHART, GetXMLToken(eXMLChartType )) );
    1322             :             }
    1323             : 
    1324             :             //column-mapping or row-mapping
    1325           0 :             if( maSequenceMapping.getLength() )
    1326             :             {
    1327           0 :                 enum XMLTokenEnum eTransToken = ::xmloff::token::XML_ROW_MAPPING;
    1328           0 :                 if( mbRowSourceColumns )
    1329           0 :                     eTransToken = ::xmloff::token::XML_COLUMN_MAPPING;
    1330             :                 ::rtl::OUString aSequenceMappingStr( lcl_GetStringFromNumberSequence(
    1331           0 :                     maSequenceMapping, mbHasCategoryLabels && !xNewDoc->hasInternalDataProvider() ) );
    1332             : 
    1333             :                 mrExport.AddAttribute( XML_NAMESPACE_CHART,
    1334           0 :                                         ::xmloff::token::GetXMLToken( eTransToken ),
    1335           0 :                                         aSequenceMappingStr );
    1336             :             }
    1337             :         }
    1338             :         // write style name
    1339           0 :         AddAutoStyleAttribute( aPropertyStates );
    1340             : 
    1341             :         //element
    1342           0 :         pElChart = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_CHART, sal_True, sal_True );
    1343             :     }
    1344             :     else    // autostyles
    1345             :     {
    1346           0 :         CollectAutoStyle( aPropertyStates );
    1347             :     }
    1348             :     // remove property states for autostyles
    1349           0 :     aPropertyStates.clear();
    1350             : 
    1351             :     // title element
    1352             :     // -------------
    1353             : 
    1354           0 :     if( bHasMainTitle )
    1355             :     {
    1356             :         // get property states for autostyles
    1357           0 :         if( mxExpPropMapper.is())
    1358             :         {
    1359           0 :             Reference< beans::XPropertySet > xPropSet( rChartDoc->getTitle(), uno::UNO_QUERY );
    1360           0 :             if( xPropSet.is())
    1361           0 :                 aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    1362             :         }
    1363           0 :         if( bExportContent )
    1364             :         {
    1365           0 :             Reference< drawing::XShape > xShape = rChartDoc->getTitle();
    1366           0 :             if( xShape.is())    // && "hasTitleBeenMoved"
    1367           0 :                 addPosition( xShape );
    1368             : 
    1369             :             // write style name
    1370           0 :             AddAutoStyleAttribute( aPropertyStates );
    1371             : 
    1372             :             // element
    1373           0 :             SvXMLElementExport aElTitle( mrExport, XML_NAMESPACE_CHART, XML_TITLE, sal_True, sal_True );
    1374             : 
    1375             :             // content (text:p)
    1376           0 :             Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
    1377           0 :             if( xPropSet.is())
    1378             :             {
    1379           0 :                 Any aAny( xPropSet->getPropertyValue(
    1380           0 :                     OUString(  "String" )));
    1381           0 :                 OUString aText;
    1382           0 :                 aAny >>= aText;
    1383           0 :                 exportText( aText );
    1384           0 :             }
    1385             :         }
    1386             :         else    // autostyles
    1387             :         {
    1388           0 :             CollectAutoStyle( aPropertyStates );
    1389             :         }
    1390             :         // remove property states for autostyles
    1391           0 :         aPropertyStates.clear();
    1392             :     }
    1393             : 
    1394             :     // subtitle element
    1395             :     // ----------------
    1396             : 
    1397           0 :     if( bHasSubTitle )
    1398             :     {
    1399             :         // get property states for autostyles
    1400           0 :         if( mxExpPropMapper.is())
    1401             :         {
    1402           0 :             Reference< beans::XPropertySet > xPropSet( rChartDoc->getSubTitle(), uno::UNO_QUERY );
    1403           0 :             if( xPropSet.is())
    1404           0 :                 aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    1405             :         }
    1406             : 
    1407           0 :         if( bExportContent )
    1408             :         {
    1409           0 :             Reference< drawing::XShape > xShape = rChartDoc->getSubTitle();
    1410           0 :             if( xShape.is())
    1411           0 :                 addPosition( xShape );
    1412             : 
    1413             :             // write style name
    1414           0 :             AddAutoStyleAttribute( aPropertyStates );
    1415             : 
    1416             :             // element (has no subelements)
    1417           0 :             SvXMLElementExport aElSubTitle( mrExport, XML_NAMESPACE_CHART, XML_SUBTITLE, sal_True, sal_True );
    1418             : 
    1419             :             // content (text:p)
    1420           0 :             Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
    1421           0 :             if( xPropSet.is())
    1422             :             {
    1423           0 :                 Any aAny( xPropSet->getPropertyValue(
    1424           0 :                     OUString(  "String" )));
    1425           0 :                 OUString aText;
    1426           0 :                 aAny >>= aText;
    1427           0 :                 exportText( aText );
    1428           0 :             }
    1429             :         }
    1430             :         else    // autostyles
    1431             :         {
    1432           0 :             CollectAutoStyle( aPropertyStates );
    1433             :         }
    1434             :         // remove property states for autostyles
    1435           0 :         aPropertyStates.clear();
    1436             :     }
    1437             : 
    1438             :     // legend element
    1439             :     // --------------
    1440           0 :     if( bHasLegend )
    1441             :     {
    1442             :         // get property states for autostyles
    1443           0 :         if( mxExpPropMapper.is())
    1444             :         {
    1445           0 :             Reference< beans::XPropertySet > xPropSet( rChartDoc->getLegend(), uno::UNO_QUERY );
    1446           0 :             if( xPropSet.is())
    1447           0 :                 aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    1448             :         }
    1449             : 
    1450           0 :         if( bExportContent )
    1451             :         {
    1452           0 :             Reference< beans::XPropertySet > xProp( rChartDoc->getLegend(), uno::UNO_QUERY );
    1453           0 :             if( xProp.is())
    1454             :             {
    1455             :                 // export legend anchor position
    1456             :                 try
    1457             :                 {
    1458           0 :                     Any aAny( xProp->getPropertyValue( OUString(  "Alignment" )));
    1459           0 :                     if( SchXMLEnumConverter::getLegendPositionConverter().exportXML( msString, aAny, mrExport.GetMM100UnitConverter() ) )
    1460           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LEGEND_POSITION, msString );
    1461             :                 }
    1462           0 :                 catch( const beans::UnknownPropertyException & )
    1463             :                 {
    1464             :                     DBG_WARNING( "Property Align not found in ChartLegend" );
    1465             :                 }
    1466             : 
    1467             :                 // export absolute legend position
    1468           0 :                 Reference< drawing::XShape > xLegendShape( xProp, uno::UNO_QUERY );
    1469           0 :                 addPosition( xLegendShape );
    1470             : 
    1471             :                 // export legend size
    1472           0 :                 const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
    1473           0 :                 if( xLegendShape.is() && nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
    1474             :                 {
    1475             :                     try
    1476             :                     {
    1477           0 :                         chart::ChartLegendExpansion nLegendExpansion = chart::ChartLegendExpansion_HIGH;
    1478           0 :                         OUString aExpansionString;
    1479           0 :                         Any aAny( xProp->getPropertyValue( OUString(  "Expansion" )));
    1480           0 :                         bool bHasExpansion = (aAny >>= nLegendExpansion);
    1481           0 :                         if( bHasExpansion && SchXMLEnumConverter::getLegendExpansionConverter().exportXML( aExpansionString, aAny, mrExport.GetMM100UnitConverter() ) )
    1482             :                         {
    1483           0 :                             mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION, aExpansionString );
    1484           0 :                             if( nLegendExpansion == chart::ChartLegendExpansion_CUSTOM)
    1485             :                             {
    1486           0 :                                 awt::Size aSize( xLegendShape->getSize() );
    1487           0 :                                 addSize( aSize, true );
    1488           0 :                                 rtl::OUStringBuffer aAspectRatioString;
    1489             :                                 ::sax::Converter::convertDouble(
    1490             :                                     aAspectRatioString,
    1491           0 :                                     double(aSize.Width)/double(aSize.Height));
    1492           0 :                                 mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION_ASPECT_RATIO, aAspectRatioString.makeStringAndClear() );
    1493             :                             }
    1494           0 :                         }
    1495             :                     }
    1496           0 :                     catch( const beans::UnknownPropertyException & )
    1497             :                     {
    1498             :                         DBG_WARNING( "Property Expansion not found in ChartLegend" );
    1499             :                     }
    1500           0 :                 }
    1501             :             }
    1502             : 
    1503             :             // write style name
    1504           0 :             AddAutoStyleAttribute( aPropertyStates );
    1505             : 
    1506             :             // element
    1507           0 :             SvXMLElementExport aLegend( mrExport, XML_NAMESPACE_CHART, XML_LEGEND, sal_True, sal_True );
    1508             :         }
    1509             :         else    // autostyles
    1510             :         {
    1511           0 :             CollectAutoStyle( aPropertyStates );
    1512             :         }
    1513             :         // remove property states for autostyles
    1514           0 :         aPropertyStates.clear();
    1515             :     }
    1516             : 
    1517             :     // plot-area element
    1518             :     // -----------------
    1519           0 :     if( xDiagram.is())
    1520           0 :         exportPlotArea( xDiagram, xNewDiagram, aPageSize, bExportContent, bIncludeTable );
    1521             : 
    1522             :     // export additional shapes
    1523             :     // ------------------------
    1524           0 :     if( xDocPropSet.is() )
    1525             :     {
    1526           0 :         if( bExportContent )
    1527             :         {
    1528           0 :             if( mxAdditionalShapes.is())
    1529             :             {
    1530             :                 // can't call exportShapes with all shapes because the
    1531             :                 // initialisation happend with the complete draw page and not
    1532             :                 // the XShapes object used here. Thus the shapes have to be
    1533             :                 // exported one by one
    1534           0 :                 UniReference< XMLShapeExport > rShapeExport = mrExport.GetShapeExport();
    1535           0 :                 Reference< drawing::XShape > xShape;
    1536           0 :                 const sal_Int32 nShapeCount( mxAdditionalShapes->getCount());
    1537           0 :                 for( sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++ )
    1538             :                 {
    1539           0 :                     mxAdditionalShapes->getByIndex( nShapeId ) >>= xShape;
    1540             :                     DBG_ASSERT( xShape.is(), "Shape without an XShape?" );
    1541           0 :                     if( ! xShape.is())
    1542           0 :                         continue;
    1543             : 
    1544           0 :                     rShapeExport->exportShape( xShape );
    1545           0 :                 }
    1546             :                 // this would be the easier way if it worked:
    1547             :                 //mrExport.GetShapeExport()->exportShapes( mxAdditionalShapes );
    1548             :             }
    1549             :         }
    1550             :         else
    1551             :         {
    1552             :             // get a sequence of non-chart shapes (inserted via clipboard)
    1553             :             try
    1554             :             {
    1555           0 :                 Any aShapesAny = xDocPropSet->getPropertyValue( OUString( "AdditionalShapes" ));
    1556           0 :                 aShapesAny >>= mxAdditionalShapes;
    1557             :             }
    1558           0 :             catch( const uno::Exception & rEx )
    1559             :             {
    1560             :                 (void)rEx; // avoid warning for pro build
    1561             :                 OSL_TRACE(
    1562             :                     OUStringToOString(
    1563             :                         OUString( "AdditionalShapes not found: " ) +
    1564             :                         rEx.Message,
    1565             :                         RTL_TEXTENCODING_ASCII_US ).getStr());
    1566             :             }
    1567             : 
    1568           0 :             if( mxAdditionalShapes.is())
    1569             :             {
    1570             :                 // seek shapes has to be called for the whole page because in
    1571             :                 // the shape export the vector of shapes is accessed via the
    1572             :                 // ZOrder which might be (actually is) larger than the number of
    1573             :                 // shapes in mxAdditionalShapes
    1574           0 :                 Reference< drawing::XDrawPageSupplier > xSupplier( rChartDoc, uno::UNO_QUERY );
    1575             :                 DBG_ASSERT( xSupplier.is(), "Cannot retrieve draw page to initialize shape export" );
    1576           0 :                 if( xSupplier.is() )
    1577             :                 {
    1578           0 :                     Reference< drawing::XShapes > xDrawPage( xSupplier->getDrawPage(), uno::UNO_QUERY );
    1579             :                     DBG_ASSERT( xDrawPage.is(), "Invalid draw page for initializing shape export" );
    1580           0 :                     if( xDrawPage.is())
    1581           0 :                         mrExport.GetShapeExport()->seekShapes( xDrawPage );
    1582             :                 }
    1583             : 
    1584             :                 // can't call collectShapesAutoStyles with all shapes because
    1585             :                 // the initialisation happend with the complete draw page and
    1586             :                 // not the XShapes object used here. Thus the shapes have to be
    1587             :                 // exported one by one
    1588           0 :                 UniReference< XMLShapeExport > rShapeExport = mrExport.GetShapeExport();
    1589           0 :                 Reference< drawing::XShape > xShape;
    1590           0 :                 const sal_Int32 nShapeCount( mxAdditionalShapes->getCount());
    1591           0 :                 for( sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++ )
    1592             :                 {
    1593           0 :                     mxAdditionalShapes->getByIndex( nShapeId ) >>= xShape;
    1594             :                     DBG_ASSERT( xShape.is(), "Shape without an XShape?" );
    1595           0 :                     if( ! xShape.is())
    1596           0 :                         continue;
    1597             : 
    1598           0 :                     rShapeExport->collectShapeAutoStyles( xShape );
    1599           0 :                 }
    1600             :             }
    1601             :         }
    1602             :     }
    1603             : 
    1604             :     // table element
    1605             :     // (is included as subelement of chart)
    1606             :     // ------------------------------------
    1607           0 :     if( bExportContent )
    1608             :     {
    1609             :         // #85929# always export table, otherwise clipboard may loose data
    1610           0 :         exportTable();
    1611             :     }
    1612             : 
    1613             :     // close <chart:chart> element
    1614           0 :     if( pElChart )
    1615           0 :         delete pElChart;
    1616             : }
    1617             : 
    1618           0 : static void lcl_exportComplexLabel( const Sequence< uno::Any >& rComplexLabel, SvXMLExport& rExport )
    1619             : {
    1620           0 :     sal_Int32 nLength = rComplexLabel.getLength();
    1621           0 :     if( nLength<=1 )
    1622           0 :         return;
    1623           0 :     SvXMLElementExport aTextList( rExport, XML_NAMESPACE_TEXT, XML_LIST, sal_True, sal_True );
    1624           0 :     for(sal_Int32 nN=0; nN<nLength; nN++)
    1625             :     {
    1626           0 :         SvXMLElementExport aListItem( rExport, XML_NAMESPACE_TEXT, XML_LIST_ITEM, sal_True, sal_True );
    1627           0 :         OUString aString;
    1628           0 :         if( !(rComplexLabel[nN]>>=aString) )
    1629             :         {
    1630             :             //todo?
    1631             :         }
    1632           0 :         SchXMLTools::exportText( rExport, aString, false /*bConvertTabsLFs*/ );
    1633           0 :     }
    1634             : }
    1635             : 
    1636           0 : void SchXMLExportHelper_Impl::exportTable()
    1637             : {
    1638             :     // table element
    1639             :     // -------------
    1640           0 :     mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NAME, msTableName );
    1641             : 
    1642             :     try
    1643             :     {
    1644           0 :         bool bProtected = false;
    1645           0 :         Reference< beans::XPropertySet > xProps( mrExport.GetModel(), uno::UNO_QUERY_THROW );
    1646           0 :         if ( ( xProps->getPropertyValue( OUString(  "DisableDataTableDialog"  ) ) >>= bProtected ) &&
    1647             :              bProtected )
    1648             :         {
    1649           0 :             mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE );
    1650           0 :         }
    1651             :     }
    1652           0 :     catch ( const uno::Exception& )
    1653             :     {
    1654             :     }
    1655             : 
    1656           0 :     SvXMLElementExport aTable( mrExport, XML_NAMESPACE_TABLE, XML_TABLE, sal_True, sal_True );
    1657             : 
    1658           0 :     bool bHasOwnData = false;
    1659           0 :     Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
    1660           0 :     Reference< chart2::data::XRangeXMLConversion > xRangeConversion;
    1661           0 :     if( xNewDoc.is())
    1662             :     {
    1663           0 :         bHasOwnData = xNewDoc->hasInternalDataProvider();
    1664           0 :         xRangeConversion.set( xNewDoc->getDataProvider(), uno::UNO_QUERY );
    1665             :     }
    1666             : 
    1667           0 :     Reference< chart2::XAnyDescriptionAccess > xAnyDescriptionAccess;
    1668             :     {
    1669           0 :         Reference< chart::XChartDocument > xChartDoc( mrExport.GetModel(), uno::UNO_QUERY );
    1670           0 :         if( xChartDoc.is() )
    1671           0 :             xAnyDescriptionAccess = Reference< chart2::XAnyDescriptionAccess >( xChartDoc->getData(), uno::UNO_QUERY );
    1672             :     }
    1673             : 
    1674           0 :     if( bHasOwnData )
    1675           0 :         lcl_ReorderInternalSequencesAccordingToTheirRangeName( m_aDataSequencesToExport );
    1676             :     lcl_TableData aData( lcl_getDataForLocalTable( m_aDataSequencesToExport
    1677             :                                 , xAnyDescriptionAccess, maCategoriesRange
    1678           0 :                                 , mbRowSourceColumns, xRangeConversion ));
    1679             : 
    1680           0 :     tStringVector::const_iterator aDataRangeIter( aData.aDataRangeRepresentations.begin());
    1681           0 :     const tStringVector::const_iterator aDataRangeEndIter( aData.aDataRangeRepresentations.end());
    1682             : 
    1683           0 :     tStringVector::const_iterator aRowDescriptions_RangeIter( aData.aRowDescriptions_Ranges.begin());
    1684           0 :     const tStringVector::const_iterator aRowDescriptions_RangeEnd( aData.aRowDescriptions_Ranges.end());
    1685             : 
    1686             :     // declare columns
    1687             :     {
    1688           0 :         SvXMLElementExport aHeaderColumns( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, sal_True, sal_True );
    1689           0 :         SvXMLElementExport aHeaderColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
    1690             :     }
    1691             :     {
    1692           0 :         SvXMLElementExport aColumns( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, sal_True, sal_True );
    1693             : 
    1694           0 :         sal_Int32 nNextIndex = 0;
    1695           0 :         for( size_t nN=0; nN< aData.aHiddenColumns.size(); nN++ )
    1696             :         {
    1697             :             //i91578 display of hidden values (copy paste scenario; export hidden flag thus it can be used during migration to locale table upon paste )
    1698           0 :             sal_Int32 nHiddenIndex = aData.aHiddenColumns[nN];
    1699           0 :             if( nHiddenIndex > nNextIndex )
    1700             :             {
    1701           0 :                 sal_Int64 nRepeat = static_cast< sal_Int64 >( nHiddenIndex - nNextIndex );
    1702           0 :                 if(nRepeat>1)
    1703             :                     mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
    1704           0 :                                    OUString::valueOf( nRepeat ));
    1705           0 :                 SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
    1706             :             }
    1707           0 :             mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_VISIBILITY, GetXMLToken( XML_COLLAPSE ) );
    1708           0 :             SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
    1709           0 :             nNextIndex = nHiddenIndex+1;
    1710           0 :         }
    1711             : 
    1712           0 :         sal_Int32 nEndIndex = aData.aColumnDescriptions.size()-1;
    1713           0 :         if( nEndIndex >= nNextIndex )
    1714             :         {
    1715           0 :             sal_Int64 nRepeat = static_cast< sal_Int64 >( nEndIndex - nNextIndex + 1 );
    1716           0 :             if(nRepeat>1)
    1717             :                 mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
    1718           0 :                                OUString::valueOf( nRepeat ));
    1719           0 :             SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
    1720           0 :         }
    1721             :     }
    1722             : 
    1723             :     // export rows with content
    1724             :     //export header row
    1725             :     {
    1726           0 :         SvXMLElementExport aHeaderRows( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, sal_True, sal_True );
    1727           0 :         SvXMLElementExport aRow( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True );
    1728             : 
    1729             :         //first one empty cell for the row descriptions
    1730             :         {
    1731           0 :             SvXMLElementExport aEmptyCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
    1732           0 :             SvXMLElementExport aEmptyParagraph( mrExport, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_True );
    1733             :         }
    1734             : 
    1735             :         //export column descriptions
    1736           0 :         tStringVector::const_iterator aColumnDescriptions_RangeIter( aData.aColumnDescriptions_Ranges.begin());
    1737           0 :         const tStringVector::const_iterator aColumnDescriptions_RangeEnd( aData.aColumnDescriptions_Ranges.end());
    1738           0 :         const Sequence< Sequence< uno::Any > >& rComplexColumnDescriptions = aData.aComplexColumnDescriptions;
    1739           0 :         sal_Int32 nComplexCount = rComplexColumnDescriptions.getLength();
    1740           0 :         sal_Int32 nC = 0;
    1741           0 :         for( tStringVector::const_iterator aIt( aData.aColumnDescriptions.begin())
    1742           0 :              ; (aIt != aData.aColumnDescriptions.end())
    1743             :              ; ++aIt, nC++ )
    1744             :         {
    1745           0 :             bool bExportString = true;
    1746           0 :             if( nC < nComplexCount )
    1747             :             {
    1748           0 :                 const Sequence< uno::Any >& rComplexLabel = rComplexColumnDescriptions[nC];
    1749           0 :                 if( rComplexLabel.getLength()>0 )
    1750             :                 {
    1751           0 :                     double fValue=0.0;
    1752           0 :                     if( rComplexLabel[0] >>=fValue )
    1753             :                     {
    1754           0 :                         bExportString = false;
    1755             : 
    1756             :                             ::sax::Converter::convertDouble(
    1757           0 :                                 msStringBuffer, fValue);
    1758           0 :                         msString = msStringBuffer.makeStringAndClear();
    1759           0 :                         mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT );
    1760           0 :                         mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString );
    1761             :                     }
    1762             :                 }
    1763             :             }
    1764           0 :             if( bExportString )
    1765             :             {
    1766           0 :                 mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING );
    1767             :             }
    1768             : 
    1769           0 :             SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
    1770           0 :             exportText( *aIt );
    1771           0 :             if( nC < nComplexCount )
    1772           0 :                 lcl_exportComplexLabel( rComplexColumnDescriptions[nC], mrExport );
    1773           0 :             if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd )
    1774             :             {
    1775             :                 // remind the original range to allow a correct re-association when copying via clipboard
    1776           0 :                 if (!(*aColumnDescriptions_RangeIter).isEmpty())
    1777           0 :                     SchXMLTools::exportRangeToSomewhere( mrExport, *aColumnDescriptions_RangeIter );
    1778           0 :                 ++aColumnDescriptions_RangeIter;
    1779             :             }
    1780           0 :         }
    1781           0 :         OSL_ASSERT( bHasOwnData || aColumnDescriptions_RangeIter == aColumnDescriptions_RangeEnd );
    1782             :     } // closing row and header-rows elements
    1783             : 
    1784             :     // export value rows
    1785             :     {
    1786           0 :         SvXMLElementExport aRows( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROWS, sal_True, sal_True );
    1787           0 :         tStringVector::const_iterator aRowDescriptionsIter( aData.aRowDescriptions.begin());
    1788           0 :         const Sequence< Sequence< uno::Any > >& rComplexRowDescriptions = aData.aComplexRowDescriptions;
    1789           0 :         sal_Int32 nComplexCount = rComplexRowDescriptions.getLength();
    1790           0 :         sal_Int32 nC = 0;
    1791             : 
    1792           0 :         for( t2DNumberContainer::const_iterator aRowIt( aData.aDataInRows.begin())
    1793           0 :             ; aRowIt != aData.aDataInRows.end()
    1794             :             ; ++aRowIt, ++nC )
    1795             :         {
    1796           0 :             SvXMLElementExport aRow( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True );
    1797             : 
    1798             :             //export row descriptions
    1799             :             {
    1800           0 :                 bool bExportString = true;
    1801           0 :                 if( nC < nComplexCount )
    1802             :                 {
    1803           0 :                     const Sequence< uno::Any >& rComplexLabel = rComplexRowDescriptions[nC];
    1804           0 :                     if( rComplexLabel.getLength()>0 )
    1805             :                     {
    1806           0 :                         double fValue=0.0;
    1807           0 :                         if( rComplexLabel[0] >>=fValue )
    1808             :                         {
    1809           0 :                             bExportString = false;
    1810             : 
    1811           0 :                         ::sax::Converter::convertDouble(msStringBuffer, fValue);
    1812           0 :                             msString = msStringBuffer.makeStringAndClear();
    1813           0 :                             mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT );
    1814           0 :                             mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString );
    1815             :                         }
    1816             :                     }
    1817             :                 }
    1818           0 :                 if( bExportString )
    1819             :                 {
    1820           0 :                     mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING );
    1821             :                 }
    1822             : 
    1823           0 :                 SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
    1824           0 :                 if( aRowDescriptionsIter != aData.aRowDescriptions.end())
    1825             :                 {
    1826           0 :                     exportText( *aRowDescriptionsIter );
    1827           0 :                     if( nC < nComplexCount )
    1828           0 :                         lcl_exportComplexLabel( rComplexRowDescriptions[nC], mrExport );
    1829           0 :                     if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd )
    1830             :                     {
    1831             :                         // remind the original range to allow a correct re-association when copying via clipboard
    1832           0 :                         SchXMLTools::exportRangeToSomewhere( mrExport, *aRowDescriptions_RangeIter );
    1833           0 :                         ++aRowDescriptions_RangeIter;
    1834             :                     }
    1835           0 :                     ++aRowDescriptionsIter;
    1836           0 :                 }
    1837             :             }
    1838             : 
    1839             :             //export row values
    1840           0 :             for( t2DNumberContainer::value_type::const_iterator aColIt( aRowIt->begin());
    1841           0 :                  aColIt != aRowIt->end(); ++aColIt )
    1842             :             {
    1843           0 :                 ::sax::Converter::convertDouble( msStringBuffer, *aColIt );
    1844           0 :                 msString = msStringBuffer.makeStringAndClear();
    1845           0 :                 mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT );
    1846           0 :                 mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString );
    1847           0 :                 SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True );
    1848           0 :                 exportText( msString, false ); // do not convert tabs and lfs
    1849           0 :                 if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) &&
    1850           0 :                     ( mbRowSourceColumns || (aColIt == aRowIt->begin()) ) )
    1851             :                 {
    1852             :                     // remind the original range to allow a correct re-association when copying via clipboard
    1853           0 :                     if (!(*aDataRangeIter).isEmpty())
    1854           0 :                         SchXMLTools::exportRangeToSomewhere( mrExport, *aDataRangeIter );
    1855           0 :                     ++aDataRangeIter;
    1856             :                 }
    1857           0 :             }
    1858           0 :         }
    1859             :     }
    1860             : 
    1861             :     // if range iterator was used it should have reached its end
    1862             :     OSL_ASSERT( bHasOwnData || (aDataRangeIter == aDataRangeEndIter) );
    1863           0 :     OSL_ASSERT( bHasOwnData || (aRowDescriptions_RangeIter == aRowDescriptions_RangeEnd) );
    1864           0 : }
    1865             : 
    1866             : namespace
    1867             : {
    1868             : 
    1869           0 : Reference< chart2::XCoordinateSystem > lcl_getCooSys( const Reference< chart2::XDiagram > & xNewDiagram )
    1870             : {
    1871           0 :     Reference< chart2::XCoordinateSystem > xCooSys;
    1872           0 :     Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDiagram, uno::UNO_QUERY );
    1873           0 :     if(xCooSysCnt.is())
    1874             :     {
    1875           0 :         Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
    1876           0 :         if(aCooSysSeq.getLength()>0)
    1877           0 :             xCooSys = aCooSysSeq[0];
    1878             :     }
    1879           0 :     return xCooSys;
    1880             : }
    1881             : 
    1882           0 : Reference< chart2::XAxis > lcl_getAxis( const Reference< chart2::XCoordinateSystem >& xCooSys,
    1883             :         enum XMLTokenEnum eDimension, bool bPrimary=true )
    1884             : {
    1885           0 :     Reference< chart2::XAxis > xNewAxis;
    1886             :     try
    1887             :     {
    1888           0 :         if( xCooSys.is() )
    1889             :         {
    1890           0 :             sal_Int32 nDimensionIndex=0;
    1891           0 :             switch( eDimension )
    1892             :             {
    1893             :             case XML_X:
    1894           0 :                 nDimensionIndex=0;
    1895           0 :                 break;
    1896             :             case XML_Y:
    1897           0 :                 nDimensionIndex=1;
    1898           0 :                 break;
    1899             :             case XML_Z:
    1900           0 :                 nDimensionIndex=2;
    1901           0 :                 break;
    1902             :             default:
    1903           0 :                 break;
    1904             :             }
    1905             : 
    1906           0 :             xNewAxis = xCooSys->getAxisByDimension( nDimensionIndex, bPrimary ? 0 : 1 );
    1907             :         }
    1908             :     }
    1909           0 :     catch( const uno::Exception & )
    1910             :     {
    1911             :     }
    1912           0 :     return xNewAxis;
    1913             : }
    1914             : 
    1915             : }
    1916             : 
    1917           0 : void SchXMLExportHelper_Impl::exportPlotArea(
    1918             :     Reference< chart::XDiagram > xDiagram,
    1919             :     Reference< chart2::XDiagram > xNewDiagram,
    1920             :     const awt::Size & rPageSize,
    1921             :     sal_Bool bExportContent,
    1922             :     sal_Bool bIncludeTable )
    1923             : {
    1924             :     DBG_ASSERT( xDiagram.is(), "Invalid XDiagram as parameter" );
    1925           0 :     if( ! xDiagram.is())
    1926           0 :         return;
    1927             : 
    1928             :     // variables for autostyles
    1929           0 :     Reference< beans::XPropertySet > xPropSet;
    1930           0 :     std::vector< XMLPropertyState > aPropertyStates;
    1931             : 
    1932           0 :     sal_Bool bIs3DChart = sal_False;
    1933           0 :     drawing::HomogenMatrix aTransMatrix;
    1934             : 
    1935           0 :     msStringBuffer.setLength( 0 );
    1936             : 
    1937             :     // plot-area element
    1938             :     // -----------------
    1939             : 
    1940           0 :     SvXMLElementExport* pElPlotArea = 0;
    1941             :     // get property states for autostyles
    1942           0 :     xPropSet = Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY );
    1943           0 :     if( xPropSet.is())
    1944             :     {
    1945           0 :         if( mxExpPropMapper.is())
    1946           0 :             aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    1947             :     }
    1948           0 :     if( bExportContent )
    1949             :     {
    1950           0 :         UniReference< XMLShapeExport > rShapeExport;
    1951             : 
    1952             :         // write style name
    1953           0 :         AddAutoStyleAttribute( aPropertyStates );
    1954             : 
    1955           0 :         if( !msChartAddress.isEmpty() )
    1956             :         {
    1957           0 :             if( !bIncludeTable )
    1958           0 :                 mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, msChartAddress );
    1959             : 
    1960           0 :             Reference< chart::XChartDocument > xDoc( mrExport.GetModel(), uno::UNO_QUERY );
    1961           0 :             if( xDoc.is() )
    1962             :             {
    1963           0 :                 Reference< beans::XPropertySet > xDocProp( xDoc, uno::UNO_QUERY );
    1964           0 :                 if( xDocProp.is())
    1965             :                 {
    1966           0 :                     Any aAny;
    1967           0 :                     sal_Bool bFirstCol = false, bFirstRow = false;
    1968             : 
    1969             :                     try
    1970             :                     {
    1971           0 :                         aAny = xDocProp->getPropertyValue(
    1972           0 :                             OUString(  "DataSourceLabelsInFirstColumn" ));
    1973           0 :                         aAny >>= bFirstCol;
    1974           0 :                         aAny = xDocProp->getPropertyValue(
    1975           0 :                             OUString(  "DataSourceLabelsInFirstRow" ));
    1976           0 :                         aAny >>= bFirstRow;
    1977             : 
    1978           0 :                         if( bFirstCol || bFirstRow )
    1979             :                         {
    1980             :                             mrExport.AddAttribute( XML_NAMESPACE_CHART,
    1981           0 :                                                    ::xmloff::token::GetXMLToken( ::xmloff::token::XML_DATA_SOURCE_HAS_LABELS ),
    1982             :                                                    ( bFirstCol
    1983             :                                                      ? ( bFirstRow
    1984             :                                                          ?  ::xmloff::token::GetXMLToken( ::xmloff::token::XML_BOTH )
    1985             :                                                          :  ::xmloff::token::GetXMLToken( ::xmloff::token::XML_COLUMN ))
    1986           0 :                                                      : ::xmloff::token::GetXMLToken( ::xmloff::token::XML_ROW )));
    1987             :                         }
    1988             :                     }
    1989           0 :                     catch( const beans::UnknownPropertyException & )
    1990             :                     {
    1991             :                         SAL_WARN( "xmloff.chart", "Properties missing" );
    1992           0 :                     }
    1993           0 :                 }
    1994           0 :             }
    1995             :         }
    1996             : 
    1997             :         // #i72973#, #144135# only export table-number-list in OOo format (also for binary)
    1998           0 :         Reference< beans::XPropertySet > xExportInfo( mrExport.getExportInfo());
    1999           0 :         if( !msTableNumberList.isEmpty() && xExportInfo.is())
    2000             :         {
    2001             :             try
    2002             :             {
    2003           0 :                 OUString sExportTableNumListPropName( "ExportTableNumberList");
    2004           0 :                 Reference< beans::XPropertySetInfo > xInfo( xExportInfo->getPropertySetInfo());
    2005           0 :                 bool bExportTableNumberList = false;
    2006           0 :                 if( xInfo.is() && xInfo->hasPropertyByName( sExportTableNumListPropName ) &&
    2007           0 :                     (xExportInfo->getPropertyValue( sExportTableNumListPropName ) >>= bExportTableNumberList) &&
    2008             :                     bExportTableNumberList )
    2009             :                 {
    2010             :                     // this attribute is for charts embedded in calc documents only.
    2011             :                     // With this you are able to store a file again in 5.0 binary format
    2012           0 :                     mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_TABLE_NUMBER_LIST, msTableNumberList );
    2013           0 :                 }
    2014             :             }
    2015           0 :             catch( const uno::Exception & rEx )
    2016             :             {
    2017             : #ifdef DBG_UTIL
    2018             :                 rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
    2019             :                 OSL_TRACE("chart:TableNumberList property caught: %s", aBStr.getStr());
    2020             : #else
    2021             :                 (void)rEx; // avoid warning
    2022             : #endif
    2023             :             }
    2024             :         }
    2025             : 
    2026             :         // attributes
    2027           0 :         Reference< drawing::XShape > xShape ( xDiagram, uno::UNO_QUERY );
    2028           0 :         if( xShape.is())
    2029             :         {
    2030           0 :             addPosition( xShape );
    2031           0 :             addSize( xShape );
    2032             :         }
    2033             : 
    2034           0 :         if( xPropSet.is())
    2035             :         {
    2036           0 :             Any aAny;
    2037             : 
    2038             :             // 3d attributes
    2039             :             try
    2040             :             {
    2041           0 :                 aAny = xPropSet->getPropertyValue( OUString(  "Dim3D" ));
    2042           0 :                 aAny >>= bIs3DChart;
    2043             : 
    2044           0 :                 if( bIs3DChart )
    2045             :                 {
    2046           0 :                     rShapeExport = mrExport.GetShapeExport();
    2047           0 :                     if( rShapeExport.is())
    2048           0 :                         rShapeExport->export3DSceneAttributes( xPropSet );
    2049             :                 }
    2050             :             }
    2051           0 :             catch( const uno::Exception & rEx )
    2052             :             {
    2053             : #ifdef DBG_UTIL
    2054             :                 rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
    2055             :                 OSL_TRACE( "chart:exportPlotAreaException caught: %s", aBStr.getStr());
    2056             : #else
    2057             :                 (void)rEx; // avoid warning
    2058             : #endif
    2059           0 :             }
    2060             :         }
    2061             : 
    2062             :         // plot-area element
    2063           0 :         pElPlotArea = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, sal_True, sal_True );
    2064             : 
    2065             :         //inner position rectangle element
    2066           0 :         exportCoordinateRegion( xDiagram );
    2067             : 
    2068             :         // light sources (inside plot area element)
    2069           0 :         if( bIs3DChart &&
    2070           0 :             rShapeExport.is())
    2071           0 :             rShapeExport->export3DLamps( xPropSet );
    2072             :     }
    2073             :     else    // autostyles
    2074             :     {
    2075           0 :         CollectAutoStyle( aPropertyStates );
    2076             :     }
    2077             :     // remove property states for autostyles
    2078           0 :     aPropertyStates.clear();
    2079             : 
    2080             :     // axis elements
    2081             :     // -------------
    2082           0 :     exportAxes( xDiagram, xNewDiagram, bExportContent );
    2083             : 
    2084             :     // series elements
    2085             :     // ---------------
    2086           0 :     Reference< chart2::XAxis > xSecondYAxis = lcl_getAxis( lcl_getCooSys( xNewDiagram ), XML_Y, false );
    2087           0 :     exportSeries( xNewDiagram, rPageSize, bExportContent, xSecondYAxis.is() );
    2088             : 
    2089             :     // stock-chart elements
    2090           0 :     OUString sChartType ( xDiagram->getDiagramType());
    2091           0 :     if( 0 == sChartType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart.StockDiagram" )))
    2092             :     {
    2093           0 :         Reference< chart::XStatisticDisplay > xStockPropProvider( xDiagram, uno::UNO_QUERY );
    2094           0 :         if( xStockPropProvider.is())
    2095             :         {
    2096             :             // stock-gain-marker
    2097           0 :             Reference< beans::XPropertySet > xStockPropSet = xStockPropProvider->getUpBar();
    2098           0 :             if( xStockPropSet.is())
    2099             :             {
    2100           0 :                 aPropertyStates.clear();
    2101           0 :                 aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
    2102             : 
    2103           0 :                 if( !aPropertyStates.empty() )
    2104             :                 {
    2105           0 :                     if( bExportContent )
    2106             :                     {
    2107           0 :                         AddAutoStyleAttribute( aPropertyStates );
    2108             : 
    2109           0 :                         SvXMLElementExport aGain( mrExport, XML_NAMESPACE_CHART, XML_STOCK_GAIN_MARKER, sal_True, sal_True );
    2110             :                     }
    2111             :                     else
    2112             :                     {
    2113           0 :                         CollectAutoStyle( aPropertyStates );
    2114             :                     }
    2115             :                 }
    2116             :             }
    2117             : 
    2118             :             // stock-loss-marker
    2119           0 :             xStockPropSet = xStockPropProvider->getDownBar();
    2120           0 :             if( xStockPropSet.is())
    2121             :             {
    2122           0 :                 aPropertyStates.clear();
    2123           0 :                 aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
    2124             : 
    2125           0 :                 if( !aPropertyStates.empty() )
    2126             :                 {
    2127           0 :                     if( bExportContent )
    2128             :                     {
    2129           0 :                         AddAutoStyleAttribute( aPropertyStates );
    2130             : 
    2131           0 :                         SvXMLElementExport aGain( mrExport, XML_NAMESPACE_CHART, XML_STOCK_LOSS_MARKER, sal_True, sal_True );
    2132             :                     }
    2133             :                     else
    2134             :                     {
    2135           0 :                         CollectAutoStyle( aPropertyStates );
    2136             :                     }
    2137             :                 }
    2138             :             }
    2139             : 
    2140             :             // stock-range-line
    2141           0 :             xStockPropSet = xStockPropProvider->getMinMaxLine();
    2142           0 :             if( xStockPropSet.is())
    2143             :             {
    2144           0 :                 aPropertyStates.clear();
    2145           0 :                 aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
    2146             : 
    2147           0 :                 if( !aPropertyStates.empty() )
    2148             :                 {
    2149           0 :                     if( bExportContent )
    2150             :                     {
    2151           0 :                         AddAutoStyleAttribute( aPropertyStates );
    2152             : 
    2153           0 :                         SvXMLElementExport aGain( mrExport, XML_NAMESPACE_CHART, XML_STOCK_RANGE_LINE, sal_True, sal_True );
    2154             :                     }
    2155             :                     else
    2156             :                     {
    2157           0 :                         CollectAutoStyle( aPropertyStates );
    2158             :                     }
    2159             :                 }
    2160           0 :             }
    2161           0 :         }
    2162             :     }
    2163             : 
    2164             :     // wall and floor element
    2165             :     // ----------------------
    2166             : 
    2167           0 :     Reference< chart::X3DDisplay > xWallFloorSupplier( xDiagram, uno::UNO_QUERY );
    2168           0 :     if( mxExpPropMapper.is() &&
    2169           0 :         xWallFloorSupplier.is())
    2170             :     {
    2171             :         // remove property states for autostyles
    2172           0 :         aPropertyStates.clear();
    2173             : 
    2174           0 :         Reference< beans::XPropertySet > xWallPropSet( xWallFloorSupplier->getWall(), uno::UNO_QUERY );
    2175           0 :         if( xWallPropSet.is())
    2176             :         {
    2177           0 :             aPropertyStates = mxExpPropMapper->Filter( xWallPropSet );
    2178             : 
    2179           0 :             if( !aPropertyStates.empty() )
    2180             :             {
    2181             :                 // write element
    2182           0 :                 if( bExportContent )
    2183             :                 {
    2184             :                     // add style name attribute
    2185           0 :                     AddAutoStyleAttribute( aPropertyStates );
    2186             : 
    2187           0 :                     SvXMLElementExport aWall( mrExport, XML_NAMESPACE_CHART, XML_WALL, sal_True, sal_True );
    2188             :                 }
    2189             :                 else    // autostyles
    2190             :                 {
    2191           0 :                     CollectAutoStyle( aPropertyStates );
    2192             :                 }
    2193             :             }
    2194             :         }
    2195             : 
    2196             :         // floor element
    2197             :         // -------------
    2198             : 
    2199             :         // remove property states for autostyles
    2200           0 :         aPropertyStates.clear();
    2201             : 
    2202           0 :         Reference< beans::XPropertySet > xFloorPropSet( xWallFloorSupplier->getFloor(), uno::UNO_QUERY );
    2203           0 :         if( xFloorPropSet.is())
    2204             :         {
    2205           0 :             aPropertyStates = mxExpPropMapper->Filter( xFloorPropSet );
    2206             : 
    2207           0 :             if( !aPropertyStates.empty() )
    2208             :             {
    2209             :                 // write element
    2210           0 :                 if( bExportContent )
    2211             :                 {
    2212             :                     // add style name attribute
    2213           0 :                     AddAutoStyleAttribute( aPropertyStates );
    2214             : 
    2215           0 :                     SvXMLElementExport aFloor( mrExport, XML_NAMESPACE_CHART, XML_FLOOR, sal_True, sal_True );
    2216             :                 }
    2217             :                 else    // autostyles
    2218             :                 {
    2219           0 :                     CollectAutoStyle( aPropertyStates );
    2220             :                 }
    2221             :             }
    2222           0 :         }
    2223             :     }
    2224             : 
    2225           0 :     if( pElPlotArea )
    2226           0 :         delete pElPlotArea;
    2227             : }
    2228             : 
    2229           0 : void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< chart::XDiagram >& xDiagram )
    2230             : {
    2231           0 :     const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
    2232           0 :     if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older
    2233             :         return;
    2234             : 
    2235           0 :     Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY );
    2236             :     DBG_ASSERT( xDiaPos.is(), "Invalid xDiaPos as parameter" );
    2237           0 :     if( !xDiaPos.is() )
    2238             :         return;
    2239             : 
    2240           0 :     awt::Rectangle aRect( xDiaPos->calculateDiagramPositionExcludingAxes() );
    2241           0 :     addPosition( awt::Point(aRect.X,aRect.Y) );
    2242           0 :     addSize( awt::Size(aRect.Width,aRect.Height) );
    2243             : 
    2244           0 :     SvXMLElementExport aCoordinateRegion( mrExport, XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, sal_True );//#i100778# todo: change to chart namespace in future - dependent on fileformat
    2245             : }
    2246             : 
    2247             : namespace
    2248             : {
    2249           0 :     XMLTokenEnum lcl_getTimeUnitToken( sal_Int32 nTimeUnit )
    2250             :     {
    2251           0 :         XMLTokenEnum eToken = XML_DAYS;
    2252           0 :         switch( nTimeUnit )
    2253             :         {
    2254             :         case ::com::sun::star::chart::TimeUnit::YEAR:
    2255           0 :             eToken = XML_YEARS;
    2256           0 :             break;
    2257             :         case ::com::sun::star::chart::TimeUnit::MONTH:
    2258           0 :             eToken = XML_MONTHS;
    2259           0 :             break;
    2260             :         default://days
    2261           0 :             break;
    2262             :         }
    2263           0 :         return eToken;
    2264             :     }
    2265             : }
    2266             : 
    2267           0 : void SchXMLExportHelper_Impl::exportDateScale( const Reference< beans::XPropertySet > xAxisProps )
    2268             : {
    2269           0 :     if( !xAxisProps.is() )
    2270           0 :         return;
    2271             : 
    2272           0 :     chart::TimeIncrement aIncrement;
    2273           0 :     if( (xAxisProps->getPropertyValue( OUString( "TimeIncrement" )) >>= aIncrement) )
    2274             :     {
    2275           0 :         sal_Int32 nTimeResolution = ::com::sun::star::chart::TimeUnit::DAY;
    2276           0 :         if( aIncrement.TimeResolution >>= nTimeResolution )
    2277           0 :             mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_BASE_TIME_UNIT, lcl_getTimeUnitToken( nTimeResolution ) );
    2278             : 
    2279           0 :         OUStringBuffer aValue;
    2280           0 :         chart::TimeInterval aInterval;
    2281           0 :         if( aIncrement.MajorTimeInterval >>= aInterval )
    2282             :         {
    2283           0 :             ::sax::Converter::convertNumber( aValue, aInterval.Number );
    2284           0 :             mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_VALUE, aValue.makeStringAndClear() );
    2285           0 :             mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
    2286             :         }
    2287           0 :         if( aIncrement.MinorTimeInterval >>= aInterval )
    2288             :         {
    2289           0 :             ::sax::Converter::convertNumber( aValue, aInterval.Number );
    2290           0 :             mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_VALUE, aValue.makeStringAndClear() );
    2291           0 :             mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
    2292             :         }
    2293             : 
    2294           0 :         SvXMLElementExport aDateScale( mrExport, XML_NAMESPACE_CHART_EXT, XML_DATE_SCALE, sal_True, sal_True );//#i25706#todo: change namespace for next ODF version
    2295           0 :     }
    2296             : }
    2297             : 
    2298           0 : void SchXMLExportHelper_Impl::exportAxisTitle( const Reference< beans::XPropertySet > xTitleProps, bool bExportContent )
    2299             : {
    2300           0 :     if( !xTitleProps.is() )
    2301           0 :         return;
    2302           0 :     std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xTitleProps );
    2303           0 :     if( bExportContent )
    2304             :     {
    2305           0 :         OUString aText;
    2306           0 :         Any aAny( xTitleProps->getPropertyValue(
    2307           0 :             OUString(  "String" )));
    2308           0 :         aAny >>= aText;
    2309             : 
    2310           0 :         Reference< drawing::XShape > xShape( xTitleProps, uno::UNO_QUERY );
    2311           0 :         if( xShape.is())
    2312           0 :             addPosition( xShape );
    2313             : 
    2314           0 :         AddAutoStyleAttribute( aPropertyStates );
    2315           0 :         SvXMLElementExport aTitle( mrExport, XML_NAMESPACE_CHART, XML_TITLE, sal_True, sal_True );
    2316             : 
    2317             :         // paragraph containing title
    2318           0 :         exportText( aText );
    2319             :     }
    2320             :     else
    2321             :     {
    2322           0 :         CollectAutoStyle( aPropertyStates );
    2323             :     }
    2324           0 :     aPropertyStates.clear();
    2325             : }
    2326             : 
    2327           0 : void SchXMLExportHelper_Impl::exportGrid( const Reference< beans::XPropertySet > xGridProperties, bool bMajor, bool bExportContent )
    2328             : {
    2329           0 :     if( !xGridProperties.is() )
    2330           0 :         return;
    2331           0 :     std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xGridProperties );
    2332           0 :     if( bExportContent )
    2333             :     {
    2334           0 :         AddAutoStyleAttribute( aPropertyStates );
    2335           0 :         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS, bMajor ? XML_MAJOR : XML_MINOR );
    2336           0 :         SvXMLElementExport aGrid( mrExport, XML_NAMESPACE_CHART, XML_GRID, sal_True, sal_True );
    2337             :     }
    2338             :     else
    2339             :     {
    2340           0 :         CollectAutoStyle( aPropertyStates );
    2341             :     }
    2342           0 :     aPropertyStates.clear();
    2343             : }
    2344             : 
    2345             : namespace
    2346             : {
    2347             : 
    2348             : //returns true if a date scale needs to be exported
    2349           0 : bool lcl_exportAxisType( const Reference< chart2::XAxis > xChart2Axis, SvXMLExport& rExport)
    2350             : {
    2351           0 :     bool bExportDateScale = false;
    2352           0 :     if( !xChart2Axis.is() )
    2353           0 :         return bExportDateScale;
    2354             : 
    2355           0 :     const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
    2356           0 :     if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older
    2357           0 :         return bExportDateScale;
    2358             : 
    2359           0 :     chart2::ScaleData aScale( xChart2Axis->getScaleData() );
    2360             :     //#i25706#todo: change namespace for next ODF version
    2361           0 :     sal_uInt16 nNameSpace = XML_NAMESPACE_CHART_EXT;
    2362             : 
    2363           0 :     switch(aScale.AxisType)
    2364             :     {
    2365             :     case chart2::AxisType::CATEGORY:
    2366           0 :         if( aScale.AutoDateAxis )
    2367             :         {
    2368           0 :             rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_AUTO );
    2369           0 :             bExportDateScale = true;
    2370             :         }
    2371             :         else
    2372           0 :             rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_TEXT );
    2373           0 :         break;
    2374             :     case chart2::AxisType::DATE:
    2375           0 :         rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_DATE );
    2376           0 :         bExportDateScale = true;
    2377           0 :         break;
    2378             :     default: //AUTOMATIC
    2379           0 :         rExport.AddAttribute( nNameSpace, XML_AXIS_TYPE, XML_AUTO );
    2380           0 :         break;
    2381             :     }
    2382             : 
    2383           0 :     return bExportDateScale;
    2384             : }
    2385             : 
    2386             : }
    2387             : 
    2388           0 : void SchXMLExportHelper_Impl::exportAxis(
    2389             :     enum XMLTokenEnum eDimension,
    2390             :     enum XMLTokenEnum eAxisName,
    2391             :     const Reference< beans::XPropertySet > xAxisProps,
    2392             :     const Reference< chart2::XAxis >& xChart2Axis,
    2393             :     const OUString& rCategoriesRange,
    2394             :     bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid,
    2395             :     bool bExportContent )
    2396             : {
    2397           0 :     static const OUString sNumFormat( OUString( "NumberFormat" ));
    2398           0 :     std::vector< XMLPropertyState > aPropertyStates;
    2399           0 :     SvXMLElementExport* pAxis = NULL;
    2400             : 
    2401             :     // get property states for autostyles
    2402           0 :     if( xAxisProps.is() && mxExpPropMapper.is() )
    2403             :     {
    2404           0 :         lcl_exportNumberFormat( sNumFormat, xAxisProps, mrExport );
    2405           0 :         aPropertyStates = mxExpPropMapper->Filter( xAxisProps );
    2406             :     }
    2407             : 
    2408           0 :     bool bExportDateScale = false;
    2409           0 :     if( bExportContent )
    2410             :     {
    2411           0 :         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, eDimension );
    2412           0 :         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_NAME, eAxisName );
    2413           0 :         AddAutoStyleAttribute( aPropertyStates ); // write style name
    2414           0 :         if( !rCategoriesRange.isEmpty() )
    2415           0 :             bExportDateScale = lcl_exportAxisType( xChart2Axis, mrExport );
    2416             : 
    2417             :         // open axis element
    2418           0 :         pAxis = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_AXIS, sal_True, sal_True );
    2419             :     }
    2420             :     else
    2421             :     {
    2422           0 :         CollectAutoStyle( aPropertyStates );
    2423             :     }
    2424           0 :     aPropertyStates.clear();
    2425             : 
    2426             :     //date scale
    2427           0 :     if( bExportDateScale )
    2428           0 :         exportDateScale( xAxisProps );
    2429             : 
    2430           0 :     Reference< beans::XPropertySet > xTitleProps;
    2431           0 :     Reference< beans::XPropertySet > xMajorGridProps;
    2432           0 :     Reference< beans::XPropertySet > xMinorGridProps;
    2433           0 :     Reference< chart::XAxis > xAxis( xAxisProps, uno::UNO_QUERY );
    2434           0 :     if( xAxis.is() )
    2435             :     {
    2436           0 :         xTitleProps = bHasTitle ? xAxis->getAxisTitle() : 0;
    2437           0 :         xMajorGridProps = bHasMajorGrid ? xAxis->getMajorGrid() : 0;
    2438           0 :         xMinorGridProps = bHasMinorGrid ? xAxis->getMinorGrid() : 0;
    2439             :     }
    2440             : 
    2441             :     // axis-title
    2442           0 :     exportAxisTitle( xTitleProps , bExportContent );
    2443             : 
    2444             :     // categories if we have a categories chart
    2445           0 :     if( bExportContent && !rCategoriesRange.isEmpty() )
    2446             :     {
    2447           0 :         mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, rCategoriesRange );
    2448           0 :         SvXMLElementExport aCategories( mrExport, XML_NAMESPACE_CHART, XML_CATEGORIES, sal_True, sal_True );
    2449             :     }
    2450             : 
    2451             :     // grid
    2452           0 :     exportGrid( xMajorGridProps, true, bExportContent );
    2453           0 :     exportGrid( xMinorGridProps, false, bExportContent );
    2454             : 
    2455           0 :     if( pAxis )
    2456             :     {
    2457             :         //close axis element
    2458           0 :         delete pAxis;
    2459           0 :         pAxis = NULL;
    2460           0 :     }
    2461           0 : }
    2462             : 
    2463           0 : void SchXMLExportHelper_Impl::exportAxes(
    2464             :     const Reference< chart::XDiagram > & xDiagram,
    2465             :     const Reference< chart2::XDiagram > & xNewDiagram,
    2466             :     sal_Bool bExportContent )
    2467             : {
    2468             :     DBG_ASSERT( xDiagram.is(), "Invalid XDiagram as parameter" );
    2469           0 :     if( ! xDiagram.is())
    2470           0 :         return;
    2471             : 
    2472             :     // get some properties from document first
    2473           0 :     sal_Bool bHasXAxis = sal_False,
    2474           0 :         bHasYAxis = sal_False,
    2475           0 :         bHasZAxis = sal_False,
    2476           0 :         bHasSecondaryXAxis = sal_False,
    2477           0 :         bHasSecondaryYAxis = sal_False;
    2478           0 :     sal_Bool bHasXAxisTitle = sal_False,
    2479           0 :         bHasYAxisTitle = sal_False,
    2480           0 :         bHasZAxisTitle = sal_False,
    2481           0 :         bHasSecondaryXAxisTitle = sal_False,
    2482           0 :         bHasSecondaryYAxisTitle = sal_False;
    2483           0 :     sal_Bool bHasXAxisMajorGrid = sal_False,
    2484           0 :         bHasXAxisMinorGrid = sal_False,
    2485           0 :         bHasYAxisMajorGrid = sal_False,
    2486           0 :         bHasYAxisMinorGrid = sal_False,
    2487           0 :         bHasZAxisMajorGrid = sal_False,
    2488           0 :         bHasZAxisMinorGrid = sal_False;
    2489             : 
    2490             :     // get multiple properties using XMultiPropertySet
    2491           0 :     MultiPropertySetHandler aDiagramProperties (xDiagram);
    2492             : 
    2493             :     aDiagramProperties.Add (
    2494           0 :         OUString("HasXAxis"), bHasXAxis);
    2495             :     aDiagramProperties.Add (
    2496           0 :         OUString("HasYAxis"), bHasYAxis);
    2497             :     aDiagramProperties.Add (
    2498           0 :         OUString("HasZAxis"), bHasZAxis);
    2499             :     aDiagramProperties.Add (
    2500           0 :         OUString("HasSecondaryXAxis"), bHasSecondaryXAxis);
    2501             :     aDiagramProperties.Add (
    2502           0 :         OUString("HasSecondaryYAxis"), bHasSecondaryYAxis);
    2503             : 
    2504             :     aDiagramProperties.Add (
    2505           0 :         OUString ("HasXAxisTitle"), bHasXAxisTitle);
    2506             :     aDiagramProperties.Add (
    2507           0 :         OUString ("HasYAxisTitle"), bHasYAxisTitle);
    2508             :     aDiagramProperties.Add (
    2509           0 :         OUString ("HasZAxisTitle"), bHasZAxisTitle);
    2510             :     aDiagramProperties.Add (
    2511           0 :         OUString ("HasSecondaryXAxisTitle"), bHasSecondaryXAxisTitle);
    2512             :     aDiagramProperties.Add (
    2513           0 :         OUString ("HasSecondaryYAxisTitle"), bHasSecondaryYAxisTitle);
    2514             : 
    2515             :     aDiagramProperties.Add (
    2516           0 :         OUString ("HasXAxisGrid"), bHasXAxisMajorGrid);
    2517             :     aDiagramProperties.Add (
    2518           0 :         OUString ("HasYAxisGrid"), bHasYAxisMajorGrid);
    2519             :     aDiagramProperties.Add (
    2520           0 :         OUString ("HasZAxisGrid"), bHasZAxisMajorGrid);
    2521             : 
    2522             :     aDiagramProperties.Add (
    2523           0 :         OUString ("HasXAxisHelpGrid"), bHasXAxisMinorGrid);
    2524             :     aDiagramProperties.Add (
    2525           0 :         OUString ("HasYAxisHelpGrid"), bHasYAxisMinorGrid);
    2526             :     aDiagramProperties.Add (
    2527           0 :         OUString ("HasZAxisHelpGrid"), bHasZAxisMinorGrid);
    2528             : 
    2529           0 :     if ( ! aDiagramProperties.GetProperties ())
    2530             :     {
    2531             :         DBG_WARNING ("Required properties not found in Chart diagram");
    2532             :     }
    2533             : 
    2534           0 :     Reference< chart2::XCoordinateSystem > xCooSys( lcl_getCooSys(xNewDiagram) );
    2535             : 
    2536             :     // write an axis element also if the axis itself is not visible, but a grid or a title
    2537             : 
    2538           0 :     OUString aCategoriesRange;
    2539           0 :     Reference< chart::XAxisSupplier > xAxisSupp( xDiagram, uno::UNO_QUERY );
    2540             : 
    2541             :     // x axis
    2542             :     // -------
    2543           0 :     Reference< ::com::sun::star::chart2::XAxis > xNewAxis = lcl_getAxis( xCooSys, XML_X );
    2544           0 :     if( xNewAxis.is() )
    2545             :     {
    2546           0 :         Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getAxis(0) : 0, uno::UNO_QUERY );
    2547           0 :         if( mbHasCategoryLabels && bExportContent )
    2548             :         {
    2549           0 :             Reference< chart2::data::XLabeledDataSequence > xCategories( lcl_getCategories( xNewDiagram ) );
    2550           0 :             if( xCategories.is() )
    2551             :             {
    2552           0 :                 Reference< chart2::data::XDataSequence > xValues( xCategories->getValues() );
    2553           0 :                 if( xValues.is() )
    2554             :                 {
    2555           0 :                     Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
    2556           0 :                     maCategoriesRange = xValues->getSourceRangeRepresentation();
    2557           0 :                     aCategoriesRange = lcl_ConvertRange( maCategoriesRange, xNewDoc );
    2558           0 :                 }
    2559           0 :             }
    2560             :         }
    2561           0 :         exportAxis( XML_X, XML_PRIMARY_X, xAxisProps, xNewAxis, aCategoriesRange, bHasXAxisTitle, bHasXAxisMajorGrid, bHasXAxisMinorGrid, bExportContent );
    2562           0 :         aCategoriesRange = OUString();
    2563             :     }
    2564             : 
    2565             :     // secondary x axis
    2566             :     // -------
    2567           0 :     Reference< chart::XSecondAxisTitleSupplier > xSecondTitleSupp( xDiagram, uno::UNO_QUERY );
    2568           0 :     xNewAxis = lcl_getAxis( xCooSys, XML_X, false );
    2569           0 :     if( xNewAxis.is() )
    2570             :     {
    2571           0 :         Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getSecondaryAxis(0) : 0, uno::UNO_QUERY );
    2572           0 :         exportAxis( XML_X, XML_SECONDARY_X, xAxisProps, xNewAxis, aCategoriesRange, bHasSecondaryXAxisTitle, false, false, bExportContent );
    2573             :     }
    2574             : 
    2575             :     // y axis
    2576             :     // -------
    2577           0 :     xNewAxis = lcl_getAxis( xCooSys, XML_Y );
    2578           0 :     if( xNewAxis.is() )
    2579             :     {
    2580           0 :         Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getAxis(1) : 0, uno::UNO_QUERY );
    2581           0 :         exportAxis( XML_Y, XML_PRIMARY_Y, xAxisProps, xNewAxis, aCategoriesRange, bHasYAxisTitle, bHasYAxisMajorGrid, bHasYAxisMinorGrid, bExportContent );
    2582             :     }
    2583             : 
    2584             :     // secondary y axis
    2585             :     // -------
    2586           0 :     xNewAxis = lcl_getAxis( xCooSys, XML_Y, false );
    2587           0 :     if( xNewAxis.is() )
    2588             :     {
    2589           0 :         Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getSecondaryAxis(1) : 0, uno::UNO_QUERY );
    2590           0 :         exportAxis( XML_Y, XML_SECONDARY_Y, xAxisProps, xNewAxis, aCategoriesRange, bHasSecondaryYAxisTitle, false, false, bExportContent );
    2591             :     }
    2592             : 
    2593             :     // z axis
    2594             :     // -------
    2595           0 :     xNewAxis = lcl_getAxis( xCooSys, XML_Z );
    2596           0 :     if( xNewAxis.is() )
    2597             :     {
    2598           0 :         Reference< beans::XPropertySet > xAxisProps( xAxisSupp.is() ? xAxisSupp->getAxis(2) : 0, uno::UNO_QUERY );
    2599           0 :         exportAxis( XML_Z, XML_PRIMARY_Z, xAxisProps, xNewAxis, aCategoriesRange, bHasZAxisTitle, bHasZAxisMajorGrid, bHasZAxisMinorGrid, bExportContent );
    2600           0 :     }
    2601             : }
    2602             : 
    2603             : namespace
    2604             : {
    2605           0 :     bool lcl_hasNoValuesButText( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
    2606             :     {
    2607           0 :         if( !xDataSequence.is() )
    2608           0 :             return false;//have no data
    2609             : 
    2610           0 :         Sequence< uno::Any > aData;
    2611           0 :         Reference< chart2::data::XNumericalDataSequence > xNumericalDataSequence( xDataSequence, uno::UNO_QUERY );
    2612           0 :         if( xNumericalDataSequence.is() )
    2613             :         {
    2614           0 :             Sequence< double >  aDoubles( xNumericalDataSequence->getNumericalData() );
    2615           0 :             sal_Int32 nCount = aDoubles.getLength();
    2616           0 :             for( sal_Int32 i = 0; i < nCount; ++i )
    2617             :             {
    2618           0 :                 if( !::rtl::math::isNan( aDoubles[i] ) )
    2619           0 :                     return false;//have double value
    2620           0 :             }
    2621             :         }
    2622             :         else
    2623             :         {
    2624           0 :             aData = xDataSequence->getData();
    2625           0 :             double fDouble = 0.0;
    2626           0 :             sal_Int32 nCount = aData.getLength();
    2627           0 :             for( sal_Int32 i = 0; i < nCount; ++i )
    2628             :             {
    2629           0 :                 if( (aData[i] >>= fDouble) && !::rtl::math::isNan( fDouble ) )
    2630           0 :                     return false;//have double value
    2631             :             }
    2632             : 
    2633             :         }
    2634             :         //no values found
    2635             : 
    2636           0 :         Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
    2637           0 :         if( xTextualDataSequence.is() )
    2638             :         {
    2639           0 :             uno::Sequence< rtl::OUString > aStrings( xTextualDataSequence->getTextualData() );
    2640           0 :             sal_Int32 nCount = aStrings.getLength();
    2641           0 :             for( sal_Int32 i = 0; i < nCount; ++i )
    2642             :             {
    2643           0 :                 if( !aStrings[i].isEmpty() )
    2644           0 :                     return true;//have text
    2645           0 :             }
    2646             :         }
    2647             :         else
    2648             :         {
    2649           0 :             if( !aData.getLength() )
    2650           0 :                 aData = xDataSequence->getData();
    2651           0 :             uno::Any aAny;
    2652           0 :             OUString aString;
    2653           0 :             sal_Int32 nCount = aData.getLength();
    2654           0 :             for( sal_Int32 i = 0; i < nCount; ++i )
    2655             :             {
    2656           0 :                 if( (aData[i]>>=aString) && !aString.isEmpty() )
    2657           0 :                     return true;//have text
    2658           0 :             }
    2659             :         }
    2660             :         //no doubles and no texts
    2661           0 :         return false;
    2662             :     }
    2663             : }
    2664             : 
    2665           0 : void SchXMLExportHelper_Impl::exportSeries(
    2666             :     const Reference< chart2::XDiagram > & xNewDiagram,
    2667             :     const awt::Size & rPageSize,
    2668             :     sal_Bool bExportContent,
    2669             :     sal_Bool bHasTwoYAxes )
    2670             : {
    2671           0 :     Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xNewDiagram, uno::UNO_QUERY );
    2672           0 :     if( ! xBCooSysCnt.is())
    2673           0 :         return;
    2674           0 :     Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
    2675             : 
    2676           0 :     OUString aFirstXDomainRange;
    2677           0 :     OUString aFirstYDomainRange;
    2678             : 
    2679           0 :     std::vector< XMLPropertyState > aPropertyStates;
    2680             : 
    2681           0 :     const OUString sNumFormat("NumberFormat");
    2682           0 :     const OUString sPercentageNumFormat( "PercentageNumberFormat");
    2683             : 
    2684             :     Sequence< Reference< chart2::XCoordinateSystem > >
    2685           0 :         aCooSysSeq( xBCooSysCnt->getCoordinateSystems());
    2686           0 :     for( sal_Int32 nCSIdx=0; nCSIdx<aCooSysSeq.getLength(); ++nCSIdx )
    2687             :     {
    2688           0 :         Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCSIdx], uno::UNO_QUERY );
    2689           0 :         if( ! xCTCnt.is())
    2690           0 :             continue;
    2691           0 :         Sequence< Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes());
    2692           0 :         for( sal_Int32 nCTIdx=0; nCTIdx<aCTSeq.getLength(); ++nCTIdx )
    2693             :         {
    2694           0 :             Reference< chart2::XDataSeriesContainer > xDSCnt( aCTSeq[nCTIdx], uno::UNO_QUERY );
    2695           0 :             if( ! xDSCnt.is())
    2696           0 :                 continue;
    2697             :             // note: if xDSCnt.is() then also aCTSeq[nCTIdx]
    2698           0 :             OUString aChartType( aCTSeq[nCTIdx]->getChartType());
    2699           0 :             OUString aLabelRole = aCTSeq[nCTIdx]->getRoleOfSequenceForSeriesLabel();
    2700             : 
    2701             :             // special export for stock charts
    2702           0 :             if ( aChartType == "com.sun.star.chart2.CandleStickChartType" )
    2703             :             {
    2704           0 :                 sal_Bool bJapaneseCandleSticks = sal_False;
    2705           0 :                 Reference< beans::XPropertySet > xCTProp( aCTSeq[nCTIdx], uno::UNO_QUERY );
    2706           0 :                 if( xCTProp.is())
    2707           0 :                     xCTProp->getPropertyValue( OUString( "Japanese" )) >>= bJapaneseCandleSticks;
    2708             :                 exportCandleStickSeries(
    2709           0 :                     xDSCnt->getDataSeries(), xNewDiagram, bJapaneseCandleSticks, bExportContent );
    2710           0 :                 continue;
    2711             :             }
    2712             : 
    2713             :             // export dataseries for current chart-type
    2714           0 :             Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
    2715           0 :             for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
    2716             :             {
    2717             :                 // export series
    2718           0 :                 Reference< chart2::data::XDataSource > xSource( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY );
    2719           0 :                 if( xSource.is())
    2720             :                 {
    2721           0 :                     SvXMLElementExport* pSeries = NULL;
    2722             :                     Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
    2723           0 :                         xSource->getDataSequences());
    2724           0 :                     sal_Int32 nMainSequenceIndex = -1;
    2725           0 :                     sal_Int32 nSeriesLength = 0;
    2726           0 :                     sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y;
    2727           0 :                     sal_Bool bHasMeanValueLine = false;
    2728           0 :                     chart::ChartRegressionCurveType eRegressionType( chart::ChartRegressionCurveType_NONE );
    2729           0 :                     Reference< beans::XPropertySet > xPropSet;
    2730           0 :                     tLabelValuesDataPair aSeriesLabelValuesPair;
    2731             : 
    2732             :                     // search for main sequence and create a series element
    2733             :                     {
    2734           0 :                         Reference< chart2::data::XDataSequence > xValuesSeq;
    2735           0 :                         Reference< chart2::data::XDataSequence > xLabelSeq;
    2736           0 :                         sal_Int32 nSeqIdx=0;
    2737           0 :                         for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
    2738             :                         {
    2739           0 :                             OUString aRole;
    2740           0 :                             Reference< chart2::data::XDataSequence > xTempValueSeq( aSeqCnt[nSeqIdx]->getValues() );
    2741           0 :                             if( nMainSequenceIndex==-1 )
    2742             :                             {
    2743           0 :                                 Reference< beans::XPropertySet > xSeqProp( xTempValueSeq, uno::UNO_QUERY );
    2744           0 :                                 if( xSeqProp.is())
    2745           0 :                                     xSeqProp->getPropertyValue(OUString( "Role" )) >>= aRole;
    2746             :                                 // "main" sequence
    2747           0 :                                 if( aRole.equals( aLabelRole ))
    2748             :                                 {
    2749           0 :                                     xValuesSeq.set( xTempValueSeq );
    2750           0 :                                     xLabelSeq.set( aSeqCnt[nSeqIdx]->getLabel());
    2751           0 :                                     nMainSequenceIndex = nSeqIdx;
    2752           0 :                                 }
    2753             :                             }
    2754           0 :                             sal_Int32 nSequenceLength = (xTempValueSeq.is()? xTempValueSeq->getData().getLength() : sal_Int32(0));
    2755           0 :                             if( nSeriesLength < nSequenceLength )
    2756           0 :                                 nSeriesLength = nSequenceLength;
    2757           0 :                         }
    2758             : 
    2759             :                         // have found the main sequence, then xValuesSeq and
    2760             :                         // xLabelSeq contain those.  Otherwise both are empty
    2761             :                         {
    2762             :                             // get property states for autostyles
    2763             :                             try
    2764             :                             {
    2765             :                                 xPropSet = SchXMLSeriesHelper::createOldAPISeriesPropertySet(
    2766           0 :                                     aSeriesSeq[nSeriesIdx], mrExport.GetModel() );
    2767             :                             }
    2768           0 :                             catch( const uno::Exception & rEx )
    2769             :                             {
    2770             :                                 (void)rEx; // avoid warning for pro build
    2771             :                                 OSL_TRACE(
    2772             :                                     OUStringToOString(
    2773             :                                         OUString( "Series not found or no XPropertySet: " ) +
    2774             :                                         rEx.Message,
    2775             :                                         RTL_TEXTENCODING_ASCII_US ).getStr());
    2776           0 :                                 continue;
    2777             :                             }
    2778           0 :                             if( xPropSet.is())
    2779             :                             {
    2780             :                                 // determine attached axis
    2781             :                                 try
    2782             :                                 {
    2783           0 :                                     Any aAny( xPropSet->getPropertyValue(
    2784           0 :                                                   OUString(  "Axis" )));
    2785           0 :                                     aAny >>= nAttachedAxis;
    2786             : 
    2787           0 :                                     aAny = xPropSet->getPropertyValue(
    2788           0 :                                         OUString(  "MeanValue" ));
    2789           0 :                                     aAny >>= bHasMeanValueLine;
    2790             : 
    2791           0 :                                     aAny = xPropSet->getPropertyValue(
    2792           0 :                                         OUString(  "RegressionCurves" ));
    2793           0 :                                     aAny >>= eRegressionType;
    2794             :                                 }
    2795           0 :                                 catch( const beans::UnknownPropertyException & rEx )
    2796             :                                 {
    2797             :                                     (void)rEx; // avoid warning for pro build
    2798             :                                     OSL_TRACE(
    2799             :                                         OUStringToOString(
    2800             :                                             OUString( "Required property not found in DataRowProperties: " ) +
    2801             :                                             rEx.Message,
    2802             :                                             RTL_TEXTENCODING_ASCII_US ).getStr());
    2803             :                                 }
    2804             : 
    2805           0 :                                 const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
    2806           0 :                                 if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
    2807             :                                 {
    2808           0 :                                     lcl_exportNumberFormat( sNumFormat, xPropSet, mrExport );
    2809           0 :                                     lcl_exportNumberFormat( sPercentageNumFormat, xPropSet, mrExport );
    2810             :                                 }
    2811             : 
    2812           0 :                                 if( mxExpPropMapper.is())
    2813           0 :                                     aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    2814             :                             }
    2815             : 
    2816           0 :                             if( bExportContent )
    2817             :                             {
    2818           0 :                                 if( bHasTwoYAxes )
    2819             :                                 {
    2820           0 :                                     if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
    2821           0 :                                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
    2822             :                                     else
    2823           0 :                                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
    2824             :                                 }
    2825             : 
    2826             :                                 // write style name
    2827           0 :                                 AddAutoStyleAttribute( aPropertyStates );
    2828             : 
    2829           0 :                                 if( xValuesSeq.is())
    2830             :                                     mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS,
    2831             :                                                            lcl_ConvertRange(
    2832           0 :                                                                xValuesSeq->getSourceRangeRepresentation(),
    2833           0 :                                                                xNewDoc ));
    2834             :                                 else
    2835             :                                     // #i75297# allow empty series, export empty range to have all ranges on import
    2836           0 :                                     mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, OUString());
    2837             : 
    2838           0 :                                 if( xLabelSeq.is())
    2839             :                                     mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS,
    2840             :                                                            lcl_ConvertRange(
    2841           0 :                                                                xLabelSeq->getSourceRangeRepresentation(),
    2842           0 :                                                                xNewDoc ));
    2843           0 :                                 if( xLabelSeq.is() || xValuesSeq.is() )
    2844           0 :                                     aSeriesLabelValuesPair = tLabelValuesDataPair( xLabelSeq, xValuesSeq );
    2845             : 
    2846             :                                 // chart-type for mixed types
    2847             :                                 enum XMLTokenEnum eCTToken(
    2848           0 :                                     SchXMLTools::getTokenByChartType( aChartType, false /* bUseOldNames */ ));
    2849             :                                 //@todo: get token for current charttype
    2850             :                                 mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS,
    2851           0 :                                                        mrExport.GetNamespaceMap().GetQNameByKey(
    2852           0 :                                                            XML_NAMESPACE_CHART, GetXMLToken( eCTToken )));
    2853             : 
    2854             :                                 // open series element until end of for loop
    2855           0 :                                 pSeries = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
    2856             :                             }
    2857             :                             else    // autostyles
    2858             :                             {
    2859           0 :                                 CollectAutoStyle( aPropertyStates );
    2860             :                             }
    2861             :                             // remove property states for autostyles
    2862           0 :                             aPropertyStates.clear();
    2863           0 :                         }
    2864             :                     }
    2865             : 
    2866             :                     // export domain elements if we have a series parent element
    2867           0 :                     if( pSeries )
    2868             :                     {
    2869             :                         // domain elements
    2870           0 :                         if( bExportContent )
    2871             :                         {
    2872           0 :                             bool bIsScatterChart = aChartType == "com.sun.star.chart2.ScatterChartType";
    2873           0 :                             bool bIsBubbleChart = aChartType == "com.sun.star.chart2.BubbleChartType";
    2874           0 :                             Reference< chart2::data::XDataSequence > xYValuesForBubbleChart;
    2875           0 :                             if( bIsBubbleChart )
    2876             :                             {
    2877           0 :                                 Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, OUString( "values-y" ) ) );
    2878           0 :                                 if( xSequence.is() )
    2879             :                                 {
    2880           0 :                                     xYValuesForBubbleChart = xSequence->getValues();
    2881           0 :                                     if( !lcl_exportDomainForThisSequence( xYValuesForBubbleChart, aFirstYDomainRange, mrExport ) )
    2882           0 :                                         xYValuesForBubbleChart = 0;
    2883           0 :                                 }
    2884             :                             }
    2885           0 :                             if( bIsScatterChart || bIsBubbleChart )
    2886             :                             {
    2887           0 :                                 Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, OUString( "values-x" ) ) );
    2888           0 :                                 if( xSequence.is() )
    2889             :                                 {
    2890           0 :                                     Reference< chart2::data::XDataSequence > xValues( xSequence->getValues() );
    2891           0 :                                     if( lcl_exportDomainForThisSequence( xValues, aFirstXDomainRange, mrExport ) )
    2892             :                                         m_aDataSequencesToExport.push_back( tLabelValuesDataPair(
    2893           0 :                                             (uno::Reference< chart2::data::XDataSequence >)0, xValues ));
    2894             :                                 }
    2895           0 :                                 else if( nSeriesIdx==0 )
    2896             :                                 {
    2897             :                                     //might be that the categories are used as x-values (e.g. for date axis) -> export them accordingly
    2898           0 :                                     Reference< chart2::data::XLabeledDataSequence > xCategories( lcl_getCategories( xNewDiagram ) );
    2899           0 :                                     if( xCategories.is() )
    2900             :                                     {
    2901           0 :                                         Reference< chart2::data::XDataSequence > xValues( xCategories->getValues() );
    2902           0 :                                         if( !lcl_hasNoValuesButText( xValues ) )
    2903           0 :                                             lcl_exportDomainForThisSequence( xValues, aFirstXDomainRange, mrExport );
    2904           0 :                                     }
    2905           0 :                                 }
    2906             :                             }
    2907           0 :                             if( xYValuesForBubbleChart.is() )
    2908             :                                 m_aDataSequencesToExport.push_back( tLabelValuesDataPair(
    2909           0 :                                     (uno::Reference< chart2::data::XDataSequence >)0, xYValuesForBubbleChart ));
    2910             :                         }
    2911             :                     }
    2912             : 
    2913             :                     // add sequences for main sequence after domain sequences,
    2914             :                     // so that the export of the local table has the correct order
    2915           0 :                     if( bExportContent &&
    2916           0 :                         (aSeriesLabelValuesPair.first.is() || aSeriesLabelValuesPair.second.is()))
    2917           0 :                         m_aDataSequencesToExport.push_back( aSeriesLabelValuesPair );
    2918             : 
    2919             :                     // statistical objects:
    2920             :                     // regression curves and mean value lines
    2921           0 :                     if( bHasMeanValueLine &&
    2922           0 :                         xPropSet.is() &&
    2923           0 :                         mxExpPropMapper.is() )
    2924             :                     {
    2925           0 :                         Reference< beans::XPropertySet > xStatProp;
    2926             :                         try
    2927             :                         {
    2928           0 :                             Any aPropAny( xPropSet->getPropertyValue(
    2929           0 :                                             OUString(  "DataMeanValueProperties" )));
    2930           0 :                             aPropAny >>= xStatProp;
    2931             :                         }
    2932           0 :                         catch( const uno::Exception & rEx )
    2933             :                         {
    2934             :                             (void)rEx; // avoid warning for pro build
    2935             :                             OSL_TRACE( "Exception caught during Export of series - optional DataMeanValueProperties not available: %s",
    2936             :                                         OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
    2937             :                         }
    2938             : 
    2939           0 :                         if( xStatProp.is() )
    2940             :                         {
    2941           0 :                             aPropertyStates = mxExpPropMapper->Filter( xStatProp );
    2942             : 
    2943           0 :                             if( !aPropertyStates.empty() )
    2944             :                             {
    2945             :                                 // write element
    2946           0 :                                 if( bExportContent )
    2947             :                                 {
    2948             :                                     // add style name attribute
    2949           0 :                                     AddAutoStyleAttribute( aPropertyStates );
    2950             : 
    2951           0 :                                     SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_MEAN_VALUE, sal_True, sal_True );
    2952             :                                 }
    2953             :                                 else    // autostyles
    2954             :                                 {
    2955           0 :                                     CollectAutoStyle( aPropertyStates );
    2956             :                                 }
    2957             :                             }
    2958           0 :                         }
    2959             :                     }
    2960             : 
    2961           0 :                     if( eRegressionType != chart::ChartRegressionCurveType_NONE &&
    2962           0 :                         xPropSet.is() &&
    2963           0 :                         mxExpPropMapper.is() )
    2964             :                     {
    2965           0 :                         exportRegressionCurve( aSeriesSeq[nSeriesIdx], xPropSet, rPageSize, bExportContent );
    2966             :                     }
    2967             : 
    2968           0 :                     exportErrorBar( xPropSet,false, bExportContent );   // X ErrorBar
    2969           0 :                     exportErrorBar( xPropSet,true, bExportContent );    // Y ErrorBar
    2970             : 
    2971             :                     exportDataPoints(
    2972           0 :                         uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ),
    2973           0 :                         nSeriesLength, xNewDiagram, bExportContent );
    2974             : 
    2975             :                     // close series element
    2976           0 :                     if( pSeries )
    2977           0 :                         delete pSeries;
    2978             :                 }
    2979           0 :             }
    2980           0 :             aPropertyStates.clear();
    2981           0 :         }
    2982           0 :     }
    2983             : }
    2984             : 
    2985           0 : void SchXMLExportHelper_Impl::exportRegressionCurve(
    2986             :     const Reference< chart2::XDataSeries > & xSeries,
    2987             :     const Reference< beans::XPropertySet > & xSeriesProp,
    2988             :     const awt::Size & rPageSize,
    2989             :     sal_Bool bExportContent )
    2990             : {
    2991             :     OSL_ASSERT( mxExpPropMapper.is());
    2992             : 
    2993           0 :     std::vector< XMLPropertyState > aPropertyStates;
    2994           0 :     std::vector< XMLPropertyState > aEquationPropertyStates;
    2995           0 :     Reference< beans::XPropertySet > xStatProp;
    2996             :     try
    2997             :     {
    2998           0 :         Any aPropAny( xSeriesProp->getPropertyValue(
    2999           0 :                           OUString(  "DataRegressionProperties" )));
    3000           0 :         aPropAny >>= xStatProp;
    3001             :     }
    3002           0 :     catch( const uno::Exception & rEx )
    3003             :     {
    3004             :         (void)rEx; // avoid warning for pro build
    3005             :         OSL_TRACE( "Exception caught during Export of series - optional DataRegressionProperties not available: %s",
    3006             :                     OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
    3007             :     }
    3008             : 
    3009           0 :     if( xStatProp.is() )
    3010             :     {
    3011           0 :         Reference< chart2::XRegressionCurve > xRegCurve( SchXMLTools::getRegressionCurve( xSeries ));
    3012           0 :         Reference< beans::XPropertySet > xEquationProperties;
    3013           0 :         if( xRegCurve.is())
    3014           0 :             xEquationProperties.set( xRegCurve->getEquationProperties());
    3015             : 
    3016           0 :         bool bShowEquation = false;
    3017           0 :         bool bShowRSquared = false;
    3018           0 :         bool bExportEquation = false;
    3019           0 :         aPropertyStates = mxExpPropMapper->Filter( xStatProp );
    3020           0 :         if( xEquationProperties.is())
    3021             :         {
    3022           0 :             xEquationProperties->getPropertyValue( OUString(  "ShowEquation" ))
    3023           0 :                 >>= bShowEquation;
    3024           0 :             xEquationProperties->getPropertyValue( OUString(  "ShowCorrelationCoefficient" ))
    3025           0 :                 >>= bShowRSquared;
    3026           0 :             bExportEquation = ( bShowEquation || bShowRSquared );
    3027           0 :             const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
    3028           0 :             if( nCurrentVersion < SvtSaveOptions::ODFVER_012 )
    3029           0 :                 bExportEquation=false;
    3030           0 :             if( bExportEquation )
    3031             :             {
    3032             :                 // number format
    3033           0 :                 sal_Int32 nNumberFormat = 0;
    3034           0 :                 if( ( xEquationProperties->getPropertyValue(
    3035           0 :                           OUString(  "NumberFormat" )) >>= nNumberFormat ) &&
    3036             :                     nNumberFormat != -1 )
    3037             :                 {
    3038           0 :                     mrExport.addDataStyle( nNumberFormat );
    3039             :                 }
    3040           0 :                 aEquationPropertyStates = mxExpPropMapper->Filter( xEquationProperties );
    3041             :             }
    3042             :         }
    3043             : 
    3044           0 :         if( !aPropertyStates.empty() || bExportEquation )
    3045             :         {
    3046             :             // write element
    3047           0 :             if( bExportContent )
    3048             :             {
    3049             :                 // add style name attribute
    3050           0 :                 if( !aPropertyStates.empty())
    3051           0 :                     AddAutoStyleAttribute( aPropertyStates );
    3052           0 :                 SvXMLElementExport aRegressionExport( mrExport, XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, sal_True, sal_True );
    3053           0 :                 if( bExportEquation )
    3054             :                 {
    3055             :                     // default is true
    3056           0 :                     if( !bShowEquation )
    3057           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_EQUATION, XML_FALSE );
    3058             :                     // default is false
    3059           0 :                     if( bShowRSquared )
    3060           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_R_SQUARE, XML_TRUE );
    3061             : 
    3062             :                     // export position
    3063           0 :                     chart2::RelativePosition aRelativePosition;
    3064           0 :                     if( xEquationProperties->getPropertyValue(
    3065           0 :                             OUString( "RelativePosition")) >>= aRelativePosition )
    3066             :                     {
    3067           0 :                         double fX = aRelativePosition.Primary * rPageSize.Width;
    3068           0 :                         double fY = aRelativePosition.Secondary * rPageSize.Height;
    3069           0 :                         awt::Point aPos;
    3070           0 :                         aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( fX ));
    3071           0 :                         aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY ));
    3072           0 :                         addPosition( aPos );
    3073             :                     }
    3074             : 
    3075           0 :                     if( !aEquationPropertyStates.empty())
    3076           0 :                         AddAutoStyleAttribute( aEquationPropertyStates );
    3077             : 
    3078           0 :                     SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_EQUATION, sal_True, sal_True );
    3079           0 :                 }
    3080             :             }
    3081             :             else    // autostyles
    3082             :             {
    3083           0 :                 if( !aPropertyStates.empty())
    3084           0 :                     CollectAutoStyle( aPropertyStates );
    3085           0 :                 if( bExportEquation && !aEquationPropertyStates.empty())
    3086           0 :                     CollectAutoStyle( aEquationPropertyStates );
    3087             :             }
    3088           0 :         }
    3089           0 :     }
    3090           0 : }
    3091             : 
    3092           0 : void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySet> &xSeriesProp,
    3093             :                                               bool bYError, bool bExportContent )
    3094             : {
    3095             :     assert(mxExpPropMapper.is());
    3096             : 
    3097           0 :     const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
    3098             : 
    3099             :     /// Dont export X ErrorBars for older ODF versions.
    3100           0 :     if ( !bYError && nCurrentVersion <= SvtSaveOptions::ODFVER_012 )
    3101           0 :         return;
    3102             : 
    3103           0 :     if (xSeriesProp.is())
    3104             :     {
    3105           0 :         bool bNegative = false, bPositive = false;
    3106           0 :         sal_Int32 nErrorBarStyle = chart::ErrorBarStyle::NONE;
    3107           0 :         Reference< beans::XPropertySet > xErrorBarProp;
    3108             : 
    3109             :         try
    3110             :         {
    3111           0 :             Any aAny;
    3112             : 
    3113           0 :             aAny = xSeriesProp->getPropertyValue( bYError ? rtl::OUString("ErrorBarY") : rtl::OUString("ErrorBarX") );
    3114           0 :             aAny >>= xErrorBarProp;
    3115             : 
    3116           0 :             if ( xErrorBarProp.is() )
    3117             :             {
    3118           0 :                 aAny = xErrorBarProp->getPropertyValue("ShowNegativeError" );
    3119           0 :                 aAny >>= bNegative;
    3120             : 
    3121           0 :                 aAny = xErrorBarProp->getPropertyValue("ShowPositiveError" );
    3122           0 :                 aAny >>= bPositive;
    3123             : 
    3124           0 :                 aAny = xErrorBarProp->getPropertyValue("ErrorBarStyle" );
    3125           0 :                 aAny >>= nErrorBarStyle;
    3126           0 :             }
    3127             :         }
    3128           0 :         catch( const beans::UnknownPropertyException & rEx )
    3129             :         {
    3130             :             (void)rEx; // avoid warning for pro build
    3131             :             OSL_TRACE(
    3132             :                 OUStringToOString(OUString("Required property not found in DataRowProperties: " ) +
    3133             :                     rEx.Message,
    3134             :                     RTL_TEXTENCODING_ASCII_US ).getStr());
    3135             :         }
    3136             : 
    3137           0 :         if( nErrorBarStyle != chart::ErrorBarStyle::NONE && (bNegative || bPositive))
    3138             :         {
    3139           0 :             if( bExportContent && nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA )
    3140             :             {
    3141           0 :                 uno::Reference< chart2::XChartDocument > xNewDoc(mrExport.GetModel(), uno::UNO_QUERY);
    3142             : 
    3143             :                 // register data ranges for error bars for export in local table
    3144             :                 ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences(
    3145           0 :                     lcl_getErrorBarSequences( xErrorBarProp ));
    3146           0 :                 for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt(
    3147           0 :                          aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt )
    3148             :                 {
    3149           0 :                     if ( nCurrentVersion > SvtSaveOptions::ODFVER_012 )
    3150             :                     {
    3151           0 :                         rtl::OUString aRole, aRange;
    3152           0 :                         Reference< beans::XPropertySet > xSeqProp( *aIt, uno::UNO_QUERY_THROW );
    3153           0 :                         xSeqProp->getPropertyValue("Role") >>= aRole;
    3154             : 
    3155           0 :                         aRange = lcl_ConvertRange((*aIt)->getSourceRangeRepresentation(), xNewDoc );
    3156             : 
    3157           0 :                         if ( aRole.indexOf("positive") != -1 )
    3158             :                         {
    3159           0 :                             if ( bPositive )
    3160           0 :                                 mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ERROR_UPPER_RANGE, aRange );
    3161             :                         }
    3162             :                         else
    3163             :                         {
    3164           0 :                             if ( bNegative )
    3165           0 :                                 mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ERROR_LOWER_RANGE, aRange );
    3166           0 :                         }
    3167             :                     }
    3168             : 
    3169             :                     m_aDataSequencesToExport.push_back( tLabelValuesDataPair(
    3170           0 :                         (uno::Reference< chart2::data::XDataSequence >)0, *aIt ));
    3171           0 :                 }
    3172             :             }
    3173             : 
    3174           0 :             std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp );
    3175             : 
    3176           0 :             if( !aPropertyStates.empty() )
    3177             :             {
    3178             :                 // write element
    3179           0 :                 if( bExportContent )
    3180             :                 {
    3181             :                     // add style name attribute
    3182           0 :                     AddAutoStyleAttribute( aPropertyStates );
    3183             : 
    3184           0 :                     if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 )
    3185           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, bYError ? XML_Y : XML_X );//#i114149#
    3186           0 :                     SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True );
    3187             :                 }
    3188             :                 else    // autostyles
    3189             :                 {
    3190           0 :                     CollectAutoStyle( aPropertyStates );
    3191             :                 }
    3192           0 :             }
    3193           0 :         }
    3194             :     }
    3195             : }
    3196             : 
    3197           0 : void SchXMLExportHelper_Impl::exportCandleStickSeries(
    3198             :     const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq,
    3199             :     const Reference< chart2::XDiagram > & xDiagram,
    3200             :     sal_Bool bJapaneseCandleSticks,
    3201             :     sal_Bool bExportContent )
    3202             : {
    3203             : 
    3204           0 :     for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
    3205             :     {
    3206           0 :         Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nSeriesIdx] );
    3207           0 :         sal_Int32 nAttachedAxis = lcl_isSeriesAttachedToFirstAxis( xSeries )
    3208             :             ? chart::ChartAxisAssign::PRIMARY_Y
    3209           0 :             : chart::ChartAxisAssign::SECONDARY_Y;
    3210             : 
    3211           0 :         Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
    3212           0 :         if( xSource.is())
    3213             :         {
    3214             :             // export series in correct order (as we don't store roles)
    3215             :             // with japanese candlesticks: open, low, high, close
    3216             :             // otherwise: low, high, close
    3217             :             Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
    3218           0 :                 xSource->getDataSequences());
    3219             : 
    3220             :             sal_Int32 nSeriesLength =
    3221           0 :                 lcl_getSequenceLengthByRole( aSeqCnt, OUString( "values-last" ));
    3222             : 
    3223           0 :             if( bExportContent )
    3224             :             {
    3225           0 :                 Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
    3226             :                 //@todo: export data points
    3227             : 
    3228             :                 // open
    3229           0 :                 if( bJapaneseCandleSticks )
    3230             :                 {
    3231             :                     tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
    3232           0 :                         aSeqCnt, OUString( "values-first" ),  xNewDoc, m_aDataSequencesToExport ));
    3233           0 :                     if( !aRanges.second.isEmpty())
    3234           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
    3235           0 :                     if( !aRanges.first.isEmpty())
    3236           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
    3237           0 :                     if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
    3238           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
    3239             :                     else
    3240           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
    3241           0 :                     SvXMLElementExport aOpenSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
    3242             :                     // export empty data points
    3243           0 :                     exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
    3244             :                 }
    3245             : 
    3246             :                 // low
    3247             :                 {
    3248             :                     tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
    3249           0 :                         aSeqCnt, OUString( "values-min" ),  xNewDoc, m_aDataSequencesToExport ));
    3250           0 :                     if( !aRanges.second.isEmpty())
    3251           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
    3252           0 :                     if( !aRanges.first.isEmpty())
    3253           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
    3254           0 :                     if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
    3255           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
    3256             :                     else
    3257           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
    3258           0 :                     SvXMLElementExport aLowSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
    3259             :                     // export empty data points
    3260           0 :                     exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
    3261             :                 }
    3262             : 
    3263             :                 // high
    3264             :                 {
    3265             :                     tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
    3266           0 :                         aSeqCnt, OUString( "values-max" ),  xNewDoc, m_aDataSequencesToExport ));
    3267           0 :                     if( !aRanges.second.isEmpty())
    3268           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
    3269           0 :                     if( !aRanges.first.isEmpty())
    3270           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
    3271           0 :                     if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
    3272           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
    3273             :                     else
    3274           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
    3275           0 :                     SvXMLElementExport aHighSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
    3276             :                     // export empty data points
    3277           0 :                     exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
    3278             :                 }
    3279             : 
    3280             :                 // close
    3281             :                 {
    3282             :                     tLabelAndValueRange aRanges( lcl_getLabelAndValueRangeByRole(
    3283           0 :                         aSeqCnt, OUString( "values-last" ),  xNewDoc, m_aDataSequencesToExport ));
    3284           0 :                     if( !aRanges.second.isEmpty())
    3285           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, aRanges.second );
    3286           0 :                     if( !aRanges.first.isEmpty())
    3287           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, aRanges.first );
    3288           0 :                     if( nAttachedAxis == chart::ChartAxisAssign::SECONDARY_Y )
    3289           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_SECONDARY_Y );
    3290             :                     else
    3291           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_PRIMARY_Y );
    3292           0 :                     SvXMLElementExport aCloseSeries( mrExport, XML_NAMESPACE_CHART, XML_SERIES, sal_True, sal_True );
    3293             :                     // export empty data points
    3294           0 :                     exportDataPoints( 0, nSeriesLength, xDiagram, bExportContent );
    3295           0 :                 }
    3296             :             }
    3297             :             else    // autostyles
    3298             :             {
    3299             :                 // for close series
    3300           0 :             }
    3301             :             // remove property states for autostyles
    3302             :         }
    3303           0 :     }
    3304           0 : }
    3305             : 
    3306           0 : void SchXMLExportHelper_Impl::exportDataPoints(
    3307             :     const uno::Reference< beans::XPropertySet > & xSeriesProperties,
    3308             :     sal_Int32 nSeriesLength,
    3309             :     const uno::Reference< chart2::XDiagram > & xDiagram,
    3310             :     sal_Bool bExportContent )
    3311             : {
    3312             :     // data-points
    3313             :     // -----------
    3314             :     // write data-points only if they contain autostyles
    3315             :     // objects with equal autostyles are grouped using the attribute
    3316             :     // repeat="number"
    3317             : 
    3318             :     // Note: if only the nth data-point has autostyles there is an element
    3319             :     // without style and repeat="n-1" attribute written in advance.
    3320             : 
    3321             :     // the sequence aDataPointSeq contains indices of data-points that
    3322             :     // do have own attributes.  This increases the performance substantially.
    3323             : 
    3324             :     // more performant version for #93600#
    3325           0 :     if( mxExpPropMapper.is())
    3326             :     {
    3327           0 :         uno::Reference< chart2::XDataSeries > xSeries( xSeriesProperties, uno::UNO_QUERY );
    3328             : 
    3329           0 :         std::vector< XMLPropertyState > aPropertyStates;
    3330             : 
    3331           0 :         const OUString sNumFormat("NumberFormat");
    3332           0 :         const OUString sPercentageNumFormat( "PercentageNumberFormat");
    3333             : 
    3334           0 :         bool bVaryColorsByPoint = false;
    3335           0 :         Sequence< sal_Int32 > aDataPointSeq;
    3336           0 :         if( xSeriesProperties.is())
    3337             :         {
    3338           0 :             Any aAny = xSeriesProperties->getPropertyValue(
    3339           0 :                 OUString(  "AttributedDataPoints" ));
    3340           0 :             aAny >>= aDataPointSeq;
    3341           0 :             xSeriesProperties->getPropertyValue(
    3342           0 :                 OUString(  "VaryColorsByPoint" )) >>= bVaryColorsByPoint;
    3343             :         }
    3344             : 
    3345             : 
    3346           0 :         sal_Int32 nSize = aDataPointSeq.getLength();
    3347             :         DBG_ASSERT( nSize <= nSeriesLength, "Too many point attributes" );
    3348             : 
    3349           0 :         const sal_Int32 * pPoints = aDataPointSeq.getConstArray();
    3350             :         sal_Int32 nElement;
    3351             :         sal_Int32 nRepeat;
    3352           0 :         Reference< chart2::XColorScheme > xColorScheme;
    3353           0 :         if( xDiagram.is())
    3354           0 :             xColorScheme.set( xDiagram->getDefaultColorScheme());
    3355             : 
    3356           0 :         ::std::list< SchXMLDataPointStruct > aDataPointList;
    3357             : 
    3358           0 :         sal_Int32 nLastIndex = -1;
    3359           0 :         sal_Int32 nCurrIndex = 0;
    3360             : 
    3361             :         // collect elements
    3362           0 :         if( bVaryColorsByPoint && xColorScheme.is() )
    3363             :         {
    3364           0 :             ::std::set< sal_Int32 > aAttrPointSet;
    3365           0 :             ::std::copy( pPoints, pPoints + aDataPointSeq.getLength(),
    3366           0 :                             ::std::inserter( aAttrPointSet, aAttrPointSet.begin()));
    3367           0 :             const ::std::set< sal_Int32 >::const_iterator aEndIt( aAttrPointSet.end());
    3368           0 :             for( nElement = 0; nElement < nSeriesLength; ++nElement )
    3369             :             {
    3370           0 :                 aPropertyStates.clear();
    3371           0 :                 uno::Reference< beans::XPropertySet > xPropSet;
    3372           0 :                 bool bExportNumFmt = false;
    3373           0 :                 if( aAttrPointSet.find( nElement ) != aEndIt )
    3374             :                 {
    3375             :                     try
    3376             :                     {
    3377             :                         xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
    3378           0 :                                     xSeries, nElement, mrExport.GetModel() );
    3379           0 :                         bExportNumFmt = true;
    3380             :                     }
    3381           0 :                     catch( const uno::Exception & rEx )
    3382             :                     {
    3383             :                         (void)rEx; // avoid warning for pro build
    3384             :                         OSL_TRACE( "Exception caught during Export of data point: %s",
    3385             :                                     OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
    3386             :                     }
    3387             :                 }
    3388             :                 else
    3389             :                 {
    3390             :                     // property set only containing the color
    3391             :                     xPropSet.set( new ::xmloff::chart::ColorPropertySet(
    3392           0 :                                         xColorScheme->getColorByIndex( nElement )));
    3393             :                 }
    3394             :                 DBG_ASSERT( xPropSet.is(), "Pie Segments should have properties" );
    3395           0 :                 if( xPropSet.is())
    3396             :                 {
    3397           0 :                     const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
    3398           0 :                     if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 && bExportNumFmt )
    3399             :                     {
    3400           0 :                         lcl_exportNumberFormat( sNumFormat, xPropSet, mrExport );
    3401           0 :                         lcl_exportNumberFormat( sPercentageNumFormat, xPropSet, mrExport );
    3402             :                     }
    3403             : 
    3404           0 :                     aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    3405           0 :                     if( !aPropertyStates.empty() )
    3406             :                     {
    3407           0 :                         if( bExportContent )
    3408             :                         {
    3409             :                             // write data-point with style
    3410             :                             DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
    3411             : 
    3412           0 :                             SchXMLDataPointStruct aPoint;
    3413           0 :                             aPoint.maStyleName = maAutoStyleNameQueue.front();
    3414           0 :                             maAutoStyleNameQueue.pop();
    3415           0 :                             aDataPointList.push_back( aPoint );
    3416             :                         }
    3417             :                         else
    3418             :                         {
    3419           0 :                             CollectAutoStyle( aPropertyStates );
    3420             :                         }
    3421             :                     }
    3422             :                 }
    3423           0 :             }
    3424             :             DBG_ASSERT( !bExportContent || (static_cast<sal_Int32>(aDataPointList.size()) == nSeriesLength),
    3425           0 :                         "not enough data points on content export" );
    3426             :         }
    3427             :         else
    3428             :         {
    3429           0 :             for( nElement = 0; nElement < nSize; ++nElement )
    3430             :             {
    3431           0 :                 aPropertyStates.clear();
    3432           0 :                 nCurrIndex = pPoints[ nElement ];
    3433             :                 //assuming sorted indices in pPoints
    3434             : 
    3435           0 :                 if( nCurrIndex<0 || nCurrIndex>=nSeriesLength )
    3436             :                     break;
    3437             : 
    3438             :                 // write leading empty data points
    3439           0 :                 if( nCurrIndex - nLastIndex > 1 )
    3440             :                 {
    3441           0 :                     SchXMLDataPointStruct aPoint;
    3442           0 :                     aPoint.mnRepeat = nCurrIndex - nLastIndex - 1;
    3443           0 :                     aDataPointList.push_back( aPoint );
    3444             :                 }
    3445             : 
    3446           0 :                 uno::Reference< beans::XPropertySet > xPropSet;
    3447             :                 // get property states
    3448             :                 try
    3449             :                 {
    3450             :                     xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
    3451           0 :                                     xSeries, nCurrIndex, mrExport.GetModel() );
    3452             :                 }
    3453           0 :                 catch( const uno::Exception & rEx )
    3454             :                 {
    3455             :                     (void)rEx; // avoid warning for pro build
    3456             :                     OSL_TRACE( "Exception caught during Export of data point: %s",
    3457             :                                 OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
    3458             :                 }
    3459           0 :                 if( xPropSet.is())
    3460             :                 {
    3461           0 :                     const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
    3462           0 :                     if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 )
    3463             :                     {
    3464           0 :                         lcl_exportNumberFormat( sNumFormat, xPropSet, mrExport );
    3465           0 :                         lcl_exportNumberFormat( sPercentageNumFormat, xPropSet, mrExport );
    3466             :                     }
    3467             : 
    3468           0 :                     aPropertyStates = mxExpPropMapper->Filter( xPropSet );
    3469           0 :                     if( !aPropertyStates.empty() )
    3470             :                     {
    3471           0 :                         if( bExportContent )
    3472             :                         {
    3473             :                             // write data-point with style
    3474             :                             DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
    3475           0 :                             SchXMLDataPointStruct aPoint;
    3476           0 :                             aPoint.maStyleName = maAutoStyleNameQueue.front();
    3477           0 :                             maAutoStyleNameQueue.pop();
    3478             : 
    3479           0 :                             aDataPointList.push_back( aPoint );
    3480           0 :                             nLastIndex = nCurrIndex;
    3481             :                         }
    3482             :                         else
    3483             :                         {
    3484           0 :                             CollectAutoStyle( aPropertyStates );
    3485             :                         }
    3486           0 :                         continue;
    3487             :                     }
    3488             :                 }
    3489             : 
    3490             :                 // if we get here the property states are empty
    3491           0 :                 SchXMLDataPointStruct aPoint;
    3492           0 :                 aDataPointList.push_back( aPoint );
    3493             : 
    3494           0 :                 nLastIndex = nCurrIndex;
    3495           0 :             }
    3496             :             // final empty elements
    3497           0 :             nRepeat = nSeriesLength - nLastIndex - 1;
    3498           0 :             if( nRepeat > 0 )
    3499             :             {
    3500           0 :                 SchXMLDataPointStruct aPoint;
    3501           0 :                 aPoint.mnRepeat = nRepeat;
    3502           0 :                 aDataPointList.push_back( aPoint );
    3503             :             }
    3504             :         }
    3505             : 
    3506           0 :         if( bExportContent )
    3507             :         {
    3508             :             // write elements (merge equal ones)
    3509           0 :             ::std::list< SchXMLDataPointStruct >::iterator aIter = aDataPointList.begin();
    3510           0 :             SchXMLDataPointStruct aPoint;
    3511           0 :             SchXMLDataPointStruct aLastPoint;
    3512             : 
    3513             :             // initialize so that it doesn't matter if
    3514             :             // the element is counted in the first iteration
    3515           0 :             aLastPoint.mnRepeat = 0;
    3516             : 
    3517           0 :             for( ; aIter != aDataPointList.end(); ++aIter )
    3518             :             {
    3519           0 :                 aPoint = (*aIter);
    3520             : 
    3521           0 :                 if( aPoint.maStyleName == aLastPoint.maStyleName )
    3522           0 :                     aPoint.mnRepeat += aLastPoint.mnRepeat;
    3523           0 :                 else if( aLastPoint.mnRepeat > 0 )
    3524             :                 {
    3525             :                     // write last element
    3526           0 :                     if( !aLastPoint.maStyleName.isEmpty() )
    3527           0 :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME, aLastPoint.maStyleName );
    3528             : 
    3529           0 :                     if( aLastPoint.mnRepeat > 1 )
    3530             :                         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
    3531           0 :                                             OUString::valueOf( (sal_Int64)( aLastPoint.mnRepeat ) ));
    3532             : 
    3533           0 :                     SvXMLElementExport aPointElem( mrExport, XML_NAMESPACE_CHART, XML_DATA_POINT, sal_True, sal_True );
    3534             :                 }
    3535           0 :                 aLastPoint = aPoint;
    3536             :             }
    3537             :             // write last element if it hasn't been written in last iteration
    3538           0 :             if( aPoint.maStyleName == aLastPoint.maStyleName )
    3539             :             {
    3540           0 :                 if( !aLastPoint.maStyleName.isEmpty() )
    3541           0 :                     mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME, aLastPoint.maStyleName );
    3542             : 
    3543           0 :                 if( aLastPoint.mnRepeat > 1 )
    3544             :                     mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
    3545           0 :                                         OUString::valueOf( (sal_Int64)( aLastPoint.mnRepeat ) ));
    3546             : 
    3547           0 :                 SvXMLElementExport aPointElem( mrExport, XML_NAMESPACE_CHART, XML_DATA_POINT, sal_True, sal_True );
    3548           0 :             }
    3549           0 :         }
    3550             :     }
    3551           0 : }
    3552             : 
    3553           0 : void SchXMLExportHelper_Impl::addPosition( const awt::Point & rPosition )
    3554             : {
    3555           0 :     mrExport.GetMM100UnitConverter().convertMeasureToXML(
    3556           0 :             msStringBuffer, rPosition.X );
    3557           0 :     msString = msStringBuffer.makeStringAndClear();
    3558           0 :     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, msString );
    3559             : 
    3560           0 :     mrExport.GetMM100UnitConverter().convertMeasureToXML(
    3561           0 :             msStringBuffer, rPosition.Y );
    3562           0 :     msString = msStringBuffer.makeStringAndClear();
    3563           0 :     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, msString );
    3564           0 : }
    3565             : 
    3566           0 : void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape )
    3567             : {
    3568           0 :     if( xShape.is())
    3569           0 :         addPosition( xShape->getPosition());
    3570           0 : }
    3571             : 
    3572           0 : void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize, bool bIsOOoNamespace)
    3573             : {
    3574           0 :     mrExport.GetMM100UnitConverter().convertMeasureToXML(
    3575           0 :             msStringBuffer, rSize.Width );
    3576           0 :     msString = msStringBuffer.makeStringAndClear();
    3577           0 :     mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG , XML_WIDTH,  msString );
    3578             : 
    3579             : 
    3580           0 :     mrExport.GetMM100UnitConverter().convertMeasureToXML(
    3581           0 :             msStringBuffer, rSize.Height);
    3582           0 :     msString = msStringBuffer.makeStringAndClear();
    3583           0 :     mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG, XML_HEIGHT, msString );
    3584           0 : }
    3585             : 
    3586           0 : void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape, bool bIsOOoNamespace )
    3587             : {
    3588           0 :     if( xShape.is())
    3589           0 :         addSize( xShape->getSize(), bIsOOoNamespace );
    3590           0 : }
    3591             : 
    3592           0 : awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const
    3593             : {
    3594           0 :     awt::Size aSize( 8000, 7000 );
    3595           0 :     uno::Reference< embed::XVisualObject > xVisualObject( xChartDoc, uno::UNO_QUERY );
    3596             :     DBG_ASSERT( xVisualObject.is(),"need XVisualObject for page size" );
    3597           0 :     if( xVisualObject.is() )
    3598           0 :         aSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
    3599             : 
    3600           0 :     return aSize;
    3601             : }
    3602             : 
    3603           0 : void SchXMLExportHelper_Impl::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates )
    3604             : {
    3605           0 :     if( !aStates.empty() )
    3606           0 :         maAutoStyleNameQueue.push( GetAutoStylePoolP().Add( XML_STYLE_FAMILY_SCH_CHART_ID, aStates ));
    3607           0 : }
    3608             : 
    3609           0 : void SchXMLExportHelper_Impl::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates )
    3610             : {
    3611           0 :     if( !aStates.empty() )
    3612             :     {
    3613             :         DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
    3614             : 
    3615           0 :         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME,  maAutoStyleNameQueue.front() );
    3616           0 :         maAutoStyleNameQueue.pop();
    3617             :     }
    3618           0 : }
    3619             : 
    3620           0 : void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTabsLFs )
    3621             : {
    3622           0 :     SchXMLTools::exportText( mrExport, rText, bConvertTabsLFs );
    3623           0 : }
    3624             : 
    3625             : // ========================================
    3626             : // class SchXMLExport
    3627             : // ========================================
    3628             : 
    3629             : // #110680#
    3630           0 : SchXMLExport::SchXMLExport(
    3631             :     const Reference< lang::XMultiServiceFactory >& xServiceFactory,
    3632             :     sal_uInt16 nExportFlags )
    3633             : :   SvXMLExport( util::MeasureUnit::CM, xServiceFactory,
    3634             :         ::xmloff::token::XML_CHART, nExportFlags ),
    3635             :     maAutoStylePool( *this ),
    3636           0 :     maExportHelper( *this, maAutoStylePool )
    3637             : {
    3638           0 :     if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
    3639           0 :         _GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
    3640           0 : }
    3641             : 
    3642             : 
    3643           0 : SchXMLExport::~SchXMLExport()
    3644             : {
    3645             :     // stop progress view
    3646           0 :     if( mxStatusIndicator.is())
    3647             :     {
    3648           0 :         mxStatusIndicator->end();
    3649           0 :         mxStatusIndicator->reset();
    3650             :     }
    3651           0 : }
    3652             : 
    3653           0 : sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
    3654             : {
    3655           0 :     Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
    3656           0 :     maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc );
    3657           0 :     return SvXMLExport::exportDoc( eClass );
    3658             : }
    3659             : 
    3660           0 : void SchXMLExport::_ExportStyles( sal_Bool bUsed )
    3661             : {
    3662           0 :     SvXMLExport::_ExportStyles( bUsed );
    3663           0 : }
    3664             : 
    3665           0 : void SchXMLExport::_ExportMasterStyles()
    3666             : {
    3667             :     // not available in chart
    3668             :     DBG_WARNING( "Master Style Export requested. Not available for Chart" );
    3669           0 : }
    3670             : 
    3671           0 : void SchXMLExport::_ExportAutoStyles()
    3672             : {
    3673             :     // there are no styles that require their own autostyles
    3674           0 :     if( getExportFlags() & EXPORT_CONTENT )
    3675             :     {
    3676           0 :         Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
    3677           0 :         if( xChartDoc.is())
    3678             :         {
    3679           0 :             maExportHelper.m_pImpl->collectAutoStyles( xChartDoc );
    3680           0 :             maExportHelper.m_pImpl->exportAutoStyles();
    3681             :         }
    3682             :         else
    3683             :         {
    3684             :             OSL_FAIL( "Couldn't export chart due to wrong XModel (must be XChartDocument)" );
    3685           0 :         }
    3686             :     }
    3687           0 : }
    3688             : 
    3689           0 : void SchXMLExport::_ExportContent()
    3690             : {
    3691           0 :     Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
    3692           0 :     if( xChartDoc.is())
    3693             :     {
    3694             :         // determine if data comes from the outside
    3695           0 :         sal_Bool bIncludeTable = sal_True;
    3696             : 
    3697           0 :         Reference< chart2::XChartDocument > xNewDoc( xChartDoc, uno::UNO_QUERY );
    3698           0 :         if( xNewDoc.is())
    3699             :         {
    3700             :             // check if we have own data.  If so we must not export the complete
    3701             :             // range string, as this is our only indicator for having own or
    3702             :             // external data. @todo: fix this in the file format!
    3703           0 :             Reference< lang::XServiceInfo > xDPServiceInfo( xNewDoc->getDataProvider(), uno::UNO_QUERY );
    3704           0 :             if( ! (xDPServiceInfo.is() && xDPServiceInfo->getImplementationName() == "com.sun.star.comp.chart.InternalDataProvider" ))
    3705             :             {
    3706           0 :                 bIncludeTable = sal_False;
    3707           0 :             }
    3708             :         }
    3709             :         else
    3710             :         {
    3711           0 :             Reference< lang::XServiceInfo > xServ( xChartDoc, uno::UNO_QUERY );
    3712           0 :             if( xServ.is())
    3713             :             {
    3714           0 :                 if( xServ->supportsService(
    3715           0 :                         OUString( "com.sun.star.chart.ChartTableAddressSupplier" )))
    3716             :                 {
    3717           0 :                     Reference< beans::XPropertySet > xProp( xServ, uno::UNO_QUERY );
    3718           0 :                     if( xProp.is())
    3719             :                     {
    3720           0 :                         Any aAny;
    3721             :                         try
    3722             :                         {
    3723           0 :                             OUString sChartAddress;
    3724           0 :                             aAny = xProp->getPropertyValue(
    3725           0 :                                 OUString( "ChartRangeAddress" ));
    3726           0 :                             aAny >>= sChartAddress;
    3727           0 :                             maExportHelper.m_pImpl->SetChartRangeAddress( sChartAddress );
    3728             : 
    3729           0 :                             OUString sTableNumberList;
    3730           0 :                             aAny = xProp->getPropertyValue(
    3731           0 :                                 OUString( "TableNumberList" ));
    3732           0 :                             aAny >>= sTableNumberList;
    3733           0 :                             maExportHelper.m_pImpl->SetTableNumberList( sTableNumberList );
    3734             : 
    3735             :                             // do not include own table if there are external addresses
    3736           0 :                             bIncludeTable = sChartAddress.isEmpty();
    3737             :                         }
    3738           0 :                         catch( const beans::UnknownPropertyException & )
    3739             :                         {
    3740             :                             OSL_FAIL( "Property ChartRangeAddress not supported by ChartDocument" );
    3741           0 :                         }
    3742           0 :                     }
    3743             :                 }
    3744           0 :             }
    3745             :         }
    3746           0 :         maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable );
    3747             :     }
    3748             :     else
    3749             :     {
    3750             :         OSL_FAIL( "Couldn't export chart due to wrong XModel" );
    3751           0 :     }
    3752           0 : }
    3753             : 
    3754           0 : UniReference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const
    3755             : {
    3756           0 :     return maExportHelper.m_pImpl->GetPropertySetMapper();
    3757             : }
    3758             : 
    3759           0 : void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
    3760             : {
    3761           0 :     if( xChartDoc.is())
    3762             :         try
    3763             :         {
    3764           0 :             Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
    3765             :             OSL_ENSURE( xDataProvider.is(), "No DataProvider" );
    3766           0 :             if( xDataProvider.is())
    3767             :             {
    3768           0 :                 Reference< chart2::data::XDataSource > xDataSource( lcl_pressUsedDataIntoRectangularFormat( xChartDoc, mbHasCategoryLabels ));
    3769           0 :                 Sequence< beans::PropertyValue > aArgs( xDataProvider->detectArguments( xDataSource ));
    3770           0 :                 ::rtl::OUString sCellRange, sBrokenRange;
    3771           0 :                 bool bBrokenRangeAvailable = false;
    3772           0 :                 for( sal_Int32 i=0; i<aArgs.getLength(); ++i )
    3773             :                 {
    3774           0 :                     if ( aArgs[i].Name == "CellRangeRepresentation" )
    3775           0 :                         aArgs[i].Value >>= sCellRange;
    3776           0 :                     else if ( aArgs[i].Name == "BrokenCellRangeForExport" )
    3777             :                     {
    3778           0 :                         if( aArgs[i].Value >>= sBrokenRange )
    3779           0 :                             bBrokenRangeAvailable = true;
    3780             :                     }
    3781           0 :                     else if ( aArgs[i].Name == "DataRowSource" )
    3782             :                     {
    3783             :                         chart::ChartDataRowSource eRowSource;
    3784           0 :                         aArgs[i].Value >>= eRowSource;
    3785           0 :                         mbRowSourceColumns = ( eRowSource == chart::ChartDataRowSource_COLUMNS );
    3786             :                     }
    3787           0 :                     else if ( aArgs[i].Name == "FirstCellAsLabel" )
    3788           0 :                         aArgs[i].Value >>= mbHasSeriesLabels;
    3789           0 :                     else if ( aArgs[i].Name == "SequenceMapping" )
    3790           0 :                         aArgs[i].Value >>= maSequenceMapping;
    3791           0 :                     else if ( aArgs[i].Name == "TableNumberList" )
    3792           0 :                         aArgs[i].Value >>= msTableNumberList;
    3793             :                 }
    3794             : 
    3795             :                 // #i79009# For Writer we have to export a broken version of the
    3796             :                 // range, where every row number is noe too large, so that older
    3797             :                 // version can correctly read those files.
    3798           0 :                 msChartAddress = (bBrokenRangeAvailable ? sBrokenRange : sCellRange);
    3799           0 :                 if( !msChartAddress.isEmpty() )
    3800             :                 {
    3801             :                     // convert format to XML-conform one
    3802           0 :                     Reference< chart2::data::XRangeXMLConversion > xConversion( xDataProvider, uno::UNO_QUERY );
    3803           0 :                     if( xConversion.is())
    3804           0 :                         msChartAddress = xConversion->convertRangeToXML( msChartAddress );
    3805           0 :                 }
    3806           0 :             }
    3807             :         }
    3808           0 :         catch( const uno::Exception & ex )
    3809             :         {
    3810             :             (void)ex; // avoid warning for pro build
    3811             :             OSL_FAIL( OUStringToOString(
    3812             :                             OUString(  "Exception caught. Type: " ) +
    3813             :                             OUString::createFromAscii( typeid( ex ).name()) +
    3814             :                             OUString(  ", Message: " ) +
    3815             :                             ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
    3816             :         }
    3817           0 : }
    3818             : 
    3819             : // export components ========================================
    3820             : 
    3821             : // first version: everything goes in one storage
    3822             : 
    3823           0 : Sequence< OUString > SAL_CALL SchXMLExport_getSupportedServiceNames() throw()
    3824             : {
    3825           0 :     const OUString aServiceName(  "com.sun.star.comp.Chart.XMLExporter"  );
    3826           0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
    3827           0 :     return aSeq;
    3828             : }
    3829             : 
    3830           2 : OUString SAL_CALL SchXMLExport_getImplementationName() throw()
    3831             : {
    3832           2 :     return OUString(  "SchXMLExport.Compact"  );
    3833             : }
    3834             : 
    3835           0 : Reference< uno::XInterface > SAL_CALL SchXMLExport_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
    3836             : {
    3837             :     // #110680#
    3838             :     // #103997# removed some flags from EXPORT_ALL
    3839           0 :     return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS ));
    3840             : }
    3841             : 
    3842             : // Oasis format
    3843           0 : Sequence< OUString > SAL_CALL SchXMLExport_Oasis_getSupportedServiceNames() throw()
    3844             : {
    3845           0 :     const OUString aServiceName(  "com.sun.star.comp.Chart.XMLOasisExporter"  );
    3846           0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
    3847           0 :     return aSeq;
    3848             : }
    3849             : 
    3850           2 : OUString SAL_CALL SchXMLExport_Oasis_getImplementationName() throw()
    3851             : {
    3852           2 :     return OUString(  "SchXMLExport.Oasis.Compact"  );
    3853             : }
    3854             : 
    3855           0 : Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
    3856             : {
    3857             :     // #103997# removed some flags from EXPORT_ALL
    3858             :     return (cppu::OWeakObject*)new SchXMLExport( rSMgr,
    3859           0 :         (EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )) | EXPORT_OASIS );
    3860             : }
    3861             : 
    3862             : // ============================================================
    3863             : 
    3864             : // multiple storage version: one for content / styles / meta
    3865             : 
    3866           0 : Sequence< OUString > SAL_CALL SchXMLExport_Styles_getSupportedServiceNames() throw()
    3867             : {
    3868           0 :     const OUString aServiceName(  "com.sun.star.comp.Chart.XMLStylesExporter" );
    3869           0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
    3870           0 :     return aSeq;
    3871             : }
    3872             : 
    3873           2 : OUString SAL_CALL SchXMLExport_Styles_getImplementationName() throw()
    3874             : {
    3875           2 :     return OUString(  "SchXMLExport.Styles" );
    3876             : }
    3877             : 
    3878           0 : Reference< uno::XInterface > SAL_CALL SchXMLExport_Styles_createInstance(const Reference< lang::XMultiServiceFactory >& rSMgr) throw( uno::Exception )
    3879             : {
    3880             :     // #110680#
    3881           0 :     return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES );
    3882             : }
    3883             : 
    3884             : // Oasis format
    3885           0 : Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Styles_getSupportedServiceNames() throw()
    3886             : {
    3887           0 :     const OUString aServiceName(  "com.sun.star.comp.Chart.XMLOasisStylesExporter" );
    3888           0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
    3889           0 :     return aSeq;
    3890             : }
    3891             : 
    3892           2 : OUString SAL_CALL SchXMLExport_Oasis_Styles_getImplementationName() throw()
    3893             : {
    3894           2 :     return OUString(  "SchXMLExport.Oasis.Styles" );
    3895             : }
    3896             : 
    3897           0 : Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
    3898             : {
    3899           0 :     return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES | EXPORT_OASIS );
    3900             : }
    3901             : 
    3902             : // ------------------------------------------------------------
    3903             : 
    3904           0 : Sequence< OUString > SAL_CALL SchXMLExport_Content_getSupportedServiceNames() throw()
    3905             : {
    3906           0 :     const OUString aServiceName(  "com.sun.star.comp.Chart.XMLContentExporter" );
    3907           0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
    3908           0 :     return aSeq;
    3909             : }
    3910             : 
    3911           2 : OUString SAL_CALL SchXMLExport_Content_getImplementationName() throw()
    3912             : {
    3913           2 :     return OUString(  "SchXMLExport.Content" );
    3914             : }
    3915             : 
    3916           0 : Reference< uno::XInterface > SAL_CALL SchXMLExport_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
    3917             : {
    3918             :     // #110680#
    3919           0 :     return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS );
    3920             : }
    3921             : 
    3922             : // Oasis format
    3923           0 : Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Content_getSupportedServiceNames() throw()
    3924             : {
    3925           0 :     const OUString aServiceName(  "com.sun.star.comp.Chart.XMLOasisContentExporter" );
    3926           0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
    3927           0 :     return aSeq;
    3928             : }
    3929             : 
    3930           2 : OUString SAL_CALL SchXMLExport_Oasis_Content_getImplementationName() throw()
    3931             : {
    3932           2 :     return OUString(  "SchXMLExport.Oasis.Content" );
    3933             : }
    3934             : 
    3935           0 : Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
    3936             : {
    3937           0 :     return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS );
    3938             : }
    3939             : 
    3940             : // ------------------------------------------------------------
    3941             : 
    3942             : // Oasis format
    3943           0 : Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Meta_getSupportedServiceNames() throw()
    3944             : {
    3945           0 :     const OUString aServiceName(  "com.sun.star.comp.Chart.XMLOasisMetaExporter" );
    3946           0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
    3947           0 :     return aSeq;
    3948             : }
    3949             : 
    3950           2 : OUString SAL_CALL SchXMLExport_Oasis_Meta_getImplementationName() throw()
    3951             : {
    3952           2 :     return OUString(  "SchXMLExport.Oasis.Meta" );
    3953             : }
    3954             : 
    3955           0 : Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Meta_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
    3956             : {
    3957           0 :     return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_META | EXPORT_OASIS  );
    3958             : }
    3959             : 
    3960             : 
    3961             : // XServiceInfo
    3962           0 : OUString SAL_CALL SchXMLExport::getImplementationName() throw( uno::RuntimeException )
    3963             : {
    3964           0 :     switch( getExportFlags())
    3965             :     {
    3966             :         case EXPORT_ALL:
    3967           0 :             return SchXMLExport_getImplementationName();
    3968             :         case EXPORT_STYLES:
    3969           0 :             return SchXMLExport_Styles_getImplementationName();
    3970             :         case ( EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS ):
    3971           0 :             return SchXMLExport_Content_getImplementationName();
    3972             : 
    3973             :         // Oasis format
    3974             :         case ( EXPORT_ALL | EXPORT_OASIS ):
    3975           0 :             return SchXMLExport_Oasis_getImplementationName();
    3976             :         case ( EXPORT_STYLES | EXPORT_OASIS ):
    3977           0 :             return SchXMLExport_Oasis_Styles_getImplementationName();
    3978             :         case ( EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS  ):
    3979           0 :             return SchXMLExport_Oasis_Content_getImplementationName();
    3980             :         case ( EXPORT_META | EXPORT_OASIS ):
    3981           0 :             return SchXMLExport_Oasis_Meta_getImplementationName();
    3982             : 
    3983             :         case EXPORT_SETTINGS:
    3984             :         // there is no settings component in chart
    3985             :         default:
    3986           0 :             return OUString( "SchXMLExport" );
    3987             :     }
    3988             : }
    3989             : 
    3990             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10