+ return (!params_.inner_box || params_.use_makebox)
+ && params_.type != "Shaded" && params_.type != "Framed";
+}
+
+
+bool InsetBox::needsCProtection(bool const maintext, bool const fragile) const
+{
+ // We need to cprotect boxes that use minipages as inner box
+ // in fragile context
+ if (fragile && params_.inner_box && !params_.use_parbox && !params_.use_makebox)
+ return true;
+
+ return InsetText::needsCProtection(maintext, fragile);
+}
+
+
+ColorCode InsetBox::backgroundColor(PainterInfo const &) const
+{
+ // we only support background color for 3 types
+ if (params_.type != "Shaded" && params_.type != "Frameless" && params_.type != "Boxed")
+ return getLayout().bgcolor();
+
+ if (params_.type == "Shaded") {
+ // FIXME: This hardcoded color is a hack!
+ if (buffer().params().boxbgcolor == lyx::rgbFromHexName("#ff0000"))
+ return getLayout().bgcolor();
+
+ ColorCode c = lcolor.getFromLyXName("boxbgcolor");
+ if (c == Color_none)
+ return getLayout().bgcolor();
+ return c;
+ }
+
+ if (params_.backgroundcolor != "none")
+ return lcolor.getFromLaTeXName(params_.backgroundcolor);
+
+ return getLayout().bgcolor();