]> git.lyx.org Git - lyx.git/blob - src/Format.cpp
f031b6806d42562838a242e422e0fecb905ba1e8
[lyx.git] / src / Format.cpp
1 /**
2  * \file Format.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Dekel Tsur
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "Format.h"
14 #include "Buffer.h"
15 #include "BufferParams.h"
16 #include "LyXRC.h"
17 #include "ServerSocket.h"
18
19 #include "frontends/alert.h" //to be removed?
20
21 #include "support/debug.h"
22 #include "support/filetools.h"
23 #include "support/gettext.h"
24 #include "support/lstrings.h"
25 #include "support/os.h"
26 #include "support/Path.h"
27 #include "support/Systemcall.h"
28 #include "support/textutils.h"
29 #include "support/Translator.h"
30
31 #include <algorithm>
32 #include <map>
33 #include <ctime>
34
35 // FIXME: Q_WS_MACX is not available, it's in Qt
36 #ifdef USE_MACOSX_PACKAGING
37 #include "support/linkback/LinkBackProxy.h"
38 #endif
39
40 #ifdef HAVE_MAGIC_H
41 #include <magic.h>
42 #endif
43
44 using namespace std;
45 using namespace lyx::support;
46
47 namespace lyx {
48
49 namespace Alert = frontend::Alert;
50 namespace os = support::os;
51
52 namespace {
53
54 string const token_from_format("$$i");
55 string const token_path_format("$$p");
56 string const token_socket_format("$$a");
57
58
59 class FormatNamesEqual : public unary_function<Format, bool> {
60 public:
61         FormatNamesEqual(string const & name)
62                 : name_(name) {}
63         bool operator()(Format const & f) const
64         {
65                 return f.name() == name_;
66         }
67 private:
68         string name_;
69 };
70
71
72 class FormatExtensionsEqual : public unary_function<Format, bool> {
73 public:
74         FormatExtensionsEqual(string const & extension)
75                 : extension_(extension) {}
76         bool operator()(Format const & f) const
77         {
78                 return f.hasExtension(extension_);
79         }
80 private:
81         string extension_;
82 };
83
84
85 class FormatMimeEqual : public unary_function<Format, bool> {
86 public:
87         FormatMimeEqual(string const & mime)
88                 : mime_(mime) {}
89         bool operator()(Format const & f) const
90         {
91                 // The test for empty mime strings is needed since we allow
92                 // formats with empty mime types.
93                 return f.mime() == mime_ && !mime_.empty();
94         }
95 private:
96         string mime_;
97 };
98
99
100 class FormatPrettyNameEqual : public unary_function<Format, bool> {
101 public:
102         FormatPrettyNameEqual(string const & prettyname)
103                 : prettyname_(prettyname) {}
104         bool operator()(Format const & f) const
105         {
106                 return f.prettyname() == prettyname_;
107         }
108 private:
109         string prettyname_;
110 };
111
112 } //namespace anon
113
114
115 bool operator<(Format const & a, Format const & b)
116 {
117         return _(a.prettyname()) < _(b.prettyname());
118 }
119
120
121 Format::Format(string const & n, string const & e, string const & p,
122                string const & s, string const & v, string const & ed,
123                string const & m, int flags)
124         : name_(n), prettyname_(p), shortcut_(s), viewer_(v),
125           editor_(ed), mime_(m), flags_(flags)
126 {
127         extension_list_ = getVectorFromString(e, ",");
128         LYXERR(Debug::GRAPHICS, "New Format: n=" << n << ", flags=" << flags);
129 }
130
131
132 bool Format::dummy() const
133 {
134         return extension().empty();
135 }
136
137
138 string const Format::extensions() const
139 {
140         return getStringFromVector(extension_list_, ", ");
141 }
142
143
144 bool Format::hasExtension(string const & e) const
145 {
146         return (find(extension_list_.begin(), extension_list_.end(), e)
147                 != extension_list_.end());
148 }
149
150
151 bool Format::isChildFormat() const
152 {
153         if (name_.empty())
154                 return false;
155         return isDigitASCII(name_[name_.length() - 1]);
156 }
157
158
159 string const Format::parentFormat() const
160 {
161         return name_.substr(0, name_.length() - 1);
162 }
163
164
165 void Format::setExtensions(string const & e)
166 {
167         extension_list_ = getVectorFromString(e, ",");
168 }
169
170
171 // This method should return a reference, and throw an exception
172 // if the format named name cannot be found (Lgb)
173 Format const * Formats::getFormat(string const & name) const
174 {
175         FormatList::const_iterator cit =
176                 find_if(formatlist.begin(), formatlist.end(),
177                         FormatNamesEqual(name));
178         if (cit != formatlist.end())
179                 return &(*cit);
180         else
181                 return 0;
182 }
183
184
185 namespace {
186
187 /** Guess the file format name (as in Format::name()) from contents.
188  *  Normally you don't want to use this directly, but rather
189  *  Formats::getFormatFromFile().
190  */
191 string guessFormatFromContents(FileName const & fn)
192 {
193         // the different filetypes and what they contain in one of the first lines
194         // (dots are any characters).           (Herbert 20020131)
195         // AGR  Grace...
196         // BMP  BM...
197         // EPS  %!PS-Adobe-3.0 EPSF...
198         // FIG  #FIG...
199         // FITS ...BITPIX...
200         // GIF  GIF...
201         // JPG  JFIF
202         // PDF  %PDF-...
203         // PNG  .PNG...
204         // PBM  P1... or P4     (B/W)
205         // PGM  P2... or P5     (Grayscale)
206         // PPM  P3... or P6     (color)
207         // PS   %!PS-Adobe-2.0 or 1.0,  no "EPSF"!
208         // SGI  \001\332...     (decimal 474)
209         // TGIF %TGIF...
210         // TIFF II... or MM...
211         // XBM  ..._bits[]...
212         // XPM  /* XPM */    sometimes missing (f.ex. tgif-export)
213         //      ...static char *...
214         // XWD  \000\000\000\151        (0x00006900) decimal 105
215         //
216         // GZIP \037\213        http://www.ietf.org/rfc/rfc1952.txt
217         // ZIP  PK...                   http://www.halyava.ru/document/ind_arch.htm
218         // Z    \037\235                UNIX compress
219
220         // paranoia check
221         if (fn.empty() || !fn.isReadableFile())
222                 return string();
223
224         ifstream ifs(fn.toFilesystemEncoding().c_str());
225         if (!ifs)
226                 // Couldn't open file...
227                 return string();
228
229         // gnuzip
230         static string const gzipStamp = "\037\213";
231
232         // PKZIP
233         static string const zipStamp = "PK";
234
235         // ZIP containers (koffice, openoffice.org etc).
236         static string const nonzipStamp = "\008\0\0\0mimetypeapplication/";
237
238         // compress
239         static string const compressStamp = "\037\235";
240
241         // Maximum strings to read
242         int const max_count = 50;
243         int count = 0;
244
245         string str;
246         string format;
247         bool firstLine = true;
248         while ((count++ < max_count) && format.empty()) {
249                 if (ifs.eof()) {
250                         LYXERR(Debug::GRAPHICS, "filetools(getFormatFromContents)\n"
251                                 << "\tFile type not recognised before EOF!");
252                         break;
253                 }
254
255                 getline(ifs, str);
256                 string const stamp = str.substr(0, 2);
257                 if (firstLine && str.size() >= 2) {
258                         // at first we check for a zipped file, because this
259                         // information is saved in the first bytes of the file!
260                         // also some graphic formats which save the information
261                         // in the first line, too.
262                         if (prefixIs(str, gzipStamp)) {
263                                 format =  "gzip";
264
265                         } else if (stamp == zipStamp &&
266                                    !contains(str, nonzipStamp)) {
267                                 format =  "zip";
268
269                         } else if (stamp == compressStamp) {
270                                 format =  "compress";
271
272                         // the graphics part
273                         } else if (stamp == "BM") {
274                                 format =  "bmp";
275
276                         } else if (stamp == "\001\332") {
277                                 format =  "sgi";
278
279                         // PBM family
280                         // Don't need to use str.at(0), str.at(1) because
281                         // we already know that str.size() >= 2
282                         } else if (str[0] == 'P') {
283                                 switch (str[1]) {
284                                 case '1':
285                                 case '4':
286                                         format =  "pbm";
287                                     break;
288                                 case '2':
289                                 case '5':
290                                         format =  "pgm";
291                                     break;
292                                 case '3':
293                                 case '6':
294                                         format =  "ppm";
295                                 }
296                                 break;
297
298                         } else if ((stamp == "II") || (stamp == "MM")) {
299                                 format =  "tiff";
300
301                         } else if (prefixIs(str,"%TGIF")) {
302                                 format =  "tgif";
303
304                         } else if (prefixIs(str,"#FIG")) {
305                                 format =  "fig";
306
307                         } else if (prefixIs(str,"GIF")) {
308                                 format =  "gif";
309
310                         } else if (str.size() > 3) {
311                                 int const c = ((str[0] << 24) & (str[1] << 16) &
312                                                (str[2] << 8)  & str[3]);
313                                 if (c == 105) {
314                                         format =  "xwd";
315                                 }
316                         }
317
318                         firstLine = false;
319                 }
320
321                 if (!format.empty())
322                     break;
323                 else if (contains(str,"EPSF"))
324                         // dummy, if we have wrong file description like
325                         // %!PS-Adobe-2.0EPSF"
326                         format = "eps";
327
328                 else if (contains(str, "Grace"))
329                         format = "agr";
330
331                 else if (contains(str, "JFIF"))
332                         format = "jpg";
333
334                 else if (contains(str, "%PDF"))
335                         format = "pdf";
336
337                 else if (contains(str, "PNG"))
338                         format = "png";
339
340                 else if (contains(str, "%!PS-Adobe")) {
341                         // eps or ps
342                         ifs >> str;
343                         if (contains(str,"EPSF"))
344                                 format = "eps";
345                         else
346                             format = "ps";
347                 }
348
349                 else if (contains(str, "_bits[]"))
350                         format = "xbm";
351
352                 else if (contains(str, "XPM") || contains(str, "static char *"))
353                         format = "xpm";
354
355                 else if (contains(str, "BITPIX"))
356                         format = "fits";
357         }
358
359         if (!format.empty()) {
360                 LYXERR(Debug::GRAPHICS, "Recognised Fileformat: " << format);
361                 return format;
362         }
363
364         LYXERR(Debug::GRAPHICS, "filetools(getFormatFromContents)\n"
365                 << "\tCouldn't find a known format!");
366         return string();
367 }
368
369 }
370
371
372 string Formats::getFormatFromFile(FileName const & filename) const
373 {
374         if (filename.empty())
375                 return string();
376
377 #ifdef HAVE_MAGIC_H
378         if (filename.exists()) {
379                 magic_t magic_cookie = magic_open(MAGIC_MIME);
380                 if (magic_cookie) {
381                         string format;
382                         if (magic_load(magic_cookie, NULL) != 0) {
383                                 LYXERR(Debug::GRAPHICS, "Formats::getFormatFromFile\n"
384                                         << "\tCouldn't load magic database - "
385                                         << magic_error(magic_cookie));
386                         } else {
387                                 string mime = magic_file(magic_cookie,
388                                         filename.toFilesystemEncoding().c_str());
389                                 mime = token(mime, ';', 0);
390                                 // we need our own ps/eps detection
391                                 if ((mime != "application/postscript") && (mime != "text/plain")) {
392                                         Formats::const_iterator cit =
393                                                 find_if(formatlist.begin(), formatlist.end(),
394                                                         FormatMimeEqual(mime));
395                                         if (cit != formats.end()) {
396                                                 LYXERR(Debug::GRAPHICS, "\tgot format from MIME type: "
397                                                         << mime << " -> " << cit->name());
398                                                 format = cit->name();
399                                         }
400                                 }
401                         }
402                         magic_close(magic_cookie);
403                         if (!format.empty())
404                                 return format;
405                 }
406         }
407 #endif
408
409         string const format = guessFormatFromContents(filename);
410         string const ext = getExtension(filename.absFileName());
411         if (isZippedFileFormat(format) && !ext.empty()) {
412                 string const & fmt_name = formats.getFormatFromExtension(ext);
413                 if (!fmt_name.empty()) {
414                         Format const * p_format = formats.getFormat(fmt_name);
415                         if (p_format && p_format->zippedNative())
416                                 return p_format->name();
417                 }
418         }
419         if (!format.empty())
420                 return format;
421
422         // try to find a format from the file extension.
423         return getFormatFromExtension(ext);
424 }
425
426
427 string Formats::getFormatFromExtension(string const & ext) const
428 {
429         if (!ext.empty()) {
430                 // this is ambigous if two formats have the same extension,
431                 // but better than nothing
432                 Formats::const_iterator cit =
433                         find_if(formatlist.begin(), formatlist.end(),
434                                 FormatExtensionsEqual(ext));
435                 if (cit != formats.end()) {
436                         LYXERR(Debug::GRAPHICS, "\twill guess format from file extension: "
437                                 << ext << " -> " << cit->name());
438                         return cit->name();
439                 }
440         }
441         return string();
442 }
443
444
445 string Formats::getFormatFromPrettyName(string const & prettyname) const
446 {
447         if (!prettyname.empty()) {
448                 Formats::const_iterator cit =
449                         find_if(formatlist.begin(), formatlist.end(),
450                                 FormatPrettyNameEqual(prettyname));
451                 if (cit != formats.end())
452                         return cit->name();
453         }
454         return string();
455 }
456
457
458 /// Used to store last timestamp of file and whether it is (was) zipped
459 struct ZippedInfo {
460         bool zipped;
461         std::time_t timestamp;
462         ZippedInfo(bool zipped, std::time_t timestamp)
463         : zipped(zipped), timestamp(timestamp) { }
464 };
465
466
467 /// Mapping absolute pathnames of files to their ZippedInfo metadata.
468 static std::map<std::string, ZippedInfo> zipped_;
469
470
471 bool Formats::isZippedFile(support::FileName const & filename) const {
472         string const & fname = filename.absFileName();
473         time_t timestamp = filename.lastModified();
474         map<string, ZippedInfo>::iterator it = zipped_.find(fname);
475         if (it != zipped_.end() && it->second.timestamp == timestamp)
476                 return it->second.zipped;
477         string const & format = getFormatFromFile(filename);
478         bool zipped = (format == "gzip" || format == "zip");
479         zipped_.insert(pair<string, ZippedInfo>(fname, ZippedInfo(zipped, timestamp)));
480         return zipped;
481 }
482
483
484 bool Formats::isZippedFileFormat(string const & format)
485 {
486         return contains("gzip zip compress", format) && !format.empty();
487 }
488
489
490 bool Formats::isPostScriptFileFormat(string const & format)
491 {
492         return format == "ps" || format == "eps";
493 }
494
495 static string fixCommand(string const & cmd, string const & ext,
496                   os::auto_open_mode mode)
497 {
498         // configure.py says we do not want a viewer/editor
499         if (cmd.empty())
500                 return cmd;
501
502         // Does the OS manage this format?
503         if (os::canAutoOpenFile(ext, mode))
504                 return "auto";
505
506         // if configure.py found nothing, clear the command
507         if (token(cmd, ' ', 0) == "auto")
508                 return string();
509
510         // use the command found by configure.py
511         return cmd;
512 }
513
514
515 void Formats::setAutoOpen()
516 {
517         FormatList::iterator fit = formatlist.begin();
518         FormatList::iterator const fend = formatlist.end();
519         for ( ; fit != fend ; ++fit) {
520                 fit->setViewer(fixCommand(fit->viewer(), fit->extension(), os::VIEW));
521                 fit->setEditor(fixCommand(fit->editor(), fit->extension(), os::EDIT));
522         }
523 }
524
525
526 int Formats::getNumber(string const & name) const
527 {
528         FormatList::const_iterator cit =
529                 find_if(formatlist.begin(), formatlist.end(),
530                         FormatNamesEqual(name));
531         if (cit != formatlist.end())
532                 return distance(formatlist.begin(), cit);
533         else
534                 return -1;
535 }
536
537
538 void Formats::add(string const & name)
539 {
540         if (!getFormat(name))
541                 add(name, name, name, string(), string(), string(),
542                     string(), Format::document);
543 }
544
545
546 void Formats::add(string const & name, string const & extensions,
547                   string const & prettyname, string const & shortcut,
548                   string const & viewer, string const & editor,
549                   string const & mime, int flags)
550 {
551         FormatList::iterator it =
552                 find_if(formatlist.begin(), formatlist.end(),
553                         FormatNamesEqual(name));
554         if (it == formatlist.end())
555                 formatlist.push_back(Format(name, extensions, prettyname,
556                                             shortcut, viewer, editor, mime, flags));
557         else
558                 *it = Format(name, extensions, prettyname, shortcut, viewer,
559                              editor, mime, flags);
560 }
561
562
563 void Formats::erase(string const & name)
564 {
565         FormatList::iterator it =
566                 find_if(formatlist.begin(), formatlist.end(),
567                         FormatNamesEqual(name));
568         if (it != formatlist.end())
569                 formatlist.erase(it);
570 }
571
572
573 void Formats::sort()
574 {
575         std::sort(formatlist.begin(), formatlist.end());
576 }
577
578
579 void Formats::setViewer(string const & name, string const & command)
580 {
581         add(name);
582         FormatList::iterator it =
583                 find_if(formatlist.begin(), formatlist.end(),
584                         FormatNamesEqual(name));
585         if (it != formatlist.end())
586                 it->setViewer(command);
587 }
588
589
590 void Formats::setEditor(string const & name, string const & command)
591 {
592         add(name);
593         FormatList::iterator it =
594                 find_if(formatlist.begin(), formatlist.end(),
595                         FormatNamesEqual(name));
596         if (it != formatlist.end())
597                 it->setEditor(command);
598 }
599
600
601 bool Formats::view(Buffer const & buffer, FileName const & filename,
602                    string const & format_name) const
603 {
604         if (filename.empty() || !filename.exists()) {
605                 Alert::error(_("Cannot view file"),
606                         bformat(_("File does not exist: %1$s"),
607                                 from_utf8(filename.absFileName())));
608                 return false;
609         }
610
611         Format const * format = getFormat(format_name);
612         if (format && format->viewer().empty() &&
613             format->isChildFormat())
614                 format = getFormat(format->parentFormat());
615         if (!format || format->viewer().empty()) {
616 // FIXME: I believe this is the wrong place to show alerts, it should be done
617 // by the caller (this should be "utility" code)
618                 Alert::error(_("Cannot view file"),
619                         bformat(_("No information for viewing %1$s"),
620                                 prettyName(format_name)));
621                 return false;
622         }
623         // viewer is 'auto'
624         if (format->viewer() == "auto") {
625                 if (os::autoOpenFile(filename.absFileName(), os::VIEW, buffer.filePath()))
626                         return true;
627                 else {
628                         Alert::error(_("Cannot view file"),
629                                 bformat(_("Auto-view file %1$s failed"),
630                                         from_utf8(filename.absFileName())));
631                         return false;
632                 }
633         }
634
635         string command = libScriptSearch(format->viewer());
636
637         if (format_name == "dvi" &&
638             !lyxrc.view_dvi_paper_option.empty()) {
639                 string paper_size = buffer.params().paperSizeName(BufferParams::XDVI);
640                 if (!paper_size.empty()) {
641                         command += ' ' + lyxrc.view_dvi_paper_option;
642                         command += ' ' + paper_size;
643                         if (buffer.params().orientation == ORIENTATION_LANDSCAPE &&
644                             buffer.params().papersize != PAPER_CUSTOM)
645                                 command += 'r';
646                 }
647         }
648
649         if (!contains(command, token_from_format))
650                 command += ' ' + token_from_format;
651
652         command = subst(command, token_from_format, quoteName(onlyFileName(filename.toFilesystemEncoding())));
653         command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
654         command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
655         LYXERR(Debug::FILES, "Executing command: " << command);
656         // FIXME UNICODE utf8 can be wrong for files
657         buffer.message(_("Executing command: ") + from_utf8(command));
658
659         PathChanger p(filename.onlyPath());
660         Systemcall one;
661         one.startscript(Systemcall::DontWait, command, buffer.filePath());
662
663         // we can't report any sort of error, since we aren't waiting
664         return true;
665 }
666
667
668 bool Formats::edit(Buffer const & buffer, FileName const & filename,
669                          string const & format_name) const
670 {
671         if (filename.empty() || !filename.exists()) {
672                 Alert::error(_("Cannot edit file"),
673                         bformat(_("File does not exist: %1$s"),
674                                 from_utf8(filename.absFileName())));
675                 return false;
676         }
677
678         // LinkBack files look like PDF, but have the .linkback extension
679         string const ext = getExtension(filename.absFileName());
680         if (format_name == "pdf" && ext == "linkback") {
681 #ifdef USE_MACOSX_PACKAGING
682                 return editLinkBackFile(filename.absFileName().c_str());
683 #else
684                 Alert::error(_("Cannot edit file"),
685                              _("LinkBack files can only be edited on Apple Mac OSX."));
686                 return false;
687 #endif // USE_MACOSX_PACKAGING
688         }
689
690         Format const * format = getFormat(format_name);
691         if (format && format->editor().empty() &&
692             format->isChildFormat())
693                 format = getFormat(format->parentFormat());
694         if (!format || format->editor().empty()) {
695 // FIXME: I believe this is the wrong place to show alerts, it should
696 // be done by the caller (this should be "utility" code)
697                 Alert::error(_("Cannot edit file"),
698                         bformat(_("No information for editing %1$s"),
699                                 prettyName(format_name)));
700                 return false;
701         }
702
703         // editor is 'auto'
704         if (format->editor() == "auto") {
705                 if (os::autoOpenFile(filename.absFileName(), os::EDIT, buffer.filePath()))
706                         return true;
707                 else {
708                         Alert::error(_("Cannot edit file"),
709                                 bformat(_("Auto-edit file %1$s failed"),
710                                         from_utf8(filename.absFileName())));
711                         return false;
712                 }
713         }
714
715         string command = format->editor();
716
717         if (!contains(command, token_from_format))
718                 command += ' ' + token_from_format;
719
720         command = subst(command, token_from_format, quoteName(filename.toFilesystemEncoding()));
721         command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
722         command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
723         LYXERR(Debug::FILES, "Executing command: " << command);
724         // FIXME UNICODE utf8 can be wrong for files
725         buffer.message(_("Executing command: ") + from_utf8(command));
726
727         Systemcall one;
728         one.startscript(Systemcall::DontWait, command, buffer.filePath());
729
730         // we can't report any sort of error, since we aren't waiting
731         return true;
732 }
733
734
735 docstring const Formats::prettyName(string const & name) const
736 {
737         Format const * format = getFormat(name);
738         if (format)
739                 return from_utf8(format->prettyname());
740         else
741                 return from_utf8(name);
742 }
743
744
745 string const Formats::extension(string const & name) const
746 {
747         Format const * format = getFormat(name);
748         if (format)
749                 return format->extension();
750         else
751                 return name;
752 }
753
754
755 string const Formats::extensions(string const & name) const
756 {
757         Format const * format = getFormat(name);
758         if (format)
759                 return format->extensions();
760         else
761                 return name;
762 }
763
764
765 namespace {
766 typedef Translator<OutputParams::FLAVOR, string> FlavorTranslator;
767
768 FlavorTranslator initFlavorTranslator()
769 {
770         FlavorTranslator f(OutputParams::LATEX, "latex");
771         f.addPair(OutputParams::DVILUATEX, "dviluatex");
772         f.addPair(OutputParams::LUATEX, "luatex");
773         f.addPair(OutputParams::PDFLATEX, "pdflatex");
774         f.addPair(OutputParams::XETEX, "xetex");
775         f.addPair(OutputParams::XML, "docbook-xml");
776         f.addPair(OutputParams::HTML, "xhtml");
777         f.addPair(OutputParams::TEXT, "text");
778         return f;
779 }
780
781
782 FlavorTranslator const & flavorTranslator()
783 {
784         static FlavorTranslator translator = initFlavorTranslator();
785         return translator;
786 }
787 }
788
789
790 std::string flavor2format(OutputParams::FLAVOR flavor)
791 {
792         return flavorTranslator().find(flavor);
793 }
794
795
796 /* Not currently needed, but I'll leave the code in case it is.
797 OutputParams::FLAVOR format2flavor(std::string fmt)
798 {
799         return flavorTranslator().find(fmt);
800 } */
801
802 Formats formats;
803
804 Formats system_formats;
805
806
807 } // namespace lyx