mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
A more general way of setting paragraphs in an inset to standard
layout upon paste. * insettext.[Ch]: add forceParagraphsToDefault method * insettabular.C (InsetTabular::doDispatch): use it for cell * insetbox.C (InsetBox::doDispatch): use it * insetert.C (InsetERT::doDispatch): use it * insetcharstyle.C (InsetCharStyle::doDispatch): use it git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13535 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ce1170d887
commit
726637fc29
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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();
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -143,6 +143,8 @@ public:
|
||||
bool & Wide() const { return wide_inset_; }
|
||||
///
|
||||
bool const Tall() const;
|
||||
///
|
||||
void forceParagraphsToDefault(LCursor & cur);
|
||||
|
||||
protected:
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user