1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CHART2_TP_RANGECHOOSER_HXX
25 #define _CHART2_TP_RANGECHOOSER_HXX
26 
27 #include "RangeSelectionListener.hxx"
28 #include "RangeSelectionButton.hxx"
29 #include "TabPageNotifiable.hxx"
30 #include "RangeEdit.hxx"
31 
32 #include <com/sun/star/chart2/XChartDocument.hpp>
33 #include <com/sun/star/chart2/data/XDataProvider.hpp>
34 #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
35 #include <svtools/wizardmachine.hxx>
36 #include <vcl/edit.hxx>
37 #include <vcl/fixed.hxx>
38 #include <com/sun/star/sheet/XRangeSelection.hpp>
39 
40 //.............................................................................
41 namespace chart
42 {
43 //.............................................................................
44 
45 //-----------------------------------------------------------------------------
46 /**
47 */
48 class ChartTypeTemplateProvider;
49 class DialogModel;
50 
51 class RangeChooserTabPage : public svt::OWizardPage, public RangeSelectionListenerParent
52 {
53 public:
54 
55     RangeChooserTabPage( Window* pParent
56                 , DialogModel & rDialogModel
57                 , ChartTypeTemplateProvider* pTemplateProvider
58                 , Dialog * pParentDialog
59                 , bool bHideDescription = false );
60 virtual ~RangeChooserTabPage();
61 
62     //RangeSelectionListenerParent
63     virtual void listeningFinished( const ::rtl::OUString & rNewRange );
64     virtual void disposingRangeSelection();
65 
66     void commitPage();
67 
68 protected: //methods
69 
70     //OWizardPage
71     virtual void ActivatePage();
72     virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason );
73 
74     //TabPage
75     virtual void DeactivatePage();
76 
77     void initControlsFromModel();
78     void changeDialogModelAccordingToControls();
79     bool isValid();
80     void setDirty();
81 
82     DECL_LINK( ChooseRangeHdl, void* );
83     DECL_LINK( ControlChangedHdl, void* );
84     DECL_LINK( ControlEditedHdl, void* );
85 
86 protected: //member
87 
88     FixedText       m_aFT_Caption;
89     FixedText       m_aFT_Range;
90     RangeEdit       m_aED_Range;
91     RangeSelectionButton     m_aIB_Range;
92 
93     RadioButton     m_aRB_Rows;
94     RadioButton     m_aRB_Columns;
95 
96     CheckBox        m_aCB_FirstRowAsLabel;
97     CheckBox        m_aCB_FirstColumnAsLabel;
98 
99     sal_Int32       m_nChangingControlCalls;
100     bool            m_bIsDirty;
101 
102     ::com::sun::star::uno::Reference<
103          ::com::sun::star::chart2::XChartDocument >         m_xChartDocument;
104     ::com::sun::star::uno::Reference<
105          ::com::sun::star::chart2::data::XDataProvider >    m_xDataProvider;
106 
107     rtl::OUString                                           m_aLastValidRangeString;
108     ::com::sun::star::uno::Reference<
109          ::com::sun::star::chart2::XChartTypeTemplate >     m_xCurrentChartTypeTemplate;
110     ChartTypeTemplateProvider*                              m_pTemplateProvider;
111 
112     DialogModel &                                           m_rDialogModel;
113     Dialog *                                                m_pParentDialog;
114     TabPageNotifiable *                                     m_pTabPageNotifiable;
115 };
116 
117 //.............................................................................
118 } //namespace chart
119 //.............................................................................
120 #endif
121