fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sc / source / ui / dbgui / dapitype.cxx
blobc2a7bdd1ebe89f052d5e8adb4ce098a96fb5fe6b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 #undef SC_DLLIMPLEMENTATION
25 //------------------------------------------------------------------
27 #include "dapitype.hxx"
28 #include "scresid.hxx"
29 #include "sc.hrc"
30 #include "dapitype.hrc"
32 using namespace com::sun::star;
34 //-------------------------------------------------------------------------
36 ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg(Window* pParent, bool bEnableExternal)
37 : ModalDialog( pParent, "SelectSourceDialog", "modules/scalc/ui/selectsource.ui" )
39 get(m_pBtnSelection, "selection");
40 get(m_pBtnNamedRange, "namedrange");
41 get(m_pBtnDatabase, "database");
42 get(m_pBtnExternal, "external");
43 get(m_pLbNamedRange, "rangelb");
44 m_pBtnSelection->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
45 m_pBtnNamedRange->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
46 m_pBtnDatabase->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
47 m_pBtnExternal->SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
49 if (!bEnableExternal)
50 m_pBtnExternal->Disable();
52 m_pBtnSelection->Check();
54 // Disabled unless at least one named range exists.
55 m_pLbNamedRange->Disable();
56 m_pBtnNamedRange->Disable();
58 // Intentionally hide this button to see if anyone complains.
59 m_pBtnExternal->Show(false);
62 ScDataPilotSourceTypeDlg::~ScDataPilotSourceTypeDlg()
66 bool ScDataPilotSourceTypeDlg::IsDatabase() const
68 return m_pBtnDatabase->IsChecked();
71 bool ScDataPilotSourceTypeDlg::IsExternal() const
73 return m_pBtnExternal->IsChecked();
76 bool ScDataPilotSourceTypeDlg::IsNamedRange() const
78 return m_pBtnNamedRange->IsChecked();
81 OUString ScDataPilotSourceTypeDlg::GetSelectedNamedRange() const
83 sal_uInt16 nPos = m_pLbNamedRange->GetSelectEntryPos();
84 return m_pLbNamedRange->GetEntry(nPos);
87 void ScDataPilotSourceTypeDlg::AppendNamedRange(const OUString& rName)
89 m_pLbNamedRange->InsertEntry(rName);
90 if (m_pLbNamedRange->GetEntryCount() == 1)
92 // Select position 0 only for the first time.
93 m_pLbNamedRange->SelectEntryPos(0);
94 m_pBtnNamedRange->Enable();
98 IMPL_LINK( ScDataPilotSourceTypeDlg, RadioClickHdl, RadioButton*, pBtn )
100 m_pLbNamedRange->Enable(pBtn == m_pBtnNamedRange);
101 return 0;
104 //-------------------------------------------------------------------------
106 ScDataPilotServiceDlg::ScDataPilotServiceDlg( Window* pParent,
107 const uno::Sequence<OUString>& rServices ) :
108 ModalDialog ( pParent, ScResId( RID_SCDLG_DAPISERVICE ) ),
110 aFlFrame ( this, ScResId( FL_FRAME ) ),
111 aFtService ( this, ScResId( FT_SERVICE ) ),
112 aLbService ( this, ScResId( LB_SERVICE ) ),
113 aFtSource ( this, ScResId( FT_SOURCE ) ),
114 aEdSource ( this, ScResId( ED_SOURCE ) ),
115 aFtName ( this, ScResId( FT_NAME ) ),
116 aEdName ( this, ScResId( ED_NAME ) ),
117 aFtUser ( this, ScResId( FT_USER ) ),
118 aEdUser ( this, ScResId( ED_USER ) ),
119 aFtPasswd ( this, ScResId( FT_PASSWD ) ),
120 aEdPasswd ( this, ScResId( ED_PASSWD ) ),
121 aBtnOk ( this, ScResId( BTN_OK ) ),
122 aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
123 aBtnHelp ( this, ScResId( BTN_HELP ) )
125 long nCount = rServices.getLength();
126 const OUString* pArray = rServices.getConstArray();
127 for (long i=0; i<nCount; i++)
129 String aName = pArray[i];
130 aLbService.InsertEntry( aName );
132 aLbService.SelectEntryPos( 0 );
134 FreeResource();
137 ScDataPilotServiceDlg::~ScDataPilotServiceDlg()
141 String ScDataPilotServiceDlg::GetServiceName() const
143 return aLbService.GetSelectEntry();
146 String ScDataPilotServiceDlg::GetParSource() const
148 return aEdSource.GetText();
151 String ScDataPilotServiceDlg::GetParName() const
153 return aEdName.GetText();
156 String ScDataPilotServiceDlg::GetParUser() const
158 return aEdUser.GetText();
161 String ScDataPilotServiceDlg::GetParPass() const
163 return aEdPasswd.GetText();
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */