2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiDocument.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
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIDOCUMENT_H
|
|
|
|
#define GUIDOCUMENT_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiDialogView.h"
|
2007-04-24 19:37:34 +00:00
|
|
|
#include "BulletsModule.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
#include "ControlDocument.h"
|
2007-02-13 18:27:46 +00:00
|
|
|
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_DocumentUi.h"
|
|
|
|
#include "ui_FontUi.h"
|
|
|
|
#include "ui_TextLayoutUi.h"
|
|
|
|
#include "ui_MathsUi.h"
|
|
|
|
#include "ui_LaTeXUi.h"
|
|
|
|
#include "ui_PageLayoutUi.h"
|
|
|
|
#include "ui_LanguageUi.h"
|
|
|
|
#include "ui_BiblioUi.h"
|
|
|
|
#include "ui_NumberingUi.h"
|
|
|
|
#include "ui_MarginsUi.h"
|
|
|
|
#include "ui_PreambleUi.h"
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
#include <QDialog>
|
2007-05-14 12:09:14 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#include <vector>
|
2007-04-24 19:37:34 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class FloatPlacement;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-24 19:37:34 +00:00
|
|
|
template<class UI>
|
2007-08-31 22:16:11 +00:00
|
|
|
class UiWidget : public QWidget, public UI
|
2007-04-24 19:37:34 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
UiWidget(QWidget * parent = 0) : QWidget(parent)
|
|
|
|
{
|
|
|
|
UI::setupUi(this);
|
|
|
|
}
|
|
|
|
};
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiBranches;
|
|
|
|
class GuiDocument;
|
2007-05-14 12:09:14 +00:00
|
|
|
class PreambleModule;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiDocumentDialog : public QDialog, public Ui::DocumentUi {
|
2007-04-24 19:37:34 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-08-31 05:53:55 +00:00
|
|
|
friend class GuiDocument;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiDocumentDialog(GuiDocument *);
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
void updateParams(BufferParams const & params);
|
|
|
|
void apply(BufferParams & params);
|
|
|
|
|
|
|
|
void updateFontsize(std::string const &, std::string const &);
|
|
|
|
void updatePagestyle(std::string const &, std::string const &);
|
|
|
|
|
|
|
|
void showPreamble();
|
2007-07-27 18:17:00 +00:00
|
|
|
/// validate listings parameters and return an error message, if any
|
|
|
|
docstring validate_listings_params();
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void updateNumbering();
|
|
|
|
void change_adaptor();
|
2007-07-27 18:17:00 +00:00
|
|
|
void set_listings_msg();
|
2007-04-24 19:37:34 +00:00
|
|
|
void saveDefaultClicked();
|
|
|
|
void useDefaultsClicked();
|
|
|
|
|
|
|
|
protected Q_SLOTS:
|
|
|
|
void setLSpacing(int);
|
|
|
|
void setMargins(bool);
|
|
|
|
void setCustomPapersize(int);
|
|
|
|
void setCustomMargins(bool);
|
|
|
|
void romanChanged(int);
|
|
|
|
void sansChanged(int);
|
|
|
|
void ttChanged(int);
|
|
|
|
void setSkip(int);
|
|
|
|
void enableSkip(bool);
|
|
|
|
void portraitChanged();
|
|
|
|
void classChanged();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent * e);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
UiWidget<Ui::TextLayoutUi> *textLayoutModule;
|
|
|
|
UiWidget<Ui::FontUi> *fontModule;
|
|
|
|
UiWidget<Ui::PageLayoutUi> *pageLayoutModule;
|
|
|
|
UiWidget<Ui::MarginsUi> *marginsModule;
|
|
|
|
UiWidget<Ui::LanguageUi> *langModule;
|
|
|
|
UiWidget<Ui::NumberingUi> *numberingModule;
|
|
|
|
UiWidget<Ui::BiblioUi> *biblioModule;
|
|
|
|
UiWidget<Ui::MathsUi> *mathsModule;
|
|
|
|
UiWidget<Ui::LaTeXUi> *latexModule;
|
2007-05-14 12:09:14 +00:00
|
|
|
PreambleModule *preambleModule;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiBranches *branchesModule;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
BulletsModule * bulletsModule;
|
|
|
|
FloatPlacement * floatModule;
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiDocument * form_;
|
2007-04-24 19:37:34 +00:00
|
|
|
|
|
|
|
/// FIXME
|
|
|
|
std::vector<std::string> lang_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
class GuiDocument : public GuiView<GuiDocumentDialog>
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
friend class GuiDocumentDialog;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiDocument(Dialog &);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
void showPreamble();
|
2007-08-31 22:16:11 +00:00
|
|
|
/// parent controller
|
|
|
|
ControlDocument & controller()
|
|
|
|
{ return static_cast<ControlDocument &>(this->getController()); }
|
|
|
|
/// parent controller
|
|
|
|
ControlDocument const & controller() const
|
|
|
|
{ return static_cast<ControlDocument const &>(this->getController()); }
|
2006-03-05 17:24:44 +00:00
|
|
|
private:
|
|
|
|
/// Apply changes
|
|
|
|
void apply();
|
|
|
|
/// update
|
|
|
|
void update_contents();
|
|
|
|
/// build the dialog
|
|
|
|
void build_dialog();
|
|
|
|
/// save as default template
|
|
|
|
void saveDocDefault();
|
|
|
|
/// reset to default params
|
|
|
|
void useClassDefaults();
|
2007-07-27 18:17:00 +00:00
|
|
|
protected:
|
|
|
|
/// return false if validate_listings_params returns error
|
|
|
|
virtual bool isValid();
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
2007-05-14 12:09:14 +00:00
|
|
|
|
2007-05-14 16:41:50 +00:00
|
|
|
typedef void const * BufferId;
|
|
|
|
|
|
|
|
|
2007-05-14 12:09:14 +00:00
|
|
|
class PreambleModule : public UiWidget<Ui::PreambleUi>
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PreambleModule();
|
2007-05-14 16:41:50 +00:00
|
|
|
void update(BufferParams const & params, BufferId id);
|
2007-05-14 12:09:14 +00:00
|
|
|
void apply(BufferParams & params);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/// signal that something's changed in the Widget.
|
|
|
|
void changed();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *);
|
|
|
|
void on_preambleTE_textChanged() { changed(); }
|
|
|
|
|
|
|
|
private:
|
2007-05-14 16:41:50 +00:00
|
|
|
typedef std::map<BufferId, std::pair<int,int> > Coords;
|
2007-05-14 12:09:14 +00:00
|
|
|
Coords preamble_coords_;
|
2007-05-14 16:41:50 +00:00
|
|
|
BufferId current_id_;
|
2007-05-14 12:09:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIDOCUMENT_H
|