From d9e6e32961860821ecc047039ae6c1a9dcc6e35d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 25 Nov 2005 14:40:34 +0000 Subject: [PATCH] fix bug 2089: Touching Navigate menu crashes Lyx when a TOC inset is in a section layout git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10622 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/insets/ChangeLog | 12 ++++++++++++ src/insets/insetbase.h | 3 +++ src/insets/insetcharstyle.C | 7 +++++++ src/insets/insetcharstyle.h | 3 +++ src/insets/insetcite.C | 7 +++++++ src/insets/insetcite.h | 3 +++ src/insets/insetlatexaccent.C | 7 +++++++ src/insets/insetlatexaccent.h | 3 +++ src/insets/insetquotes.C | 7 +++++++ src/insets/insetquotes.h | 5 +++++ src/insets/insetref.C | 7 +++++++ src/insets/insetref.h | 3 +++ src/insets/insetspace.C | 7 +++++++ src/insets/insetspace.h | 3 +++ src/insets/insetspecialchar.C | 7 +++++++ src/insets/insetspecialchar.h | 3 +++ src/insets/inseturl.C | 7 +++++++ src/insets/inseturl.h | 3 +++ src/mathed/ChangeLog | 4 ++++ src/mathed/math_hullinset.C | 7 +++++++ src/mathed/math_hullinset.h | 3 +++ src/paragraph.C | 2 +- 23 files changed, 116 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index d04d7171f2..00cae0fac5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-11-25 Jürgen Spitzmüller + + * paragraph.C (asString): use new inset->textString method (fix bug 2089) + 2005-11-24 Jean-Marc Lasgouttes * CutAndPaste.C (numberOfSelections): new helper function. diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 2986041bb1..e5da110596 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,15 @@ +2005-11-25 Jürgen Spitzmüller + + * insetbase.h: + * insetcharstyle.[Ch]: + * insetcite.[Ch]: + * insetlatexaccent.[Ch]: + * insetquotes.[Ch]: + * insetref.[Ch]: + * insetspace.[Ch]: + * insetspecialchar.[Ch]: + * inseturl.[Ch]: new method textString (fix bug 2089) + 2005-11-18 Georg Baum * insetbibtex.C (latex): copy .bib files to the master buffer temp dir diff --git a/src/insets/insetbase.h b/src/insets/insetbase.h index 1c0cb2de46..6f0a860ba8 100644 --- a/src/insets/insetbase.h +++ b/src/insets/insetbase.h @@ -191,6 +191,9 @@ public: /// docbook output virtual int docbook(Buffer const &, std::ostream & os, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream &, + OutputParams const &) const { return 0; }; /** This enum indicates by which means the inset can be modified: - NOT_EDITABLE: the inset's content can not be modified at all diff --git a/src/insets/insetcharstyle.C b/src/insets/insetcharstyle.C index 6b2a785fa4..df6efba2db 100644 --- a/src/insets/insetcharstyle.C +++ b/src/insets/insetcharstyle.C @@ -316,6 +316,13 @@ int InsetCharStyle::plaintext(Buffer const & buf, ostream & os, } +int InsetCharStyle::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + void InsetCharStyle::validate(LaTeXFeatures & features) const { // Force inclusion of preamble snippet in layout file diff --git a/src/insets/insetcharstyle.h b/src/insets/insetcharstyle.h index 079a5c43c6..84c20cbb58 100644 --- a/src/insets/insetcharstyle.h +++ b/src/insets/insetcharstyle.h @@ -80,6 +80,9 @@ public: /// int plaintext(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; /// void validate(LaTeXFeatures &) const; diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index 5217f69289..75e64fe669 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -353,6 +353,13 @@ int InsetCitation::docbook(Buffer const &, ostream & os, OutputParams const &) c } +int InsetCitation::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + // Have to overwrite the default InsetCommand method in order to check that // the \cite command is valid. Eg, the user has natbib enabled, inputs some // citations and then changes his mind, turning natbib support off. The output diff --git a/src/insets/insetcite.h b/src/insets/insetcite.h index 2d232de640..0733e93486 100644 --- a/src/insets/insetcite.h +++ b/src/insets/insetcite.h @@ -38,6 +38,9 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; /// void validate(LaTeXFeatures &) const; diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index f79feb29bd..f5a9fac5ec 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -601,6 +601,13 @@ int InsetLatexAccent::docbook(Buffer const &, ostream & os, } +int InsetLatexAccent::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + bool InsetLatexAccent::directWrite() const { return true; diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 5fd5abee75..a44359f77a 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -57,6 +57,9 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; /// bool directWrite() const; /// diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index a5f1611690..7a85306c6d 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -330,6 +330,13 @@ int InsetQuotes::docbook(Buffer const &, ostream & os, } +int InsetQuotes::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + void InsetQuotes::validate(LaTeXFeatures & features) const { bool const use_babel = features.useBabel(); diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index e67ca8bc8f..c8e8e8caa1 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -93,6 +93,11 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; + /// void validate(LaTeXFeatures &) const; /// diff --git a/src/insets/insetref.C b/src/insets/insetref.C index 0d57161109..fd7074e5bf 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -127,6 +127,13 @@ int InsetRef::docbook(Buffer const & buf, ostream & os, } +int InsetRef::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + void InsetRef::validate(LaTeXFeatures & features) const { if (getCmdName() == "vref" || getCmdName() == "vpageref") diff --git a/src/insets/insetref.h b/src/insets/insetref.h index 0311730dbc..be19e7bd87 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -55,6 +55,9 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; /// void validate(LaTeXFeatures & features) const; protected: diff --git a/src/insets/insetspace.C b/src/insets/insetspace.C index 1eed8c05cd..0ca675b1bb 100644 --- a/src/insets/insetspace.C +++ b/src/insets/insetspace.C @@ -254,6 +254,13 @@ int InsetSpace::docbook(Buffer const &, ostream & os, } +int InsetSpace::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + auto_ptr InsetSpace::doClone() const { return auto_ptr(new InsetSpace(kind_)); diff --git a/src/insets/insetspace.h b/src/insets/insetspace.h index 2334633ed3..0c594c9bda 100644 --- a/src/insets/insetspace.h +++ b/src/insets/insetspace.h @@ -72,6 +72,9 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; /// InsetBase::Code lyxCode() const { return InsetBase::SPACE_CODE; } /// We don't need \begin_inset and \end_inset diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index 528abb78bb..c79eeb735d 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -243,6 +243,13 @@ int InsetSpecialChar::docbook(Buffer const &, ostream & os, } +int InsetSpecialChar::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + auto_ptr InsetSpecialChar::doClone() const { return auto_ptr(new InsetSpecialChar(kind_)); diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index fabcf8eaa1..bb88fbe9ab 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -64,6 +64,9 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; /// InsetBase::Code lyxCode() const { return InsetBase::SPECIALCHAR_CODE; } /// We don't need \begin_inset and \end_inset diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 0f052738d8..4802f14eed 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -100,6 +100,13 @@ int InsetUrl::docbook(Buffer const &, ostream & os, } +int InsetUrl::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} + + void InsetUrl::validate(LaTeXFeatures & features) const { features.require("url"); diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index b80e783eca..6536be76e0 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -46,6 +46,9 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; private: virtual std::auto_ptr doClone() const { return std::auto_ptr(new InsetUrl(params())); diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 205ca8a5e2..c61c48e73a 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2005-11-25 Jürgen Spitzmüller + + * math_hullinset.[Ch]: new method textString (fix bug 2089) + 2005-11-15 Georg Baum * command_inset.[Ch] (editXY): implement, since MathNestInset::editXY diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index 12417efb4c..ed159c05af 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -1473,3 +1473,10 @@ int MathHullInset::docbook(Buffer const & buf, ostream & os, ms << ETag(name.c_str()); return ms.line() + res; } + + +int MathHullInset::textString(Buffer const & buf, ostream & os, + OutputParams const & op) const +{ + return plaintext(buf, os, op); +} diff --git a/src/mathed/math_hullinset.h b/src/mathed/math_hullinset.h index a9d2387ba6..9767f0f883 100644 --- a/src/mathed/math_hullinset.h +++ b/src/mathed/math_hullinset.h @@ -108,6 +108,9 @@ public: /// int docbook(Buffer const &, std::ostream &, OutputParams const &) const; + /// the string that is passed to the TOC + virtual int textString(Buffer const &, std::ostream & os, + OutputParams const &) const; /// get notification when the cursor leaves this inset void notifyCursorLeaves(LCursor & cur); diff --git a/src/paragraph.C b/src/paragraph.C index 4d679f12c2..6588be1934 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1598,7 +1598,7 @@ string const Paragraph::asString(Buffer const & buffer, if (IsPrintable(c)) os << c; else if (c == META_INSET) - getInset(i)->plaintext(buffer, os, runparams); + getInset(i)->textString(buffer, os, runparams); } return os.str(); -- 2.39.5