summaryrefslogtreecommitdiffstats
path: root/kspread/dialogs/sheet_properties.cc
blob: e78549356d2742eefe4039eac60a707e92966b2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/* This file is part of the KDE project
   Copyright (C) 2004 Ariya Hidayat <ariya@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#include <qvbox.h>
#include <qcheckbox.h>

#include <kcombobox.h>
#include <kdialogbase.h>
#include <klocale.h>

#include "kspread_sheet.h"
#include "sheet_properties_base.h"

#include "sheet_properties.h"

using namespace KSpread;

SheetPropertiesDialog::SheetPropertiesDialog( QWidget* parent ):
  KDialogBase( parent, "sheetPropertiesDialog", true, 
  i18n("Sheet Properties"), 
  KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Default )
{
  QVBox* mainWidget = makeVBoxMainWidget();
  d = new SheetPropertiesBase( mainWidget );
  QWidget* spacer = new QWidget( mainWidget );
  spacer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
  enableButtonSeparator( true );
}

SheetPropertiesDialog::~SheetPropertiesDialog()
{
  delete d;
}

void SheetPropertiesDialog::slotDefault()
{
  setLayoutDirection( Sheet::LeftToRight );
  setAutoCalc( true );
  setShowGrid( true );
  setShowFormula( false );
  setHideZero( false );
  setShowFormulaIndicator( true );
  setShowCommentIndicator( true );
  setShowPageBorders( false );
  setColumnAsNumber( false );
  setLcMode( false );
  setCapitalizeFirstLetter( false );
}

Sheet::LayoutDirection SheetPropertiesDialog::layoutDirection() const
{
  if( d->directionComboBox->currentText() == i18n( "Left to Right" ) )
    return Sheet::LeftToRight;
  
  if( d->directionComboBox->currentText() == i18n( "Right to Left" ) )
    return Sheet::RightToLeft;
  
  // fallback
  return Sheet::LeftToRight;
}

void SheetPropertiesDialog::setLayoutDirection( Sheet::LayoutDirection dir )
{
  switch( dir )
  {
    case Sheet::LeftToRight:
      d->directionComboBox->setCurrentText( i18n( "Left to Right" ) );
      break;
    case Sheet::RightToLeft:
      d->directionComboBox->setCurrentText( i18n( "Right to Left" ) );
      break;
    default: break;
  };
}

bool SheetPropertiesDialog::autoCalc() const
{
  return d->autoCalcCheckBox->isChecked();
}

void SheetPropertiesDialog::setAutoCalc( bool b )
{
  d->autoCalcCheckBox->setChecked( b );
}

bool SheetPropertiesDialog::showGrid() const
{
  return d->showGridCheckBox->isChecked();
}

void SheetPropertiesDialog::setShowGrid( bool b )
{
  d->showGridCheckBox->setChecked( b );
}

bool SheetPropertiesDialog::showPageBorders() const
{
  return d->showPageBordersCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setShowPageBorders( bool b )
{
  d->showPageBordersCheckBox->setChecked( b );
}   

bool SheetPropertiesDialog::showFormula() const
{
  return d->showFormulaCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setShowFormula( bool b )
{
  d->showFormulaCheckBox->setChecked( b );
}
    
bool SheetPropertiesDialog::hideZero() const
{
  return d->hideZeroCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setHideZero( bool b )
{
  d->hideZeroCheckBox->setChecked( b );
}
    
bool SheetPropertiesDialog::showFormulaIndicator() const
{
  return d->showFormulaIndicatorCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setShowFormulaIndicator( bool b )
{
  d->showFormulaIndicatorCheckBox->setChecked( b );
}

bool SheetPropertiesDialog::showCommentIndicator() const
{
  return d->showCommentIndicatorCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setShowCommentIndicator( bool b )
{
  d->showCommentIndicatorCheckBox->setChecked( b );
}
    
bool SheetPropertiesDialog::columnAsNumber() const
{
  return d->showColumnAsNumbersCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setColumnAsNumber( bool b )
{
  d->showColumnAsNumbersCheckBox->setChecked( b );
}
    
bool SheetPropertiesDialog::lcMode() const
{
  return d->useLCModeCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setLcMode( bool b )
{
  d->useLCModeCheckBox->setChecked( b );
}    
    
bool SheetPropertiesDialog::capitalizeFirstLetter() const
{
  return d->capitalizeFirstLetterCheckBox->isChecked();
}
    
void SheetPropertiesDialog::setCapitalizeFirstLetter( bool b )
{
  d->capitalizeFirstLetterCheckBox->setChecked( b );
}    
    
#include "sheet_properties.moc"