fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / dialogs / DataBrowserModel.hxx
blobce1b5e14f98dcf0130b1bcd88680a2643fac8cad
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/chart2/XChartDocument.hpp>
23 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <vector>
27 #include <boost/scoped_ptr.hpp>
29 namespace com { namespace sun { namespace star { namespace chart2 {
30 class XDataSeries;
31 class XChartType;
32 }}}}
34 namespace chart
37 class DialogModel;
39 class DataBrowserModel
41 public:
42 explicit DataBrowserModel(
43 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDoc,
44 const ::com::sun::star::uno::Reference<
45 ::com::sun::star::uno::XComponentContext > & xContext );
46 virtual ~DataBrowserModel();
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
58 belongs.
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 );
71 enum eCellType
73 NUMBER,
74 TEXT,
75 TEXTORDATE
78 eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow ) 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 ::com::sun::star::uno::Any getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow );
83 sal_uInt32 getNumberFormatKey( sal_Int32 nAtColumn, sal_Int32 nAtRow );
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 ::com::sun::star::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;
98 struct tDataHeader
100 ::com::sun::star::uno::Reference<
101 ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
102 ::com::sun::star::uno::Reference<
103 ::com::sun::star::chart2::XChartType > m_xChartType;
104 bool m_bSwapXAndYAxis;
105 sal_Int32 m_nStartColumn;
106 sal_Int32 m_nEndColumn;
108 // default CTOR
109 tDataHeader() :
110 m_bSwapXAndYAxis( false ),
111 m_nStartColumn( -1 ),
112 m_nEndColumn( -1 )
114 // "full" CTOR
115 tDataHeader(
116 ::com::sun::star::uno::Reference<
117 ::com::sun::star::chart2::XDataSeries > xDataSeries,
118 ::com::sun::star::uno::Reference<
119 ::com::sun::star::chart2::XChartType > xChartType,
120 bool bSwapXAndYAxis,
121 sal_Int32 nStartColumn,
122 sal_Int32 nEndColumn ) :
123 m_xDataSeries( xDataSeries ),
124 m_xChartType( xChartType ),
125 m_bSwapXAndYAxis( bSwapXAndYAxis ),
126 m_nStartColumn( nStartColumn ),
127 m_nEndColumn( nEndColumn )
131 typedef ::std::vector< tDataHeader > tDataHeaderVector;
133 const tDataHeaderVector& getDataHeaders() const { return m_aHeaders;}
135 tDataHeader getHeaderForSeries(
136 const ::com::sun::star::uno::Reference<
137 ::com::sun::star::chart2::XDataSeries > &xSeries ) const;
139 ::com::sun::star::uno::Reference<
140 ::com::sun::star::chart2::XDataSeries >
141 getDataSeriesByColumn( sal_Int32 nColumn ) const;
143 private:
144 void updateFromModel();
146 void removeComplexCategoryLevel( sal_Int32 nAtColumnIndex );
148 void addErrorBarRanges(
149 const ::com::sun::star::uno::Reference<
150 ::com::sun::star::chart2::XDataSeries > & xDataSeries,
151 sal_Int32 nNumberFormatKey,
152 sal_Int32 & rInOutSequenceIndex,
153 sal_Int32 & rInOutHeaderEnd, bool bYError );
155 sal_Int32 getCategoryColumnCount();
157 ::com::sun::star::uno::Reference<
158 ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
159 ::com::sun::star::uno::Reference<
160 ::com::sun::star::uno::XComponentContext > m_xContext;
161 boost::scoped_ptr< DialogModel > m_apDialogModel;
163 struct tDataColumn;
164 struct implColumnLess;
166 typedef ::std::vector< tDataColumn > tDataColumnVector;
168 tDataColumnVector m_aColumns;
169 tDataHeaderVector m_aHeaders;
172 } // namespace chart
174 // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSERMODEL_HXX
175 #endif
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */