xref: /AOO41X/main/chart2/source/controller/dialogs/tp_DataSource.hxx (revision de7b3f825c374d9f7270d1282e9d92876f197200)
1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir #ifndef CHART2_DATASOURCETABPAGE_HXX
24cdf0e10cSrcweir #define CHART2_DATASOURCETABPAGE_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svtools/wizardmachine.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "DialogModel.hxx"
29cdf0e10cSrcweir #include "TabPageNotifiable.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // header for class Edit
32cdf0e10cSrcweir #include <vcl/edit.hxx>
33cdf0e10cSrcweir // header for class ListBox
34cdf0e10cSrcweir #include <vcl/lstbox.hxx>
35cdf0e10cSrcweir // header for class PushButton, OKButton, CancelButton, HelpButton
36cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX
37cdf0e10cSrcweir #include <vcl/button.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir // header for class FixedText, FixedLine
40cdf0e10cSrcweir #include <vcl/fixed.hxx>
41cdf0e10cSrcweir // header for class SvTabListBox
42cdf0e10cSrcweir #include <svtools/svtabbx.hxx>
43cdf0e10cSrcweir // header for class SvTreeListBox
44cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
45cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
46cdf0e10cSrcweir #include <com/sun/star/chart2/XDiagram.hpp>
47cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataProvider.hpp>
48cdf0e10cSrcweir #include <com/sun/star/chart2/XDataSeries.hpp>
49cdf0e10cSrcweir #include <com/sun/star/sheet/XRangeSelection.hpp>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <utility>
52cdf0e10cSrcweir #include <vector>
53cdf0e10cSrcweir #include <memory>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #include "RangeSelectionListener.hxx"
56cdf0e10cSrcweir #include "RangeSelectionButton.hxx"
57cdf0e10cSrcweir #include "RangeEdit.hxx"
58cdf0e10cSrcweir 
59cdf0e10cSrcweir namespace com { namespace sun { namespace star {
60cdf0e10cSrcweir     namespace chart2 {
61cdf0e10cSrcweir         class XChartType;
62cdf0e10cSrcweir }}}}
63cdf0e10cSrcweir 
64cdf0e10cSrcweir namespace chart
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class ChartTypeTemplateProvider;
68cdf0e10cSrcweir class DialogModel;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir class DataSourceTabPage :
71cdf0e10cSrcweir         public ::svt::OWizardPage,
72cdf0e10cSrcweir         public RangeSelectionListenerParent
73cdf0e10cSrcweir {
74cdf0e10cSrcweir public:
75cdf0e10cSrcweir     explicit DataSourceTabPage(
76cdf0e10cSrcweir         Window * pParent,
77cdf0e10cSrcweir         DialogModel & rDialogModel,
78cdf0e10cSrcweir         ChartTypeTemplateProvider* pTemplateProvider,
79cdf0e10cSrcweir         Dialog * pParentDialog,
80cdf0e10cSrcweir         bool bHideDescription = false );
81cdf0e10cSrcweir 	virtual ~DataSourceTabPage();
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     void commitPage();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir protected:
86cdf0e10cSrcweir     // OWizardPage
87cdf0e10cSrcweir     virtual void ActivatePage();
88cdf0e10cSrcweir     virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     //TabPage
91cdf0e10cSrcweir     virtual void DeactivatePage();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     virtual void		initializePage();
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     DECL_LINK( SeriesSelectionChangedHdl, void* );
96cdf0e10cSrcweir     DECL_LINK( RoleSelectionChangedHdl, void* );
97cdf0e10cSrcweir     DECL_LINK( MainRangeButtonClickedHdl, void* );
98cdf0e10cSrcweir     DECL_LINK( CategoriesRangeButtonClickedHdl, void* );
99cdf0e10cSrcweir     DECL_LINK( AddButtonClickedHdl, void* );
100cdf0e10cSrcweir     DECL_LINK( RemoveButtonClickedHdl, void* );
101cdf0e10cSrcweir     DECL_LINK( RangeModifiedHdl, Edit* );
102cdf0e10cSrcweir     DECL_LINK( RangeUpdateDataHdl, Edit* );
103cdf0e10cSrcweir     DECL_LINK( UpButtonClickedHdl, void* );
104cdf0e10cSrcweir     DECL_LINK( DownButtonClickedHdl, void* );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // ____ RangeSelectionListenerParent ____
107cdf0e10cSrcweir     virtual void listeningFinished( const ::rtl::OUString & rNewRange );
108cdf0e10cSrcweir     virtual void disposingRangeSelection();
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     void updateControlState();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir protected:
113cdf0e10cSrcweir     /** updates the internal data according to the content of the given edit
114cdf0e10cSrcweir         field.  If pField is 0, all relevant fields are used
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         @return
117cdf0e10cSrcweir             <TRUE/> if the text from the field is a valid format to the internal
118cdf0e10cSrcweir             data was valid
119cdf0e10cSrcweir      */
120cdf0e10cSrcweir     bool updateModelFromControl( Edit * pField = 0 );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener >
123cdf0e10cSrcweir         getSelectionRangeListener();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     /** @return </sal_True>, if the edit field contains a valid range entry. if no
126cdf0e10cSrcweir         XCellRangesAccess can be obtained, </sal_True> is returned.
127cdf0e10cSrcweir      */
128cdf0e10cSrcweir     bool isRangeFieldContentValid( Edit & rEdit );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     /** @return </sal_True>, if the tab-page is in a consistent (commitable) state
131cdf0e10cSrcweir      */
132cdf0e10cSrcweir     bool isValid();
133cdf0e10cSrcweir     void setDirty();
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     void updateControlsFromDialogModel();
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     void fillSeriesListBox();
138cdf0e10cSrcweir     void fillRoleListBox();
139cdf0e10cSrcweir 
140cdf0e10cSrcweir private:
141cdf0e10cSrcweir     FixedText               m_aFT_CAPTION;
142cdf0e10cSrcweir     FixedText               m_aFT_SERIES;
143cdf0e10cSrcweir     ::std::auto_ptr< SvTreeListBox > m_apLB_SERIES;
144cdf0e10cSrcweir     PushButton              m_aBTN_ADD;
145cdf0e10cSrcweir     PushButton              m_aBTN_REMOVE;
146cdf0e10cSrcweir     PushButton              m_aBTN_UP;
147cdf0e10cSrcweir     PushButton              m_aBTN_DOWN;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     FixedText               m_aFT_ROLE;
150cdf0e10cSrcweir     SvTabListBox            m_aLB_ROLE;
151cdf0e10cSrcweir     FixedText               m_aFT_RANGE;
152cdf0e10cSrcweir     RangeEdit               m_aEDT_RANGE;
153cdf0e10cSrcweir     RangeSelectionButton    m_aIMB_RANGE_MAIN;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     FixedText               m_aFT_CATEGORIES;
156cdf0e10cSrcweir     FixedText               m_aFT_DATALABELS;//used for xy charts
157cdf0e10cSrcweir     RangeEdit               m_aEDT_CATEGORIES;
158cdf0e10cSrcweir     RangeSelectionButton    m_aIMB_RANGE_CAT;
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     ::rtl::OUString         m_aFixedTextRange;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     ChartTypeTemplateProvider * m_pTemplateProvider;
163cdf0e10cSrcweir     DialogModel &               m_rDialogModel;
164cdf0e10cSrcweir     Edit *                      m_pCurrentRangeChoosingField;
165cdf0e10cSrcweir     bool                        m_bIsDirty;
166cdf0e10cSrcweir     sal_Int32                   m_nLastChartTypeGroupIndex;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     Dialog *                    m_pParentDialog;
169cdf0e10cSrcweir     TabPageNotifiable *         m_pTabPageNotifiable;
170cdf0e10cSrcweir };
171cdf0e10cSrcweir 
172cdf0e10cSrcweir } //  namespace chart
173cdf0e10cSrcweir 
174cdf0e10cSrcweir // CHART2_DATASOURCETABPAGE_HXX
175cdf0e10cSrcweir #endif
176