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 <kcolorbutton.h>
45#include "kspread_sheet.h"
46#include "kspread_sheetprint.h"
47#include "kspread_doc.h"
48#include "kspread_canvas.h"
49#include "kspread_view.h"
50#include "kspread_locale.h"
51#include "kspread_editors.h"
53#include "kspread_dlg_preference.h"
57PreferenceDialog::PreferenceDialog(
View* parent,
const char* )
58 : KDialogBase(KDialogBase::IconList,i18n(
"Configure KSpread") ,
59 KDialogBase::Ok | KDialogBase::Cancel| KDialogBase::Default,
65 connect(
this, TQ_SIGNAL(okClicked()),
this,TQ_SLOT(slotApply()));
67 TQVBox *page2=addVBoxPage(i18n(
"Locale Settings"), TQString(),BarIcon(
"go-home",TDEIcon::SizeMedium));
68 _localePage=
new parameterLocale(parent,page2 );
70 TQVBox *page3=addVBoxPage(i18n(
"Interface"), TQString(),BarIcon(
"signature", TDEIcon::SizeMedium) );
71 _configure =
new configure(parent,page3 );
73 TQVBox * page4=addVBoxPage(i18n(
"Misc"), TQString(),BarIcon(
"misc",TDEIcon::SizeMedium) );
74 _miscParameter =
new miscParameters(parent,page4 );
76 TQVBox *page5=addVBoxPage(i18n(
"Color"), TQString(),BarIcon(
"colorize",TDEIcon::SizeMedium) );
77 _colorParameter=
new colorParameters(parent,page5 );
79 TQVBox *page6=addVBoxPage(i18n(
"Page Layout"), TQString(),BarIcon(
"edit",TDEIcon::SizeMedium) );
80 _layoutPage=
new configureLayoutPage(parent,page6 );
82 TQVBox *page7 = addVBoxPage( i18n(
"Spelling"), i18n(
"Spell Checker Behavior"),
83 BarIcon(
"tools-check-spelling", TDEIcon::SizeMedium) );
84 _spellPage=
new configureSpellPage(parent,page7);
86 if (KoSpeaker::isKttsdInstalled()) {
87 TQVBox *page8 = addVBoxPage( i18n(
"Abbreviation for Text-to-Speech",
"TTS"),
88 i18n(
"Text-to-Speech Settings"), BarIcon(
"access", TDEIcon::SizeMedium) );
89 _ttsPage=
new configureTTSPage(parent, page8);
94void PreferenceDialog::openPage(
int flags)
98 else if(flags & KS_INTERFACE)
100 else if(flags & KS_MISC)
102 else if(flags & KS_COLOR)
104 else if(flags & KS_LAYOUT)
106 else if(flags & KS_SPELLING)
110void PreferenceDialog::slotApply()
112 m_pView->doc()->emitBeginOperation(
false );
114 _miscParameter->apply();
115 _colorParameter->apply();
116 _layoutPage->apply();
118 _localePage->apply();
119 if (_ttsPage) _ttsPage->apply();
120 m_pView->doc()->refreshInterface();
121 m_pView->slotUpdateView( m_pView->activeSheet() );
124void PreferenceDialog::slotDefault()
126 switch(activePageIndex())
129 _configure->slotDefault();
132 _miscParameter->slotDefault();
135 _colorParameter->slotDefault();
138 _layoutPage->slotDefault();
141 _spellPage->slotDefault();
144 _ttsPage->slotDefault();
152parameterLocale::parameterLocale(
View* _view, TQVBox *box ,
char *name )
153 :TQObject ( box->parent(),name)
156 m_bUpdateLocale=
false;
157 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Settings"), box,
"GroupBox" );
159 TDELocale* locale=_view->doc()->locale();
161 m_language=
new TQLabel( tmpTQGroupBox,
"label");
162 m_number=
new TQLabel( tmpTQGroupBox,
"label6");
163 m_date=
new TQLabel( tmpTQGroupBox,
"label1");
164 m_shortDate=
new TQLabel( tmpTQGroupBox,
"label5");
165 m_time=
new TQLabel( tmpTQGroupBox,
"label2");
166 m_money=
new TQLabel( tmpTQGroupBox,
"label3");
168 updateToMatchLocale(locale);
170 m_updateButton=
new TQPushButton ( i18n(
"&Update Locale Settings"), tmpTQGroupBox);
171 connect(m_updateButton, TQ_SIGNAL(clicked()),
this,TQ_SLOT(updateDefaultSystemConfig()));
174void parameterLocale::apply()
178 m_pView->doc()->emitBeginOperation(
false );
179 m_pView->doc()->refreshLocale();
180 m_pView->slotUpdateView( m_pView->activeSheet() );
184void parameterLocale::updateDefaultSystemConfig()
186 m_bUpdateLocale=
true;
187 static_cast<Locale*
>(m_pView->doc()->locale())->defaultSystemConfig( );
188 TDELocale* locale=m_pView->doc()->locale();
189 updateToMatchLocale( locale );
192void parameterLocale::updateToMatchLocale(TDELocale* locale)
194 m_language->setText( i18n(
"Language: %1").arg( locale->language() ));
195 m_number->setText( i18n(
"Default number format: %1").arg( locale->formatNumber(12.55) ));
196 m_date->setText( i18n(
"Long date format: %1").arg( locale->formatDate( TQDate::currentDate() )));
197 m_shortDate->setText( i18n(
"Short date format: %1").arg( locale->formatDate( TQDate::currentDate() ,
true) ));
198 m_time->setText( i18n(
"Time format: %1").arg( locale->formatTime( TQTime::currentTime() ) ));
199 m_money->setText( i18n(
"Currency format: %1").arg( locale->formatMoney(12.55) ));
202configure::configure(
View* _view, TQVBox *box ,
char *name )
203 :TQObject ( box->parent(),name)
208 bool horizontal=
true;
212 bool formulaBar=
true;
214 m_oldBackupFile =
true;
216 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Settings"), box,
"GroupBox" );
218 config = Factory::global()->config();
222 oldAutoSaveValue=KoDocument::defaultAutoSave()/60;
224 if( config->hasGroup(
"Parameters" ))
226 config->setGroup(
"Parameters" );
227 _page=config->readNumEntry(
"NbPage" ,1) ;
228 horizontal=config->readBoolEntry(
"Horiz ScrollBar",
true);
229 vertical=config->readBoolEntry(
"Vert ScrollBar",
true);
230 colHeader=config->readBoolEntry(
"Column Header",
true);
231 rowHeader=config->readBoolEntry(
"Row Header",
true);
232 tabbar=config->readBoolEntry(
"Tabbar",
true);
233 formulaBar=config->readBoolEntry(
"Formula bar",
true);
234 statusBar=config->readBoolEntry(
"Status bar",
true);
235 oldRecent=config->readNumEntry(
"NbRecentFile" ,10);
236 oldAutoSaveValue=config->readNumEntry(
"AutoSave",KoDocument::defaultAutoSave()/60);
237 m_oldBackupFile=config->readBoolEntry(
"BackupFile",m_oldBackupFile);
239 nbPage=
new KIntNumInput(_page, tmpTQGroupBox , 10);
240 nbPage->setRange(1, 10, 1);
241 nbPage->setLabel(i18n(
"Number of sheets open at the &beginning:"));
242 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." ) );
244 nbRecentFile=
new KIntNumInput(oldRecent, tmpTQGroupBox , 10);
245 nbRecentFile->setRange(1, 20, 1);
246 nbRecentFile->setLabel(i18n(
"&Number of files to show in Recent Files list:"));
247 TQWhatsThis::add(nbRecentFile, i18n(
"Controls the maximum number of filenames that are shown when you select File-> Open Recent." ) );
249 autoSaveDelay=
new KIntNumInput(oldAutoSaveValue, tmpTQGroupBox , 10);
250 autoSaveDelay->setRange(0, 60, 1);
251 autoSaveDelay->setLabel(i18n(
"Au&tosave delay (minutes):"));
252 autoSaveDelay->setSpecialValueText(i18n(
"Do not save automatically"));
253 autoSaveDelay->setSuffix(i18n(
"min"));
254 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)." ) );
256 m_createBackupFile =
new TQCheckBox( i18n(
"Create backup files"), tmpTQGroupBox );
257 m_createBackupFile->setChecked( m_oldBackupFile );
258 TQWhatsThis::add(m_createBackupFile, i18n(
"Check this box if you want some backup files created. This is checked per default." ) );
260 showVScrollBar=
new TQCheckBox(i18n(
"Show &vertical scrollbar"),tmpTQGroupBox);
261 showVScrollBar->setChecked(vertical);
262 TQWhatsThis::add(showVScrollBar, i18n(
"Check or uncheck this box to show or hide the vertical scrollbar in all sheets." ) );
264 showHScrollBar=
new TQCheckBox(i18n(
"Show &horizontal scrollbar"),tmpTQGroupBox);
265 showHScrollBar->setChecked(horizontal);
266 TQWhatsThis::add(showHScrollBar, i18n(
"Check or uncheck this box to show or hide the horizontal scrollbar in all sheets." ) );
268 showColHeader=
new TQCheckBox(i18n(
"Show c&olumn header"),tmpTQGroupBox);
269 showColHeader->setChecked(colHeader);
270 TQWhatsThis::add(showColHeader, i18n(
"Check this box to show the column letters across the top of each worksheet." ) );
271 showRowHeader=
new TQCheckBox(i18n(
"Show &row header"),tmpTQGroupBox);
272 showRowHeader->setChecked(rowHeader);
273 TQWhatsThis::add(showRowHeader, i18n(
"Check this box to show the row numbers down the left side." ) );
275 showTabBar =
new TQCheckBox(i18n(
"Show ta&bs"),tmpTQGroupBox);
276 showTabBar->setChecked(tabbar);
277 TQWhatsThis::add(showTabBar, i18n(
"This check box controls whether the sheet tabs are shown at the bottom of the worksheet." ) );
279 showFormulaBar =
new TQCheckBox(i18n(
"Sho&w formula toolbar"),tmpTQGroupBox);
280 showFormulaBar->setChecked(formulaBar);
281 TQWhatsThis::add(showFormulaBar, i18n(
"Here is where you can choose to show or hide the Formula bar." ) );
283 showStatusBar =
new TQCheckBox(i18n(
"Show stat&us bar"),tmpTQGroupBox);
284 showStatusBar->setChecked(statusBar);
285 TQWhatsThis::add(showStatusBar, i18n(
"Uncheck this box if you want to hide the status bar." ) );
289void configure::slotDefault()
291 showHScrollBar->setChecked(
true);
292 showRowHeader->setChecked(
true);
293 showVScrollBar->setChecked(
true);
294 showColHeader->setChecked(
true);
295 showTabBar->setChecked(
true);
296 showFormulaBar->setChecked(
true);
297 showStatusBar->setChecked(
true);
299 nbRecentFile->setValue(10);
300 autoSaveDelay->setValue(KoDocument::defaultAutoSave()/60);
301 m_createBackupFile->setChecked(
true );
305void configure::apply()
307 m_pView->doc()->emitBeginOperation(
false );
308 config->setGroup(
"Parameters" );
309 config->writeEntry(
"NbPage", nbPage->value());
310 Doc *doc =m_pView->doc();
312 active=showHScrollBar->isChecked();
313 if( m_pView->horzScrollBar()->isVisible()!=active)
315 config->writeEntry(
"Horiz ScrollBar",active);
317 m_pView->horzScrollBar()->show();
319 m_pView->horzScrollBar()->hide();
322 active=showVScrollBar->isChecked();
323 if( m_pView->vertScrollBar()->isVisible()!=active)
325 config->writeEntry(
"Vert ScrollBar", active);
327 m_pView->vertScrollBar()->show();
329 m_pView->vertScrollBar()->hide();
333 active=showColHeader->isChecked();
334 if( m_pView->hBorderWidget()->isVisible()!=active)
336 config->writeEntry(
"Column Header", active);
338 m_pView->hBorderWidget()->show();
340 m_pView->hBorderWidget()->hide();
344 active=showRowHeader->isChecked();
345 if( m_pView->vBorderWidget()->isVisible()!=active)
347 config->writeEntry(
"Row Header", active);
349 m_pView->vBorderWidget()->show();
351 m_pView->vBorderWidget()->hide();
355 active=showTabBar->isChecked();
356 if(m_pView->tabBar()->isVisible()!=active)
358 config->writeEntry(
"Tabbar", active);
360 m_pView->tabBar()->show();
362 m_pView->tabBar()->hide();
366 active=showFormulaBar->isChecked();
367 if(m_pView->posWidget()->isVisible()!=active)
369 config->writeEntry(
"Formula bar",active);
370 m_pView->editWidget()->showEditWidget(active);
372 m_pView->posWidget()->show();
374 m_pView->posWidget()->hide();
378 active=showStatusBar->isChecked();
379 config->writeEntry(
"Status bar",active);
380 m_pView->showStatusBar( active );
382 int val=nbRecentFile->value();
385 config->writeEntry(
"NbRecentFile",val);
386 m_pView->changeNbOfRecentFiles(val);
388 val=autoSaveDelay->value();
389 if(val!=oldAutoSaveValue)
391 config->writeEntry(
"AutoSave", val );
392 doc->setAutoSave(val*60);
395 bool state =m_createBackupFile->isChecked();
396 if(state!=m_oldBackupFile)
398 config->writeEntry(
"BackupFile", state );
399 doc->setBackupFile( state);
400 m_oldBackupFile=state;
403 m_pView->slotUpdateView( m_pView->activeSheet() );
407miscParameters::miscParameters(
View* _view,TQVBox *box,
char *name )
408 :TQObject ( box->parent(),name)
413 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Misc"), box,
"GroupBox" );
415 config = Factory::global()->config();
416 indentUnit = _view->doc()->unit();
417 double _indent = KoUnit::toUserValue( 10.0, indentUnit);
418 bool m_bMsgError=
false;
419 if( config->hasGroup(
"Parameters" ))
421 config->setGroup(
"Parameters" );
422 _indent = config->readDoubleNumEntry(
"Indent" , _indent ) ;
423 m_bMsgError=config->readBoolEntry(
"Msg error" ,
false) ;
426 if( config->hasGroup(
"Misc") )
428 config->setGroup(
"Misc" );
429 m_oldNbRedo=config->readNumEntry(
"UndoRedo",m_oldNbRedo);
432 m_undoRedoLimit=
new KIntNumInput( m_oldNbRedo, tmpTQGroupBox );
433 m_undoRedoLimit->setLabel(i18n(
"Undo/redo limit:"));
434 m_undoRedoLimit->setRange(10, 60, 1);
437 TQLabel *label=
new TQLabel(i18n(
"&Completion mode:"), tmpTQGroupBox);
439 typeCompletion=
new TQComboBox(tmpTQGroupBox);
440 label->setBuddy(typeCompletion);
441 TQWhatsThis::add(typeCompletion, i18n(
"Lets you choose the (auto) text completion mode from a range of options in the drop down selection box." ) );
442 TQStringList listType;
443 listType+=i18n(
"None");
444 listType+=i18n(
"Manual");
445 listType+=i18n(
"Popup");
446 listType+=i18n(
"Automatic");
447 listType+=i18n(
"Semi-Automatic");
448 typeCompletion->insertStringList(listType);
449 typeCompletion->setCurrentItem(0);
451 connect(typeCompletion,TQ_SIGNAL(activated(
const TQString & )),
this,TQ_SLOT(slotTextComboChanged(
const TQString &)));
453 label=
new TQLabel(i18n(
"&Pressing enter moves cell cursor:"), tmpTQGroupBox);
454 typeOfMove=
new TQComboBox( tmpTQGroupBox);
455 label->setBuddy(typeOfMove);
457 listType+=i18n(
"Down");
458 listType+=i18n(
"Up");
459 listType+=i18n(
"Right");
460 listType+=i18n(
"Left");
461 listType+=i18n(
"Down, First Column");
462 typeOfMove->insertStringList(listType);
463 typeOfMove->setCurrentItem(0);
464 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." ) );
466 label=
new TQLabel(i18n(
"&Method of calc:"), tmpTQGroupBox);
468 typeCalc=
new TQComboBox( tmpTQGroupBox);
469 label->setBuddy(typeCalc);
470 TQStringList listTypeCalc;
471 listTypeCalc+=i18n(
"Sum");
472 listTypeCalc+=i18n(
"Min");
473 listTypeCalc+=i18n(
"Max");
474 listTypeCalc+=i18n(
"Average");
475 listTypeCalc+=i18n(
"Count");
476 listTypeCalc+=i18n(
"CountA");
477 listTypeCalc+=i18n(
"None");
478 typeCalc->insertStringList(listTypeCalc);
479 typeCalc->setCurrentItem(0);
480 TQWhatsThis::add(typeCalc, i18n(
"This drop down selection box can be used to choose the calculation performed by the Statusbar Summary function." ) );
483 valIndent =
new KDoubleNumInput( tmpTQGroupBox );
484 valIndent->setRange( KoUnit::toUserValue( 0.0, indentUnit ),
485 KoUnit::toUserValue( 400.0, indentUnit ),
486 KoUnit::toUserValue( 10.0, indentUnit) );
488 valIndent->setValue ( KoUnit::toUserValue( _indent, indentUnit ) );
489 TQWhatsThis::add(valIndent, i18n(
"Lets you define the amount of indenting used by the Increase Indent and Decrease Indent option in the Format menu." ) );
490 valIndent->setLabel(i18n(
"&Indentation step (%1):").arg(KoUnit::unitName(indentUnit)));
492 msgError=
new TQCheckBox(i18n(
"&Show error message for invalid formulae"),tmpTQGroupBox);
493 msgError->setChecked(m_bMsgError);
494 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." ) );
499void miscParameters::slotTextComboChanged(
const TQString &)
504void miscParameters::initComboBox()
506 TDEGlobalSettings::Completion tmpCompletion=TDEGlobalSettings::CompletionAuto;
507 if( config->hasGroup(
"Parameters" ))
509 config->setGroup(
"Parameters" );
510 tmpCompletion=( TDEGlobalSettings::Completion)config->readNumEntry(
"Completion Mode" ,TDEGlobalSettings::CompletionAuto) ;
511 config->writeEntry(
"Completion Mode", (
int)tmpCompletion);
513switch(tmpCompletion )
515 case TDEGlobalSettings::CompletionNone:
516 typeCompletion->setCurrentItem(0);
518 case TDEGlobalSettings::CompletionAuto:
519 typeCompletion->setCurrentItem(3);
521 case TDEGlobalSettings::CompletionMan:
522 typeCompletion->setCurrentItem(4);
524 case TDEGlobalSettings::CompletionShell:
525 typeCompletion->setCurrentItem(1);
527 case TDEGlobalSettings::CompletionPopup:
528 typeCompletion->setCurrentItem(2);
531 typeCompletion->setCurrentItem(0);
534switch( m_pView->doc()->getMoveToValue( ))
536 case KSpread::Bottom:
537 typeOfMove->setCurrentItem(0);
540 typeOfMove->setCurrentItem(3);
543 typeOfMove->setCurrentItem(1);
546 typeOfMove->setCurrentItem(2);
548 case KSpread::BottomFirst:
549 typeOfMove->setCurrentItem(4);
552 typeOfMove->setCurrentItem(0);
556switch( m_pView->doc()->getTypeOfCalc())
559 typeCalc->setCurrentItem(0);
562 typeCalc->setCurrentItem(1);
565 typeCalc->setCurrentItem(2);
568 typeCalc->setCurrentItem(3);
571 typeCalc->setCurrentItem(4);
574 typeCalc->setCurrentItem(5);
577 typeCalc->setCurrentItem(6);
580 typeCalc->setCurrentItem(0);
586void miscParameters::slotDefault()
588 m_undoRedoLimit->setValue(30);
589 valIndent->setValue( KoUnit::toUserValue( 10.0, indentUnit) );
590 typeCompletion->setCurrentItem(3);
591 typeOfMove->setCurrentItem(0);
592 msgError->setChecked(
false);
593 typeCalc->setCurrentItem(0);
597void miscParameters::apply()
599 kdDebug() <<
"Applying misc preferences" << endl;
601 config->setGroup(
"Misc" );
602 int const newUndo=m_undoRedoLimit->value();
603 if( newUndo!=m_oldNbRedo )
605 config->writeEntry(
"UndoRedo",newUndo);
606 m_pView->doc()->setUndoRedoLimit(newUndo);
610 config->setGroup(
"Parameters" );
611 TDEGlobalSettings::Completion tmpCompletion=TDEGlobalSettings::CompletionNone;
613 switch(typeCompletion->currentItem())
616 tmpCompletion=TDEGlobalSettings::CompletionNone;
619 tmpCompletion=TDEGlobalSettings::CompletionShell;
622 tmpCompletion=TDEGlobalSettings::CompletionPopup;
625 tmpCompletion=TDEGlobalSettings::CompletionAuto;
628 tmpCompletion=TDEGlobalSettings::CompletionMan;
635 m_pView->doc()->setCompletionMode(tmpCompletion);
636 config->writeEntry(
"Completion Mode", (
int)tmpCompletion);
639 KSpread::MoveTo tmpMoveTo=KSpread::Bottom;
640 switch(typeOfMove->currentItem())
643 tmpMoveTo=KSpread::Bottom;
646 tmpMoveTo=KSpread::Top;
649 tmpMoveTo=KSpread::Right;
652 tmpMoveTo=KSpread::Left;
655 tmpMoveTo=KSpread::BottomFirst;
658 if(tmpMoveTo!=m_pView->doc()->getMoveToValue())
660 m_pView->doc()->setMoveToValue(tmpMoveTo);
661 config->writeEntry(
"Move", (
int)tmpMoveTo);
664 MethodOfCalc tmpMethodCalc=SumOfNumber;
665 switch(typeCalc->currentItem())
668 tmpMethodCalc =SumOfNumber;
677 tmpMethodCalc=Average;
683 tmpMethodCalc=CountA;
686 tmpMethodCalc=NoneCalc;
690 if(tmpMethodCalc!=m_pView->doc()->getTypeOfCalc())
692 m_pView->doc()->setTypeOfCalc(tmpMethodCalc);
693 config->writeEntry(
"Method of Calc", (
int)tmpMethodCalc);
694 m_pView->calcStatusBarOp();
695 m_pView->initCalcMenu();
698 double val = valIndent->value();
699 if( val != m_pView->doc()->getIndentValue() )
701 KoUnit::Unit oldUnit = m_pView->doc()->unit();
702 m_pView->doc()->setUnit(indentUnit);
703 m_pView->doc()->setIndentValue( val );
704 m_pView->doc()->setUnit(oldUnit);
705 config->writeEntry(
"Indent", KoUnit::fromUserValue( val, indentUnit ) );
708 bool active=msgError->isChecked();
709 if(active!=m_pView->doc()->getShowMessageError())
711 m_pView->doc()->setShowMessageError( active);
712 config->writeEntry(
"Msg error" ,(
int)active);
718colorParameters::colorParameters(
View* _view,TQVBox *box ,
char *name )
719 :TQObject ( box->parent(),name)
722 config = Factory::global()->config();
724 TQColor _gridColor(TQt::lightGray);
726 if ( config->hasGroup(
"KSpread Color" ) )
728 config->setGroup(
"KSpread Color" );
729 _gridColor = config->readColorEntry(
"GridColor",&_gridColor);
732 TQGroupBox* tmpTQGroupBox =
new TQVGroupBox( i18n(
"Color"), box,
"GroupBox" );
734 TQLabel *label =
new TQLabel(i18n(
"&Grid color:"), tmpTQGroupBox,
"label20" );
736 gridColor =
new KColorButton( _gridColor,
739 TQWhatsThis::add(gridColor, i18n(
"Click here to change the grid color ie the color of the borders of each cell." ) );
740 label->setBuddy(gridColor);
742 TQColor _pbColor(TQt::red);
743 if ( config->hasGroup(
"KSpread Color" ) )
745 config->setGroup(
"KSpread Color" );
746 _pbColor = config->readColorEntry(
"PageBorderColor", &_pbColor);
749 TQLabel * label2 =
new TQLabel( i18n(
"&Page borders:"), tmpTQGroupBox,
"label21" );
751 pageBorderColor =
new KColorButton( _pbColor,
754 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." ) );
756 label2->setBuddy(pageBorderColor);
759void colorParameters::apply()
761 TQColor _col = gridColor->color();
762 if ( m_pView->doc()->gridColor() != _col )
764 m_pView->doc()->setGridColor( _col );
765 config->setGroup(
"KSpread Color" );
766 config->writeEntry(
"GridColor", _col );
769 TQColor _pbColor = pageBorderColor->color();
770 if ( m_pView->doc()->pageBorderColor() != _pbColor )
772 m_pView->doc()->changePageBorderColor( _pbColor );
773 config->setGroup(
"KSpread Color" );
774 config->writeEntry(
"PageBorderColor", _pbColor );
778void colorParameters::slotDefault()
780 gridColor->setColor( lightGray );
781 pageBorderColor->setColor( red );
786configureLayoutPage::configureLayoutPage(
View* _view,TQVBox *box ,
char *name )
787 :TQObject ( box->parent(),name)
791 TQGroupBox* tmpTQGroupBox =
new TQGroupBox( 0, TQt::Vertical, i18n(
"Default Parameters"), box,
"GroupBox" );
792 tmpTQGroupBox->layout()->setSpacing(KDialog::spacingHint());
793 tmpTQGroupBox->layout()->setMargin(KDialog::marginHint());
795 TQGridLayout *grid1 =
new TQGridLayout(tmpTQGroupBox->layout(),8,1);
796 grid1->addRowSpacing( 0, KDialog::marginHint() );
797 grid1->setRowStretch( 7, 10 );
799 config = Factory::global()->config();
801 TQLabel *label=
new TQLabel(i18n(
"Default page &size:"), tmpTQGroupBox);
803 grid1->addWidget(label,0,0);
805 defaultSizePage=
new TQComboBox( tmpTQGroupBox);
806 label->setBuddy(defaultSizePage);
807 defaultSizePage->insertStringList( KoPageFormat::allFormats() );
808 defaultSizePage->setCurrentItem(1);
809 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." ) );
810 grid1->addWidget(defaultSizePage,1,0);
812 label=
new TQLabel(i18n(
"Default page &orientation:"), tmpTQGroupBox);
813 grid1->addWidget(label,2,0);
815 defaultOrientationPage=
new TQComboBox( tmpTQGroupBox);
816 label->setBuddy(defaultOrientationPage);
818 TQStringList listType;
819 listType+=i18n(
"Portrait" );
820 listType+=i18n(
"Landscape" );
821 defaultOrientationPage->insertStringList(listType);
822 defaultOrientationPage->setCurrentItem(0);
823 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." ) );
824 grid1->addWidget(defaultOrientationPage,3,0);
826 label=
new TQLabel(tmpTQGroupBox);
827 label->setText(i18n(
"Default page &unit:"));
828 grid1->addWidget(label,4,0);
829 defaultUnit=
new TQComboBox( tmpTQGroupBox);
830 label->setBuddy(defaultUnit);
832 defaultUnit->insertStringList(KoUnit::listOfUnitName());
833 defaultUnit->setCurrentItem(0);
834 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." ) );
835 grid1->addWidget(defaultUnit,5,0);
840void configureLayoutPage::slotDefault()
842 defaultSizePage->setCurrentItem(1);
843 defaultOrientationPage->setCurrentItem(0);
844 defaultUnit->setCurrentItem(0);
847void configureLayoutPage::initCombo()
852 if( config->hasGroup(
"KSpread Page Layout" ))
854 config->setGroup(
"KSpread Page Layout" );
855 paper=config->readNumEntry(
"Default size page" ,1);
856 orientation=config->readNumEntry(
"Default orientation page" ,0);
857 unit=config->readNumEntry(
"Default unit page" ,0);
860 defaultUnit->setCurrentItem(m_pView->doc()->unit());
861 defaultSizePage->setCurrentItem(paper);
862 defaultOrientationPage->setCurrentItem(orientation);
866void configureLayoutPage::apply()
868 m_pView->doc()->emitBeginOperation(
false );
869 config->setGroup(
"KSpread Page Layout" );
871 if( paper != defaultSizePage->currentItem() )
873 unsigned int sizePage = defaultSizePage->currentItem();
874 config->writeEntry(
"Default size page", sizePage );
875 m_pView->activeSheet()->print()->setPaperFormat( (KoFormat)sizePage );
877 if( orientation != defaultOrientationPage->currentItem() )
879 unsigned int orientationPage = defaultOrientationPage->currentItem();
880 config->writeEntry(
"Default orientation page", orientationPage );
881 m_pView->activeSheet()->print()->setPaperOrientation( (KoOrientation)orientationPage );
883 if( unit != defaultUnit->currentItem() )
885 unsigned int unitPage = defaultUnit->currentItem();
886 config->writeEntry(
"Default unit page", unitPage );
887 m_pView->doc()->setUnit( (KoUnit::Unit)unitPage );
889 m_pView->slotUpdateView( m_pView->activeSheet() );
892configureSpellPage::configureSpellPage(
View* _view,TQVBox *box ,
char *name )
893 :TQObject ( box->parent(),name)
897 config = Factory::global()->config();
900 m_spellConfigWidget =
new KSpellConfig( box,
"spell_check",m_pView->doc()->getKSpellConfig());
901 dontCheckUpperWord =
new TQCheckBox( i18n(
"Skip all uppercase words"),box);
902 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." ) );
903 dontCheckTitleCase =
new TQCheckBox( i18n(
"Do not check title case"),box);
904 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." ) );
906 TQWidget* spacer =
new TQWidget( box );
907 spacer->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Expanding ) );
909 if( config->hasGroup(
"KSpell kspread") )
911 config->setGroup(
"KSpell kspread" );
913 dontCheckUpperWord->setChecked(config->readBoolEntry(
"KSpell_dont_check_upper_word",
false));
914 dontCheckTitleCase->setChecked(config->readBoolEntry(
"KSpell_dont_check_title_case",
false));
920void configureSpellPage::apply()
922 m_pView->doc()->emitBeginOperation(
false );
924 KSpellConfig *_spellConfig = m_spellConfigWidget;
925 config->setGroup(
"KSpell kspread" );
926 config->writeEntry (
"KSpell_NoRootAffix",(
int) _spellConfig->noRootAffix ());
927 config->writeEntry (
"KSpell_RunTogether", (
int) _spellConfig->runTogether ());
928 config->writeEntry (
"KSpell_Dictionary", _spellConfig->dictionary ());
929 config->writeEntry (
"KSpell_DictFromList",(
int) _spellConfig->dictFromList());
930 config->writeEntry (
"KSpell_Encoding", (
int) _spellConfig->encoding());
931 config->writeEntry (
"KSpell_Client", _spellConfig->client());
933 Doc* doc = m_pView->doc();
936 bool state=dontCheckUpperWord->isChecked();
937 config->writeEntry (
"KSpell_dont_check_upper_word",(
int)state);
938 doc->setDontCheckUpperWord(state);
940 state=dontCheckTitleCase->isChecked();
941 config->writeEntry(
"KSpell_dont_check_title_case",(
int)state);
942 doc->setDontCheckTitleCase(state);
946 m_pView->slotUpdateView( m_pView->activeSheet() );
949void configureSpellPage::slotDefault()
957configureTTSPage::configureTTSPage(
View *_view, TQVBox *box,
char *name )
958 : TQObject( box->parent(), name )
962 m_cbSpeakPointerWidget =
new TQCheckBox(i18n(
"Speak widget under &mouse pointer"), box);
963 m_cbSpeakFocusWidget =
new TQCheckBox(i18n(
"Speak widget with &focus"), box);
964 m_gbScreenReaderOptions =
new TQVGroupBox(
"", box);
965 m_gbScreenReaderOptions->setMargin( KDialog::marginHint() );
966 m_gbScreenReaderOptions->setInsideSpacing( KDialog::spacingHint() );
967 m_cbSpeakTooltips =
new TQCheckBox(i18n(
"Speak &tool tips"), m_gbScreenReaderOptions);
968 m_cbSpeakWhatsThis =
new TQCheckBox(i18n(
"Speak &What's This"), m_gbScreenReaderOptions);
969 m_cbSpeakDisabled =
new TQCheckBox(i18n(
"Verbal indication if widget is disabled (grayed)",
970 "&Say whether disabled"), m_gbScreenReaderOptions);
971 m_cbSpeakAccelerators =
new TQCheckBox(i18n(
"Spea&k accelerators"), m_gbScreenReaderOptions);
972 TQHBox* hbAcceleratorPrefix =
new TQHBox(m_gbScreenReaderOptions);
973 TQWidget* spacer =
new TQWidget(hbAcceleratorPrefix);
974 spacer->setMinimumWidth(2 * KDialog::marginHint());
975 m_lblAcceleratorPrefix =
976 new TQLabel(i18n(
"A word spoken before another word",
"Pr&efaced by the word:"),
977 hbAcceleratorPrefix);
978 m_leAcceleratorPrefixWord =
new TQLineEdit(i18n(
"Keyboard accelerator, such as Alt+F",
"Accelerator"),
979 hbAcceleratorPrefix);
980 m_lblAcceleratorPrefix->setBuddy(m_leAcceleratorPrefixWord);
981 TQHBox* hbPollingInterval =
new TQHBox(m_gbScreenReaderOptions);
982 hbPollingInterval->setMargin( 0 );
983 TQLabel* lblPollingInterval =
new TQLabel(i18n(
"&Polling interval:"), hbPollingInterval);
984 m_iniPollingInterval =
new KIntNumInput(hbPollingInterval);
985 m_iniPollingInterval->setSuffix(
" ms");
986 m_iniPollingInterval->setRange(100, 5000, 100,
true);
987 lblPollingInterval->setBuddy(m_iniPollingInterval);
989 config = Factory::global()->config();
990 config->setGroup(
"TTS");
991 m_cbSpeakPointerWidget->setChecked(config->readBoolEntry(
"SpeakPointerWidget",
false));
992 m_cbSpeakFocusWidget->setChecked(config->readBoolEntry(
"SpeakFocusWidget",
false));
993 m_cbSpeakTooltips->setChecked(config->readBoolEntry(
"SpeakTooltips",
true));
994 m_cbSpeakWhatsThis->setChecked(config->readBoolEntry(
"SpeakWhatsThis",
false));
995 m_cbSpeakDisabled->setChecked(config->readBoolEntry(
"SpeakDisabled",
true));
996 m_cbSpeakAccelerators->setChecked(config->readBoolEntry(
"SpeakAccelerators",
true));
997 m_leAcceleratorPrefixWord->setText(config->readEntry(
"AcceleratorPrefixWord",
998 i18n(
"Keyboard accelerator, such as Alt+F",
"Accelerator")));
999 m_iniPollingInterval->setValue(config->readNumEntry(
"PollingInterval", 600));
1001 screenReaderOptionChanged();
1002 connect(m_cbSpeakPointerWidget, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(screenReaderOptionChanged()));
1003 connect(m_cbSpeakFocusWidget, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(screenReaderOptionChanged()));
1004 connect(m_cbSpeakAccelerators, TQ_SIGNAL(toggled(
bool)),
this, TQ_SLOT(screenReaderOptionChanged()));
1007void configureTTSPage::slotDefault()
1009 m_cbSpeakPointerWidget->setChecked(
false);
1010 m_cbSpeakFocusWidget->setChecked(
false);
1011 m_cbSpeakTooltips->setChecked(
true);
1012 m_cbSpeakWhatsThis->setChecked(
false);
1013 m_cbSpeakDisabled->setChecked(
true);
1014 m_cbSpeakAccelerators->setChecked(
true);
1015 m_leAcceleratorPrefixWord->setText(i18n(
"Keyboard accelerator, such as Alt+F",
"Accelerator"));
1016 m_iniPollingInterval->setValue(600);
1019void configureTTSPage::apply()
1021 config->setGroup(
"TTS");
1022 config->writeEntry(
"SpeakPointerWidget", m_cbSpeakPointerWidget->isChecked());
1023 config->writeEntry(
"SpeakFocusWidget", m_cbSpeakFocusWidget->isChecked());
1024 config->writeEntry(
"SpeakTooltips", m_cbSpeakTooltips->isChecked());
1025 config->writeEntry(
"SpeakWhatsThis", m_cbSpeakWhatsThis->isChecked());
1026 config->writeEntry(
"SpeakDisabled", m_cbSpeakDisabled->isChecked());
1027 config->writeEntry(
"SpeakAccelerators", m_cbSpeakAccelerators->isChecked());
1028 config->writeEntry(
"AcceleratorPrefixWord", m_leAcceleratorPrefixWord->text());
1029 config->writeEntry(
"PollingInterval", m_iniPollingInterval->value());
1030 if (kospeaker) kospeaker->readConfig(config);
1033void configureTTSPage::screenReaderOptionChanged()
1035 m_gbScreenReaderOptions->setEnabled(
1036 m_cbSpeakPointerWidget->isChecked() || m_cbSpeakFocusWidget->isChecked());
1037 m_leAcceleratorPrefixWord->setEnabled(m_cbSpeakAccelerators->isChecked());
1038 m_lblAcceleratorPrefix->setEnabled(m_cbSpeakAccelerators->isChecked());
1041#include "kspread_dlg_preference.moc"
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.