1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHARTDATAWRAPPER_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHARTDATAWRAPPER_HXX
22 #include <MutexContainer.hxx>
23 #include <cppuhelper/implbase.hxx>
24 #include <comphelper/interfacecontainer2.hxx>
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 #include <com/sun/star/lang/EventObject.hpp>
38 class Chart2ModelContact
;
41 class ChartDataWrapper final
: public MutexContainer
, public
42 ::cppu::WeakImplHelper
<
43 css::chart2::XAnyDescriptionAccess
,
44 css::chart::XDateCategories
,
45 css::lang::XServiceInfo
,
46 css::lang::XEventListener
,
47 css::lang::XComponent
>
50 explicit ChartDataWrapper(const std::shared_ptr
<Chart2ModelContact
>& spChart2ModelContact
);
51 ChartDataWrapper(const std::shared_ptr
<Chart2ModelContact
>& spChart2ModelContact
52 , const css::uno::Reference
< css::chart::XChartData
>& xNewData
);
53 virtual ~ChartDataWrapper() override
;
55 /// XServiceInfo declarations
56 virtual OUString SAL_CALL
getImplementationName() override
;
57 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
58 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
61 // ____ XDateCategories ____
62 virtual css::uno::Sequence
< double > SAL_CALL
getDateCategories() override
;
63 virtual void SAL_CALL
setDateCategories( const css::uno::Sequence
< double >& rDates
) override
;
65 // ____ XAnyDescriptionAccess ____
66 virtual css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> > SAL_CALL
67 getAnyRowDescriptions() override
;
68 virtual void SAL_CALL
setAnyRowDescriptions(
69 const css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> >& aRowDescriptions
) override
;
70 virtual css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> > SAL_CALL
71 getAnyColumnDescriptions() override
;
72 virtual void SAL_CALL
setAnyColumnDescriptions(
73 const css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> >& aColumnDescriptions
) override
;
75 // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
76 virtual css::uno::Sequence
< css::uno::Sequence
< OUString
> > SAL_CALL
77 getComplexRowDescriptions() override
;
78 virtual void SAL_CALL
setComplexRowDescriptions(
79 const css::uno::Sequence
< css::uno::Sequence
< OUString
> >& aRowDescriptions
) override
;
80 virtual css::uno::Sequence
< css::uno::Sequence
< OUString
> > SAL_CALL
81 getComplexColumnDescriptions() override
;
82 virtual void SAL_CALL
setComplexColumnDescriptions(
83 const css::uno::Sequence
< css::uno::Sequence
< OUString
> >& aColumnDescriptions
) override
;
85 // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
86 virtual css::uno::Sequence
< css::uno::Sequence
< double > > SAL_CALL
getData() override
;
87 virtual void SAL_CALL
setData( const css::uno::Sequence
< css::uno::Sequence
< double > >& aData
) override
;
88 virtual css::uno::Sequence
< OUString
> SAL_CALL
getRowDescriptions() override
;
89 virtual void SAL_CALL
setRowDescriptions( const css::uno::Sequence
< OUString
>& aRowDescriptions
) override
;
90 virtual css::uno::Sequence
< OUString
> SAL_CALL
getColumnDescriptions() override
;
91 virtual void SAL_CALL
setColumnDescriptions( const css::uno::Sequence
< OUString
>& aColumnDescriptions
) override
;
93 // ____ XChartData (base of XChartDataArray) ____
94 virtual void SAL_CALL
addChartDataChangeEventListener( const css::uno::Reference
< css::chart::XChartDataChangeEventListener
>& aListener
) override
;
95 virtual void SAL_CALL
removeChartDataChangeEventListener( const css::uno::Reference
< css::chart::XChartDataChangeEventListener
>& aListener
) override
;
96 virtual double SAL_CALL
getNotANumber() override
;
97 virtual sal_Bool SAL_CALL
isNotANumber( double nNumber
) override
;
99 // ____ XComponent ____
100 virtual void SAL_CALL
dispose() override
;
101 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
102 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
104 // ____ XEventListener ____
105 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
107 void fireChartDataChangeEvent( css::chart::ChartDataChangeEvent
& aEvent
);
109 void switchToInternalDataProvider();
110 void initDataAccess();
111 void applyData( lcl_Operator
& rDataOperator
);
113 css::uno::Reference
< css::chart2::XAnyDescriptionAccess
> m_xDataAccess
;
115 std::shared_ptr
< Chart2ModelContact
> m_spChart2ModelContact
;
116 ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer
;
119 } // namespace wrapper
122 // INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHARTDATAWRAPPER_HXX
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */