]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetBox.cpp
DocBook, InsetFloat: avoid a potential nullptr dereference when detecting the type...
[features.git] / src / insets / InsetBox.cpp
index 9cf0169422d39b392f1a20d5e722208e3076bdb6..c04bd1e927e6bf9721ba0b13b6793766bb854699 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "support/debug.h"
 #include "support/docstream.h"
+#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/Translator.h"
@@ -220,11 +221,10 @@ ColorCode InsetBox::backgroundColor(PainterInfo const &) const
                return getLayout().bgcolor();
 
        if (params_.type == "Shaded") {
-               // FIXME: This hardcoded color is a hack!
-               if (buffer().params().boxbgcolor == lyx::rgbFromHexName("#ff0000"))
+               if (!buffer().params().isboxbgcolor)
                        return getLayout().bgcolor();
 
-               ColorCode c = lcolor.getFromLyXName("boxbgcolor");
+               ColorCode c = lcolor.getFromLyXName("boxbgcolor@" + buffer().fileName().absFileName());
                if (c == Color_none)
                        return getLayout().bgcolor();
                return c;