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 : : #include "WTypeSelect.hxx"
21 : : #include "WizardPages.hrc"
22 : : #include "dbustrings.hrc"
23 : : #include <tools/diagnose_ex.h>
24 : : #include <osl/diagnose.h>
25 : : #include "FieldDescriptions.hxx"
26 : : #include "WCopyTable.hxx"
27 : : #include "dbaccess_helpid.hrc"
28 : : #include "dbu_misc.hrc"
29 : : #include <tools/stream.hxx>
30 : : #include <svtools/svparser.hxx>
31 : : #include "UITools.hxx"
32 : : #include "sqlmessage.hxx"
33 : : #include "FieldControls.hxx"
34 : :
35 : : #include "dbaccess_slotid.hrc"
36 : :
37 : : using namespace ::dbaui;
38 : : using namespace ::com::sun::star::uno;
39 : : using namespace ::com::sun::star::beans;
40 : : using namespace ::com::sun::star::container;
41 : : using namespace ::com::sun::star::util;
42 : : using namespace ::com::sun::star::sdbc;
43 : :
44 : : //========================================================================
45 : : // OWizTypeSelectControl
46 : : DBG_NAME(OWizTypeSelectControl)
47 : : //========================================================================
48 : 0 : OWizTypeSelectControl::OWizTypeSelectControl(Window* pParent, const ResId& rResId,OTableDesignHelpBar* pHelpBar)
49 : 0 : : OFieldDescControl(pParent,rResId,pHelpBar)
50 : : {
51 : : DBG_CTOR(OWizTypeSelectControl,NULL);
52 : :
53 : 0 : }
54 : : // -----------------------------------------------------------------------------
55 : 0 : OWizTypeSelectControl::~OWizTypeSelectControl()
56 : : {
57 : :
58 : : DBG_DTOR(OWizTypeSelectControl,NULL);
59 [ # # ]: 0 : }
60 : : // -----------------------------------------------------------------------
61 : 0 : void OWizTypeSelectControl::ActivateAggregate( EControlType eType )
62 : : {
63 [ # # ]: 0 : switch(eType )
64 : : {
65 : : case tpFormat:
66 : : case tpDefault:
67 : : case tpAutoIncrement:
68 : : case tpAutoIncrementValue:
69 : 0 : break;
70 : : default:
71 : 0 : OFieldDescControl::ActivateAggregate( eType );
72 : : }
73 : 0 : }
74 : : // -----------------------------------------------------------------------
75 : 0 : void OWizTypeSelectControl::DeactivateAggregate( EControlType eType )
76 : : {
77 [ # # ]: 0 : switch(eType )
78 : : {
79 : : case tpFormat:
80 : : case tpDefault:
81 : : case tpAutoIncrement:
82 : : case tpAutoIncrementValue:
83 : 0 : break;
84 : : default:
85 : 0 : OFieldDescControl::DeactivateAggregate( eType );
86 : : }
87 : 0 : }
88 : : // -----------------------------------------------------------------------
89 : 0 : void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
90 : : {
91 : : OSL_ENSURE(nRow == -1,"nRow muss -1 sein!");
92 : : (void)nRow;
93 : :
94 [ # # ]: 0 : MultiListBox &aListBox = ((OWizTypeSelect*)GetParent())->m_lbColumnNames;
95 : :
96 : 0 : OFieldDescription* pCurFieldDescr = getCurrentFieldDescData();
97 : :
98 [ # # ][ # # ]: 0 : sal_uInt16 nPos = aListBox.GetEntryPos( String( pCurFieldDescr->GetName() ) );
[ # # ][ # # ]
99 [ # # ]: 0 : pCurFieldDescr = static_cast< OFieldDescription* >( aListBox.GetEntryData( nPos ) );
100 : : OSL_ENSURE( pCurFieldDescr, "OWizTypeSelectControl::CellModified: Columnname/type not found in the listbox!" );
101 [ # # ]: 0 : if ( !pCurFieldDescr )
102 : : return;
103 : 0 : setCurrentFieldDescData( pCurFieldDescr );
104 : :
105 [ # # ]: 0 : ::rtl::OUString sName = pCurFieldDescr->GetName();
106 : 0 : ::rtl::OUString sNewName;
107 : 0 : const OPropColumnEditCtrl* pColumnName = getColumnCtrl();
108 [ # # ]: 0 : if ( pColumnName )
109 [ # # ][ # # ]: 0 : sNewName = pColumnName->GetText();
[ # # ]
110 : :
111 [ # # ]: 0 : switch(nColId)
112 : : {
113 : : case FIELD_PRPOERTY_COLUMNNAME:
114 : : {
115 [ # # ][ # # ]: 0 : OCopyTableWizard* pWiz = static_cast<OCopyTableWizard*>(GetParent()->GetParent());
116 : : // first we have to check if this name already exists
117 : 0 : sal_Bool bDoubleName = sal_False;
118 : 0 : sal_Bool bCase = sal_True;
119 [ # # ][ # # ]: 0 : if ( getMetaData().is() && !getMetaData()->supportsMixedCaseQuotedIdentifiers() )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ]
120 : : {
121 : 0 : bCase = sal_False;
122 [ # # ]: 0 : sal_uInt16 nCount = aListBox.GetEntryCount();
123 [ # # ][ # # ]: 0 : for (sal_uInt16 i=0 ; !bDoubleName && i < nCount ; ++i)
[ # # ]
124 : : {
125 [ # # ][ # # ]: 0 : ::rtl::OUString sEntry(aListBox.GetEntry(i));
[ # # ]
126 : 0 : bDoubleName = sNewName.equalsIgnoreAsciiCase(sEntry);
127 : 0 : }
128 [ # # ][ # # ]: 0 : if ( !bDoubleName && pWiz->shouldCreatePrimaryKey() )
[ # # ][ # # ]
129 : 0 : bDoubleName = sNewName.equalsIgnoreAsciiCase(pWiz->getPrimaryKeyName());
130 : :
131 : : }
132 : : else
133 [ # # ][ # # ]: 0 : bDoubleName = ((aListBox.GetEntryPos(String(sNewName)) != LISTBOX_ENTRY_NOTFOUND)
[ # # ][ # # ]
[ # # ]
134 [ # # ]: 0 : || ( pWiz->shouldCreatePrimaryKey()
135 [ # # ][ # # ]: 0 : && pWiz->getPrimaryKeyName() == sNewName) );
[ # # ][ # # ]
[ # # ]
136 : :
137 [ # # ]: 0 : if ( bDoubleName )
138 : : {
139 [ # # ][ # # ]: 0 : String strMessage = String(ModuleRes(STR_TABLEDESIGN_DUPLICATE_NAME));
140 [ # # ][ # # ]: 0 : strMessage.SearchAndReplaceAscii("$column$", sNewName);
[ # # ]
141 [ # # ][ # # ]: 0 : pWiz->showError(strMessage);
142 [ # # ]: 0 : pCurFieldDescr->SetName(sName);
143 [ # # ]: 0 : DisplayData(pCurFieldDescr);
144 [ # # ]: 0 : static_cast<OWizTypeSelect*>(GetParent())->setDuplicateName(sal_True);
145 [ # # ]: 0 : return;
146 : : }
147 : :
148 [ # # ]: 0 : ::rtl::OUString sOldName = pCurFieldDescr->GetName();
149 [ # # ]: 0 : pCurFieldDescr->SetName(sNewName);
150 [ # # ]: 0 : static_cast<OWizTypeSelect*>(GetParent())->setDuplicateName(sal_False);
151 : :
152 : : // now we change the name
153 : 0 : OCopyTableWizard::TNameMapping::iterator aIter = pWiz->m_mNameMapping.begin();
154 : 0 : OCopyTableWizard::TNameMapping::iterator aEnd = pWiz->m_mNameMapping.end();
155 : :
156 : 0 : ::comphelper::UStringMixEqual aCase(bCase);
157 [ # # ]: 0 : for(;aIter != aEnd;++aIter)
158 : : {
159 [ # # ]: 0 : if ( aCase(aIter->second,sName) )
160 : : {
161 : 0 : aIter->second = sNewName;
162 : 0 : break;
163 : : }
164 : : }
165 : :
166 [ # # ]: 0 : aListBox.RemoveEntry(nPos);
167 [ # # ][ # # ]: 0 : aListBox.InsertEntry(pCurFieldDescr->GetName(),nPos);
[ # # ][ # # ]
168 [ # # ]: 0 : aListBox.SetEntryData(nPos,pCurFieldDescr);
169 : :
170 [ # # ]: 0 : pWiz->replaceColumn(nPos,pCurFieldDescr,sOldName);
171 : : }
172 : 0 : break;
173 : : }
174 [ # # ][ # # ]: 0 : saveCurrentFieldDescData();
[ # # ]
175 : : }
176 : : // -----------------------------------------------------------------------------
177 : 0 : ::com::sun::star::lang::Locale OWizTypeSelectControl::GetLocale() const
178 : : {
179 : 0 : return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->GetLocale();
180 : : }
181 : : // -----------------------------------------------------------------------------
182 : 0 : Reference< XNumberFormatter > OWizTypeSelectControl::GetFormatter() const
183 : : {
184 : 0 : return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->GetFormatter();
185 : : }
186 : : // -----------------------------------------------------------------------------
187 : 0 : TOTypeInfoSP OWizTypeSelectControl::getTypeInfo(sal_Int32 _nPos)
188 : : {
189 : 0 : return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->getDestTypeInfo(_nPos);
190 : : }
191 : : // -----------------------------------------------------------------------------
192 : 0 : const OTypeInfoMap* OWizTypeSelectControl::getTypeInfo() const
193 : : {
194 : 0 : return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->getDestTypeInfo();
195 : : }
196 : : // -----------------------------------------------------------------------------
197 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> OWizTypeSelectControl::getMetaData()
198 : : {
199 : 0 : return ((OWizTypeSelect*)GetParent())->m_pParent->m_xDestConnection->getMetaData();
200 : : }
201 : : // -----------------------------------------------------------------------------
202 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> OWizTypeSelectControl::getConnection()
203 : : {
204 : 0 : return ((OWizTypeSelect*)GetParent())->m_pParent->m_xDestConnection;
205 : : }
206 : : // -----------------------------------------------------------------------------
207 : 0 : sal_Bool OWizTypeSelectControl::isAutoIncrementValueEnabled() const
208 : : {
209 : 0 : return ((OWizTypeSelect*)GetParent())->m_bAutoIncrementEnabled;
210 : : }
211 : : // -----------------------------------------------------------------------------
212 : 0 : ::rtl::OUString OWizTypeSelectControl::getAutoIncrementValue() const
213 : : {
214 : 0 : return ((OWizTypeSelect*)GetParent())->m_sAutoIncrementValue;
215 : : }
216 : : // -----------------------------------------------------------------------------
217 : :
218 : : //========================================================================
219 : : DBG_NAME(OWizTypeSelect);
220 : : #define IMG_PRIMARY_KEY 1
221 : : //========================================================================
222 : 0 : OWizTypeSelect::OWizTypeSelect( Window* pParent, SvStream* _pStream )
223 : : :OWizardPage( pParent, ModuleRes( TAB_WIZ_TYPE_SELECT ))
224 : : ,m_lbColumnNames( this, ModuleRes( LB_NEW_COLUMN_NAMES ) )
225 : : ,m_flColumns( this, ModuleRes( FL_COLUMN_NAME ) )
226 : : ,m_aTypeControl( this, ModuleRes( CONTROL_CONTAINER ))
227 : : ,m_flAutoType( this, ModuleRes( FL_AUTO_TYPE ) )
228 : : ,m_ftAuto( this, ModuleRes( FT_AUTO ) )
229 : : ,m_etAuto( this, ModuleRes( ET_AUTO ) )
230 : : ,m_pbAuto( this, ModuleRes( PB_AUTO ) )
231 : : ,m_pParserStream( _pStream )
232 : : ,m_nDisplayRow(0)
233 : : ,m_bAutoIncrementEnabled(sal_False)
234 [ # # ][ # # ]: 0 : ,m_bDuplicateName(sal_False)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
235 : : {
236 : : DBG_CTOR(OWizTypeSelect,NULL);
237 [ # # ]: 0 : m_lbColumnNames.SetSelectHdl(LINK(this,OWizTypeSelect,ColumnSelectHdl));
238 : :
239 [ # # ]: 0 : ModuleRes aModuleRes(IMG_JOINS);
240 [ # # ]: 0 : ImageList aImageList(aModuleRes);
241 [ # # ][ # # ]: 0 : m_imgPKey = aImageList.GetImage(IMG_PRIMARY_KEY);
[ # # ]
242 : :
243 [ # # ]: 0 : m_aTypeControl.Show();
244 [ # # ]: 0 : m_aTypeControl.Init();
245 [ # # ][ # # ]: 0 : m_etAuto.SetText(rtl::OUString("10"));
[ # # ][ # # ]
246 [ # # ]: 0 : m_etAuto.SetDecimalDigits(0);
247 [ # # ]: 0 : m_pbAuto.SetClickHdl(LINK(this,OWizTypeSelect,ButtonClickHdl));
248 [ # # ]: 0 : m_lbColumnNames.EnableMultiSelection(sal_True);
249 : :
250 : : try
251 : : {
252 [ # # ]: 0 : m_lbColumnNames.SetPKey( m_pParent->supportsPrimaryKey() );
253 [ # # ]: 0 : ::dbaui::fillAutoIncrementValue( m_pParent->m_xDestConnection, m_bAutoIncrementEnabled, m_sAutoIncrementValue );
254 : : }
255 [ # # ]: 0 : catch(const Exception&)
256 : : {
257 : : DBG_UNHANDLED_EXCEPTION();
258 : : }
259 : :
260 [ # # ][ # # ]: 0 : FreeResource();
261 : 0 : }
262 : : // -----------------------------------------------------------------------
263 [ # # ][ # # ]: 0 : OWizTypeSelect::~OWizTypeSelect()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
264 : : {
265 : : DBG_DTOR(OWizTypeSelect,NULL);
266 [ # # ]: 0 : }
267 : : // -----------------------------------------------------------------------------
268 : 0 : String OWizTypeSelect::GetTitle() const
269 : : {
270 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
271 [ # # ]: 0 : return String(ModuleRes(STR_WIZ_TYPE_SELECT_TITEL));
272 : : }
273 : : // -----------------------------------------------------------------------
274 : 0 : void OWizTypeSelect::Resize()
275 : : {
276 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
277 : 0 : }
278 : : // -----------------------------------------------------------------------
279 : 0 : IMPL_LINK( OWizTypeSelect, ColumnSelectHdl, MultiListBox *, /*pListBox*/ )
280 : : {
281 [ # # ]: 0 : String aColumnName( m_lbColumnNames.GetSelectEntry() );
282 : :
283 [ # # ][ # # ]: 0 : OFieldDescription* pField = static_cast<OFieldDescription*>(m_lbColumnNames.GetEntryData(m_lbColumnNames.GetEntryPos(aColumnName)));
284 [ # # ]: 0 : if(pField)
285 [ # # ]: 0 : m_aTypeControl.DisplayData(pField);
286 : :
287 [ # # ][ # # ]: 0 : m_aTypeControl.Enable(m_lbColumnNames.GetSelectEntryCount() == 1 );
288 [ # # ]: 0 : return 0;
289 : : }
290 : : // -----------------------------------------------------------------------
291 : 0 : void OWizTypeSelect::Reset()
292 : : {
293 : : // urspr"unglichen zustand wiederherstellen
294 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
295 : :
296 [ # # ][ # # ]: 0 : while(m_lbColumnNames.GetEntryCount())
297 [ # # ]: 0 : m_lbColumnNames.RemoveEntry(0);
298 [ # # ]: 0 : m_lbColumnNames.Clear();
299 : : sal_Int32 nBreakPos;
300 [ # # ]: 0 : m_pParent->CheckColumns(nBreakPos);
301 : :
302 : 0 : const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector();
303 : 0 : ODatabaseExport::TColumnVector::const_iterator aIter = pDestColumns->begin();
304 : 0 : ODatabaseExport::TColumnVector::const_iterator aEnd = pDestColumns->end();
305 [ # # ][ # # ]: 0 : for(;aIter != aEnd;++aIter)
306 : : {
307 : : sal_uInt16 nPos;
308 [ # # ][ # # ]: 0 : if((*aIter)->second->IsPrimaryKey())
309 [ # # ][ # # ]: 0 : nPos = m_lbColumnNames.InsertEntry((*aIter)->first, m_imgPKey );
[ # # ]
310 : : else
311 [ # # ][ # # ]: 0 : nPos = m_lbColumnNames.InsertEntry((*aIter)->first);
[ # # ]
312 [ # # ]: 0 : m_lbColumnNames.SetEntryData(nPos,(*aIter)->second);
313 : : }
314 : 0 : m_bFirstTime = sal_False;
315 : 0 : }
316 : : // -----------------------------------------------------------------------
317 : 0 : void OWizTypeSelect::ActivatePage( )
318 : : {
319 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
320 : 0 : sal_Bool bOldFirstTime = m_bFirstTime;
321 : 0 : Reset();
322 : 0 : m_bFirstTime = bOldFirstTime;
323 : :
324 : 0 : m_lbColumnNames.SelectEntryPos(static_cast<sal_uInt16>(m_nDisplayRow));
325 : 0 : m_nDisplayRow = 0;
326 : 0 : m_lbColumnNames.GetSelectHdl().Call(&m_lbColumnNames);
327 : 0 : }
328 : : // -----------------------------------------------------------------------
329 : 0 : sal_Bool OWizTypeSelect::LeavePage()
330 : : {
331 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
332 [ # # ]: 0 : String aColumnName( m_lbColumnNames.GetSelectEntry() );
333 : :
334 : 0 : sal_Bool bDuplicateName = sal_False;
335 [ # # ][ # # ]: 0 : OFieldDescription* pField = static_cast<OFieldDescription*>(m_lbColumnNames.GetEntryData(m_lbColumnNames.GetEntryPos(aColumnName)));
336 [ # # ]: 0 : if ( pField )
337 : : {
338 [ # # ]: 0 : m_aTypeControl.SaveData(pField);
339 : 0 : bDuplicateName = m_bDuplicateName;
340 : : }
341 [ # # ]: 0 : return !bDuplicateName;
342 : : }
343 : : //------------------------------------------------------------------------------
344 : 0 : void OWizTypeSelect::EnableAuto(sal_Bool bEnable)
345 : : {
346 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
347 : 0 : m_ftAuto.Show(bEnable);
348 : 0 : m_etAuto.Show(bEnable);
349 : 0 : m_pbAuto.Show(bEnable);
350 : 0 : m_flAutoType.Show(bEnable);
351 : 0 : }
352 : : //------------------------------------------------------------------------------
353 : 0 : IMPL_LINK( OWizTypeSelect, ButtonClickHdl, Button *, /*pButton*/ )
354 : : {
355 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
356 : : sal_Int32 nBreakPos;
357 [ # # ]: 0 : m_pParent->CheckColumns(nBreakPos);
358 [ # # ][ # # ]: 0 : fillColumnList(m_etAuto.GetText().ToInt32());
[ # # ][ # # ]
359 : :
360 [ # # ]: 0 : ActivatePage();
361 : :
362 : 0 : return 0;
363 : : }
364 : : //------------------------------------------------------------------------
365 : 0 : sal_Bool OWizTypeSelectList::IsPrimaryKeyAllowed() const
366 : : {
367 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
368 : 0 : sal_uInt16 nCount = GetSelectEntryCount();
369 : : sal_uInt16 j;
370 : :
371 [ # # ][ # # ]: 0 : for( j = 0; m_bPKey && j < nCount; ++j )
[ # # ]
372 : : {
373 : 0 : OFieldDescription* pField = static_cast<OFieldDescription*>(GetEntryData(GetSelectEntryPos(j)));
374 [ # # ][ # # ]: 0 : if(!pField || pField->getTypeInfo()->nSearchType == ColumnSearch::NONE)
[ # # ]
[ # # # # ]
[ # # ]
375 : 0 : break;
376 : : }
377 : 0 : return j == nCount;
378 : : }
379 : : // -----------------------------------------------------------------------------
380 : 0 : void OWizTypeSelectList::setPrimaryKey(OFieldDescription* _pFieldDescr,sal_uInt16 _nPos,sal_Bool _bSet)
381 : : {
382 [ # # ]: 0 : String sColumnName = GetEntry(_nPos);
383 [ # # ]: 0 : RemoveEntry(_nPos);
384 [ # # ]: 0 : _pFieldDescr->SetPrimaryKey(_bSet);
385 [ # # ]: 0 : if( _bSet )
386 [ # # ][ # # ]: 0 : InsertEntry(sColumnName,((OWizTypeSelect*)GetParent())->m_imgPKey,_nPos);
387 [ # # ][ # # ]: 0 : else if( _pFieldDescr->getTypeInfo()->bNullable )
[ # # ]
388 : : {
389 [ # # ]: 0 : _pFieldDescr->SetControlDefault(Any());
390 [ # # ]: 0 : InsertEntry(sColumnName,_nPos);
391 : : }
392 [ # # ][ # # ]: 0 : SetEntryData(_nPos,_pFieldDescr);
393 : 0 : }
394 : : //------------------------------------------------------------------------
395 : 0 : long OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
396 : : {
397 : 0 : long nDone = 0;
398 [ # # # ]: 0 : switch( rEvt.GetType() )
399 : : {
400 : : case EVENT_MOUSEBUTTONDOWN:
401 : : {
402 : 0 : const MouseEvent* pMEvt = rEvt.GetMouseEvent();
403 [ # # ][ # # ]: 0 : if(pMEvt->IsRight() && !pMEvt->GetModifier())
[ # # ]
404 : 0 : nDone = 1;
405 : : }
406 : 0 : break;
407 : : case EVENT_COMMAND:
408 : : {
409 [ # # ][ # # ]: 0 : if(!IsPrimaryKeyAllowed())
410 : : break;
411 : :
412 [ # # ]: 0 : const CommandEvent* pComEvt = rEvt.GetCommandEvent();
413 [ # # ]: 0 : if(pComEvt->GetCommand() != COMMAND_CONTEXTMENU)
414 : : break;
415 : : // die Stelle, an der geklickt wurde
416 : 0 : Point ptWhere(0,0);
417 [ # # ]: 0 : if (pComEvt->IsMouseEvent())
418 : 0 : ptWhere = pComEvt->GetMousePosPixel();
419 : :
420 [ # # ][ # # ]: 0 : PopupMenu aContextMenu(ModuleRes(RID_SBA_RTF_PKEYPOPUP));
421 [ # # ][ # # ]: 0 : switch( aContextMenu.Execute( this, ptWhere ) )
422 : : {
423 : : case SID_TABLEDESIGN_TABED_PRIMARYKEY:
424 : : {
425 [ # # ]: 0 : String sColumnName;
426 [ # # ]: 0 : sal_uInt16 nCount = GetEntryCount();
427 [ # # ]: 0 : for(sal_uInt16 j = 0 ; j < nCount ; ++j)
428 : : {
429 [ # # ]: 0 : OFieldDescription* pFieldDescr = static_cast<OFieldDescription*>(GetEntryData(j));
430 [ # # ]: 0 : if( pFieldDescr )
431 : : {
432 [ # # ][ # # ]: 0 : if(pFieldDescr->IsPrimaryKey() && !IsEntryPosSelected(j))
[ # # ][ # # ]
[ # # ]
433 [ # # ]: 0 : setPrimaryKey(pFieldDescr,j);
434 [ # # ][ # # ]: 0 : else if(IsEntryPosSelected(j))
435 : : {
436 [ # # ][ # # ]: 0 : setPrimaryKey(pFieldDescr,j,!pFieldDescr->IsPrimaryKey());
437 [ # # ]: 0 : SelectEntryPos(j);
438 : : }
439 : : }
440 : : }
441 [ # # ][ # # ]: 0 : GetSelectHdl().Call(this);
442 : : }
443 : 0 : break;
444 : : }
445 [ # # ]: 0 : nDone = 1;
446 : : }
447 : 0 : break;
448 : : }
449 [ # # ]: 0 : return nDone ? nDone : MultiListBox::PreNotify(rEvt);
450 : : }
451 : : // -----------------------------------------------------------------------------
452 : 0 : void OWizTypeSelect::fillColumnList(sal_uInt32 nRows)
453 : : {
454 : : DBG_CHKTHIS(OWizTypeSelect,NULL);
455 [ # # ]: 0 : if(m_pParserStream)
456 : : {
457 : 0 : sal_uInt32 nTell = m_pParserStream->Tell(); // might change seek position of stream
458 : :
459 : 0 : SvParser *pReader = createReader(nRows);
460 [ # # ]: 0 : if(pReader)
461 : : {
462 : 0 : pReader->AddRef();
463 : 0 : pReader->CallParser();
464 : 0 : pReader->ReleaseRef();
465 : : }
466 : 0 : m_pParserStream->Seek(nTell);
467 : : }
468 : 0 : }
469 : : // -----------------------------------------------------------------------------
470 : :
471 : :
472 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|