]> git.lyx.org Git - features.git/blob - src/tex2lyx/dummy_impl.cpp
Rationalise includes
[features.git] / src / tex2lyx / dummy_impl.cpp
1 /**
2  * \file dummy_impl.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jean-Marc Lasgouttes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 /**
12  * This file contains dummy implementation of some methods that are
13  * needed byclasses used by tex2lyx. This allows to reduce the number
14  * of classes we have to link against.
15 */
16
17 // {[(
18
19 #include <config.h>
20
21 #include "Format.h"
22 #include "LaTeXFeatures.h"
23 #include "LyXRC.h"
24 #include "output_xhtml.h"
25
26 #include "support/Messages.h"
27
28 #include <iostream>
29
30 using namespace std;
31
32 namespace lyx {
33
34 //
35 // Dummy Alert support (needed by TextClass)
36 //
37
38
39 namespace frontend {
40 namespace Alert {
41         void warning(docstring const & title, docstring const & message,
42                                  bool const &)
43         {
44                 cerr << to_utf8(title) << "\n" << to_utf8(message) << endl;
45         }
46 }
47 }
48
49
50 //
51 // Dummy LyXRC support
52 //
53
54 LyXRC lyxrc;
55
56 /** Note that some variables are not initialized correctly. Hopefully
57  * they are not used in our code (currently valgrind does not complain).
58  * Linking against the full LyXRC.cpp forces us to pull too much
59  * stuff.
60  */
61 LyXRC::LyXRC()
62 {}
63
64
65 //
66 // Dummy translation support (needed at many places)
67 //
68
69
70 Messages messages_;
71 Messages const & getMessages(string const &)
72 {
73         return messages_;
74 }
75
76
77 Messages const & getGuiMessages()
78 {
79         return messages_;
80 }
81
82
83 //
84 // Dummy formats support (needed by Lexer)
85 //
86
87 Formats formats;
88
89 bool Formats::isZippedFile(support::FileName const&) const
90 {
91         return false;
92 }
93
94
95 //
96 // Dummy features support (needed by ModuleList)
97 //
98
99
100 bool LaTeXFeatures::isAvailable(string const &)
101 {
102         return true;
103 }
104
105
106 string alignmentToCSS(LyXAlignment)
107 {
108         return string();
109 }
110
111 //
112 // Dummy FontMetrics (needed by Length)
113 //
114
115 namespace frontend {
116 class FontMetrics {
117         int em() const { return 0; };
118 };
119 }
120
121 class FontInfo;
122
123 frontend::FontMetrics const & theFontMetrics(FontInfo const &) {
124         static frontend::FontMetrics dummy;
125         return dummy;
126 }
127
128 //
129 // Keep the linker happy on Windows
130 //
131
132 void lyx_exit(int)
133 {}
134
135 }