3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
7 * \author Martin Vermeer
8 * \author Jürgen Spitzmüller
10 * Full author contact details are available in file CREDITS.
15 #include "InsetFlex.h"
18 #include "BufferParams.h"
20 #include "FuncRequest.h"
21 #include "FuncStatus.h"
24 #include "support/gettext.h"
33 InsetFlex::InsetFlex(Buffer * buf, string const & layoutName)
34 : InsetCollapsable(buf), name_(layoutName)
40 InsetFlex::InsetFlex(InsetFlex const & in)
41 : InsetCollapsable(in), name_(in.name_)
45 InsetLayout::InsetDecoration InsetFlex::decoration() const
47 InsetLayout::InsetDecoration const dec = getLayout().decoration();
48 return dec == InsetLayout::DEFAULT ? InsetLayout::CONGLOMERATE : dec;
52 void InsetFlex::write(ostream & os) const
55 (name_.empty() ? "undefined" : name_) << "\n";
56 InsetCollapsable::write(os);
60 bool InsetFlex::getStatus(Cursor & cur, FuncRequest const & cmd,
61 FuncStatus & flag) const
64 case LFUN_INSET_DISSOLVE:
65 if (!cmd.argument().empty()) {
66 InsetLayout const & il = getLayout();
67 InsetLayout::InsetLyXType const type =
68 translateLyXType(to_utf8(cmd.argument()));
69 if (il.lyxtype() == type) {
70 FuncRequest temp_cmd(LFUN_INSET_DISSOLVE);
71 return InsetCollapsable::getStatus(cur, temp_cmd, flag);
77 return InsetCollapsable::getStatus(cur, cmd, flag);
82 void InsetFlex::doDispatch(Cursor & cur, FuncRequest & cmd)
85 case LFUN_INSET_DISSOLVE:
86 if (!cmd.argument().empty()) {
87 InsetLayout const & il = getLayout();
88 InsetLayout::InsetLyXType const type =
89 translateLyXType(to_utf8(cmd.argument()));
91 if (il.lyxtype() == type) {
92 FuncRequest temp_cmd(LFUN_INSET_DISSOLVE);
93 InsetCollapsable::doDispatch(cur, temp_cmd);
100 InsetCollapsable::doDispatch(cur, cmd);