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 #ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINT_HXX
20 #define INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINT_HXX
21 
22 #include <cppuhelper/implbase.hxx>
23 #include <cppuhelper/weakref.hxx>
24 #include <comphelper/uno3.hxx>
25 #include <com/sun/star/container/XChild.hpp>
26 #include <com/sun/star/util/XCloneable.hpp>
27 #include <com/sun/star/util/XModifyBroadcaster.hpp>
28 #include <com/sun/star/util/XModifyListener.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 
31 #include <OPropertySet.hxx>
32 #include <MutexContainer.hxx>
33 
34 namespace chart
35 {
36 
37 namespace impl
38 {
39 typedef ::cppu::WeakImplHelper<
40         css::container::XChild,
41         css::util::XCloneable,
42         css::util::XModifyBroadcaster,
43         css::util::XModifyListener,
44         css::lang::XServiceInfo >
45     DataPoint_Base;
46 }
47 
48 class DataPoint final :
49         public MutexContainer,
50         public impl::DataPoint_Base,
51         public ::property::OPropertySet
52 {
53 public:
54     explicit DataPoint( const css::uno::Reference< css::beans::XPropertySet > & rParentProperties );
55     virtual ~DataPoint() override;
56 
57     /// merge XInterface implementations
58      DECLARE_XINTERFACE()
59     /// XServiceInfo declarations
60     virtual OUString SAL_CALL getImplementationName() override;
61     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
62     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
63 
64 private:
65     explicit DataPoint( const DataPoint & rOther );
66 
67     // ____ OPropertySet ____
68     virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
69     virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
70     virtual void SAL_CALL setFastPropertyValue_NoBroadcast
71         ( sal_Int32 nHandle,
72           const css::uno::Any& rValue ) override;
73 
74     // ____ XPropertySet ____
75     virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
76         getPropertySetInfo() override;
77 
78     // ____ XCloneable ____
79     // Note: m_xParentProperties are not cloned!
80     virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
81 
82     // ____ XChild ____
83     virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override;
84     virtual void SAL_CALL setParent(
85         const css::uno::Reference< css::uno::XInterface >& Parent ) override;
86 
87     // ____ XModifyBroadcaster ____
88     virtual void SAL_CALL addModifyListener(
89         const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
90     virtual void SAL_CALL removeModifyListener(
91         const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
92 
93     // ____ XModifyListener ____
94     virtual void SAL_CALL modified(
95         const css::lang::EventObject& aEvent ) override;
96 
97     // ____ XEventListener (base of XModifyListener) ____
98     virtual void SAL_CALL disposing(
99         const css::lang::EventObject& Source ) override;
100 
101     // ____ OPropertySet ____
102     virtual void firePropertyChangeEvent() override;
103     using OPropertySet::disposing;
104 
105     css::uno::WeakReference< css::beans::XPropertySet >   m_xParentProperties;
106 
107     css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
108     bool m_bNoParentPropAllowed;
109 };
110 
111 } //  namespace chart
112 
113 // INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINT_HXX
114 #endif
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
117