Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef _DBAUI_GENERALPAGE_HXX_
21 : : #define _DBAUI_GENERALPAGE_HXX_
22 : :
23 : : #include "adminpages.hxx"
24 : : #include "opendoccontrols.hxx"
25 : : #include <vcl/fixed.hxx>
26 : : #include <vcl/lstbox.hxx>
27 : : #include <vcl/edit.hxx>
28 : : #include <svtools/dialogcontrolling.hxx>
29 : : #include <memory>
30 : :
31 : : //.........................................................................
32 : : namespace dbaui
33 : : {
34 : : //.........................................................................
35 : : //=========================================================================
36 : : //= OGeneralPage
37 : : //=========================================================================
38 : : class OGeneralPage : public OGenericAdministrationPage
39 : : {
40 : : OGeneralPage(Window* pParent, const SfxItemSet& _rItems, sal_Bool _bDBWizardMode = sal_False);
41 : : ~OGeneralPage();
42 : :
43 : : public:
44 : : enum CreationMode
45 : : {
46 : : eCreateNew,
47 : : eConnectExternal,
48 : : eOpenExisting
49 : : };
50 : :
51 [ # # ][ # # ]: 0 : struct DocumentDescriptor
[ # # ]
52 : : {
53 : : String sURL;
54 : : String sFilter;
55 : : };
56 : :
57 : : private:
58 : : // dialog controls
59 : : FixedText m_aFTHeaderText;
60 : : FixedText m_aFTHelpText;
61 : : FixedText m_aFT_DatasourceTypeHeader;
62 : : RadioButton m_aRB_CreateDatabase;
63 : : RadioButton m_aRB_OpenDocument;
64 : : RadioButton m_aRB_GetExistingDatabase;
65 : : FixedText m_aFT_DocListLabel;
66 : : ::std::auto_ptr< OpenDocumentListBox >
67 : : m_pLB_DocumentList;
68 : : OpenDocumentButton m_aPB_OpenDocument;
69 : : FixedText m_aTypePreLabel;
70 : : FixedText m_aDatasourceTypeLabel;
71 : : ::std::auto_ptr< ListBox >
72 : : m_pDatasourceType;
73 : : FixedText m_aFTDataSourceAppendix;
74 : : FixedText m_aTypePostLabel;
75 : : FixedText m_aSpecialMessage;
76 : : sal_Bool m_DBWizardMode;
77 : : String m_sMySQLEntry;
78 : : CreationMode m_eOriginalCreationMode;
79 : : DocumentDescriptor m_aBrowsedDocument;
80 : :
81 : : ::svt::ControlDependencyManager
82 : : m_aControlDependencies;
83 : : ::std::vector< ::rtl::OUString> m_aURLPrefixes;
84 : :
85 : :
86 : : ::dbaccess::ODsnTypeCollection*
87 : : m_pCollection; /// the DSN type collection instance
88 : : ::rtl::OUString m_eCurrentSelection; /// currently selected type
89 : : ::dbaccess::DATASOURCE_TYPE m_eNotSupportedKnownType; /// if a data source of an unsupported, but known type is encountered ....
90 : :
91 : : enum SPECIAL_MESSAGE
92 : : {
93 : : smNone,
94 : : smUnsupportedType
95 : : };
96 : : SPECIAL_MESSAGE m_eLastMessage;
97 : :
98 : : Link m_aTypeSelectHandler; /// to be called if a new type is selected
99 : : Link m_aCreationModeHandler; /// to be called if a new type is selected
100 : : Link m_aDocumentSelectionHandler; /// to be called when a document in the RecentDoc list is selected
101 : : Link m_aChooseDocumentHandler; /// to be called when a recent document has been definately chosen
102 : : sal_Bool m_bDisplayingInvalid : 1; // the currently displayed data source is deleted
103 : : sal_Bool m_bUserGrabFocus : 1;
104 : : bool m_bInitTypeList : 1;
105 : : bool approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName );
106 : : void insertDatasourceTypeEntryData(const ::rtl::OUString& _sType, String sDisplayName);
107 : :
108 : : public:
109 : : static SfxTabPage* Create(Window* pParent, const SfxItemSet& _rAttrSet, sal_Bool _bDBWizardMode = sal_False);
110 : :
111 : : /// set a handler which gets called every time the user selects a new type
112 : 0 : void SetTypeSelectHandler(const Link& _rHandler) { m_aTypeSelectHandler = _rHandler; }
113 : 0 : void SetCreationModeHandler(const Link& _rHandler) { m_aCreationModeHandler = _rHandler; }
114 : 0 : void SetDocumentSelectionHandler( const Link& _rHandler) { m_aDocumentSelectionHandler = _rHandler; }
115 : 0 : void SetChooseDocumentHandler( const Link& _rHandler) { m_aChooseDocumentHandler = _rHandler; }
116 : : CreationMode GetDatabaseCreationMode() const;
117 : :
118 : : DocumentDescriptor GetSelectedDocument() const;
119 : :
120 : : /// get the currently selected datasource type
121 : 0 : ::rtl::OUString GetSelectedType() const { return m_eCurrentSelection; }
122 : :
123 : : protected:
124 : : // SfxTabPage overridables
125 : : virtual sal_Bool FillItemSet(SfxItemSet& _rCoreAttrs);
126 : : virtual void Reset(const SfxItemSet& _rCoreAttrs);
127 : :
128 : : virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
129 : :
130 : : virtual void GetFocus();
131 : :
132 : : // <method>OGenericAdministrationPage::fillControls</method>
133 : : virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
134 : : // <method>OGenericAdministrationPage::fillWindows</method>
135 : : virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
136 : :
137 : : protected:
138 : :
139 : : void onTypeSelected(const ::rtl::OUString& _sURLPrefix);
140 : : void initializeTypeList();
141 : :
142 : : void implSetCurrentType( const ::rtl::OUString& _eType );
143 : :
144 : : void switchMessage(const ::rtl::OUString& _sURLPrefix);
145 : :
146 : : /// sets the the title of the parent dialog
147 : : void setParentTitle(const ::rtl::OUString& _sURLPrefix);
148 : :
149 : : DECL_LINK(OnDatasourceTypeSelected, ListBox*);
150 : : DECL_LINK(OnSetupModeSelected, RadioButton*);
151 : : DECL_LINK(OnDocumentSelected, ListBox*);
152 : : DECL_LINK(OnOpenDocument, PushButton*);
153 : : };
154 : :
155 : : //.........................................................................
156 : : } // namespace dbaui
157 : : //.........................................................................
158 : : #endif // _DBAUI_GENERALPAGE_HXX_
159 : :
160 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|