00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "finddlg.h"
00035
00036
00037 #include <qlabel.h>
00038 #include <qradiobutton.h>
00039
00040 FindDialog::FindDialog(QWidget *parent)
00041 :QDialog(parent, 0, TRUE)
00042 {
00043
00044 tabs=new QTabWidget(this);
00045 widgetFind=new QWidget(tabs);
00046 widgetOptions=new QWidget(tabs);
00047 tabs->addTab(widgetFind, tr("&Find && Replace"));
00048 tabs->addTab(widgetOptions, tr("&Options"));
00049
00050
00051 QLabel *label=new QLabel(tr("&Search for:"), widgetFind);
00052 label->setGeometry(10, 10, 215, 20);
00053 editFind=new QLineEdit(widgetFind);
00054 editFind->setGeometry(10, 40, 215, 20);
00055 label->setBuddy(editFind);
00056
00057 label=new QLabel(tr("&Replace with:"), widgetFind);
00058 label->setGeometry(10, 80, 215, 20);
00059 editReplace=new QLineEdit(widgetFind);
00060 editReplace->setGeometry(10, 110, 215, 20);
00061 editReplace->setEnabled(FALSE);
00062 label->setBuddy(editReplace);
00063
00064 groupType=new QVButtonGroup(tr("&Type"), widgetFind);
00065 groupType->setGeometry(10, 150, 215, 90);
00066 QRadioButton *radio=new QRadioButton(tr("&Find"), groupType);
00067 radio=new QRadioButton(tr("&Replace"), groupType);
00068 radio=new QRadioButton(tr("Replace &all"), groupType);
00069 groupType->setButton(0);
00070 connect(groupType, SIGNAL(clicked(int)), this, SLOT(typeChanged(int)));
00071
00072
00073 checkCase=new QCheckBox(tr("Match &case"), widgetOptions);
00074 checkCase->setGeometry(10, 10, 215, 20);
00075 checkSelection=new QCheckBox(tr("Current &selection only"), widgetOptions);
00076 checkSelection->setGeometry(10, 40, 215, 20);
00077 checkEntire=new QCheckBox(tr("&Entire cell"), widgetOptions);
00078 checkEntire->setGeometry(10, 70, 215, 20);
00079
00080
00081 box=new QVBoxLayout(this);
00082 box->addWidget(tabs);
00083
00084 setCaption(tr("Find & Replace"));
00085 }
00086
00087 FindDialog::~FindDialog()
00088 {}
00089
00090 void FindDialog::typeChanged(int id)
00091 {
00092 editReplace->setEnabled(id>0);
00093 }
00094
00095 int FindDialog::exec(Sheet *s)
00096 {
00097 if (QDialog::exec()==QDialog::Accepted)
00098 {
00099 int id=groupType->id(groupType->selected());
00100 s->dataFindReplace(editFind->text(), editReplace->text(), checkCase->isChecked(), !checkSelection->isChecked(), checkEntire->isChecked(), id>0, id>1);
00101 return QDialog::Accepted;
00102 }
00103 return QDialog::Rejected;
00104 }