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