kspread

sheet_properties.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Ariya Hidayat <ariya@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include <tqvbox.h>
21#include <tqcheckbox.h>
22
23#include <kcombobox.h>
24#include <kdialogbase.h>
25#include <tdelocale.h>
26
27#include "kspread_sheet.h"
28#include "sheet_properties_base.h"
29
30#include "sheet_properties.h"
31
32using namespace KSpread;
33
34SheetPropertiesDialog::SheetPropertiesDialog( TQWidget* parent ):
35 KDialogBase( parent, "sheetPropertiesDialog", true,
36 i18n("Sheet Properties"),
37 KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Default )
38{
39 TQVBox* mainWidget = makeVBoxMainWidget();
40 d = new SheetPropertiesBase( mainWidget );
41 TQWidget* spacer = new TQWidget( mainWidget );
42 spacer->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding );
43 enableButtonSeparator( true );
44}
45
46SheetPropertiesDialog::~SheetPropertiesDialog()
47{
48 delete d;
49}
50
51void SheetPropertiesDialog::slotDefault()
52{
53 setLayoutDirection( Sheet::LeftToRight );
54 setAutoCalc( true );
55 setShowGrid( true );
56 setShowFormula( false );
57 setHideZero( false );
58 setShowFormulaIndicator( true );
59 setShowCommentIndicator( true );
60 setShowPageBorders( false );
61 setColumnAsNumber( false );
62 setLcMode( false );
63 setCapitalizeFirstLetter( false );
64}
65
66Sheet::LayoutDirection SheetPropertiesDialog::layoutDirection() const
67{
68 if( d->directionComboBox->currentText() == i18n( "Left to Right" ) )
69 return Sheet::LeftToRight;
70
71 if( d->directionComboBox->currentText() == i18n( "Right to Left" ) )
72 return Sheet::RightToLeft;
73
74 // fallback
75 return Sheet::LeftToRight;
76}
77
78void SheetPropertiesDialog::setLayoutDirection( Sheet::LayoutDirection dir )
79{
80 switch( dir )
81 {
82 case Sheet::LeftToRight:
83 d->directionComboBox->setCurrentText( i18n( "Left to Right" ) );
84 break;
85 case Sheet::RightToLeft:
86 d->directionComboBox->setCurrentText( i18n( "Right to Left" ) );
87 break;
88 default: break;
89 };
90}
91
92bool SheetPropertiesDialog::autoCalc() const
93{
94 return d->autoCalcCheckBox->isChecked();
95}
96
97void SheetPropertiesDialog::setAutoCalc( bool b )
98{
99 d->autoCalcCheckBox->setChecked( b );
100}
101
102bool SheetPropertiesDialog::showGrid() const
103{
104 return d->showGridCheckBox->isChecked();
105}
106
107void SheetPropertiesDialog::setShowGrid( bool b )
108{
109 d->showGridCheckBox->setChecked( b );
110}
111
112bool SheetPropertiesDialog::showPageBorders() const
113{
114 return d->showPageBordersCheckBox->isChecked();
115}
116
117void SheetPropertiesDialog::setShowPageBorders( bool b )
118{
119 d->showPageBordersCheckBox->setChecked( b );
120}
121
122bool SheetPropertiesDialog::showFormula() const
123{
124 return d->showFormulaCheckBox->isChecked();
125}
126
127void SheetPropertiesDialog::setShowFormula( bool b )
128{
129 d->showFormulaCheckBox->setChecked( b );
130}
131
132bool SheetPropertiesDialog::hideZero() const
133{
134 return d->hideZeroCheckBox->isChecked();
135}
136
137void SheetPropertiesDialog::setHideZero( bool b )
138{
139 d->hideZeroCheckBox->setChecked( b );
140}
141
142bool SheetPropertiesDialog::showFormulaIndicator() const
143{
144 return d->showFormulaIndicatorCheckBox->isChecked();
145}
146
147void SheetPropertiesDialog::setShowFormulaIndicator( bool b )
148{
149 d->showFormulaIndicatorCheckBox->setChecked( b );
150}
151
152bool SheetPropertiesDialog::showCommentIndicator() const
153{
154 return d->showCommentIndicatorCheckBox->isChecked();
155}
156
157void SheetPropertiesDialog::setShowCommentIndicator( bool b )
158{
159 d->showCommentIndicatorCheckBox->setChecked( b );
160}
161
162bool SheetPropertiesDialog::columnAsNumber() const
163{
164 return d->showColumnAsNumbersCheckBox->isChecked();
165}
166
167void SheetPropertiesDialog::setColumnAsNumber( bool b )
168{
169 d->showColumnAsNumbersCheckBox->setChecked( b );
170}
171
172bool SheetPropertiesDialog::lcMode() const
173{
174 return d->useLCModeCheckBox->isChecked();
175}
176
177void SheetPropertiesDialog::setLcMode( bool b )
178{
179 d->useLCModeCheckBox->setChecked( b );
180}
181
182bool SheetPropertiesDialog::capitalizeFirstLetter() const
183{
184 return d->capitalizeFirstLetterCheckBox->isChecked();
185}
186
187void SheetPropertiesDialog::setCapitalizeFirstLetter( bool b )
188{
189 d->capitalizeFirstLetterCheckBox->setChecked( b );
190}
191
192#include "sheet_properties.moc"
The KSpread namespace.
Definition commands.h:39