LibreOffice Module chart2 (master) 1
ChartDataWrapper.hxx
Go to the documentation of this file.
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#pragma once
20
23#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
24#include <com/sun/star/chart/XDateCategories.hpp>
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
27#include <com/sun/star/lang/EventObject.hpp>
28
29#include <memory>
30
31namespace chart::wrapper
32{
33
34class Chart2ModelContact;
35struct lcl_Operator;
36
37class ChartDataWrapper final : public
38 ::cppu::WeakImplHelper<
39 css::chart2::XAnyDescriptionAccess,
40 css::chart::XDateCategories,
41 css::lang::XServiceInfo,
42 css::lang::XEventListener,
43 css::lang::XComponent >
44{
45public:
46 explicit ChartDataWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
47 ChartDataWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact
48 , const css::uno::Reference< css::chart::XChartData >& xNewData );
49 virtual ~ChartDataWrapper() override;
50
52 virtual OUString SAL_CALL getImplementationName() override;
53 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
54 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
55
56private:
57 // ____ XDateCategories ____
58 virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override;
59 virtual void SAL_CALL setDateCategories( const css::uno::Sequence< double >& rDates ) override;
60
61 // ____ XAnyDescriptionAccess ____
62 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL
63 getAnyRowDescriptions() override;
64 virtual void SAL_CALL setAnyRowDescriptions(
65 const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aRowDescriptions ) override;
66 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL
67 getAnyColumnDescriptions() override;
68 virtual void SAL_CALL setAnyColumnDescriptions(
69 const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aColumnDescriptions ) override;
70
71 // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
72 virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL
74 virtual void SAL_CALL setComplexRowDescriptions(
75 const css::uno::Sequence< css::uno::Sequence< OUString > >& aRowDescriptions ) override;
76 virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL
78 virtual void SAL_CALL setComplexColumnDescriptions(
79 const css::uno::Sequence< css::uno::Sequence< OUString > >& aColumnDescriptions ) override;
80
81 // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
82 virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override;
83 virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
84 virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
85 virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override;
86 virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
87 virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
88
89 // ____ XChartData (base of XChartDataArray) ____
90 virtual void SAL_CALL addChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
91 virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
92 virtual double SAL_CALL getNotANumber() override;
93 virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override;
94
95 // ____ XComponent ____
96 virtual void SAL_CALL dispose() override;
97 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
98 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
99
100 // ____ XEventListener ____
101 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
102
103 void fireChartDataChangeEvent( css::chart::ChartDataChangeEvent& aEvent );
104
106 void initDataAccess();
107 void applyData( lcl_Operator& rDataOperator );
108
109 std::mutex m_aMutex;
110 css::uno::Reference< css::chart2::XAnyDescriptionAccess > m_xDataAccess;
111 std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
113};
114
115} // namespace chart::wrapper
116
117/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual double SAL_CALL getNotANumber() override
virtual void SAL_CALL setAnyColumnDescriptions(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aColumnDescriptions) override
virtual void SAL_CALL setDateCategories(const css::uno::Sequence< double > &rDates) override
virtual sal_Bool SAL_CALL isNotANumber(double nNumber) override
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getAnyRowDescriptions() override
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getAnyColumnDescriptions() override
css::uno::Reference< css::chart2::XAnyDescriptionAccess > m_xDataAccess
void fireChartDataChangeEvent(css::chart::ChartDataChangeEvent &aEvent)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
ChartDataWrapper(std::shared_ptr< Chart2ModelContact > spChart2ModelContact)
virtual void SAL_CALL setColumnDescriptions(const css::uno::Sequence< OUString > &aColumnDescriptions) override
virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override
void applyData(lcl_Operator &rDataOperator)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL dispose() override
virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override
virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override
virtual void SAL_CALL addChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &aListener) override
virtual void SAL_CALL setAnyRowDescriptions(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aRowDescriptions) override
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexColumnDescriptions() override
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexRowDescriptions() override
virtual void SAL_CALL setRowDescriptions(const css::uno::Sequence< OUString > &aRowDescriptions) override
virtual void SAL_CALL setComplexRowDescriptions(const css::uno::Sequence< css::uno::Sequence< OUString > > &aRowDescriptions) override
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListenerContainer
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
virtual OUString SAL_CALL getImplementationName() override
XServiceInfo declarations.
virtual void SAL_CALL setData(const css::uno::Sequence< css::uno::Sequence< double > > &aData) override
virtual void SAL_CALL removeChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &aListener) override
virtual void SAL_CALL setComplexColumnDescriptions(const css::uno::Sequence< css::uno::Sequence< OUString > > &aColumnDescriptions) override
ChartDataWrapper(std::shared_ptr< Chart2ModelContact > spChart2ModelContact, const css::uno::Reference< css::chart::XChartData > &xNewData)
unsigned char sal_Bool