2002-09-12 14:58:06 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file factory.cpp
|
2002-09-12 14:58:06 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-12 14:58:06 +00:00
|
|
|
|
*/
|
2002-08-27 10:14:56 +00:00
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2003-09-05 16:31:30 +00:00
|
|
|
|
#include "factory.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Buffer.h"
|
|
|
|
|
#include "BufferParams.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
|
#include "FloatList.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "FuncRequest.h"
|
2007-04-26 11:30:54 +00:00
|
|
|
|
#include "Lexer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "LyX.h"
|
2007-11-07 23:34:45 +00:00
|
|
|
|
#include "TextClass.h"
|
2002-08-28 17:33:42 +00:00
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetBibitem.h"
|
|
|
|
|
#include "insets/InsetBibtex.h"
|
|
|
|
|
#include "insets/InsetCaption.h"
|
2007-04-25 16:11:45 +00:00
|
|
|
|
#include "insets/InsetCitation.h"
|
2007-09-05 15:29:04 +00:00
|
|
|
|
#include "insets/InsetFlex.h"
|
2007-04-28 20:44:46 +00:00
|
|
|
|
#include "insets/InsetEnvironment.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetERT.h"
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
#include "insets/InsetListings.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetExternal.h"
|
|
|
|
|
#include "insets/InsetFloat.h"
|
|
|
|
|
#include "insets/InsetFloatList.h"
|
|
|
|
|
#include "insets/InsetFoot.h"
|
|
|
|
|
#include "insets/InsetGraphics.h"
|
|
|
|
|
#include "insets/InsetHFill.h"
|
|
|
|
|
#include "insets/InsetInclude.h"
|
|
|
|
|
#include "insets/InsetIndex.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
|
#include "insets/InsetInfo.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetNomencl.h"
|
|
|
|
|
#include "insets/InsetLabel.h"
|
|
|
|
|
#include "insets/InsetLine.h"
|
|
|
|
|
#include "insets/InsetMarginal.h"
|
|
|
|
|
#include "insets/InsetNote.h"
|
|
|
|
|
#include "insets/InsetBox.h"
|
|
|
|
|
#include "insets/InsetBranch.h"
|
|
|
|
|
#include "insets/InsetOptArg.h"
|
2007-11-23 02:10:00 +00:00
|
|
|
|
#include "insets/InsetNewpage.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetRef.h"
|
|
|
|
|
#include "insets/InsetSpace.h"
|
|
|
|
|
#include "insets/InsetTabular.h"
|
|
|
|
|
#include "insets/InsetTOC.h"
|
2007-10-13 19:06:09 +00:00
|
|
|
|
#include "insets/InsetHyperlink.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetVSpace.h"
|
|
|
|
|
#include "insets/InsetWrap.h"
|
2004-01-26 10:13:15 +00:00
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "mathed/MathMacroTemplate.h"
|
|
|
|
|
#include "mathed/InsetMathHull.h"
|
2003-02-27 13:26:07 +00:00
|
|
|
|
|
2007-04-28 20:44:46 +00:00
|
|
|
|
#include "frontends/alert.h"
|
2007-04-18 12:59:07 +00:00
|
|
|
|
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/debug.h"
|
2003-03-12 11:52:23 +00:00
|
|
|
|
#include "support/lstrings.h"
|
2007-04-18 12:59:07 +00:00
|
|
|
|
#include "support/ExceptionMessage.h"
|
2002-08-27 10:14:56 +00:00
|
|
|
|
|
2003-10-01 16:27:36 +00:00
|
|
|
|
#include <boost/assert.hpp>
|
|
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
|
#include <sstream>
|
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
using namespace std;
|
2007-12-12 19:57:42 +00:00
|
|
|
|
using namespace lyx::support;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
namespace Alert = frontend::Alert;
|
|
|
|
|
|
2003-09-05 22:17:02 +00:00
|
|
|
|
|
2007-11-03 17:37:37 +00:00
|
|
|
|
Inset * createInset(Buffer & buf, FuncRequest const & cmd)
|
2002-08-27 10:14:56 +00:00
|
|
|
|
{
|
2007-11-03 17:37:37 +00:00
|
|
|
|
BufferParams const & params = buf.params();
|
2002-08-27 10:14:56 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
try {
|
2003-03-11 11:52:05 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
switch (cmd.action) {
|
|
|
|
|
case LFUN_HFILL_INSERT:
|
|
|
|
|
return new InsetHFill;
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_LINE_INSERT:
|
|
|
|
|
return new InsetLine;
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
2007-11-23 02:10:00 +00:00
|
|
|
|
case LFUN_NEWPAGE_INSERT:
|
|
|
|
|
return new InsetNewpage;
|
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_PAGEBREAK_INSERT:
|
|
|
|
|
return new InsetPagebreak;
|
2006-11-25 15:09:01 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_CLEARPAGE_INSERT:
|
|
|
|
|
return new InsetClearPage;
|
2006-11-25 15:09:01 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_CLEARDOUBLEPAGE_INSERT:
|
|
|
|
|
return new InsetClearDoublePage;
|
2003-11-12 14:38:26 +00:00
|
|
|
|
|
2007-09-05 18:40:56 +00:00
|
|
|
|
case LFUN_FLEX_INSERT: {
|
2007-04-18 12:59:07 +00:00
|
|
|
|
string s = cmd.getArg(0);
|
2007-11-03 00:35:07 +00:00
|
|
|
|
TextClass const & tclass = params.getTextClass();
|
|
|
|
|
InsetLayout const & il = tclass.insetlayout(from_utf8(s));
|
2007-09-05 15:29:04 +00:00
|
|
|
|
return new InsetFlex(params, il);
|
2007-04-18 12:59:07 +00:00
|
|
|
|
}
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_NOTE_INSERT: {
|
|
|
|
|
string arg = cmd.getArg(0);
|
|
|
|
|
if (arg.empty())
|
|
|
|
|
arg = "Note";
|
|
|
|
|
return new InsetNote(params, arg);
|
|
|
|
|
}
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_BOX_INSERT: {
|
|
|
|
|
string arg = cmd.getArg(0);
|
|
|
|
|
if (arg.empty())
|
|
|
|
|
arg = "Boxed";
|
|
|
|
|
return new InsetBox(params, arg);
|
|
|
|
|
}
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_BRANCH_INSERT: {
|
|
|
|
|
docstring arg = cmd.argument();
|
|
|
|
|
if (arg.empty())
|
|
|
|
|
arg = from_ascii("none");
|
|
|
|
|
return new InsetBranch(params, InsetBranchParams(arg));
|
|
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_ERT_INSERT:
|
|
|
|
|
return new InsetERT(params);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
case LFUN_LISTING_INSERT:
|
|
|
|
|
return new InsetListings(params);
|
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_FOOTNOTE_INSERT:
|
|
|
|
|
return new InsetFoot(params);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_MARGINALNOTE_INSERT:
|
|
|
|
|
return new InsetMarginal(params);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_OPTIONAL_INSERT:
|
|
|
|
|
return new InsetOptArg(params);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_BIBITEM_INSERT:
|
2007-10-19 17:22:55 +00:00
|
|
|
|
return new InsetBibitem(InsetCommandParams(BIBITEM_CODE));
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_FLOAT_INSERT: {
|
|
|
|
|
// check if the float type exists
|
|
|
|
|
string const argument = to_utf8(cmd.argument());
|
2007-04-29 19:53:54 +00:00
|
|
|
|
if (params.getTextClass().floats().typeExist(argument))
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetFloat(params, argument);
|
|
|
|
|
lyxerr << "Non-existent float type: " << argument << endl;
|
2003-02-26 19:28:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_FLOAT_WIDE_INSERT: {
|
|
|
|
|
// check if the float type exists
|
|
|
|
|
string const argument = to_utf8(cmd.argument());
|
2007-04-29 19:53:54 +00:00
|
|
|
|
if (params.getTextClass().floats().typeExist(argument)) {
|
2007-04-18 12:59:07 +00:00
|
|
|
|
auto_ptr<InsetFloat> p(new InsetFloat(params, argument));
|
|
|
|
|
p->wide(true, params);
|
|
|
|
|
return p.release();
|
|
|
|
|
}
|
|
|
|
|
lyxerr << "Non-existent float type: " << argument << endl;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2006-11-04 17:55:36 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_WRAP_INSERT: {
|
|
|
|
|
string const argument = to_utf8(cmd.argument());
|
2007-10-03 21:07:01 +00:00
|
|
|
|
if (argument == "figure" || argument == "table")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetWrap(params, argument);
|
2007-09-09 23:47:22 +00:00
|
|
|
|
lyxerr << "Non-existent wrapfig type: " << argument << endl;
|
2005-07-15 22:10:25 +00:00
|
|
|
|
return 0;
|
2007-04-18 12:59:07 +00:00
|
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-10-03 13:38:19 +00:00
|
|
|
|
case LFUN_INDEX_INSERT:
|
|
|
|
|
return new InsetIndex(params);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_NOMENCL_INSERT: {
|
2007-10-19 17:22:55 +00:00
|
|
|
|
InsetCommandParams icp(NOMENCL_CODE);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
icp["symbol"] = cmd.argument();
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetNomencl(icp);
|
|
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_TABULAR_INSERT: {
|
|
|
|
|
if (cmd.argument().empty())
|
|
|
|
|
return 0;
|
2007-12-12 19:28:07 +00:00
|
|
|
|
istringstream ss(to_utf8(cmd.argument()));
|
2007-04-18 12:59:07 +00:00
|
|
|
|
int r = 0, c = 0;
|
|
|
|
|
ss >> r >> c;
|
|
|
|
|
if (r <= 0)
|
|
|
|
|
r = 2;
|
|
|
|
|
if (c <= 0)
|
|
|
|
|
c = 2;
|
2007-11-03 17:37:37 +00:00
|
|
|
|
return new InsetTabular(buf, r, c);
|
2007-04-18 12:59:07 +00:00
|
|
|
|
}
|
2006-11-04 17:55:36 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_CAPTION_INSERT: {
|
|
|
|
|
auto_ptr<InsetCaption> inset(new InsetCaption(params));
|
|
|
|
|
inset->setAutoBreakRows(true);
|
|
|
|
|
inset->setDrawFrame(true);
|
2007-10-25 12:41:02 +00:00
|
|
|
|
inset->setFrameColor(Color_captionframe);
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return inset.release();
|
|
|
|
|
}
|
2002-08-29 13:05:55 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_INDEX_PRINT:
|
2007-10-19 17:22:55 +00:00
|
|
|
|
return new InsetPrintIndex(InsetCommandParams(INDEX_PRINT_CODE));
|
2003-03-13 11:00:31 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_NOMENCL_PRINT:
|
2007-10-19 17:22:55 +00:00
|
|
|
|
return new InsetPrintNomencl(InsetCommandParams(NOMENCL_PRINT_CODE));
|
2002-08-27 10:14:56 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_TOC_INSERT:
|
2007-10-19 17:22:55 +00:00
|
|
|
|
return new InsetTOC(InsetCommandParams(TOC_CODE));
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_ENVIRONMENT_INSERT:
|
2007-07-11 13:39:08 +00:00
|
|
|
|
return new InsetEnvironment(params, cmd.argument());
|
2003-03-05 11:30:35 +00:00
|
|
|
|
|
2007-10-11 14:52:00 +00:00
|
|
|
|
case LFUN_INFO_INSERT:
|
|
|
|
|
return new InsetInfo(params, to_utf8(cmd.argument()));
|
2007-04-18 12:59:07 +00:00
|
|
|
|
#if 0
|
|
|
|
|
case LFUN_THEOREM_INSERT:
|
|
|
|
|
return new InsetTheorem;
|
|
|
|
|
#endif
|
2003-03-05 14:59:37 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_INSET_INSERT: {
|
|
|
|
|
string const name = cmd.getArg(0);
|
2007-10-17 12:50:25 +00:00
|
|
|
|
InsetCode code = insetCode(name);
|
|
|
|
|
switch (code) {
|
|
|
|
|
case NO_CODE:
|
|
|
|
|
lyxerr << "No such inset '" << name << "'.";
|
|
|
|
|
return 0;
|
|
|
|
|
|
2007-10-19 17:22:55 +00:00
|
|
|
|
case BIBITEM_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetBibitem(icp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BIBTEX_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetBibtex(icp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case CITE_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetCitation(icp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ERT_CODE: {
|
|
|
|
|
InsetCollapsable::CollapseStatus st;
|
|
|
|
|
InsetERTMailer::string2params(to_utf8(cmd.argument()), st);
|
|
|
|
|
return new InsetERT(params, st);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LISTINGS_CODE: {
|
|
|
|
|
InsetListingsParams par;
|
|
|
|
|
InsetListingsMailer::string2params(to_utf8(cmd.argument()), par);
|
|
|
|
|
return new InsetListings(params, par);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case EXTERNAL_CODE: {
|
|
|
|
|
InsetExternalParams iep;
|
2007-11-03 17:37:37 +00:00
|
|
|
|
InsetExternalMailer::string2params(to_utf8(cmd.argument()), buf, iep);
|
2007-10-19 17:22:55 +00:00
|
|
|
|
auto_ptr<InsetExternal> inset(new InsetExternal);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
inset->setParams(iep, buf);
|
2007-10-19 17:22:55 +00:00
|
|
|
|
return inset.release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case GRAPHICS_CODE: {
|
|
|
|
|
InsetGraphicsParams igp;
|
2007-11-03 17:37:37 +00:00
|
|
|
|
InsetGraphicsMailer::string2params(to_utf8(cmd.argument()), buf, igp);
|
2007-10-19 17:22:55 +00:00
|
|
|
|
auto_ptr<InsetGraphics> inset(new InsetGraphics);
|
|
|
|
|
inset->setParams(igp);
|
|
|
|
|
return inset.release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case HYPERLINK_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetHyperlink(icp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case INCLUDE_CODE: {
|
2007-10-23 15:02:15 +00:00
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetInclude(icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-17 12:50:25 +00:00
|
|
|
|
case INDEX_CODE:
|
2007-10-03 13:38:19 +00:00
|
|
|
|
return new InsetIndex(params);
|
2007-10-19 17:22:55 +00:00
|
|
|
|
|
|
|
|
|
case NOMENCL_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetNomencl(icp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LABEL_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetLabel(icp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case REF_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
return new InsetRef(icp, buf);
|
2007-10-19 17:22:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case TOC_CODE: {
|
|
|
|
|
InsetCommandParams icp(code);
|
|
|
|
|
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
|
|
|
|
return new InsetTOC(icp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case VSPACE_CODE: {
|
|
|
|
|
VSpace vspace;
|
|
|
|
|
InsetVSpaceMailer::string2params(to_utf8(cmd.argument()), vspace);
|
|
|
|
|
return new InsetVSpace(vspace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
lyxerr << "Inset '" << name << "' not permitted with LFUN_INSET_INSERT."
|
2007-12-12 19:28:07 +00:00
|
|
|
|
<< endl;
|
2007-10-19 17:22:55 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
}
|
2007-10-17 12:50:25 +00:00
|
|
|
|
} //end LFUN_INSET_INSERT
|
2003-02-27 13:26:07 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
case LFUN_SPACE_INSERT: {
|
|
|
|
|
string const name = to_utf8(cmd.argument());
|
|
|
|
|
if (name == "normal")
|
|
|
|
|
return new InsetSpace(InsetSpace::NORMAL);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name == "protected")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetSpace(InsetSpace::PROTECTED);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name == "thin")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetSpace(InsetSpace::THIN);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name == "quad")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetSpace(InsetSpace::QUAD);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name == "qquad")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetSpace(InsetSpace::QQUAD);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name == "enspace")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetSpace(InsetSpace::ENSPACE);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name == "enskip")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetSpace(InsetSpace::ENSKIP);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name == "negthinspace")
|
2007-04-18 12:59:07 +00:00
|
|
|
|
return new InsetSpace(InsetSpace::NEGTHIN);
|
2007-11-03 17:37:37 +00:00
|
|
|
|
if (name.empty())
|
2007-04-18 12:59:07 +00:00
|
|
|
|
lyxerr << "LyX function 'space' needs an argument." << endl;
|
|
|
|
|
else
|
|
|
|
|
lyxerr << "Wrong argument for LyX function 'space'." << endl;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2006-11-04 17:55:36 +00:00
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2003-02-27 13:26:07 +00:00
|
|
|
|
}
|
2003-05-22 10:40:57 +00:00
|
|
|
|
|
2007-12-12 19:57:42 +00:00
|
|
|
|
} catch (ExceptionMessage const & message) {
|
|
|
|
|
if (message.type_ == ErrorException) {
|
2007-12-16 11:34:29 +00:00
|
|
|
|
// This should never happen!
|
2007-04-18 12:59:07 +00:00
|
|
|
|
Alert::error(message.title_, message.details_);
|
2007-12-16 11:34:29 +00:00
|
|
|
|
LyX::cref().exit(1);
|
2007-12-12 19:57:42 +00:00
|
|
|
|
} else if (message.type_ == WarningException) {
|
2007-04-18 12:59:07 +00:00
|
|
|
|
Alert::warning(message.title_, message.details_);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2003-05-22 10:40:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-02-26 19:28:38 +00:00
|
|
|
|
|
2002-08-27 10:14:56 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2003-03-12 11:52:23 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset * readInset(Lexer & lex, Buffer const & buf)
|
2003-03-12 11:52:23 +00:00
|
|
|
|
{
|
|
|
|
|
// consistency check
|
|
|
|
|
if (lex.getString() != "\\begin_inset") {
|
|
|
|
|
lyxerr << "Buffer::readInset: Consistency check failed."
|
|
|
|
|
<< endl;
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
auto_ptr<Inset> inset;
|
2003-03-12 11:52:23 +00:00
|
|
|
|
|
2007-11-03 00:35:07 +00:00
|
|
|
|
TextClass const & tclass = buf.params().getTextClass();
|
2004-04-03 08:37:12 +00:00
|
|
|
|
|
2003-03-12 11:52:23 +00:00
|
|
|
|
lex.next();
|
2003-11-12 14:38:26 +00:00
|
|
|
|
string tmptok = lex.getString();
|
2003-03-12 11:52:23 +00:00
|
|
|
|
|
|
|
|
|
// test the different insets
|
2007-10-17 12:50:25 +00:00
|
|
|
|
|
|
|
|
|
//FIXME It would be better if we did not have this branch and could
|
|
|
|
|
//just do one massive switch for all insets. But at present, it's easier
|
|
|
|
|
//to do it this way, and we can't do the massive switch until the conversion
|
|
|
|
|
//mentioned below.
|
|
|
|
|
//Note that if we do want to do a single switch, we need to remove
|
|
|
|
|
//this "CommandInset" line---or replace it with a single "InsetType" line
|
|
|
|
|
//that would be used in all insets.
|
2007-09-27 18:24:18 +00:00
|
|
|
|
if (tmptok == "CommandInset") {
|
Rework InsetCommandParams interface and file storage
* src/insets/insetcommandparams.[Ch]:
(operator[]): New, access a parameter
(clear): New, clear all parameters
(info_): New, stire info about this command
(cmdname): Rename to name_
(contents, options, sec_options): Replace with params_. Parameters
are now stored as docstring.
(findInfo): New factor for command info for all commands
(read, write): Use new syntax
(parameter set and get methods): reimplemenmt for new parameter storage
* src/insets/insetcommand.h
(getParam): New, get a parameter
(setParam): New, set a parameter
(parameter set and get methods): Adjust to InsetCommandParams changes
* src/insets/insetbibitem.[Ch]
(write): Remove, not needed anymore
(directWrite): ditto
* src/insets/insetbibitem.C
(InsetBibitem::read): Use InsetCommand::read
* src/insets/insetref.C
(InsetRef::latex): Use new InsetCommandParams interface
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): ditto
* src/text3.C
(LyXText::dispatch): ditto
* src/factory.C
(createInset): Create InsetCommandParams with command name
(readInset): ditto
(readInset): Remove error message for bibitem, since bibitem is
now a normal command inset
* src/buffer.C: Bump file format number
* src/frontends/controllers/ControlCommand.[Ch]
(ControlCommand): take an additional command name parameter
* src/text.C
(readParToken): Remove code for \bibitem
* lib/lyx2lyx/LyX.py: Bump latest file format number
* lib/lyx2lyx/lyx_1_5.py
(convert_bibitem, convert_commandparams): new, convert to new format
(revert_commandparams): new, convert to old format
* development/FORMAT: document new format
* many other files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15357 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-17 21:07:16 +00:00
|
|
|
|
lex.next();
|
2007-09-27 18:24:18 +00:00
|
|
|
|
string const insetType = lex.getString();
|
|
|
|
|
lex.pushToken(insetType);
|
2007-10-17 12:50:25 +00:00
|
|
|
|
|
|
|
|
|
InsetCode const code = insetCode(insetType);
|
|
|
|
|
|
|
|
|
|
//FIXME If we do the one massive switch, we cannot do this here, since
|
|
|
|
|
//we do not know in advance that we're dealing with a command inset.
|
|
|
|
|
//Worst case, we could put it in each case below. Better, we could
|
|
|
|
|
//pass the lexer to the constructor and let the params be built there.
|
2007-10-19 17:22:55 +00:00
|
|
|
|
InsetCommandParams inscmd(code);
|
Rework InsetCommandParams interface and file storage
* src/insets/insetcommandparams.[Ch]:
(operator[]): New, access a parameter
(clear): New, clear all parameters
(info_): New, stire info about this command
(cmdname): Rename to name_
(contents, options, sec_options): Replace with params_. Parameters
are now stored as docstring.
(findInfo): New factor for command info for all commands
(read, write): Use new syntax
(parameter set and get methods): reimplemenmt for new parameter storage
* src/insets/insetcommand.h
(getParam): New, get a parameter
(setParam): New, set a parameter
(parameter set and get methods): Adjust to InsetCommandParams changes
* src/insets/insetbibitem.[Ch]
(write): Remove, not needed anymore
(directWrite): ditto
* src/insets/insetbibitem.C
(InsetBibitem::read): Use InsetCommand::read
* src/insets/insetref.C
(InsetRef::latex): Use new InsetCommandParams interface
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): ditto
* src/text3.C
(LyXText::dispatch): ditto
* src/factory.C
(createInset): Create InsetCommandParams with command name
(readInset): ditto
(readInset): Remove error message for bibitem, since bibitem is
now a normal command inset
* src/buffer.C: Bump file format number
* src/frontends/controllers/ControlCommand.[Ch]
(ControlCommand): take an additional command name parameter
* src/text.C
(readParToken): Remove code for \bibitem
* lib/lyx2lyx/LyX.py: Bump latest file format number
* lib/lyx2lyx/lyx_1_5.py
(convert_bibitem, convert_commandparams): new, convert to new format
(revert_commandparams): new, convert to old format
* development/FORMAT: document new format
* many other files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15357 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-17 21:07:16 +00:00
|
|
|
|
inscmd.read(lex);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
|
2007-10-17 12:50:25 +00:00
|
|
|
|
switch (code) {
|
|
|
|
|
case BIBITEM_CODE:
|
|
|
|
|
inset.reset(new InsetBibitem(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case BIBTEX_CODE:
|
|
|
|
|
inset.reset(new InsetBibtex(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case CITE_CODE:
|
|
|
|
|
inset.reset(new InsetCitation(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case HYPERLINK_CODE:
|
|
|
|
|
inset.reset(new InsetHyperlink(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case INCLUDE_CODE:
|
|
|
|
|
inset.reset(new InsetInclude(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case INDEX_PRINT_CODE:
|
|
|
|
|
inset.reset(new InsetPrintIndex(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case LABEL_CODE:
|
|
|
|
|
inset.reset(new InsetLabel(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case NOMENCL_CODE:
|
|
|
|
|
inset.reset(new InsetNomencl(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case NOMENCL_PRINT_CODE:
|
|
|
|
|
inset.reset(new InsetPrintNomencl(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case REF_CODE:
|
|
|
|
|
if (!inscmd["name"].empty() || !inscmd["reference"].empty())
|
|
|
|
|
inset.reset(new InsetRef(inscmd, buf));
|
|
|
|
|
break;
|
|
|
|
|
case TOC_CODE:
|
|
|
|
|
inset.reset(new InsetTOC(inscmd));
|
|
|
|
|
break;
|
|
|
|
|
case NO_CODE:
|
|
|
|
|
default:
|
|
|
|
|
lyxerr << "unknown CommandInset '" << insetType
|
2007-12-12 19:28:07 +00:00
|
|
|
|
<< "'" << endl;
|
2007-10-17 12:50:25 +00:00
|
|
|
|
while (lex.isOK() && lex.getString() != "\\end_inset")
|
|
|
|
|
lex.next();
|
|
|
|
|
return 0;
|
2003-03-12 11:52:23 +00:00
|
|
|
|
}
|
2007-10-17 12:50:25 +00:00
|
|
|
|
} else {
|
|
|
|
|
// FIXME This branch should be made to use inset codes as the preceding
|
|
|
|
|
// branch does. Unfortunately, that will take some doing. It requires
|
|
|
|
|
// converting the representation of the insets in LyX files so that they
|
|
|
|
|
// use the inset names listed in Inset.cpp. Then, as above, the inset names
|
|
|
|
|
// can be translated to inset codes using insetCode(). And the insets'
|
|
|
|
|
// write() routines should use insetName() rather than hardcoding it.
|
2003-03-12 11:52:23 +00:00
|
|
|
|
if (tmptok == "Quotes") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetQuotes);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "External") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetExternal);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "FormulaMacro") {
|
2004-04-13 06:27:29 +00:00
|
|
|
|
inset.reset(new MathMacroTemplate);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Formula") {
|
2006-09-16 18:11:38 +00:00
|
|
|
|
inset.reset(new InsetMathHull);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Graphics") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetGraphics);
|
2003-12-10 17:28:14 +00:00
|
|
|
|
} else if (tmptok == "Note") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetNote(buf.params(), tmptok));
|
2003-12-10 21:48:40 +00:00
|
|
|
|
} else if (tmptok == "Box") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetBox(buf.params(), tmptok));
|
2007-09-08 13:09:58 +00:00
|
|
|
|
} else if (tmptok == "Flex") {
|
2003-11-28 10:12:04 +00:00
|
|
|
|
lex.next();
|
|
|
|
|
string s = lex.getString();
|
2007-11-03 00:35:07 +00:00
|
|
|
|
InsetLayout const & il = tclass.insetlayout(from_utf8(s));
|
2007-09-05 15:29:04 +00:00
|
|
|
|
inset.reset(new InsetFlex(buf.params(), il));
|
2003-08-17 11:28:23 +00:00
|
|
|
|
} else if (tmptok == "Branch") {
|
2003-12-14 16:33:56 +00:00
|
|
|
|
inset.reset(new InsetBranch(buf.params(),
|
|
|
|
|
InsetBranchParams()));
|
2003-03-13 11:42:12 +00:00
|
|
|
|
} else if (tmptok == "Environment") {
|
|
|
|
|
lex.next();
|
2007-07-11 13:39:08 +00:00
|
|
|
|
inset.reset(new InsetEnvironment(buf.params(), lex.getDocString()));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "ERT") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetERT(buf.params()));
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
} else if (tmptok == "listings") {
|
|
|
|
|
inset.reset(new InsetListings(buf.params()));
|
2003-05-22 10:40:57 +00:00
|
|
|
|
} else if (tmptok == "InsetSpace") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetSpace);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Tabular") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetTabular(buf));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Text") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetText(buf.params()));
|
2003-11-28 15:53:34 +00:00
|
|
|
|
} else if (tmptok == "VSpace") {
|
|
|
|
|
inset.reset(new InsetVSpace);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Foot") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetFoot(buf.params()));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Marginal") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetMarginal(buf.params()));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "OptArg") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetOptArg(buf.params()));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Float") {
|
|
|
|
|
lex.next();
|
|
|
|
|
string tmptok = lex.getString();
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetFloat(buf.params(), tmptok));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "Wrap") {
|
|
|
|
|
lex.next();
|
|
|
|
|
string tmptok = lex.getString();
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetWrap(buf.params(), tmptok));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
#if 0
|
|
|
|
|
} else if (tmptok == "Theorem") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetList);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
#endif
|
|
|
|
|
} else if (tmptok == "Caption") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetCaption(buf.params()));
|
2007-10-03 13:38:19 +00:00
|
|
|
|
} else if (tmptok == "Index") {
|
|
|
|
|
inset.reset(new InsetIndex(buf.params()));
|
2003-03-12 11:52:23 +00:00
|
|
|
|
} else if (tmptok == "FloatList") {
|
2003-11-03 17:47:28 +00:00
|
|
|
|
inset.reset(new InsetFloatList);
|
2007-10-11 14:52:00 +00:00
|
|
|
|
} else if (tmptok == "Info") {
|
|
|
|
|
inset.reset(new InsetInfo(buf.params()));
|
2003-10-01 16:27:36 +00:00
|
|
|
|
} else {
|
2003-10-14 12:49:15 +00:00
|
|
|
|
lyxerr << "unknown Inset type '" << tmptok
|
2007-12-12 19:28:07 +00:00
|
|
|
|
<< "'" << endl;
|
2003-10-14 12:49:15 +00:00
|
|
|
|
while (lex.isOK() && lex.getString() != "\\end_inset")
|
|
|
|
|
lex.next();
|
|
|
|
|
return 0;
|
2003-03-12 11:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-10-01 16:27:36 +00:00
|
|
|
|
inset->read(buf, lex);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-11-03 17:47:28 +00:00
|
|
|
|
return inset.release();
|
2003-03-12 11:52:23 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|