]> 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 7be6505640d6bc63e65b8842337c39f99e04186b..408765bbe433c0472641b62ecd9ba28ad63e1f4a 100644 (file)
@@ -6,6 +6,7 @@
  *
  * \author Edwin Leuven
  * \author John Levon
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
 #ifndef GUIPARAGRAPH_H
 #define GUIPARAGRAPH_H
 
-#include "GuiDialogView.h"
-#include "ControlParagraph.h"
-#include "Layout.h"
+#include "DialogView.h"
+#include "GuiView.h"
+#include "qt_helpers.h"
 #include "ui_ParagraphUi.h"
 
+#include "Layout.h"
+#include "ParagraphParameters.h"
+
 #include <QDialog>
+#include <QShowEvent>
+#include <QGridLayout>
 
 #include <map>
 
 namespace lyx {
 namespace frontend {
 
-class GuiParagraph;
-
-class GuiParagraphDialog : public QDialog, public Ui::ParagraphUi {
+class GuiParagraph
+       : public DialogView, public Ui::ParagraphUi
+{
        Q_OBJECT
 public:
-       GuiParagraphDialog(GuiParagraph * form);
+       GuiParagraph(GuiView & lv);
+
+       /// 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:
        ///
        void checkAlignmentRadioButtons();
        ///
        void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
        ///
-       LyXAlignment getAlignmentFromDialog();
-protected:
-       void closeEvent (QCloseEvent * e);
-private:
-       GuiParagraph * form_;
-       typedef std::map<LyXAlignment, QRadioButton *> QPRadioMap;
-       QPRadioMap radioMap;
-       typedef std::map<LyXAlignment, docstring> QPAlignmentLabels;
-       QPAlignmentLabels labelMap;
-               
-protected Q_SLOTS:
+       LyXAlignment getAlignmentFromDialog() const;
        ///
-       void change_adaptor();
+       ParagraphParameters const & params() const;
        ///
-       void enableLinespacingValue(int);
-};
-
+       bool haveMultiParSelection() const;
+       ///
+       bool canIndent() const;
+       ///
+       bool hasLabelwidth() const;
+       ///
+       LyXAlignment alignPossible() const;
+       ///
+       LyXAlignment alignDefault() const;
 
-class GuiParagraph : public GuiView<GuiParagraphDialog>
-{
-public:
-       friend class GuiParagraphDialog;
+private Q_SLOTS:
+       ///
+       void changed();
+       ///
+       void on_synchronizedViewCB_toggled();
+       ///
+       void on_restorePB_clicked();
+       ///
+       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();
 
-       GuiParagraph(GuiDialog &);
-       /// parent controller
-       ControlParagraph & controller()
-       { return static_cast<ControlParagraph &>(this->getController()); }
-       /// parent controller
-       ControlParagraph const & controller() const
-       { return static_cast<ControlParagraph const &>(this->getController()); }
 private:
-       /// Apply changes
-       virtual void apply();
-       /// update
-       virtual void update_contents();
-       /// build the dialog
-       virtual void build_dialog();
+       ///
+       typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
+       ///
+       RadioMap radioMap_;
+
+       ///
+       QString alignDefaultLabel_;
+       ///
+       ParagraphParameters params_;
 };
 
 } // namespace frontend