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 const sal_Int32 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_TYPED( ScDataPilotSourceTypeDlg
, RadioClickHdl
, Button
*, pBtn
, void )
103 m_pLbNamedRange
->Enable(pBtn
== m_pBtnNamedRange
);
106 ScDataPilotServiceDlg::ScDataPilotServiceDlg( vcl::Window
* pParent
,
107 const std::vector
<OUString
>& rServices
) :
108 ModalDialog ( pParent
, "DapiserviceDialog", "modules/scalc/ui/dapiservicedialog.ui" )
110 get(m_pLbService
, "service");
111 get(m_pEdSource
, "source");
112 get(m_pEdName
, "name");
113 get(m_pEdUser
, "user");
114 get(m_pEdPasswd
, "password");
116 for (const OUString
& aName
: rServices
)
118 m_pLbService
->InsertEntry( aName
);
120 m_pLbService
->SelectEntryPos( 0 );
123 ScDataPilotServiceDlg::~ScDataPilotServiceDlg()
128 void ScDataPilotServiceDlg::dispose()
130 m_pLbService
.clear();
135 ModalDialog::dispose();
139 OUString
ScDataPilotServiceDlg::GetServiceName() const
141 return m_pLbService
->GetSelectEntry();
144 OUString
ScDataPilotServiceDlg::GetParSource() const
146 return m_pEdSource
->GetText();
149 OUString
ScDataPilotServiceDlg::GetParName() const
151 return m_pEdName
->GetText();
154 OUString
ScDataPilotServiceDlg::GetParUser() const
156 return m_pEdUser
->GetText();
159 OUString
ScDataPilotServiceDlg::GetParPass() const
161 return m_pEdPasswd
->GetText();
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */