Jean-Marc Lasgouttes wrote: > What about redefining as > > virtual bool forceDefaultParagraphs(idx_type cell =0) > > Paragraph::forceDefaultParagraph would pass 0 (or no value), the > others would use the cursor.
Looks much nicer :-) I wonder if passing 0 from Paragraph::forceDefaultParagraphs() is always correct, though. Jürgen
Index: lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.671 diff -p -u -r1.671 lyxfunc.C --- lyxfunc.C 24 Oct 2005 09:42:18 -0000 1.671 +++ lyxfunc.C 14 Nov 2005 20:31:41 -0000 @@ -430,7 +430,7 @@ FuncStatus LyXFunc::getStatus(FuncReques case LFUN_LAYOUT: case LFUN_LAYOUT_PARAGRAPH: - enable = !cur.inset().forceDefaultParagraphs(&cur.inset()); + enable = !cur.inset().forceDefaultParagraphs(cur.idx()); break; case LFUN_VC_REGISTER: Index: paragraph.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v retrieving revision 1.415 diff -p -u -r1.415 paragraph.C --- paragraph.C 7 Nov 2005 11:28:11 -0000 1.415 +++ paragraph.C 14 Nov 2005 20:31:43 -0000 @@ -703,7 +703,7 @@ InsetBibitem * Paragraph::bibitem() cons bool Paragraph::forceDefaultParagraphs() const { - return inInset() && inInset()->forceDefaultParagraphs(inInset()); + return inInset() && inInset()->forceDefaultParagraphs(0); } Index: text3.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v retrieving revision 1.317 diff -p -u -r1.317 text3.C --- text3.C 2 Nov 2005 11:27:08 -0000 1.317 +++ text3.C 14 Nov 2005 20:31:47 -0000 @@ -1414,8 +1414,7 @@ void LyXText::dispatch(LCursor & cur, Fu params2string(cur.paragraph(), data); // Will the paragraph accept changes from the dialog? - InsetBase & inset = cur.inset(); - bool const accept = !inset.forceDefaultParagraphs(&inset); + bool const accept = !cur.inset().forceDefaultParagraphs(cur.idx()); data = "update " + convert<string>(accept) + '\n' + data; bv->owner()->getDialogs().update("paragraph", data); Index: insets/insetbase.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbase.h,v retrieving revision 1.60 diff -p -u -r1.60 insetbase.h --- insets/insetbase.h 10 Nov 2005 10:19:05 -0000 1.60 +++ insets/insetbase.h 14 Nov 2005 20:31:50 -0000 @@ -327,7 +327,7 @@ public: virtual bool insetAllowed(Code) const { return false; } /// if this inset has paragraphs should they be output all as default /// paragraphs with "Standard" layout? - virtual bool forceDefaultParagraphs(InsetBase const *) const { return false; } + virtual bool forceDefaultParagraphs(idx_type) const { return false; } /// virtual std::string const & getInsetName() const; Index: insets/insetert.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.h,v retrieving revision 1.112 diff -p -u -r1.112 insetert.h --- insets/insetert.h 10 Sep 2005 06:51:54 -0000 1.112 +++ insets/insetert.h 14 Nov 2005 20:31:50 -0000 @@ -67,7 +67,7 @@ public: /// void getDrawFont(LyXFont &) const; /// - bool forceDefaultParagraphs(InsetBase const *) const { return true; } + bool forceDefaultParagraphs(idx_type) const { return true; } /// should paragraph indendation be ommitted in any case? bool neverIndent() const { return true; } protected: Index: insets/insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.491 diff -p -u -r1.491 insettabular.C --- insets/insettabular.C 24 Oct 2005 09:42:20 -0000 1.491 +++ insets/insettabular.C 14 Nov 2005 20:31:53 -0000 @@ -1851,27 +1851,9 @@ void InsetTabular::markErased(bool erase } -bool InsetTabular::forceDefaultParagraphs(InsetBase const *) const +bool InsetTabular::forceDefaultParagraphs(idx_type cell) const { -#if 0 - idx_type const cell = tabular.getCellFromInset(in); - // FIXME: getCellFromInset() returns now always a valid cell, so - // the stuff below can be deleted, and instead we have: return tabular.getPWidth(cell).zero(); - - if (cell != npos) - return tabular.getPWidth(cell).zero(); - - // this is a workaround for a crash (New, Insert->Tabular, - // Insert->FootNote) - if (!owner()) - return false; - - // well we didn't obviously find it so maybe our owner knows more - BOOST_ASSERT(owner()); - return owner()->forceDefaultParagraphs(in); -#endif - return false; } Index: insets/insettabular.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.h,v retrieving revision 1.208 diff -p -u -r1.208 insettabular.h --- insets/insettabular.h 7 Sep 2005 10:37:04 -0000 1.208 +++ insets/insettabular.h 14 Nov 2005 20:31:54 -0000 @@ -117,9 +117,10 @@ public: /// void markErased(bool); - // this should return true if we have a "normal" cell, otherwise true. + // this should return true if we have a "normal" cell, otherwise false. // "normal" means without width set! - bool forceDefaultParagraphs(InsetBase const * in) const; + /// should all paragraphs be output with "Standard" layout? + bool forceDefaultParagraphs(idx_type cell = 0) const; /// void addPreview(lyx::graphics::PreviewLoader &) const;