fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / drawingml / chart / datasourceconverter.cxx
blob8b1725f4dea5b2d38bb527c70128f70ec42fea89
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "drawingml/chart/datasourceconverter.hxx"
22 #include <com/sun/star/chart2/XChartDocument.hpp>
23 #include "oox/drawingml/chart/chartconverter.hxx"
24 #include "oox/drawingml/chart/datasourcemodel.hxx"
25 #include "oox/token/properties.hxx"
27 namespace oox {
28 namespace drawingml {
29 namespace chart {
31 using namespace ::com::sun::star::chart2::data;
32 using namespace ::com::sun::star::uno;
34 DataSequenceConverter::DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel ) :
35 ConverterBase< DataSequenceModel >( rParent, rModel )
39 DataSequenceConverter::~DataSequenceConverter()
43 Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUString& rRole )
45 // create data sequence from data source model (virtual call at chart converter)
46 Reference< XDataSequence > xDataSeq;
47 if( getChartConverter() )
49 // the internal data table does not support complex labels
50 // this is only supported in Calc!!!
51 // merge the labels into a single one
52 if(rRole == "label")
54 mrModel.mnPointCount = std::min<sal_Int32>(mrModel.mnPointCount, 1);
55 OUStringBuffer aTitle;
56 bool bFirst = true;
57 for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(),
58 itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr)
60 Any aAny = itr->second;
61 if(aAny.has<OUString>())
63 if(!bFirst)
64 aTitle.append(" ");
66 aTitle.append(aAny.get<OUString>());
67 bFirst = false;
71 if(!bFirst)
73 mrModel.maData.clear();
74 mrModel.maData.insert(std::make_pair<sal_Int32, Any>(1, Any(aTitle.makeStringAndClear())));
77 xDataSeq = getChartConverter()->createDataSequence(getChartDocument()->getDataProvider(), mrModel, rRole);
79 // set sequence role
80 PropertySet aSeqProp( xDataSeq );
81 aSeqProp.setProperty( PROP_Role, rRole );
83 return xDataSeq;
86 DataSourceConverter::DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel ) :
87 ConverterBase< DataSourceModel >( rParent, rModel )
91 DataSourceConverter::~DataSourceConverter()
95 Reference< XDataSequence > DataSourceConverter::createDataSequence( const OUString& rRole )
97 Reference< XDataSequence > xDataSeq;
98 if( mrModel.mxDataSeq.is() )
100 DataSequenceConverter aDataSeqConv( *this, *mrModel.mxDataSeq );
101 xDataSeq = aDataSeqConv.createDataSequence( rRole );
103 return xDataSeq;
106 } // namespace chart
107 } // namespace drawingml
108 } // namespace oox
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */