update dev300-m58
[ooovba.git] / chart2 / source / controller / dialogs / tp_DataSource.hxx
blob1fe223a2cdd908d1621a1b0c237e23fdcb459784
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: tp_DataSource.hxx,v $
10 * $Revision: 1.4.44.2 $
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_DATASOURCETABPAGE_HXX
31 #define CHART2_DATASOURCETABPAGE_HXX
33 #include <svtools/wizardmachine.hxx>
35 #include "DialogModel.hxx"
36 #include "TabPageNotifiable.hxx"
38 // header for class Edit
39 #include <vcl/edit.hxx>
40 // header for class ListBox
41 #include <vcl/lstbox.hxx>
42 // header for class PushButton, OKButton, CancelButton, HelpButton
43 #ifndef _SV_BUTTON_HXX
44 #include <vcl/button.hxx>
45 #endif
46 // header for class FixedText, FixedLine
47 #include <vcl/fixed.hxx>
48 // header for class SvTabListBox
49 #include <svtools/svtabbx.hxx>
50 // header for class SvTreeListBox
51 #include <svtools/svtreebx.hxx>
52 #include <com/sun/star/chart2/XChartDocument.hpp>
53 #include <com/sun/star/chart2/XDiagram.hpp>
54 #include <com/sun/star/chart2/data/XDataProvider.hpp>
55 #include <com/sun/star/chart2/XDataSeries.hpp>
56 #include <com/sun/star/sheet/XRangeSelection.hpp>
58 #include <utility>
59 #include <vector>
60 #include <memory>
62 #include "RangeSelectionListener.hxx"
63 #include "RangeSelectionButton.hxx"
64 #include "RangeEdit.hxx"
66 namespace com { namespace sun { namespace star {
67 namespace chart2 {
68 class XChartType;
69 }}}}
71 namespace chart
74 class ChartTypeTemplateProvider;
75 class DialogModel;
77 class DataSourceTabPage :
78 public ::svt::OWizardPage,
79 public RangeSelectionListenerParent
81 public:
82 explicit DataSourceTabPage(
83 Window * pParent,
84 DialogModel & rDialogModel,
85 ChartTypeTemplateProvider* pTemplateProvider,
86 Dialog * pParentDialog,
87 bool bHideDescription = false );
88 virtual ~DataSourceTabPage();
90 void commitPage();
92 protected:
93 // OWizardPage
94 virtual void ActivatePage();
95 virtual sal_Bool commitPage( CommitPageReason eReason );
97 //TabPage
98 virtual void DeactivatePage();
100 virtual void initializePage();
102 DECL_LINK( SeriesSelectionChangedHdl, void* );
103 DECL_LINK( RoleSelectionChangedHdl, void* );
104 DECL_LINK( MainRangeButtonClickedHdl, void* );
105 DECL_LINK( CategoriesRangeButtonClickedHdl, void* );
106 DECL_LINK( AddButtonClickedHdl, void* );
107 DECL_LINK( RemoveButtonClickedHdl, void* );
108 DECL_LINK( RangeModifiedHdl, Edit* );
109 DECL_LINK( RangeUpdateDataHdl, Edit* );
110 DECL_LINK( UpButtonClickedHdl, void* );
111 DECL_LINK( DownButtonClickedHdl, void* );
113 // ____ RangeSelectionListenerParent ____
114 virtual void listeningFinished( const ::rtl::OUString & rNewRange );
115 virtual void disposingRangeSelection();
117 void updateControlState();
119 protected:
120 /** updates the internal data according to the content of the given edit
121 field. If pField is 0, all relevant fields are used
123 @return
124 <TRUE/> if the text from the field is a valid format to the internal
125 data was valid
127 bool updateModelFromControl( Edit * pField = 0 );
129 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener >
130 getSelectionRangeListener();
132 /** @return </TRUE>, if the edit field contains a valid range entry. if no
133 XCellRangesAccess can be obtained, </TRUE> is returned.
135 bool isRangeFieldContentValid( Edit & rEdit );
137 /** @return </TRUE>, if the tab-page is in a consistent (commitable) state
139 bool isValid();
140 void setDirty();
142 void updateControlsFromDialogModel();
144 void fillSeriesListBox();
145 void fillRoleListBox();
147 private:
148 FixedText m_aFT_CAPTION;
149 FixedText m_aFT_SERIES;
150 ::std::auto_ptr< SvTreeListBox > m_apLB_SERIES;
151 PushButton m_aBTN_ADD;
152 PushButton m_aBTN_REMOVE;
153 PushButton m_aBTN_UP;
154 PushButton m_aBTN_DOWN;
156 FixedText m_aFT_ROLE;
157 SvTabListBox m_aLB_ROLE;
158 FixedText m_aFT_RANGE;
159 RangeEdit m_aEDT_RANGE;
160 RangeSelectionButton m_aIMB_RANGE_MAIN;
162 FixedText m_aFT_CATEGORIES;
163 FixedText m_aFT_DATALABELS;//used for xy charts
164 RangeEdit m_aEDT_CATEGORIES;
165 RangeSelectionButton m_aIMB_RANGE_CAT;
167 ::rtl::OUString m_aFixedTextRange;
169 ChartTypeTemplateProvider * m_pTemplateProvider;
170 DialogModel & m_rDialogModel;
171 Edit * m_pCurrentRangeChoosingField;
172 bool m_bIsDirty;
173 sal_Int32 m_nLastChartTypeGroupIndex;
175 Dialog * m_pParentDialog;
176 TabPageNotifiable * m_pTabPageNotifiable;
179 } // namespace chart
181 // CHART2_DATASOURCETABPAGE_HXX
182 #endif