Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
Line
Count
Source
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 <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>
30
#include <memory>
31
32
namespace chart { class DataSeries; }
33
34
namespace chart::wrapper
35
{
36
37
class Chart2ModelContact;
38
39
class DataSeriesPointWrapper final : public ::cppu::ImplInheritanceHelper<
40
                                          WrappedPropertySet
41
                                        , css::lang::XServiceInfo
42
                                        , css::lang::XInitialization
43
                                        , css::lang::XComponent
44
                                        , css::lang::XEventListener
45
                                        >
46
                                        , public ReferenceSizePropertyProvider
47
48
{
49
public:
50
    enum eType
51
    {
52
        DATA_SERIES,
53
        DATA_POINT
54
    };
55
56
    //this constructor needs an initialize call afterwards
57
    explicit DataSeriesPointWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
58
59
    DataSeriesPointWrapper(eType eType
60
            , sal_Int32 nSeriesIndexInNewAPI
61
            , sal_Int32 nPointIndex //ignored for series
62
            , std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
63
64
    virtual ~DataSeriesPointWrapper() override;
65
66
    bool isSupportingAreaProperties();
67
0
    bool isLinesForbidden() const { return !m_bLinesAllowed;}
68
69
    /// XServiceInfo declarations
70
    virtual OUString SAL_CALL getImplementationName() override;
71
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
72
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
73
74
    // ___lang::XInitialization___
75
    virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
76
77
    //ReferenceSizePropertyProvider
78
    virtual void updateReferenceSize() override;
79
    virtual css::uno::Any getReferenceSize() override;
80
    virtual css::awt::Size getCurrentSizeForReference() override;
81
82
private:
83
    // ____ XComponent ____
84
    virtual void SAL_CALL dispose() override;
85
    virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
86
    virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
87
88
    // ____ XEventListener ____
89
    virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
90
91
    // ____ WrappedPropertySet ____
92
    virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence() override;
93
    virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties() override;
94
    virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
95
    virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
96
    virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override;
97
98
    virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
99
    virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
100
    virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
101
102
    //own methods
103
    rtl::Reference< ::chart::DataSeries > getDataSeries();
104
    css::uno::Reference< css::beans::XPropertySet > getDataPointProperties();
105
106
    std::shared_ptr< Chart2ModelContact >         m_spChart2ModelContact;
107
    ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
108
109
    eType               m_eType;
110
    sal_Int32           m_nSeriesIndexInNewAPI;
111
    sal_Int32           m_nPointIndex;
112
113
    bool                m_bLinesAllowed;
114
115
    //this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface
116
    //because a big change in the chartmodel may lead to a dataseriespointer that is not connected to the model anymore
117
    //with the indices instead we can always get the new dataseries
118
    rtl::Reference< ::chart::DataSeries >     m_xDataSeries;
119
};
120
121
} //  namespace chart::wrapper
122
123
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */