kspread
kspread_dlg_find.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kspread_dlg_find.h"
00022 #include <qcheckbox.h>
00023 #include <qlayout.h>
00024 #include <klocale.h>
00025 #include <qpushbutton.h>
00026 #include <qlabel.h>
00027 #include <qcombobox.h>
00028
00029 using namespace KSpread;
00030
00031 FindOption::FindOption( QWidget *parent)
00032 {
00033 QVBoxLayout *layout = new QVBoxLayout(parent);
00034 m_moreOptions = new QPushButton( i18n( "More Options" ), parent );
00035 layout->addWidget( m_moreOptions );
00036
00037 connect( m_moreOptions, SIGNAL( clicked () ), this, SLOT( slotMoreOptions() ) );
00038
00039 m_findExtension = new QWidget( parent );
00040 layout->addWidget( m_findExtension );
00041 QVBoxLayout *layout1 = new QVBoxLayout( m_findExtension );
00042 m_searchInAllSheet = new QCheckBox( i18n( "Search entire sheet" ),m_findExtension );
00043 layout1->addWidget( m_searchInAllSheet );
00044
00045 QHBoxLayout *comboLayout = new QHBoxLayout( m_findExtension );
00046 QLabel *label = new QLabel( i18n( "Search in:" ), m_findExtension );
00047 comboLayout->addWidget( label );
00048
00049 m_searchIn = new QComboBox( m_findExtension );
00050 comboLayout->addWidget( m_searchIn );
00051 layout1->addLayout( comboLayout );
00052
00053 QStringList lst;
00054 lst << i18n( "Cell Values" );
00055 lst << i18n( "Comments" );
00056 m_searchIn->insertStringList( lst );
00057
00058 comboLayout = new QHBoxLayout( m_findExtension );
00059 label = new QLabel( i18n( "Search direction:" ), m_findExtension );
00060 comboLayout->addWidget( label );
00061
00062 m_searchDirection = new QComboBox( m_findExtension );
00063 comboLayout->addWidget( m_searchDirection );
00064 layout1->addLayout( comboLayout );
00065
00066 lst.clear();
00067 lst << i18n( "Across then Down" );
00068 lst << i18n( "Down then Across" );
00069 m_searchDirection->insertStringList( lst );
00070
00071 m_findExtension->hide();
00072 emit adjustSize();
00073 }
00074
00075 FindOption::searchTypeValue FindOption::searchType() const
00076 {
00077 int pos = m_searchIn->currentItem();
00078 if ( pos == 0 )
00079 return Value;
00080 else if ( pos == 1 )
00081 return Note;
00082 else
00083 return Value;
00084 }
00085
00086 FindOption::searchDirectionValue FindOption::searchDirection() const
00087 {
00088 int pos = m_searchDirection->currentItem();
00089 if ( pos == 0 )
00090 return Row;
00091 else if ( pos == 1 )
00092 return Column;
00093 else
00094 return Row;
00095 }
00096
00097
00098 void FindOption::slotMoreOptions()
00099 {
00100 if ( m_findExtension->isHidden() )
00101 {
00102 m_findExtension->show();
00103 m_moreOptions->setText( i18n( "Fewer Options" ));
00104 }
00105 else
00106 {
00107 m_findExtension->hide();
00108 m_moreOptions->setText( i18n( "More Options" ));
00109 }
00110 emit adjustSize();
00111 }
00112
00113 bool FindOption::searchInAllSheet() const
00114 {
00115 return m_searchInAllSheet->isChecked();
00116 }
00117
00118 FindDlg::FindDlg(QWidget *parent, const char *name, long options, const QStringList &findStrings, bool hasSelection )
00119 : KFindDialog(parent,name,options,findStrings,hasSelection )
00120 {
00121 m_findOptions = new FindOption( findExtension() );
00122 connect( m_findOptions, SIGNAL( adjustSize() ), SLOT( slotAjustSize() ) );
00123 setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
00124 }
00125
00126 FindDlg::~FindDlg()
00127 {
00128
00129 }
00130
00131 void FindDlg::slotAjustSize()
00132 {
00133 adjustSize();
00134 }
00135
00136 bool FindDlg::searchInAllSheet() const
00137 {
00138 return m_findOptions->searchInAllSheet();
00139 }
00140
00141
00142 SearchDlg::SearchDlg(QWidget *parent, const char *name, long options, const QStringList &findStrings, const QStringList &replaceStrings, bool hasSelection )
00143 : KReplaceDialog(parent,name,options,findStrings,replaceStrings,hasSelection )
00144 {
00145 m_findOptions = new FindOption( findExtension() );
00146 connect( m_findOptions, SIGNAL( adjustSize() ), SLOT( slotAjustSize() ) );
00147 setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
00148 }
00149
00150 SearchDlg::~SearchDlg()
00151 {
00152
00153 }
00154
00155 void SearchDlg::slotAjustSize()
00156 {
00157 adjustSize();
00158 setFixedSize(size());
00159 }
00160
00161 bool SearchDlg::searchInAllSheet() const
00162 {
00163 return m_findOptions->searchInAllSheet();
00164 }
00165
00166
00167 #include "kspread_dlg_find.moc"
|