On Wed, Mar 29, 2006 at 12:10:34PM +0200, Jean-Marc Lasgouttes wrote: > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
... > Have you seen this one? > http://bugzilla.lyx.org/show_bug.cgi?id=2382 > > Maybe a more general solution is needed. Like the attached? This solves also 2382 and a similar bug in Box. (I think it is even formally correct. General paragraph layouts are allowed when there is a parbox/minipage around it, in tabular and in box.) - Martin
Index: insettext.h =================================================================== --- insettext.h (revision 13520) +++ insettext.h (working copy) @@ -143,6 +143,8 @@ public: bool & Wide() const { return wide_inset_; } /// bool const Tall() const; + /// + void forceParagraphsToDefault(LCursor & cur); protected: /// Index: insettabular.C =================================================================== --- insettabular.C (revision 13520) +++ insettabular.C (working copy) @@ -745,6 +745,9 @@ void InsetTabular::doDispatch(LCursor & break; } cell(cur.idx())->dispatch(cur, cmd); + // Reset pasted paragraphs: + if (tabular.getPWidth(cur.idx()).zero()) + cell(cur.idx())->forceParagraphsToDefault(cur); break; case LFUN_EMPH: Index: insetbox.C =================================================================== --- insetbox.C (revision 13520) +++ insetbox.C (working copy) @@ -198,6 +198,12 @@ void InsetBox::doDispatch(LCursor & cur, } InsetCollapsable::doDispatch(cur, cmd); break; + case LFUN_PASTE: + case LFUN_PASTESELECTION: + InsetCollapsable::doDispatch(cur, cmd); + if (!params_.inner_box) + forceParagraphsToDefault(cur); + break; default: InsetCollapsable::doDispatch(cur, cmd); Index: insetert.C =================================================================== --- insetert.C (revision 13520) +++ insetert.C (working copy) @@ -244,6 +244,7 @@ void InsetERT::doDispatch(LCursor & cur, // Since we can only store plain text, we must reset all // attributes. + forceParagraphsToDefault(cur); // FIXME: Change only the pasted paragraphs BufferParams const & bp = cur.buffer().params(); @@ -255,7 +256,6 @@ void InsetERT::doDispatch(LCursor & cur, ParagraphList::iterator const end = paragraphs().end(); for (ParagraphList::iterator par = paragraphs().begin(); par != end; ++par) { - par->layout(layout); // in case par had a manual label par->setBeginOfBody(); pos_type const siz = par->size(); Index: insetcharstyle.C =================================================================== --- insetcharstyle.C (revision 13520) +++ insetcharstyle.C (working copy) @@ -238,13 +238,7 @@ void InsetCharStyle::doDispatch(LCursor case LFUN_PASTE: case LFUN_PASTESELECTION: { InsetCollapsable::doDispatch(cur, cmd); - BufferParams const & bp = cur.buffer().params(); - LyXLayout_ptr const layout = - bp.getLyXTextClass().defaultLayout(); - ParagraphList::iterator const end = paragraphs().end(); - for (ParagraphList::iterator par = paragraphs().begin(); - par != end; ++par) - par->layout(layout); + forceParagraphsToDefault(cur); break; } default: Index: insettext.C =================================================================== --- insettext.C (revision 13520) +++ insettext.C (working copy) @@ -264,6 +264,18 @@ bool const InsetText::Tall() const } +void InsetText::forceParagraphsToDefault(LCursor & cur) +{ + BufferParams const & bp = cur.buffer().params(); + LyXLayout_ptr const layout = + bp.getLyXTextClass().defaultLayout(); + ParagraphList::iterator const end = paragraphs().end(); + for (ParagraphList::iterator par = paragraphs().begin(); + par != end; ++par) + par->layout(layout); +} + + void InsetText::doDispatch(LCursor & cur, FuncRequest & cmd) { lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
pgpFe44C876L5.pgp
Description: PGP signature