]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFlex.cpp
* ANNOUNCE
[lyx.git] / src / insets / InsetFlex.cpp
index 2e9e97096fd51a6dca41717ac97af1b671c21f76..6d64c3f8ead6a4f839e1a93f26e2a67b9e0d2b70 100644 (file)
@@ -20,6 +20,7 @@
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "Lexer.h"
+#include "TextClass.h"
 
 #include "support/gettext.h"
 
@@ -42,6 +43,16 @@ InsetFlex::InsetFlex(InsetFlex const & in)
 {}
 
 
+InsetLayout const & InsetFlex::getLayout() const
+{
+       DocumentClass const & dc = buffer().params().documentClass();
+       docstring const dname = from_utf8(name_); 
+       if (dc.hasInsetLayout(dname))
+               return dc.insetLayout(dname);
+       return dc.insetLayout(from_utf8("Flex:" + name_));
+}
+
+
 InsetLayout::InsetDecoration InsetFlex::decoration() const
 {
        InsetLayout::InsetDecoration const dec = getLayout().decoration();
@@ -60,7 +71,7 @@ void InsetFlex::write(ostream & os) const
 bool InsetFlex::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
-       switch (cmd.action_) {
+       switch (cmd.action()) {
        case LFUN_INSET_DISSOLVE:
                if (!cmd.argument().empty()) {
                        InsetLayout const & il = getLayout();
@@ -81,7 +92,7 @@ bool InsetFlex::getStatus(Cursor & cur, FuncRequest const & cmd,
 
 void InsetFlex::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
-       switch (cmd.action_) {
+       switch (cmd.action()) {
        case LFUN_INSET_DISSOLVE:
                if (!cmd.argument().empty()) {
                        InsetLayout const & il = getLayout();