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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSERMODEL_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSERMODEL_HXX
22 #include <com/sun/star/uno/Reference.hxx>
27 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XChartDocument
; } } } }
28 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{ class XComponentContext
; } } } }
30 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{
40 class DataBrowserModel final
43 explicit DataBrowserModel(
44 const css::uno::Reference
< css::chart2::XChartDocument
> & xChartDoc
,
45 const css::uno::Reference
< css::uno::XComponentContext
> & xContext
);
48 /** Inserts a new data series after the data series to which the data column
49 with index nAfterColumnIndex belongs.
51 void insertDataSeries( sal_Int32 nAfterColumnIndex
);
53 /** Inserts a new text column for complex categories.
55 void insertComplexCategoryLevel( sal_Int32 nAfterColumnIndex
);
57 /** Removes a data series to which the data column with index nAtColumnIndex
60 void removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColumnIndex
);
62 /** Swaps the series to which the data column with index nFirstIndex belongs
63 with the next series (which starts at an index >= nFirstIndex + 1)
65 void swapDataSeries( sal_Int32 nFirstIndex
);
66 void swapDataPointForAllSeries( sal_Int32 nFirstIndex
);
68 void insertDataPointForAllSeries( sal_Int32 nAfterIndex
);
69 void removeDataPointForAllSeries( sal_Int32 nAtIndex
);
78 eCellType
getCellType( sal_Int32 nAtColumn
) const;
79 /// If getCellType( nAtColumn, nAtRow ) returns TEXT, the result will be Nan
80 double getCellNumber( sal_Int32 nAtColumn
, sal_Int32 nAtRow
);
81 OUString
getCellText( sal_Int32 nAtColumn
, sal_Int32 nAtRow
);
82 css::uno::Any
getCellAny( sal_Int32 nAtColumn
, sal_Int32 nAtRow
);
83 sal_uInt32
getNumberFormatKey( sal_Int32 nAtColumn
);
85 /// returns </sal_True> if the number could successfully be set at the given position
86 bool setCellNumber( sal_Int32 nAtColumn
, sal_Int32 nAtRow
, double fValue
);
87 /// returns </sal_True> if the text could successfully be set at the given position
88 bool setCellText( sal_Int32 nAtColumn
, sal_Int32 nAtRow
, const OUString
& rText
);
89 bool setCellAny( sal_Int32 nAtColumn
, sal_Int32 nAtRow
, const css::uno::Any
& aValue
);
91 sal_Int32
getColumnCount() const;
92 sal_Int32
getMaxRowCount() const;
94 // returns the UI string of the corresponding role
95 OUString
getRoleOfColumn( sal_Int32 nColumnIndex
) const;
96 bool isCategoriesColumn( sal_Int32 nColumnIndex
) const;
100 css::uno::Reference
< css::chart2::XDataSeries
> m_xDataSeries
;
101 css::uno::Reference
< css::chart2::XChartType
> m_xChartType
;
102 bool m_bSwapXAndYAxis
;
103 sal_Int32 m_nStartColumn
;
104 sal_Int32 m_nEndColumn
;
108 m_bSwapXAndYAxis( false ),
109 m_nStartColumn( -1 ),
114 css::uno::Reference
< css::chart2::XDataSeries
> const & xDataSeries
,
115 css::uno::Reference
< css::chart2::XChartType
> const &xChartType
,
117 sal_Int32 nStartColumn
,
118 sal_Int32 nEndColumn
) :
119 m_xDataSeries( xDataSeries
),
120 m_xChartType( xChartType
),
121 m_bSwapXAndYAxis( bSwapXAndYAxis
),
122 m_nStartColumn( nStartColumn
),
123 m_nEndColumn( nEndColumn
)
127 typedef std::vector
< tDataHeader
> tDataHeaderVector
;
129 const tDataHeaderVector
& getDataHeaders() const { return m_aHeaders
;}
131 tDataHeader
getHeaderForSeries(
132 const css::uno::Reference
< css::chart2::XDataSeries
> &xSeries
) const;
134 css::uno::Reference
< css::chart2::XDataSeries
>
135 getDataSeriesByColumn( sal_Int32 nColumn
) const;
138 void updateFromModel();
140 void removeComplexCategoryLevel( sal_Int32 nAtColumnIndex
);
142 void addErrorBarRanges(
143 const css::uno::Reference
<css::chart2::XDataSeries
> & xDataSeries
,
144 sal_Int32 nNumberFormatKey
,
145 sal_Int32
& rInOutSequenceIndex
,
146 sal_Int32
& rInOutHeaderEnd
, bool bYError
);
148 sal_Int32
getCategoryColumnCount();
150 css::uno::Reference
< css::chart2::XChartDocument
> m_xChartDocument
;
151 std::unique_ptr
< DialogModel
> m_apDialogModel
;
154 struct implColumnLess
;
156 typedef std::vector
< tDataColumn
> tDataColumnVector
;
158 tDataColumnVector m_aColumns
;
159 tDataHeaderVector m_aHeaders
;
164 // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSERMODEL_HXX
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */