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 : #undef SC_DLLIMPLEMENTATION
21 :
22 : #include "dapitype.hxx"
23 : #include "scresid.hxx"
24 : #include "sc.hrc"
25 :
26 : using namespace com::sun::star;
27 :
28 0 : ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg(vcl::Window* pParent, bool bEnableExternal)
29 0 : : ModalDialog( pParent, "SelectSourceDialog", "modules/scalc/ui/selectsource.ui" )
30 : {
31 0 : get(m_pBtnSelection, "selection");
32 0 : get(m_pBtnNamedRange, "namedrange");
33 0 : get(m_pBtnDatabase, "database");
34 0 : get(m_pBtnExternal, "external");
35 0 : get(m_pLbNamedRange, "rangelb");
36 0 : m_pBtnSelection->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
37 0 : m_pBtnNamedRange->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
38 0 : m_pBtnDatabase->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
39 0 : m_pBtnExternal->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
40 :
41 0 : if (!bEnableExternal)
42 0 : m_pBtnExternal->Disable();
43 :
44 0 : m_pBtnSelection->Check();
45 :
46 : // Disabled unless at least one named range exists.
47 0 : m_pLbNamedRange->Disable();
48 0 : m_pBtnNamedRange->Disable();
49 :
50 : // Intentionally hide this button to see if anyone complains.
51 0 : m_pBtnExternal->Show(false);
52 0 : }
53 :
54 0 : ScDataPilotSourceTypeDlg::~ScDataPilotSourceTypeDlg()
55 : {
56 0 : disposeOnce();
57 0 : }
58 :
59 0 : void ScDataPilotSourceTypeDlg::dispose()
60 : {
61 0 : m_pBtnSelection.clear();
62 0 : m_pBtnNamedRange.clear();
63 0 : m_pBtnDatabase.clear();
64 0 : m_pBtnExternal.clear();
65 0 : m_pLbNamedRange.clear();
66 0 : ModalDialog::dispose();
67 0 : }
68 :
69 0 : bool ScDataPilotSourceTypeDlg::IsDatabase() const
70 : {
71 0 : return m_pBtnDatabase->IsChecked();
72 : }
73 :
74 0 : bool ScDataPilotSourceTypeDlg::IsExternal() const
75 : {
76 0 : return m_pBtnExternal->IsChecked();
77 : }
78 :
79 0 : bool ScDataPilotSourceTypeDlg::IsNamedRange() const
80 : {
81 0 : return m_pBtnNamedRange->IsChecked();
82 : }
83 :
84 0 : OUString ScDataPilotSourceTypeDlg::GetSelectedNamedRange() const
85 : {
86 0 : sal_uInt16 nPos = m_pLbNamedRange->GetSelectEntryPos();
87 0 : return m_pLbNamedRange->GetEntry(nPos);
88 : }
89 :
90 0 : void ScDataPilotSourceTypeDlg::AppendNamedRange(const OUString& rName)
91 : {
92 0 : m_pLbNamedRange->InsertEntry(rName);
93 0 : if (m_pLbNamedRange->GetEntryCount() == 1)
94 : {
95 : // Select position 0 only for the first time.
96 0 : m_pLbNamedRange->SelectEntryPos(0);
97 0 : m_pBtnNamedRange->Enable();
98 : }
99 0 : }
100 :
101 0 : IMPL_LINK( ScDataPilotSourceTypeDlg, RadioClickHdl, RadioButton*, pBtn )
102 : {
103 0 : m_pLbNamedRange->Enable(pBtn == m_pBtnNamedRange);
104 0 : return 0;
105 : }
106 :
107 0 : ScDataPilotServiceDlg::ScDataPilotServiceDlg( vcl::Window* pParent,
108 : const uno::Sequence<OUString>& rServices ) :
109 0 : ModalDialog ( pParent, "DapiserviceDialog", "modules/scalc/ui/dapiservicedialog.ui" )
110 : {
111 0 : get(m_pLbService, "service");
112 0 : get(m_pEdSource, "source");
113 0 : get(m_pEdName, "name");
114 0 : get(m_pEdUser, "user");
115 0 : get(m_pEdPasswd, "password");
116 :
117 0 : long nCount = rServices.getLength();
118 0 : const OUString* pArray = rServices.getConstArray();
119 0 : for (long i=0; i<nCount; i++)
120 : {
121 0 : OUString aName = pArray[i];
122 0 : m_pLbService->InsertEntry( aName );
123 0 : }
124 0 : m_pLbService->SelectEntryPos( 0 );
125 0 : }
126 :
127 0 : ScDataPilotServiceDlg::~ScDataPilotServiceDlg()
128 : {
129 0 : disposeOnce();
130 0 : }
131 :
132 0 : void ScDataPilotServiceDlg::dispose()
133 : {
134 0 : m_pLbService.clear();
135 0 : m_pEdSource.clear();
136 0 : m_pEdName.clear();
137 0 : m_pEdUser.clear();
138 0 : m_pEdPasswd.clear();
139 0 : ModalDialog::dispose();
140 0 : }
141 :
142 :
143 0 : OUString ScDataPilotServiceDlg::GetServiceName() const
144 : {
145 0 : return m_pLbService->GetSelectEntry();
146 : }
147 :
148 0 : OUString ScDataPilotServiceDlg::GetParSource() const
149 : {
150 0 : return m_pEdSource->GetText();
151 : }
152 :
153 0 : OUString ScDataPilotServiceDlg::GetParName() const
154 : {
155 0 : return m_pEdName->GetText();
156 : }
157 :
158 0 : OUString ScDataPilotServiceDlg::GetParUser() const
159 : {
160 0 : return m_pEdUser->GetText();
161 : }
162 :
163 0 : OUString ScDataPilotServiceDlg::GetParPass() const
164 : {
165 0 : return m_pEdPasswd->GetText();
166 0 : }
167 :
168 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|