diff --git a/src/insets/insetbox.C b/src/insets/insetbox.C index 9440fc5283..602b00e9bc 100644 --- a/src/insets/insetbox.C +++ b/src/insets/insetbox.C @@ -198,6 +198,12 @@ void InsetBox::doDispatch(LCursor & cur, FuncRequest & cmd) } 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); diff --git a/src/insets/insetcharstyle.C b/src/insets/insetcharstyle.C index ba4a13c208..30f8e605e4 100644 --- a/src/insets/insetcharstyle.C +++ b/src/insets/insetcharstyle.C @@ -238,13 +238,7 @@ void InsetCharStyle::doDispatch(LCursor & cur, FuncRequest & cmd) 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: diff --git a/src/insets/insetert.C b/src/insets/insetert.C index fa7533093b..ec2afaa3b1 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -244,6 +244,7 @@ void InsetERT::doDispatch(LCursor & cur, FuncRequest & cmd) // 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, FuncRequest & cmd) 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(); diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index ed94b67f96..45f3321a4a 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -745,6 +745,9 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd) 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: diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 6a45246ade..2d6730930c 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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 diff --git a/src/insets/insettext.h b/src/insets/insettext.h index a47c1c0988..c98102b08b 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -143,6 +143,8 @@ public: bool & Wide() const { return wide_inset_; } /// bool const Tall() const; + /// + void forceParagraphsToDefault(LCursor & cur); protected: ///