merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / controller / dialogs / DataBrowserModel.hxx
bloba5bf7648519795f82e230231a555f46146dc2a53
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DataBrowserModel.hxx,v $
10 * $Revision: 1.7.16.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CHART2_DATABROWSERMODEL_HXX
31 #define CHART2_DATABROWSERMODEL_HXX
33 #include <com/sun/star/chart2/XChartDocument.hpp>
34 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <memory>
37 #include <vector>
39 namespace com { namespace sun { namespace star { namespace chart2 {
40 class XDataSeries;
41 class XChartType;
42 namespace data {
43 class XLabeledDataSequence;
45 }}}}
47 namespace chart
50 class DialogModel;
52 class DataBrowserModel
54 public:
55 explicit DataBrowserModel(
56 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDoc,
57 const ::com::sun::star::uno::Reference<
58 ::com::sun::star::uno::XComponentContext > & xContext );
59 virtual ~DataBrowserModel();
61 /** Inserts a new data series after the data series to which the data column
62 with index nAfterColumnIndex belongs.
64 void insertDataSeries( sal_Int32 nAfterColumnIndex );
66 /** Removes a data series to which the data column with index nAtColumnIndex
67 belongs.
69 void removeDataSeries( sal_Int32 nAtColumnIndex );
71 /** Swaps the series to which the data column with index nFirstIndex belongs
72 with the next series (which starts at an index >= nFirstIndex + 1)
74 void swapDataSeries( sal_Int32 nFirstIndex );
75 void swapDataPointForAllSeries( sal_Int32 nFirstIndex );
77 void insertDataPointForAllSeries( sal_Int32 nAfterIndex );
78 void removeDataPointForAllSeries( sal_Int32 nAtIndex );
80 enum eCellType
82 NUMBER,
83 TEXT
86 eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow );
87 /// If getCellType( nAtColumn, nAtRow ) returns TEXT, the result will be Nan
88 double getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow );
89 ::rtl::OUString getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow );
90 sal_uInt32 getNumberFormatKey( sal_Int32 nAtColumn, sal_Int32 nAtRow );
92 /// returns </TRUE> if the number could successfully be set at the given position
93 bool setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue );
94 /// returns </TRUE> if the text could successfully be set at the given position
95 bool setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::rtl::OUString & rText );
96 bool setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::com::sun::star::uno::Any & aValue );
98 sal_Int32 getColumnCount() const;
99 sal_Int32 getMaxRowCount() const;
101 // returns the UI string of the corresponding role
102 ::rtl::OUString getRoleOfColumn( sal_Int32 nColumnIndex ) const;
104 struct tDataHeader
106 ::com::sun::star::uno::Reference<
107 ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
108 ::com::sun::star::uno::Reference<
109 ::com::sun::star::chart2::XChartType > m_xChartType;
110 bool m_bSwapXAndYAxis;
111 sal_Int32 m_nStartColumn;
112 sal_Int32 m_nEndColumn;
114 // default CTOR
115 tDataHeader() :
116 m_bSwapXAndYAxis( false ),
117 m_nStartColumn( -1 ),
118 m_nEndColumn( -1 )
120 // "full" CTOR
121 tDataHeader(
122 ::com::sun::star::uno::Reference<
123 ::com::sun::star::chart2::XDataSeries > xDataSeries,
124 ::com::sun::star::uno::Reference<
125 ::com::sun::star::chart2::XChartType > xChartType,
126 bool bSwapXAndYAxis,
127 sal_Int32 nStartColumn,
128 sal_Int32 nEndColumn ) :
129 m_xDataSeries( xDataSeries ),
130 m_xChartType( xChartType ),
131 m_bSwapXAndYAxis( bSwapXAndYAxis ),
132 m_nStartColumn( nStartColumn ),
133 m_nEndColumn( nEndColumn )
137 typedef ::std::vector< tDataHeader > tDataHeaderVector;
139 const tDataHeaderVector& getDataHeaders() const;
141 tDataHeader getHeaderForSeries(
142 const ::com::sun::star::uno::Reference<
143 ::com::sun::star::chart2::XDataSeries > &xSeries ) const;
145 ::com::sun::star::uno::Reference<
146 ::com::sun::star::chart2::XDataSeries >
147 getDataSeriesByColumn( sal_Int32 nColumn ) const;
149 private:
150 void updateFromModel();
152 void addErrorBarRanges(
153 const ::com::sun::star::uno::Reference<
154 ::com::sun::star::chart2::XDataSeries > & xDataSeries,
155 sal_Int32 nNumberFormatKey,
156 sal_Int32 & rInOutSequenceIndex,
157 sal_Int32 & rInOutHeaderEnd );
159 ::com::sun::star::uno::Reference<
160 ::com::sun::star::chart2::data::XLabeledDataSequence >
161 getCategories() const throw();
163 ::com::sun::star::uno::Reference<
164 ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
165 ::com::sun::star::uno::Reference<
166 ::com::sun::star::uno::XComponentContext > m_xContext;
167 ::std::auto_ptr< DialogModel > m_apDialogModel;
169 struct tDataColumn;
170 struct implColumnLess;
172 typedef ::std::vector< tDataColumn > tDataColumnVector;
174 tDataColumnVector m_aColumns;
175 tDataHeaderVector m_aHeaders;
178 } // namespace chart
180 // CHART2_DATABROWSERMODEL_HXX
181 #endif