File indexing completed on 2024-05-12 16:35:18

0001 /* This file is part of the KDE project
0002    Copyright (C) 1999-2005 Laurent Montel <montel@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef CALLIGRA_SHEETS_FIND_DIALOG
0021 #define CALLIGRA_SHEETS_FIND_DIALOG
0022 
0023 
0024 #include <kfinddialog.h>
0025 #include <QStringList>
0026 #include <kreplacedialog.h>
0027 
0028 class QCheckBox;
0029 class QPushButton;
0030 class KComboBox;
0031 
0032 namespace Calligra
0033 {
0034 namespace Sheets
0035 {
0036 
0037 /**
0038  * \ingroup UI
0039  * Options for finding and replacing cell values.
0040  */
0041 class FindOption : public QObject
0042 {
0043     Q_OBJECT
0044 public:
0045     explicit FindOption(QWidget *parent);
0046     bool searchInAllSheet() const;
0047 
0048     enum searchTypeValue { Value, Note};
0049     enum searchDirectionValue { Row, Column};
0050 
0051     searchTypeValue searchType() const;
0052     searchDirectionValue searchDirection() const;
0053 
0054 private Q_SLOTS:
0055     void slotMoreOptions();
0056 
0057 Q_SIGNALS:
0058     void adjustSize();
0059 
0060 private:
0061     QPushButton *m_moreOptions;
0062     QCheckBox *m_searchInAllSheet;
0063     QWidget *m_findExtension;
0064     KComboBox *m_searchIn;
0065     KComboBox *m_searchDirection;
0066 };
0067 
0068 
0069 /**
0070  * \ingroup UI
0071  * Dialog for finding cell values.
0072  */
0073 class FindDlg : public KFindDialog
0074 {
0075     Q_OBJECT
0076 
0077 public:
0078     explicit FindDlg(QWidget *parent = 0,
0079                      const QString &name = QString(),
0080                      long options = 0,
0081                      const QStringList &findStrings = QStringList(),
0082                      bool hasSelection = false);
0083     ~FindDlg() override;
0084     bool searchInAllSheet() const;
0085     FindOption::searchTypeValue searchType() const {
0086         return m_findOptions->searchType();
0087     }
0088     FindOption::searchDirectionValue searchDirection() const {
0089         return m_findOptions->searchDirection();
0090     }
0091 
0092 private Q_SLOTS:
0093     void slotAjustSize();
0094 private:
0095     FindOption *m_findOptions;
0096 };
0097 
0098 
0099 /**
0100  * \ingroup UI
0101  * Dialog for replacing cell values.
0102  */
0103 class SearchDlg : public KReplaceDialog
0104 {
0105     Q_OBJECT
0106 
0107 public:
0108     explicit SearchDlg(QWidget *parent = 0,
0109                        const QString &name = QString(),
0110                        long options = 0,
0111                        const QStringList &findStrings = QStringList(),
0112                        const QStringList &replaceStrings = QStringList(),
0113                        bool hasSelection = false);
0114     ~SearchDlg() override;
0115     bool searchInAllSheet() const;
0116     FindOption::searchTypeValue searchType() const {
0117         return m_findOptions->searchType();
0118     }
0119 
0120 private Q_SLOTS:
0121     void slotAjustSize();
0122 private:
0123     FindOption *m_findOptions;
0124 };
0125 
0126 } // namespace Sheets
0127 } // namespace Calligra
0128 
0129 #endif // CALLIGRA_SHEETS_FIND_DIALOG