Branch data 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 : : #include "dlgsave.hxx"
22 : : #include "dlgsave.hrc"
23 : : #include <vcl/msgbox.hxx>
24 : : #include "dbu_dlg.hrc"
25 : : #include <com/sun/star/sdb/CommandType.hpp>
26 : : #include <com/sun/star/sdbc/XRow.hpp>
27 : : #include "sqlmessage.hxx"
28 : : #include <connectivity/dbtools.hxx>
29 : : #include "UITools.hxx"
30 : : #include "dbaccess_helpid.hrc"
31 : : #include "SqlNameEdit.hxx"
32 : : #include <vcl/button.hxx>
33 : : #include <vcl/fixed.hxx>
34 : : #include <vcl/edit.hxx>
35 : : #include <com/sun/star/container/XNameAccess.hpp>
36 : : #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
37 : : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
38 : : #include "moduledbu.hxx"
39 : : #include "objectnamecheck.hxx"
40 : : #include <tools/diagnose_ex.h>
41 : :
42 : :
43 : : using namespace dbaui;
44 : : using namespace dbtools;
45 : : using namespace ::com::sun::star::uno;
46 : : using namespace ::com::sun::star::container;
47 : : using namespace ::com::sun::star::sdb;
48 : : using namespace ::com::sun::star::sdbc;
49 : : namespace dbaui
50 : : {
51 [ # # ][ # # ]: 0 : class OSaveAsDlgImpl
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
52 : : {
53 : : public:
54 : : FixedText m_aDescription;
55 : : FixedText m_aCatalogLbl;
56 : : OSQLNameComboBox m_aCatalog;
57 : : FixedText m_aSchemaLbl;
58 : : OSQLNameComboBox m_aSchema;
59 : : FixedText m_aLabel;
60 : : OSQLNameEdit m_aTitle;
61 : : OKButton m_aPB_OK;
62 : : CancelButton m_aPB_CANCEL;
63 : : HelpButton m_aPB_HELP;
64 : : String m_aQryLabel;
65 : : String m_sTblLabel;
66 : : String m_aName;
67 : : const IObjectNameCheck&
68 : : m_rObjectNameCheck;
69 : : String m_sParentURL;
70 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xMetaData;
71 : : sal_Int32 m_nType;
72 : : sal_Int32 m_nFlags;
73 : :
74 : : OSaveAsDlgImpl( Window * pParent,const sal_Int32& _rType,
75 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
76 : : const String& rDefault,
77 : : const IObjectNameCheck& _rObjectNameCheck,
78 : : sal_Int32 _nFlags);
79 : : OSaveAsDlgImpl( Window * pParent,
80 : : const String& rDefault,
81 : : const IObjectNameCheck& _rObjectNameCheck,
82 : : sal_Int32 _nFlags);
83 : : };
84 : : // -----------------------------------------------------------------------------
85 : : } // dbaui
86 : : // -----------------------------------------------------------------------------
87 : 0 : OSaveAsDlgImpl::OSaveAsDlgImpl( Window * _pParent,
88 : : const sal_Int32& _rType,
89 : : const Reference< XConnection>& _xConnection,
90 : : const String& rDefault,
91 : : const IObjectNameCheck& _rObjectNameCheck,
92 : : sal_Int32 _nFlags)
93 : : :m_aDescription(_pParent, ModuleRes (FT_DESCRIPTION))
94 : : ,m_aCatalogLbl(_pParent, ModuleRes (FT_CATALOG))
95 : : ,m_aCatalog(_pParent, ModuleRes (ET_CATALOG), ::rtl::OUString())
96 : : ,m_aSchemaLbl(_pParent, ModuleRes (FT_SCHEMA))
97 : : ,m_aSchema(_pParent, ModuleRes (ET_SCHEMA), ::rtl::OUString())
98 : : ,m_aLabel(_pParent, ModuleRes (FT_TITLE))
99 : : ,m_aTitle(_pParent, ModuleRes (ET_TITLE), ::rtl::OUString())
100 : : ,m_aPB_OK(_pParent, ModuleRes( PB_OK ) )
101 : : ,m_aPB_CANCEL(_pParent, ModuleRes( PB_CANCEL ))
102 : : ,m_aPB_HELP(_pParent, ModuleRes( PB_HELP))
103 : : ,m_aQryLabel(ModuleRes(STR_QRY_LABEL))
104 : : ,m_sTblLabel(ModuleRes(STR_TBL_LABEL))
105 : : ,m_aName(rDefault)
106 : : ,m_rObjectNameCheck( _rObjectNameCheck )
107 : : ,m_nType(_rType)
108 [ # # ][ # # ]: 0 : ,m_nFlags(_nFlags)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
109 : : {
110 [ # # ]: 0 : if ( _xConnection.is() )
111 [ # # ][ # # ]: 0 : m_xMetaData = _xConnection->getMetaData();
[ # # ]
112 : :
113 [ # # ]: 0 : if ( m_xMetaData.is() )
114 : : {
115 [ # # ][ # # ]: 0 : ::rtl::OUString sExtraNameChars( m_xMetaData->getExtraNameCharacters() );
116 : 0 : m_aCatalog.setAllowedChars( sExtraNameChars );
117 : 0 : m_aSchema.setAllowedChars( sExtraNameChars );
118 : 0 : m_aTitle.setAllowedChars( sExtraNameChars );
119 : : }
120 : :
121 [ # # ]: 0 : m_aCatalog.SetDropDownLineCount( 10 );
122 [ # # ]: 0 : m_aSchema.SetDropDownLineCount( 10 );
123 : 0 : }
124 : : // -----------------------------------------------------------------------------
125 : 0 : OSaveAsDlgImpl::OSaveAsDlgImpl( Window * _pParent,
126 : : const String& rDefault,
127 : : const IObjectNameCheck& _rObjectNameCheck,
128 : : sal_Int32 _nFlags)
129 : : :m_aDescription(_pParent, ModuleRes (FT_DESCRIPTION))
130 : : ,m_aCatalogLbl(_pParent, ModuleRes (FT_CATALOG))
131 : : ,m_aCatalog(_pParent, ModuleRes (ET_CATALOG))
132 : : ,m_aSchemaLbl(_pParent, ModuleRes (FT_SCHEMA))
133 : : ,m_aSchema(_pParent, ModuleRes (ET_SCHEMA))
134 : : ,m_aLabel(_pParent, ModuleRes (FT_TITLE))
135 : : ,m_aTitle(_pParent, ModuleRes (ET_TITLE))
136 : : ,m_aPB_OK(_pParent, ModuleRes( PB_OK ) )
137 : : ,m_aPB_CANCEL(_pParent, ModuleRes( PB_CANCEL ))
138 : : ,m_aPB_HELP(_pParent, ModuleRes( PB_HELP))
139 : : ,m_aQryLabel(ModuleRes(STR_QRY_LABEL))
140 : : ,m_sTblLabel(ModuleRes(STR_TBL_LABEL))
141 : : ,m_aName(rDefault)
142 : : ,m_rObjectNameCheck( _rObjectNameCheck )
143 : : ,m_nType(CommandType::COMMAND)
144 [ # # ][ # # ]: 0 : ,m_nFlags(_nFlags)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
145 : : {
146 [ # # ]: 0 : m_aCatalog.SetDropDownLineCount( 10 );
147 [ # # ]: 0 : m_aSchema.SetDropDownLineCount( 10 );
148 : 0 : }
149 : :
150 : : // -----------------------------------------------------------------------------
151 : : using namespace ::com::sun::star::lang;
152 : :
153 : : //==================================================================
154 : : namespace
155 : : {
156 : : typedef Reference< XResultSet > (SAL_CALL XDatabaseMetaData::*FGetMetaStrings)();
157 : :
158 : 0 : void lcl_fillComboList( ComboBox& _rList, const Reference< XConnection >& _rxConnection,
159 : : FGetMetaStrings _GetAll, const ::rtl::OUString& _rCurrent )
160 : : {
161 : : try
162 : : {
163 [ # # ][ # # ]: 0 : Reference< XDatabaseMetaData > xMetaData( _rxConnection->getMetaData(), UNO_QUERY_THROW );
[ # # ]
164 : :
165 [ # # ][ # # ]: 0 : Reference< XResultSet > xRes = (xMetaData.get()->*_GetAll)();
[ # # ]
166 [ # # ]: 0 : Reference< XRow > xRow( xRes, UNO_QUERY_THROW );
167 : 0 : ::rtl::OUString sValue;
168 [ # # ][ # # ]: 0 : while ( xRes->next() )
[ # # ]
169 : : {
170 [ # # ][ # # ]: 0 : sValue = xRow->getString( 1 );
171 [ # # ][ # # ]: 0 : if ( !xRow->wasNull() )
[ # # ]
172 [ # # ][ # # ]: 0 : _rList.InsertEntry( sValue );
[ # # ]
173 : : }
174 : :
175 [ # # ][ # # ]: 0 : sal_uInt16 nPos = _rList.GetEntryPos( String( _rCurrent ) );
[ # # ]
176 [ # # ]: 0 : if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
177 [ # # ]: 0 : _rList.SelectEntryPos( nPos );
178 : : else
179 [ # # ][ # # ]: 0 : _rList.SelectEntryPos( 0 );
180 : : }
181 : 0 : catch( const Exception& )
182 : : {
183 : : DBG_UNHANDLED_EXCEPTION();
184 : : }
185 : 0 : }
186 : : }
187 : :
188 : : //==================================================================
189 : 0 : OSaveAsDlg::OSaveAsDlg( Window * pParent,
190 : : const sal_Int32& _rType,
191 : : const Reference< XMultiServiceFactory >& _rxORB,
192 : : const Reference< XConnection>& _xConnection,
193 : : const String& rDefault,
194 : : const IObjectNameCheck& _rObjectNameCheck,
195 : : sal_Int32 _nFlags)
196 : : :ModalDialog( pParent, ModuleRes(DLG_SAVE_AS))
197 [ # # ]: 0 : ,m_xORB( _rxORB )
198 : : {
199 [ # # ][ # # ]: 0 : m_pImpl = new OSaveAsDlgImpl(this,_rType,_xConnection,rDefault,_rObjectNameCheck,_nFlags);
200 : :
201 [ # # # ]: 0 : switch (_rType)
202 : : {
203 : : case CommandType::QUERY:
204 [ # # ]: 0 : implInitOnlyTitle(m_pImpl->m_aQryLabel);
205 : 0 : break;
206 : :
207 : : case CommandType::TABLE:
208 : : OSL_ENSURE( m_pImpl->m_xMetaData.is(), "OSaveAsDlg::OSaveAsDlg: no meta data for entering table names: this will crash!" );
209 : : {
210 [ # # ]: 0 : m_pImpl->m_aLabel.SetText(m_pImpl->m_sTblLabel);
211 [ # # ]: 0 : Point aPos(m_pImpl->m_aPB_OK.GetPosPixel());
212 [ # # ][ # # ]: 0 : if(m_pImpl->m_xMetaData.is() && !m_pImpl->m_xMetaData->supportsCatalogsInTableDefinitions())
[ # # ][ # # ]
[ # # ]
213 : : {
214 [ # # ]: 0 : m_pImpl->m_aCatalogLbl.Hide();
215 [ # # ]: 0 : m_pImpl->m_aCatalog.Hide();
216 : :
217 [ # # ]: 0 : aPos = m_pImpl->m_aLabel.GetPosPixel();
218 : :
219 [ # # ][ # # ]: 0 : m_pImpl->m_aLabel.SetPosPixel(m_pImpl->m_aSchemaLbl.GetPosPixel());
220 [ # # ][ # # ]: 0 : m_pImpl->m_aTitle.SetPosPixel(m_pImpl->m_aSchema.GetPosPixel());
221 : :
222 [ # # ][ # # ]: 0 : m_pImpl->m_aSchemaLbl.SetPosPixel(m_pImpl->m_aCatalogLbl.GetPosPixel());
223 [ # # ][ # # ]: 0 : m_pImpl->m_aSchema.SetPosPixel(m_pImpl->m_aCatalog.GetPosPixel());
224 : : }
225 : : else
226 : : {
227 : : // now fill the catalogs
228 : : lcl_fillComboList( m_pImpl->m_aCatalog, _xConnection,
229 [ # # ][ # # ]: 0 : &XDatabaseMetaData::getCatalogs, _xConnection->getCatalog() );
[ # # ]
230 : : }
231 : :
232 [ # # ][ # # ]: 0 : if ( !m_pImpl->m_xMetaData->supportsSchemasInTableDefinitions())
[ # # ]
233 : : {
234 [ # # ]: 0 : m_pImpl->m_aSchemaLbl.Hide();
235 [ # # ]: 0 : m_pImpl->m_aSchema.Hide();
236 : :
237 [ # # ]: 0 : aPos = m_pImpl->m_aLabel.GetPosPixel();
238 : :
239 [ # # ][ # # ]: 0 : m_pImpl->m_aLabel.SetPosPixel(m_pImpl->m_aSchemaLbl.GetPosPixel());
240 [ # # ][ # # ]: 0 : m_pImpl->m_aTitle.SetPosPixel(m_pImpl->m_aSchema.GetPosPixel());
241 : : }
242 : : else
243 : : {
244 : : lcl_fillComboList( m_pImpl->m_aSchema, _xConnection,
245 [ # # ][ # # ]: 0 : &XDatabaseMetaData::getSchemas, m_pImpl->m_xMetaData->getUserName() );
[ # # ]
246 : : }
247 : :
248 : : OSL_ENSURE(m_pImpl->m_xMetaData.is(),"The metadata can not be null!");
249 [ # # ][ # # ]: 0 : if(m_pImpl->m_aName.Search('.') != STRING_NOTFOUND)
250 : : {
251 : 0 : ::rtl::OUString sCatalog,sSchema,sTable;
252 : : ::dbtools::qualifiedNameComponents(m_pImpl->m_xMetaData,
253 : : m_pImpl->m_aName,
254 : : sCatalog,
255 : : sSchema,
256 : : sTable,
257 [ # # ][ # # ]: 0 : ::dbtools::eInDataManipulation);
258 : :
259 [ # # ][ # # ]: 0 : sal_uInt16 nPos = m_pImpl->m_aCatalog.GetEntryPos(String(sCatalog));
[ # # ]
260 [ # # ]: 0 : if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
261 [ # # ]: 0 : m_pImpl->m_aCatalog.SelectEntryPos(nPos);
262 : :
263 [ # # ]: 0 : if ( !sSchema.isEmpty() )
264 : : {
265 [ # # ][ # # ]: 0 : nPos = m_pImpl->m_aSchema.GetEntryPos(String(sSchema));
[ # # ]
266 [ # # ]: 0 : if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
267 [ # # ]: 0 : m_pImpl->m_aSchema.SelectEntryPos(nPos);
268 : : }
269 [ # # ][ # # ]: 0 : m_pImpl->m_aTitle.SetText(sTable);
[ # # ]
270 : : }
271 : : else
272 [ # # ]: 0 : m_pImpl->m_aTitle.SetText(m_pImpl->m_aName);
273 [ # # ]: 0 : m_pImpl->m_aTitle.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
274 : :
275 [ # # ][ # # ]: 0 : m_pImpl->m_aPB_OK.SetPosPixel(Point(m_pImpl->m_aPB_OK.GetPosPixel().X(),aPos.Y()));
276 [ # # ][ # # ]: 0 : m_pImpl->m_aPB_CANCEL.SetPosPixel(Point(m_pImpl->m_aPB_CANCEL.GetPosPixel().X(),aPos.Y()));
277 [ # # ][ # # ]: 0 : m_pImpl->m_aPB_HELP.SetPosPixel(Point(m_pImpl->m_aPB_HELP.GetPosPixel().X(),aPos.Y()));
278 : :
279 [ # # ][ # # ]: 0 : sal_uInt16 nLength = m_pImpl->m_xMetaData.is() ? static_cast<sal_uInt16>(m_pImpl->m_xMetaData->getMaxTableNameLength()) : 0;
[ # # ]
280 [ # # ]: 0 : nLength = nLength ? nLength : EDIT_NOLIMIT;
281 : :
282 [ # # ]: 0 : m_pImpl->m_aTitle.SetMaxTextLen(nLength);
283 [ # # ]: 0 : m_pImpl->m_aSchema.SetMaxTextLen(nLength);
284 [ # # ]: 0 : m_pImpl->m_aCatalog.SetMaxTextLen(nLength);
285 : :
286 [ # # ][ # # ]: 0 : sal_Bool bCheck = _xConnection.is() && isSQL92CheckEnabled(_xConnection);
[ # # ]
287 : 0 : m_pImpl->m_aTitle.setCheck(bCheck); // enable non valid sql chars as well
288 : 0 : m_pImpl->m_aSchema.setCheck(bCheck); // enable non valid sql chars as well
289 : 0 : m_pImpl->m_aCatalog.setCheck(bCheck); // enable non valid sql chars as well
290 : :
291 [ # # ]: 0 : Size aSize = GetSizePixel();
292 : 0 : aSize.Height() =
293 [ # # ][ # # ]: 0 : aPos.Y() + m_pImpl->m_aPB_OK.GetSizePixel().Height() + m_pImpl->m_aTitle.GetSizePixel().Height() / 2;
294 [ # # ]: 0 : SetSizePixel(aSize);
295 : : }
296 : 0 : break;
297 : :
298 : : default:
299 : : OSL_FAIL( "OSaveAsDlg::OSaveAsDlg: Type not supported yet!" );
300 : : }
301 : :
302 [ # # ]: 0 : implInit();
303 : 0 : }
304 : : // -----------------------------------------------------------------------------
305 : 0 : OSaveAsDlg::OSaveAsDlg( Window * pParent,
306 : : const Reference< XMultiServiceFactory >& _rxORB,
307 : : const String& rDefault,
308 : : const String& _sLabel,
309 : : const IObjectNameCheck& _rObjectNameCheck,
310 : : sal_Int32 _nFlags)
311 : : :ModalDialog( pParent, ModuleRes(DLG_SAVE_AS))
312 [ # # ]: 0 : ,m_xORB( _rxORB )
313 : : {
314 [ # # ][ # # ]: 0 : m_pImpl = new OSaveAsDlgImpl(this,rDefault,_rObjectNameCheck,_nFlags);
315 [ # # ]: 0 : implInitOnlyTitle(_sLabel);
316 [ # # ]: 0 : implInit();
317 : 0 : }
318 : : // -----------------------------------------------------------------------------
319 : 0 : OSaveAsDlg::~OSaveAsDlg()
320 : : {
321 [ # # ][ # # ]: 0 : DELETEZ(m_pImpl);
322 [ # # ]: 0 : }
323 : : // -----------------------------------------------------------------------------
324 : 0 : IMPL_LINK(OSaveAsDlg, ButtonClickHdl, Button *, pButton)
325 : : {
326 [ # # ]: 0 : if (pButton == &m_pImpl->m_aPB_OK)
327 : : {
328 [ # # ][ # # ]: 0 : m_pImpl->m_aName = m_pImpl->m_aTitle.GetText();
[ # # ]
329 : :
330 [ # # ]: 0 : ::rtl::OUString sNameToCheck( m_pImpl->m_aName );
331 : :
332 [ # # ]: 0 : if ( m_pImpl->m_nType == CommandType::TABLE )
333 : : {
334 : : sNameToCheck = ::dbtools::composeTableName(
335 : : m_pImpl->m_xMetaData,
336 : : getCatalog(),
337 : : getSchema(),
338 : : sNameToCheck,
339 : : sal_False, // no quoting
340 : : ::dbtools::eInDataManipulation
341 [ # # ][ # # ]: 0 : );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
342 : : }
343 : :
344 [ # # ]: 0 : SQLExceptionInfo aNameError;
345 [ # # ][ # # ]: 0 : if ( m_pImpl->m_rObjectNameCheck.isNameValid( sNameToCheck, aNameError ) )
346 [ # # ]: 0 : EndDialog( RET_OK );
347 : :
348 [ # # ]: 0 : showError( aNameError, this, m_xORB );
349 [ # # ][ # # ]: 0 : m_pImpl->m_aTitle.GrabFocus();
350 : : }
351 : 0 : return 0;
352 : : }
353 : : // -----------------------------------------------------------------------------
354 : :
355 : 0 : IMPL_LINK(OSaveAsDlg, EditModifyHdl, Edit *, pEdit )
356 : : {
357 [ # # ]: 0 : if (pEdit == &m_pImpl->m_aTitle)
358 [ # # ]: 0 : m_pImpl->m_aPB_OK.Enable(0 != m_pImpl->m_aTitle.GetText().Len());
359 : 0 : return 0;
360 : : }
361 : : // -----------------------------------------------------------------------------
362 : 0 : void OSaveAsDlg::implInitOnlyTitle(const String& _rLabel)
363 : : {
364 [ # # ]: 0 : m_pImpl->m_aLabel.SetText(_rLabel);
365 [ # # ]: 0 : m_pImpl->m_aCatalogLbl.Hide();
366 [ # # ]: 0 : m_pImpl->m_aCatalog.Hide();
367 [ # # ]: 0 : m_pImpl->m_aSchemaLbl.Hide();
368 [ # # ]: 0 : m_pImpl->m_aSchema.Hide();
369 : :
370 [ # # ]: 0 : Point aPos(m_pImpl->m_aSchemaLbl.GetPosPixel());
371 [ # # ][ # # ]: 0 : m_pImpl->m_aLabel.SetPosPixel(m_pImpl->m_aCatalogLbl.GetPosPixel());
372 [ # # ][ # # ]: 0 : m_pImpl->m_aTitle.SetPosPixel(m_pImpl->m_aCatalog.GetPosPixel());
373 : :
374 [ # # ][ # # ]: 0 : m_pImpl->m_aPB_OK.SetPosPixel(Point(m_pImpl->m_aPB_OK.GetPosPixel().X(),aPos.Y()));
375 [ # # ][ # # ]: 0 : m_pImpl->m_aPB_CANCEL.SetPosPixel(Point(m_pImpl->m_aPB_CANCEL.GetPosPixel().X(),aPos.Y()));
376 [ # # ][ # # ]: 0 : m_pImpl->m_aPB_HELP.SetPosPixel(Point(m_pImpl->m_aPB_HELP.GetPosPixel().X(),aPos.Y()));
377 : :
378 : : sal_Int32 nNewHeight =
379 [ # # ][ # # ]: 0 : aPos.Y() + m_pImpl->m_aPB_OK.GetSizePixel().Height() + m_pImpl->m_aTitle.GetSizePixel().Height() / 2;
380 : :
381 [ # # ][ # # ]: 0 : SetSizePixel(Size(GetSizePixel().Width(), nNewHeight));
382 : :
383 [ # # ]: 0 : m_pImpl->m_aTitle.SetText(m_pImpl->m_aName);
384 : 0 : m_pImpl->m_aTitle.setCheck(sal_False); // enable non valid sql chars as well
385 : 0 : }
386 : : // -----------------------------------------------------------------------------
387 : 0 : void OSaveAsDlg::implInit()
388 : : {
389 [ # # ]: 0 : if ( 0 == ( m_pImpl->m_nFlags & SAD_ADDITIONAL_DESCRIPTION ) )
390 : : {
391 : : // hide the description window
392 [ # # ]: 0 : m_pImpl->m_aDescription.Hide();
393 : :
394 : : // the number of pixels we have to move the other controls
395 [ # # ][ # # ]: 0 : sal_Int32 nMoveUp = m_pImpl->m_aCatalog.GetPosPixel().Y() - m_pImpl->m_aDescription.GetPosPixel().Y();
396 : :
397 : : // loop to all controls and move them ...
398 [ # # ][ # # ]: 0 : for ( Window* pChildControl = GetWindow( WINDOW_FIRSTCHILD );
[ # # ]
399 : : pChildControl;
400 : : pChildControl= pChildControl->GetWindow( WINDOW_NEXT )
401 : : )
402 : : {
403 [ # # ]: 0 : if ( &m_pImpl->m_aDescription != pChildControl )
404 : : {
405 [ # # ]: 0 : Point aPos = pChildControl->GetPosPixel();
406 : 0 : aPos.Y() -= nMoveUp;
407 [ # # ]: 0 : pChildControl->SetPosPixel(aPos);
408 : : }
409 : : }
410 : :
411 : : // change our own size accordingly
412 [ # # ]: 0 : Size aSize = GetSizePixel();
413 : 0 : aSize.Height() -= nMoveUp;
414 [ # # ]: 0 : SetSizePixel(aSize);
415 : : }
416 : :
417 [ # # ]: 0 : if ( SAD_TITLE_PASTE_AS == ( m_pImpl->m_nFlags & SAD_TITLE_PASTE_AS ) )
418 [ # # ][ # # ]: 0 : SetText( String( ModuleRes( STR_TITLE_PASTE_AS ) ) );
[ # # ]
419 [ # # ]: 0 : else if ( SAD_TITLE_RENAME == ( m_pImpl->m_nFlags & SAD_TITLE_RENAME ) )
420 : : {
421 [ # # ][ # # ]: 0 : SetText( String( ModuleRes( STR_TITLE_RENAME ) ) );
[ # # ]
422 [ # # ]: 0 : m_pImpl->m_aTitle.SetHelpId(HID_DLG_RENAME);
423 : : }
424 : :
425 : 0 : m_pImpl->m_aPB_OK.SetClickHdl(LINK(this,OSaveAsDlg,ButtonClickHdl));
426 : 0 : m_pImpl->m_aTitle.SetModifyHdl(LINK(this,OSaveAsDlg,EditModifyHdl));
427 : 0 : m_pImpl->m_aTitle.GrabFocus();
428 : 0 : FreeResource();
429 : 0 : }
430 : : // -----------------------------------------------------------------------------
431 : 0 : String OSaveAsDlg::getName() const { return m_pImpl->m_aName; }
432 [ # # ]: 0 : String OSaveAsDlg::getCatalog() const { return m_pImpl->m_aCatalog.IsVisible() ? m_pImpl->m_aCatalog.GetText() : String(); }
433 [ # # ]: 0 : String OSaveAsDlg::getSchema() const { return m_pImpl->m_aSchema.IsVisible() ? m_pImpl->m_aSchema.GetText() : String(); }
434 : :
435 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|