Add layout tag that determines if/when a paragraph can be indented.

Fixes: #7327, #7458, #8670
This commit is contained in:
Juergen Spitzmueller 2014-05-29 14:10:32 +02:00
parent 06cee46d7e
commit 20bcaec061
32 changed files with 260 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\lyxformat 476
\begin_document
\begin_header
\textclass scrbook
@ -145,11 +145,12 @@ End
\papercolumns 1
\papersides 2
\paperpagestyle headings
\tracking_changes false
\tracking_changes true
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict true
\author -712698321 "Jürgen Spitzmüller"
\end_header
\begin_body
@ -5850,6 +5851,10 @@ latex foiltex.ins
\begin_layout Enumerate
Now you need to decide if the package should be available for all users
or only for you.
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -6144,6 +6149,10 @@ latex
\begin_layout Enumerate
Now one only need to tell LaTeX that there are new files.
This depends on the used LaTeX-Distribution:
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -10495,6 +10504,10 @@ EndArgument
.
So a command with two optional arguments has:
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -12553,6 +12566,10 @@ Itemize, Bibliography
\end_inset
]
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -12973,6 +12990,10 @@ LatexType
\end_inset
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -13430,6 +13451,10 @@ Static
\end_inset
The kind of margin that the style has on the left side.
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -14504,6 +14529,128 @@ int=3
\series default
The level of the style in the table of contents.
This is used for automatic numbering of section headings.
\change_inserted -712698321 1401363541
\end_layout
\begin_layout Description
\change_inserted -712698321 1401363906
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1401363547
ToggleIndent
\end_layout
\end_inset
[
\emph on
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1401363664
\emph on
default
\change_unchanged
\end_layout
\end_inset
\emph default
,
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1401363669
always
\change_unchanged
\end_layout
\end_inset
,
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1401363675
never
\change_unchanged
\end_layout
\end_inset
] This tag determines whether the first line indentation of this paragraph
can be toggled via the Paragraph settings dialog.
If
\emph on
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1401363761
\emph off
default
\end_layout
\end_inset
\emph default
is set, indentation can be toggled if the document settings use
\begin_inset Quotes eld
\end_inset
indent
\begin_inset Quotes erd
\end_inset
paragraph style, with
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1401363844
always
\end_layout
\end_inset
, indentation can always be toggled, notwithstanding the document settings,
with
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1401363901
never
\end_layout
\end_inset
, indentation can never be toggled.
\change_unchanged
\end_layout
\begin_layout Description
@ -14602,6 +14749,10 @@ theorems-ams.inc
\begin_layout LyX-Code
Preamble
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -17314,6 +17465,10 @@ LatexType
\end_inset
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper
@ -18249,6 +18404,10 @@ LabelStringAppendix
to the same value.
The following special constructs can be used in the string:
\begin_inset Separator parbreak
\end_inset
\end_layout
\begin_deeper

View File

@ -345,6 +345,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -405,6 +405,7 @@ Style References
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -210,6 +210,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -202,6 +202,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -357,6 +357,7 @@ Style Itemize
LatexType Item_Environment
LatexName APAitemize
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -379,6 +380,7 @@ Style Enumerate
LatexType Item_Environment
LatexName APAenumerate
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ParSkip 0.0

View File

@ -457,6 +457,7 @@ Style Itemize
LatexType Item_Environment
LatexName APAitemize
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -480,6 +481,7 @@ Style Enumerate
LatexType Item_Environment
LatexName APAenumerate
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ParSkip 0.0

View File

@ -100,6 +100,7 @@ Style Itemize
RightDelim >
EndArgument
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -137,6 +138,7 @@ Style Enumerate
RightDelim >
EndArgument
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ParSkip 0.0
@ -209,6 +211,7 @@ Style Part
EndArgument
NeedProtect 1
NextNoIndent 1
ToggleIndent Never
Labelsep xx
ParSkip 0.4
TopSep 4
@ -236,6 +239,7 @@ Style Section
LatexName section
NeedProtect 1
NextNoIndent 1
ToggleIndent Never
LabelSep xx
ParSkip 0.4
TopSep 2
@ -293,6 +297,7 @@ Style Subsection
LatexName subsection
NeedProtect 1
NextNoIndent 1
ToggleIndent Never
LabelSep xx
ParSkip 0.4
TopSep 2
@ -350,6 +355,7 @@ Style Subsubsection
LatexName subsubsection
NeedProtect 1
NextNoIndent 1
ToggleIndent Never
LabelSep xx
ParSkip 0.4
TopSep 2
@ -596,6 +602,7 @@ Style Column
LabelType Static
LabelSep xx
LabelString "Start column (increase depth!), width:"
ToggleIndent Never
Argument 1
MenuString "Column Options"
LabelString "Options"
@ -1048,6 +1055,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0
@ -1075,6 +1083,7 @@ Style Quotation
LatexType Environment
LatexName quotation
NextNoIndent 1
ToggleIndent Always
LeftMargin MMM
RightMargin MMM
ParIndent MM
@ -1100,6 +1109,7 @@ Style Quote
LatexType Environment
LatexName quote
NextNoIndent 1
ToggleIndent Never
LeftMargin MMM
RightMargin MMM
TopSep 0.5

View File

@ -109,6 +109,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -104,6 +104,7 @@ Style Quotation
LatexType Environment
LatexName quotation
NextNoIndent 1
ToggleIndent Always
LeftMargin MMM
RightMargin MMM
ParIndent MM
@ -122,6 +123,7 @@ Style Quote
LatexType Environment
LatexName quote
NextNoIndent 1
ToggleIndent Never
LeftMargin MMM
RightMargin MMM
TopSep 0.5
@ -180,6 +182,7 @@ Style Itemize
LatexType Item_Environment
LatexName itemize
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -201,6 +204,7 @@ Style Description
LatexType Item_environment
LatexName description
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
LabelSep xxx
ParSkip 0.4
@ -576,6 +580,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0
@ -586,7 +591,7 @@ Style Bibliography
AlignPossible Block, Left
LabelType Bibliography
LabelString "References"
LabelBottomSep 0.7
LabelBottomSep 0.7
LabelFont
Series Bold
EndFont

View File

@ -310,6 +310,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -286,6 +286,7 @@ Style ItemList
LatexType Item_Environment
LatexName itemlist
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -449,6 +450,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -289,6 +289,7 @@ Style ItemList
LatexType Item_Environment
LatexName itemlist
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -462,6 +463,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -269,6 +269,7 @@ Style "Bibliography (plain)"
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -272,6 +272,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -349,6 +349,7 @@ Style References
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -272,6 +272,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0
@ -282,7 +283,7 @@ Style Bibliography
AlignPossible Block, Left
LabelType Bibliography
LabelString "References"
LabelBottomSep 0.7
LabelBottomSep 0.7
LabelFont
Series Bold
EndFont

View File

@ -465,6 +465,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -257,6 +257,7 @@ Style Itemize
LatexType Item_Environment
LatexName itemize
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -305,6 +306,7 @@ Style Enumerate
LatexType Item_Environment
LatexName enumerate
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ParSkip 0.0
@ -356,6 +358,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0
@ -378,6 +381,7 @@ Style Quotation
LatexType Environment
LatexName quotation
NextNoIndent 1
ToggleIndent Always
LeftMargin MMM
RightMargin MMM
ParIndent MM
@ -399,6 +403,7 @@ Style Quote
LatexType Environment
LatexName quote
NextNoIndent 1
ToggleIndent Never
LeftMargin MMM
RightMargin MMM
TopSep 0.5

View File

@ -328,6 +328,7 @@ Style Bibliography
LatexType Bib_Environment
LatexName thebibliography
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -89,6 +89,7 @@ Style Itemize
LatexType Item_Environment
LatexName itemize
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -157,6 +158,7 @@ Style Bibliography
LatexType Bib_Environment
LabelType Bibliography
LabelBottomSep 0.7
ToggleIndent Never
LabelFont
Size Tiny
EndFont

View File

@ -15,6 +15,7 @@ Style Quotation
LatexType Environment
LatexName quotation
NextNoIndent 1
ToggleIndent Always
LeftMargin MMM
RightMargin MMM
ParIndent MM
@ -36,6 +37,7 @@ Style Quote
LatexType Environment
LatexName quote
NextNoIndent 1
ToggleIndent Never
LeftMargin MMM
RightMargin MMM
TopSep 0.5

View File

@ -16,6 +16,7 @@ Style Itemize
LatexType Item_Environment
LatexName itemize
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ItemSep 0.2
@ -41,6 +42,7 @@ Style Enumerate
LatexType Item_Environment
LatexName enumerate
NextNoIndent 1
ToggleIndent Never
LeftMargin MMN
LabelSep xx
ParSkip 0.0

View File

@ -20,6 +20,7 @@ Style Part
LatexName part
NeedProtect 1
NextNoIndent 1
ToggleIndent Never
Labelsep xxx
ParSkip 0.4
TopSep 4
@ -51,6 +52,7 @@ Style Chapter
LatexName chapter
NeedProtect 1
NextNoIndent 1
ToggleIndent Never
ParSkip 0.4
TopSep 4
BottomSep 0.8
@ -78,6 +80,7 @@ Style Section
LatexName section
NeedProtect 1
NextNoIndent 1
ToggleIndent Never
LabelSep xxx
ParSkip 0.4
TopSep 1.3

View File

@ -15,6 +15,7 @@ Style Abstract
LatexName abstract
Category FrontMatter
NextNoIndent 1
ToggleIndent Always
LeftMargin MMM
RightMargin MMM
ParIndent MM
@ -56,6 +57,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -577,6 +577,7 @@ Style Bibliography
LatexName thebibliography
Category BackMatter
NextNoIndent 1
ToggleIndent Never
LeftMargin MM
ParSkip 0.4
ItemSep 0

View File

@ -168,6 +168,9 @@ import os, re, string, sys
# Incremented to format 50, 9 May 2014 by forenr
# Removal of "Separator" layouts
# Incremented to format 51, 29 May 2014 by spitz
# New Style tag "ToggleIndent"
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
@ -399,6 +402,11 @@ def convert(lines):
i += 1
continue
if format == 50:
# nothing to do.
i += 1
continue
if format == 49:
separator = []

View File

@ -105,6 +105,7 @@ enum LayoutTags {
LT_RESETARGS,
LT_RIGHTDELIM,
LT_FORCELOCAL,
LT_TOGGLE_INDENT,
LT_INTITLE // keep this last!
};
@ -148,6 +149,7 @@ Layout::Layout()
spellcheck = true;
forcelocal = 0;
itemcommand_ = "item";
toggle_indent = ITOGGLE_DOCUMENT_DEFAULT;
}
@ -243,6 +245,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
{ "spellcheck", LT_SPELLCHECK },
{ "textfont", LT_TEXTFONT },
{ "toclevel", LT_TOCLEVEL },
{ "toggleindent", LT_TOGGLE_INDENT },
{ "topsep", LT_TOPSEP }
};
@ -383,6 +386,19 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> nextnoindent;
break;
case LT_TOGGLE_INDENT: {
string tog;
lex >> tog;
tog = support::ascii_lowercase(tog);
if (tog == "always")
toggle_indent = ITOGGLE_ALWAYS;
else if (tog == "never")
toggle_indent = ITOGGLE_NEVER;
else
toggle_indent = ITOGGLE_DOCUMENT_DEFAULT;
break;
}
case LT_COMMANDDEPTH:
lex >> commanddepth;
break;

View File

@ -280,6 +280,8 @@ public:
///
bool nextnoindent;
///
ToggleIndentation toggle_indent;
///
bool free_spacing;
///
bool pass_thru;

View File

@ -64,6 +64,17 @@ enum LyXAlignment {
LYX_ALIGN_DECIMAL = 64
};
/// Paragraph indendation control
enum ToggleIndentation {
/// Indentation can be toggled if document uses "indent" paragraph style
ITOGGLE_DOCUMENT_DEFAULT = 1,
/// Indentation cannot be toggled
ITOGGLE_NEVER,
/// Indentation can always be toggled
ITOGGLE_ALWAYS
};
///
inline void operator|=(LyXAlignment & la1, LyXAlignment la2)
{

View File

@ -2237,7 +2237,8 @@ int Paragraph::Private::startTeXParParams(BufferParams const & bparams,
{
int column = 0;
if (params_.noindent() && !layout_->pass_thru) {
if (params_.noindent() && !layout_->pass_thru
&& (layout_->toggle_indent != ITOGGLE_NEVER)) {
os << "\\noindent ";
column += 10;
}

View File

@ -227,7 +227,7 @@ void GuiParagraph::applyView()
// label width
params_.labelWidthString(qstring_to_ucs4(labelWidth->text()));
// indendation
// indentation
params_.noindent(!indentCB->isChecked());
dispatchParams();
@ -336,8 +336,11 @@ bool GuiParagraph::haveMultiParSelection() const
bool GuiParagraph::canIndent() const
{
return buffer().params().paragraph_separation
== BufferParams::ParagraphIndentSeparation;
Layout const lay = bufferview()->cursor().innerParagraph().layout();
if (buffer().params().paragraph_separation
== BufferParams::ParagraphIndentSeparation)
return (lay.toggle_indent != ITOGGLE_NEVER);
return (lay.toggle_indent == ITOGGLE_ALWAYS);
}