]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiParagraph.h
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiParagraph.h
index 75f5e16389089b5419c8725f5ab65e90a4401fe7..408765bbe433c0472641b62ecd9ba28ad63e1f4a 100644 (file)
 #ifndef GUIPARAGRAPH_H
 #define GUIPARAGRAPH_H
 
-// Uncomment this if you prefer dock widget
-//#define USE_DOCK_WIDGET
+#include "DialogView.h"
+#include "GuiView.h"
+#include "qt_helpers.h"
+#include "ui_ParagraphUi.h"
 
 #include "Layout.h"
-#include "ui_ParagraphUi.h"
-#include "Dialog.h"
 #include "ParagraphParameters.h"
-#include "GuiView.h"
-#include "qt_helpers.h"
-#include "debug.h"
 
-#include <QCloseEvent>
 #include <QDialog>
-#include <QSettings>
 #include <QShowEvent>
 #include <QGridLayout>
 
 #include <map>
-#include <string>
 
 namespace lyx {
 namespace frontend {
 
 class GuiParagraph
-       : public QDialog, public Ui::ParagraphUi, public Dialog
+       : public DialogView, public Ui::ParagraphUi
 {
        Q_OBJECT
 public:
-       GuiParagraph(LyXView & lv);
+       GuiParagraph(GuiView & lv);
 
-       /// update
+       /// Dialog inherited methods
+       //@{
+       void applyView();
        void updateView();
+       void dispatchParams();
+       void enableView(bool enable);
+       bool isBufferDependent() const { return true; }
+       virtual FuncCode getLfun() const { return LFUN_PARAGRAPH_PARAMS_APPLY; }
+       void saveSession() const;
+       void restoreSession();
+       //@}
 
 private:
        ///
@@ -53,67 +56,19 @@ private:
        ///
        void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
        ///
-       LyXAlignment getAlignmentFromDialog();
+       LyXAlignment getAlignmentFromDialog() const;
        ///
-       typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
-       RadioMap radioMap;
-       typedef std::map<LyXAlignment, docstring> AlignmentLabels;
-       AlignmentLabels labelMap;
-
-       QString const alignDefaultLabel;
-
-       void applyView() {}
-       void hideView()
-       {
-               clearParams();
-               QDialog::hide();
-       }
-       void showData(std::string const & data)
-       {
-               initialiseParams(data);
-               showView();
-       }
-       void showView()
-       {
-               updateView();  // make sure its up-to-date
-               QDialog::show();
-               raise();
-               activateWindow();
-       }
-       bool isVisibleView() const { return QDialog::isVisible(); }
-       void checkStatus() { updateView(); }
-       void redraw() { redrawView(); }
-       void redrawView() {}
-       void updateData(std::string const & data)
-       {
-               initialiseParams(data);
-               updateView();
-       }
-       void partialUpdateView(int /*id*/) {}
-       std::string name() const { return "paragraph"; }
-
-private:
-       std::string name_;
-
-       void showEvent(QShowEvent * e)
-       {
-#if (QT_VERSION >= 0x040200)
-               QSettings settings;
-               std::string key = name_ + "/geometry";
-               QDialog::restoreGeometry(settings.value(key.c_str()).toByteArray());
-#endif
-           QDialog::showEvent(e);
-       }
-
-       void closeEvent(QCloseEvent * e)
-       {
-#if (QT_VERSION >= 0x040200)
-               QSettings settings;
-               std::string key = name_ + "/geometry";
-               settings.setValue(key.c_str(), QDialog::saveGeometry());
-#endif
-               QDialog::closeEvent(e);
-       }
+       ParagraphParameters const & params() const;
+       ///
+       bool haveMultiParSelection() const;
+       ///
+       bool canIndent() const;
+       ///
+       bool hasLabelwidth() const;
+       ///
+       LyXAlignment alignPossible() const;
+       ///
+       LyXAlignment alignDefault() const;
 
 private Q_SLOTS:
        ///
@@ -126,31 +81,21 @@ private Q_SLOTS:
        void on_linespacing_activated(int);
        /// Apply changes
        void on_applyPB_clicked();
+       /// Apply changes and close
+       void on_okPB_clicked();
+       /// Close/Cancel dialog
+       void on_closePB_clicked();
 
 private:
        ///
-       bool initialiseParams(std::string const & /*data*/) { return true; }
-       /// clean-up on hide.
-       void clearParams() {}
-       ///
-       void dispatchParams();
-       ///
-       bool isBufferDependent() const { return true; }
-       ///
-       ParagraphParameters & params();
-       ///
-       ParagraphParameters const & params() const;
+       typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
        ///
-       bool haveMulitParSelection();
+       RadioMap radioMap_;
+
        ///
-       bool canIndent() const;
+       QString alignDefaultLabel_;
        ///
-       LyXAlignment alignPossible() const;
-       ///
-       LyXAlignment alignDefault() const;
-
-private:
-       ParagraphParameters multiparsel_;
+       ParagraphParameters params_;
 };
 
 } // namespace frontend