2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiParagraph.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Edwin Leuven
|
|
|
|
* \author John Levon
|
2007-10-07 20:00:46 +00:00
|
|
|
* \author Abdelrazak Younes
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIPARAGRAPH_H
|
|
|
|
#define GUIPARAGRAPH_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
// Uncomment this if you prefer dock widget
|
|
|
|
//#define USE_DOCK_WIDGET
|
|
|
|
|
2007-04-29 22:04:32 +00:00
|
|
|
#include "Layout.h"
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_ParagraphUi.h"
|
2007-10-07 20:00:46 +00:00
|
|
|
#include "Dialog.h"
|
|
|
|
#include "ParagraphParameters.h"
|
|
|
|
#include "GuiView.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
#include "debug.h"
|
2007-04-29 22:04:32 +00:00
|
|
|
|
2007-10-07 20:00:46 +00:00
|
|
|
#include <QCloseEvent>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QShowEvent>
|
|
|
|
#include <QGridLayout>
|
2007-09-26 13:13:01 +00:00
|
|
|
|
2007-04-29 22:04:32 +00:00
|
|
|
#include <map>
|
2007-10-07 20:00:46 +00:00
|
|
|
#include <string>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2007-05-28 22:27:45 +00:00
|
|
|
|
2007-10-07 20:00:46 +00:00
|
|
|
class GuiParagraph
|
2007-10-09 21:21:01 +00:00
|
|
|
: public QDialog, public Ui::ParagraphUi, public Dialog
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2007-04-24 19:37:34 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 20:00:46 +00:00
|
|
|
GuiParagraph(LyXView & lv);
|
2007-09-26 13:13:01 +00:00
|
|
|
|
|
|
|
/// update
|
|
|
|
void updateView();
|
|
|
|
|
|
|
|
private:
|
2007-04-24 19:37:34 +00:00
|
|
|
///
|
|
|
|
void checkAlignmentRadioButtons();
|
|
|
|
///
|
|
|
|
void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
|
|
|
|
///
|
|
|
|
LyXAlignment getAlignmentFromDialog();
|
2007-09-05 20:33:29 +00:00
|
|
|
///
|
|
|
|
typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
|
|
|
|
RadioMap radioMap;
|
2007-10-23 08:10:55 +00:00
|
|
|
typedef std::map<LyXAlignment, docstring> AlignmentLabels;
|
|
|
|
AlignmentLabels labelMap;
|
2007-09-26 13:13:01 +00:00
|
|
|
|
|
|
|
QString const alignDefaultLabel;
|
2007-10-07 20:00:46 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
QSettings settings;
|
|
|
|
std::string key = name_ + "/geometry";
|
|
|
|
QDialog::restoreGeometry(settings.value(key.c_str()).toByteArray());
|
|
|
|
QDialog::showEvent(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
void closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
QSettings settings;
|
|
|
|
std::string key = name_ + "/geometry";
|
|
|
|
settings.setValue(key.c_str(), QDialog::saveGeometry());
|
2007-10-09 21:21:01 +00:00
|
|
|
QDialog::closeEvent(e);
|
2007-10-07 20:00:46 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
private Q_SLOTS:
|
2007-04-24 19:37:34 +00:00
|
|
|
///
|
2007-09-26 13:13:01 +00:00
|
|
|
void changed();
|
2007-04-24 19:37:34 +00:00
|
|
|
///
|
2007-09-26 13:13:01 +00:00
|
|
|
void on_synchronizedViewCB_toggled();
|
|
|
|
///
|
|
|
|
void on_restorePB_clicked();
|
|
|
|
///
|
|
|
|
void on_linespacing_activated(int);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Apply changes
|
2007-09-26 13:13:01 +00:00
|
|
|
void on_applyPB_clicked();
|
2007-10-07 20:00:46 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
///
|
|
|
|
bool haveMulitParSelection();
|
|
|
|
///
|
|
|
|
bool canIndent() const;
|
|
|
|
///
|
|
|
|
LyXAlignment alignPossible() const;
|
|
|
|
///
|
|
|
|
LyXAlignment alignDefault() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
ParagraphParameters multiparsel_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // QPARAGRAPH_H
|