Update lyx examples to latest file format (for 1.5.0 release)
[lyx.git] / src / Layout.cpp
blob96acc0e087592e545ece7cd4f6b642fa4c89bf31
1 /**
2 * \file Layout.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author André Pönitz
10 * Full author contact details are available in file CREDITS.
13 #include <config.h>
15 #include "Layout.h"
16 #include "TextClass.h"
17 #include "Lexer.h"
18 #include "debug.h"
20 #include "support/lstrings.h"
23 namespace lyx {
25 using support::subst;
26 using support::trim;
28 using std::endl;
29 using std::string;
31 /// Special value of toclevel for layouts that to not belong in a TOC
32 const int Layout::NOT_IN_TOC = -1000;
34 // The order of the LayoutTags enum is no more important. [asierra300396]
35 // Tags indexes.
36 enum LayoutTags {
37 LT_ALIGN = 1,
38 LT_ALIGNPOSSIBLE,
39 LT_MARGIN,
40 LT_BOTTOMSEP,
41 LT_COMMANDDEPTH,
42 LT_COPYSTYLE,
43 LT_DEPENDSON,
44 LT_OBSOLETEDBY,
45 //LT_EMPTY,
46 LT_END,
47 //LT_ENVIRONMENT_DEFAULT,
48 //LT_FANCYHDR,
49 LT_FILL_BOTTOM,
50 LT_FILL_TOP,
51 //LT_FIRST_COUNTER,
52 LT_FONT,
53 LT_FREE_SPACING,
54 LT_PASS_THRU,
55 //LT_HEADINGS,
56 LT_ITEMSEP,
57 LT_KEEPEMPTY,
58 LT_LABEL_BOTTOMSEP,
59 LT_LABELFONT,
60 LT_TEXTFONT,
61 LT_LABELINDENT,
62 LT_LABELSEP,
63 LT_LABELSTRING,
64 LT_LABELSTRING_APPENDIX,
65 LT_LABELCOUNTER,
66 LT_LABELTYPE,
67 LT_ENDLABELSTRING,
68 LT_ENDLABELTYPE,
69 LT_LATEXNAME,
70 LT_LATEXPARAM,
71 LT_OPTARGS,
72 LT_LATEXTYPE,
73 LT_LATEXHEADER,
74 LT_LATEXFOOTER,
75 LT_LATEXPARAGRAPH,
76 LT_LEFTMARGIN,
77 LT_NEED_PROTECT,
78 LT_NEWLINE,
79 LT_NEXTNOINDENT,
80 LT_PARINDENT,
81 LT_PARSEP,
82 LT_PARSKIP,
83 //LT_PLAIN,
84 LT_PREAMBLE,
85 LT_RIGHTMARGIN,
86 LT_SPACING,
87 LT_TOPSEP,
88 LT_TOCLEVEL,
89 LT_INNERTAG,
90 LT_LABELTAG,
91 LT_ITEMTAG,
92 LT_INTITLE // keep this last!
95 /////////////////////
97 // Constructor for layout
98 Layout::Layout ()
100 margintype = MARGIN_STATIC;
101 latextype = LATEX_PARAGRAPH;
102 intitle = false;
103 optionalargs = 0;
104 needprotect = false;
105 keepempty = false;
106 font = Font(Font::ALL_INHERIT);
107 labelfont = Font(Font::ALL_INHERIT);
108 resfont = Font(Font::ALL_SANE);
109 reslabelfont = Font(Font::ALL_SANE);
110 nextnoindent = false;
111 parskip = 0.0;
112 itemsep = 0;
113 topsep = 0.0;
114 bottomsep = 0.0;
115 labelbottomsep = 0.0;
116 parsep = 0;
117 align = LYX_ALIGN_BLOCK;
118 alignpossible = LYX_ALIGN_BLOCK;
119 labeltype = LABEL_NO_LABEL;
120 endlabeltype = END_LABEL_NO_LABEL;
121 // Should or should not. That is the question.
122 // spacing.set(Spacing::OneHalf);
123 fill_top = false;
124 fill_bottom = false;
125 newline_allowed = true;
126 free_spacing = false;
127 pass_thru = false;
128 is_environment = false;
129 toclevel = NOT_IN_TOC;
130 commanddepth = 0;
134 // Reads a layout definition from file
135 bool Layout::read(Lexer & lexrc, TextClass const & tclass)
137 // This table is sorted alphabetically [asierra 30March96]
138 keyword_item layoutTags[] = {
139 { "align", LT_ALIGN },
140 { "alignpossible", LT_ALIGNPOSSIBLE },
141 { "bottomsep", LT_BOTTOMSEP },
142 { "commanddepth", LT_COMMANDDEPTH },
143 { "copystyle", LT_COPYSTYLE },
144 { "dependson", LT_DEPENDSON },
145 { "end", LT_END },
146 { "endlabelstring", LT_ENDLABELSTRING },
147 { "endlabeltype", LT_ENDLABELTYPE },
148 { "fill_bottom", LT_FILL_BOTTOM },
149 { "fill_top", LT_FILL_TOP },
150 { "font", LT_FONT },
151 { "freespacing", LT_FREE_SPACING },
152 { "innertag", LT_INNERTAG },
153 { "intitle", LT_INTITLE },
154 { "itemsep", LT_ITEMSEP },
155 { "itemtag", LT_ITEMTAG },
156 { "keepempty", LT_KEEPEMPTY },
157 { "labelbottomsep", LT_LABEL_BOTTOMSEP },
158 { "labelcounter", LT_LABELCOUNTER },
159 { "labelfont", LT_LABELFONT },
160 { "labelindent", LT_LABELINDENT },
161 { "labelsep", LT_LABELSEP },
162 { "labelstring", LT_LABELSTRING },
163 { "labelstringappendix", LT_LABELSTRING_APPENDIX },
164 { "labeltag", LT_LABELTAG },
165 { "labeltype", LT_LABELTYPE },
166 { "latexfooter", LT_LATEXFOOTER },
167 { "latexheader", LT_LATEXHEADER },
168 { "latexname", LT_LATEXNAME },
169 { "latexparagraph", LT_LATEXPARAGRAPH },
170 { "latexparam", LT_LATEXPARAM },
171 { "latextype", LT_LATEXTYPE },
172 { "leftmargin", LT_LEFTMARGIN },
173 { "margin", LT_MARGIN },
174 { "needprotect", LT_NEED_PROTECT },
175 { "newline", LT_NEWLINE },
176 { "nextnoindent", LT_NEXTNOINDENT },
177 { "obsoletedby", LT_OBSOLETEDBY },
178 { "optionalargs", LT_OPTARGS },
179 { "parindent", LT_PARINDENT },
180 { "parsep", LT_PARSEP },
181 { "parskip", LT_PARSKIP },
182 { "passthru", LT_PASS_THRU },
183 { "preamble", LT_PREAMBLE },
184 { "rightmargin", LT_RIGHTMARGIN },
185 { "spacing", LT_SPACING },
186 { "textfont", LT_TEXTFONT },
187 { "toclevel", LT_TOCLEVEL },
188 { "topsep", LT_TOPSEP }
191 bool error = false;
192 bool finished = false;
193 lexrc.pushTable(layoutTags, LT_INTITLE);
194 // parse style section
195 while (!finished && lexrc.isOK() && !error) {
196 int le = lexrc.lex();
197 // See comment in LyXRC.cpp.
198 switch (le) {
199 case Lexer::LEX_FEOF:
200 continue;
202 case Lexer::LEX_UNDEF: // parse error
203 lexrc.printError("Unknown layout tag `$$Token'");
204 error = true;
205 continue;
206 default: break;
208 switch (static_cast<LayoutTags>(le)) {
209 case LT_END: // end of structure
210 finished = true;
211 break;
213 case LT_COPYSTYLE: // initialize with a known style
214 if (lexrc.next()) {
215 docstring const style = subst(lexrc.getDocString(),
216 '_', ' ');
218 if (tclass.hasLayout(style)) {
219 docstring const tmpname = name_;
220 this->operator=(*tclass[style]);
221 name_ = tmpname;
222 } else {
223 lyxerr << "Cannot copy unknown style `"
224 << to_utf8(style) << "'\n"
225 << "All layouts so far:"
226 << endl;
227 TextClass::const_iterator it =
228 tclass.begin();
229 TextClass::const_iterator end =
230 tclass.end();
231 for (; it != end; ++it) {
232 lyxerr << to_utf8((*it)->name())
233 << endl;
236 //lexrc.printError("Cannot copy known "
237 // "style `$$Token'");
240 break;
242 case LT_OBSOLETEDBY: // replace with a known style
243 if (lexrc.next()) {
244 docstring const style =
245 subst(lexrc.getDocString(), '_', ' ');
247 if (tclass.hasLayout(style)) {
248 docstring const tmpname = name_;
249 this->operator=(*tclass[style]);
250 name_ = tmpname;
251 if (obsoleted_by().empty())
252 obsoleted_by_ = style;
253 } else {
254 lyxerr << "Cannot replace with unknown style `"
255 << to_utf8(style) << '\'' << endl;
257 //lexrc.printError("Cannot replace with"
258 // " unknown style "
259 // "`$$Token'");
262 break;
264 case LT_DEPENDSON:
265 if (lexrc.next())
266 depends_on_ = subst(lexrc.getDocString(), '_', ' ');
267 break;
269 case LT_MARGIN: // margin style definition.
270 readMargin(lexrc);
271 break;
273 case LT_LATEXTYPE: // LaTeX style definition.
274 readLatexType(lexrc);
275 break;
277 case LT_LATEXHEADER: // header for environments
278 lexrc.next();
279 latexheader = lexrc.getString();
280 break;
282 case LT_LATEXFOOTER: // footer for environments
283 lexrc.next();
284 latexfooter = lexrc.getString();
285 break;
287 case LT_LATEXPARAGRAPH:
288 lexrc.next();
289 latexparagraph = lexrc.getString();
290 break;
292 case LT_INTITLE:
293 intitle = lexrc.next() && lexrc.getInteger();
294 break;
296 case LT_TOCLEVEL:
297 lexrc.next();
298 toclevel = lexrc.getInteger();
299 break;
301 case LT_OPTARGS:
302 if (lexrc.next())
303 optionalargs = lexrc.getInteger();
304 break;
306 case LT_NEED_PROTECT:
307 needprotect = lexrc.next() && lexrc.getInteger();
308 break;
310 case LT_KEEPEMPTY:
311 keepempty = lexrc.next() && lexrc.getInteger();
312 break;
314 case LT_FONT:
315 font.lyxRead(lexrc);
316 labelfont= font;
317 break;
319 case LT_TEXTFONT:
320 font.lyxRead(lexrc);
321 break;
323 case LT_LABELFONT:
324 labelfont.lyxRead(lexrc);
325 break;
327 case LT_NEXTNOINDENT: // Indent next paragraph?
328 if (lexrc.next() && lexrc.getInteger())
329 nextnoindent = true;
330 else
331 nextnoindent = false;
332 break;
334 case LT_COMMANDDEPTH:
335 lexrc.next();
336 commanddepth = lexrc.getInteger();
337 break;
339 case LT_LATEXNAME:
340 if (lexrc.next())
341 latexname_ = lexrc.getString();
342 break;
344 case LT_LATEXPARAM:
345 if (lexrc.next())
346 latexparam_ = subst(lexrc.getString(), "&quot;", "\"");
347 break;
349 case LT_INNERTAG:
350 if (lexrc.next())
351 innertag_ = lexrc.getString();
352 break;
354 case LT_LABELTAG:
355 if (lexrc.next())
356 labeltag_ = lexrc.getString();
357 break;
359 case LT_ITEMTAG:
360 if (lexrc.next())
361 itemtag_ = lexrc.getString();
362 break;
364 case LT_PREAMBLE:
365 preamble_ = from_utf8(lexrc.getLongString("EndPreamble"));
366 break;
368 case LT_LABELTYPE:
369 readLabelType(lexrc);
370 break;
372 case LT_ENDLABELTYPE:
373 readEndLabelType(lexrc);
374 break;
376 case LT_LEFTMARGIN: // left margin type
377 if (lexrc.next())
378 leftmargin = lexrc.getString();
379 break;
381 case LT_RIGHTMARGIN: // right margin type
382 if (lexrc.next())
383 rightmargin = lexrc.getString();
384 break;
386 case LT_LABELINDENT: // label indenting flag
387 if (lexrc.next())
388 labelindent = lexrc.getString();
389 break;
391 case LT_PARINDENT: // paragraph indent. flag
392 if (lexrc.next())
393 parindent = lexrc.getString();
394 break;
396 case LT_PARSKIP: // paragraph skip size
397 if (lexrc.next())
398 parskip = lexrc.getFloat();
399 break;
401 case LT_ITEMSEP: // item separation size
402 if (lexrc.next())
403 itemsep = lexrc.getFloat();
404 break;
406 case LT_TOPSEP: // top separation size
407 if (lexrc.next())
408 topsep = lexrc.getFloat();
409 break;
411 case LT_BOTTOMSEP: // bottom separation size
412 if (lexrc.next())
413 bottomsep = lexrc.getFloat();
414 break;
416 case LT_LABEL_BOTTOMSEP: // label bottom separation size
417 if (lexrc.next())
418 labelbottomsep = lexrc.getFloat();
419 break;
421 case LT_LABELSEP: // label separator
422 if (lexrc.next()) {
423 labelsep = subst(lexrc.getString(), 'x', ' ');
425 break;
427 case LT_PARSEP: // par. separation size
428 if (lexrc.next())
429 parsep = lexrc.getFloat();
430 break;
432 case LT_FILL_TOP: // fill top flag
433 if (lexrc.next())
434 fill_top = lexrc.getInteger();
435 break;
437 case LT_FILL_BOTTOM: // fill bottom flag
438 if (lexrc.next())
439 fill_bottom = lexrc.getInteger();
440 break;
442 case LT_NEWLINE: // newlines allowed?
443 if (lexrc.next())
444 newline_allowed = lexrc.getInteger();
445 break;
447 case LT_ALIGN: // paragraph align
448 readAlign(lexrc);
449 break;
450 case LT_ALIGNPOSSIBLE: // paragraph allowed align
451 readAlignPossible(lexrc);
452 break;
454 case LT_LABELSTRING: // label string definition
455 if (lexrc.next()) {
456 labelstring_ = trim(lexrc.getDocString());
457 labelstring_appendix_ = labelstring_;
459 break;
461 case LT_ENDLABELSTRING: // endlabel string definition
462 if (lexrc.next())
463 endlabelstring_ = trim(lexrc.getDocString());
464 break;
466 case LT_LABELSTRING_APPENDIX: // label string appendix definition
467 if (lexrc.next())
468 labelstring_appendix_ = trim(lexrc.getDocString());
469 break;
471 case LT_LABELCOUNTER: // name of counter to use
472 if (lexrc.next())
473 counter = lyx::from_ascii(trim(lexrc.getString()));
474 break;
476 case LT_FREE_SPACING: // Allow for free spacing.
477 if (lexrc.next())
478 free_spacing = lexrc.getInteger();
479 break;
481 case LT_PASS_THRU: // Allow for pass thru.
482 if (lexrc.next())
483 pass_thru = lexrc.getInteger();
484 break;
486 case LT_SPACING: // setspace.sty
487 readSpacing(lexrc);
488 break;
491 lexrc.popTable();
493 return error;
497 enum AlignTags {
498 AT_BLOCK = 1,
499 AT_LEFT,
500 AT_RIGHT,
501 AT_CENTER,
502 AT_LAYOUT
506 void Layout::readAlign(Lexer & lexrc)
508 keyword_item alignTags[] = {
509 { "block", AT_BLOCK },
510 { "center", AT_CENTER },
511 { "layout", AT_LAYOUT },
512 { "left", AT_LEFT },
513 { "right", AT_RIGHT }
516 PushPopHelper pph(lexrc, alignTags, AT_LAYOUT);
517 int le = lexrc.lex();
518 switch (le) {
519 case Lexer::LEX_UNDEF:
520 lexrc.printError("Unknown alignment `$$Token'");
521 return;
522 default: break;
524 switch (static_cast<AlignTags>(le)) {
525 case AT_BLOCK:
526 align = LYX_ALIGN_BLOCK;
527 break;
528 case AT_LEFT:
529 align = LYX_ALIGN_LEFT;
530 break;
531 case AT_RIGHT:
532 align = LYX_ALIGN_RIGHT;
533 break;
534 case AT_CENTER:
535 align = LYX_ALIGN_CENTER;
536 break;
537 case AT_LAYOUT:
538 align = LYX_ALIGN_LAYOUT;
539 break;
544 void Layout::readAlignPossible(Lexer & lexrc)
546 keyword_item alignTags[] = {
547 { "block", AT_BLOCK },
548 { "center", AT_CENTER },
549 { "layout", AT_LAYOUT },
550 { "left", AT_LEFT },
551 { "right", AT_RIGHT }
554 lexrc.pushTable(alignTags, AT_LAYOUT);
555 alignpossible = LYX_ALIGN_NONE;
556 int lineno = lexrc.getLineNo();
557 do {
558 int le = lexrc.lex();
559 switch (le) {
560 case Lexer::LEX_UNDEF:
561 lexrc.printError("Unknown alignment `$$Token'");
562 continue;
563 default: break;
565 switch (static_cast<AlignTags>(le)) {
566 case AT_BLOCK:
567 alignpossible |= LYX_ALIGN_BLOCK;
568 break;
569 case AT_LEFT:
570 alignpossible |= LYX_ALIGN_LEFT;
571 break;
572 case AT_RIGHT:
573 alignpossible |= LYX_ALIGN_RIGHT;
574 break;
575 case AT_CENTER:
576 alignpossible |= LYX_ALIGN_CENTER;
577 break;
578 case AT_LAYOUT:
579 alignpossible |= LYX_ALIGN_LAYOUT;
580 break;
582 } while (lineno == lexrc.getLineNo());
583 lexrc.popTable();
587 enum LabelTypeTags {
588 LA_NO_LABEL = 1,
589 LA_MANUAL,
590 LA_TOP_ENVIRONMENT,
591 LA_CENTERED_TOP_ENVIRONMENT,
592 LA_STATIC,
593 LA_SENSITIVE,
594 LA_COUNTER,
595 LA_ENUMERATE,
596 LA_ITEMIZE,
597 LA_BIBLIO
601 void Layout::readLabelType(Lexer & lexrc)
603 keyword_item labelTypeTags[] = {
604 { "bibliography", LA_BIBLIO },
605 { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
606 { "counter", LA_COUNTER },
607 { "enumerate", LA_ENUMERATE },
608 { "itemize", LA_ITEMIZE },
609 { "manual", LA_MANUAL },
610 { "no_label", LA_NO_LABEL },
611 { "sensitive", LA_SENSITIVE },
612 { "static", LA_STATIC },
613 { "top_environment", LA_TOP_ENVIRONMENT }
616 PushPopHelper pph(lexrc, labelTypeTags, LA_BIBLIO);
617 int le = lexrc.lex();
618 switch (le) {
619 case Lexer::LEX_UNDEF:
620 lexrc.printError("Unknown labeltype tag `$$Token'");
621 return;
622 default: break;
624 switch (static_cast<LabelTypeTags>(le)) {
625 case LA_NO_LABEL:
626 labeltype = LABEL_NO_LABEL;
627 break;
628 case LA_MANUAL:
629 labeltype = LABEL_MANUAL;
630 break;
631 case LA_TOP_ENVIRONMENT:
632 labeltype = LABEL_TOP_ENVIRONMENT;
633 break;
634 case LA_CENTERED_TOP_ENVIRONMENT:
635 labeltype = LABEL_CENTERED_TOP_ENVIRONMENT;
636 break;
637 case LA_STATIC:
638 labeltype = LABEL_STATIC;
639 break;
640 case LA_SENSITIVE:
641 labeltype = LABEL_SENSITIVE;
642 break;
643 case LA_COUNTER:
644 labeltype = LABEL_COUNTER;
645 break;
646 case LA_ENUMERATE:
647 labeltype = LABEL_ENUMERATE;
648 break;
649 case LA_ITEMIZE:
650 labeltype = LABEL_ITEMIZE;
651 break;
652 case LA_BIBLIO:
653 labeltype = LABEL_BIBLIO;
654 break;
659 namespace {
661 keyword_item endlabelTypeTags[] = {
662 { "box", END_LABEL_BOX },
663 { "filled_box", END_LABEL_FILLED_BOX },
664 { "no_label", END_LABEL_NO_LABEL },
665 { "static", END_LABEL_STATIC }
668 } // namespace anon
671 void Layout::readEndLabelType(Lexer & lexrc)
673 PushPopHelper pph(lexrc, endlabelTypeTags,
674 END_LABEL_ENUM_LAST-END_LABEL_ENUM_FIRST+1);
675 int le = lexrc.lex();
676 switch (le) {
677 case Lexer::LEX_UNDEF:
678 lexrc.printError("Unknown labeltype tag `$$Token'");
679 break;
680 case END_LABEL_STATIC:
681 case END_LABEL_BOX:
682 case END_LABEL_FILLED_BOX:
683 case END_LABEL_NO_LABEL:
684 endlabeltype = static_cast<LYX_END_LABEL_TYPES>(le);
685 break;
686 default:
687 lyxerr << "Unhandled value " << le
688 << " in Layout::readEndLabelType." << endl;
689 break;
694 void Layout::readMargin(Lexer & lexrc)
696 keyword_item marginTags[] = {
697 { "dynamic", MARGIN_DYNAMIC },
698 { "first_dynamic", MARGIN_FIRST_DYNAMIC },
699 { "manual", MARGIN_MANUAL },
700 { "right_address_box", MARGIN_RIGHT_ADDRESS_BOX },
701 { "static", MARGIN_STATIC }
704 PushPopHelper pph(lexrc, marginTags, MARGIN_RIGHT_ADDRESS_BOX);
706 int le = lexrc.lex();
707 switch (le) {
708 case Lexer::LEX_UNDEF:
709 lexrc.printError("Unknown margin type tag `$$Token'");
710 return;
711 case MARGIN_STATIC:
712 case MARGIN_MANUAL:
713 case MARGIN_DYNAMIC:
714 case MARGIN_FIRST_DYNAMIC:
715 case MARGIN_RIGHT_ADDRESS_BOX:
716 margintype = static_cast<LYX_MARGIN_TYPE>(le);
717 break;
718 default:
719 lyxerr << "Unhandled value " << le
720 << " in Layout::readMargin." << endl;
721 break;
726 void Layout::readLatexType(Lexer & lexrc)
728 keyword_item latexTypeTags[] = {
729 { "bib_environment", LATEX_BIB_ENVIRONMENT },
730 { "command", LATEX_COMMAND },
731 { "environment", LATEX_ENVIRONMENT },
732 { "item_environment", LATEX_ITEM_ENVIRONMENT },
733 { "list_environment", LATEX_LIST_ENVIRONMENT },
734 { "paragraph", LATEX_PARAGRAPH }
737 PushPopHelper pph(lexrc, latexTypeTags, LATEX_LIST_ENVIRONMENT);
738 int le = lexrc.lex();
739 switch (le) {
740 case Lexer::LEX_UNDEF:
741 lexrc.printError("Unknown latextype tag `$$Token'");
742 return;
743 case LATEX_PARAGRAPH:
744 case LATEX_COMMAND:
745 case LATEX_ENVIRONMENT:
746 case LATEX_ITEM_ENVIRONMENT:
747 case LATEX_BIB_ENVIRONMENT:
748 case LATEX_LIST_ENVIRONMENT:
749 latextype = static_cast<LYX_LATEX_TYPES>(le);
750 break;
751 default:
752 lyxerr << "Unhandled value " << le
753 << " in Layout::readLatexType." << endl;
754 break;
759 enum SpacingTags {
760 ST_SPACING_SINGLE = 1,
761 ST_SPACING_ONEHALF,
762 ST_SPACING_DOUBLE,
763 ST_OTHER
767 void Layout::readSpacing(Lexer & lexrc)
769 keyword_item spacingTags[] = {
770 {"double", ST_SPACING_DOUBLE },
771 {"onehalf", ST_SPACING_ONEHALF },
772 {"other", ST_OTHER },
773 {"single", ST_SPACING_SINGLE }
776 PushPopHelper pph(lexrc, spacingTags, ST_OTHER);
777 int le = lexrc.lex();
778 switch (le) {
779 case Lexer::LEX_UNDEF:
780 lexrc.printError("Unknown spacing token `$$Token'");
781 return;
782 default: break;
784 switch (static_cast<SpacingTags>(le)) {
785 case ST_SPACING_SINGLE:
786 spacing.set(Spacing::Single);
787 break;
788 case ST_SPACING_ONEHALF:
789 spacing.set(Spacing::Onehalf);
790 break;
791 case ST_SPACING_DOUBLE:
792 spacing.set(Spacing::Double);
793 break;
794 case ST_OTHER:
795 lexrc.next();
796 spacing.set(Spacing::Other, lexrc.getString());
797 break;
802 docstring const & Layout::name() const
804 return name_;
808 void Layout::setName(docstring const & n)
810 name_ = n;
814 docstring const & Layout::obsoleted_by() const
816 return obsoleted_by_;
820 docstring const & Layout::depends_on() const
822 return depends_on_;
826 Layout * Layout::forCaption()
828 Layout * lay = new Layout();
829 lay->name_ = from_ascii("Caption");
830 lay->latexname_ = "caption";
831 lay->latextype = LATEX_COMMAND;
832 lay->optionalargs = 1;
833 return lay;
838 } // namespace lyx