fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / dialogs / DialogModel.hxx
blobf44a366c90e9fa366aacbbf10279c8941802b6ed
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_DIALOGMODEL_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
22 #include "TimerTriggeredControllerLock.hxx"
23 #include <com/sun/star/chart2/XChartDocument.hpp>
24 #include <com/sun/star/frame/XModel.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include "ChartModel.hxx"
29 #include <vector>
30 #include <map>
31 #include <boost/shared_ptr.hpp>
33 namespace com { namespace sun { namespace star { namespace chart2 {
34 class XDataSeriesContainer;
35 class XDataSeries;
36 class XChartType;
37 class XChartTypeTemplate;
38 struct InterpretedData;
39 namespace data {
40 class XDataProvider;
41 class XLabeledDataSequence;
43 }}}}
45 namespace chart
48 class RangeSelectionHelper;
50 struct DialogModelTimeBasedInfo
52 DialogModelTimeBasedInfo();
54 bool bTimeBased;
55 sal_Int32 nStart;
56 sal_Int32 nEnd;
59 class DialogModel
61 public:
62 explicit DialogModel(
63 const ::com::sun::star::uno::Reference<
64 ::com::sun::star::chart2::XChartDocument > & xChartDocument,
65 const ::com::sun::star::uno::Reference<
66 ::com::sun::star::uno::XComponentContext > & xContext );
67 ~DialogModel();
69 typedef ::std::pair<
70 OUString,
71 ::std::pair< ::com::sun::star::uno::Reference<
72 ::com::sun::star::chart2::XDataSeries >,
73 ::com::sun::star::uno::Reference<
74 ::com::sun::star::chart2::XChartType > > >
75 tSeriesWithChartTypeByName;
77 typedef ::std::map< OUString, OUString >
78 tRolesWithRanges;
80 void setTemplate(
81 const ::com::sun::star::uno::Reference<
82 ::com::sun::star::chart2::XChartTypeTemplate > & xTemplate );
84 ::boost::shared_ptr< RangeSelectionHelper >
85 getRangeSelectionHelper() const;
87 ::com::sun::star::uno::Reference<
88 ::com::sun::star::frame::XModel >
89 getChartModel() const;
91 ::com::sun::star::uno::Reference<
92 ::com::sun::star::chart2::data::XDataProvider >
93 getDataProvider() const;
95 ::std::vector< ::com::sun::star::uno::Reference<
96 ::com::sun::star::chart2::XDataSeriesContainer > >
97 getAllDataSeriesContainers() const;
99 ::std::vector< tSeriesWithChartTypeByName >
100 getAllDataSeriesWithLabel() const;
102 static tRolesWithRanges getRolesWithRanges(
103 const ::com::sun::star::uno::Reference<
104 ::com::sun::star::chart2::XDataSeries > & xSeries,
105 const OUString & aRoleOfSequenceForLabel,
106 const ::com::sun::star::uno::Reference<
107 ::com::sun::star::chart2::XChartType > & xChartType );
109 enum eMoveDirection
111 MOVE_DOWN,
112 MOVE_UP
115 void moveSeries( const ::com::sun::star::uno::Reference<
116 ::com::sun::star::chart2::XDataSeries > & xSeries,
117 eMoveDirection eDirection );
119 /// @return the newly inserted series
120 ::com::sun::star::uno::Reference<
121 ::com::sun::star::chart2::XDataSeries > insertSeriesAfter(
122 const ::com::sun::star::uno::Reference<
123 ::com::sun::star::chart2::XDataSeries > & xSeries,
124 const ::com::sun::star::uno::Reference<
125 ::com::sun::star::chart2::XChartType > & xChartType,
126 bool bCreateDataCachedSequences = false );
128 void deleteSeries(
129 const ::com::sun::star::uno::Reference<
130 ::com::sun::star::chart2::XDataSeries > & xSeries,
131 const ::com::sun::star::uno::Reference<
132 ::com::sun::star::chart2::XChartType > & xChartType );
134 ::com::sun::star::uno::Reference<
135 ::com::sun::star::chart2::data::XLabeledDataSequence >
136 getCategories() const;
138 void setCategories( const ::com::sun::star::uno::Reference<
139 ::com::sun::star::chart2::data::XLabeledDataSequence > & xCategories );
141 OUString getCategoriesRange() const;
143 bool isCategoryDiagram() const;
145 void detectArguments(
146 OUString & rOutRangeString,
147 bool & rOutUseColumns, bool & rOutFirstCellAsLabel, bool & rOutHasCategories ) const;
149 bool allArgumentsForRectRangeDetected() const;
151 bool setData( const ::com::sun::star::uno::Sequence<
152 ::com::sun::star::beans::PropertyValue > & rArguments );
154 void setTimeBasedRange( bool bTimeBased, sal_Int32 nStart, sal_Int32 nEnd) const;
156 const DialogModelTimeBasedInfo& getTimeBasedInfo() const { return maTimeBasedInfo; }
158 void startControllerLockTimer();
160 static OUString ConvertRoleFromInternalToUI( const OUString & rRoleString );
161 static OUString GetRoleDataLabel();
163 // pass a role string (not translated) and get an index that serves for
164 // relative ordering, to get e.g. x-values and y-values in the right order
165 static sal_Int32 GetRoleIndexForSorting( const OUString & rInternalRoleString );
167 private:
168 ::com::sun::star::uno::Reference<
169 ::com::sun::star::chart2::XChartDocument >
170 m_xChartDocument;
172 ::com::sun::star::uno::Reference<
173 ::com::sun::star::chart2::XChartTypeTemplate >
174 m_xTemplate;
176 ::com::sun::star::uno::Reference<
177 ::com::sun::star::uno::XComponentContext >
178 m_xContext;
180 mutable ::boost::shared_ptr< RangeSelectionHelper >
181 m_spRangeSelectionHelper;
183 TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
185 private:
186 void createBackup();
188 void applyInterpretedData(
189 const ::com::sun::star::chart2::InterpretedData & rNewData,
190 const ::std::vector< ::com::sun::star::uno::Reference<
191 ::com::sun::star::chart2::XDataSeries > > & rSeriesToReUse,
192 bool bSetStyles );
194 sal_Int32 countSeries() const;
196 ChartModel& getModel() const;
197 mutable DialogModelTimeBasedInfo maTimeBasedInfo;
200 } // namespace chart
202 // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
203 #endif
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */