1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "AddField.hxx"
#include "UITools.hxx"
#include <svx/dbaexchange.hxx>
#include <svx/svdpagv.hxx>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/i18n/XCollator.hpp>
#include <vcl/waitobj.hxx>
#include <vcl/svapp.hxx>
#include <tools/diagnose_ex.h>
#include <comphelper/stl_types.hxx>
#include "rptui_slotid.hrc"
#include <connectivity/dbtools.hxx>
#include "helpids.hrc"
#include "RptResId.hrc"
#include "CondFormat.hrc"
#include "ModuleHelper.hxx"
#include "uistrings.hrc"
#include "ColumnInfo.hxx"
#include <comphelper/property.hxx>
#include <svtools/imgdef.hxx>
namespace rptui
{
const long STD_WIN_SIZE_X = 180;
const long STD_WIN_SIZE_Y = 320;
const long LISTBOX_BORDER = 2;
using namespace ::com::sun::star;
using namespace sdbc;
using namespace sdb;
using namespace uno;
using namespace datatransfer;
using namespace beans;
using namespace lang;
using namespace container;
using namespace ::svx;
class OAddFieldWindowListBox : public SvTreeListBox
{
OAddFieldWindow* m_pTabWin;
OAddFieldWindowListBox(const OAddFieldWindowListBox&);
void operator =(const OAddFieldWindowListBox&);
public:
OAddFieldWindowListBox( OAddFieldWindow* _pParent );
virtual ~OAddFieldWindowListBox();
sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
uno::Sequence< beans::PropertyValue > getSelectedFieldDescriptors();
protected:
// DragSourceHelper
virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
private:
using SvTreeListBox::ExecuteDrop;
};
// -----------------------------------------------------------------------------
uno::Sequence< beans::PropertyValue > OAddFieldWindowListBox::getSelectedFieldDescriptors()
{
uno::Sequence< beans::PropertyValue > aArgs(GetSelectionCount());
sal_Int32 i = 0;
SvTreeListEntry* pSelected = FirstSelected();
while( pSelected )
{
// build a descriptor for the currently selected field
::svx::ODataAccessDescriptor aDescriptor;
m_pTabWin->fillDescriptor(pSelected,aDescriptor);
aArgs[i++].Value <<= aDescriptor.createPropertyValueSequence();
pSelected = NextSelected(pSelected);
}
return aArgs;
}
//==================================================================
// class OAddFieldWindowListBox
//==================================================================
DBG_NAME( rpt_OAddFieldWindowListBox );
//------------------------------------------------------------------------------
OAddFieldWindowListBox::OAddFieldWindowListBox( OAddFieldWindow* _pParent )
:SvTreeListBox( _pParent, WB_TABSTOP|WB_BORDER|WB_SORT )
,m_pTabWin( _pParent )
{
DBG_CTOR( rpt_OAddFieldWindowListBox,NULL);
SetHelpId( HID_RPT_FIELD_SEL );
SetSelectionMode(MULTIPLE_SELECTION);
SetDragDropMode( 0xFFFF );
SetHighlightRange( );
}
//------------------------------------------------------------------------------
OAddFieldWindowListBox::~OAddFieldWindowListBox()
{
DBG_DTOR( rpt_OAddFieldWindowListBox,NULL);
}
//------------------------------------------------------------------------------
sal_Int8 OAddFieldWindowListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
{
return DND_ACTION_NONE;
}
//------------------------------------------------------------------------------
sal_Int8 OAddFieldWindowListBox::ExecuteDrop( const ExecuteDropEvent& /*rEvt*/ )
{
return DND_ACTION_NONE;
}
//------------------------------------------------------------------------------
void OAddFieldWindowListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
{
if ( GetSelectionCount() < 1 )
// no drag without a field
return;
OMultiColumnTransferable* pDataContainer = new OMultiColumnTransferable(getSelectedFieldDescriptors());
Reference< XTransferable> xEnsureDelete = pDataContainer;
EndSelection();
pDataContainer->StartDrag( this, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
}
//========================================================================
// class OAddFieldWindow
//========================================================================
DBG_NAME( rpt_OAddFieldWindow );
//-----------------------------------------------------------------------
OAddFieldWindow::OAddFieldWindow(Window* pParent
,const uno::Reference< beans::XPropertySet >& _xRowSet
)
:FloatingWindow(pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE))
,::comphelper::OPropertyChangeListener(m_aMutex)
,::comphelper::OContainerListener(m_aMutex)
,m_xRowSet(_xRowSet)
,m_aActions(this,ModuleRes(RID_TB_SORTING))
,m_pListBox(new OAddFieldWindowListBox( this ))
,m_aFixedLine(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) )
,m_aHelpText(this, ModuleRes(ADDFIELD_HELP_FIELD) )
,m_aInsertButton(this, WB_TABSTOP|WB_CENTER)
,m_nCommandType(0)
,m_bEscapeProcessing(sal_False)
,m_pChangeListener(NULL)
,m_pContainerListener(NULL)
{
DBG_CTOR( rpt_OAddFieldWindow,NULL);
SetHelpId( HID_RPT_FIELD_SEL_WIN );
SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
SetMinOutputSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
m_aActions.SetStyle(m_aActions.GetStyle()|WB_LINESPACING);
m_aActions.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
m_aActions.SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction));
setToolBox(&m_aActions);
m_aActions.CheckItem(SID_FM_SORTUP);
m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, sal_False);
m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
m_pListBox->SetSelectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) );
m_pListBox->SetDeselectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) );
m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
m_pListBox->Show();
const String sTitle(ModuleRes(RID_STR_INSERT));
m_aInsertButton.SetText(sTitle);
m_aInsertButton.SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
m_aInsertButton.Show();
m_aFixedLine.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
m_aHelpText.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
if ( m_xRowSet.is() )
{
try
{
// be notified when the settings of report definition change
m_pChangeListener = new ::comphelper::OPropertyChangeMultiplexer( this, m_xRowSet );
m_pChangeListener->addProperty( PROPERTY_COMMAND );
m_pChangeListener->addProperty( PROPERTY_COMMANDTYPE );
m_pChangeListener->addProperty( PROPERTY_ESCAPEPROCESSING );
m_pChangeListener->addProperty( PROPERTY_FILTER );
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
}
//-----------------------------------------------------------------------
OAddFieldWindow::~OAddFieldWindow()
{
if ( m_pListBox.get() )
{
SvLBoxTreeList* pModel = m_pListBox->GetModel();
sal_uLong nCount = pModel->GetEntryCount();
for(sal_uLong i = 0; i< nCount;++i)
{
delete static_cast<ColumnInfo*>(pModel->GetEntry(i)->GetUserData());
}
}
if (m_pChangeListener.is())
m_pChangeListener->dispose();
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
DBG_DTOR( rpt_OAddFieldWindow,NULL);
}
//-----------------------------------------------------------------------
void OAddFieldWindow::GetFocus()
{
if ( m_pListBox.get() )
m_pListBox->GrabFocus();
else
FloatingWindow::GetFocus();
}
//-----------------------------------------------------------------------
uno::Sequence< beans::PropertyValue > OAddFieldWindow::getSelectedFieldDescriptors()
{
return m_pListBox->getSelectedFieldDescriptors();
}
//-----------------------------------------------------------------------
long OAddFieldWindow::PreNotify( NotifyEvent& _rNEvt )
{
if ( EVENT_KEYINPUT == _rNEvt.GetType() )
{
const KeyCode& rKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode();
if ( ( 0 == rKeyCode.GetModifier() ) && ( KEY_RETURN == rKeyCode.GetCode() ) )
{
if ( m_aCreateLink.IsSet() )
{
m_aCreateLink.Call(this);
return 1;
}
}
}
return FloatingWindow::PreNotify( _rNEvt );
}
//-----------------------------------------------------------------------
void OAddFieldWindow::_propertyChanged( const beans::PropertyChangeEvent& _evt ) throw( uno::RuntimeException )
{
OSL_ENSURE( _evt.Source == m_xRowSet, "OAddFieldWindow::_propertyChanged: where did this come from?" );
(void)_evt;
Update();
}
//-----------------------------------------------------------------------
namespace
{
void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Sequence< ::rtl::OUString >& _rEntries )
{
const ::rtl::OUString* pEntries = _rEntries.getConstArray();
sal_Int32 nEntries = _rEntries.getLength();
for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
_rListBox.InsertEntry( *pEntries,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries) );
}
void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns )
{
uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames();
const ::rtl::OUString* pEntries = aEntries.getConstArray();
sal_Int32 nEntries = aEntries.getLength();
for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
{
uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW);
::rtl::OUString sLabel;
if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
if ( !sLabel.isEmpty() )
_rListBox.InsertEntry( sLabel,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
else
_rListBox.InsertEntry( *pEntries,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
}
}
}
//-----------------------------------------------------------------------
void OAddFieldWindow::Update()
{
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
m_pContainerListener = NULL;
m_xColumns.clear();
try
{
// ListBox loeschen
m_pListBox->Clear();
const sal_uInt16 nItemCount = m_aActions.GetItemCount();
for (sal_uInt16 j = 0; j< nItemCount; ++j)
{
m_aActions.EnableItem(m_aActions.GetItemId(j),sal_False);
}
String aTitle(ModuleRes(RID_STR_FIELDSELECTION));
SetText(aTitle);
if ( m_xRowSet.is() )
{
::rtl::OUString sCommand( m_aCommandName );
sal_Int32 nCommandType( m_nCommandType );
sal_Bool bEscapeProcessing( m_bEscapeProcessing );
::rtl::OUString sFilter( m_sFilter );
OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand );
OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType );
OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_ESCAPEPROCESSING ) >>= bEscapeProcessing );
OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_FILTER ) >>= sFilter );
m_aCommandName = sCommand;
m_nCommandType = nCommandType;
m_bEscapeProcessing = bEscapeProcessing;
m_sFilter = sFilter;
// add the columns to the list
uno::Reference< sdbc::XConnection> xCon = getConnection();
if ( xCon.is() && !m_aCommandName.isEmpty() )
m_xColumns = dbtools::getFieldsByCommandDescriptor( xCon, GetCommandType(), GetCommand(), m_xHoldAlive );
if ( m_xColumns.is() )
{
lcl_addToList( *m_pListBox, m_xColumns );
uno::Reference< container::XContainer> xContainer(m_xColumns,uno::UNO_QUERY);
if ( xContainer.is() )
m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
}
// add the parameter columns to the list
uno::Reference< ::com::sun::star::sdbc::XRowSet > xRowSet(m_xRowSet,uno::UNO_QUERY);
Sequence< ::rtl::OUString > aParamNames( getParameterNames( xRowSet ) );
lcl_addToList( *m_pListBox, aParamNames );
// set title
aTitle.AppendAscii(" ");
aTitle += m_aCommandName.getStr();
SetText( aTitle );
if ( !m_aCommandName.isEmpty() )
{
for (sal_uInt16 i = 0; i < nItemCount; ++i)
{
m_aActions.EnableItem(m_aActions.GetItemId(i));
}
}
OnSelectHdl(NULL);
}
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
//-----------------------------------------------------------------------
void OAddFieldWindow::Resize()
{
FloatingWindow::Resize();
const Size aWindowSize( GetOutputSizePixel() );
const Size aRelated(LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT ));
const Size aFixedTextSize(LogicToPixel( Size( FIXEDTEXT_WIDTH, FIXEDTEXT_HEIGHT ), MAP_APPFONT ));
// ToolBar
Size aToolbarSize( m_aActions.GetSizePixel() );
Point aToolbarPos( aRelated.Width(), aRelated.Height());
m_aActions.SetPosPixel(Point(aToolbarPos.X(), aToolbarPos.Y()));
Size aLBSize( aWindowSize );
aLBSize.Width() -= ( 2 * aRelated.Width() );
// help text
const Size aHelpTextSize = m_aHelpText.CalcMinimumSize(aLBSize.Width());
// ListBox
Point aLBPos( aRelated.Width(), aRelated.Height() + aToolbarSize.Height() + aRelated.Height() );
aLBSize.Height() -= aToolbarSize.Height(); // Toolbar
aLBSize.Height() -= (6*aRelated.Height()); // 6 * gap
aLBSize.Height() -= aFixedTextSize.Height(); // fixed line
aLBSize.Height() -= aHelpTextSize.Height(); // help text
m_pListBox->SetPosSizePixel( aLBPos, aLBSize );
// FixedLine
Size aFLSize( aLBSize.Width(),aFixedTextSize.Height() );
Point aFLPos( aRelated.Width(), aLBPos.Y() + aLBSize.Height() + aRelated.Height());
m_aFixedLine.SetPosSizePixel( aFLPos, aFLSize );
// Help text
Point aFTPos( aRelated.Width(), aFLPos.Y() + aFLSize.Height() + aRelated.Height() );
m_aHelpText.SetPosSizePixel( aFTPos, aHelpTextSize );
}
// -----------------------------------------------------------------------------
uno::Reference< sdbc::XConnection> OAddFieldWindow::getConnection() const
{
return uno::Reference< sdbc::XConnection>(m_xRowSet->getPropertyValue( PROPERTY_ACTIVECONNECTION ),uno::UNO_QUERY);
}
// -----------------------------------------------------------------------------
void OAddFieldWindow::fillDescriptor(SvTreeListEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor)
{
if ( _pSelected && m_xColumns.is() )
{
uno::Reference<container::XChild> xChild(getConnection(),uno::UNO_QUERY);
if ( xChild.is( ) )
{
uno::Reference<sdb::XDocumentDataSource> xDocument( xChild->getParent(), uno::UNO_QUERY );
if ( xDocument.is() )
{
uno::Reference<frame::XModel> xModel(xDocument->getDatabaseDocument(),uno::UNO_QUERY);
if ( xModel.is() )
_rDescriptor[ daDatabaseLocation ] <<= xModel->getURL();
}
}
_rDescriptor[ ::svx::daCommand ] <<= GetCommand();
_rDescriptor[ ::svx::daCommandType ] <<= GetCommandType();
_rDescriptor[ ::svx::daEscapeProcessing ] <<= GetEscapeProcessing();
_rDescriptor[ ::svx::daConnection ] <<= getConnection();
ColumnInfo* pInfo = static_cast<ColumnInfo*>(_pSelected->GetUserData());
_rDescriptor[ ::svx::daColumnName ] <<= pInfo->sColumnName;
if ( m_xColumns->hasByName( pInfo->sColumnName ) )
_rDescriptor[ ::svx::daColumnObject ] <<= m_xColumns->getByName(pInfo->sColumnName);
}
}
// -----------------------------------------------------------------------------
void OAddFieldWindow::_elementInserted( const container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException)
{
if ( m_pListBox.get() )
{
::rtl::OUString sName;
if ( (_rEvent.Accessor >>= sName) && m_xColumns->hasByName(sName) )
{
uno::Reference< beans::XPropertySet> xColumn(m_xColumns->getByName(sName),UNO_QUERY_THROW);
::rtl::OUString sLabel;
if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
if ( !sLabel.isEmpty() )
m_pListBox->InsertEntry( sLabel,NULL,sal_False,LIST_APPEND,new ColumnInfo(sName,sLabel) );
else
m_pListBox->InsertEntry( sName,NULL,sal_False,LIST_APPEND,new ColumnInfo(sName,sLabel) );
}
}
}
// -----------------------------------------------------------------------------
void OAddFieldWindow::_elementRemoved( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
{
if ( m_pListBox.get() )
{
m_pListBox->Clear();
if ( m_xColumns.is() )
lcl_addToList( *m_pListBox, m_xColumns );
}
}
// -----------------------------------------------------------------------------
void OAddFieldWindow::_elementReplaced( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
{
}
// -----------------------------------------------------------------------------
IMPL_LINK( OAddFieldWindow, OnSelectHdl, void* ,/*_pAddFieldDlg*/)
{
m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, ( m_pListBox.get() && m_pListBox->GetSelectionCount() > 0 ));
return 0L;
}
// -----------------------------------------------------------------------------
IMPL_LINK( OAddFieldWindow, OnDoubleClickHdl, void* ,/*_pAddFieldDlg*/)
{
if ( m_aCreateLink.IsSet() )
m_aCreateLink.Call(this);
return 0L;
}
//------------------------------------------------------------------------------
ImageList OAddFieldWindow::getImageList(sal_Int16 _eBitmapSet) const
{
sal_Int16 nN = IMG_ADDFIELD_DLG_SC;
if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE )
nN = IMG_ADDFIELD_DLG_LC;
return ImageList(ModuleRes(nN));
}
//------------------------------------------------------------------
void OAddFieldWindow::resizeControls(const Size& _rDiff)
{
// we use large images so we must change them
if ( _rDiff.Width() || _rDiff.Height() )
{
Invalidate();
}
}
//------------------------------------------------------------------
IMPL_LINK( OAddFieldWindow, OnSortAction, ToolBox*, /*NOTINTERESTEDIN*/ )
{
const sal_uInt16 nCurItem = m_aActions.GetCurItemId();
if ( SID_ADD_CONTROL_PAIR == nCurItem )
OnDoubleClickHdl(NULL);
else
{
if ( SID_FM_REMOVE_FILTER_SORT == nCurItem || !m_aActions.IsItemChecked(nCurItem) )
{
const sal_uInt16 nItemCount = m_aActions.GetItemCount();
for (sal_uInt16 j = 0; j< nItemCount; ++j)
{
const sal_uInt16 nItemId = m_aActions.GetItemId(j);
if ( nCurItem != nItemId )
m_aActions.CheckItem(nItemId,sal_False);
}
SvSortMode eSortMode = SortNone;
if ( SID_FM_REMOVE_FILTER_SORT != nCurItem )
{
m_aActions.CheckItem(nCurItem,!m_aActions.IsItemChecked(nCurItem));
if ( m_aActions.IsItemChecked(SID_FM_SORTUP) )
eSortMode = SortAscending;
else if ( m_aActions.IsItemChecked(SID_FM_SORTDOWN) )
eSortMode = SortDescending;
}
m_pListBox->GetModel()->SetSortMode(eSortMode);
if ( SID_FM_REMOVE_FILTER_SORT == nCurItem )
Update();
m_pListBox->GetModel()->Resort();
}
}
return 0L;
}
// -----------------------------------------------------------------------------
// =============================================================================
} // namespace rptui
// =============================================================================
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|