2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiToc.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 John Levon
|
|
|
|
* \author Kalle Dalheimer
|
2007-10-06 20:35:44 +00:00
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUITOC_H
|
|
|
|
#define GUITOC_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 20:35:44 +00:00
|
|
|
#include "TocBackend.h"
|
2007-10-07 18:58:47 +00:00
|
|
|
#include "Dialog.h"
|
|
|
|
#include "insets/InsetCommandParams.h"
|
2006-04-18 09:57:47 +00:00
|
|
|
|
2007-03-12 14:23:44 +00:00
|
|
|
#include <QObject>
|
2006-04-18 09:57:47 +00:00
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include <QStringListModel>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 20:35:44 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2006-04-18 09:57:47 +00:00
|
|
|
class TocModel;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-07 18:58:47 +00:00
|
|
|
class GuiToc : public QObject, public Controller
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-03-12 14:23:44 +00:00
|
|
|
Q_OBJECT
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
public:
|
|
|
|
///
|
2007-09-08 17:28:14 +00:00
|
|
|
GuiToc(Dialog &);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-03 13:07:38 +00:00
|
|
|
///
|
2007-10-06 20:35:44 +00:00
|
|
|
bool initialiseParams(std::string const & data);
|
2006-11-16 12:37:55 +00:00
|
|
|
///
|
2007-10-06 20:35:44 +00:00
|
|
|
void updateView();
|
|
|
|
/// Test if outlining operation is possible
|
2007-03-16 14:14:55 +00:00
|
|
|
bool canOutline(int type) const;
|
2007-05-28 22:27:45 +00:00
|
|
|
|
2007-03-16 14:14:55 +00:00
|
|
|
QStandardItemModel * tocModel(int type);
|
2006-04-19 14:48:22 +00:00
|
|
|
///
|
2007-10-06 20:35:44 +00:00
|
|
|
QModelIndex currentIndex(int type) const;
|
2006-04-19 14:48:22 +00:00
|
|
|
///
|
2007-03-16 14:14:55 +00:00
|
|
|
void goTo(int type, QModelIndex const & index);
|
2006-11-16 12:37:55 +00:00
|
|
|
///
|
|
|
|
int getType();
|
2006-11-25 22:16:22 +00:00
|
|
|
///
|
2007-03-16 14:14:55 +00:00
|
|
|
int getTocDepth(int type);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-03-12 14:23:44 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
/// Signal that the internal toc_models_ has been reset.
|
|
|
|
void modelReset();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-03-12 14:23:44 +00:00
|
|
|
private:
|
2007-10-06 20:35:44 +00:00
|
|
|
friend class TocWidget;
|
2007-03-12 14:23:44 +00:00
|
|
|
///
|
2006-04-18 09:57:47 +00:00
|
|
|
std::vector<TocModel *> toc_models_;
|
2007-10-06 20:35:44 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
TocList const & tocs() const;
|
|
|
|
|
|
|
|
/// Return the list of types available
|
|
|
|
std::vector<docstring> const & typeNames() const
|
|
|
|
{ return type_names_; }
|
|
|
|
|
|
|
|
///
|
|
|
|
int selectedType() { return selected_type_; }
|
|
|
|
|
|
|
|
/// Return the first TocItem before the cursor
|
|
|
|
TocIterator currentTocItem(int type) const;
|
|
|
|
|
|
|
|
/// Apply the selected outlining operation
|
|
|
|
void outlineUp();
|
|
|
|
///
|
|
|
|
void outlineDown();
|
|
|
|
///
|
|
|
|
void outlineIn();
|
|
|
|
///
|
|
|
|
void outlineOut();
|
|
|
|
///
|
|
|
|
void updateBackend();
|
|
|
|
|
|
|
|
std::vector<std::string> types_;
|
|
|
|
std::vector<docstring> type_names_;
|
|
|
|
int selected_type_;
|
|
|
|
|
|
|
|
/// Return the guiname from a given cmdName of the TOC param
|
|
|
|
docstring guiName(std::string const & type) const;
|
2007-10-07 18:58:47 +00:00
|
|
|
|
|
|
|
/// clean-up on hide.
|
|
|
|
void clearParams() { params_.clear(); }
|
|
|
|
///
|
|
|
|
void dispatchParams();
|
|
|
|
///
|
|
|
|
bool isBufferDependent() const { return true; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
InsetCommandParams params_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUITOC_H
|