1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _CHART2_TP_RANGECHOOSER_HXX
29 #define _CHART2_TP_RANGECHOOSER_HXX
30 
31 #include "RangeSelectionListener.hxx"
32 #include "RangeSelectionButton.hxx"
33 #include "TabPageNotifiable.hxx"
34 #include "RangeEdit.hxx"
35 
36 #include <com/sun/star/chart2/XChartDocument.hpp>
37 #include <com/sun/star/chart2/data/XDataProvider.hpp>
38 #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
39 #include <svtools/wizardmachine.hxx>
40 #include <vcl/edit.hxx>
41 #include <vcl/fixed.hxx>
42 #include <com/sun/star/sheet/XRangeSelection.hpp>
43 
44 //.............................................................................
45 namespace chart
46 {
47 //.............................................................................
48 
49 //-----------------------------------------------------------------------------
50 /**
51 */
52 class ChartTypeTemplateProvider;
53 class DialogModel;
54 
55 class RangeChooserTabPage : public svt::OWizardPage, public RangeSelectionListenerParent
56 {
57 public:
58 
59     RangeChooserTabPage( Window* pParent
60                 , DialogModel & rDialogModel
61                 , ChartTypeTemplateProvider* pTemplateProvider
62                 , Dialog * pParentDialog
63                 , bool bHideDescription = false );
64 virtual ~RangeChooserTabPage();
65 
66     //RangeSelectionListenerParent
67     virtual void listeningFinished( const ::rtl::OUString & rNewRange );
68     virtual void disposingRangeSelection();
69 
70     void commitPage();
71 
72 protected: //methods
73 
74     //OWizardPage
75     virtual void ActivatePage();
76     virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason );
77 
78     //TabPage
79     virtual void DeactivatePage();
80 
81     void initControlsFromModel();
82     void changeDialogModelAccordingToControls();
83     bool isValid();
84     void setDirty();
85 
86     DECL_LINK( ChooseRangeHdl, void* );
87     DECL_LINK( ControlChangedHdl, void* );
88     DECL_LINK( ControlEditedHdl, void* );
89 
90 protected: //member
91 
92     FixedText       m_aFT_Caption;
93     FixedText       m_aFT_Range;
94     RangeEdit       m_aED_Range;
95     RangeSelectionButton     m_aIB_Range;
96 
97     RadioButton     m_aRB_Rows;
98     RadioButton     m_aRB_Columns;
99 
100     CheckBox        m_aCB_FirstRowAsLabel;
101     CheckBox        m_aCB_FirstColumnAsLabel;
102 
103     sal_Int32       m_nChangingControlCalls;
104     bool            m_bIsDirty;
105 
106     ::com::sun::star::uno::Reference<
107          ::com::sun::star::chart2::XChartDocument >         m_xChartDocument;
108     ::com::sun::star::uno::Reference<
109          ::com::sun::star::chart2::data::XDataProvider >    m_xDataProvider;
110 
111     rtl::OUString                                           m_aLastValidRangeString;
112     ::com::sun::star::uno::Reference<
113          ::com::sun::star::chart2::XChartTypeTemplate >     m_xCurrentChartTypeTemplate;
114     ChartTypeTemplateProvider*                              m_pTemplateProvider;
115 
116     DialogModel &                                           m_rDialogModel;
117     Dialog *                                                m_pParentDialog;
118     TabPageNotifiable *                                     m_pTabPageNotifiable;
119 };
120 
121 //.............................................................................
122 } //namespace chart
123 //.............................................................................
124 #endif
125