LibreOffice Module svtools (master) 1
addresstemplate.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <config_options.h>
23#include <memory>
24#include <svtools/svtdllapi.h>
25#include <vcl/weld.hxx>
26
27namespace com :: sun :: star :: container { class XNameAccess; }
28namespace com :: sun :: star :: sdbc { class XDataSource; }
29namespace com :: sun :: star :: sdb { class XDatabaseContext; }
30namespace com :: sun :: star :: uno { class XComponentContext; }
31namespace com :: sun :: star :: util { struct AliasProgrammaticPair; }
32
33#define FIELD_PAIRS_VISIBLE 5
34#define FIELD_CONTROLS_VISIBLE 2 * FIELD_PAIRS_VISIBLE
35
36namespace svt
37{
38 // = AddressBookSourceDialog
39 struct AddressBookSourceDialogData;
40 class UNLESS_MERGELIBS(SVT_DLLPUBLIC) AddressBookSourceDialog final : public weld::GenericDialogController
41 {
42 public:
43 AddressBookSourceDialog(weld::Window* _pParent,
44 const css::uno::Reference< css::uno::XComponentContext >& _rxORB );
45
65 AddressBookSourceDialog(weld::Window* _pParent,
66 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
67 const css::uno::Reference< css::sdbc::XDataSource >& _rxTransientDS,
68 const OUString& _rDataSourceName,
69 const OUString& _rTable,
70 const css::uno::Sequence< css::util::AliasProgrammaticPair >& _rMapping
71 );
72
73 virtual ~AddressBookSourceDialog() override;
74
75 // to be used if the object was constructed for editing a field mapping only
76 void getFieldMapping(
77 css::uno::Sequence< css::util::AliasProgrammaticPair >& _rMapping) const;
78
79 private:
80 void implConstruct();
81
82 // implementations
83 void implScrollFields(sal_Int32 nPos, bool bAdjustFocus, bool bAdjustScrollbar);
84 static void implSelectField(weld::ComboBox* pBox, const OUString& rText);
85
86 void resetTables();
87 void resetFields();
88
89 // fill in the data sources listbox
90 void initializeDatasources();
91
92 // initialize the dialog from the configuration data
93 void loadConfiguration();
94
95 DECL_DLLPRIVATE_LINK(OnFieldScroll, weld::ScrolledWindow&, void);
96 DECL_DLLPRIVATE_LINK(OnFieldSelect, weld::ComboBox&, void);
97 DECL_DLLPRIVATE_LINK(OnAdministrateDatasources, weld::Button&, void);
98 DECL_DLLPRIVATE_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, weld::Widget&, void);
99 DECL_DLLPRIVATE_LINK(OnComboLoseFocus, weld::Widget&, void);
100 DECL_DLLPRIVATE_LINK(OnComboSelect, weld::ComboBox&, void);
101 DECL_DLLPRIVATE_LINK(OnOkClicked, weld::Button&, void);
102 DECL_DLLPRIVATE_LINK(OnDelayedInitialize, void*, void);
103
104 // string to display for "no selection"
105 const OUString m_sNoFieldSelection;
106
108 css::uno::Reference< css::sdb::XDatabaseContext >
109 m_xDatabaseContext;
110 // the ORB for creating objects
111 css::uno::Reference< css::uno::XComponentContext >
112 m_xORB;
113 css::uno::Reference< css::container::XNameAccess >
114 m_xCurrentDatasourceTables;
115
116 // Controls
117 std::unique_ptr<weld::ComboBox> m_xDatasource;
118 std::unique_ptr<weld::Button> m_xAdministrateDatasources;
119 std::unique_ptr<weld::ComboBox> m_xTable;
120 std::unique_ptr<weld::ScrolledWindow> m_xFieldScroller;
121 std::unique_ptr<weld::Button> m_xOKButton;
122 std::unique_ptr<weld::Widget> m_xGrid;
123
124 std::unique_ptr<AddressBookSourceDialogData> m_pImpl;
125 };
126} // namespace svt
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
std::unique_ptr< weld::Button > m_xOKButton
sal_uInt16 nPos