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