Cleanup handling of LFUN_LAYOUT_PARAGRAPH in getStatus

The way it works is:
* the inset defines allowParagraphCustomization() correctly
* Text::getStatus acts on it.

Note that, in Text::getStatus, testing for cur.inset().allowParagraphCustomization() does not make much sense, since one should pass the cursor idx as parameter. Actually, for some reason the safest bet is to use the owner of the Text object as inset.
This commit is contained in:
Jean-Marc Lasgouttes 2016-05-12 17:31:47 +02:00 committed by Richard Heck
parent 0d21dca360
commit ccc8ad4744
4 changed files with 3 additions and 6 deletions

View File

@ -3145,7 +3145,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_PARAGRAPH_PARAMS: case LFUN_PARAGRAPH_PARAMS:
case LFUN_PARAGRAPH_PARAMS_APPLY: case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_UPDATE: case LFUN_PARAGRAPH_UPDATE:
enable = cur.inset().allowParagraphCustomization(); enable = owner_->allowParagraphCustomization();
break; break;
// FIXME: why are accent lfuns forbidden with pass_thru layouts? // FIXME: why are accent lfuns forbidden with pass_thru layouts?

View File

@ -263,7 +263,6 @@ bool InsetScript::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const FuncStatus & flag) const
{ {
switch (cmd.action()) { switch (cmd.action()) {
case LFUN_LAYOUT_PARAGRAPH:
case LFUN_MATH_DISPLAY: case LFUN_MATH_DISPLAY:
case LFUN_BOX_INSERT: case LFUN_BOX_INSERT:
case LFUN_BRANCH_INSERT: case LFUN_BRANCH_INSERT:

View File

@ -82,6 +82,8 @@ public:
/// ///
bool forcePlainLayout(idx_type = 0) const { return true; } bool forcePlainLayout(idx_type = 0) const { return true; }
/// ///
bool allowParagraphCustomization(idx_type = 0) const { return false; }
///
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
/// ///
int plaintext(odocstringstream & ods, OutputParams const & op, int plaintext(odocstringstream & ods, OutputParams const & op,

View File

@ -3413,10 +3413,6 @@ bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
{ {
bool enabled = true; bool enabled = true;
switch (cmd.action()) { switch (cmd.action()) {
case LFUN_LAYOUT_PARAGRAPH:
enabled = allowParagraphCustomization();
break;
case LFUN_MATH_DISPLAY: case LFUN_MATH_DISPLAY:
if (!hasFixedWidth()) { if (!hasFixedWidth()) {
enabled = false; enabled = false;