View | Details | Raw Unified | Return to issue 115820
Collapse All | Expand All

(-)chart2/source/inc/InternalData.hxx (+4 lines)
Lines 37-42 Link Here
37
    InternalData();
37
    InternalData();
38
38
39
    void createDefaultData();
39
    void createDefaultData();
40
	////for chart in pptx
41
	bool isDefaultData();
42
	void clearDefaultData();
43
	////for chart in pptx
40
44
41
    void setData( const ::com::sun::star::uno::Sequence<
45
    void setData( const ::com::sun::star::uno::Sequence<
42
        ::com::sun::star::uno::Sequence< double > > & rDataInRows );
46
        ::com::sun::star::uno::Sequence< double > > & rDataInRows );
(-)chart2/source/inc/InternalDataProvider.hxx (+9 lines)
Lines 134-139 Link Here
134
        const ::rtl::OUString& aRangeRepresentation )
134
        const ::rtl::OUString& aRangeRepresentation )
135
        throw (::com::sun::star::lang::IllegalArgumentException,
135
        throw (::com::sun::star::lang::IllegalArgumentException,
136
               ::com::sun::star::uno::RuntimeException);
136
               ::com::sun::star::uno::RuntimeException);
137
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >  SAL_CALL createDataSequenceByRangeRepresentationAndRole(
138
        const ::rtl::OUString& aRangeRepresentation ,const ::sal_Bool bCatogory )
139
        throw (::com::sun::star::lang::IllegalArgumentException,
140
               ::com::sun::star::uno::RuntimeException);
137
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection()
141
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection()
138
        throw (::com::sun::star::uno::RuntimeException);
142
        throw (::com::sun::star::uno::RuntimeException);
139
143
Lines 228-233 Link Here
228
                                       const ::rtl::OUString & rRole );
232
                                       const ::rtl::OUString & rRole );
229
    ::com::sun::star::uno::Reference<
233
    ::com::sun::star::uno::Reference<
230
            ::com::sun::star::chart2::data::XDataSequence >
234
            ::com::sun::star::chart2::data::XDataSequence >
235
        lcl_createDataSequenceAndAddToMapByRole( const ::rtl::OUString & rRangeRepresentation,
236
                                       const ::sal_Bool bCategory);
237
									   
238
    ::com::sun::star::uno::Reference<
239
            ::com::sun::star::chart2::data::XDataSequence >
231
        lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation );
240
        lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation );
232
241
233
    void lcl_deleteMapReferences( const ::rtl::OUString & rRangeRepresentation );
242
    void lcl_deleteMapReferences( const ::rtl::OUString & rRangeRepresentation );
(-)chart2/source/tools/InternalData.cxx (-8 / +33 lines)
Lines 30-36 Link Here
30
#include "macros.hxx"
30
#include "macros.hxx"
31
31
32
#include <rtl/math.hxx>
32
#include <rtl/math.hxx>
33
33
#include <algorithm>
34
using ::com::sun::star::uno::Sequence;
34
using ::com::sun::star::uno::Sequence;
35
using ::rtl::OUString;
35
using ::rtl::OUString;
36
36
Lines 84-89 Link Here
84
    , m_aRowLabels( 0 )
84
    , m_aRowLabels( 0 )
85
    , m_aColumnLabels( 0 )
85
    , m_aColumnLabels( 0 )
86
{}
86
{}
87
static const double fDefaultData[] = {
88
    9.10, 3.20, 4.54,
89
    2.40, 8.80, 9.65,
90
    3.10, 1.50, 3.70,
91
    4.30, 9.02, 6.20
92
};
87
93
88
void InternalData::createDefaultData()
94
void InternalData::createDefaultData()
89
{
95
{
Lines 96-108 Link Here
96
    // @todo: localize this!
102
    // @todo: localize this!
97
    const OUString aRowName( ::chart::SchResId::getResString( STR_ROW_LABEL ));
103
    const OUString aRowName( ::chart::SchResId::getResString( STR_ROW_LABEL ));
98
    const OUString aColName( ::chart::SchResId::getResString( STR_COLUMN_LABEL ));
104
    const OUString aColName( ::chart::SchResId::getResString( STR_COLUMN_LABEL ));
99
105
	
100
    const double fDefaultData[ nSize ] =
101
        { 9.10, 3.20, 4.54,
102
          2.40, 8.80, 9.65,
103
          3.10, 1.50, 3.70,
104
          4.30, 9.02, 6.20 };
105
106
    m_aData.resize( nSize );
106
    m_aData.resize( nSize );
107
    for( sal_Int32 i=0; i<nSize; ++i )
107
    for( sal_Int32 i=0; i<nSize; ++i )
108
        m_aData[i] = fDefaultData[i];
108
        m_aData[i] = fDefaultData[i];
Lines 118-123 Link Here
118
        lcl_NumberedStringGenerator( aColName, C2U("%COLUMNNUMBER") ));
118
        lcl_NumberedStringGenerator( aColName, C2U("%COLUMNNUMBER") ));
119
}
119
}
120
120
121
bool InternalData::isDefaultData()
122
{
123
124
    if( m_nRowCount == 4 && m_nColumnCount == 3 )
125
    {
126
        for( sal_Int32 i=0; i<(4*3); ++i )
127
            if( m_aData[i] != fDefaultData[i] )
128
                return false;
129
130
        return true;
131
    }
132
    return false;
133
}
134
135
void InternalData::clearDefaultData()
136
{
137
    if( isDefaultData() )
138
    {
139
        m_nRowCount = m_nColumnCount = 1;
140
        m_aData.resize( 1 );
141
        m_aRowLabels.clear();
142
        m_aColumnLabels.clear();
143
    }
144
}
145
121
void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
146
void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
122
{
147
{
123
    m_nRowCount = rDataInRows.getLength();
148
    m_nRowCount = rDataInRows.getLength();
(-)chart2/source/tools/InternalDataProvider.cxx (-5 / +144 lines)
Lines 293-300 Link Here
293
            rVector.resize( m_nLevel );
293
            rVector.resize( m_nLevel );
294
294
295
        vector< uno::Any >::iterator aIt( rVector.begin() );
295
        vector< uno::Any >::iterator aIt( rVector.begin() );
296
        for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
296
        for( sal_Int32 nN=1; aIt<rVector.end(); aIt++, nN++)
297
        {
297
		{
298
            if( nN==m_nLevel )
298
            if( nN==m_nLevel )
299
                break;
299
                break;
300
        }
300
        }
Lines 315-322 Link Here
315
    void operator() ( vector< uno::Any >& rVector )
315
    void operator() ( vector< uno::Any >& rVector )
316
    {
316
    {
317
        vector< uno::Any >::iterator aIt( rVector.begin() );
317
        vector< uno::Any >::iterator aIt( rVector.begin() );
318
        for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
318
        for( sal_Int32 nN=1; aIt<rVector.end(); aIt++, nN++)
319
        {
319
		{
320
            if( nN==m_nLevel )
320
            if( nN==m_nLevel )
321
            {
321
            {
322
                rVector.erase( aIt );
322
                rVector.erase( aIt );
Lines 513-518 Link Here
513
    return xSeq;
513
    return xSeq;
514
}
514
}
515
515
516
Reference< chart2::data::XDataSequence > InternalDataProvider::lcl_createDataSequenceAndAddToMapByRole(
517
    const OUString & rRangeRepresentation ,const sal_Bool bCategory)
518
{
519
    OUString aRangeRepresentation = rRangeRepresentation;
520
    if( aRangeRepresentation.indexOf('{') >= 0 )
521
    {
522
        ::std::vector< double > aNewData;
523
        ::std::vector< uno::Any > aNewLabels;
524
        OUString    aToken;
525
        sal_Int32   nCategories     = 0;
526
        sal_Int32   nIndex          = 0;
527
        bool        bValues         = true;
528
        bool        bLabelSet       = false;
529
530
        OUString str = aRangeRepresentation.replace('{',' ').replace('}',' ');
531
532
        m_aInternalData.clearDefaultData();
533
        sal_Int32 n = m_aInternalData.getColumnCount();
534
535
        if( n )
536
            n = n - 1;
537
538
        do
539
        {
540
            // TODO: This will be problematic if ';' is used in label names
541
            // '"' character also needs to be considered in such cases
542
            aToken = str.getToken(0,';',nIndex);
543
            if( !aToken.getLength() )
544
                break;
545
			if( aToken.indexOf('"') < 0 )
546
			{
547
				if( !bCategory )
548
					aNewData.push_back( aToken.toDouble() );
549
				else
550
				{
551
					aNewLabels.push_back( uno::makeAny(aToken.toDouble()) );
552
					if( !nCategories &&
553
                   ( !m_aInternalData.getComplexColumnLabel(n).size() ||
554
                     !m_aInternalData.getComplexColumnLabel(n).front().hasValue() ) )
555
					{
556
						m_aInternalData.setComplexColumnLabel( n,  aNewLabels );
557
						bLabelSet = true;
558
					}
559
					else
560
					{
561
						m_aInternalData.setComplexRowLabel(nCategories, aNewLabels);
562
						if(nCategories==1 && bLabelSet)
563
						{
564
							::std::vector< uno::Any > aLabels;
565
							m_aInternalData.setComplexRowLabel( 0, m_aInternalData.getComplexColumnLabel( n ) );
566
							m_aInternalData.setComplexColumnLabel( n, aLabels );
567
						}
568
					}
569
					aNewLabels.pop_back();
570
					nCategories++;
571
					bValues = false;
572
				}
573
			}
574
            else
575
            {  
576
				aNewLabels.push_back( uno::makeAny(aToken.replace('"', ' ').trim()) );
577
                
578
				if( !nCategories &&
579
                   ( !m_aInternalData.getComplexColumnLabel(n).size() ||
580
                     !m_aInternalData.getComplexColumnLabel(n).front().hasValue() ) )
581
                {
582
                    m_aInternalData.setComplexColumnLabel( n,  aNewLabels );
583
                    bLabelSet = true;
584
                }
585
                else
586
                {
587
                    m_aInternalData.setComplexRowLabel(nCategories, aNewLabels);
588
                    if(nCategories==1 && bLabelSet)
589
                    {
590
                        ::std::vector< uno::Any > aLabels;
591
                        m_aInternalData.setComplexRowLabel( 0, m_aInternalData.getComplexColumnLabel( n ) );
592
                        m_aInternalData.setComplexColumnLabel( n, aLabels );
593
                    }
594
                }
595
                aNewLabels.pop_back();
596
                nCategories++;
597
                bValues = false;
598
            }
599
        } while( nIndex >= 0 );
600
601
        if( bValues )
602
        {
603
            m_aInternalData.insertColumn( n );
604
            m_aInternalData.setColumnValues( n, aNewData );
605
            aRangeRepresentation = OUString::valueOf( n );
606
        }
607
        else if( nCategories > 1 )
608
        {
609
            aRangeRepresentation = lcl_aCategoriesRangeName;
610
        }
611
        else
612
        {
613
            aRangeRepresentation = lcl_aLabelRangePrefix+OUString::valueOf( n );
614
        }
615
    }
616
617
    Reference< chart2::data::XDataSequence > xSeq(
618
        new UncachedDataSequence( this, aRangeRepresentation ));
619
    lcl_addDataSequenceToMap( aRangeRepresentation, xSeq );
620
    return xSeq;
621
}
622
////
516
Reference< chart2::data::XDataSequence > InternalDataProvider::lcl_createDataSequenceAndAddToMap(
623
Reference< chart2::data::XDataSequence > InternalDataProvider::lcl_createDataSequenceAndAddToMap(
517
    const OUString & rRangeRepresentation,
624
    const OUString & rRangeRepresentation,
518
    const OUString & rRole )
625
    const OUString & rRole )
Lines 676-681 Link Here
676
    return true;
783
    return true;
677
}
784
}
678
785
786
Reference< chart2::data::XDataSequence > InternalDataProvider::createDataSequenceByRangeRepresentationAndRole(
787
	const OUString& aRangeRepresentation ,const sal_Bool bCatogory )
788
{
789
	 if( aRangeRepresentation.match( lcl_aCategoriesRangeName ))
790
    {
791
        OSL_ASSERT( aRangeRepresentation.equals( lcl_aCategoriesRangeName ) );//it is not expected nor implmented that only parts of the categories are really requested
792
793
        // categories
794
        return lcl_createDataSequenceAndAddToMap( lcl_aCategoriesRangeName, lcl_aCategoriesRoleName );
795
    }
796
    else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
797
    {
798
        // label
799
        sal_Int32 nIndex = aRangeRepresentation.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
800
        return lcl_createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + OUString::valueOf( nIndex ));
801
    }
802
    else if( aRangeRepresentation.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "last" )))
803
    {
804
        sal_Int32 nIndex = (m_bDataInColumns
805
                            ? m_aInternalData.getColumnCount()
806
                            : m_aInternalData.getRowCount()) - 1;
807
        return lcl_createDataSequenceAndAddToMap( OUString::valueOf( nIndex ));
808
    }
809
    else if( aRangeRepresentation.getLength())
810
    {
811
		return lcl_createDataSequenceAndAddToMapByRole( aRangeRepresentation ,bCatogory );
812
	}
813
	
814
	return Reference< chart2::data::XDataSequence >();
815
}
816
817
679
Reference< chart2::data::XDataSequence > SAL_CALL InternalDataProvider::createDataSequenceByRangeRepresentation(
818
Reference< chart2::data::XDataSequence > SAL_CALL InternalDataProvider::createDataSequenceByRangeRepresentation(
680
    const OUString& aRangeRepresentation )
819
    const OUString& aRangeRepresentation )
681
    throw (lang::IllegalArgumentException,
820
    throw (lang::IllegalArgumentException,
Lines 706-713 Link Here
706
        // data
845
        // data
707
        sal_Int32 nIndex = aRangeRepresentation.toInt32();
846
        sal_Int32 nIndex = aRangeRepresentation.toInt32();
708
        return lcl_createDataSequenceAndAddToMap( OUString::valueOf( nIndex ));
847
        return lcl_createDataSequenceAndAddToMap( OUString::valueOf( nIndex ));
848
709
    }
849
    }
710
711
    return Reference< chart2::data::XDataSequence >();
850
    return Reference< chart2::data::XDataSequence >();
712
}
851
}
713
852
(-)dbaccess/source/core/inc/DatabaseDataProvider.hxx (+3 lines)
Lines 86-91 Link Here
86
    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments(const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > & xDataSource) throw (::com::sun::star::uno::RuntimeException);
86
    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments(const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > & xDataSource) throw (::com::sun::star::uno::RuntimeException);
87
    virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const ::rtl::OUString & aRangeRepresentation) throw (::com::sun::star::uno::RuntimeException);
87
    virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const ::rtl::OUString & aRangeRepresentation) throw (::com::sun::star::uno::RuntimeException);
88
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const ::rtl::OUString & aRangeRepresentation) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
88
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const ::rtl::OUString & aRangeRepresentation) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
89
    ////
90
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentationAndRole(const ::rtl::OUString & aRangeRepresentation ,sal_Bool bCategory) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
91
    ////
89
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection() throw (::com::sun::star::uno::RuntimeException);
92
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection() throw (::com::sun::star::uno::RuntimeException);
90
93
91
    // ::com::sun::star::chart2::data::XRangeXMLConversion:
94
    // ::com::sun::star::chart2::data::XRangeXMLConversion:
(-)dbaccess/source/core/misc/DatabaseDataProvider.cxx (-1 / +6 lines)
Lines 314-320 Link Here
314
    }
314
    }
315
    return xData;
315
    return xData;
316
}
316
}
317
317
////
318
uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentationAndRole(const ::rtl::OUString & _sRangeRepresentation,sal_Bool bCategory) throw (uno::RuntimeException, lang::IllegalArgumentException)
319
{
320
    return 0;
321
}
322
////
318
uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException)
323
uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException)
319
{
324
{
320
    return m_xComplexDescriptionAccess->getComplexRowDescriptions();
325
    return m_xComplexDescriptionAccess->getComplexRowDescriptions();
(-)offapi/com/sun/star/chart2/data/XDataProvider.idl (-1 / +5 lines)
Lines 132-138 Link Here
132
    XDataSequence createDataSequenceByRangeRepresentation(
132
    XDataSequence createDataSequenceByRangeRepresentation(
133
        [in] string aRangeRepresentation )
133
        [in] string aRangeRepresentation )
134
        raises( com::sun::star::lang::IllegalArgumentException );
134
        raises( com::sun::star::lang::IllegalArgumentException );
135
135
    ////
136
    XDataSequence createDataSequenceByRangeRepresentationAndRole(
137
        [in] string aRangeRepresentation ,[in] boolean bCategory )
138
        raises( com::sun::star::lang::IllegalArgumentException );
139
    ////
136
    /** Returns a component that is able to change a given range
140
    /** Returns a component that is able to change a given range
137
        representation to another one.  This usually is a
141
        representation to another one.  This usually is a
138
        controller-component that uses the GUI to allow a user to
142
        controller-component that uses the GUI to allow a user to
(-)oox/inc/oox/drawingml/chart/datasourcemodel.hxx (+3 lines)
Lines 41-46 Link Here
41
    ::rtl::OUString     maFormula;          /// Formula reference, e.g. into a spreadsheet.
41
    ::rtl::OUString     maFormula;          /// Formula reference, e.g. into a spreadsheet.
42
    ::rtl::OUString     maFormatCode;       /// Number format for double values.
42
    ::rtl::OUString     maFormatCode;       /// Number format for double values.
43
    sal_Int32           mnPointCount;       /// Number of points in this series source.
43
    sal_Int32           mnPointCount;       /// Number of points in this series source.
44
    ////
45
    sal_Bool			mbCategory;			/// bool double values as category
46
    ////
44
47
45
    explicit            DataSequenceModel();
48
    explicit            DataSequenceModel();
46
                        ~DataSequenceModel();
49
                        ~DataSequenceModel();
(-)oox/source/drawingml/chart/chartconverter.cxx (-1 / +80 lines)
Lines 26-32 Link Here
26
#include <com/sun/star/chart2/XChartDocument.hpp>
26
#include <com/sun/star/chart2/XChartDocument.hpp>
27
#include "oox/drawingml/chart/chartspaceconverter.hxx"
27
#include "oox/drawingml/chart/chartspaceconverter.hxx"
28
#include "oox/drawingml/chart/chartspacemodel.hxx"
28
#include "oox/drawingml/chart/chartspacemodel.hxx"
29
#include "oox/helper/containerhelper.hxx"
30
#include "oox/core/xmlfilterbase.hxx"
29
31
32
using ::oox::drawingml::chart::DataSequenceModel;
33
using ::com::sun::star::uno::Any;
34
using ::rtl::OUStringBuffer;
35
30
namespace oox {
36
namespace oox {
31
namespace drawingml {
37
namespace drawingml {
32
namespace chart {
38
namespace chart {
Lines 42-47 Link Here
42
using ::oox::core::XmlFilterBase;
48
using ::oox::core::XmlFilterBase;
43
using ::rtl::OUString;
49
using ::rtl::OUString;
44
50
51
52
static const sal_Unicode API_TOKEN_ARRAY_OPEN      = '{';
53
static const sal_Unicode API_TOKEN_ARRAY_CLOSE     = '}';
54
static const sal_Unicode API_TOKEN_ARRAY_ROWSEP    = '|';
55
static const sal_Unicode API_TOKEN_ARRAY_COLSEP    = ';';
56
57
// Code similar to oox/source/xls/formulabase.cxx
58
static OUString lclGenerateApiString( const OUString& rString )
59
{
60
    OUString aRetString = rString;
61
    sal_Int32 nQuotePos = aRetString.getLength();
62
    while( (nQuotePos = aRetString.lastIndexOf( '"', nQuotePos )) >= 0 )
63
        aRetString = aRetString.replaceAt( nQuotePos, 1, CREATE_OUSTRING( "\"\"" ) );
64
    return OUStringBuffer().append( sal_Unicode( '"' ) ).append( aRetString ).append( sal_Unicode( '"' ) ).makeStringAndClear();
65
}
66
67
static ::rtl::OUString lclGenerateApiArray( const Matrix< Any >& rMatrix )
68
{
69
    OSL_ENSURE( !rMatrix.empty(), "ChartConverter::lclGenerateApiArray - missing matrix values" );
70
    OUStringBuffer aBuffer;
71
    aBuffer.append( API_TOKEN_ARRAY_OPEN );
72
    for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow )
73
    {
74
        if( nRow > 0 )
75
            aBuffer.append( API_TOKEN_ARRAY_ROWSEP );
76
        for( Matrix< Any >::const_iterator aBeg = rMatrix.row_begin( nRow ), aIt = aBeg, aEnd = rMatrix.row_end( nRow ); aIt != aEnd; ++aIt )
77
        {
78
            double fValue = 0.0;
79
            ::rtl::OUString aString;
80
            if( aIt != aBeg )
81
                aBuffer.append( API_TOKEN_ARRAY_COLSEP );
82
            if( *aIt >>= fValue )
83
                aBuffer.append( fValue );
84
            else if( *aIt >>= aString )
85
                aBuffer.append( lclGenerateApiString( aString ) );
86
            else
87
                aBuffer.appendAscii( "\"\"" );
88
        }
89
    }
90
    aBuffer.append( API_TOKEN_ARRAY_CLOSE );
91
    return aBuffer.makeStringAndClear();
92
}
93
94
45
// ============================================================================
95
// ============================================================================
46
96
47
ChartConverter::ChartConverter()
97
ChartConverter::ChartConverter()
Lines 77-84 Link Here
77
    }
127
    }
78
}
128
}
79
129
80
Reference< XDataSequence > ChartConverter::createDataSequence( const Reference< XDataProvider >&, const DataSequenceModel& )
130
Reference< XDataSequence > ChartConverter::createDataSequence( const Reference< XDataProvider >& rxDataProvider, const DataSequenceModel& rDataSeq )
81
{
131
{
132
	Reference< XDataSequence > xDataSeq;
133
    if( rxDataProvider.is() )
134
    {
135
        ::rtl::OUString aRangeRep;
136
		sal_Bool bCategory = false;
137
        if( !rDataSeq.maData.empty() )
138
        {
139
            // create a single-row array from constant source data
140
            Matrix< Any > aMatrix( rDataSeq.maData.size(), 1 );
141
            Matrix< Any >::iterator aMIt = aMatrix.begin();
142
            // TODO: how to handle missing values in the map?
143
            for( DataSequenceModel::AnyMap::const_iterator aDIt = rDataSeq.maData.begin(), aDEnd = rDataSeq.maData.end(); aDIt != aDEnd; ++aDIt, ++aMIt )
144
                *aMIt = aDIt->second;
145
            aRangeRep = lclGenerateApiArray( aMatrix );
146
			bCategory = rDataSeq.mbCategory;
147
        }
148
		
149
        if( aRangeRep.getLength() > 0 ) try
150
        {
151
            // create the data sequence
152
            xDataSeq = rxDataProvider->createDataSequenceByRangeRepresentationAndRole( aRangeRep , bCategory );
153
            return xDataSeq;
154
        }
155
        catch( Exception& )
156
        {
157
            OSL_ENSURE( sal_False , "ChartConverter::createDataSequence - cannot create data sequence" );
158
        }
159
    }
160
82
    return 0;
161
    return 0;
83
}
162
}
84
163
(-)oox/source/drawingml/chart/datasourcecontext.cxx (+6 lines)
Lines 99-104 Link Here
99
        case C_TOKEN( v ):
99
        case C_TOKEN( v ):
100
            if( mnPtIndex >= 0 )
100
            if( mnPtIndex >= 0 )
101
                mrModel.maData[ mnPtIndex ] <<= rChars.toDouble();
101
                mrModel.maData[ mnPtIndex ] <<= rChars.toDouble();
102
            if( isParentElement( C_TOKEN( cat ), 4 ) ||
103
                   isParentElement( C_TOKEN( xVal ), 4 ) )
104
                mrModel.mbCategory = true;
105
            else
106
                mrModel.mbCategory = false;
107
                
102
        break;
108
        break;
103
    }
109
    }
104
}
110
}
(-)sc/inc/chart2uno.hxx (+4 lines)
Lines 104-109 Link Here
104
        ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(
104
        ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(
105
            const ::rtl::OUString& aRangeRepresentation )
105
            const ::rtl::OUString& aRangeRepresentation )
106
            throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
106
            throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
107
    virtual ::com::sun::star::uno::Reference<
108
        ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentationAndRole(
109
            const ::rtl::OUString& aRangeRepresentation ,sal_Bool bCategory)
110
            throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
107
111
108
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection()
112
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection()
109
        throw (::com::sun::star::uno::RuntimeException);
113
        throw (::com::sun::star::uno::RuntimeException);
(-)sc/source/ui/unoobj/chart2uno.cxx (-1 / +10 lines)
Lines 2045-2051 Link Here
2045
2045
2046
    return xResult;
2046
    return xResult;
2047
}
2047
}
2048
2048
////
2049
uno::Reference< chart2::data::XDataSequence > SAL_CALL
2050
    ScChart2DataProvider::createDataSequenceByRangeRepresentationAndRole(
2051
    const ::rtl::OUString& aRangeRepresentation ,sal_Bool bCategory)
2052
    throw (lang::IllegalArgumentException,
2053
           uno::RuntimeException)
2054
{
2055
    return 0;
2056
}
2057
////
2049
uno::Reference< sheet::XRangeSelection > SAL_CALL ScChart2DataProvider::getRangeSelection()
2058
uno::Reference< sheet::XRangeSelection > SAL_CALL ScChart2DataProvider::getRangeSelection()
2050
    throw (uno::RuntimeException)
2059
    throw (uno::RuntimeException)
2051
{
2060
{
(-)sw/inc/unochart.hxx (+4 lines)
Lines 181-186 Link Here
181
    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource ) throw (::com::sun::star::uno::RuntimeException);
181
    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource ) throw (::com::sun::star::uno::RuntimeException);
182
    virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( const ::rtl::OUString& aRangeRepresentation ) throw (::com::sun::star::uno::RuntimeException);
182
    virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( const ::rtl::OUString& aRangeRepresentation ) throw (::com::sun::star::uno::RuntimeException);
183
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( const ::rtl::OUString& aRangeRepresentation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
183
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( const ::rtl::OUString& aRangeRepresentation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
184
    ////
185
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentationAndRole( const ::rtl::
186
    OUString& aRangeRepresentation ,sal_Bool bCategory ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
187
    ////
184
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection(  ) throw (::com::sun::star::uno::RuntimeException);
188
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection(  ) throw (::com::sun::star::uno::RuntimeException);
185
189
186
    // XRangeXMLConversion
190
    // XRangeXMLConversion
(-)sw/source/core/unocore/unochart.cxx (-1 / +9 lines)
Lines 1505-1512 Link Here
1505
    vos::OGuard aGuard( Application::GetSolarMutex() );
1505
    vos::OGuard aGuard( Application::GetSolarMutex() );
1506
    return Impl_createDataSequenceByRangeRepresentation( rRangeRepresentation );
1506
    return Impl_createDataSequenceByRangeRepresentation( rRangeRepresentation );
1507
}
1507
}
1508
////
1509
uno::Reference< chart2::data::XDataSequence > SAL_CALL SwChartDataProvider::createDataSequenceByRangeRepresentationAndRole(
1510
        const OUString& rRangeRepresentation ,sal_Bool bCategory)
1511
    throw (lang::IllegalArgumentException, uno::RuntimeException)
1512
{
1513
    vos::OGuard aGuard( Application::GetSolarMutex() );
1514
    return Impl_createDataSequenceByRangeRepresentation( rRangeRepresentation );
1515
}
1516
////
1508
1517
1509
1510
uno::Reference< sheet::XRangeSelection > SAL_CALL SwChartDataProvider::getRangeSelection(  )
1518
uno::Reference< sheet::XRangeSelection > SAL_CALL SwChartDataProvider::getRangeSelection(  )
1511
    throw (uno::RuntimeException)
1519
    throw (uno::RuntimeException)
1512
{
1520
{

Return to issue 115820