From adfa69440d776cb20098fef09b569af4d576d772 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 5 Nov 2007 10:14:19 +0000 Subject: [PATCH] Get rid of InsetFlexParams git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21432 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetFlex.cpp | 49 +++++++++++++++------------------------- src/insets/InsetFlex.h | 20 ++-------------- 2 files changed, 20 insertions(+), 49 deletions(-) diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp index c25bb3c34e..81bd94867a 100644 --- a/src/insets/InsetFlex.cpp +++ b/src/insets/InsetFlex.cpp @@ -47,12 +47,12 @@ InsetFlex::InsetFlex(BufferParams const & bp, InsetLayout const & il) : InsetCollapsable(bp, Collapsed, &il) { - params_.name = il.name; + name_ = il.name; } InsetFlex::InsetFlex(InsetFlex const & in) - : InsetCollapsable(in), params_(in.params_) + : InsetCollapsable(in), name_(in.name_) {} @@ -76,14 +76,28 @@ docstring const InsetFlex::editMessage() const void InsetFlex::write(Buffer const & buf, ostream & os) const { - params_.write(os); + os << "Flex " << name_ << "\n"; InsetCollapsable::write(buf, os); } void InsetFlex::read(Buffer const & buf, Lexer & lex) { - params_.read(lex); + while (lex.isOK()) { + lex.next(); + string token = lex.getString(); + + if (token == "Flex") { + lex.next(); + name_ = lex.getString(); + } + + // This is handled in Collapsable + else if (token == "status") { + lex.pushToken(token); + break; + } + } InsetCollapsable::read(buf, lex); } @@ -124,31 +138,4 @@ void InsetFlex::textString(Buffer const & buf, odocstream & os) const os << paragraphs().begin()->asString(buf, true); } - -void InsetFlexParams::write(ostream & os) const -{ - os << "Flex " << name << "\n"; -} - - -void InsetFlexParams::read(Lexer & lex) -{ - while (lex.isOK()) { - lex.next(); - string token = lex.getString(); - - if (token == "Flex") { - lex.next(); - name = lex.getString(); - } - - // This is handled in Collapsable - else if (token == "status") { - lex.pushToken(token); - break; - } - } -} - - } // namespace lyx diff --git a/src/insets/InsetFlex.h b/src/insets/InsetFlex.h index 9cdc7c7a6d..fbfbeb7eaf 100644 --- a/src/insets/InsetFlex.h +++ b/src/insets/InsetFlex.h @@ -20,17 +20,6 @@ namespace lyx { -class InsetFlexParams { -public: - /// - void write(std::ostream & os) const; - /// - void read(Lexer & lex); - /// - std::string name; -}; - - /** The Flex inset, e.g., CharStyle, Custom inset or XML short element */ @@ -39,7 +28,7 @@ public: /// InsetFlex(BufferParams const &, InsetLayout const &); /// - docstring name() const { return from_utf8(params_.name); } + docstring name() const { return from_utf8(name_); } /// Is this character style defined in the document's textclass? /// May be wrong after textclass change or paste from another document @@ -64,9 +53,6 @@ public: /// the string that is passed to the TOC virtual void textString(Buffer const &, odocstream &) const; - /// - InsetFlexParams const & params() const { return params_; } - /// should paragraph indendation be ommitted in any case? bool neverIndent(Buffer const &) const { return true; } @@ -74,12 +60,10 @@ protected: InsetFlex(InsetFlex const &); private: - friend class InsetFlexParams; - virtual Inset * clone() const; /// - InsetFlexParams params_; + std::string name_; }; -- 2.39.2