X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Foutput_xhtml.h;h=ac405cdebd00a880a052d7cb38248ca70e1772d1;hb=4db3e641ed6765e005343010cb90ee8af26f8f99;hp=0bcc9849c0e354c9781cfcccdbe4bc7e06000589;hpb=64f0cffbba33c9a02e8f1f5d3b825d8e79257012;p=lyx.git diff --git a/src/output_xhtml.h b/src/output_xhtml.h index 0bcc9849c0..ac405cdebd 100644 --- a/src/output_xhtml.h +++ b/src/output_xhtml.h @@ -31,6 +31,9 @@ class Text; namespace html { +struct FontTag; +struct EndFontTag; + /// Attributes will be escaped automatically and so should NOT /// be escaped before being passed to the constructor. struct StartTag @@ -44,16 +47,20 @@ struct StartTag /// ~StartTag() {} /// - virtual docstring asTag() const; + virtual docstring writeTag() const; /// - virtual docstring asEndTag() const; + virtual docstring writeEndTag() const; /// - bool operator==(StartTag const & rhs) const + virtual FontTag const * asFontTag() const { return 0; } + /// + virtual bool operator==(StartTag const & rhs) const { return tag_ == rhs.tag_; } /// - bool operator!=(StartTag const & rhs) const + virtual bool operator!=(StartTag const & rhs) const { return !(*this == rhs); } /// + virtual bool operator==(FontTag const & rhs) const; + /// std::string tag_; /// std::string attr_; @@ -63,6 +70,46 @@ struct StartTag }; +/// +struct EndTag +{ + /// + explicit EndTag(std::string tag) : tag_(tag) {} + /// + virtual docstring writeEndTag() const; + /// + bool operator==(StartTag const & rhs) const + { return tag_ == rhs.tag_; } + /// + bool operator!=(StartTag const & rhs) const + { return !(*this == rhs); } + /// + virtual EndFontTag const * asFontTag() const { return 0; } + /// + std::string tag_; +}; + + +/// Tags like +/// Attributes will be escaped automatically and so should NOT +/// be escaped before being passed to the constructor. +struct CompTag +{ + /// + explicit CompTag(std::string const & tag) + : tag_(tag) {} + /// + explicit CompTag(std::string const & tag, std::string const & attr) + : tag_(tag), attr_(attr) {} + /// + docstring writeTag() const; + /// + std::string tag_; + /// + std::string attr_; +}; + + /// A special case of StartTag, used exclusively for tags that wrap paragraphs. struct ParTag : public StartTag { @@ -74,7 +121,7 @@ struct ParTag : public StartTag /// ~ParTag() {} /// - docstring asTag() const; + docstring writeTag() const; /// the "magic par label" for this paragraph std::string parid_; }; @@ -82,20 +129,37 @@ struct ParTag : public StartTag /// enum FontTypes { + // ranges FT_EMPH, - FT_BOLD, FT_NOUN, FT_UBAR, FT_DBAR, - FT_SOUT, FT_WAVE, + FT_SOUT, + // bold + FT_BOLD, + // shapes + FT_UPRIGHT, FT_ITALIC, FT_SLANTED, FT_SMALLCAPS, + // families FT_ROMAN, FT_SANS, - FT_TYPER - // SIZES? + FT_TYPE, + // sizes + FT_SIZE_TINY, + FT_SIZE_SCRIPT, + FT_SIZE_FOOTNOTE, + FT_SIZE_SMALL, + FT_SIZE_NORMAL, + FT_SIZE_LARGE, + FT_SIZE_LARGER, + FT_SIZE_LARGEST, + FT_SIZE_HUGE, + FT_SIZE_HUGER, + FT_SIZE_INCREASE, + FT_SIZE_DECREASE }; @@ -105,56 +169,23 @@ struct FontTag : public StartTag /// explicit FontTag(FontTypes type); /// - docstring asTag() const; - /// - docstring asEndTag() const; + FontTag const * asFontTag() const { return this; } /// - bool isFontTag() { return true; } - /// - bool operator==(FontTag const & rhs) - { return font_type_ == rhs.font_type_; } - /// Asserts. - bool operator==(StartTag const &); + bool operator==(StartTag const &) const; /// FontTypes font_type_; }; /// -struct EndTag +struct EndFontTag : public EndTag { /// - explicit EndTag(std::string tag) : tag_(tag) {} - /// - docstring asEndTag() const; - /// - bool operator==(StartTag const & rhs) const - { return tag_ == rhs.tag_; } + explicit EndFontTag(FontTypes type); /// - bool operator!=(StartTag const & rhs) const - { return !(*this == rhs); } + EndFontTag const * asFontTag() const { return this; } /// - std::string tag_; -}; - - -/// Tags like -/// Attributes will be escaped automatically and so should NOT -/// be escaped before being passed to the constructor. -struct CompTag -{ - /// - explicit CompTag(std::string const & tag) - : tag_(tag) {} - /// - explicit CompTag(std::string const & tag, std::string const & attr) - : tag_(tag), attr_(attr) {} - /// - docstring asTag() const; - /// - std::string tag_; - /// - std::string attr_; + FontTypes font_type_; }; @@ -201,6 +232,8 @@ public: /// XHTMLStream & operator<<(html::ParTag const &); /// + XHTMLStream & operator<<(html::FontTag const &); + /// XHTMLStream & operator<<(html::CR const &); /// enum EscapeSettings {