]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFlex.cpp
Some things did not need to be mutable after all
[lyx.git] / src / insets / InsetFlex.cpp
index 9a0db9a0973d1a0ac5114f7fb78041fec19dcfe0..0b14973faa46fe06c323f4738371e5a62aa4a44d 100644 (file)
@@ -25,6 +25,7 @@
 #include "TextClass.h"
 
 #include "support/gettext.h"
+#include "support/lstrings.h"
 
 #include <ostream>
 
@@ -57,14 +58,6 @@ InsetLayout const & InsetFlex::getLayout() const
 }
 
 
-bool InsetFlex::resetFontEdit() const
-{
-       if (getLayout().resetsFont())
-               return true;
-       return InsetCollapsable::resetFontEdit();
-}
-
-
 InsetLayout::InsetDecoration InsetFlex::decoration() const
 {
        InsetLayout::InsetDecoration const dec = getLayout().decoration();
@@ -74,8 +67,25 @@ InsetLayout::InsetDecoration InsetFlex::decoration() const
 
 void InsetFlex::write(ostream & os) const
 {
-       os << "Flex " <<
-               (name_.empty() ? "undefined" : name_) << "\n";
+       os << "Flex ";
+       string name;
+       if (name_.empty())
+               name = "undefined";
+       else {
+               InsetLayout const & il = getLayout();
+               // use il.name(), since this resolves obsoleted InsetLayout names
+               if (il.name() == "undefined")
+                       // This is the name of the plain_insetlayout_. We assume that the
+                       // name resolution has failed.
+                       name = name_;
+               else {
+                       name = to_utf8(il.name());
+                       // Remove the "Flex:" prefix, if it is present
+                       if (support::prefixIs(name, "Flex:"))
+                               name = support::split(name, ':');
+               }
+       }
+       os << name << "\n";
        InsetCollapsable::write(os);
 }