1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #undef SC_DLLIMPLEMENTATION
22 #include "dapitype.hxx"
23 #include "scresid.hxx"
26 using namespace com::sun::star
;
28 ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg(vcl::Window
* pParent
, bool bEnableExternal
)
29 : ModalDialog( pParent
, "SelectSourceDialog", "modules/scalc/ui/selectsource.ui" )
31 get(m_pBtnSelection
, "selection");
32 get(m_pBtnNamedRange
, "namedrange");
33 get(m_pBtnDatabase
, "database");
34 get(m_pBtnExternal
, "external");
35 get(m_pLbNamedRange
, "rangelb");
36 m_pBtnSelection
->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg
, RadioClickHdl
) );
37 m_pBtnNamedRange
->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg
, RadioClickHdl
) );
38 m_pBtnDatabase
->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg
, RadioClickHdl
) );
39 m_pBtnExternal
->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg
, RadioClickHdl
) );
42 m_pBtnExternal
->Disable();
44 m_pBtnSelection
->Check();
46 // Disabled unless at least one named range exists.
47 m_pLbNamedRange
->Disable();
48 m_pBtnNamedRange
->Disable();
50 // Intentionally hide this button to see if anyone complains.
51 m_pBtnExternal
->Show(false);
54 ScDataPilotSourceTypeDlg::~ScDataPilotSourceTypeDlg()
59 void ScDataPilotSourceTypeDlg::dispose()
61 m_pBtnSelection
.clear();
62 m_pBtnNamedRange
.clear();
63 m_pBtnDatabase
.clear();
64 m_pBtnExternal
.clear();
65 m_pLbNamedRange
.clear();
66 ModalDialog::dispose();
69 bool ScDataPilotSourceTypeDlg::IsDatabase() const
71 return m_pBtnDatabase
->IsChecked();
74 bool ScDataPilotSourceTypeDlg::IsExternal() const
76 return m_pBtnExternal
->IsChecked();
79 bool ScDataPilotSourceTypeDlg::IsNamedRange() const
81 return m_pBtnNamedRange
->IsChecked();
84 OUString
ScDataPilotSourceTypeDlg::GetSelectedNamedRange() const
86 sal_uInt16 nPos
= m_pLbNamedRange
->GetSelectEntryPos();
87 return m_pLbNamedRange
->GetEntry(nPos
);
90 void ScDataPilotSourceTypeDlg::AppendNamedRange(const OUString
& rName
)
92 m_pLbNamedRange
->InsertEntry(rName
);
93 if (m_pLbNamedRange
->GetEntryCount() == 1)
95 // Select position 0 only for the first time.
96 m_pLbNamedRange
->SelectEntryPos(0);
97 m_pBtnNamedRange
->Enable();
101 IMPL_LINK( ScDataPilotSourceTypeDlg
, RadioClickHdl
, RadioButton
*, pBtn
)
103 m_pLbNamedRange
->Enable(pBtn
== m_pBtnNamedRange
);
107 ScDataPilotServiceDlg::ScDataPilotServiceDlg( vcl::Window
* pParent
,
108 const uno::Sequence
<OUString
>& rServices
) :
109 ModalDialog ( pParent
, "DapiserviceDialog", "modules/scalc/ui/dapiservicedialog.ui" )
111 get(m_pLbService
, "service");
112 get(m_pEdSource
, "source");
113 get(m_pEdName
, "name");
114 get(m_pEdUser
, "user");
115 get(m_pEdPasswd
, "password");
117 long nCount
= rServices
.getLength();
118 const OUString
* pArray
= rServices
.getConstArray();
119 for (long i
=0; i
<nCount
; i
++)
121 OUString aName
= pArray
[i
];
122 m_pLbService
->InsertEntry( aName
);
124 m_pLbService
->SelectEntryPos( 0 );
127 ScDataPilotServiceDlg::~ScDataPilotServiceDlg()
132 void ScDataPilotServiceDlg::dispose()
134 m_pLbService
.clear();
139 ModalDialog::dispose();
143 OUString
ScDataPilotServiceDlg::GetServiceName() const
145 return m_pLbService
->GetSelectEntry();
148 OUString
ScDataPilotServiceDlg::GetParSource() const
150 return m_pEdSource
->GetText();
153 OUString
ScDataPilotServiceDlg::GetParName() const
155 return m_pEdName
->GetText();
158 OUString
ScDataPilotServiceDlg::GetParUser() const
160 return m_pEdUser
->GetText();
163 OUString
ScDataPilotServiceDlg::GetParPass() const
165 return m_pEdPasswd
->GetText();
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */