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