Some framework stuff for default-generated CSS.

The actual generation is still to come.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31749 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-10-26 16:13:09 +00:00
parent 546f91ac9e
commit 67b7ca00a0
2 changed files with 36 additions and 2 deletions

View File

@ -101,6 +101,7 @@ enum LayoutTags {
LT_HTMLLABELFIRST,
LT_HTMLPREAMBLE,
LT_HTMLSTYLE,
LT_HTMLFORCEDEFAULT,
LT_INTITLE // keep this last!
};
@ -140,6 +141,7 @@ Layout::Layout()
toclevel = NOT_IN_TOC;
commanddepth = 0;
htmllabelfirst_ = false;
htmlforcedefault_ = false;
}
@ -162,7 +164,8 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
{ "fill_top", LT_FILL_TOP },
{ "font", LT_FONT },
{ "freespacing", LT_FREE_SPACING },
{ "htmlattr", LT_HTMLATTR },
{ "htmlattr", LT_HTMLATTR },
{ "htmlforcedefault", LT_HTMLFORCEDEFAULT },
{ "htmlitem", LT_HTMLITEM },
{ "htmlitemattr", LT_HTMLITEMATTR },
{ "htmllabel", LT_HTMLLABEL },
@ -514,6 +517,9 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
htmlstyle_ = from_utf8(lex.getLongString("EndHTMLStyle"));
break;
case LT_HTMLFORCEDEFAULT:
lex >> htmlforcedefault_;
case LT_HTMLPREAMBLE:
htmlpreamble_ = from_utf8(lex.getLongString("EndPreamble"));
break;
@ -863,6 +869,24 @@ docstring const Layout::babelpreamble(Language const * lang) const
}
docstring Layout::htmlstyle() const {
if (!htmlstyle_.empty() && !htmlforcedefault_)
return htmlstyle_;
if (htmldefaultstyle_.empty())
makeDefaultCSS();
docstring retval = htmldefaultstyle_;
if (!htmlstyle_.empty())
retval += '\n' + htmlstyle_;
return retval;
}
void Layout::makeDefaultCSS() const {
// FIXME just an empty hook for now.
// i'll get to this shortly.
}
bool Layout::operator==(Layout const & rhs) const
{
// This is enough for the applications we actually make,

View File

@ -124,7 +124,7 @@ public:
///
bool htmllabelfirst() const { return htmllabelfirst_; }
///
docstring const & htmlstyle() const { return htmlstyle_; }
docstring htmlstyle() const;
///
docstring const & htmlpreamble() const { return htmlpreamble_; }
///
@ -249,6 +249,9 @@ public:
private:
/// generates the default CSS for this layout
void makeDefaultCSS() const;
/// Name of the layout/paragraph environment
docstring name_;
@ -315,6 +318,13 @@ private:
bool htmllabelfirst_;
/// CSS information needed by this layout.
docstring htmlstyle_;
/// Should we generate the default CSS for this layout, even if HTMLStyle
/// has been given? Default is false.
/// Note that the default CSS is output first, then the user CSS, so it is
/// possible to override what one does not want.
bool htmlforcedefault_;
/// A cache for the default style info so generated.
mutable docstring htmldefaultstyle_;
/// Any other info for the HTML header.
docstring htmlpreamble_;
/// This is the `category' for this layout. The following are