]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/FindAndReplace.h
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / FindAndReplace.h
index f1f89b0b01ea0019c9a9485c5e7be5e813d11ecb..b9c82042e89d8f50e39b1fcf4cc904db42f0114e 100644 (file)
@@ -22,6 +22,7 @@
 #include "LyX.h"
 #include "LyXFunc.h"
 #include "Text.h"
+#include "lyxfind.h"
 
 #include <QDialog>
 
 namespace lyx {
 namespace frontend {
 
-class FindAndReplace : public DockView, public Ui::FindAndReplaceUi
+class FindAndReplaceWidget : public QWidget, public Ui::FindAndReplaceUi
 {
        Q_OBJECT
+
 public:
-       FindAndReplace(GuiView & parent);
+       FindAndReplaceWidget(GuiView & view);
+       bool initialiseParams(std::string const & params);
+
+private:
+       ///
+       GuiView & view_;
+
+       /// add a string to the combo if needed
+       void remember(std::string const & find, QComboBox & combo);
+
+       /// FIXME Probably to be merged with findAndReplace(bool, bool)
+       void findAndReplace(
+               bool casesensitive, bool matchword, bool backwards,
+               bool expandmacros, bool ignoreformat, bool replace,
+               bool keep_case
+       );
+
+       /// Perform the scope-related buffer switch while searching
+       void findAndReplaceScope(FindAndReplaceOptions & opt);
+
+       /// Collect options from the GUI elements, then perform the search
+       void findAndReplace(bool backwards, bool replace);
+
+       bool eventFilter(QObject *obj, QEvent *event);
+
+       void virtual showEvent(QShowEvent *ev);
+       void virtual hideEvent(QHideEvent *ev);
+
+       void hideDialog();
+
+protected Q_SLOTS:
+       void on_findNextPB_clicked();
+       void on_findPrevPB_clicked();
+       void on_replaceNextPB_clicked();
+       void on_replacePrevPB_clicked();
+       void on_replaceallPB_clicked();
+       void insertRegexp(QAction *);
+};
+
+
+class FindAndReplace : public DockView
+{
+       Q_OBJECT
+public:
+       FindAndReplace(
+               GuiView & parent, ///< the main window where to dock.
+               Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
+               Qt::WindowFlags flags = 0);
+
+       ~FindAndReplace();
 
        bool initialiseParams(std::string const &);
        void clearParams() {}
@@ -46,40 +97,12 @@ public:
        void updateView() {}
        //virtual void update_contents() {}
 
-protected Q_SLOTS:
-       void on_findNextPB_clicked();
-       void on_findPrevPB_clicked();
-       void on_replacePB_clicked();
-       void on_replaceallPB_clicked();
-       void on_closePB_clicked();
-       void on_regexpInsertCombo_currentIndexChanged(int index);
-
 protected:
-       void find(bool backwards);
        virtual bool wantInitialFocus() const { return true; }
 
 private:
-       // add a string to the combo if needed
-       void remember(std::string const & find, QComboBox & combo);
-       void findAdv(bool casesensitive,
-                       bool matchword, bool backwards,
-                       bool expandmacros, bool ignoreformat);
-
-       GuiView & parent_view_;
-
-       GuiWorkArea * searchWorkArea_;  // The work area defining what to search
-
-private:
-       /// Apply changes
-       virtual void apply() {}
-
-       void find(docstring const & str, int len, bool casesens,
-                 bool words, bool backwards, bool expandmacros);
-
-       void replace(docstring const & findstr,
-                    docstring const & replacestr,
-                    bool casesens, bool words, bool backwards, bool expandmacros, bool all);
-       bool eventFilter(QObject *obj, QEvent *event);
+       /// The encapsulated widget.
+       FindAndReplaceWidget * widget_;
 };