LibreOffice Module chart2 (master) 1
LabeledDataSequence.cxx
Go to the documentation of this file.
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
23#include <utility>
24
25namespace com::sun::star::uno { class XComponentContext; }
26
27using namespace ::com::sun::star;
28
29using ::com::sun::star::uno::Reference;
30using ::com::sun::star::uno::Sequence;
31
32namespace chart
33{
34
36 m_xModifyEventForwarder( new ModifyEventForwarder() )
37{}
38
41 m_xData(std::move( xValues )),
42 m_xModifyEventForwarder( new ModifyEventForwarder() )
43{
45}
46
48 uno::Reference< chart2::data::XDataSequence > xValues,
49 uno::Reference< chart2::data::XDataSequence > xLabel ) :
50 m_xData(std::move( xValues )),
51 m_xLabel(std::move( xLabel )),
52 m_xModifyEventForwarder( new ModifyEventForwarder() )
53{
56}
57
60 m_xModifyEventForwarder( new ModifyEventForwarder() )
61{
64
65 uno::Reference< util::XCloneable > xLabelCloneable( rSource.m_xLabel, uno::UNO_QUERY );
66 if( xLabelCloneable.is())
67 xNewLabel.set( xLabelCloneable->createClone(), uno::UNO_QUERY );
68
69 uno::Reference< util::XCloneable > xValuesCloneable( rSource.m_xData, uno::UNO_QUERY );
70 if( xValuesCloneable.is())
71 xNewValues.set( xValuesCloneable->createClone(), uno::UNO_QUERY );
72
73 m_xData = xNewValues;
74 m_xLabel = xNewLabel;
75
78}
79
81{
83 {
84 if( m_xData.is())
86 if( m_xLabel.is())
88 }
89}
90
91// ____ XLabeledDataSequence ____
93{
94 return m_xData;
95}
96
99{
100 if( m_xData != xSequence )
101 {
103 m_xData = xSequence;
105 }
106}
107
109{
110 return m_xLabel;
111}
112
115{
116 if( m_xLabel != xSequence )
117 {
119 m_xLabel = xSequence;
121 }
122}
123
124// ____ XCloneable ____
126{
129
130 uno::Reference< util::XCloneable > xLabelCloneable( m_xLabel, uno::UNO_QUERY );
131 if( xLabelCloneable.is())
132 xNewLabel.set( xLabelCloneable->createClone(), uno::UNO_QUERY );
133
134 uno::Reference< util::XCloneable > xValuesCloneable( m_xData, uno::UNO_QUERY );
135 if( xValuesCloneable.is())
136 xNewValues.set( xValuesCloneable->createClone(), uno::UNO_QUERY );
137
139 new LabeledDataSequence( xNewValues, xNewLabel ) );
140}
141
142// ____ XModifyBroadcaster ____
144{
145 m_xModifyEventForwarder->addModifyListener( aListener );
146}
147
149{
150 m_xModifyEventForwarder->removeModifyListener( aListener );
151}
152
154{
155 return "com.sun.star.comp.chart2.LabeledDataSequence";
156}
157
158sal_Bool SAL_CALL LabeledDataSequence::supportsService( const OUString& rServiceName )
159{
160 return cppu::supportsService(this, rServiceName);
161}
162
163css::uno::Sequence< OUString > SAL_CALL LabeledDataSequence::getSupportedServiceNames()
164{
165 return { "com.sun.star.chart2.data.LabeledDataSequence" };
166}
167
168} // namespace chart
169
170extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
172 css::uno::Sequence<css::uno::Any> const &)
173{
174 return cppu::acquire(new ::chart::LabeledDataSequence );
175}
176
177/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart2_LabeledDataSequence_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getLabel() override
css::uno::Reference< css::chart2::data::XDataSequence > m_xLabel
virtual void SAL_CALL setLabel(const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence) override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual OUString SAL_CALL getImplementationName() override
declare XServiceInfo methods
virtual void SAL_CALL setValues(const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getValues() override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
css::uno::Reference< css::chart2::data::XDataSequence > m_xData
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
rtl::Reference< ModifyEventForwarder > m_xModifyEventForwarder
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual ~LabeledDataSequence() override
This helper class serves as forwarder of modify events.
std::unique_ptr< weld::Label > m_xLabel
void removeListener(const InterfaceRef &xObject, const css::uno::Reference< css::util::XModifyListener > &xListener)
void addListener(const InterfaceRef &xObject, const css::uno::Reference< css::util::XModifyListener > &xListener)
cppu::WeakImplHelper< css::chart2::data::XLabeledDataSequence2, css::lang::XServiceInfo > LabeledDataSequence_Base
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool