Author: baum
Date: Mon Oct 31 22:31:32 2011
New Revision: 40116
URL: http://www.lyx.org/trac/changeset/40116

Log:
Fix bug #7846

Modified:
   lyx-devel/trunk/src/tex2lyx/text.cpp

Modified: lyx-devel/trunk/src/tex2lyx/text.cpp
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/text.cpp        Mon Oct 31 21:27:21 2011        
(r40115)
+++ lyx-devel/trunk/src/tex2lyx/text.cpp        Mon Oct 31 22:31:32 2011        
(r40116)
@@ -855,6 +855,8 @@
                        position = "c";
                if (inner_pos.empty())
                        inner_pos = position;
+               // FIXME: Support makebox
+               bool const use_makebox = false;
                parent_context.check_layout(os);
                begin_inset(os, "Box ");
                if (outer_type == "framed")
@@ -877,18 +879,28 @@
                os << "has_inner_box " << !inner_type.empty() << "\n";
                os << "inner_pos \"" << inner_pos << "\"\n";
                os << "use_parbox " << (inner_type == "parbox") << '\n';
-               os << "use_makebox 0\n";
+               os << "use_makebox " << use_makebox << '\n';
                os << "width \"" << width_value << width_unit << "\"\n";
                os << "special \"none\"\n";
                os << "height \"" << height_value << height_unit << "\"\n";
                os << "height_special \"" << height_special << "\"\n";
                os << "status open\n\n";
-               Context context(true, parent_context.textclass);
-               context.font = parent_context.font;
 
-               // FIXME, the inset layout should be plain, not standard, see 
bug #7846
+               // Unfortunately we can't use parse_text_in_inset:
+               // InsetBox::forcePlainLayout() is hard coded and does not
+               // use the inset layout. Apart from that do we call parse_text
+               // up to two times, but need only one check_end_layout.
+
+               bool const forcePlainLayout =
+                       (!inner_type.empty() || use_makebox) &&
+                       outer_type != "shaded" && outer_type != "framed";
+               Context context(true, parent_context.textclass);
+               if (forcePlainLayout)
+                       context.layout = &context.textclass.plainLayout();
+               else
+                       context.font = parent_context.font;
 
-               // If we have no inner box the contens will be read with the 
outer box
+               // If we have no inner box the contents will be read with the 
outer box
                if (!inner_type.empty())
                        parse_text(p, os, inner_flags, outer, context);
 
@@ -2614,7 +2626,6 @@
                                
preamble.registerAutomaticallyLoadedPackage("ulem");
                }
 
-               // FIXME, the inset layout should be plain, not standard, see 
bug #7846
                else if (t.cs() == "phantom" || t.cs() == "hphantom" ||
                             t.cs() == "vphantom") {
                        context.check_layout(os);
@@ -2625,7 +2636,8 @@
                        if (t.cs() == "vphantom")
                                begin_inset(os, "Phantom VPhantom\n");
                        os << "status open\n";
-                       parse_text_in_inset(p, os, FLAG_ITEM, outer, context);
+                       parse_text_in_inset(p, os, FLAG_ITEM, outer, context,
+                                           "Phantom");
                        end_inset(os);
                }
 

Reply via email to