Introduce allowMultiPar()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20898 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2007-10-11 10:13:45 +00:00
parent c2b139d5a0
commit 04ee2d87fc
5 changed files with 16 additions and 2 deletions

View File

@ -210,8 +210,8 @@ static bool doInsertInset(Cursor & cur, Text * text,
if (gotsel && pastesel) { if (gotsel && pastesel) {
lyx::dispatch(FuncRequest(LFUN_PASTE, "0")); lyx::dispatch(FuncRequest(LFUN_PASTE, "0"));
InsetLayout il = inset->getLayout(cur.buffer().params()); if (!static_cast<InsetText *>(inset)->allowMultiPar()
if (!il.multipar || cur.lastpit() == 0) { || cur.lastpit() == 0) {
// reset first par to default // reset first par to default
LayoutPtr const layout = LayoutPtr const layout =
cur.buffer().params().getTextClass().defaultLayout(); cur.buffer().params().getTextClass().defaultLayout();

View File

@ -14,6 +14,7 @@
#include "InsetBox.h" #include "InsetBox.h"
#include "Buffer.h"
#include "BufferView.h" #include "BufferView.h"
#include "Cursor.h" #include "Cursor.h"
#include "DispatchResult.h" #include "DispatchResult.h"
@ -94,6 +95,7 @@ void InsetBox::init()
InsetBox::InsetBox(BufferParams const & bp, string const & label) InsetBox::InsetBox(BufferParams const & bp, string const & label)
: InsetCollapsable(bp), params_(label) : InsetCollapsable(bp), params_(label)
{ {
setLayout(bp);
init(); init();
} }
@ -134,6 +136,7 @@ void InsetBox::read(Buffer const & buf, Lexer & lex)
{ {
params_.read(lex); params_.read(lex);
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
setLayout(buf.params());
setButtonLabel(); setButtonLabel();
} }
@ -203,6 +206,7 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_INSET_MODIFY: { case LFUN_INSET_MODIFY: {
//lyxerr << "InsetBox::dispatch MODIFY" << endl; //lyxerr << "InsetBox::dispatch MODIFY" << endl;
InsetBoxMailer::string2params(to_utf8(cmd.argument()), params_); InsetBoxMailer::string2params(to_utf8(cmd.argument()), params_);
setLayout(cur.buffer().params());
setButtonLabel(); setButtonLabel();
break; break;
} }

View File

@ -546,6 +546,12 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
} }
bool InsetCollapsable::allowMultiPar() const
{
return layout_.multipar;
}
bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd, bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const FuncStatus & flag) const
{ {

View File

@ -122,6 +122,8 @@ public:
/// ///
bool allowSpellCheck() const { return true; } bool allowSpellCheck() const { return true; }
/// ///
bool allowMultiPar() const;
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
/// ///
void setStatus(Cursor & cur, CollapseStatus st); void setStatus(Cursor & cur, CollapseStatus st);

View File

@ -130,6 +130,8 @@ public:
/// should paragraph indendation be ommitted in any case? /// should paragraph indendation be ommitted in any case?
bool neverIndent(Buffer const &) const; bool neverIndent(Buffer const &) const;
/// ///
virtual bool allowMultiPar() const { return true; }
///
InsetText(InsetText const &); InsetText(InsetText const &);
// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents