#ifndef GUIPARAGRAPH_H
#define GUIPARAGRAPH_H
-// Uncomment this if you prefer dock widget
-//#define USE_DOCK_WIDGET
-
-#include "Layout.h"
+#include "DialogView.h"
#include "ui_ParagraphUi.h"
-#include "Dialog.h"
-#include "ParagraphParameters.h"
-#include "GuiView.h"
-#include "qt_helpers.h"
-#include "support/debug.h"
-#include <QCloseEvent>
-#include <QDialog>
-#include <QSettings>
-#include <QShowEvent>
-#include <QGridLayout>
+#include "ParagraphParameters.h"
#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(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:
///
///
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 updateData(std::string const & data)
- {
- initialiseParams(data);
- updateView();
- }
- std::string name() const { return "paragraph"; }
-
-private:
- QString name_;
-
- void showEvent(QShowEvent * e)
- {
- QSettings settings;
- QString key = name_ + "/geometry";
- QDialog::restoreGeometry(settings.value(key).toByteArray());
- QDialog::showEvent(e);
- }
-
- void closeEvent(QCloseEvent * e)
- {
- QSettings settings;
- QString key = name_ + "/geometry";
- settings.setValue(key, QDialog::saveGeometry());
- 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:
///
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