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