Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #undef SC_DLLIMPLEMENTATION
31 : :
32 : :
33 : :
34 : : //------------------------------------------------------------------
35 : :
36 : : #include "dapitype.hxx"
37 : : #include "scresid.hxx"
38 : : #include "sc.hrc"
39 : : #include "dapitype.hrc"
40 : :
41 : : using namespace com::sun::star;
42 : : using ::rtl::OUString;
43 : :
44 : : //-------------------------------------------------------------------------
45 : :
46 : 0 : ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg( Window* pParent, sal_Bool bEnableExternal ) :
47 : : ModalDialog ( pParent, ScResId( RID_SCDLG_DAPITYPE ) ),
48 : : //
49 : : aFlFrame ( this, ScResId( FL_FRAME ) ),
50 : : aBtnSelection ( this, ScResId( BTN_SELECTION ) ),
51 : : aBtnNamedRange ( this, ScResId( BTN_NAMED_RANGE ) ),
52 : : aBtnDatabase ( this, ScResId( BTN_DATABASE ) ),
53 : : aBtnExternal ( this, ScResId( BTN_EXTERNAL ) ),
54 : : aLbNamedRange ( this, ScResId( LB_NAMED_RANGE ) ),
55 : : aBtnOk ( this, ScResId( BTN_OK ) ),
56 : : aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
57 : 0 : aBtnHelp ( this, ScResId( BTN_HELP ) )
58 : : {
59 : 0 : aBtnSelection.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
60 : 0 : aBtnNamedRange.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
61 : 0 : aBtnDatabase.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
62 : 0 : aBtnExternal.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
63 : :
64 : 0 : if (!bEnableExternal)
65 : 0 : aBtnExternal.Disable();
66 : :
67 : 0 : aBtnSelection.Check();
68 : :
69 : : // Disabled unless at least one named range exists.
70 : 0 : aLbNamedRange.Disable();
71 : 0 : aBtnNamedRange.Disable();
72 : :
73 : 0 : FreeResource();
74 : 0 : }
75 : :
76 : 0 : ScDataPilotSourceTypeDlg::~ScDataPilotSourceTypeDlg()
77 : : {
78 : 0 : }
79 : :
80 : 0 : bool ScDataPilotSourceTypeDlg::IsDatabase() const
81 : : {
82 : 0 : return aBtnDatabase.IsChecked();
83 : : }
84 : :
85 : 0 : bool ScDataPilotSourceTypeDlg::IsExternal() const
86 : : {
87 : 0 : return aBtnExternal.IsChecked();
88 : : }
89 : :
90 : 0 : bool ScDataPilotSourceTypeDlg::IsNamedRange() const
91 : : {
92 : 0 : return aBtnNamedRange.IsChecked();
93 : : }
94 : :
95 : 0 : OUString ScDataPilotSourceTypeDlg::GetSelectedNamedRange() const
96 : : {
97 : 0 : sal_uInt16 nPos = aLbNamedRange.GetSelectEntryPos();
98 : 0 : return aLbNamedRange.GetEntry(nPos);
99 : : }
100 : :
101 : 0 : void ScDataPilotSourceTypeDlg::AppendNamedRange(const OUString& rName)
102 : : {
103 : 0 : aLbNamedRange.InsertEntry(rName);
104 : 0 : if (aLbNamedRange.GetEntryCount() == 1)
105 : : {
106 : : // Select position 0 only for the first time.
107 : 0 : aLbNamedRange.SelectEntryPos(0);
108 : 0 : aBtnNamedRange.Enable();
109 : : }
110 : 0 : }
111 : :
112 : 0 : IMPL_LINK( ScDataPilotSourceTypeDlg, RadioClickHdl, RadioButton*, pBtn )
113 : : {
114 : 0 : aLbNamedRange.Enable(pBtn == &aBtnNamedRange);
115 : 0 : return 0;
116 : : }
117 : :
118 : : //-------------------------------------------------------------------------
119 : :
120 : 0 : ScDataPilotServiceDlg::ScDataPilotServiceDlg( Window* pParent,
121 : : const uno::Sequence<rtl::OUString>& rServices ) :
122 : : ModalDialog ( pParent, ScResId( RID_SCDLG_DAPISERVICE ) ),
123 : : //
124 : : aFlFrame ( this, ScResId( FL_FRAME ) ),
125 : : aFtService ( this, ScResId( FT_SERVICE ) ),
126 : : aLbService ( this, ScResId( LB_SERVICE ) ),
127 : : aFtSource ( this, ScResId( FT_SOURCE ) ),
128 : : aEdSource ( this, ScResId( ED_SOURCE ) ),
129 : : aFtName ( this, ScResId( FT_NAME ) ),
130 : : aEdName ( this, ScResId( ED_NAME ) ),
131 : : aFtUser ( this, ScResId( FT_USER ) ),
132 : : aEdUser ( this, ScResId( ED_USER ) ),
133 : : aFtPasswd ( this, ScResId( FT_PASSWD ) ),
134 : : aEdPasswd ( this, ScResId( ED_PASSWD ) ),
135 : : aBtnOk ( this, ScResId( BTN_OK ) ),
136 : : aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
137 : 0 : aBtnHelp ( this, ScResId( BTN_HELP ) )
138 : : {
139 : 0 : long nCount = rServices.getLength();
140 : 0 : const rtl::OUString* pArray = rServices.getConstArray();
141 : 0 : for (long i=0; i<nCount; i++)
142 : : {
143 : 0 : String aName = pArray[i];
144 : 0 : aLbService.InsertEntry( aName );
145 : 0 : }
146 : 0 : aLbService.SelectEntryPos( 0 );
147 : :
148 : 0 : FreeResource();
149 : 0 : }
150 : :
151 : 0 : ScDataPilotServiceDlg::~ScDataPilotServiceDlg()
152 : : {
153 : 0 : }
154 : :
155 : 0 : String ScDataPilotServiceDlg::GetServiceName() const
156 : : {
157 : 0 : return aLbService.GetSelectEntry();
158 : : }
159 : :
160 : 0 : String ScDataPilotServiceDlg::GetParSource() const
161 : : {
162 : 0 : return aEdSource.GetText();
163 : : }
164 : :
165 : 0 : String ScDataPilotServiceDlg::GetParName() const
166 : : {
167 : 0 : return aEdName.GetText();
168 : : }
169 : :
170 : 0 : String ScDataPilotServiceDlg::GetParUser() const
171 : : {
172 : 0 : return aEdUser.GetText();
173 : : }
174 : :
175 : 0 : String ScDataPilotServiceDlg::GetParPass() const
176 : : {
177 : 0 : return aEdPasswd.GetText();
178 : : }
179 : :
180 : :
181 : :
182 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|