LibreOffice Module sc (master) 1
dapitype.cxx
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#undef SC_DLLIMPLEMENTATION
21
22#include <dapitype.hxx>
23#include <comphelper/lok.hxx>
24
25using namespace com::sun::star;
26
28 : GenericDialogController(pParent, "modules/scalc/ui/selectsource.ui", "SelectSourceDialog")
29 , m_xBtnSelection(m_xBuilder->weld_radio_button("selection"))
30 , m_xBtnNamedRange(m_xBuilder->weld_radio_button("namedrange"))
31 , m_xBtnDatabase(m_xBuilder->weld_radio_button("database"))
32 , m_xBtnExternal(m_xBuilder->weld_radio_button("external"))
33 , m_xLbNamedRange(m_xBuilder->weld_combo_box("rangelb"))
34 , m_xBtnOk(m_xBuilder->weld_button("ok")) // for LOK jsdialog
35 , m_xBtnCancel(m_xBuilder->weld_button("cancel")) // for LOK jsdialog
36{
37 m_xBtnSelection->connect_toggled( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
38 m_xBtnNamedRange->connect_toggled( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
39 m_xBtnDatabase->connect_toggled( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
40 m_xBtnExternal->connect_toggled( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
41
42 m_xBtnOk->connect_clicked( LINK(this, ScDataPilotSourceTypeDlg, ResponseHdl ) );
43 m_xBtnCancel->connect_clicked( LINK(this, ScDataPilotSourceTypeDlg, ResponseHdl ) );
44
45 if (!bEnableExternal)
46 m_xBtnExternal->set_sensitive(false);
47
48 m_xBtnSelection->set_active(true);
49
50 // Disabled unless at least one named range exists.
51 m_xLbNamedRange->set_sensitive(false);
52 m_xBtnNamedRange->set_sensitive(false);
53
54 // Intentionally hide this button to see if anyone complains.
55 m_xBtnExternal->hide();
56
58 m_xBtnDatabase->hide();
59}
60
61IMPL_LINK(ScDataPilotSourceTypeDlg, ResponseHdl, weld::Button&, rButton, void)
62{
63 if (&rButton == m_xBtnOk.get())
64 m_xDialog->response(RET_OK);
65 else
66 m_xDialog->response(RET_CANCEL);
67}
68
70{
71}
72
74{
75 return m_xBtnDatabase->get_active();
76}
77
79{
80 return m_xBtnExternal->get_active();
81}
82
84{
85 return m_xBtnNamedRange->get_active();
86}
87
89{
90 return m_xLbNamedRange->get_active_text();
91}
92
94{
95 m_xLbNamedRange->append_text(rName);
96 if (m_xLbNamedRange->get_count() == 1)
97 {
98 // Select position 0 only for the first time.
99 m_xLbNamedRange->set_active(0);
100 m_xBtnNamedRange->set_sensitive(true);
101 }
102}
103
105{
106 m_xLbNamedRange->set_sensitive(m_xBtnNamedRange->get_active());
107}
108
109ScDataPilotServiceDlg::ScDataPilotServiceDlg(weld::Window* pParent, const std::vector<OUString>& rServices)
110 : GenericDialogController(pParent, "modules/scalc/ui/dapiservicedialog.ui", "DapiserviceDialog")
111 , m_xLbService(m_xBuilder->weld_combo_box("service"))
112 , m_xEdSource(m_xBuilder->weld_entry("source"))
113 , m_xEdName(m_xBuilder->weld_entry("name"))
114 , m_xEdUser(m_xBuilder->weld_entry("user"))
115 , m_xEdPasswd(m_xBuilder->weld_entry("password"))
116{
117 for (const OUString& aName : rServices)
118 {
119 m_xLbService->append_text(aName);
120 }
121 m_xLbService->set_active(0);
122}
123
125{
126}
127
129{
130 return m_xLbService->get_active_text();
131}
132
134{
135 return m_xEdSource->get_text();
136}
137
139{
140 return m_xEdName->get_text();
141}
142
144{
145 return m_xEdUser->get_text();
146}
147
149{
150 return m_xEdPasswd->get_text();
151}
152
153/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
OUString GetParSource() const
Definition: dapitype.cxx:133
OUString GetParUser() const
Definition: dapitype.cxx:143
OUString GetParPass() const
Definition: dapitype.cxx:148
virtual ~ScDataPilotServiceDlg() override
Definition: dapitype.cxx:124
OUString GetServiceName() const
Definition: dapitype.cxx:128
std::unique_ptr< weld::Entry > m_xEdPasswd
Definition: dapitype.hxx:56
ScDataPilotServiceDlg(weld::Window *pParent, const std::vector< OUString > &rServices)
Definition: dapitype.cxx:109
std::unique_ptr< weld::Entry > m_xEdSource
Definition: dapitype.hxx:53
std::unique_ptr< weld::Entry > m_xEdName
Definition: dapitype.hxx:54
std::unique_ptr< weld::Entry > m_xEdUser
Definition: dapitype.hxx:55
OUString GetParName() const
Definition: dapitype.cxx:138
std::unique_ptr< weld::ComboBox > m_xLbService
Definition: dapitype.hxx:52
std::unique_ptr< weld::RadioButton > m_xBtnNamedRange
Definition: dapitype.hxx:28
void AppendNamedRange(const OUString &rNames)
Definition: dapitype.cxx:93
std::unique_ptr< weld::Button > m_xBtnOk
Definition: dapitype.hxx:32
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: dapitype.hxx:33
bool IsDatabase() const
Definition: dapitype.cxx:73
bool IsNamedRange() const
Definition: dapitype.cxx:83
std::unique_ptr< weld::RadioButton > m_xBtnSelection
Definition: dapitype.hxx:27
OUString GetSelectedNamedRange() const
Definition: dapitype.cxx:88
bool IsExternal() const
Definition: dapitype.cxx:78
std::unique_ptr< weld::ComboBox > m_xLbNamedRange
Definition: dapitype.hxx:31
std::unique_ptr< weld::RadioButton > m_xBtnDatabase
Definition: dapitype.hxx:29
std::unique_ptr< weld::RadioButton > m_xBtnExternal
Definition: dapitype.hxx:30
virtual ~ScDataPilotSourceTypeDlg() override
Definition: dapitype.cxx:69
ScDataPilotSourceTypeDlg(weld::Window *pParent, bool bEnableExternal)
Definition: dapitype.cxx:27
IMPL_LINK(ScDataPilotSourceTypeDlg, ResponseHdl, weld::Button &, rButton, void)
Definition: dapitype.cxx:61
IMPL_LINK_NOARG(ScDataPilotSourceTypeDlg, RadioClickHdl, weld::Toggleable &, void)
Definition: dapitype.cxx:104
OUString aName
RET_OK
RET_CANCEL