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