Update ooo320-m1
[ooovba.git] / dbaccess / source / ui / dlg / generalpage.hxx
blobb6a4aa159d721d01f55ea17df7f8c7bbc62703e7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: generalpage.hxx,v $
10 * $Revision: 1.22.68.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_GENERALPAGE_HXX_
32 #define _DBAUI_GENERALPAGE_HXX_
34 #ifndef _DBAUI_ADMINPAGES_HXX_
35 #include "adminpages.hxx"
36 #endif
37 #ifndef DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
38 #include "opendoccontrols.hxx"
39 #endif
40 #ifndef _SV_FIXED_HXX
41 #include <vcl/fixed.hxx>
42 #endif
43 #ifndef _SV_LSTBOX_HXX
44 #include <vcl/lstbox.hxx>
45 #endif
46 #ifndef _SV_EDIT_HXX
47 #include <vcl/edit.hxx>
48 #endif
49 #include <svtools/dialogcontrolling.hxx>
50 #include <memory>
52 //.........................................................................
53 namespace dbaui
55 //.........................................................................
56 class IDatabaseSettingsDialog;
57 //=========================================================================
58 //= OGeneralPage
59 //=========================================================================
60 class OGeneralPage : public OGenericAdministrationPage
62 OGeneralPage(Window* pParent, const SfxItemSet& _rItems, sal_Bool _bDBWizardMode = sal_False);
63 ~OGeneralPage();
65 public:
66 enum CreationMode
68 eCreateNew,
69 eConnectExternal,
70 eOpenExisting
73 struct DocumentDescriptor
75 String sURL;
76 String sFilter;
79 private:
80 // dialog controls
81 FixedText m_aFTHeaderText;
82 FixedText m_aFTHelpText;
83 FixedText m_aFT_DatasourceTypeHeader;
84 RadioButton m_aRB_CreateDatabase;
85 RadioButton m_aRB_OpenDocument;
86 RadioButton m_aRB_GetExistingDatabase;
87 FixedText m_aFT_DocListLabel;
88 ::std::auto_ptr< OpenDocumentListBox >
89 m_pLB_DocumentList;
90 OpenDocumentButton m_aPB_OpenDocument;
91 FixedText m_aTypePreLabel;
92 FixedText m_aDatasourceTypeLabel;
93 ::std::auto_ptr< ListBox >
94 m_pDatasourceType;
95 FixedText m_aFTDataSourceAppendix;
96 FixedText m_aTypePostLabel;
97 FixedText m_aSpecialMessage;
98 sal_Bool m_DBWizardMode;
99 String m_sMySQLEntry;
100 CreationMode m_eOriginalCreationMode;
101 DocumentDescriptor m_aBrowsedDocument;
103 ::svt::ControlDependencyManager
104 m_aControlDependencies;
105 ::std::vector< ::rtl::OUString> m_aURLPrefixes;
108 ::dbaccess::ODsnTypeCollection*
109 m_pCollection; /// the DSN type collection instance
110 ::rtl::OUString m_eCurrentSelection; /// currently selected type
111 ::dbaccess::DATASOURCE_TYPE m_eNotSupportedKnownType; /// if a data source of an unsupported, but known type is encountered ....
113 enum SPECIAL_MESSAGE
115 smNone,
116 smUnsupportedType
118 SPECIAL_MESSAGE m_eLastMessage;
120 Link m_aTypeSelectHandler; /// to be called if a new type is selected
121 Link m_aCreationModeHandler; /// to be called if a new type is selected
122 Link m_aDocumentSelectionHandler; /// to be called when a document in the RecentDoc list is selected
123 Link m_aChooseDocumentHandler; /// to be called when a recent document has been definately chosen
124 sal_Bool m_bDisplayingInvalid : 1; // the currently displayed data source is deleted
125 sal_Bool m_bUserGrabFocus : 1;
126 bool m_bInitTypeList : 1;
127 bool approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName );
128 void insertDatasourceTypeEntryData(const ::rtl::OUString& _sType, String sDisplayName);
130 public:
131 static SfxTabPage* Create(Window* pParent, const SfxItemSet& _rAttrSet, sal_Bool _bDBWizardMode = sal_False);
133 /// set a handler which gets called every time the user selects a new type
134 void SetTypeSelectHandler(const Link& _rHandler) { m_aTypeSelectHandler = _rHandler; }
135 void SetCreationModeHandler(const Link& _rHandler) { m_aCreationModeHandler = _rHandler; }
136 void SetDocumentSelectionHandler( const Link& _rHandler) { m_aDocumentSelectionHandler = _rHandler; }
137 void SetChooseDocumentHandler( const Link& _rHandler) { m_aChooseDocumentHandler = _rHandler; }
138 CreationMode GetDatabaseCreationMode() const;
140 DocumentDescriptor GetSelectedDocument() const;
142 /// get the currently selected datasource type
143 ::rtl::OUString GetSelectedType() const { return m_eCurrentSelection; }
145 protected:
146 // SfxTabPage overridables
147 virtual BOOL FillItemSet(SfxItemSet& _rCoreAttrs);
148 virtual void Reset(const SfxItemSet& _rCoreAttrs);
150 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
152 virtual void GetFocus();
154 // <method>OGenericAdministrationPage::fillControls</method>
155 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
156 // <method>OGenericAdministrationPage::fillWindows</method>
157 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
159 protected:
161 void onTypeSelected(const ::rtl::OUString& _sURLPrefix);
162 void initializeTypeList();
164 void implSetCurrentType( const ::rtl::OUString& _eType );
166 void switchMessage(const ::rtl::OUString& _sURLPrefix);
168 /// sets the the title of the parent dialog
169 void setParentTitle(const ::rtl::OUString& _sURLPrefix);
171 DECL_LINK(OnDatasourceTypeSelected, ListBox*);
172 DECL_LINK(OnSetupModeSelected, RadioButton*);
173 DECL_LINK(OnDocumentSelected, ListBox*);
174 DECL_LINK(OnOpenDocument, PushButton*);
177 //.........................................................................
178 } // namespace dbaui
179 //.........................................................................
180 #endif // _DBAUI_GENERALPAGE_HXX_