]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFlex.cpp
Split pdf format as discussed on the list
[lyx.git] / src / insets / InsetFlex.cpp
index 2fd3a21037b31e8e4a8ebf7accb633b7e6894667..5609934b6d16cb144b3dfc18b5a29190f5787ba9 100644 (file)
@@ -20,6 +20,7 @@
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "Lexer.h"
+#include "TextClass.h"
 
 #include "support/gettext.h"
 
@@ -32,9 +33,7 @@ namespace lyx {
 
 InsetFlex::InsetFlex(Buffer * buf, string const & layoutName)
        : InsetCollapsable(buf), name_(layoutName)
-{
-       status_= Collapsed;
-}
+{}
 
 
 InsetFlex::InsetFlex(InsetFlex const & in)
@@ -42,9 +41,25 @@ InsetFlex::InsetFlex(InsetFlex const & in)
 {}
 
 
-docstring InsetFlex::name() const
-{ 
-       return from_utf8("Flex:" + name_); 
+// special code for InsetFlex when there is not the explicit Flex:: prefix
+InsetLayout const & InsetFlex::getLayout() const
+{
+       if (!buffer_)
+               return DocumentClass::plainInsetLayout();
+
+       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_));
+}
+
+
+bool InsetFlex::resetFontEdit() const
+{
+       if (getLayout().resetsFont())
+               return true;
+       return InsetCollapsable::resetFontEdit();
 }