LibreOffice Module chart2 (master) 1
DataBrowserModel.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
21#include <DataSeries.hxx>
22#include <ChartType.hxx>
23
24#include <com/sun/star/uno/Reference.hxx>
25#include <rtl/ref.hxx>
26
27#include <memory>
28#include <utility>
29#include <vector>
30
31namespace com::sun::star::chart2 { class XChartDocument; }
32namespace com::sun::star::uno { class XComponentContext; }
33
34namespace com::sun::star::chart2 {
35 class XDataSeries;
36 class XChartType;
37}
38
39namespace chart
40{
41
42class DialogModel;
43class ChartModel;
44class ChartType;
45class DataSeries;
46
48{
49public:
50 explicit DataBrowserModel(
51 const rtl::Reference<::chart::ChartModel> & xChartDoc );
53
57 void insertDataSeries( sal_Int32 nAfterColumnIndex );
58
61 void insertComplexCategoryLevel( sal_Int32 nAfterColumnIndex );
62
66 void removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColumnIndex );
67
71 void swapDataSeries( sal_Int32 nFirstIndex );
72 void swapDataPointForAllSeries( sal_Int32 nFirstIndex );
73
74 void insertDataPointForAllSeries( sal_Int32 nAfterIndex );
75 void removeDataPointForAllSeries( sal_Int32 nAtIndex );
76
78 {
82 };
83
84 eCellType getCellType( sal_Int32 nAtColumn ) const;
86 double getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow );
87 OUString getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow );
88 css::uno::Any getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow );
89 sal_uInt32 getNumberFormatKey( sal_Int32 nAtColumn );
90
92 bool setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue );
94 bool setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const OUString & rText );
95 bool setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const css::uno::Any & aValue );
96
97 sal_Int32 getColumnCount() const;
98 sal_Int32 getMaxRowCount() const;
99
100 // returns the UI string of the corresponding role
101 OUString getRoleOfColumn( sal_Int32 nColumnIndex ) const;
102 bool isCategoriesColumn( sal_Int32 nColumnIndex ) const;
103
105 {
109 sal_Int32 m_nStartColumn;
110 sal_Int32 m_nEndColumn;
111
112 // default CTOR
114 m_bSwapXAndYAxis( false ),
115 m_nStartColumn( -1 ),
116 m_nEndColumn( -1 )
117 {}
118 // "full" CTOR
122 bool bSwapXAndYAxis,
123 sal_Int32 nStartColumn,
124 sal_Int32 nEndColumn ) :
125 m_xDataSeries(std::move( xDataSeries )),
126 m_xChartType(std::move( xChartType )),
127 m_bSwapXAndYAxis( bSwapXAndYAxis ),
128 m_nStartColumn( nStartColumn ),
129 m_nEndColumn( nEndColumn )
130 {}
131 };
132
133 typedef std::vector< tDataHeader > tDataHeaderVector;
134
136
137 tDataHeader getHeaderForSeries(
138 const css::uno::Reference< css::chart2::XDataSeries > &xSeries ) const;
139
141 getDataSeriesByColumn( sal_Int32 nColumn ) const;
142
143private:
144 void updateFromModel();
145
146 void removeComplexCategoryLevel( sal_Int32 nAtColumnIndex );
147
149 const rtl::Reference<::chart::DataSeries > & xDataSeries,
150 sal_Int32 nNumberFormatKey,
151 sal_Int32 & rInOutSequenceIndex,
152 sal_Int32 & rInOutHeaderEnd, bool bYError );
153
154 sal_Int32 getCategoryColumnCount();
155
157 std::unique_ptr< DialogModel > m_apDialogModel;
158
159 struct tDataColumn;
160 struct implColumnLess;
161
162 typedef std::vector< tDataColumn > tDataColumnVector;
163
166};
167
168} // namespace chart
169
170/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void removeDataSeriesOrComplexCategoryLevel(sal_Int32 nAtColumnIndex)
Removes a data series to which the data column with index nAtColumnIndex belongs.
bool setCellAny(sal_Int32 nAtColumn, sal_Int32 nAtRow, const css::uno::Any &aValue)
void addErrorBarRanges(const rtl::Reference<::chart::DataSeries > &xDataSeries, sal_Int32 nNumberFormatKey, sal_Int32 &rInOutSequenceIndex, sal_Int32 &rInOutHeaderEnd, bool bYError)
tDataHeaderVector m_aHeaders
rtl::Reference< ::chart::DataSeries > getDataSeriesByColumn(sal_Int32 nColumn) const
void insertDataSeries(sal_Int32 nAfterColumnIndex)
Inserts a new data series after the data series to which the data column with index nAfterColumnIndex...
void insertDataPointForAllSeries(sal_Int32 nAfterIndex)
std::unique_ptr< DialogModel > m_apDialogModel
void swapDataPointForAllSeries(sal_Int32 nFirstIndex)
sal_uInt32 getNumberFormatKey(sal_Int32 nAtColumn)
tDataHeader getHeaderForSeries(const css::uno::Reference< css::chart2::XDataSeries > &xSeries) const
void swapDataSeries(sal_Int32 nFirstIndex)
Swaps the series to which the data column with index nFirstIndex belongs with the next series (which ...
const tDataHeaderVector & getDataHeaders() const
OUString getRoleOfColumn(sal_Int32 nColumnIndex) const
double getCellNumber(sal_Int32 nAtColumn, sal_Int32 nAtRow)
If getCellType( nAtColumn, nAtRow ) returns TEXT, the result will be Nan.
eCellType getCellType(sal_Int32 nAtColumn) const
void removeDataPointForAllSeries(sal_Int32 nAtIndex)
sal_Int32 getColumnCount() const
void removeComplexCategoryLevel(sal_Int32 nAtColumnIndex)
rtl::Reference<::chart::ChartModel > m_xChartDocument
sal_Int32 getMaxRowCount() const
bool setCellNumber(sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue)
returns </sal_True> if the number could successfully be set at the given position
css::uno::Any getCellAny(sal_Int32 nAtColumn, sal_Int32 nAtRow)
bool setCellText(sal_Int32 nAtColumn, sal_Int32 nAtRow, const OUString &rText)
returns </sal_True> if the text could successfully be set at the given position
std::vector< tDataColumn > tDataColumnVector
std::vector< tDataHeader > tDataHeaderVector
void insertComplexCategoryLevel(sal_Int32 nAfterColumnIndex)
Inserts a new text column for complex categories.
bool isCategoriesColumn(sal_Int32 nColumnIndex) const
tDataColumnVector m_aColumns
DataBrowserModel(const rtl::Reference<::chart::ChartModel > &xChartDoc)
OUString getCellText(sal_Int32 nAtColumn, sal_Int32 nAtRow)
rtl::Reference< ::chart::DataSeries > m_xDataSeries
tDataHeader(rtl::Reference< ::chart::DataSeries > xDataSeries, rtl::Reference< ::chart::ChartType > xChartType, bool bSwapXAndYAxis, sal_Int32 nStartColumn, sal_Int32 nEndColumn)
rtl::Reference< ::chart::ChartType > m_xChartType