update credits
[LibreOffice.git] / include / svtools / addresstemplate.hxx
blobd7406235b9a6dc289b0254e0a05e4f514ad34b12
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 _SVT_ADDRESSTEMPLATE_HXX_
21 #define _SVT_ADDRESSTEMPLATE_HXX_
23 #include "svtools/svtdllapi.h"
24 #include <vcl/dialog.hxx>
25 #include <vcl/fixed.hxx>
26 #include <vcl/combobox.hxx>
27 #include <vcl/button.hxx>
28 #include <vcl/layout.hxx>
29 #include <vcl/lstbox.hxx>
30 #include <vcl/scrbar.hxx>
31 #include <com/sun/star/container/XNameAccess.hpp>
32 #include <com/sun/star/util/AliasProgrammaticPair.hpp>
33 #include <com/sun/star/sdb/XDatabaseContext.hpp>
34 #include <com/sun/star/sdbc/XDataSource.hpp>
35 #include <unotools/configitem.hxx>
37 // .......................................................................
38 namespace svt
40 // .......................................................................
42 // ===================================================================
43 // = AddressBookSourceDialog
44 // ===================================================================
45 struct AddressBookSourceDialogData;
46 class SVT_DLLPUBLIC AddressBookSourceDialog : public ModalDialog
48 protected:
49 // Controls
50 ComboBox* m_pDatasource;
51 PushButton* m_pAdministrateDatasources;
52 ComboBox* m_pTable;
53 ScrollBar* m_pFieldScroller;
55 // string to display for "no selection"
56 const String m_sNoFieldSelection;
58 /// the DatabaseContext for selecting data sources
59 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
60 m_xDatabaseContext;
61 // the ORB for creating objects
62 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
63 m_xORB;
64 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
65 m_xCurrentDatasourceTables;
67 AddressBookSourceDialogData*
68 m_pImpl;
70 public:
71 AddressBookSourceDialog( Window* _pParent,
72 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB );
74 /** if you use this ctor, the dialog
75 <ul><li>will not store it's data in the configuration (nor initially retrieve it from there)</li>
76 <li>will not allow to change the data source name</li>
77 <li>will not allow to change the table name</li>
78 <li>will not allow to call the data source administration dialog</li>
79 </ul>
81 @param _rxORB
82 a service factory to use for various UNO related needs
83 @param _rxTransientDS
84 the data source to obtain connections from
85 @param _rDataSourceName
86 the to-be name of _rxTransientDS. This is only for displaying this
87 name to the user, since the dialog completely works on _rxTransientDS,
88 and doesn't allow to change this.
89 @param _rTable
90 the table name to display. It must refer to a valid table, relative to a connection
91 obtained from <arg>_rxTransientDS</arg>
93 AddressBookSourceDialog( Window* _pParent,
94 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB,
95 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxTransientDS,
96 const OUString& _rDataSourceName,
97 const OUString& _rTable,
98 const ::com::sun::star::uno::Sequence< ::com::sun::star::util::AliasProgrammaticPair >& _rMapping
101 ~AddressBookSourceDialog();
103 // to be used if the object was constructed for editing a field mapping only
104 void getFieldMapping(
105 ::com::sun::star::uno::Sequence< ::com::sun::star::util::AliasProgrammaticPair >& _rMapping) const;
107 protected:
108 void implConstruct();
110 // Window overridables
111 virtual long PreNotify( NotifyEvent& _rNEvt );
113 // implementations
114 void implScrollFields(sal_Int32 _nPos, sal_Bool _bAdjustFocus, sal_Bool _bAdjustScrollbar);
115 void implSelectField(ListBox* _pBox, const String& _rText);
117 void initalizeListBox(ListBox* _pList);
118 void resetTables();
119 void resetFields();
121 // fill in the data sources listbox
122 void initializeDatasources();
124 // initialize the dialog from the configuration data
125 void loadConfiguration();
127 DECL_LINK(OnFieldScroll, ScrollBar*);
128 DECL_LINK(OnFieldSelect, ListBox*);
129 DECL_LINK(OnAdministrateDatasources, void*);
130 DECL_LINK(OnComboGetFocus, ComboBox*);
131 DECL_LINK(OnComboLoseFocus, ComboBox*);
132 DECL_LINK(OnComboSelect, ComboBox*);
133 DECL_LINK(OnOkClicked, void*);
134 DECL_LINK(OnDelayedInitialize, void*);
138 // .......................................................................
139 } // namespace svt
140 // .......................................................................
142 #endif // _SVT_ADDRESSTEMPLATE_HXX_
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */