2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiToc.cpp
|
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 Abdelrazak Younes
|
2007-10-06 20:35:44 +00:00
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiToc.h"
|
2007-10-06 20:35:44 +00:00
|
|
|
#include "GuiView.h"
|
|
|
|
#include "TocWidget.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2007-10-06 20:35:44 +00:00
|
|
|
#include "Buffer.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "BufferParams.h"
|
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
2012-06-28 20:52:20 +02:00
|
|
|
#include "support/debug.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/gettext.h"
|
2008-04-30 08:26:40 +00:00
|
|
|
#include "support/lassert.h"
|
2008-03-15 00:22:54 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-11-05 13:52:37 +00:00
|
|
|
GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
|
2016-12-31 15:16:15 +01:00
|
|
|
: DockView(parent, "toc", qt_("Outline"), area, flags),
|
|
|
|
widget_(new TocWidget(parent, this)),
|
|
|
|
is_closing_(false)
|
2007-10-08 20:14:58 +00:00
|
|
|
{
|
|
|
|
setWidget(widget_);
|
2010-04-26 10:03:09 +00:00
|
|
|
setFocusProxy(widget_);
|
2007-10-08 20:14:58 +00:00
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
2007-10-06 20:35:44 +00:00
|
|
|
void GuiToc::updateView()
|
|
|
|
{
|
2008-10-23 20:46:03 +00:00
|
|
|
widget_->updateView();
|
2007-10-06 20:35:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-24 01:01:34 -05:00
|
|
|
bool GuiToc::initialiseParams(string const & sdata)
|
2007-04-03 13:07:38 +00:00
|
|
|
{
|
2018-02-24 01:01:34 -05:00
|
|
|
widget_->init(toqstr(sdata));
|
2007-04-03 13:07:38 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-02 12:09:51 +00:00
|
|
|
void GuiToc::dispatchParams()
|
2007-10-06 20:35:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-30 00:25:46 +01:00
|
|
|
void GuiToc::enableView(bool enable)
|
2007-10-07 18:58:47 +00:00
|
|
|
{
|
2016-04-30 00:25:46 +01:00
|
|
|
if (!enable)
|
|
|
|
// In the opposite case, updateView() will be called anyway.
|
2016-04-29 22:48:53 +01:00
|
|
|
widget_->updateViewNow();
|
2007-10-07 18:58:47 +00:00
|
|
|
}
|
|
|
|
|
2009-05-14 23:46:42 +00:00
|
|
|
|
2009-06-09 13:17:07 +00:00
|
|
|
void GuiToc::closeEvent(QCloseEvent * /*event*/)
|
2009-05-14 23:46:42 +00:00
|
|
|
{
|
|
|
|
is_closing_ = true;
|
2015-10-10 21:44:08 +02:00
|
|
|
static_cast<GuiView *>(parent())->updateToolbars();
|
2009-05-14 23:46:42 +00:00
|
|
|
is_closing_ = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-03 00:02:45 -05:00
|
|
|
void GuiToc::doDispatch(Cursor & cur, FuncRequest const & cmd,
|
|
|
|
DispatchResult & dr)
|
2009-04-08 21:06:58 +00:00
|
|
|
{
|
2020-03-03 00:02:45 -05:00
|
|
|
widget_->doDispatch(cur, cmd, dr);
|
2009-04-08 21:06:58 +00:00
|
|
|
}
|
|
|
|
|
2007-10-07 18:58:47 +00:00
|
|
|
|
2009-04-11 11:43:13 +00:00
|
|
|
bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|
|
|
FuncStatus & status) const
|
|
|
|
{
|
|
|
|
return widget_->getStatus(cur, cmd, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-03-12 14:23:44 +00:00
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiToc.cpp"
|