30#include <tqcheckbox.h>
31#include <tqcombobox.h>
32#include <tqvgroupbox.h>
33#include <tqwhatsthis.h>
36#include <kstatusbar.h>
39#include <tdemessagebox.h>
40#include <tdeversion.h>
41#include <kcolorbutton.h>
46#include "kspread_sheet.h"
47#include "kspread_sheetprint.h"
48#include "kspread_doc.h"
49#include "kspread_canvas.h"
50#include "kspread_view.h"
51#include "kspread_locale.h"
52#include "kspread_editors.h"
54#include "kspread_dlg_preference.h"
58PreferenceDialog::PreferenceDialog(
View* parent,
const char* )
59 : KDialogBase(KDialogBase::IconList,i18n(
"Configure KSpread") ,
60 KDialogBase::Ok | KDialogBase::Cancel| KDialogBase::Default,
66 connect(
this, TQ_SIGNAL(okClicked()),
this,TQ_SLOT(slotApply()));
68 TQVBox *page2=addVBoxPage(i18n(
"Locale Settings"), TQString(),BarIcon(
"go-home",TDEIcon::SizeMedium));
69 _localePage=
new parameterLocale(parent,page2 );
71 TQVBox *page3=addVBoxPage(i18n(
"Interface"), TQString(),BarIcon(
"signature", TDEIcon::SizeMedium) );
72 _configure =
new configure(parent,page3 );
74 TQVBox * page4=addVBoxPage(i18n(
"Misc"), TQString(),BarIcon(
"misc",TDEIcon::SizeMedium) );
75 _miscParameter =
new miscParameters(parent,page4 );
77 TQVBox *page5=addVBoxPage(i18n(
"Color"), TQString(),BarIcon(
"colorize",TDEIcon::SizeMedium) );
78 _colorParameter=
new colorParameters(parent,page5 );
80 TQVBox *page6=addVBoxPage(i18n(
"Page Layout"), TQString(),BarIcon(
"edit",TDEIcon::SizeMedium) );
81 _layoutPage=
new configureLayoutPage(parent,page6 );
83 TQVBox *page7 = addVBoxPage( i18n(
"Spelling"), i18n(
"Spell Checker Behavior"),
84 BarIcon(
"tools-check-spelling", TDEIcon::SizeMedium) );
85 _spellPage=
new configureSpellPage(parent,page7);
87 if (KoSpeaker::isKttsdInstalled()) {
88 TQVBox *page8 = addVBoxPage( i18n(
"Abbreviation for Text-to-Speech",
"TTS"),
89 i18n(
"Text-to-Speech Settings"), BarIcon(
"access", TDEIcon::SizeMedium) );
90 _ttsPage=
new configureTTSPage(parent, page8);
95void PreferenceDialog::openPage(
int flags)
99 else if(flags & KS_INTERFACE)
101 else if(flags & KS_MISC)
103 else if(flags & KS_COLOR)
105 else if(flags & KS_LAYOUT)
107 else if(flags & KS_SPELLING)
111void PreferenceDialog::slotApply()
113 m_pView->doc()->emitBeginOperation(
false );
115 _miscParameter->apply();
116 _colorParameter->apply();
117 _layoutPage->apply();
119 _localePage->apply();
120 if (_ttsPage) _ttsPage->apply();
121 m_pView->doc()->refreshInterface();
122 m_pView->slotUpdateView( m_pView->activeSheet() );
125void PreferenceDialog::slotDefault()
127 switch(activePageIndex())
130 _configure->slotDefault();
133 _miscParameter->slotDefault();
136 _colorParameter->slotDefault();
139 _layoutPage->slotDefault();
142 _spellPage->slotDefault();
145 _ttsPage->slotDefault();
153parameterLocale::parameterLocale(
View* _view, TQVBox *box ,
char *name )
154 :TQObject ( box->parent(),name)
157 m_bUpdateLocale=
false;
158 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Settings"), box,
"GroupBox" );
160 TDELocale* locale=_view->doc()->locale();
162 m_language=
new TQLabel( tmpTQGroupBox,
"label");
163 m_number=
new TQLabel( tmpTQGroupBox,
"label6");
164 m_date=
new TQLabel( tmpTQGroupBox,
"label1");
165 m_shortDate=
new TQLabel( tmpTQGroupBox,
"label5");
166 m_time=
new TQLabel( tmpTQGroupBox,
"label2");
167 m_money=
new TQLabel( tmpTQGroupBox,
"label3");
169 updateToMatchLocale(locale);
171 m_updateButton=
new TQPushButton ( i18n(
"&Update Locale Settings"), tmpTQGroupBox);
172 connect(m_updateButton, TQ_SIGNAL(clicked()),
this,TQ_SLOT(updateDefaultSystemConfig()));
175void parameterLocale::apply()
179 m_pView->doc()->emitBeginOperation(
false );
180 m_pView->doc()->refreshLocale();
181 m_pView->slotUpdateView( m_pView->activeSheet() );
185void parameterLocale::updateDefaultSystemConfig()
187 m_bUpdateLocale=
true;
188 static_cast<Locale*
>(m_pView->doc()->locale())->defaultSystemConfig( );
189 TDELocale* locale=m_pView->doc()->locale();
190 updateToMatchLocale( locale );
193void parameterLocale::updateToMatchLocale(TDELocale* locale)
195 m_language->setText( i18n(
"Language: %1").arg( locale->language() ));
196 m_number->setText( i18n(
"Default number format: %1").arg( locale->formatNumber(12.55) ));
197 m_date->setText( i18n(
"Long date format: %1").arg( locale->formatDate( TQDate::currentDate() )));
198 m_shortDate->setText( i18n(
"Short date format: %1").arg( locale->formatDate( TQDate::currentDate() ,
true) ));
199 m_time->setText( i18n(
"Time format: %1").arg( locale->formatTime( TQTime::currentTime() ) ));
200 m_money->setText( i18n(
"Currency format: %1").arg( locale->formatMoney(12.55) ));
203configure::configure(
View* _view, TQVBox *box ,
char *name )
204 :TQObject ( box->parent(),name)
209 bool horizontal=
true;
213 bool formulaBar=
true;
215 m_oldBackupFile =
true;
217 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Settings"), box,
"GroupBox" );
219 config = Factory::global()->config();
223 oldAutoSaveValue=KoDocument::defaultAutoSave()/60;
225 if( config->hasGroup(
"Parameters" ))
227 config->setGroup(
"Parameters" );
228 _page=config->readNumEntry(
"NbPage" ,1) ;
229 horizontal=config->readBoolEntry(
"Horiz ScrollBar",
true);
230 vertical=config->readBoolEntry(
"Vert ScrollBar",
true);
231 colHeader=config->readBoolEntry(
"Column Header",
true);
232 rowHeader=config->readBoolEntry(
"Row Header",
true);
233 tabbar=config->readBoolEntry(
"Tabbar",
true);
234 formulaBar=config->readBoolEntry(
"Formula bar",
true);
235 statusBar=config->readBoolEntry(
"Status bar",
true);
236 oldRecent=config->readNumEntry(
"NbRecentFile" ,10);
237 oldAutoSaveValue=config->readNumEntry(
"AutoSave",KoDocument::defaultAutoSave()/60);
238 m_oldBackupFile=config->readBoolEntry(
"BackupFile",m_oldBackupFile);
240 nbPage=
new KIntNumInput(_page, tmpTQGroupBox , 10);
241 nbPage->setRange(1, 10, 1);
242 nbPage->setLabel(i18n(
"Number of sheets open at the &beginning:"));
243 TQWhatsThis::add(nbPage, i18n(
"Controls how many worksheets will be created if the option Start with an empty document is chosen when KSpread is started." ) );
245 nbRecentFile=
new KIntNumInput(oldRecent, tmpTQGroupBox , 10);
246 nbRecentFile->setRange(1, 20, 1);
247 nbRecentFile->setLabel(i18n(
"&Number of files to show in Recent Files list:"));
248 TQWhatsThis::add(nbRecentFile, i18n(
"Controls the maximum number of filenames that are shown when you select File-> Open Recent." ) );
250 autoSaveDelay=
new KIntNumInput(oldAutoSaveValue, tmpTQGroupBox , 10);
251 autoSaveDelay->setRange(0, 60, 1);
252 autoSaveDelay->setLabel(i18n(
"Au&tosave delay (minutes):"));
253 autoSaveDelay->setSpecialValueText(i18n(
"Do not save automatically"));
254 autoSaveDelay->setSuffix(i18n(
"min"));
255 TQWhatsThis::add(autoSaveDelay, i18n(
"Here you can select the time between autosaves, or disable this feature altogether by choosing Do not save automatically (drag the slider to the far left)." ) );
257 m_createBackupFile =
new TQCheckBox( i18n(
"Create backup files"), tmpTQGroupBox );
258 m_createBackupFile->setChecked( m_oldBackupFile );
259 TQWhatsThis::add(m_createBackupFile, i18n(
"Check this box if you want some backup files created. This is checked per default." ) );
261 showVScrollBar=
new TQCheckBox(i18n(
"Show &vertical scrollbar"),tmpTQGroupBox);
262 showVScrollBar->setChecked(vertical);
263 TQWhatsThis::add(showVScrollBar, i18n(
"Check or uncheck this box to show or hide the vertical scrollbar in all sheets." ) );
265 showHScrollBar=
new TQCheckBox(i18n(
"Show &horizontal scrollbar"),tmpTQGroupBox);
266 showHScrollBar->setChecked(horizontal);
267 TQWhatsThis::add(showHScrollBar, i18n(
"Check or uncheck this box to show or hide the horizontal scrollbar in all sheets." ) );
269 showColHeader=
new TQCheckBox(i18n(
"Show c&olumn header"),tmpTQGroupBox);
270 showColHeader->setChecked(colHeader);
271 TQWhatsThis::add(showColHeader, i18n(
"Check this box to show the column letters across the top of each worksheet." ) );
272 showRowHeader=
new TQCheckBox(i18n(
"Show &row header"),tmpTQGroupBox);
273 showRowHeader->setChecked(rowHeader);
274 TQWhatsThis::add(showRowHeader, i18n(
"Check this box to show the row numbers down the left side." ) );
276 showTabBar =
new TQCheckBox(i18n(
"Show ta&bs"),tmpTQGroupBox);
277 showTabBar->setChecked(tabbar);
278 TQWhatsThis::add(showTabBar, i18n(
"This check box controls whether the sheet tabs are shown at the bottom of the worksheet." ) );
280 showFormulaBar =
new TQCheckBox(i18n(
"Sho&w formula toolbar"),tmpTQGroupBox);
281 showFormulaBar->setChecked(formulaBar);
282 TQWhatsThis::add(showFormulaBar, i18n(
"Here is where you can choose to show or hide the Formula bar." ) );
284 showStatusBar =
new TQCheckBox(i18n(
"Show stat&us bar"),tmpTQGroupBox);
285 showStatusBar->setChecked(statusBar);
286 TQWhatsThis::add(showStatusBar, i18n(
"Uncheck this box if you want to hide the status bar." ) );
290void configure::slotDefault()
292 showHScrollBar->setChecked(
true);
293 showRowHeader->setChecked(
true);
294 showVScrollBar->setChecked(
true);
295 showColHeader->setChecked(
true);
296 showTabBar->setChecked(
true);
297 showFormulaBar->setChecked(
true);
298 showStatusBar->setChecked(
true);
300 nbRecentFile->setValue(10);
301 autoSaveDelay->setValue(KoDocument::defaultAutoSave()/60);
302 m_createBackupFile->setChecked(
true );
306void configure::apply()
308 m_pView->doc()->emitBeginOperation(
false );
309 config->setGroup(
"Parameters" );
310 config->writeEntry(
"NbPage", nbPage->value());
311 Doc *doc =m_pView->doc();
313 active=showHScrollBar->isChecked();
314 if( m_pView->horzScrollBar()->isVisible()!=active)
316 config->writeEntry(
"Horiz ScrollBar",active);
318 m_pView->horzScrollBar()->show();
320 m_pView->horzScrollBar()->hide();
323 active=showVScrollBar->isChecked();
324 if( m_pView->vertScrollBar()->isVisible()!=active)
326 config->writeEntry(
"Vert ScrollBar", active);
328 m_pView->vertScrollBar()->show();
330 m_pView->vertScrollBar()->hide();
334 active=showColHeader->isChecked();
335 if( m_pView->hBorderWidget()->isVisible()!=active)
337 config->writeEntry(
"Column Header", active);
339 m_pView->hBorderWidget()->show();
341 m_pView->hBorderWidget()->hide();
345 active=showRowHeader->isChecked();
346 if( m_pView->vBorderWidget()->isVisible()!=active)
348 config->writeEntry(
"Row Header", active);
350 m_pView->vBorderWidget()->show();
352 m_pView->vBorderWidget()->hide();
356 active=showTabBar->isChecked();
357 if(m_pView->tabBar()->isVisible()!=active)
359 config->writeEntry(
"Tabbar", active);
361 m_pView->tabBar()->show();
363 m_pView->tabBar()->hide();
367 active=showFormulaBar->isChecked();
368 if(m_pView->posWidget()->isVisible()!=active)
370 config->writeEntry(
"Formula bar",active);
371 m_pView->editWidget()->showEditWidget(active);
373 m_pView->posWidget()->show();
375 m_pView->posWidget()->hide();
379 active=showStatusBar->isChecked();
380 config->writeEntry(
"Status bar",active);
381 m_pView->showStatusBar( active );
383 int val=nbRecentFile->value();
386 config->writeEntry(
"NbRecentFile",val);
387 m_pView->changeNbOfRecentFiles(val);
389 val=autoSaveDelay->value();
390 if(val!=oldAutoSaveValue)
392 config->writeEntry(
"AutoSave", val );
393 doc->setAutoSave(val*60);
396 bool state =m_createBackupFile->isChecked();
397 if(state!=m_oldBackupFile)
399 config->writeEntry(
"BackupFile", state );
400 doc->setBackupFile( state);
401 m_oldBackupFile=state;
404 m_pView->slotUpdateView( m_pView->activeSheet() );
408miscParameters::miscParameters(
View* _view,TQVBox *box,
char *name )
409 :TQObject ( box->parent(),name)
414 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Misc"), box,
"GroupBox" );
416 config = Factory::global()->config();
417 indentUnit = _view->doc()->unit();
418 double _indent = KoUnit::toUserValue( 10.0, indentUnit);
419 bool m_bMsgError=
false;
420 if( config->hasGroup(
"Parameters" ))
422 config->setGroup(
"Parameters" );
423 _indent = config->readDoubleNumEntry(
"Indent" , _indent ) ;
424 m_bMsgError=config->readBoolEntry(
"Msg error" ,
false) ;
427 if( config->hasGroup(
"Misc") )
429 config->setGroup(
"Misc" );
430 m_oldNbRedo=config->readNumEntry(
"UndoRedo",m_oldNbRedo);
433 m_undoRedoLimit=
new KIntNumInput( m_oldNbRedo, tmpTQGroupBox );
434 m_undoRedoLimit->setLabel(i18n(
"Undo/redo limit:"));
435 m_undoRedoLimit->setRange(10, 60, 1);
438 TQLabel *label=
new TQLabel(i18n(
"&Completion mode:"), tmpTQGroupBox);
440 typeCompletion=
new TQComboBox(tmpTQGroupBox);
441 label->setBuddy(typeCompletion);
442 TQWhatsThis::add(typeCompletion, i18n(
"Lets you choose the (auto) text completion mode from a range of options in the drop down selection box." ) );
443 TQStringList listType;
444 listType+=i18n(
"None");
445 listType+=i18n(
"Manual");
446 listType+=i18n(
"Popup");
447 listType+=i18n(
"Automatic");
448 listType+=i18n(
"Semi-Automatic");
449 typeCompletion->insertStringList(listType);
450 typeCompletion->setCurrentItem(0);
452 connect(typeCompletion,TQ_SIGNAL(activated(
const TQString & )),
this,TQ_SLOT(slotTextComboChanged(
const TQString &)));
454 label=
new TQLabel(i18n(
"&Pressing enter moves cell cursor:"), tmpTQGroupBox);
455 typeOfMove=
new TQComboBox( tmpTQGroupBox);
456 label->setBuddy(typeOfMove);
458 listType+=i18n(
"Down");
459 listType+=i18n(
"Up");
460 listType+=i18n(
"Right");
461 listType+=i18n(
"Left");
462 listType+=i18n(
"Down, First Column");
463 typeOfMove->insertStringList(listType);
464 typeOfMove->setCurrentItem(0);
465 TQWhatsThis::add(typeOfMove, i18n(
"When you have selected a cell, pressing the Enter key will move the cell cursor one cell left, right, up or down, as determined by this setting." ) );
467 label=
new TQLabel(i18n(
"&Method of calc:"), tmpTQGroupBox);
469 typeCalc=
new TQComboBox( tmpTQGroupBox);
470 label->setBuddy(typeCalc);
471 TQStringList listTypeCalc;
472 listTypeCalc+=i18n(
"Sum");
473 listTypeCalc+=i18n(
"Min");
474 listTypeCalc+=i18n(
"Max");
475 listTypeCalc+=i18n(
"Average");
476 listTypeCalc+=i18n(
"Count");
477 listTypeCalc+=i18n(
"CountA");
478 listTypeCalc+=i18n(
"None");
479 typeCalc->insertStringList(listTypeCalc);
480 typeCalc->setCurrentItem(0);
481 TQWhatsThis::add(typeCalc, i18n(
"This drop down selection box can be used to choose the calculation performed by the Statusbar Summary function." ) );
484 valIndent =
new KDoubleNumInput( tmpTQGroupBox );
485 valIndent->setRange( KoUnit::toUserValue( 0.0, indentUnit ),
486 KoUnit::toUserValue( 400.0, indentUnit ),
487 KoUnit::toUserValue( 10.0, indentUnit) );
489 valIndent->setValue ( KoUnit::toUserValue( _indent, indentUnit ) );
490 TQWhatsThis::add(valIndent, i18n(
"Lets you define the amount of indenting used by the Increase Indent and Decrease Indent option in the Format menu." ) );
491 valIndent->setLabel(i18n(
"&Indentation step (%1):").arg(KoUnit::unitName(indentUnit)));
493 msgError=
new TQCheckBox(i18n(
"&Show error message for invalid formulae"),tmpTQGroupBox);
494 msgError->setChecked(m_bMsgError);
495 TQWhatsThis::add(msgError, i18n(
"If this box is checked a message box will pop up when what you have entered into a cell cannot be understood by KSpread." ) );
500void miscParameters::slotTextComboChanged(
const TQString &)
505void miscParameters::initComboBox()
507 TDEGlobalSettings::Completion tmpCompletion=TDEGlobalSettings::CompletionAuto;
508 if( config->hasGroup(
"Parameters" ))
510 config->setGroup(
"Parameters" );
511 tmpCompletion=( TDEGlobalSettings::Completion)config->readNumEntry(
"Completion Mode" ,TDEGlobalSettings::CompletionAuto) ;
512 config->writeEntry(
"Completion Mode", (
int)tmpCompletion);
514switch(tmpCompletion )
516 case TDEGlobalSettings::CompletionNone:
517 typeCompletion->setCurrentItem(0);
519 case TDEGlobalSettings::CompletionAuto:
520 typeCompletion->setCurrentItem(3);
522 case TDEGlobalSettings::CompletionMan:
523 typeCompletion->setCurrentItem(4);
525 case TDEGlobalSettings::CompletionShell:
526 typeCompletion->setCurrentItem(1);
528 case TDEGlobalSettings::CompletionPopup:
529 typeCompletion->setCurrentItem(2);
532 typeCompletion->setCurrentItem(0);
535switch( m_pView->doc()->getMoveToValue( ))
537 case KSpread::Bottom:
538 typeOfMove->setCurrentItem(0);
541 typeOfMove->setCurrentItem(3);
544 typeOfMove->setCurrentItem(1);
547 typeOfMove->setCurrentItem(2);
549 case KSpread::BottomFirst:
550 typeOfMove->setCurrentItem(4);
553 typeOfMove->setCurrentItem(0);
557switch( m_pView->doc()->getTypeOfCalc())
560 typeCalc->setCurrentItem(0);
563 typeCalc->setCurrentItem(1);
566 typeCalc->setCurrentItem(2);
569 typeCalc->setCurrentItem(3);
572 typeCalc->setCurrentItem(4);
575 typeCalc->setCurrentItem(5);
578 typeCalc->setCurrentItem(6);
581 typeCalc->setCurrentItem(0);
587void miscParameters::slotDefault()
589 m_undoRedoLimit->setValue(30);
590 valIndent->setValue( KoUnit::toUserValue( 10.0, indentUnit) );
591 typeCompletion->setCurrentItem(3);
592 typeOfMove->setCurrentItem(0);
593 msgError->setChecked(
false);
594 typeCalc->setCurrentItem(0);
598void miscParameters::apply()
600 kdDebug() <<
"Applying misc preferences" << endl;
602 config->setGroup(
"Misc" );
603 int const newUndo=m_undoRedoLimit->value();
604 if( newUndo!=m_oldNbRedo )
606 config->writeEntry(
"UndoRedo",newUndo);
607 m_pView->doc()->setUndoRedoLimit(newUndo);
611 config->setGroup(
"Parameters" );
612 TDEGlobalSettings::Completion tmpCompletion=TDEGlobalSettings::CompletionNone;
614 switch(typeCompletion->currentItem())
617 tmpCompletion=TDEGlobalSettings::CompletionNone;
620 tmpCompletion=TDEGlobalSettings::CompletionShell;
623 tmpCompletion=TDEGlobalSettings::CompletionPopup;
626 tmpCompletion=TDEGlobalSettings::CompletionAuto;
629 tmpCompletion=TDEGlobalSettings::CompletionMan;
636 m_pView->doc()->setCompletionMode(tmpCompletion);
637 config->writeEntry(
"Completion Mode", (
int)tmpCompletion);
640 KSpread::MoveTo tmpMoveTo=KSpread::Bottom;
641 switch(typeOfMove->currentItem())
644 tmpMoveTo=KSpread::Bottom;
647 tmpMoveTo=KSpread::Top;
650 tmpMoveTo=KSpread::Right;
653 tmpMoveTo=KSpread::Left;
656 tmpMoveTo=KSpread::BottomFirst;
659 if(tmpMoveTo!=m_pView->doc()->getMoveToValue())
661 m_pView->doc()->setMoveToValue(tmpMoveTo);
662 config->writeEntry(
"Move", (
int)tmpMoveTo);
665 MethodOfCalc tmpMethodCalc=SumOfNumber;
666 switch(typeCalc->currentItem())
669 tmpMethodCalc =SumOfNumber;
678 tmpMethodCalc=Average;
684 tmpMethodCalc=CountA;
687 tmpMethodCalc=NoneCalc;
691 if(tmpMethodCalc!=m_pView->doc()->getTypeOfCalc())
693 m_pView->doc()->setTypeOfCalc(tmpMethodCalc);
694 config->writeEntry(
"Method of Calc", (
int)tmpMethodCalc);
695 m_pView->calcStatusBarOp();
696 m_pView->initCalcMenu();
699 double val = valIndent->value();
700 if( val != m_pView->doc()->getIndentValue() )
702 KoUnit::Unit oldUnit = m_pView->doc()->unit();
703 m_pView->doc()->setUnit(indentUnit);
704 m_pView->doc()->setIndentValue( val );
705 m_pView->doc()->setUnit(oldUnit);
706 config->writeEntry(
"Indent", KoUnit::fromUserValue( val, indentUnit ) );
709 bool active=msgError->isChecked();
710 if(active!=m_pView->doc()->getShowMessageError())
712 m_pView->doc()->setShowMessageError( active);
713 config->writeEntry(
"Msg error" ,(
int)active);
719colorParameters::colorParameters(
View* _view,TQVBox *box ,
char *name )
720 :TQObject ( box->parent(),name)
723 config = Factory::global()->config();
725 TQColor _gridColor(TQt::lightGray);
727 if ( config->hasGroup(
"KSpread Color" ) )
729 config->setGroup(
"KSpread Color" );
730 _gridColor = config->readColorEntry(
"GridColor",&_gridColor);
733 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Color"), box,
"GroupBox" );
735 TQLabel *label =
new TQLabel(i18n(
"&Grid color:"), tmpTQGroupBox,
"label20" );
737 gridColor =
new KColorButton( _gridColor,
740 TQWhatsThis::add(gridColor, i18n(
"Click here to change the grid color ie the color of the borders of each cell." ) );
741 label->setBuddy(gridColor);
743 TQColor _pbColor(TQt::red);
744 if ( config->hasGroup(
"KSpread Color" ) )
746 config->setGroup(
"KSpread Color" );
747 _pbColor = config->readColorEntry(
"PageBorderColor", &_pbColor);
750 TQLabel * label2 =
new TQLabel( i18n(
"&Page borders:"), tmpTQGroupBox,
"label21" );
752 pageBorderColor =
new KColorButton( _pbColor,
755 TQWhatsThis::add(pageBorderColor, i18n(
"When the View ->Show Page Borders menu item is checked, the page borders are displayed. Click here to choose another color for the borders than the default red." ) );
757 label2->setBuddy(pageBorderColor);
760void colorParameters::apply()
762 TQColor _col = gridColor->color();
763 if ( m_pView->doc()->gridColor() != _col )
765 m_pView->doc()->setGridColor( _col );
766 config->setGroup(
"KSpread Color" );
767 config->writeEntry(
"GridColor", _col );
770 TQColor _pbColor = pageBorderColor->color();
771 if ( m_pView->doc()->pageBorderColor() != _pbColor )
773 m_pView->doc()->changePageBorderColor( _pbColor );
774 config->setGroup(
"KSpread Color" );
775 config->writeEntry(
"PageBorderColor", _pbColor );
779void colorParameters::slotDefault()
781 gridColor->setColor( lightGray );
782 pageBorderColor->setColor( red );
787configureLayoutPage::configureLayoutPage(
View* _view,TQVBox *box ,
char *name )
788 :TQObject ( box->parent(),name)
792 TQGroupBox* tmpTQGroupBox =
new TQGroupBox( 0, TQt::Vertical, i18n(
"Default Parameters"), box,
"GroupBox" );
793 tmpTQGroupBox->layout()->setSpacing(KDialog::spacingHint());
794 tmpTQGroupBox->layout()->setMargin(KDialog::marginHint());
796 TQGridLayout *grid1 =
new TQGridLayout(tmpTQGroupBox->layout(),8,1);
797 grid1->addRowSpacing( 0, KDialog::marginHint() );
798 grid1->setRowStretch( 7, 10 );
800 config = Factory::global()->config();
802 TQLabel *label=
new TQLabel(i18n(
"Default page &size:"), tmpTQGroupBox);
804 grid1->addWidget(label,0,0);
806 defaultSizePage=
new TQComboBox( tmpTQGroupBox);
807 label->setBuddy(defaultSizePage);
808 defaultSizePage->insertStringList( KoPageFormat::allFormats() );
809 defaultSizePage->setCurrentItem(1);
810 TQWhatsThis::add(defaultSizePage, i18n(
"Choose the default page size for your worksheet among all the most common page sizes.\nNote that you can overwrite the page size for the current sheet using the Format -> Page Layout... dialog." ) );
811 grid1->addWidget(defaultSizePage,1,0);
813 label=
new TQLabel(i18n(
"Default page &orientation:"), tmpTQGroupBox);
814 grid1->addWidget(label,2,0);
816 defaultOrientationPage=
new TQComboBox( tmpTQGroupBox);
817 label->setBuddy(defaultOrientationPage);
819 TQStringList listType;
820 listType+=i18n(
"Portrait" );
821 listType+=i18n(
"Landscape" );
822 defaultOrientationPage->insertStringList(listType);
823 defaultOrientationPage->setCurrentItem(0);
824 TQWhatsThis::add(defaultOrientationPage, i18n(
"Choose the sheet orientation: portrait or lanscape.\nNote that you can overwrite the orientation for the current sheet using the Format -> Page Layout... dialog." ) );
825 grid1->addWidget(defaultOrientationPage,3,0);
827 label=
new TQLabel(tmpTQGroupBox);
828 label->setText(i18n(
"Default page &unit:"));
829 grid1->addWidget(label,4,0);
830 defaultUnit=
new TQComboBox( tmpTQGroupBox);
831 label->setBuddy(defaultUnit);
833 defaultUnit->insertStringList(KoUnit::listOfUnitName());
834 defaultUnit->setCurrentItem(0);
835 TQWhatsThis::add(defaultUnit, i18n(
"Choose the default unit that will be used in your sheet.\nNote that you can overwrite the unit for the current sheet using the Format -> Page Layout... dialog." ) );
836 grid1->addWidget(defaultUnit,5,0);
841void configureLayoutPage::slotDefault()
843 defaultSizePage->setCurrentItem(1);
844 defaultOrientationPage->setCurrentItem(0);
845 defaultUnit->setCurrentItem(0);
848void configureLayoutPage::initCombo()
853 if( config->hasGroup(
"KSpread Page Layout" ))
855 config->setGroup(
"KSpread Page Layout" );
856 paper=config->readNumEntry(
"Default size page" ,1);
857 orientation=config->readNumEntry(
"Default orientation page" ,0);
858 unit=config->readNumEntry(
"Default unit page" ,0);
861 defaultUnit->setCurrentItem(m_pView->doc()->unit());
862 defaultSizePage->setCurrentItem(paper);
863 defaultOrientationPage->setCurrentItem(orientation);
867void configureLayoutPage::apply()
869 m_pView->doc()->emitBeginOperation(
false );
870 config->setGroup(
"KSpread Page Layout" );
872 if( paper != defaultSizePage->currentItem() )
874 unsigned int sizePage = defaultSizePage->currentItem();
875 config->writeEntry(
"Default size page", sizePage );
876 m_pView->activeSheet()->print()->setPaperFormat( (KoFormat)sizePage );
878 if( orientation != defaultOrientationPage->currentItem() )
880 unsigned int orientationPage = defaultOrientationPage->currentItem();
881 config->writeEntry(
"Default orientation page", orientationPage );
882 m_pView->activeSheet()->print()->setPaperOrientation( (KoOrientation)orientationPage );
884 if( unit != defaultUnit->currentItem() )
886 unsigned int unitPage = defaultUnit->currentItem();
887 config->writeEntry(
"Default unit page", unitPage );
888 m_pView->doc()->setUnit( (KoUnit::Unit)unitPage );
890 m_pView->slotUpdateView( m_pView->activeSheet() );
893configureSpellPage::configureSpellPage(
View* _view,TQVBox *box ,
char *name )
894 :TQObject ( box->parent(),name)
898 config = Factory::global()->config();
901 m_spellConfigWidget =
new KSpellConfig( box,
"spell_check",m_pView->doc()->getKSpellConfig());
902 dontCheckUpperWord =
new TQCheckBox( i18n(
"Skip all uppercase words"),box);
903 TQWhatsThis::add(dontCheckUpperWord, i18n(
"If checked, the words written in uppercase letters are not spell checked. This might be useful if you have a lot of acronyms such as TDE for example." ) );
904 dontCheckTitleCase =
new TQCheckBox( i18n(
"Do not check title case"),box);
905 TQWhatsThis::add(dontCheckTitleCase, i18n(
"Check this box if you want the spellchecker to ignore the title case, for example My Own Spreadsheet or My own spreadsheet. If this is unchecked, the spell checker will ask for a uppercase letter in the title nouns." ) );
907 TQWidget* spacer =
new TQWidget( box );
908 spacer->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Expanding ) );
910 if( config->hasGroup(
"KSpell kspread") )
912 config->setGroup(
"KSpell kspread" );
914 dontCheckUpperWord->setChecked(config->readBoolEntry(
"KSpell_dont_check_upper_word",
false));
915 dontCheckTitleCase->setChecked(config->readBoolEntry(
"KSpell_dont_check_title_case",
false));
921void configureSpellPage::apply()
923 m_pView->doc()->emitBeginOperation(
false );
925 KSpellConfig *_spellConfig = m_spellConfigWidget;
926 config->setGroup(
"KSpell kspread" );
927 config->writeEntry (
"KSpell_NoRootAffix",(
int) _spellConfig->noRootAffix ());
928 config->writeEntry (
"KSpell_RunTogether", (
int) _spellConfig->runTogether ());
929 config->writeEntry (
"KSpell_Dictionary", _spellConfig->dictionary ());
930 config->writeEntry (
"KSpell_DictFromList",(
int) _spellConfig->dictFromList());
931 config->writeEntry (
"KSpell_Encoding", (
int) _spellConfig->encoding());
932 config->writeEntry (
"KSpell_Client", _spellConfig->client());
934 Doc* doc = m_pView->doc();
937 bool state=dontCheckUpperWord->isChecked();
938 config->writeEntry (
"KSpell_dont_check_upper_word",(
int)state);
939 doc->setDontCheckUpperWord(state);
941 state=dontCheckTitleCase->isChecked();
942 config->writeEntry(
"KSpell_dont_check_title_case",(
int)state);
943 doc->setDontCheckTitleCase(state);
947 m_pView->slotUpdateView( m_pView->activeSheet() );
950void configureSpellPage::slotDefault()
958configureTTSPage::configureTTSPage(
View *_view, TQVBox *box,
char *name )
959 : TQObject( box->parent(), name )
963 m_cbSpeakPointerWidget =
new TQCheckBox(i18n(
"Speak widget under &mouse pointer"), box);
964 m_cbSpeakFocusWidget =
new TQCheckBox(i18n(
"Speak widget with &focus"), box);
965 m_gbScreenReaderOptions =
new TQVGroupBox(
"", box);
966 m_gbScreenReaderOptions->setMargin( KDialog::marginHint() );
967 m_gbScreenReaderOptions->setInsideSpacing( KDialog::spacingHint() );
968 m_cbSpeakTooltips =
new TQCheckBox(i18n(
"Speak &tool tips"), m_gbScreenReaderOptions);
969 m_cbSpeakWhatsThis =
new TQCheckBox(i18n(
"Speak &What's This"), m_gbScreenReaderOptions);
970 m_cbSpeakDisabled =
new TQCheckBox(i18n(
"Verbal indication if widget is disabled (grayed)",
971 "&Say whether disabled"), m_gbScreenReaderOptions);
972 m_cbSpeakAccelerators =
new TQCheckBox(i18n(
"Spea&k accelerators"), m_gbScreenReaderOptions);
973 TQHBox* hbAcceleratorPrefix =
new TQHBox(m_gbScreenReaderOptions);
974 TQWidget* spacer =
new TQWidget(hbAcceleratorPrefix);
975 spacer->setMinimumWidth(2 * KDialog::marginHint());
976 m_lblAcceleratorPrefix =
977 new TQLabel(i18n(
"A word spoken before another word",
"Pr&efaced by the word:"),
978 hbAcceleratorPrefix);
979 m_leAcceleratorPrefixWord =
new TQLineEdit(i18n(
"Keyboard accelerator, such as Alt+F",
"Accelerator"),
980 hbAcceleratorPrefix);
981 m_lblAcceleratorPrefix->setBuddy(m_leAcceleratorPrefixWord);
982 TQHBox* hbPollingInterval =
new TQHBox(m_gbScreenReaderOptions);
983 hbPollingInterval->setMargin( 0 );
984 TQLabel* lblPollingInterval =
new TQLabel(i18n(
"&Polling interval:"), hbPollingInterval);
985 m_iniPollingInterval =
new KIntNumInput(hbPollingInterval);
986 m_iniPollingInterval->setSuffix(
" ms");
987 m_iniPollingInterval->setRange(100, 5000, 100,
true);
988 lblPollingInterval->setBuddy(m_iniPollingInterval);
990 config = Factory::global()->config();
991 config->setGroup(
"TTS");
992 m_cbSpeakPointerWidget->setChecked(config->readBoolEntry(
"SpeakPointerWidget",
false));
993 m_cbSpeakFocusWidget->setChecked(config->readBoolEntry(
"SpeakFocusWidget",
false));
994 m_cbSpeakTooltips->setChecked(config->readBoolEntry(
"SpeakTooltips",
true));
995 m_cbSpeakWhatsThis->setChecked(config->readBoolEntry(
"SpeakWhatsThis",
false));
996 m_cbSpeakDisabled->setChecked(config->readBoolEntry(
"SpeakDisabled",
true));
997 m_cbSpeakAccelerators->setChecked(config->readBoolEntry(
"SpeakAccelerators",
true));
998 m_leAcceleratorPrefixWord->setText(config->readEntry(
"AcceleratorPrefixWord",
999 i18n(
"Keyboard accelerator, such as Alt+F",
"Accelerator")));
1000 m_iniPollingInterval->setValue(config->readNumEntry(
"PollingInterval", 600));
1002 screenReaderOptionChanged();
1003 connect(m_cbSpeakPointerWidget, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(screenReaderOptionChanged()));
1004 connect(m_cbSpeakFocusWidget, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(screenReaderOptionChanged()));
1005 connect(m_cbSpeakAccelerators, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(screenReaderOptionChanged()));
1008void configureTTSPage::slotDefault()
1010 m_cbSpeakPointerWidget->setChecked(
false);
1011 m_cbSpeakFocusWidget->setChecked(
false);
1012 m_cbSpeakTooltips->setChecked(
true);
1013 m_cbSpeakWhatsThis->setChecked(
false);
1014 m_cbSpeakDisabled->setChecked(
true);
1015 m_cbSpeakAccelerators->setChecked(
true);
1016 m_leAcceleratorPrefixWord->setText(i18n(
"Keyboard accelerator, such as Alt+F",
"Accelerator"));
1017 m_iniPollingInterval->setValue(600);
1020void configureTTSPage::apply()
1022 config->setGroup(
"TTS");
1023 config->writeEntry(
"SpeakPointerWidget", m_cbSpeakPointerWidget->isChecked());
1024 config->writeEntry(
"SpeakFocusWidget", m_cbSpeakFocusWidget->isChecked());
1025 config->writeEntry(
"SpeakTooltips", m_cbSpeakTooltips->isChecked());
1026 config->writeEntry(
"SpeakWhatsThis", m_cbSpeakWhatsThis->isChecked());
1027 config->writeEntry(
"SpeakDisabled", m_cbSpeakDisabled->isChecked());
1028 config->writeEntry(
"SpeakAccelerators", m_cbSpeakAccelerators->isChecked());
1029 config->writeEntry(
"AcceleratorPrefixWord", m_leAcceleratorPrefixWord->text());
1030 config->writeEntry(
"PollingInterval", m_iniPollingInterval->value());
1031 if (kospeaker) kospeaker->readConfig(config);
1034void configureTTSPage::screenReaderOptionChanged()
1036 m_gbScreenReaderOptions->setEnabled(
1037 m_cbSpeakPointerWidget->isChecked() || m_cbSpeakFocusWidget->isChecked());
1038 m_leAcceleratorPrefixWord->setEnabled(m_cbSpeakAccelerators->isChecked());
1039 m_lblAcceleratorPrefix->setEnabled(m_cbSpeakAccelerators->isChecked());
1042#include "kspread_dlg_preference.moc"
This class holds the data that makes up a spreadsheet.
void setShowTabBar(bool b)
If b is true, tab bar is visible, otherwise it will be hidden.
void setShowVerticalScrollBar(bool b)
If b is true, vertical scrollbar is visible, otherwise it will be hidden.
void setShowColHeader(bool b)
void setShowHorizontalScrollBar(bool b)
If b is true, horizontal scrollbar is visible, otherwise it will be hidden.
void setShowFormulaBar(bool b)
If b is true, formula bar is visible, otherwise it will be hidden.
void setKSpellConfig(KSpellConfig _tdespell)
get custom tdespell config
void setShowRowHeader(bool b)
If b is true, row header is visible, otherwise it will be hidden.
The View class displays a KSpread document.