LibreOffice Module chart2 (master) 1
DialogModel.hxx
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#pragma once
20
22#include <rtl/ustring.hxx>
23#include <rtl/ref.hxx>
24
25#include <map>
26#include <memory>
27#include <vector>
28
29namespace chart { class ChartModel; }
30namespace com::sun::star::beans { struct PropertyValue; }
31namespace com::sun::star::chart2 { class XChartDocument; }
32namespace com::sun::star::frame { class XModel; }
33namespace com::sun::star::uno { class XComponentContext; }
34namespace com::sun::star::uno { template <class E> class Sequence; }
35
36namespace com::sun::star::chart2 {
37 class XDataSeriesContainer;
38 class XDataSeries;
39 class XChartType;
40 namespace data {
41 class XDataProvider;
42 class XLabeledDataSequence;
43 }
44}
45
46namespace chart
47{
48class ChartType;
49class ChartTypeTemplate;
50class DataSeries;
51struct InterpretedData;
52class LabeledDataSequence;
53class RangeSelectionHelper;
54
56{
58
60 sal_Int32 nStart;
61 sal_Int32 nEnd;
62};
63
65{
66public:
67 explicit DialogModel( rtl::Reference<::chart::ChartModel> xChartDocument );
69
70 typedef std::pair<
71 OUString,
72 std::pair< rtl::Reference< ::chart::DataSeries >,
75
76 typedef std::map< OUString, OUString >
78
79 void setTemplate(
81
82 std::shared_ptr< RangeSelectionHelper > const &
84
86 getChartModel() const;
87
88 css::uno::Reference< css::chart2::data::XDataProvider >
89 getDataProvider() const;
90
91 std::vector< rtl::Reference< ::chart::ChartType > >
93
94 std::vector< tSeriesWithChartTypeByName >
96
98 const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
99 const OUString & aRoleOfSequenceForLabel,
100 const rtl::Reference< ::chart::ChartType > & xChartType );
101
102 enum class MoveDirection
103 {
104 Down, Up
105 };
106
107 void moveSeries( const rtl::Reference< DataSeries > & xSeries,
108 MoveDirection eDirection );
109
113 const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
114 const rtl::Reference< ::chart::ChartType > & xChartType,
115 bool bCreateDataCachedSequences = false );
116
117 void deleteSeries(
119 const rtl::Reference< ::chart::ChartType > & xChartType );
120
121 css::uno::Reference< css::chart2::data::XLabeledDataSequence >
122 getCategories() const;
123
124 void setCategories( const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xCategories );
125
126 OUString getCategoriesRange() const;
127
128 bool isCategoryDiagram() const;
129
130 void detectArguments(
131 OUString & rOutRangeString,
132 bool & rOutUseColumns, bool & rOutFirstCellAsLabel, bool & rOutHasCategories ) const;
133
135
136 void setData( const css::uno::Sequence< css::beans::PropertyValue > & rArguments );
137
138 void setTimeBasedRange( bool bTimeBased, sal_Int32 nStart, sal_Int32 nEnd) const;
139
141
143
144 static OUString ConvertRoleFromInternalToUI( const OUString & rRoleString );
145 static OUString GetRoleDataLabel();
146
147 // pass a role string (not translated) and get an index that serves for
148 // relative ordering, to get e.g. x-values and y-values in the right order
149 static sal_Int32 GetRoleIndexForSorting( const OUString & rInternalRoleString );
150
151 ChartModel& getModel() const;
152
153private:
156
158
159 mutable std::shared_ptr< RangeSelectionHelper >
161
163
164private:
166 const InterpretedData & rNewData,
167 const std::vector< rtl::Reference< ::chart::DataSeries > > & rSeriesToReUse );
168
169 sal_Int32 countSeries() const;
170
172};
173
174} // namespace chart
175
176/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< rtl::Reference< ::chart::ChartType > > getAllDataSeriesContainers() const
void setData(const css::uno::Sequence< css::beans::PropertyValue > &rArguments)
const rtl::Reference<::chart::ChartModel > & getChartModel() const
DialogModel(rtl::Reference<::chart::ChartModel > xChartDocument)
bool isCategoryDiagram() const
std::pair< OUString, std::pair< rtl::Reference< ::chart::DataSeries >, rtl::Reference< ::chart::ChartType > > > tSeriesWithChartTypeByName
Definition: DialogModel.hxx:74
std::shared_ptr< RangeSelectionHelper > m_spRangeSelectionHelper
void setCategories(const css::uno::Reference< css::chart2::data::XLabeledDataSequence > &xCategories)
static OUString GetRoleDataLabel()
void detectArguments(OUString &rOutRangeString, bool &rOutUseColumns, bool &rOutFirstCellAsLabel, bool &rOutHasCategories) const
std::vector< tSeriesWithChartTypeByName > getAllDataSeriesWithLabel() const
void setTemplate(const rtl::Reference< ::chart::ChartTypeTemplate > &xTemplate)
void setTimeBasedRange(bool bTimeBased, sal_Int32 nStart, sal_Int32 nEnd) const
void deleteSeries(const rtl::Reference< ::chart::DataSeries > &xSeries, const rtl::Reference< ::chart::ChartType > &xChartType)
rtl::Reference< ::chart::DataSeries > insertSeriesAfter(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, const rtl::Reference< ::chart::ChartType > &xChartType, bool bCreateDataCachedSequences=false)
std::map< OUString, OUString > tRolesWithRanges
Definition: DialogModel.hxx:77
bool allArgumentsForRectRangeDetected() const
css::uno::Reference< css::chart2::data::XDataProvider > getDataProvider() const
static OUString ConvertRoleFromInternalToUI(const OUString &rRoleString)
ChartModel & getModel() const
void moveSeries(const rtl::Reference< DataSeries > &xSeries, MoveDirection eDirection)
sal_Int32 countSeries() const
std::shared_ptr< RangeSelectionHelper > const & getRangeSelectionHelper() const
void startControllerLockTimer()
rtl::Reference<::chart::ChartModel > m_xChartDocument
TimerTriggeredControllerLock m_aTimerTriggeredControllerLock
static sal_Int32 GetRoleIndexForSorting(const OUString &rInternalRoleString)
css::uno::Reference< css::chart2::data::XLabeledDataSequence > getCategories() const
DialogModelTimeBasedInfo maTimeBasedInfo
static tRolesWithRanges getRolesWithRanges(const css::uno::Reference< css::chart2::XDataSeries > &xSeries, const OUString &aRoleOfSequenceForLabel, const rtl::Reference< ::chart::ChartType > &xChartType)
rtl::Reference< ::chart::ChartTypeTemplate > m_xTemplate
const DialogModelTimeBasedInfo & getTimeBasedInfo() const
OUString getCategoriesRange() const
void applyInterpretedData(const InterpretedData &rNewData, const std::vector< rtl::Reference< ::chart::DataSeries > > &rSeriesToReUse)
offers tooling to interpret different data sources in a structural and chart-type-dependent way.