Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / tools / DataSource.cxx
blobc74687c1485a863252b486289eb86afdb0bd24d9
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 <DataSource.hxx>
21 #include <cppuhelper/supportsservice.hxx>
22 #include <comphelper/sequence.hxx>
24 namespace com::sun::star::uno { class XComponentContext; }
26 using ::com::sun::star::uno::Sequence;
27 using ::com::sun::star::uno::Reference;
29 using namespace ::com::sun::star;
32 namespace chart
35 DataSource::DataSource()
38 DataSource::DataSource(
39 const Sequence< Reference< chart2::data::XLabeledDataSequence > > & rSequences ) :
40 m_aDataSeq( rSequences )
43 DataSource::DataSource(
44 const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & rSequences )
46 m_aDataSeq = comphelper::containerToSequence< Reference< chart2::data::XLabeledDataSequence > >(rSequences);
49 DataSource::~DataSource()
52 // ____ XDataSource ____
53 Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL DataSource::getDataSequences()
55 return m_aDataSeq;
58 // ____ XDataSink ____
59 void SAL_CALL DataSource::setData( const Sequence< Reference< chart2::data::XLabeledDataSequence > >& aData )
61 m_aDataSeq = aData;
64 OUString SAL_CALL DataSource::getImplementationName()
66 return "com.sun.star.comp.chart.DataSource";
69 sal_Bool SAL_CALL DataSource::supportsService( const OUString& rServiceName )
71 return cppu::supportsService(this, rServiceName);
74 css::uno::Sequence< OUString > SAL_CALL DataSource::getSupportedServiceNames()
76 return { "com.sun.star.chart2.data.DataSource" };
79 } // namespace chart
81 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
82 com_sun_star_comp_chart_DataSource_get_implementation(css::uno::XComponentContext *,
83 css::uno::Sequence<css::uno::Any> const &)
85 return cppu::acquire(new ::chart::DataSource);
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */