/* This file is part of the KDE project
   Copyright (C) 2002-2004 Ariya Hidayat <ariya@kde.org>
             (C) 2002-2003 Norbert Andres <nandres@web.de>
             (C) 2000-2003 Laurent Montel <montel@kde.org>
             (C) 2002 John Dailey <dailey@vt.edu>
             (C) 2002 Philipp Mueller <philipp.mueller@gmx.de>
             (C) 2001-2002 David Faure <faure@kde.org>
             (C) 2001 Werner Trobin <trobin@kde.org>
             (C) 2000 Bernd Johannes Wuebben <wuebben@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.
*/

#ifndef __kspread_dlg_preference__
#define __kspread_dlg_preference__

#include <kdialogbase.h>

class TDEConfig;
class KIntNumInput;
class KDoubleNumInput;
class KSpellConfig;
class TQCheckBox;
class TQComboBox;
class TQVGroupBox;
class TQPushButton;
class KColorButton;

namespace KSpread
{
class Sheet;
class View;

class parameterLocale :  public TQObject
{
 TQ_OBJECT
  
public:
   parameterLocale( View* _view,TQVBox *box, char *name = 0);
 void apply();
public slots:
   void updateDefaultSystemConfig();
 protected:
   /**
    * Updates the GUI widgets to match the specified locale.  
    */
   void updateToMatchLocale(TDELocale* locale);

   TQLabel *m_shortDate,*m_time,*m_money,*m_date,*m_language,*m_number;
   TQPushButton *m_updateButton;
   View* m_pView;
   bool m_bUpdateLocale;
};

class configure : public TQObject
{
  TQ_OBJECT
  
public:
  configure( View* _view,TQVBox *box, char *name = 0 );
  void apply();
  void slotDefault();
protected:
  View* m_pView;
  KIntNumInput  *nbPage;
  KIntNumInput* nbRecentFile;
  KIntNumInput* autoSaveDelay;
  TQCheckBox *showVScrollBar;
  TQCheckBox *showHScrollBar;
  TQCheckBox *showColHeader;
  TQCheckBox *showRowHeader;
  TQCheckBox *showTabBar;
  TQCheckBox *showFormulaBar;
    TQCheckBox *showStatusBar;
    TQCheckBox *m_createBackupFile;
  bool m_oldBackupFile;

  TDEConfig* config;
  int oldRecent;
  int oldAutoSaveValue;
} ;


class miscParameters : public TQObject
{
  TQ_OBJECT
  
public:
  miscParameters( View* _view, TQVBox *box, char *name = 0 );
  void apply();
  void slotDefault();

  void initComboBox();

public slots:
  void slotTextComboChanged(const TQString &);

protected:
  View* m_pView;
  KDoubleNumInput  *valIndent;
  
  /**
   * Needed to ensure the same unit for loading and saving.
   */
  KoUnit::Unit indentUnit;
  TDEConfig* config;
  TQComboBox *typeCompletion;
  TQComboBox *typeCalc;
  TQComboBox *typeOfMove;
  TQCheckBox *msgError;
  KIntNumInput* m_undoRedoLimit;
  bool comboChanged;
  int m_oldNbRedo;
} ;

class colorParameters : public TQObject
{
  TQ_OBJECT
  
public:
  colorParameters( View* _view, TQVBox *box, char *name = 0 );
  void apply();
  void slotDefault();
protected:
  View* m_pView;
  KColorButton* gridColor;
  KColorButton* pageBorderColor;
  TDEConfig* config;
} ;

class configureLayoutPage : public TQObject
{
  TQ_OBJECT
  
public:
  configureLayoutPage( View* _view,TQVBox *box, char *name = 0 );
  void apply();
  void slotDefault();
  void initCombo();
protected:
  View* m_pView;
  TQComboBox *defaultOrientationPage;
  TQComboBox *defaultSizePage;
  TQComboBox *defaultUnit;
  //store old config
  int paper;
  int orientation;
  int unit;

  TDEConfig* config;
} ;

class configureSpellPage : public TQObject
{
  TQ_OBJECT
  
public:
  configureSpellPage( View* _view, TQVBox *box, char *name = 0 );
  void apply();
  void slotDefault();
protected:
  View * m_pView;
  TDEConfig * config;
    KSpellConfig *m_spellConfigWidget;
    TQCheckBox *dontCheckUpperWord;
    TQCheckBox *dontCheckTitleCase;
} ;

class configureTTSPage : public TQObject
{
  TQ_OBJECT
  
public:
  configureTTSPage( View *_view, TQVBox *box, char *name = 0 );
  void slotDefault();
  void apply();
private slots:
  void screenReaderOptionChanged();
private:
  TDEConfig* config;
  TQCheckBox* m_cbSpeakPointerWidget;
  TQCheckBox* m_cbSpeakFocusWidget;
  TQVGroupBox* m_gbScreenReaderOptions;
  TQCheckBox* m_cbSpeakTooltips;
  TQCheckBox* m_cbSpeakWhatsThis;
  TQCheckBox* m_cbSpeakDisabled;
  TQCheckBox* m_cbSpeakAccelerators;
  TQLabel* m_lblAcceleratorPrefix;
  TQLineEdit* m_leAcceleratorPrefixWord;
  KIntNumInput* m_iniPollingInterval;
};

class PreferenceDialog : public KDialogBase
{
  TQ_OBJECT
  
public:
  enum { KS_PREFERENCES = 1, KS_LOCALE = 2, KS_INTERFACE = 4,
         KS_MISC = 8, KS_COLOR = 16, KS_LAYOUT = 32, KS_SPELLING = 64 };
  PreferenceDialog( View* parent, const char* name);
public slots:
  void slotApply();
  void slotDefault();
  void openPage(int flags);
private :
  View* m_pView;
  configure * _configure;
  miscParameters *_miscParameter;
  colorParameters *_colorParameter;
  configureLayoutPage *_layoutPage;
  configureSpellPage *_spellPage;
  parameterLocale *_localePage;
  configureTTSPage *_ttsPage;
};

} // namespace KSpread

#endif
