From 04ee2d87fce8a5b61e4625e5c09478ba3f6dc07e Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Thu, 11 Oct 2007 10:13:45 +0000 Subject: [PATCH] Introduce allowMultiPar() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20898 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text3.cpp | 4 ++-- src/insets/InsetBox.cpp | 4 ++++ src/insets/InsetCollapsable.cpp | 6 ++++++ src/insets/InsetCollapsable.h | 2 ++ src/insets/InsetText.h | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index 1f090369ec..d9d5b8f70b 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -210,8 +210,8 @@ static bool doInsertInset(Cursor & cur, Text * text, if (gotsel && pastesel) { lyx::dispatch(FuncRequest(LFUN_PASTE, "0")); - InsetLayout il = inset->getLayout(cur.buffer().params()); - if (!il.multipar || cur.lastpit() == 0) { + if (!static_cast(inset)->allowMultiPar() + || cur.lastpit() == 0) { // reset first par to default LayoutPtr const layout = cur.buffer().params().getTextClass().defaultLayout(); diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 2b10cd663d..8939f0eacd 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -14,6 +14,7 @@ #include "InsetBox.h" +#include "Buffer.h" #include "BufferView.h" #include "Cursor.h" #include "DispatchResult.h" @@ -94,6 +95,7 @@ void InsetBox::init() InsetBox::InsetBox(BufferParams const & bp, string const & label) : InsetCollapsable(bp), params_(label) { + setLayout(bp); init(); } @@ -134,6 +136,7 @@ void InsetBox::read(Buffer const & buf, Lexer & lex) { params_.read(lex); InsetCollapsable::read(buf, lex); + setLayout(buf.params()); setButtonLabel(); } @@ -203,6 +206,7 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { //lyxerr << "InsetBox::dispatch MODIFY" << endl; InsetBoxMailer::string2params(to_utf8(cmd.argument()), params_); + setLayout(cur.buffer().params()); setButtonLabel(); break; } diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 654979df7f..4159ff36a7 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -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, FuncStatus & flag) const { diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index a100950945..71264ade2b 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -122,6 +122,8 @@ public: /// bool allowSpellCheck() const { return true; } /// + bool allowMultiPar() const; + /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// void setStatus(Cursor & cur, CollapseStatus st); diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index 673faf6a1b..7fced9b357 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -130,6 +130,8 @@ public: /// should paragraph indendation be ommitted in any case? bool neverIndent(Buffer const &) const; /// + virtual bool allowMultiPar() const { return true; } + /// InsetText(InsetText const &); // Update the counters of this inset and of its contents -- 2.39.2