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 _EXTENSIONS_DBP_GRIDWIZARD_HXX_
25 #define _EXTENSIONS_DBP_GRIDWIZARD_HXX_
26 
27 #include "controlwizard.hxx"
28 #include "commonpagesdbp.hxx"
29 
30 //.........................................................................
31 namespace dbp
32 {
33 //.........................................................................
34 
35 	//=====================================================================
36 	//= OGridSettings
37 	//=====================================================================
38 	struct OGridSettings : public OControlWizardSettings
39 	{
40 		::com::sun::star::uno::Sequence< ::rtl::OUString >		aSelectedFields;
41 	};
42 
43 	//=====================================================================
44 	//= OGridWizard
45 	//=====================================================================
46 	class OGridWizard : public OControlWizard
47 	{
48 	protected:
49 		OGridSettings	m_aSettings;
50 		sal_Bool		m_bHadDataSelection : 1;
51 
52 	public:
53 		OGridWizard(
54 			Window* _pParent,
55 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
56 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
57 		);
58 
getSettings()59 		OGridSettings& getSettings() { return m_aSettings; }
60 
61 	protected:
62 		// OWizardMachine overridables
63         virtual ::svt::OWizardPage*	createPage( WizardState _nState );
64 		virtual WizardState		    determineNextState( WizardState _nCurrentState ) const;
65 		virtual	void				enterState( WizardState _nState );
66 		virtual	sal_Bool			leaveState( WizardState _nState );
67 		virtual sal_Bool            onFinish();
68 
69 		virtual sal_Bool approveControl(sal_Int16 _nClassId);
70 
71 	protected:
72 		void implApplySettings();
73 	};
74 
75 	//=====================================================================
76 	//= OGridPage
77 	//=====================================================================
78 	class OGridPage : public OControlWizardPage
79 	{
80 	public:
OGridPage(OGridWizard * _pParent,const ResId & _rId)81 		OGridPage( OGridWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { }
82 
83 	protected:
getSettings()84 		OGridSettings& getSettings() { return static_cast<OGridWizard*>(getDialog())->getSettings(); }
85 	};
86 
87 	//=====================================================================
88 	//= OGridFieldsSelection
89 	//=====================================================================
90 	class OGridFieldsSelection : public OGridPage
91 	{
92 	protected:
93 		FixedLine		m_aFrame;
94 		FixedText		m_aExistFieldsLabel;
95 		ListBox			m_aExistFields;
96 		PushButton		m_aSelectOne;
97 		PushButton		m_aSelectAll;
98 		PushButton		m_aDeselectOne;
99 		PushButton		m_aDeselectAll;
100 		FixedText		m_aSelFieldsLabel;
101 		ListBox			m_aSelFields;
102 
103 	public:
104 		OGridFieldsSelection( OGridWizard* _pParent );
105 
106 	protected:
107 		// TabPage overridables
108 		virtual void ActivatePage();
109 
110 		// OWizardPage overridables
111 		virtual void		initializePage();
112 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
113 		virtual bool        canAdvance() const;
114 
115 	protected:
116 		DECL_LINK(OnMoveOneEntry, PushButton*);
117 		DECL_LINK(OnMoveAllEntries, PushButton*);
118 		DECL_LINK(OnEntrySelected, ListBox*);
119 		DECL_LINK(OnEntryDoubleClicked, ListBox*);
120 
121 		void implCheckButtons();
122 		void implApplySettings();
123 
124 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > implGetColumns(sal_Bool _bShowError = sal_True);
125 	};
126 
127 //.........................................................................
128 }	// namespace dbp
129 //.........................................................................
130 
131 #endif // _EXTENSIONS_DBP_GRIDWIZARD_HXX_
132 
133