mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
InsetBox.cpp: code simplification
thanks Pavel for the hint
This commit is contained in:
parent
8ede3618f0
commit
46671b5836
@ -341,25 +341,23 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
case Frameless:
|
case Frameless:
|
||||||
break;
|
break;
|
||||||
case Framed:
|
case Framed:
|
||||||
if (!(thickness_string.find(defaultThick) != string::npos)) {
|
if (thickness_string != defaultThick) {
|
||||||
os << "{\\FrameRule " << from_ascii(thickness_string);
|
os << "{\\FrameRule " << from_ascii(thickness_string);
|
||||||
if (!(separation_string.find(defaultSep) != string::npos))
|
if (separation_string != defaultSep)
|
||||||
os << "\\FrameSep " << from_ascii(separation_string);
|
os << "\\FrameSep " << from_ascii(separation_string);
|
||||||
}
|
}
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep && thickness_string == defaultThick)
|
||||||
&& (thickness_string.find(defaultThick) != string::npos))
|
|
||||||
os << "{\\FrameSep " << from_ascii(separation_string);
|
os << "{\\FrameSep " << from_ascii(separation_string);
|
||||||
|
|
||||||
os << "\\begin{framed}%\n";
|
os << "\\begin{framed}%\n";
|
||||||
break;
|
break;
|
||||||
case Boxed:
|
case Boxed:
|
||||||
if (!(thickness_string.find(defaultThick) != string::npos)) {
|
if (thickness_string != defaultThick) {
|
||||||
os << "{\\fboxrule " << from_ascii(thickness_string);
|
os << "{\\fboxrule " << from_ascii(thickness_string);
|
||||||
if (!(separation_string.find(defaultSep) != string::npos))
|
if (separation_string != defaultSep)
|
||||||
os << "\\fboxsep " << from_ascii(separation_string);
|
os << "\\fboxsep " << from_ascii(separation_string);
|
||||||
}
|
}
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep && thickness_string == defaultThick)
|
||||||
&& (thickness_string.find(defaultThick) != string::npos))
|
|
||||||
os << "{\\fboxsep " << from_ascii(separation_string);
|
os << "{\\fboxsep " << from_ascii(separation_string);
|
||||||
if (!params_.inner_box && !width_string.empty()) {
|
if (!params_.inner_box && !width_string.empty()) {
|
||||||
if (params_.framecolor != "black" || params_.backgroundcolor != "none") {
|
if (params_.framecolor != "black" || params_.backgroundcolor != "none") {
|
||||||
@ -387,36 +385,34 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
os << "{";
|
os << "{";
|
||||||
break;
|
break;
|
||||||
case ovalbox:
|
case ovalbox:
|
||||||
if (!separation_string.empty() && separation_string.find(defaultSep) == string::npos)
|
if (!separation_string.empty() && separation_string != defaultSep)
|
||||||
os << "{\\fboxsep " << from_ascii(separation_string);
|
os << "{\\fboxsep " << from_ascii(separation_string);
|
||||||
os << "\\ovalbox{";
|
os << "\\ovalbox{";
|
||||||
break;
|
break;
|
||||||
case Ovalbox:
|
case Ovalbox:
|
||||||
if (!separation_string.empty() && separation_string.find(defaultSep) == string::npos)
|
if (!separation_string.empty() && separation_string != defaultSep)
|
||||||
os << "{\\fboxsep " << from_ascii(separation_string);
|
os << "{\\fboxsep " << from_ascii(separation_string);
|
||||||
os << "\\Ovalbox{";
|
os << "\\Ovalbox{";
|
||||||
break;
|
break;
|
||||||
case Shadowbox:
|
case Shadowbox:
|
||||||
if (!(thickness_string.find(defaultThick) != string::npos)) {
|
if (thickness_string != defaultThick) {
|
||||||
os << "{\\fboxrule " << from_ascii(thickness_string);
|
os << "{\\fboxrule " << from_ascii(thickness_string);
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)) {
|
if (separation_string != defaultSep) {
|
||||||
os << "\\fboxsep " << from_ascii(separation_string);
|
os << "\\fboxsep " << from_ascii(separation_string);
|
||||||
if (!(shadowsize_string.find(defaultShadow) != string::npos))
|
if (shadowsize_string != defaultShadow)
|
||||||
os << "\\shadowsize " << from_ascii(shadowsize_string);
|
os << "\\shadowsize " << from_ascii(shadowsize_string);
|
||||||
}
|
}
|
||||||
if (!(shadowsize_string.find(defaultShadow) != string::npos)
|
if (shadowsize_string != defaultShadow && separation_string == defaultSep)
|
||||||
&& (separation_string.find(defaultSep) != string::npos))
|
|
||||||
os << "\\shadowsize " << from_ascii(shadowsize_string);
|
os << "\\shadowsize " << from_ascii(shadowsize_string);
|
||||||
}
|
}
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep && thickness_string == defaultThick) {
|
||||||
&& (thickness_string.find(defaultThick) != string::npos)) {
|
|
||||||
os << "{\\fboxsep " << from_ascii(separation_string);
|
os << "{\\fboxsep " << from_ascii(separation_string);
|
||||||
if (!(shadowsize_string.find(defaultShadow) != string::npos))
|
if (shadowsize_string != defaultShadow)
|
||||||
os << "\\shadowsize " << from_ascii(shadowsize_string);
|
os << "\\shadowsize " << from_ascii(shadowsize_string);
|
||||||
}
|
}
|
||||||
if (!(shadowsize_string.find(defaultShadow) != string::npos)
|
if (shadowsize_string != defaultShadow
|
||||||
&& (separation_string.find(defaultSep) != string::npos)
|
&& separation_string == defaultSep
|
||||||
&& (thickness_string.find(defaultThick) != string::npos))
|
&& thickness_string == defaultThick)
|
||||||
os << "{\\shadowsize " << from_ascii(shadowsize_string);
|
os << "{\\shadowsize " << from_ascii(shadowsize_string);
|
||||||
os << "\\shadowbox{";
|
os << "\\shadowbox{";
|
||||||
break;
|
break;
|
||||||
@ -425,13 +421,12 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
// it is inside a minipage or parbox
|
// it is inside a minipage or parbox
|
||||||
break;
|
break;
|
||||||
case Doublebox:
|
case Doublebox:
|
||||||
if (!(thickness_string.find(defaultThick) != string::npos)) {
|
if (thickness_string != defaultThick) {
|
||||||
os << "{\\fboxrule " << from_ascii(thickness_string);
|
os << "{\\fboxrule " << from_ascii(thickness_string);
|
||||||
if (!(separation_string.find(defaultSep) != string::npos))
|
if (separation_string != defaultSep)
|
||||||
os << "\\fboxsep " << from_ascii(separation_string);
|
os << "\\fboxsep " << from_ascii(separation_string);
|
||||||
}
|
}
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep && thickness_string == defaultThick)
|
||||||
&& (thickness_string.find(defaultThick) != string::npos))
|
|
||||||
os << "{\\fboxsep " << from_ascii(separation_string);
|
os << "{\\fboxsep " << from_ascii(separation_string);
|
||||||
os << "\\doublebox{";
|
os << "\\doublebox{";
|
||||||
break;
|
break;
|
||||||
@ -543,8 +538,7 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
break;
|
break;
|
||||||
case Framed:
|
case Framed:
|
||||||
os << "\\end{framed}";
|
os << "\\end{framed}";
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep || thickness_string != defaultThick)
|
||||||
|| !(thickness_string.find(defaultThick) != string::npos))
|
|
||||||
os << "}";
|
os << "}";
|
||||||
break;
|
break;
|
||||||
case Boxed:
|
case Boxed:
|
||||||
@ -552,31 +546,29 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
if (!params_.inner_box && !width_string.empty()
|
if (!params_.inner_box && !width_string.empty()
|
||||||
&& (params_.framecolor != "black" || params_.backgroundcolor != "none"))
|
&& (params_.framecolor != "black" || params_.backgroundcolor != "none"))
|
||||||
os << "}";
|
os << "}";
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep || thickness_string != defaultThick)
|
||||||
|| !(thickness_string.find(defaultThick) != string::npos))
|
|
||||||
os << "}";
|
os << "}";
|
||||||
break;
|
break;
|
||||||
case ovalbox:
|
case ovalbox:
|
||||||
os << "}";
|
os << "}";
|
||||||
if (!(separation_string.find(defaultSep) != string::npos))
|
if (separation_string != defaultSep)
|
||||||
os << "}";
|
os << "}";
|
||||||
break;
|
break;
|
||||||
case Ovalbox:
|
case Ovalbox:
|
||||||
os << "}";
|
os << "}";
|
||||||
if (!(separation_string.find(defaultSep) != string::npos))
|
if (separation_string != defaultSep)
|
||||||
os << "}";
|
os << "}";
|
||||||
break;
|
break;
|
||||||
case Doublebox:
|
case Doublebox:
|
||||||
os << "}";
|
os << "}";
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep || thickness_string != defaultThick)
|
||||||
|| !(thickness_string.find(defaultThick) != string::npos))
|
|
||||||
os << "}";
|
os << "}";
|
||||||
break;
|
break;
|
||||||
case Shadowbox:
|
case Shadowbox:
|
||||||
os << "}";
|
os << "}";
|
||||||
if (!(separation_string.find(defaultSep) != string::npos)
|
if (separation_string != defaultSep
|
||||||
|| !(thickness_string.find(defaultThick) != string::npos)
|
|| thickness_string != defaultThick
|
||||||
|| !(shadowsize_string.find(defaultShadow) != string::npos))
|
|| shadowsize_string != defaultShadow)
|
||||||
os << "}";
|
os << "}";
|
||||||
break;
|
break;
|
||||||
case Shaded:
|
case Shaded:
|
||||||
|
Loading…
Reference in New Issue
Block a user