Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / dbaccess / source / ui / dlg / generalpage.hxx
blob5bd2dbe189faa9aed40a9de38a274270f610cddc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _DBAUI_GENERALPAGE_HXX_
30 #define _DBAUI_GENERALPAGE_HXX_
32 #include "adminpages.hxx"
33 #include "opendoccontrols.hxx"
34 #include <vcl/fixed.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <vcl/edit.hxx>
37 #include <svtools/dialogcontrolling.hxx>
38 #include <memory>
40 //.........................................................................
41 namespace dbaui
43 //.........................................................................
44 class IDatabaseSettingsDialog;
45 //=========================================================================
46 //= OGeneralPage
47 //=========================================================================
48 class OGeneralPage : public OGenericAdministrationPage
50 OGeneralPage(Window* pParent, const SfxItemSet& _rItems, sal_Bool _bDBWizardMode = sal_False);
51 ~OGeneralPage();
53 public:
54 enum CreationMode
56 eCreateNew,
57 eConnectExternal,
58 eOpenExisting
61 struct DocumentDescriptor
63 String sURL;
64 String sFilter;
67 private:
68 // dialog controls
69 FixedText m_aFTHeaderText;
70 FixedText m_aFTHelpText;
71 FixedText m_aFT_DatasourceTypeHeader;
72 RadioButton m_aRB_CreateDatabase;
73 RadioButton m_aRB_OpenDocument;
74 RadioButton m_aRB_GetExistingDatabase;
75 FixedText m_aFT_DocListLabel;
76 ::std::auto_ptr< OpenDocumentListBox >
77 m_pLB_DocumentList;
78 OpenDocumentButton m_aPB_OpenDocument;
79 FixedText m_aTypePreLabel;
80 FixedText m_aDatasourceTypeLabel;
81 ::std::auto_ptr< ListBox >
82 m_pDatasourceType;
83 FixedText m_aFTDataSourceAppendix;
84 FixedText m_aTypePostLabel;
85 FixedText m_aSpecialMessage;
86 sal_Bool m_DBWizardMode;
87 String m_sMySQLEntry;
88 CreationMode m_eOriginalCreationMode;
89 DocumentDescriptor m_aBrowsedDocument;
91 ::svt::ControlDependencyManager
92 m_aControlDependencies;
93 ::std::vector< ::rtl::OUString> m_aURLPrefixes;
96 ::dbaccess::ODsnTypeCollection*
97 m_pCollection; /// the DSN type collection instance
98 ::rtl::OUString m_eCurrentSelection; /// currently selected type
99 ::dbaccess::DATASOURCE_TYPE m_eNotSupportedKnownType; /// if a data source of an unsupported, but known type is encountered ....
101 enum SPECIAL_MESSAGE
103 smNone,
104 smUnsupportedType
106 SPECIAL_MESSAGE m_eLastMessage;
108 Link m_aTypeSelectHandler; /// to be called if a new type is selected
109 Link m_aCreationModeHandler; /// to be called if a new type is selected
110 Link m_aDocumentSelectionHandler; /// to be called when a document in the RecentDoc list is selected
111 Link m_aChooseDocumentHandler; /// to be called when a recent document has been definately chosen
112 sal_Bool m_bDisplayingInvalid : 1; // the currently displayed data source is deleted
113 sal_Bool m_bUserGrabFocus : 1;
114 bool m_bInitTypeList : 1;
115 bool approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName );
116 void insertDatasourceTypeEntryData(const ::rtl::OUString& _sType, String sDisplayName);
118 public:
119 static SfxTabPage* Create(Window* pParent, const SfxItemSet& _rAttrSet, sal_Bool _bDBWizardMode = sal_False);
121 /// set a handler which gets called every time the user selects a new type
122 void SetTypeSelectHandler(const Link& _rHandler) { m_aTypeSelectHandler = _rHandler; }
123 void SetCreationModeHandler(const Link& _rHandler) { m_aCreationModeHandler = _rHandler; }
124 void SetDocumentSelectionHandler( const Link& _rHandler) { m_aDocumentSelectionHandler = _rHandler; }
125 void SetChooseDocumentHandler( const Link& _rHandler) { m_aChooseDocumentHandler = _rHandler; }
126 CreationMode GetDatabaseCreationMode() const;
128 DocumentDescriptor GetSelectedDocument() const;
130 /// get the currently selected datasource type
131 ::rtl::OUString GetSelectedType() const { return m_eCurrentSelection; }
133 protected:
134 // SfxTabPage overridables
135 virtual sal_Bool FillItemSet(SfxItemSet& _rCoreAttrs);
136 virtual void Reset(const SfxItemSet& _rCoreAttrs);
138 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
140 virtual void GetFocus();
142 // <method>OGenericAdministrationPage::fillControls</method>
143 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
144 // <method>OGenericAdministrationPage::fillWindows</method>
145 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
147 protected:
149 void onTypeSelected(const ::rtl::OUString& _sURLPrefix);
150 void initializeTypeList();
152 void implSetCurrentType( const ::rtl::OUString& _eType );
154 void switchMessage(const ::rtl::OUString& _sURLPrefix);
156 /// sets the the title of the parent dialog
157 void setParentTitle(const ::rtl::OUString& _sURLPrefix);
159 DECL_LINK(OnDatasourceTypeSelected, ListBox*);
160 DECL_LINK(OnSetupModeSelected, RadioButton*);
161 DECL_LINK(OnDocumentSelected, ListBox*);
162 DECL_LINK(OnOpenDocument, PushButton*);
165 //.........................................................................
166 } // namespace dbaui
167 //.........................................................................
168 #endif // _DBAUI_GENERALPAGE_HXX_
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */