kspread Library API Documentation

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., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #include "sheet_properties.h"
00021 #include "sheet_properties_base.h"
00022 
00023 #include <qvbox.h>
00024 #include <qcheckbox.h>
00025 
00026 #include <kcombobox.h>
00027 #include <kdialogbase.h>
00028 #include <klocale.h>
00029 
00030 #include "kspread_sheet.h"
00031 
00032 SheetPropertiesDialog::SheetPropertiesDialog( QWidget* parent ):
00033   KDialogBase( parent, "sheetPropertiesDialog", true, 
00034   i18n("Sheet Properties"), 
00035   KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Default )
00036 {
00037   QVBox* mainWidget = makeVBoxMainWidget();
00038   d = new SheetPropertiesBase( mainWidget );
00039   QWidget* spacer = new QWidget( mainWidget );
00040   spacer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
00041   enableButtonSeparator( true );
00042 }
00043 
00044 SheetPropertiesDialog::~SheetPropertiesDialog()
00045 {
00046   delete d;
00047 }
00048 
00049 void SheetPropertiesDialog::slotDefault()
00050 {
00051   setLayoutDirection( KSpreadSheet::LeftToRight );
00052   setAutoCalc( true );
00053   setShowGrid( true );
00054   setShowFormula( false );
00055   setHideZero( false );
00056   setShowFormulaIndicator( true );
00057   setColumnAsNumber( false );
00058   setLcMode( false );
00059   setCapitalizeFirstLetter( false );
00060 }
00061 
00062 KSpreadSheet::LayoutDirection SheetPropertiesDialog::layoutDirection() const
00063 {
00064   if( d->directionComboBox->currentText() == i18n( "Left to Right" ) )
00065     return KSpreadSheet::LeftToRight;
00066   
00067   if( d->directionComboBox->currentText() == i18n( "Right to Left" ) )
00068     return KSpreadSheet::RightToLeft;
00069   
00070   // fallback
00071   return KSpreadSheet::LeftToRight;
00072 }
00073 
00074 void SheetPropertiesDialog::setLayoutDirection( KSpreadSheet::LayoutDirection dir )
00075 {
00076   switch( dir )
00077   {
00078     case KSpreadSheet::LeftToRight:
00079       d->directionComboBox->setCurrentText( i18n( "Left to Right" ) );
00080       break;
00081     case KSpreadSheet::RightToLeft:
00082       d->directionComboBox->setCurrentText( i18n( "Right to Left" ) );
00083       break;
00084     default: break;
00085   };
00086 }
00087 
00088 bool SheetPropertiesDialog::autoCalc() const
00089 {
00090   return d->autoCalcCheckBox->isChecked();
00091 }
00092 
00093 void SheetPropertiesDialog::setAutoCalc( bool b )
00094 {
00095   d->autoCalcCheckBox->setChecked( b );
00096 }
00097 
00098 bool SheetPropertiesDialog::showGrid() const
00099 {
00100   return d->showGridCheckBox->isChecked();
00101 }
00102 
00103 void SheetPropertiesDialog::setShowGrid( bool b )
00104 {
00105   d->showGridCheckBox->setChecked( b );
00106 }
00107 
00108 bool SheetPropertiesDialog::showPageBorders() const
00109 {
00110   return d->showPageBordersCheckBox->isChecked();
00111 }
00112     
00113 void SheetPropertiesDialog::setShowPageBorders( bool b )
00114 {
00115   d->showPageBordersCheckBox->setChecked( b );
00116 }   
00117 
00118 bool SheetPropertiesDialog::showFormula() const
00119 {
00120   return d->showFormulaCheckBox->isChecked();
00121 }
00122     
00123 void SheetPropertiesDialog::setShowFormula( bool b )
00124 {
00125   d->showFormulaCheckBox->setChecked( b );
00126 }
00127     
00128 bool SheetPropertiesDialog::hideZero() const
00129 {
00130   return d->hideZeroCheckBox->isChecked();
00131 }
00132     
00133 void SheetPropertiesDialog::setHideZero( bool b )
00134 {
00135   d->hideZeroCheckBox->setChecked( b );
00136 }
00137     
00138 bool SheetPropertiesDialog::showFormulaIndicator() const
00139 {
00140   return d->showFormulaIndicatorCheckBox->isChecked();
00141 }
00142     
00143 void SheetPropertiesDialog::setShowFormulaIndicator( bool b )
00144 {
00145   d->showFormulaIndicatorCheckBox->setChecked( b );
00146 }
00147     
00148 bool SheetPropertiesDialog::columnAsNumber() const
00149 {
00150   return d->showColumnAsNumbersCheckBox->isChecked();
00151 }
00152     
00153 void SheetPropertiesDialog::setColumnAsNumber( bool b )
00154 {
00155   d->showColumnAsNumbersCheckBox->setChecked( b );
00156 }
00157     
00158 bool SheetPropertiesDialog::lcMode() const
00159 {
00160   return d->useLCModeCheckBox->isChecked();
00161 }
00162     
00163 void SheetPropertiesDialog::setLcMode( bool b )
00164 {
00165   d->useLCModeCheckBox->setChecked( b );
00166 }    
00167     
00168 bool SheetPropertiesDialog::capitalizeFirstLetter() const
00169 {
00170   return d->capitalizeFirstLetterCheckBox->isChecked();
00171 }
00172     
00173 void SheetPropertiesDialog::setCapitalizeFirstLetter( bool b )
00174 {
00175   d->capitalizeFirstLetterCheckBox->setChecked( b );
00176 }    
00177     
00178 #include "sheet_properties.moc"
KDE Logo
This file is part of the documentation for kspread Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:43:38 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003