fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / dlg / generalpage.hxx
blobb30c592abdc77ac730740f257fd7d5cadfc4cd3f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_GENERALPAGE_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_DLG_GENERALPAGE_HXX
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>
30 namespace dbaui
32 // OGeneralPage
33 class OGeneralPage : public OGenericAdministrationPage
35 protected:
36 OGeneralPage( vcl::Window* pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems );
38 OUString m_eCurrentSelection; /// currently selected type
39 ::dbaccess::DATASOURCE_TYPE
40 m_eNotSupportedKnownType; /// if a data source of an unsupported, but known type is encountered ....
42 private:
43 VclPtr<FixedText> m_pSpecialMessage;
45 enum SPECIAL_MESSAGE
47 smNone,
48 smUnsupportedType
50 SPECIAL_MESSAGE m_eLastMessage;
52 Link<> m_aTypeSelectHandler; /// to be called if a new type is selected
53 bool m_bDisplayingInvalid : 1; /// the currently displayed data source is deleted
54 bool m_bInitTypeList : 1;
55 bool approveDatasourceType( const OUString& _sURLPrefix, OUString& _inout_rDisplayName );
56 void insertDatasourceTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
58 protected:
59 VclPtr<ListBox> m_pDatasourceType;
61 ::dbaccess::ODsnTypeCollection*
62 m_pCollection; /// the DSN type collection instance
64 ::std::vector< OUString>
65 m_aURLPrefixes;
67 public:
68 virtual ~OGeneralPage();
69 virtual void dispose() SAL_OVERRIDE;
71 /// set a handler which gets called every time the user selects a new type
72 void SetTypeSelectHandler( const Link<>& _rHandler ) { m_aTypeSelectHandler = _rHandler; }
74 /// get the currently selected datasource type
75 OUString GetSelectedType() const { return m_eCurrentSelection; }
77 protected:
78 // SfxTabPage overridables
79 virtual void Reset( const SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
81 virtual void implInitControls( const SfxItemSet& _rSet, bool _bSaveValue ) SAL_OVERRIDE;
82 virtual OUString getDatasourceName( const SfxItemSet& _rSet );
83 virtual bool approveDatasourceType( ::dbaccess::DATASOURCE_TYPE eType, OUString& _inout_rDisplayName );
85 // <method>OGenericAdministrationPage::fillControls</method>
86 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
87 // <method>OGenericAdministrationPage::fillWindows</method>
88 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
90 void onTypeSelected(const OUString& _sURLPrefix);
91 void initializeTypeList();
93 void implSetCurrentType( const OUString& _eType );
95 void switchMessage(const OUString& _sURLPrefix);
97 /// sets the title of the parent dialog
98 virtual void setParentTitle( const OUString& _sURLPrefix );
100 DECL_LINK(OnDatasourceTypeSelected, ListBox*);
103 // OGeneralPageDialog
104 class OGeneralPageDialog : public OGeneralPage
106 public:
107 OGeneralPageDialog( vcl::Window* pParent, const SfxItemSet& _rItems );
109 protected:
110 virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
112 virtual void implInitControls( const SfxItemSet& _rSet, bool _bSaveValue ) SAL_OVERRIDE;
113 virtual void setParentTitle( const OUString& _sURLPrefix ) SAL_OVERRIDE;
116 // OGeneralPageWizard
117 class OGeneralPageWizard : public OGeneralPage
119 public:
120 OGeneralPageWizard( vcl::Window* pParent, const SfxItemSet& _rItems );
121 virtual ~OGeneralPageWizard();
122 virtual void dispose() SAL_OVERRIDE;
123 public:
124 enum CreationMode
126 eCreateNew,
127 eConnectExternal,
128 eOpenExisting
131 struct DocumentDescriptor
133 OUString sURL;
134 OUString sFilter;
137 private:
138 // dialog controls
139 VclPtr<RadioButton> m_pRB_CreateDatabase;
140 VclPtr<RadioButton> m_pRB_OpenExistingDatabase;
141 VclPtr<RadioButton> m_pRB_ConnectDatabase;
143 VclPtr<FixedText> m_pFT_EmbeddedDBLabel;
144 VclPtr<ListBox> m_pEmbeddedDBType;
146 VclPtr<FixedText> m_pFT_DocListLabel;
147 VclPtr<OpenDocumentListBox> m_pLB_DocumentList;
148 VclPtr<OpenDocumentButton> m_pPB_OpenDatabase;
150 // state
151 DocumentDescriptor m_aBrowsedDocument;
152 CreationMode m_eOriginalCreationMode;
154 Link<OGeneralPageWizard *, void> m_aCreationModeHandler; /// to be called if a new type is selected
155 Link<> m_aDocumentSelectionHandler; /// to be called when a document in the RecentDoc list is selected
156 Link<> m_aChooseDocumentHandler; /// to be called when a recent document has been definitely chosen
158 ::svt::ControlDependencyManager
159 m_aControlDependencies;
161 bool m_bInitEmbeddedDBList : 1;
162 void insertEmbeddedDBTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
164 public:
165 void SetCreationModeHandler( const Link<OGeneralPageWizard *, void>& _rHandler ) { m_aCreationModeHandler = _rHandler; }
166 CreationMode GetDatabaseCreationMode() const;
168 void SetDocumentSelectionHandler( const Link<>& _rHandler) { m_aDocumentSelectionHandler = _rHandler; }
169 void SetChooseDocumentHandler( const Link<>& _rHandler) { m_aChooseDocumentHandler = _rHandler; }
170 DocumentDescriptor GetSelectedDocument() const;
172 protected:
173 virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
175 virtual void GetFocus() SAL_OVERRIDE;
177 virtual void implInitControls( const SfxItemSet& _rSet, bool _bSaveValue ) SAL_OVERRIDE;
178 virtual OUString getDatasourceName( const SfxItemSet& _rSet ) SAL_OVERRIDE;
179 virtual bool approveDatasourceType( ::dbaccess::DATASOURCE_TYPE eType, OUString& _inout_rDisplayName ) SAL_OVERRIDE;
181 ::std::vector< OUString>
182 m_aEmbeddedURLPrefixes;
184 virtual OUString getEmbeddedDBName( const SfxItemSet& _rSet );
185 void initializeEmbeddedDBList();
187 protected:
188 DECL_LINK( OnEmbeddedDBTypeSelected, ListBox* );
189 DECL_LINK( OnCreateDatabaseModeSelected, RadioButton* );
190 DECL_LINK( OnSetupModeSelected, RadioButton* );
191 DECL_LINK( OnDocumentSelected, ListBox* );
192 DECL_LINK( OnOpenDocument, PushButton* );
195 } // namespace dbaui
196 #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_GENERALPAGE_HXX
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */