kspread

kspread_dlg_conditional.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2002-2003 Norbert Andres <nandres@web.de>
3 (C) 2002-2003 Philipp Mueller <philipp.mueller@gmx.de>
4 (C) 2002 John Dailey <dailey@vt.edu>
5 (C) 1999-2001 Laurent Montel <montel@kde.org>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21*/
22
23
24#include "kspread_dlg_conditional.h"
25#include "kspread_condition.h"
26
27#include "kspread_canvas.h"
28#include "kspread_cell.h"
29#include "kspread_doc.h"
30#include "selection.h"
31#include "kspread_sheet.h"
32#include "kspread_style.h"
33#include "kspread_style_manager.h"
34#include "kspread_view.h"
35
36#include <kcombobox.h>
37#include <kdebug.h>
38#include <klineedit.h>
39#include <tdelocale.h>
40#include <tdemessagebox.h>
41
42#include <KoGlobal.h>
43
44#include <tqgroupbox.h>
45#include <tqlabel.h>
46#include <tqlayout.h>
47
48using namespace KSpread;
49
50ConditionalWidget::ConditionalWidget( TQWidget* parent, const char* name, WFlags fl )
51 : TQWidget( parent, name, fl )
52{
53 TQGridLayout * Form1Layout = new TQGridLayout( this, 1, 1, 11, 6, "Form1Layout");
54
55 TQGroupBox * groupBox1_3 = new TQGroupBox( this, "groupBox1_3" );
56 groupBox1_3->setColumnLayout(0, TQt::Vertical );
57 groupBox1_3->layout()->setSpacing( KDialog::spacingHint() );
58 groupBox1_3->layout()->setMargin( KDialog::marginHint() );
59 TQGridLayout * groupBox1_3Layout = new TQGridLayout( groupBox1_3->layout() );
60 groupBox1_3Layout->setAlignment( TQt::AlignTop );
61
62 TQLabel * textLabel1_3 = new TQLabel( groupBox1_3, "textLabel1_3" );
63 groupBox1_3Layout->addWidget( textLabel1_3, 0, 0 );
64
65 m_condition_3 = new TQComboBox( false, groupBox1_3, "m_condition_3" );
66 groupBox1_3Layout->addWidget( m_condition_3, 0, 1 );
67
68 m_firstValue_3 = new KLineEdit( groupBox1_3, "m_firstValue_3" );
69 m_firstValue_3->setEnabled( false );
70 groupBox1_3Layout->addWidget( m_firstValue_3, 0, 2 );
71
72 m_secondValue_3 = new KLineEdit( groupBox1_3, "m_secondValue_3" );
73 m_secondValue_3->setEnabled( false );
74 groupBox1_3Layout->addWidget( m_secondValue_3, 0, 3 );
75
76 m_style_3 = new TQComboBox( false, groupBox1_3, "m_style_3" );
77 m_style_3->setEnabled( false );
78 groupBox1_3Layout->addWidget( m_style_3, 1, 1 );
79
80 TQLabel * textLabel2_3 = new TQLabel( groupBox1_3, "textLabel2_3" );
81 groupBox1_3Layout->addWidget( textLabel2_3, 1, 0 );
82
83 TQSpacerItem * spacer = new TQSpacerItem( 41, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
84 groupBox1_3Layout->addItem( spacer, 1, 2 );
85 TQSpacerItem * spacer_2 = new TQSpacerItem( 61, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
86 groupBox1_3Layout->addItem( spacer_2, 1, 3 );
87
88 Form1Layout->addWidget( groupBox1_3, 2, 0 );
89
90 TQGroupBox * groupBox1_2 = new TQGroupBox( this, "groupBox1_2" );
91 groupBox1_2->setColumnLayout(0, TQt::Vertical );
92 groupBox1_2->layout()->setSpacing( KDialog::spacingHint() );
93 groupBox1_2->layout()->setMargin( KDialog::marginHint() );
94
95 TQGridLayout * groupBox1_2Layout = new TQGridLayout( groupBox1_2->layout() );
96 groupBox1_2Layout->setAlignment( TQt::AlignTop );
97
98 TQLabel * textLabel1_2 = new TQLabel( groupBox1_2, "textLabel1_2" );
99 groupBox1_2Layout->addWidget( textLabel1_2, 0, 0 );
100
101 TQLabel * textLabel2_2 = new TQLabel( groupBox1_2, "textLabel2_2" );
102 groupBox1_2Layout->addWidget( textLabel2_2, 1, 0 );
103
104 m_condition_2 = new TQComboBox( false, groupBox1_2, "m_condition_2" );
105 groupBox1_2Layout->addWidget( m_condition_2, 0, 1 );
106
107 m_style_2 = new TQComboBox( false, groupBox1_2, "m_style_2" );
108 m_style_2->setEnabled( false );
109 groupBox1_2Layout->addWidget( m_style_2, 1, 1 );
110
111 m_firstValue_2 = new KLineEdit( groupBox1_2, "m_firstValue_2" );
112 m_firstValue_2->setEnabled( false );
113 groupBox1_2Layout->addWidget( m_firstValue_2, 0, 2 );
114
115 m_secondValue_2 = new KLineEdit( groupBox1_2, "m_secondValue_2" );
116 m_secondValue_2->setEnabled( false );
117
118 groupBox1_2Layout->addWidget( m_secondValue_2, 0, 3 );
119
120 TQSpacerItem * spacer_3 = new TQSpacerItem( 41, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
121 groupBox1_2Layout->addItem( spacer_3, 1, 2 );
122 TQSpacerItem * spacer_4 = new TQSpacerItem( 61, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
123 groupBox1_2Layout->addItem( spacer_4, 1, 3 );
124 Form1Layout->addWidget( groupBox1_2, 1, 0 );
125
126 TQGroupBox * groupBox1_1 = new TQGroupBox( this, "groupBox1_1" );
127 groupBox1_1->setColumnLayout(0, TQt::Vertical );
128 groupBox1_1->layout()->setSpacing( KDialog::spacingHint() );
129 groupBox1_1->layout()->setMargin( KDialog::marginHint() );
130
131 TQGridLayout * groupBox1_1Layout = new TQGridLayout( groupBox1_1->layout() );
132 groupBox1_1Layout->setAlignment( TQt::AlignTop );
133
134 TQLabel * textLabel1_1 = new TQLabel( groupBox1_1, "textLabel1_2_2" );
135 groupBox1_1Layout->addWidget( textLabel1_1, 0, 0 );
136
137 TQLabel * textLabel2_1 = new TQLabel( groupBox1_1, "textLabel2_2_2" );
138 groupBox1_1Layout->addWidget( textLabel2_1, 1, 0 );
139
140 m_condition_1 = new TQComboBox( false, groupBox1_1, "m_condition_1" );
141 groupBox1_1Layout->addWidget( m_condition_1, 0, 1 );
142
143 m_style_1 = new TQComboBox( false, groupBox1_1, "m_style_1" );
144 m_style_1->setEnabled( false );
145 groupBox1_1Layout->addWidget( m_style_1, 1, 1 );
146
147 m_firstValue_1 = new KLineEdit( groupBox1_1, "m_firstValue_1" );
148 m_firstValue_1->setEnabled( false );
149 groupBox1_1Layout->addWidget( m_firstValue_1, 0, 2 );
150
151 m_secondValue_1 = new KLineEdit( groupBox1_1, "m_secondValue_1" );
152 m_secondValue_1->setEnabled( false );
153 groupBox1_1Layout->addWidget( m_secondValue_1, 0, 3 );
154
155 TQSpacerItem * spacer_5 = new TQSpacerItem( 41, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
156 groupBox1_1Layout->addItem( spacer_5, 1, 2 );
157 TQSpacerItem * spacer_6 = new TQSpacerItem( 61, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
158 groupBox1_1Layout->addItem( spacer_6, 1, 3 );
159
160 Form1Layout->addWidget( groupBox1_1, 0, 0 );
161 resize( TQSize(702, 380).expandedTo( minimumSizeHint() ) );
162 clearWState( WState_Polished );
163
164 TQStringList list;
165 list += i18n( "<none>" );
166 list += i18n( "equal to" );
167 list += i18n( "greater than" );
168 list += i18n( "less than" );
169 list += i18n( "equal to or greater than" );
170 list += i18n( "equal to or less than" );
171 list += i18n( "between" );
172 list += i18n( "outside range" );
173 list += i18n( "different to" );
174
175 m_condition_1->clear();
176 m_condition_2->clear();
177 m_condition_3->clear();
178 m_condition_1->insertStringList( list );
179 m_condition_2->insertStringList( list );
180 m_condition_3->insertStringList( list );
181
182 groupBox1_1->setTitle( i18n( "First Condition" ) );
183 groupBox1_2->setTitle( i18n( "Second Condition" ) );
184 groupBox1_3->setTitle( i18n( "Third Condition" ) );
185 textLabel1_1->setText( i18n( "Cell is" ) );
186 textLabel1_2->setText( i18n( "Cell is" ) );
187 textLabel1_3->setText( i18n( "Cell is" ) );
188 textLabel2_1->setText( i18n( "Cell style" ) );
189 textLabel2_2->setText( i18n( "Cell style" ) );
190 textLabel2_3->setText( i18n( "Cell style" ) );
191
192 connect( m_condition_1, TQ_SIGNAL( highlighted( const TQString & ) ), this, TQ_SLOT( slotTextChanged1( const TQString & ) ) );
193 connect( m_condition_2, TQ_SIGNAL( highlighted( const TQString & ) ), this, TQ_SLOT( slotTextChanged2( const TQString & ) ) );
194 connect( m_condition_3, TQ_SIGNAL( highlighted( const TQString & ) ), this, TQ_SLOT( slotTextChanged3( const TQString & ) ) );
195}
196
197ConditionalWidget::~ConditionalWidget()
198{
199}
200
201void ConditionalWidget::slotTextChanged1( const TQString & text )
202{
203 if ( text == i18n( "<none>" ) )
204 {
205 m_firstValue_1->setEnabled( false );
206 m_secondValue_1->setEnabled( false );
207 m_style_1->setEnabled( false );
208 }
209 else
210 {
211 m_condition_2->setEnabled( true );
212 m_style_1->setEnabled( true );
213 if ( ( text == i18n( "between" ) ) || ( text == i18n( "different from" ) ) )
214 {
215 m_firstValue_1->setEnabled( true );
216 m_secondValue_1->setEnabled( true );
217 }
218 else
219 {
220 m_firstValue_1->setEnabled( true );
221 m_secondValue_1->setEnabled( false );
222 }
223 }
224}
225
226void ConditionalWidget::slotTextChanged2( const TQString & text )
227{
228 if ( text == i18n( "<none>" ) )
229 {
230 m_firstValue_2->setEnabled( false );
231 m_secondValue_2->setEnabled( false );
232 m_style_2->setEnabled( false );
233 }
234 else
235 {
236 m_condition_3->setEnabled( true );
237 m_style_2->setEnabled( true );
238 if ( ( text == i18n( "between" ) ) || ( text == i18n( "different from" ) ) )
239 {
240 m_firstValue_2->setEnabled( true );
241 m_secondValue_2->setEnabled( true );
242 }
243 else
244 {
245 m_firstValue_2->setEnabled( true );
246 m_secondValue_2->setEnabled( false );
247 }
248 }
249}
250
251void ConditionalWidget::slotTextChanged3( const TQString & text )
252{
253 if ( text == i18n( "<none>" ) )
254 {
255 m_firstValue_3->setEnabled( false );
256 m_secondValue_3->setEnabled( false );
257 m_style_3->setEnabled( false );
258 }
259 else
260 {
261 m_style_3->setEnabled( true );
262 if ( ( text == i18n( "between" ) ) || ( text == i18n( "different from" ) ) )
263 {
264 m_firstValue_3->setEnabled( true );
265 m_secondValue_3->setEnabled( true );
266 }
267 else
268 {
269 m_firstValue_3->setEnabled( true );
270 m_secondValue_3->setEnabled( false );
271 }
272 }
273}
274
279ConditionalDialog::ConditionalDialog( View * parent, const char * name,
280 const TQRect & marker )
281 : KDialogBase( parent, name, true, "", KDialogBase::Ok | KDialogBase::Cancel,
282 KDialogBase::Ok, false ),
283 m_view( parent ),
284 m_dlg( new ConditionalWidget( this ) ),
285 m_marker( marker )
286{
287 TQStringList list( m_view->doc()->styleManager()->styleNames() );
288
289 m_dlg->m_style_1->insertStringList( list );
290 m_dlg->m_style_2->insertStringList( list );
291 m_dlg->m_style_3->insertStringList( list );
292
293 setCaption( i18n( "Conditional Cell Attributes" ) );
294 setButtonBoxOrientation(TQt::Vertical );
295 setMainWidget( m_dlg );
296
297 init();
298}
299
300void ConditionalDialog::init()
301{
302 TQValueList<Conditional> conditionList;
303 TQValueList<Conditional> otherList;
304 bool found;
305 int numCondition;
306
307 TQValueList<Conditional>::iterator it1;
308 TQValueList<Conditional>::iterator it2;
309
310 Cell * obj = m_view->activeSheet()->cellAt( m_marker.left(),
311 m_marker.top() );
312
313 conditionList = obj->conditionList();
314 /* this is the list, but only display the conditions common to all selected
315 cells*/
316
317 for ( int x = m_marker.left(); x <= m_marker.right(); x++ )
318 {
319 for ( int y = m_marker.top(); y <= m_marker.bottom(); y++ )
320 {
321 Cell * obj2 = m_view->activeSheet()->cellAt( x, y );
322 otherList = obj2->conditionList();
323
324 it1 = conditionList.begin();
325 while ( it1 != conditionList.end() )
326 {
327 kdDebug() << "Here" << endl;
328 found = false;
329 for ( it2 = otherList.begin(); !found && it2 != otherList.end(); ++it2 )
330 {
331 kdDebug() << "Found: " << found << endl;
332 found = ( (*it1).val1 == (*it2).val1 &&
333 (*it1).val2 == (*it2).val2 &&
334 (*it1).cond == (*it2).cond );
335
336 if ( (*it1).strVal1 && !(*it2).strVal1 )
337 found = false;
338 if ( !(*it1).strVal1 && (*it2).strVal1 )
339 found = false;
340 if ( (*it1).strVal1 && (*it2).strVal1
341 && ( *(*it1).strVal1 != *(*it2).strVal1 ) )
342 found = false;
343 if ( !found )
344 continue;
345
346 if ( (*it1).strVal2 && !(*it2).strVal2 )
347 found = false;
348 if ( !(*it1).strVal2 && (*it2).strVal2 )
349 found = false;
350 if ( (*it1).strVal2 && (*it2).strVal2
351 && ( *(*it1).strVal2 != *(*it2).strVal2 ) )
352 found = false;
353 if ( !found )
354 continue;
355
356 if ( (*it1).colorcond && !(*it2).colorcond )
357 found = false;
358 if ( !(*it1).colorcond && (*it2).colorcond )
359 found = false;
360 if ( (*it1).colorcond && (*it2).colorcond
361 && ( *(*it1).colorcond != *(*it2).colorcond ) )
362 found = false;
363 if ( !found )
364 continue;
365
366 if ( (*it1).fontcond && !(*it2).fontcond )
367 found = false;
368 if ( !(*it1).fontcond && (*it2).fontcond )
369 found = false;
370 if ( (*it1).fontcond && (*it2).fontcond
371 && ( *(*it1).fontcond != *(*it2).fontcond ) )
372 found = false;
373 if ( !found )
374 continue;
375
376 if ( (*it1).styleName && !(*it2).styleName )
377 found = false;
378 if ( !(*it1).styleName && (*it2).styleName )
379 found = false;
380 if ( (*it1).styleName && (*it2).styleName
381 && ( *(*it1).styleName != *(*it2).styleName ) )
382 found = false;
383 }
384
385 if ( !found ) /* if it's not here, don't display this condition */
386 {
387 it1 = conditionList.remove( it1 );
388 }
389 else
390 {
391 ++it1;
392 }
393 }
394 }
395 }
396
397 kdDebug() << "Conditions: " << conditionList.size() << endl;
398
399 m_dlg->m_condition_2->setEnabled( false );
400 m_dlg->m_condition_3->setEnabled( false );
401
402 m_dlg->m_style_1->setEnabled( false );
403 m_dlg->m_style_2->setEnabled( false );
404 m_dlg->m_style_3->setEnabled( false );
405
406 numCondition = 0;
407 for ( it1 = conditionList.begin(); numCondition < 3 && it1 != conditionList.end(); ++it1 )
408 {
409 init( *it1, numCondition );
410
411 ++numCondition;
412 }
413}
414
415void ConditionalDialog::init( Conditional const & tmp, int numCondition )
416{
417 kdDebug() << "Adding " << numCondition << endl;
418 TQComboBox * cb = 0;
419 TQComboBox * sb = 0;
420 KLineEdit * kl1 = 0;
421 KLineEdit * kl2 = 0;
422 TQString value;
423
424 switch( numCondition )
425 {
426 case 0:
427 cb = m_dlg->m_condition_1;
428 sb = m_dlg->m_style_1;
429 kl1 = m_dlg->m_firstValue_1;
430 kl2 = m_dlg->m_secondValue_1;
431 break;
432 case 1:
433 cb = m_dlg->m_condition_2;
434 sb = m_dlg->m_style_2;
435 kl1 = m_dlg->m_firstValue_2;
436 kl2 = m_dlg->m_secondValue_2;
437 break;
438 case 2:
439 cb = m_dlg->m_condition_3;
440 sb = m_dlg->m_style_3;
441 kl1 = m_dlg->m_firstValue_3;
442 kl2 = m_dlg->m_secondValue_3;
443 break;
444 default:
445 return;
446 }
447
448 if ( tmp.styleName )
449 {
450 sb->setCurrentText( *tmp.styleName );
451 sb->setEnabled( true );
452 }
453
454 switch( tmp.cond )
455 {
456 case Conditional::None :
457 break;
458
459 case Conditional::Equal :
460 cb->setCurrentItem( 1 );
461 break;
462
463 case Conditional::Superior :
464 cb->setCurrentItem( 2 );
465 break;
466
467 case Conditional::Inferior :
468 cb->setCurrentItem( 3 );
469 break;
470
471 case Conditional::SuperiorEqual :
472 cb->setCurrentItem( 4 );
473 break;
474
475 case Conditional::InferiorEqual :
476 cb->setCurrentItem( 5 );
477 break;
478
479 case Conditional::Between :
480 cb->setCurrentItem(6);
481
482 if ( tmp.strVal2 )
483 kl2->setText( *tmp.strVal2 );
484 else
485 {
486 value = value.setNum( tmp.val2 );
487 kl2->setText( value );
488 }
489 break;
490
491 case Conditional::Different :
492 cb->setCurrentItem(7);
493 if ( tmp.strVal2 )
494 kl2->setText( *tmp.strVal2 );
495 else
496 {
497 value = value.setNum( tmp.val2 );
498 kl2->setText( value );
499 }
500 break;
501 case Conditional::DifferentTo :
502 cb->setCurrentItem(8);
503 break;
504 }
505
506 if ( tmp.cond != Conditional::None )
507 {
508 kl1->setEnabled( true );
509
510 if ( tmp.strVal1 )
511 kl1->setText( *tmp.strVal1 );
512 else
513 {
514 value = value.setNum( tmp.val1 );
515 kl1->setText( value );
516 }
517 }
518}
519
520Conditional::Type ConditionalDialog::typeOfCondition( TQComboBox const * const cb ) const
521{
522 Conditional::Type result = Conditional::None;
523 switch( cb->currentItem() )
524 {
525 case 0 :
526 result = Conditional::None;
527 break;
528 case 1 :
529 result = Conditional::Equal;
530 break;
531 case 2 :
532 result = Conditional::Superior;
533 break;
534 case 3 :
535 result = Conditional::Inferior;
536 break;
537 case 4 :
538 result = Conditional::SuperiorEqual;
539 break;
540 case 5 :
541 result = Conditional::InferiorEqual;
542 break;
543 case 6 :
544 result = Conditional::Between;
545 break;
546 case 7 :
547 result = Conditional::Different;
548 break;
549 case 8 :
550 result = Conditional::DifferentTo;
551 break;
552 default:
553 kdDebug(36001) << "Error in list" << endl;
554 break;
555 }
556
557 return result;
558}
559
560bool ConditionalDialog::checkInputData( KLineEdit const * const edit1,
561 KLineEdit const * const edit2 )
562{
563 bool b1 = false;
564 bool b2 = false;
565
566 if ( !edit2->isEnabled() )
567 return true;
568
569 edit1->text().toDouble( &b1 );
570 edit2->text().toDouble( &b2 );
571
572 if ( b1 != b2 )
573 {
574 if ( b1 )
575 KMessageBox::sorry( 0, i18n( "If the first value is a number, the second value also has to be a number." ) );
576 else
577 KMessageBox::sorry( 0, i18n( "If the first value is a string, the second value also has to be a string." ) );
578 return false;
579 }
580
581 return true;
582}
583
584bool ConditionalDialog::checkInputData()
585{
586 if ( m_dlg->m_firstValue_1->isEnabled() && !checkInputData( m_dlg->m_firstValue_1, m_dlg->m_secondValue_1 ) )
587 return false;
588 if ( m_dlg->m_firstValue_2->isEnabled() && !checkInputData( m_dlg->m_firstValue_2, m_dlg->m_secondValue_2 ) )
589 return false;
590 if ( m_dlg->m_firstValue_3->isEnabled() && !checkInputData( m_dlg->m_firstValue_3, m_dlg->m_secondValue_3 ) )
591 return false;
592
593 return true;
594}
595
596bool ConditionalDialog::getCondition( Conditional & newCondition, const TQComboBox * cb,
597 const KLineEdit * edit1, const KLineEdit * edit2,
598 const TQComboBox * sb, Style * style )
599{
600 if ( !cb->isEnabled() )
601 return false;
602
603 newCondition.cond = typeOfCondition( cb );
604 if ( newCondition.cond == Conditional::None )
605 return false;
606
607 bool ok = false;
608 double d1 = edit1->text().toDouble( &ok );
609 double d2 = 0.0;
610 TQString * s1 = 0;
611 TQString * s2 = 0;
612 TQString * sn = 0;
613
614 if ( ok )
615 {
616 if ( edit2->isEnabled() )
617 d2 = edit2->text().toDouble( &ok );
618 // values are already checked...
619 }
620 else
621 {
622 d1 = 0.0;
623 s1 = new TQString( edit1->text() );
624
625 if ( edit2->isEnabled() )
626 s2 = new TQString( edit2->text() );
627 }
628 sn = new TQString( sb->currentText() );
629
630 newCondition.val1 = d1;
631 newCondition.val2 = d2;
632 newCondition.strVal1 = s1;
633 newCondition.strVal2 = s2;
634 newCondition.fontcond = 0;
635 newCondition.colorcond = 0;
636 newCondition.styleName = sn;
637 newCondition.style = style;
638
639 return true;
640}
641
642void ConditionalDialog::slotOk()
643{
644 kdDebug() << "slotOk" << endl;
645
646 if ( !checkInputData() )
647 return;
648
649 kdDebug() << "Input data is valid" << endl;
650
651 m_view->doc()->emitBeginOperation( false );
652 StyleManager * manager = m_view->doc()->styleManager();
653
654 TQValueList<Conditional> newList;
655
656 Conditional newCondition;
657
658 if ( getCondition( newCondition, m_dlg->m_condition_1, m_dlg->m_firstValue_1,
659 m_dlg->m_secondValue_1, m_dlg->m_style_1, manager->style( m_dlg->m_style_1->currentText() ) ) )
660 newList.append( newCondition );
661
662 if ( getCondition( newCondition, m_dlg->m_condition_2, m_dlg->m_firstValue_2,
663 m_dlg->m_secondValue_2, m_dlg->m_style_2, manager->style( m_dlg->m_style_2->currentText() ) ) )
664 newList.append( newCondition );
665
666 if ( getCondition( newCondition, m_dlg->m_condition_3, m_dlg->m_firstValue_3,
667 m_dlg->m_secondValue_3, m_dlg->m_style_3, manager->style( m_dlg->m_style_3->currentText() ) ) )
668 newList.append( newCondition );
669
670 kdDebug() << "Setting conditional list" << endl;
671 m_view->activeSheet()->setConditional( m_view->selectionInfo(), newList );
672 m_view->slotUpdateView( m_view->activeSheet(), *m_view->selectionInfo() );
673
674 accept();
675}
676
677#include "kspread_dlg_conditional.moc"
678
679
TQValueList< Conditional > conditionList() const
Gets a copy of the list of current conditions.
Structure to indicate the condition we're testing on a cell and the special font and color that will ...
The Style class represents a cell style.
The View class displays a KSpread document.
The KSpread namespace.
Definition commands.h:39