merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / controller / dialogs / DialogModel.hxx
blobc7bb7c630c618f0b4940a6b0ca5ee5d0c25aee8c
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: DialogModel.hxx,v $
10 * $Revision: 1.4.44.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_DIALOGMODEL_HXX
31 #define CHART2_DIALOGMODEL_HXX
33 #include "TimerTriggeredControllerLock.hxx"
34 #include <com/sun/star/chart2/XChartDocument.hpp>
35 #include <com/sun/star/frame/XModel.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <vector>
39 #include <map>
40 #include <boost/shared_ptr.hpp>
42 namespace com { namespace sun { namespace star { namespace chart2 {
43 class XDataSeriesContainer;
44 class XDataSeries;
45 class XChartType;
46 class XChartTypeTemplate;
47 struct InterpretedData;
48 namespace data {
49 class XDataProvider;
50 class XLabeledDataSequence;
52 }}}}
54 namespace chart
57 class RangeSelectionHelper;
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 ::rtl::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< ::rtl::OUString, ::rtl::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 tRolesWithRanges getRolesWithRanges(
103 const ::com::sun::star::uno::Reference<
104 ::com::sun::star::chart2::XDataSeries > & xSeries,
105 const ::rtl::OUString & aRoleOfSequenceForLabel,
106 const ::com::sun::star::uno::Reference<
107 ::com::sun::star::chart2::XChartType > & xChartType ) const;
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 ::rtl::OUString getCategoriesRange() const;
143 bool isCategoryDiagram() const;
145 void detectArguments(
146 ::rtl::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 startControllerLockTimer();
156 static ::rtl::OUString ConvertRoleFromInternalToUI( const ::rtl::OUString & rRoleString );
157 static ::rtl::OUString GetRoleDataLabel();
159 // pass a role string (not translated) and get an index that serves for
160 // relative ordering, to get e.g. x-values and y-values in the right order
161 static sal_Int32 GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString );
163 private:
164 ::com::sun::star::uno::Reference<
165 ::com::sun::star::chart2::XChartDocument >
166 m_xChartDocument;
168 ::com::sun::star::uno::Reference<
169 ::com::sun::star::chart2::XChartDocument >
170 m_xBackupChartDocument;
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;
197 } // namespace chart
199 // CHART2_DIALOGMODEL_HXX
200 #endif