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 <WrappedPropertySet.hxx>
22 #include "ReferenceSizePropertyProvider.hxx"
23 #include <cppuhelper/implbase.hxx>
24 #include <comphelper/interfacecontainer4.hxx>
25 #include <com/sun/star/lang/XComponent.hpp>
26 #include <com/sun/star/lang/XEventListener.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <rtl/ref.hxx>
32 namespace com::sun::star::chart2
{ class XDataSeries
; }
33 namespace chart
{ class DataSeries
; }
35 namespace chart::wrapper
38 class Chart2ModelContact
;
40 class DataSeriesPointWrapper final
: public ::cppu::ImplInheritanceHelper
<
42 , css::lang::XServiceInfo
43 , css::lang::XInitialization
44 , css::lang::XComponent
45 , css::lang::XEventListener
47 , public ReferenceSizePropertyProvider
57 //this constructor needs an initialize call afterwards
58 explicit DataSeriesPointWrapper(std::shared_ptr
<Chart2ModelContact
> spChart2ModelContact
);
60 DataSeriesPointWrapper(eType eType
61 , sal_Int32 nSeriesIndexInNewAPI
62 , sal_Int32 nPointIndex
//ignored for series
63 , std::shared_ptr
<Chart2ModelContact
> spChart2ModelContact
);
65 virtual ~DataSeriesPointWrapper() override
;
67 bool isSupportingAreaProperties();
68 bool isLinesForbidden() const { return !m_bLinesAllowed
;}
70 /// XServiceInfo declarations
71 virtual OUString SAL_CALL
getImplementationName() override
;
72 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
73 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
75 // ___lang::XInitialization___
76 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
78 //ReferenceSizePropertyProvider
79 virtual void updateReferenceSize() override
;
80 virtual css::uno::Any
getReferenceSize() override
;
81 virtual css::awt::Size
getCurrentSizeForReference() override
;
84 // ____ XComponent ____
85 virtual void SAL_CALL
dispose() override
;
86 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
87 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
89 // ____ XEventListener ____
90 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
92 // ____ WrappedPropertySet ____
93 virtual const css::uno::Sequence
< css::beans::Property
>& getPropertySequence() override
;
94 virtual std::vector
< std::unique_ptr
<WrappedProperty
> > createWrappedProperties() override
;
95 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
96 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
97 virtual css::uno::Reference
< css::beans::XPropertySet
> getInnerPropertySet() override
;
99 virtual css::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) override
;
100 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) override
;
101 virtual css::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
) override
;
104 rtl::Reference
< ::chart::DataSeries
> getDataSeries();
105 css::uno::Reference
< css::beans::XPropertySet
> getDataPointProperties();
107 std::shared_ptr
< Chart2ModelContact
> m_spChart2ModelContact
;
108 ::comphelper::OInterfaceContainerHelper4
<css::lang::XEventListener
> m_aEventListenerContainer
;
111 sal_Int32 m_nSeriesIndexInNewAPI
;
112 sal_Int32 m_nPointIndex
;
114 bool m_bLinesAllowed
;
116 //this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface
117 //because a big change in the chartmodel may lead to a dataseriespointer that is not connected to the model anymore
118 //with the indices instead we can always get the new dataseries
119 rtl::Reference
< ::chart::DataSeries
> m_xDataSeries
;
122 } // namespace chart::wrapper
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */