kspread
sheet_properties.cc
00001 /* This file is part of the KDE project 00002 Copyright (C) 2004 Ariya Hidayat <ariya@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include <qvbox.h> 00021 #include <qcheckbox.h> 00022 00023 #include <kcombobox.h> 00024 #include <kdialogbase.h> 00025 #include <klocale.h> 00026 00027 #include "kspread_sheet.h" 00028 #include "sheet_properties_base.h" 00029 00030 #include "sheet_properties.h" 00031 00032 using namespace KSpread; 00033 00034 SheetPropertiesDialog::SheetPropertiesDialog( QWidget* parent ): 00035 KDialogBase( parent, "sheetPropertiesDialog", true, 00036 i18n("Sheet Properties"), 00037 KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Default ) 00038 { 00039 QVBox* mainWidget = makeVBoxMainWidget(); 00040 d = new SheetPropertiesBase( mainWidget ); 00041 QWidget* spacer = new QWidget( mainWidget ); 00042 spacer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); 00043 enableButtonSeparator( true ); 00044 } 00045 00046 SheetPropertiesDialog::~SheetPropertiesDialog() 00047 { 00048 delete d; 00049 } 00050 00051 void SheetPropertiesDialog::slotDefault() 00052 { 00053 setLayoutDirection( Sheet::LeftToRight ); 00054 setAutoCalc( true ); 00055 setShowGrid( true ); 00056 setShowFormula( false ); 00057 setHideZero( false ); 00058 setShowFormulaIndicator( true ); 00059 setShowCommentIndicator( true ); 00060 setShowPageBorders( false ); 00061 setColumnAsNumber( false ); 00062 setLcMode( false ); 00063 setCapitalizeFirstLetter( false ); 00064 } 00065 00066 Sheet::LayoutDirection SheetPropertiesDialog::layoutDirection() const 00067 { 00068 if( d->directionComboBox->currentText() == i18n( "Left to Right" ) ) 00069 return Sheet::LeftToRight; 00070 00071 if( d->directionComboBox->currentText() == i18n( "Right to Left" ) ) 00072 return Sheet::RightToLeft; 00073 00074 // fallback 00075 return Sheet::LeftToRight; 00076 } 00077 00078 void SheetPropertiesDialog::setLayoutDirection( Sheet::LayoutDirection dir ) 00079 { 00080 switch( dir ) 00081 { 00082 case Sheet::LeftToRight: 00083 d->directionComboBox->setCurrentText( i18n( "Left to Right" ) ); 00084 break; 00085 case Sheet::RightToLeft: 00086 d->directionComboBox->setCurrentText( i18n( "Right to Left" ) ); 00087 break; 00088 default: break; 00089 }; 00090 } 00091 00092 bool SheetPropertiesDialog::autoCalc() const 00093 { 00094 return d->autoCalcCheckBox->isChecked(); 00095 } 00096 00097 void SheetPropertiesDialog::setAutoCalc( bool b ) 00098 { 00099 d->autoCalcCheckBox->setChecked( b ); 00100 } 00101 00102 bool SheetPropertiesDialog::showGrid() const 00103 { 00104 return d->showGridCheckBox->isChecked(); 00105 } 00106 00107 void SheetPropertiesDialog::setShowGrid( bool b ) 00108 { 00109 d->showGridCheckBox->setChecked( b ); 00110 } 00111 00112 bool SheetPropertiesDialog::showPageBorders() const 00113 { 00114 return d->showPageBordersCheckBox->isChecked(); 00115 } 00116 00117 void SheetPropertiesDialog::setShowPageBorders( bool b ) 00118 { 00119 d->showPageBordersCheckBox->setChecked( b ); 00120 } 00121 00122 bool SheetPropertiesDialog::showFormula() const 00123 { 00124 return d->showFormulaCheckBox->isChecked(); 00125 } 00126 00127 void SheetPropertiesDialog::setShowFormula( bool b ) 00128 { 00129 d->showFormulaCheckBox->setChecked( b ); 00130 } 00131 00132 bool SheetPropertiesDialog::hideZero() const 00133 { 00134 return d->hideZeroCheckBox->isChecked(); 00135 } 00136 00137 void SheetPropertiesDialog::setHideZero( bool b ) 00138 { 00139 d->hideZeroCheckBox->setChecked( b ); 00140 } 00141 00142 bool SheetPropertiesDialog::showFormulaIndicator() const 00143 { 00144 return d->showFormulaIndicatorCheckBox->isChecked(); 00145 } 00146 00147 void SheetPropertiesDialog::setShowFormulaIndicator( bool b ) 00148 { 00149 d->showFormulaIndicatorCheckBox->setChecked( b ); 00150 } 00151 00152 bool SheetPropertiesDialog::showCommentIndicator() const 00153 { 00154 return d->showCommentIndicatorCheckBox->isChecked(); 00155 } 00156 00157 void SheetPropertiesDialog::setShowCommentIndicator( bool b ) 00158 { 00159 d->showCommentIndicatorCheckBox->setChecked( b ); 00160 } 00161 00162 bool SheetPropertiesDialog::columnAsNumber() const 00163 { 00164 return d->showColumnAsNumbersCheckBox->isChecked(); 00165 } 00166 00167 void SheetPropertiesDialog::setColumnAsNumber( bool b ) 00168 { 00169 d->showColumnAsNumbersCheckBox->setChecked( b ); 00170 } 00171 00172 bool SheetPropertiesDialog::lcMode() const 00173 { 00174 return d->useLCModeCheckBox->isChecked(); 00175 } 00176 00177 void SheetPropertiesDialog::setLcMode( bool b ) 00178 { 00179 d->useLCModeCheckBox->setChecked( b ); 00180 } 00181 00182 bool SheetPropertiesDialog::capitalizeFirstLetter() const 00183 { 00184 return d->capitalizeFirstLetterCheckBox->isChecked(); 00185 } 00186 00187 void SheetPropertiesDialog::setCapitalizeFirstLetter( bool b ) 00188 { 00189 d->capitalizeFirstLetterCheckBox->setChecked( b ); 00190 } 00191 00192 #include "sheet_properties.moc"