]> git.lyx.org Git - lyx.git/blob - src/paragraph_pimpl.C
* Painter.h:
[lyx.git] / src / paragraph_pimpl.C
1 /**
2  * \file paragraph_pimpl.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Jean-Marc Lasgouttes
8  * \author John Levon
9  * \author André Pönitz
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "paragraph_pimpl.h"
17 #include "paragraph.h"
18
19 #include "bufferparams.h"
20 #include "debug.h"
21 #include "encoding.h"
22 #include "language.h"
23 #include "LaTeXFeatures.h"
24 #include "LColor.h"
25 #include "lyxlength.h"
26 #include "lyxrc.h"
27 #include "outputparams.h"
28 #include "texrow.h"
29
30 #include <boost/next_prior.hpp>
31
32
33 namespace lyx {
34
35 using std::endl;
36 using std::upper_bound;
37 using std::lower_bound;
38 using std::string;
39
40
41 // Initialization of the counter for the paragraph id's,
42 unsigned int Paragraph::Pimpl::paragraph_id = 0;
43
44 namespace {
45
46 struct special_phrase {
47         string phrase;
48         docstring macro;
49         bool builtin;
50 };
51
52 special_phrase const special_phrases[] = {
53         { "LyX", from_ascii("\\LyX{}"), false },
54         { "TeX", from_ascii("\\TeX{}"), true },
55         { "LaTeX2e", from_ascii("\\LaTeXe{}"), true },
56         { "LaTeX", from_ascii("\\LaTeX{}"), true },
57 };
58
59 size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
60
61 } // namespace anon
62
63
64 Paragraph::Pimpl::Pimpl(Paragraph * owner)
65         : owner_(owner)
66 {
67         inset_owner = 0;
68         id_ = paragraph_id++;
69 }
70
71
72 Paragraph::Pimpl::Pimpl(Pimpl const & p, Paragraph * owner)
73         : params(p.params), changes_(p.changes_), owner_(owner)
74 {
75         inset_owner = p.inset_owner;
76         fontlist = p.fontlist;
77         id_ = paragraph_id++;
78 }
79
80
81 void Paragraph::Pimpl::setContentsFromPar(Paragraph const & par)
82 {
83         owner_->text_ = par.text_;
84         // FIXME: change tracking (MG)
85         // check whether this method is really needed
86         changes_ = par.pimpl_->changes_;
87 }
88
89
90 bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
91 {
92         BOOST_ASSERT(start >= 0 && start <= size());
93         BOOST_ASSERT(end > start && end <= size() + 1);
94
95         return changes_.isChanged(start, end);
96 }
97
98
99 void Paragraph::Pimpl::setChange(Change const & change)
100 {
101         // beware of the imaginary end-of-par character!
102         changes_.set(change, 0, size() + 1);
103
104         /*
105          * Propagate the change recursively - but not in case of DELETED!
106          *
107          * Imagine that your co-author makes changes in an existing inset. He
108          * sends your document to you and you come to the conclusion that the
109          * inset should go completely. If you erase it, LyX must not delete all
110          * text within the inset. Otherwise, the change tracked insertions of
111          * your co-author get lost and there is no way to restore them later.
112          *
113          * Conclusion: An inset's content should remain untouched if you delete it
114          */
115
116         if (change.type != Change::DELETED) {
117                 for (pos_type pos = 0; pos < size(); ++pos) {
118                         if (owner_->isInset(pos)) {
119                                 owner_->getInset(pos)->setChange(change);
120                         }
121                 }
122         }
123 }
124
125
126 void Paragraph::Pimpl::setChange(pos_type pos, Change const & change)
127 {
128         BOOST_ASSERT(pos >= 0 && pos <= size());
129
130         changes_.set(change, pos);
131
132         // see comment in setChange(Change const &) above
133
134         if (change.type != Change::DELETED &&
135             pos < size() && owner_->isInset(pos)) {
136                 owner_->getInset(pos)->setChange(change);
137         }
138 }
139
140
141 Change const Paragraph::Pimpl::lookupChange(pos_type pos) const
142 {
143         BOOST_ASSERT(pos >= 0 && pos <= size());
144
145         return changes_.lookup(pos);
146 }
147
148
149 void Paragraph::Pimpl::acceptChanges(pos_type start, pos_type end)
150 {
151         BOOST_ASSERT(start >= 0 && start <= size());
152         BOOST_ASSERT(end > start && end <= size() + 1);
153         
154         for (pos_type pos = start; pos < end; ++pos) {
155                 switch (lookupChange(pos).type) {
156                         case Change::UNCHANGED:
157                                 break;
158
159                         case Change::INSERTED:
160                                 changes_.set(Change(Change::UNCHANGED), pos);
161                                 break;
162
163                         case Change::DELETED:
164                                 // Suppress access to non-existent
165                                 // "end-of-paragraph char"
166                                 if (pos < size()) {
167                                         eraseChar(pos, false);
168                                         --end;
169                                         --pos;
170                                 }
171                                 break;
172                 }
173
174                 // also accept changes in nested insets
175                 if (pos < size() && owner_->isInset(pos)) {
176                         owner_->getInset(pos)->acceptChanges();
177                 }
178         }
179 }
180
181
182 void Paragraph::Pimpl::rejectChanges(pos_type start, pos_type end)
183 {
184         BOOST_ASSERT(start >= 0 && start <= size());
185         BOOST_ASSERT(end > start && end <= size() + 1);
186
187         for (pos_type pos = start; pos < end; ++pos) {
188                 switch (lookupChange(pos).type) {
189                         case Change::UNCHANGED:
190                                 // also reject changes inside of insets
191                                 if (pos < size() && owner_->isInset(pos)) {
192                                         owner_->getInset(pos)->rejectChanges();
193                                 }
194                                 break;
195
196                         case Change::INSERTED:
197                                 // Suppress access to non-existent
198                                 // "end-of-paragraph char"
199                                 if (pos < size()) {
200                                         eraseChar(pos, false);
201                                         --end;
202                                         --pos;
203                                 }
204                                 break;
205
206                         case Change::DELETED:
207                                 changes_.set(Change(Change::UNCHANGED), pos);
208
209                                 // Do NOT reject changes within a deleted inset!
210                                 // There may be insertions of a co-author inside of it!
211
212                                 break;
213                 }
214         }
215 }
216
217
218 Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const
219 {
220         BOOST_ASSERT(pos >= 0 && pos <= size());
221
222         return owner_->getChar(pos);
223 }
224
225
226 void Paragraph::Pimpl::insertChar(pos_type pos, value_type c, Change const & change)
227 {
228         BOOST_ASSERT(pos >= 0 && pos <= size());
229
230         // track change
231         changes_.insert(change, pos);
232
233         // This is actually very common when parsing buffers (and
234         // maybe inserting ascii text)
235         if (pos == size()) {
236                 // when appending characters, no need to update tables
237                 owner_->text_.push_back(c);
238                 return;
239         }
240
241         owner_->text_.insert(owner_->text_.begin() + pos, c);
242
243         // Update the font table.
244         FontTable search_font(pos, LyXFont());
245         for (FontList::iterator it 
246               = lower_bound(fontlist.begin(), fontlist.end(), search_font, matchFT());
247              it != fontlist.end(); ++it)
248         {
249                 it->pos(it->pos() + 1);
250         }
251
252         // Update the insets
253         owner_->insetlist.increasePosAfterPos(pos);
254 }
255
256
257 void Paragraph::Pimpl::insertInset(pos_type pos, InsetBase * inset,
258                                    Change const & change)
259 {
260         BOOST_ASSERT(inset);
261         BOOST_ASSERT(pos >= 0 && pos <= size());
262
263         insertChar(pos, META_INSET, change);
264         BOOST_ASSERT(owner_->text_[pos] == META_INSET);
265
266         // Add a new entry in the insetlist.
267         owner_->insetlist.insert(inset, pos);
268 }
269
270
271 bool Paragraph::Pimpl::eraseChar(pos_type pos, bool trackChanges)
272 {
273         BOOST_ASSERT(pos >= 0 && pos <= size());
274
275         if (trackChanges) {
276                 Change change = changes_.lookup(pos);
277
278                 // set the character to DELETED if 
279                 //  a) it was previously unchanged or
280                 //  b) it was inserted by a co-author
281
282                 if (change.type == Change::UNCHANGED ||
283                     (change.type == Change::INSERTED && change.author != 0)) {
284                         setChange(pos, Change(Change::DELETED));
285                         return false;
286                 }
287
288                 if (change.type == Change::DELETED)
289                         return false;
290         }
291
292         // Don't physically access nonexistent end-of-paragraph char
293         if (pos == size()) {
294                 // FIXME: change tracking (MG)
295                 // how do we handle end-of-pars previously marked inserted?
296                 return false;
297         }
298
299         // track change
300         changes_.erase(pos);
301
302         // if it is an inset, delete the inset entry
303         if (owner_->text_[pos] == Paragraph::META_INSET) {
304                 owner_->insetlist.erase(pos);
305         }
306
307         owner_->text_.erase(owner_->text_.begin() + pos);
308
309         // Erase entries in the tables.
310         FontTable search_font(pos, LyXFont());
311
312         FontList::iterator it =
313                 lower_bound(fontlist.begin(),
314                             fontlist.end(),
315                             search_font, matchFT());
316         if (it != fontlist.end() && it->pos() == pos &&
317             (pos == 0 ||
318              (it != fontlist.begin()
319               && boost::prior(it)->pos() == pos - 1))) {
320                 // If it is a multi-character font
321                 // entry, we just make it smaller
322                 // (see update below), otherwise we
323                 // should delete it.
324                 unsigned int const i = it - fontlist.begin();
325                 fontlist.erase(fontlist.begin() + i);
326                 it = fontlist.begin() + i;
327                 if (i > 0 && i < fontlist.size() &&
328                     fontlist[i - 1].font() == fontlist[i].font()) {
329                         fontlist.erase(fontlist.begin() + i - 1);
330                         it = fontlist.begin() + i - 1;
331                 }
332         }
333
334         // Update all other entries
335         FontList::iterator fend = fontlist.end();
336         for (; it != fend; ++it)
337                 it->pos(it->pos() - 1);
338
339         // Update the insetlist
340         owner_->insetlist.decreasePosAfterPos(pos);
341
342         return true;
343 }
344
345
346 int Paragraph::Pimpl::eraseChars(pos_type start, pos_type end, bool trackChanges)
347 {
348         BOOST_ASSERT(start >= 0 && start <= size());
349         BOOST_ASSERT(end > start && end <= size() + 1);
350
351         pos_type i = start;
352         for (pos_type count = end - start; count; --count) {
353                 if (!eraseChar(i, trackChanges))
354                         ++i;
355         }
356         return end - i;
357 }
358
359
360 void Paragraph::Pimpl::simpleTeXBlanks(odocstream & os, TexRow & texrow,
361                                        pos_type const i,
362                                        unsigned int & column,
363                                        LyXFont const & font,
364                                        LyXLayout const & style)
365 {
366         if (style.pass_thru)
367                 return;
368
369         if (column > lyxrc.ascii_linelen
370             && i
371             && getChar(i - 1) != ' '
372             && (i < size() - 1)
373             // same in FreeSpacing mode
374             && !owner_->isFreeSpacing()
375             // In typewriter mode, we want to avoid
376             // ! . ? : at the end of a line
377             && !(font.family() == LyXFont::TYPEWRITER_FAMILY
378                  && (getChar(i - 1) == '.'
379                      || getChar(i - 1) == '?'
380                      || getChar(i - 1) == ':'
381                      || getChar(i - 1) == '!'))) {
382                 os << '\n';
383                 texrow.newline();
384                 texrow.start(owner_->id(), i + 1);
385                 column = 0;
386         } else if (style.free_spacing) {
387                 os << '~';
388         } else {
389                 os << ' ';
390         }
391 }
392
393
394 bool Paragraph::Pimpl::isTextAt(string const & str, pos_type pos) const
395 {
396         pos_type const len = str.length();
397
398         // is the paragraph large enough?
399         if (pos + len > size())
400                 return false;
401
402         // does the wanted text start at point?
403         for (string::size_type i = 0; i < str.length(); ++i) {
404                 if (str[i] != owner_->text_[pos + i])
405                         return false;
406         }
407
408         // is there a font change in middle of the word?
409         FontList::const_iterator cit = fontlist.begin();
410         FontList::const_iterator end = fontlist.end();
411         for (; cit != end; ++cit) {
412                 if (cit->pos() >= pos)
413                         break;
414         }
415         if (cit != end && pos + len - 1 > cit->pos())
416                 return false;
417
418         return true;
419 }
420
421
422 void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
423                                              BufferParams const & bparams,
424                                              odocstream & os,
425                                              TexRow & texrow,
426                                              OutputParams const & runparams,
427                                              LyXFont & font,
428                                              LyXFont & running_font,
429                                              LyXFont & basefont,
430                                              LyXFont const & outerfont,
431                                              bool & open_font,
432                                              Change::Type & running_change,
433                                              LyXLayout const & style,
434                                              pos_type & i,
435                                              unsigned int & column,
436                                              value_type const c)
437 {
438         if (style.pass_thru) {
439                 if (c != Paragraph::META_INSET) {
440                         if (c != '\0')
441                                 os.put(c);
442                 } else
443                         owner_->getInset(i)->plaintext(buf, os, runparams);
444                 return;
445         }
446
447         // Two major modes:  LaTeX or plain
448         // Handle here those cases common to both modes
449         // and then split to handle the two modes separately.
450         switch (c) {
451         case Paragraph::META_INSET: {
452                 InsetBase * inset = owner_->getInset(i);
453
454                 // FIXME: remove this check
455                 if (!inset)
456                         break;
457
458                 // FIXME: move this to InsetNewline::latex
459                 if (inset->lyxCode() == InsetBase::NEWLINE_CODE) {
460                         // newlines are handled differently here than
461                         // the default in simpleTeXSpecialChars().
462                         if (!style.newline_allowed) {
463                                 os << '\n';
464                         } else {
465                                 if (open_font) {
466                                         column += running_font.latexWriteEndChanges(os, basefont, basefont);
467                                         open_font = false;
468                                 }
469                                 basefont = owner_->getLayoutFont(bparams, outerfont);
470                                 running_font = basefont;
471
472                                 if (font.family() == LyXFont::TYPEWRITER_FAMILY)
473                                         os << '~';
474
475                                 if (runparams.moving_arg)
476                                         os << "\\protect ";
477
478                                 os << "\\\\\n";
479                         }
480                         texrow.newline();
481                         texrow.start(owner_->id(), i + 1);
482                         column = 0;
483                         break;
484                 }
485
486                 // output change tracking marks only if desired,
487                 // if dvipost is installed,
488                 // and with dvi/ps (other formats don't work)
489                 LaTeXFeatures features(buf, bparams, runparams);
490                 bool const output = bparams.outputChanges
491                         && runparams.flavor == OutputParams::LATEX
492                         && features.isAvailable("dvipost");
493
494                 if (inset->canTrackChanges()) {
495                         column += Changes::latexMarkChange(os, running_change,
496                                 Change::UNCHANGED, output);
497                         running_change = Change::UNCHANGED;
498                 }
499
500                 bool close = false;
501                 odocstream::pos_type const len = os.tellp();
502
503                 if ((inset->lyxCode() == InsetBase::GRAPHICS_CODE
504                      || inset->lyxCode() == InsetBase::MATH_CODE
505                      || inset->lyxCode() == InsetBase::URL_CODE)
506                     && running_font.isRightToLeft()) {
507                         os << "\\L{";
508                         close = true;
509                 }
510
511 #ifdef WITH_WARNINGS
512 #warning Bug: we can have an empty font change here!
513 // if there has just been a font change, we are going to close it
514 // right now, which means stupid latex code like \textsf{}. AFAIK,
515 // this does not harm dvi output. A minor bug, thus (JMarc)
516 #endif
517                 // some insets cannot be inside a font change command
518                 if (open_font && inset->noFontChange()) {
519                         column +=running_font.
520                                 latexWriteEndChanges(os,
521                                                      basefont,
522                                                      basefont);
523                         open_font = false;
524                         basefont = owner_->getLayoutFont(bparams, outerfont);
525                         running_font = basefont;
526                 }
527
528                 int tmp = inset->latex(buf, os, runparams);
529
530                 if (close)
531                         os << '}';
532
533                 if (tmp) {
534                         for (int j = 0; j < tmp; ++j) {
535                                 texrow.newline();
536                         }
537                         texrow.start(owner_->id(), i + 1);
538                         column = 0;
539                 } else {
540                         column += os.tellp() - len;
541                 }
542         }
543         break;
544
545         default:
546                 // And now for the special cases within each mode
547
548                 switch (c) {
549                 case '\\':
550                         os << "\\textbackslash{}";
551                         column += 15;
552                         break;
553
554                 // The following characters could be written literally in latin1, but they
555                 // would be wrongly converted on systems where char is signed, so we give
556                 // the code points.
557                 // This also makes us independant from the encoding of this source file.
558                 case 0xb1:    // ± PLUS-MINUS SIGN
559                 case 0xb2:    // ² SUPERSCRIPT TWO
560                 case 0xb3:    // ³ SUPERSCRIPT THREE
561                 case 0xd7:    // × MULTIPLICATION SIGN
562                 case 0xf7:    // ÷ DIVISION SIGN
563                 case 0xb9:    // ¹ SUPERSCRIPT ONE
564                 case 0xac:    // ¬ NOT SIGN
565                 case 0xb5:    // µ MICRO SIGN
566                         if ((bparams.inputenc == "latin1" ||
567                              bparams.inputenc == "latin9") ||
568                             (bparams.inputenc == "auto" &&
569                              (font.language()->encoding()->latexName()
570                               == "latin1" ||
571                               font.language()->encoding()->latexName()
572                               == "latin9"))) {
573                                 os << "\\ensuremath{";
574                                 os.put(c);
575                                 os << '}';
576                                 column += 13;
577                         } else {
578                                 os.put(c);
579                         }
580                         break;
581
582                 case '|': case '<': case '>':
583                         // In T1 encoding, these characters exist
584                         if (lyxrc.fontenc == "T1") {
585                                 os.put(c);
586                                 //... but we should avoid ligatures
587                                 if ((c == '>' || c == '<')
588                                     && i <= size() - 2
589                                     && getChar(i + 1) == c) {
590                                         //os << "\\textcompwordmark{}";
591                                         // Jean-Marc, have a look at
592                                         // this. I think this works
593                                         // equally well:
594                                         os << "\\,{}";
595                                         // Lgb
596                                         column += 19;
597                                 }
598                                 break;
599                         }
600                         // Typewriter font also has them
601                         if (font.family() == LyXFont::TYPEWRITER_FAMILY) {
602                                 os.put(c);
603                                 break;
604                         }
605                         // Otherwise, we use what LaTeX
606                         // provides us.
607                         switch (c) {
608                         case '<':
609                                 os << "\\textless{}";
610                                 column += 10;
611                                 break;
612                         case '>':
613                                 os << "\\textgreater{}";
614                                 column += 13;
615                                 break;
616                         case '|':
617                                 os << "\\textbar{}";
618                                 column += 9;
619                                 break;
620                         }
621                         break;
622
623                 case '-': // "--" in Typewriter mode -> "-{}-"
624                         if (i <= size() - 2
625                             && getChar(i + 1) == '-'
626                             && font.family() == LyXFont::TYPEWRITER_FAMILY) {
627                                 os << "-{}";
628                                 column += 2;
629                         } else {
630                                 os << '-';
631                         }
632                         break;
633
634                 case '\"':
635                         os << "\\char`\\\"{}";
636                         column += 9;
637                         break;
638
639                 case 0xa3:    // £ POUND SIGN
640                         if (bparams.inputenc == "default") {
641                                 os << "\\pounds{}";
642                                 column += 8;
643                         } else {
644                                 os.put(c);
645                         }
646                         break;
647
648                 case '$': case '&':
649                 case '%': case '#': case '{':
650                 case '}': case '_':
651                         os << '\\';
652                         os.put(c);
653                         column += 1;
654                         break;
655
656                 case '~':
657                         os << "\\textasciitilde{}";
658                         column += 16;
659                         break;
660
661                 case '^':
662                         os << "\\textasciicircum{}";
663                         column += 17;
664                         break;
665
666                 case '*': case '[':
667                         // avoid being mistaken for optional arguments
668                         os << '{';
669                         os.put(c);
670                         os << '}';
671                         column += 2;
672                         break;
673
674                 case ' ':
675                         // Blanks are printed before font switching.
676                         // Sure? I am not! (try nice-latex)
677                         // I am sure it's correct. LyX might be smarter
678                         // in the future, but for now, nothing wrong is
679                         // written. (Asger)
680                         break;
681
682                 default:
683
684                         // I assume this is hack treating typewriter as verbatim
685                         if (font.family() == LyXFont::TYPEWRITER_FAMILY) {
686                                 if (c != '\0') {
687                                         os.put(c);
688                                 }
689                                 break;
690                         }
691
692                         // LyX, LaTeX etc.
693
694                         // FIXME: if we have "LaTeX" with a font
695                         // change in the middle (before the 'T', then
696                         // the "TeX" part is still special cased.
697                         // Really we should only operate this on
698                         // "words" for some definition of word
699
700                         size_t pnr = 0;
701
702                         for (; pnr < phrases_nr; ++pnr) {
703                                 if (isTextAt(special_phrases[pnr].phrase, i)) {
704                                         os << special_phrases[pnr].macro;
705                                         i += special_phrases[pnr].phrase.length() - 1;
706                                         column += special_phrases[pnr].macro.length() - 1;
707                                         break;
708                                 }
709                         }
710
711                         if (pnr == phrases_nr && c != '\0') {
712                                 os.put(c);
713                         }
714                         break;
715                 }
716         }
717 }
718
719
720 void Paragraph::Pimpl::validate(LaTeXFeatures & features,
721                                 LyXLayout const & layout) const
722 {
723         BufferParams const & bparams = features.bufferParams();
724
725         // check the params.
726         if (!params.spacing().isDefault())
727                 features.require("setspace");
728
729         // then the layouts
730         features.useLayout(layout.name());
731
732         // then the fonts
733         Language const * doc_language = bparams.language;
734
735         FontList::const_iterator fcit = fontlist.begin();
736         FontList::const_iterator fend = fontlist.end();
737         for (; fcit != fend; ++fcit) {
738                 if (fcit->font().noun() == LyXFont::ON) {
739                         lyxerr[Debug::LATEX] << "font.noun: "
740                                              << fcit->font().noun()
741                                              << endl;
742                         features.require("noun");
743                         lyxerr[Debug::LATEX] << "Noun enabled. Font: "
744                                              << fcit->font().stateText(0)
745                                              << endl;
746                 }
747                 switch (fcit->font().color()) {
748                 case LColor::none:
749                 case LColor::inherit:
750                 case LColor::ignore:
751                         // probably we should put here all interface colors used for
752                         // font displaying! For now I just add this ones I know of (Jug)
753                 case LColor::latex:
754                 case LColor::note:
755                         break;
756                 default:
757                         features.require("color");
758                         lyxerr[Debug::LATEX] << "Color enabled. Font: "
759                                              << fcit->font().stateText(0)
760                                              << endl;
761                 }
762
763                 Language const * language = fcit->font().language();
764                 if (language->babel() != doc_language->babel() &&
765                     language != ignore_language &&
766                     language != latex_language)
767                 {
768                         features.useLanguage(language);
769                         lyxerr[Debug::LATEX] << "Found language "
770                                              << language->babel() << endl;
771                 }
772         }
773
774         if (!params.leftIndent().zero())
775                 features.require("ParagraphLeftIndent");
776
777         // then the insets
778         InsetList::const_iterator icit = owner_->insetlist.begin();
779         InsetList::const_iterator iend = owner_->insetlist.end();
780         for (; icit != iend; ++icit) {
781                 if (icit->inset) {
782                         icit->inset->validate(features);
783                         if (layout.needprotect &&
784                             icit->inset->lyxCode() == InsetBase::FOOT_CODE)
785                                 features.require("NeedLyXFootnoteCode");
786                 }
787         }
788
789         // then the contents
790         for (pos_type i = 0; i < size() ; ++i) {
791                 for (size_t pnr = 0; pnr < phrases_nr; ++pnr) {
792                         if (!special_phrases[pnr].builtin
793                             && isTextAt(special_phrases[pnr].phrase, i)) {
794                                 features.require(special_phrases[pnr].phrase);
795                                 break;
796                         }
797                 }
798         }
799 }
800
801
802 } // namespace lyx