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 : }
57 :
58 0 : bool ScDataPilotSourceTypeDlg::IsDatabase() const
59 : {
60 0 : return m_pBtnDatabase->IsChecked();
61 : }
62 :
63 0 : bool ScDataPilotSourceTypeDlg::IsExternal() const
64 : {
65 0 : return m_pBtnExternal->IsChecked();
66 : }
67 :
68 0 : bool ScDataPilotSourceTypeDlg::IsNamedRange() const
69 : {
70 0 : return m_pBtnNamedRange->IsChecked();
71 : }
72 :
73 0 : OUString ScDataPilotSourceTypeDlg::GetSelectedNamedRange() const
74 : {
75 0 : sal_uInt16 nPos = m_pLbNamedRange->GetSelectEntryPos();
76 0 : return m_pLbNamedRange->GetEntry(nPos);
77 : }
78 :
79 0 : void ScDataPilotSourceTypeDlg::AppendNamedRange(const OUString& rName)
80 : {
81 0 : m_pLbNamedRange->InsertEntry(rName);
82 0 : if (m_pLbNamedRange->GetEntryCount() == 1)
83 : {
84 : // Select position 0 only for the first time.
85 0 : m_pLbNamedRange->SelectEntryPos(0);
86 0 : m_pBtnNamedRange->Enable();
87 : }
88 0 : }
89 :
90 0 : IMPL_LINK( ScDataPilotSourceTypeDlg, RadioClickHdl, RadioButton*, pBtn )
91 : {
92 0 : m_pLbNamedRange->Enable(pBtn == m_pBtnNamedRange);
93 0 : return 0;
94 : }
95 :
96 0 : ScDataPilotServiceDlg::ScDataPilotServiceDlg( vcl::Window* pParent,
97 : const uno::Sequence<OUString>& rServices ) :
98 0 : ModalDialog ( pParent, "DapiserviceDialog", "modules/scalc/ui/dapiservicedialog.ui" )
99 : {
100 0 : get(m_pLbService, "service");
101 0 : get(m_pEdSource, "source");
102 0 : get(m_pEdName, "name");
103 0 : get(m_pEdUser, "user");
104 0 : get(m_pEdPasswd, "password");
105 :
106 0 : long nCount = rServices.getLength();
107 0 : const OUString* pArray = rServices.getConstArray();
108 0 : for (long i=0; i<nCount; i++)
109 : {
110 0 : OUString aName = pArray[i];
111 0 : m_pLbService->InsertEntry( aName );
112 0 : }
113 0 : m_pLbService->SelectEntryPos( 0 );
114 0 : }
115 :
116 0 : ScDataPilotServiceDlg::~ScDataPilotServiceDlg()
117 : {
118 0 : }
119 :
120 0 : OUString ScDataPilotServiceDlg::GetServiceName() const
121 : {
122 0 : return m_pLbService->GetSelectEntry();
123 : }
124 :
125 0 : OUString ScDataPilotServiceDlg::GetParSource() const
126 : {
127 0 : return m_pEdSource->GetText();
128 : }
129 :
130 0 : OUString ScDataPilotServiceDlg::GetParName() const
131 : {
132 0 : return m_pEdName->GetText();
133 : }
134 :
135 0 : OUString ScDataPilotServiceDlg::GetParUser() const
136 : {
137 0 : return m_pEdUser->GetText();
138 : }
139 :
140 0 : OUString ScDataPilotServiceDlg::GetParPass() const
141 : {
142 0 : return m_pEdPasswd->GetText();
143 0 : }
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|