kspread

kspread_dlg_formula.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2002-2003 Ariya Hidayat <ariya@kde.org>
3 (C) 2002-2003 Norbert Andres <nandres@web.de>
4 (C) 1999-2003 Laurent Montel <montel@kde.org>
5 (C) 2002 Philipp Mueller <philipp.mueller@gmx.de>
6 (C) 2002 John Dailey <dailey@vt.edu>
7 (C) 2002 Daniel Herring <herring@eecs.ku.edu>
8 (C) 2000-2001 Werner Trobin <trobin@kde.org>
9 (C) 1998-2000 Torben Weis <weis@kde.org>
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
15
16 This library 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 GNU
19 Library General Public License for more details.
20
21 You should have received a copy of the GNU Library General Public License
22 along with this library; see the file COPYING.LIB. If not, write to
23 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
25*/
26
27#include <tqtextbrowser.h>
28#include <tqtabwidget.h>
29
30#include "kspread_dlg_formula.h"
31#include "kspread_canvas.h"
32#include "kspread_util.h"
33#include "kspread_editors.h"
34#include "kspread_doc.h"
35#include "kspread_locale.h"
36#include "kspread_map.h"
37#include "selection.h"
38#include "kspread_sheet.h"
39#include "kspread_view.h"
40#include "functions.h"
41
42#include <tdeapplication.h>
43#include <kdebug.h>
44#include <kbuttonbox.h>
45#include <knumvalidator.h>
46#include <tqcombobox.h>
47#include <tqevent.h>
48#include <tqlistbox.h>
49#include <tqlabel.h>
50#include <tqpushbutton.h>
51#include <klineedit.h>
52#include <tqlayout.h>
53
54using namespace KSpread;
55
56FormulaDialog::FormulaDialog( View* parent, const char* name,const TQString& formulaName)
57 : KDialogBase( parent, name,false,i18n("Function"), Ok|Cancel )
58{
59 setWFlags( TQt::WDestructiveClose );
60
61 m_pView = parent;
62 m_focus = 0;
63 m_desc = 0;
64
65 Cell* cell = m_pView->activeSheet()->cellAt( m_pView->canvasWidget()->markerColumn(),
66 m_pView->canvasWidget()->markerRow() );
67 m_oldText=cell->text();
68 // Make sure that there is a cell editor running.
69 if ( !m_pView->canvasWidget()->editor() )
70 {
71 m_pView->canvasWidget()->createEditor( Canvas::CellEditor );
72 if(cell->text().isEmpty())
73 m_pView->canvasWidget()->editor()->setText( "=" );
74 else
75 if(cell->text().at(0)!='=')
76 m_pView->canvasWidget()->editor()->setText( "="+cell->text() );
77 else
78 m_pView->canvasWidget()->editor()->setText( cell->text() );
79 }
80
81 Q_ASSERT( m_pView->canvasWidget()->editor() );
82
83 TQWidget *page = new TQWidget( this );
84 setMainWidget(page);
85
86 TQGridLayout *grid1 = new TQGridLayout(page,11,2,KDialog::marginHint(), KDialog::spacingHint());
87
88 searchFunct = new KLineEdit(page);
89 TQSizePolicy sp3( TQSizePolicy::Preferred, TQSizePolicy::Fixed );
90 searchFunct->setSizePolicy( sp3 );
91
92 grid1->addWidget( searchFunct, 0, 0 );
93
94 typeFunction = new TQComboBox(page);
95 TQStringList cats = FunctionRepository::self()->groups();
96 cats.prepend( i18n("All") );
97 typeFunction->insertStringList( cats );
98 grid1->addWidget( typeFunction, 1, 0 );
99
100 functions = new TQListBox(page);
101 TQSizePolicy sp1( TQSizePolicy::Preferred, TQSizePolicy::Expanding );
102 functions->setSizePolicy( sp1 );
103 grid1->addWidget( functions, 2, 0 );
104
105 selectFunction = new TQPushButton( page );
106 TQToolTip::add(selectFunction, i18n("Insert function") );
107 selectFunction->setPixmap( BarIcon( "go-down", TDEIcon::SizeSmall ) );
108 grid1->addWidget( selectFunction, 3, 0 );
109
110 result = new TQLineEdit( page );
111 grid1->addMultiCellWidget( result, 4, 4, 0, 1 );
112
113 m_tabwidget = new TQTabWidget( page );
114 TQSizePolicy sp2( TQSizePolicy::Expanding, TQSizePolicy::Expanding );
115 m_tabwidget->setSizePolicy( sp2 );
116 grid1->addMultiCellWidget( m_tabwidget, 0, 2, 1, 1 );
117
118 m_browser = new TQTextBrowser( m_tabwidget );
119 m_browser->setMinimumWidth( 300 );
120
121 m_tabwidget->addTab( m_browser, i18n("&Help") );
122 int index = m_tabwidget->currentPageIndex();
123
124 m_input = new TQWidget( m_tabwidget );
125 TQVBoxLayout *grid2 = new TQVBoxLayout( m_input, KDialog::marginHint(), KDialog::spacingHint() );
126
127 // grid2->setResizeMode (TQLayout::Minimum);
128
129 label1 = new TQLabel(m_input);
130 grid2->addWidget( label1 );
131
132 firstElement=new TQLineEdit(m_input);
133 grid2->addWidget( firstElement );
134
135 label2=new TQLabel(m_input);
136 grid2->addWidget( label2 );
137
138 secondElement=new TQLineEdit(m_input);
139 grid2->addWidget( secondElement );
140
141 label3=new TQLabel(m_input);
142 grid2->addWidget( label3 );
143
144 thirdElement=new TQLineEdit(m_input);
145 grid2->addWidget( thirdElement );
146
147 label4=new TQLabel(m_input);
148 grid2->addWidget( label4 );
149
150 fourElement=new TQLineEdit(m_input);
151 grid2->addWidget( fourElement );
152
153 label5=new TQLabel(m_input);
154 grid2->addWidget( label5 );
155
156 fiveElement=new TQLineEdit(m_input);
157 grid2->addWidget( fiveElement );
158
159 grid2->addStretch( 10 );
160
161 m_tabwidget->addTab( m_input, i18n("&Parameters") );
162 m_tabwidget->setTabEnabled( m_input, false );
163
164 m_tabwidget->setCurrentPage( index );
165
166 refresh_result = true;
167
168 connect( this, TQ_SIGNAL( cancelClicked() ), this, TQ_SLOT( slotClose() ) );
169 connect( this, TQ_SIGNAL( okClicked() ), this, TQ_SLOT( slotOk() ) );
170 connect( typeFunction, TQ_SIGNAL( activated(const TQString &) ),
171 this, TQ_SLOT( slotActivated(const TQString &) ) );
172 connect( functions, TQ_SIGNAL( highlighted(const TQString &) ),
173 this, TQ_SLOT( slotSelected(const TQString &) ) );
174 connect( functions, TQ_SIGNAL( selected(const TQString &) ),
175 this, TQ_SLOT( slotSelected(const TQString &) ) );
176 connect( functions, TQ_SIGNAL( doubleClicked(TQListBoxItem * ) ),
177 this ,TQ_SLOT( slotDoubleClicked(TQListBoxItem *) ) );
178
179 slotActivated(i18n("All"));
180
181 connect( selectFunction, TQ_SIGNAL(clicked()),
182 this,TQ_SLOT(slotSelectButton()));
183
184 connect( firstElement,TQ_SIGNAL(textChanged ( const TQString & )),
185 this,TQ_SLOT(slotChangeText(const TQString &)));
186 connect( secondElement,TQ_SIGNAL(textChanged ( const TQString & )),
187 this,TQ_SLOT(slotChangeText(const TQString &)));
188 connect( thirdElement,TQ_SIGNAL(textChanged ( const TQString & )),
189 this,TQ_SLOT(slotChangeText(const TQString &)));
190 connect( fourElement,TQ_SIGNAL(textChanged ( const TQString & )),
191 this,TQ_SLOT(slotChangeText(const TQString &)));
192 connect( fiveElement,TQ_SIGNAL(textChanged ( const TQString & )),
193 this,TQ_SLOT(slotChangeText(const TQString &)));
194
195 connect( m_pView->choice(), TQ_SIGNAL(changed(const Region&)),
196 this, TQ_SLOT(slotSelectionChanged()));
197
198 connect( m_browser, TQ_SIGNAL( linkClicked( const TQString& ) ),
199 this, TQ_SLOT( slotShowFunction( const TQString& ) ) );
200
201 // Save the name of the active sheet.
202 m_sheetName = m_pView->activeSheet()->sheetName();
203 // Save the cells current text.
204 TQString tmp_oldText = m_pView->canvasWidget()->editor()->text();
205 // Position of the cell.
206 m_column = m_pView->canvasWidget()->markerColumn();
207 m_row = m_pView->canvasWidget()->markerRow();
208
209 if( tmp_oldText.isEmpty() )
210 result->setText("=");
211 else
212 {
213 if( tmp_oldText.at(0)!='=')
214 result->setText( "=" + tmp_oldText );
215 else
216 result->setText( tmp_oldText );
217 }
218
219 // Allow the user to select cells on the spreadsheet.
220 m_pView->canvasWidget()->startChoose();
221
222 tqApp->installEventFilter( this );
223
224 // Was a function name passed along with the constructor ? Then activate it.
225 if( !formulaName.isEmpty() )
226 {
227 functions->setCurrentItem( functions->index( functions->findItem( formulaName ) ) );
228 slotDoubleClicked( functions->findItem( formulaName ) );
229 }
230 else
231 {
232 // Set keyboard focus to allow selection of a formula.
233 searchFunct->setFocus();
234 }
235
236 // Add auto completion.
237 searchFunct->setCompletionMode( TDEGlobalSettings::CompletionAuto );
238 searchFunct->setCompletionObject( &listFunct, true );
239
240 if( functions->currentItem() == -1 )
241 selectFunction->setEnabled( false );
242
243 connect( searchFunct, TQ_SIGNAL( textChanged( const TQString & ) ),
244 this, TQ_SLOT( slotSearchText(const TQString &) ) );
245 connect( searchFunct, TQ_SIGNAL( returnPressed() ),
246 this, TQ_SLOT( slotPressReturn() ) );
247}
248
249FormulaDialog::~FormulaDialog()
250{
251 kdDebug(36001)<<"FormulaDialog::~FormulaDialog() \n";
252}
253
254void FormulaDialog::slotPressReturn()
255{
256 //laurent 2001-07-07 desactivate this code
257 //because kspread crash.
258 //TODO fix it
259 /*
260 if( !functions->currentText().isEmpty() )
261 slotDoubleClicked( functions->findItem( functions->currentText() ) );
262 */
263}
264
265void FormulaDialog::slotSearchText(const TQString &_text)
266{
267 TQString result = listFunct.makeCompletion( _text.upper() );
268 if( !result.isNull() )
269 functions->setCurrentItem( functions->index( functions->findItem( result ) ) );
270}
271
272bool FormulaDialog::eventFilter( TQObject* obj, TQEvent* ev )
273{
274 if ( obj == firstElement && ev->type() == TQEvent::FocusIn )
275 m_focus = firstElement;
276 else if ( obj == secondElement && ev->type() == TQEvent::FocusIn )
277 m_focus = secondElement;
278 else if ( obj == thirdElement && ev->type() == TQEvent::FocusIn )
279 m_focus = thirdElement;
280 else if ( obj == fourElement && ev->type() == TQEvent::FocusIn )
281 m_focus = fourElement;
282 else if ( obj == fiveElement && ev->type() == TQEvent::FocusIn )
283 m_focus = fiveElement;
284 else
285 return false;
286
287 if ( m_focus )
288 m_pView->canvasWidget()->startChoose();
289
290 return false;
291}
292
293void FormulaDialog::slotOk()
294{
295 m_pView->doc()->emitBeginOperation( false );
296
297 m_pView->canvasWidget()->endChoose();
298 // Switch back to the old sheet
299 if( m_pView->activeSheet()->sheetName() != m_sheetName )
300 {
301 Sheet *sheet=m_pView->doc()->map()->findSheet(m_sheetName);
302 if( sheet)
303 m_pView->setActiveSheet(sheet);
304 }
305
306 // Revert the marker to its original position
307 m_pView->selectionInfo()->initialize( TQPoint( m_column, m_row ) );
308
309 // If there is still an editor then set the text.
310 // Usually the editor is always in place.
311 if( m_pView->canvasWidget()->editor() != 0 )
312 {
313 Q_ASSERT( m_pView->canvasWidget()->editor() );
314 TQString tmp = result->text();
315 if( tmp.at(0) != '=')
316 tmp = "=" + tmp;
317 int pos = m_pView->canvasWidget()->editor()->cursorPosition()+ tmp.length();
318 m_pView->canvasWidget()->editor()->setText( tmp );
319 m_pView->canvasWidget()->editor()->setFocus();
320 m_pView->canvasWidget()->editor()->setCursorPosition( pos );
321 }
322
323 m_pView->slotUpdateView( m_pView->activeSheet() );
324 accept();
325 // delete this;
326}
327
328void FormulaDialog::slotClose()
329{
330 m_pView->doc()->emitBeginOperation( false );
331
332 m_pView->canvasWidget()->endChoose();
333
334 // Switch back to the old sheet
335 if(m_pView->activeSheet()->sheetName() != m_sheetName )
336 {
337 Sheet *sheet=m_pView->doc()->map()->findSheet(m_sheetName);
338 if( !sheet )
339 return;
340 m_pView->setActiveSheet(sheet);
341 }
342
343
344 // Revert the marker to its original position
345 m_pView->selectionInfo()->initialize( TQPoint( m_column, m_row ) );
346
347 // If there is still an editor then reset the text.
348 // Usually the editor is always in place.
349 if( m_pView->canvasWidget()->editor() != 0 )
350 {
351 Q_ASSERT( m_pView->canvasWidget()->editor() );
352 m_pView->canvasWidget()->editor()->setText( m_oldText );
353 m_pView->canvasWidget()->editor()->setFocus();
354 }
355
356 m_pView->slotUpdateView( m_pView->activeSheet() );
357 reject();
358 //laurent 2002-01-03 comment this line otherwise kspread crash
359 //but dialog box is not deleted => not good
360 //delete this;
361}
362
363void FormulaDialog::slotSelectButton()
364{
365 if( functions->currentItem() != -1 )
366 {
367 slotDoubleClicked(functions->findItem(functions->text(functions->currentItem())));
368 }
369}
370
371void FormulaDialog::slotChangeText( const TQString& )
372{
373 // Test the lock
374 if( !refresh_result )
375 return;
376
377 if ( m_focus == 0 )
378 return;
379
380 TQString tmp = m_leftText+m_funcName+"(";
381 tmp += createFormula();
382 tmp = tmp+ ")" + m_rightText;
383
384 result->setText( tmp );
385}
386
387TQString FormulaDialog::createFormula()
388{
389 TQString tmp( "" );
390
391 if ( !m_desc )
392 return TQString();
393
394 bool first = true;
395
396 int count = m_desc->params();
397
398 if(!firstElement->text().isEmpty() && count >= 1 )
399 {
400 tmp=tmp+createParameter(firstElement->text(), 0 );
401 first = false;
402 }
403
404 if(!secondElement->text().isEmpty() && count >= 2 )
405 {
406 first = false;
407 if ( !first )
408 tmp=tmp+";"+createParameter(secondElement->text(), 1 );
409 else
410 tmp=tmp+createParameter(secondElement->text(), 1 );
411 }
412 if(!thirdElement->text().isEmpty() && count >= 3 )
413 {
414 first = false;
415 if ( !first )
416 tmp=tmp+";"+createParameter(thirdElement->text(), 2 );
417 else
418 tmp=tmp+createParameter(thirdElement->text(), 2 );
419 }
420 if(!fourElement->text().isEmpty() && count >= 4 )
421 {
422 first = false;
423 if ( !first )
424 tmp=tmp+";"+createParameter(fourElement->text(), 3 );
425 else
426 tmp=tmp+createParameter(fourElement->text(), 3 );
427 }
428 if(!fiveElement->text().isEmpty() && count >= 5 )
429 {
430 first = false;
431 if ( !first )
432 tmp=tmp+";"+createParameter(fiveElement->text(), 4 );
433 else
434 tmp=tmp+createParameter(fiveElement->text(), 4 );
435 }
436
437 return(tmp);
438}
439
440TQString FormulaDialog::createParameter( const TQString& _text, int param )
441{
442 if ( _text.isEmpty() )
443 return TQString( "" );
444
445 if ( !m_desc )
446 return TQString( "" );
447
448 TQString text;
449
450 ParameterType elementType = m_desc->param( param ).type();
451
452 switch( elementType )
453 {
454 case KSpread_Any:
455 {
456 bool isNumber;
457 double tmp = m_pView->doc()->locale()->readNumber( _text, &isNumber );
458 Q_UNUSED( tmp );
459
460 //In case of number or boolean return _text, else return value as KSpread_String
461 if ( isNumber || _text.upper() =="FALSE" || _text.upper() == "TRUE" )
462 return _text;
463 }
464 // fall through
465 case KSpread_String:
466 {
467 // Does the text start with quotes?
468 if ( _text[0] == '"' )
469 {
470 text = "\\"; // changed: was "\""
471
472 // Escape quotes
473 TQString tmp = _text;
474 int pos;
475 int start = 1;
476 while( ( pos = tmp.find( '"', start ) ) != -1 )
477 {
478 if (tmp[pos - 1] != '\\')
479 tmp.replace( pos, 1, "\\\"" );
480 else
481 start = pos + 1;
482 }
483
484 text += tmp;
485 text += "\"";
486 }
487 else
488 {
489 Point p = Point( _text, m_pView->doc()->map() );
490 Range r = Range( _text, m_pView->doc()->map() );
491
492 if( !p.isValid() && !r.isValid() )
493 {
494 text = "\"";
495
496 // Escape quotes
497 TQString tmp = _text;
498 int pos;
499 int start = 1;
500 while( ( pos = tmp.find( '"', start ) ) != -1 )
501 {
502 if (tmp[pos - 1] != '\\')
503 tmp.replace( pos, 1, "\\\"" );
504 else
505 start = pos + 1;
506 }
507
508 text += tmp;
509 text += "\"";
510 }
511 else
512 text = _text;
513 }
514 }
515 return text;
516 case KSpread_Float:
517 return _text;
518 case KSpread_Boolean:
519 return _text;
520 case KSpread_Int:
521 return _text;
522 }
523
524 // Never reached
525 return text;
526}
527
528static void showEntry( TQLineEdit* edit, TQLabel* label,
529 FunctionDescription* desc, int param )
530{
531 edit->show();
532 label->setText( desc->param( param ).helpText()+":" );
533 label->show();
534 ParameterType elementType = desc->param( param ).type();
535 KFloatValidator *validate=0L;
536 switch( elementType )
537 {
538 case KSpread_String:
539 case KSpread_Boolean:
540 case KSpread_Any:
541 edit->clearValidator ();
542 break;
543 case KSpread_Float:
544 validate=new KFloatValidator (edit);
545 validate->setAcceptLocalizedNumbers(true);
546 edit->setValidator(validate);
547 edit->setText( "0" );
548 break;
549 case KSpread_Int:
550 edit->setValidator(new TQIntValidator (edit));
551 edit->setText( "0" );
552 break;
553 }
554
555}
556
557void FormulaDialog::slotDoubleClicked( TQListBoxItem* item )
558{
559 if ( !item )
560 return;
561 refresh_result = false;
562 if ( !m_desc )
563 {
564 m_browser->setText( "" );
565 return;
566 }
567
568 m_focus = 0;
569 int old_length = result->text().length();
570
571 // Dont change order of these function calls due to a bug in TQt 2.2
572 m_browser->setText( m_desc->toTQML() );
573 m_tabwidget->setTabEnabled( m_input, true );
574 m_tabwidget->setCurrentPage( 1 );
575
576 //
577 // Show as many TQLineEdits as needed.
578 //
579 if( m_desc->params() > 0 )
580 {
581 m_focus = firstElement;
582 firstElement->setFocus();
583
584 showEntry( firstElement, label1, m_desc, 0 );
585 }
586 else
587 {
588 label1->hide();
589 firstElement->hide();
590 }
591
592 if( m_desc->params() > 1 )
593 {
594 showEntry( secondElement, label2, m_desc, 1 );
595 }
596 else
597 {
598 label2->hide();
599 secondElement->hide();
600 }
601
602 if( m_desc->params() > 2 )
603 {
604 showEntry( thirdElement, label3, m_desc, 2 );
605 }
606 else
607 {
608 label3->hide();
609 thirdElement->hide();
610 }
611
612 if( m_desc->params() > 3 )
613 {
614 showEntry( fourElement, label4, m_desc, 3 );
615 }
616 else
617 {
618 label4->hide();
619 fourElement->hide();
620 }
621
622 if( m_desc->params() > 4 )
623 {
624 showEntry( fiveElement, label5, m_desc, 4 );
625 }
626 else
627 {
628 label5->hide();
629 fiveElement->hide();
630 }
631
632 if( m_desc->params() > 5 )
633 {
634 kdDebug(36001) << "Error in param->nb_param" << endl;
635 }
636 refresh_result= true;
637 //
638 // Put the new function call in the result.
639 //
640 if( result->cursorPosition() < old_length )
641 {
642 m_rightText=result->text().right(old_length-result->cursorPosition());
643 m_leftText=result->text().left(result->cursorPosition());
644 }
645 else
646 {
647 m_rightText="";
648 m_leftText=result->text();
649 }
650 int pos = result->cursorPosition();
651 result->setText( m_leftText+functions->text( functions->currentItem() ) + "()" + m_rightText);
652
653 if (result->text()[0] != '=')
654 result->setText("=" + result->text());
655
656 //
657 // Put focus somewhere is there are no TQLineEdits visible
658 //
659 if( m_desc->params() == 0 )
660 {
661 label1->show();
662 label1->setText( i18n("This function has no parameters.") );
663
664 result->setFocus();
665 result->setCursorPosition(pos+functions->text(functions->currentItem()).length()+2);
666 }
667 slotChangeText( "" );
668}
669
670void FormulaDialog::slotSelected( const TQString& function )
671{
672 FunctionDescription* desc =
673 FunctionRepository::self()->functionInfo (function);
674 if ( !desc )
675 {
676 m_browser->setText (i18n ("Description is not available."));
677 return;
678 }
679
680 if( functions->currentItem() !=- 1 )
681 selectFunction->setEnabled( true );
682
683 // Lock
684 refresh_result = false;
685
686 m_funcName = function;
687 m_desc = desc;
688
689 // Set the help text
690 m_browser->setText( m_desc->toTQML() );
691 m_browser->setContentsPos( 0, 0 );
692
693 m_focus=0;
694
695 m_tabwidget->setCurrentPage( 0 );
696 m_tabwidget->setTabEnabled( m_input, false );
697
698 // Unlock
699 refresh_result=true;
700}
701
702// from hyperlink in the "Related Function"
703void FormulaDialog::slotShowFunction( const TQString& function )
704{
705 FunctionDescription* desc =
706 FunctionRepository::self()->functionInfo( function );
707 if ( !desc ) return;
708
709 // select the category
710 TQString category = desc->group();
711 typeFunction->setCurrentText( category );
712 slotActivated( category );
713
714 // select the function
715 TQListBoxItem* item = functions->findItem( function,
716 TQt::ExactMatch | TQt::CaseSensitive );
717 if( item ) functions->setCurrentItem( item );
718
719 slotSelected( function );
720}
721
722void FormulaDialog::slotSelectionChanged()
723{
724 if ( !m_focus )
725 return;
726
727 if (m_pView->choice()->isValid())
728 {
729 TQString area = m_pView->choice()->name();
730 m_focus->setText( area );
731 }
732}
733
734void FormulaDialog::slotActivated( const TQString& category )
735{
736 TQStringList lst;
737 if ( category == i18n("All") )
738 lst = FunctionRepository::self()->functionNames();
739 else
740 lst = FunctionRepository::self()->functionNames( category );
741
742 kdDebug(36001)<<"category: "<<category<<" ("<<lst.count()<<"functions)" << endl;
743
744 functions->clear();
745 functions->insertStringList( lst );
746
747 TQStringList upperList;
748 for ( TQStringList::Iterator it = lst.begin(); it != lst.end();++it )
749 upperList.append((*it).upper());
750
751 listFunct.setItems( upperList );
752
753 // Go to the first function in the list.
754 functions->setCurrentItem(0);
755 slotSelected( functions->text(0) );
756}
757
758void FormulaDialog::closeEvent ( TQCloseEvent * e )
759{
760 e->accept();
761}
762
763#include "kspread_dlg_formula.moc"
For every cell in the spread sheet there is a Cell object.
TQString text() const
Return the text the user entered.
Sheet * findSheet(const TQString &_name)
searches for a sheet named _name
bool isValid() const
Returns true if this Range represents a valid region of a spreadsheet.
The one for all class for points and ranges.
Definition region.h:44
The View class displays a KSpread document.
The KSpread namespace.
Definition commands.h:39