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 : #include "DataSource.hxx"
21 : #include "LabeledDataSequence.hxx"
22 : #include <cppuhelper/supportsservice.hxx>
23 :
24 : using ::osl::MutexGuard;
25 : using ::com::sun::star::uno::Sequence;
26 : using ::com::sun::star::uno::Reference;
27 : using ::com::sun::star::uno::RuntimeException;
28 : using ::com::sun::star::uno::Any;
29 :
30 : using namespace ::com::sun::star;
31 :
32 : namespace
33 : {
34 : static const char lcl_aServiceName[] = "com.sun.star.comp.chart.DataSource";
35 : } // anonymous namespace
36 :
37 : namespace chart
38 : {
39 :
40 865 : DataSource::DataSource(
41 865 : const Reference< uno::XComponentContext > & /*xContext*/ )
42 865 : {}
43 :
44 8748 : DataSource::DataSource(
45 : const Sequence< Reference< chart2::data::XLabeledDataSequence > > & rSequences ) :
46 8748 : m_aDataSeq( rSequences )
47 8748 : {}
48 :
49 19226 : DataSource::~DataSource()
50 19226 : {}
51 :
52 : // ____ XDataSource ____
53 9604 : Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL DataSource::getDataSequences()
54 : throw (uno::RuntimeException, std::exception)
55 : {
56 9604 : return m_aDataSeq;
57 : }
58 :
59 : // ____ XDataSink ____
60 864 : void SAL_CALL DataSource::setData( const Sequence< Reference< chart2::data::XLabeledDataSequence > >& aData )
61 : throw (uno::RuntimeException, std::exception)
62 : {
63 864 : m_aDataSeq = aData;
64 864 : }
65 :
66 1 : Sequence< OUString > DataSource::getSupportedServiceNames_Static()
67 : {
68 1 : Sequence< OUString > aServices( 1 );
69 1 : aServices[ 0 ] = "com.sun.star.chart2.data.DataSource";
70 1 : return aServices;
71 : }
72 :
73 1 : OUString SAL_CALL DataSource::getImplementationName()
74 : throw( css::uno::RuntimeException, std::exception )
75 : {
76 1 : return getImplementationName_Static();
77 : }
78 :
79 1 : OUString DataSource::getImplementationName_Static()
80 : {
81 1 : return OUString(lcl_aServiceName);
82 : }
83 :
84 0 : sal_Bool SAL_CALL DataSource::supportsService( const OUString& rServiceName )
85 : throw( css::uno::RuntimeException, std::exception )
86 : {
87 0 : return cppu::supportsService(this, rServiceName);
88 : }
89 :
90 1 : css::uno::Sequence< OUString > SAL_CALL DataSource::getSupportedServiceNames()
91 : throw( css::uno::RuntimeException, std::exception )
92 : {
93 1 : return getSupportedServiceNames_Static();
94 : }
95 :
96 : } // namespace chart
97 :
98 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
99 865 : com_sun_star_comp_chart_DataSource_get_implementation(css::uno::XComponentContext *context,
100 : css::uno::Sequence<css::uno::Any> const &)
101 : {
102 865 : return cppu::acquire(new ::chart::DataSource(context));
103 : }
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|