1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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"
37 #ifndef DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
38 #include "opendoccontrols.hxx"
41 #include <vcl/fixed.hxx>
43 #ifndef _SV_LSTBOX_HXX
44 #include <vcl/lstbox.hxx>
47 #include <vcl/edit.hxx>
49 #include <svtools/dialogcontrolling.hxx>
52 //.........................................................................
55 //.........................................................................
56 class IDatabaseSettingsDialog
;
57 //=========================================================================
59 //=========================================================================
60 class OGeneralPage
: public OGenericAdministrationPage
62 OGeneralPage(Window
* pParent
, const SfxItemSet
& _rItems
, sal_Bool _bDBWizardMode
= sal_False
);
73 struct DocumentDescriptor
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
>
90 OpenDocumentButton m_aPB_OpenDocument
;
91 FixedText m_aTypePreLabel
;
92 FixedText m_aDatasourceTypeLabel
;
93 ::std::auto_ptr
< ListBox
>
95 FixedText m_aFTDataSourceAppendix
;
96 FixedText m_aTypePostLabel
;
97 FixedText m_aSpecialMessage
;
98 sal_Bool m_DBWizardMode
;
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 ....
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
);
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
; }
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
);
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 //.........................................................................
179 //.........................................................................
180 #endif // _DBAUI_GENERALPAGE_HXX_