]> git.lyx.org Git - lyx.git/blob - src/insets/insetbib.h
clear()->erase() ; lots of using directives for cxx
[lyx.git] / src / insets / insetbib.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  * 
10  * ====================================================== */
11
12 #ifndef INSET_BIB_H
13 #define INSET_BIB_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "insetcommand.h"
20
21 class Buffer;
22
23 /** Used to insert citations  
24  */
25 class InsetCitation: public InsetCommand {
26 public:
27         ///
28         InsetCitation() : InsetCommand("cite") {}
29         ///
30         explicit
31         InsetCitation(string const & key, string const & note = string());
32         ///
33         ~InsetCitation();
34         ///
35         Inset * Clone() const {
36                 return new InsetCitation(contents, options);
37         }
38         ///
39         string getScreenLabel()const;
40         ///
41         void Edit(BufferView *, int x, int y, unsigned int button);
42         ///
43         EDITABLE Editable() const {
44                 return IS_EDITABLE;
45         }
46         ///
47         struct Holder {
48                 InsetCitation * inset;
49                 BufferView * view;
50         };
51
52 private:
53         ///
54         Holder holder;
55 };
56
57
58 /** Used to insert bibitem's information (key and label)
59   
60   Must be automatically inserted as the first object in a
61   bibliography paragraph. 
62   */
63 class InsetBibKey: public InsetCommand {
64 public:
65         ///
66         InsetBibKey() : InsetCommand("bibitem") { counter = 1; }
67         ///
68         explicit
69         InsetBibKey(string const & key, string const & label = string());
70         ///
71         explicit
72         InsetBibKey(InsetBibKey const *);
73         ///
74         ~InsetBibKey();
75         ///
76         Inset * Clone() const { return new InsetBibKey(this); }
77         /// Currently \bibitem is used as a LyX2.x command, so we need this method.
78         void Write(std::ostream &) const;
79         ///
80         virtual string getScreenLabel() const;
81         ///
82         void Edit(BufferView *, int x, int y, unsigned int button);
83         ///
84         EDITABLE Editable() const {
85                 return IS_EDITABLE;
86         }
87         /// A user can't neither insert nor delete this inset
88         bool Deletable() const {
89                 return false;
90         }
91         ///
92         void setCounter(int);
93         ///
94         int  getCounter() const { return counter; }
95         ///
96         struct Holder {
97                 InsetBibKey * inset;
98                 BufferView * view;
99         };
100
101  private:
102         ///
103         int counter;
104
105         ///
106         Holder holder;
107 };
108
109
110 /** Used to insert BibTeX's information 
111   */
112 class InsetBibtex: public InsetCommand {
113 public:
114         /// 
115         InsetBibtex() : InsetCommand("BibTeX") { owner = 0; }
116         ///
117         InsetBibtex(string const & dbase, string const & style,
118                     Buffer *);
119         ///
120         ~InsetBibtex();
121
122         ///
123         Inset * Clone() const {
124                 return new InsetBibtex(contents, options, 0);
125         }
126         ///  
127         Inset::Code LyxCode() const
128         {
129                 return Inset::BIBTEX_CODE;
130         }
131         ///
132         string getScreenLabel() const;
133         ///
134         void Edit(BufferView *, int x, int y, unsigned int button);
135         /// 
136         int Latex(std::ostream &, bool fragile, bool freespace) const;
137         ///
138         string getKeys(char delim);
139         ///
140         EDITABLE Editable() const {
141                 return IS_EDITABLE;
142         }
143         ///
144         bool addDatabase(string const &);
145         ///
146         bool delDatabase(string const &);
147         ///
148         bool display() const { return true; } 
149
150         struct Holder {
151                 InsetBibtex * inset;
152                 BufferView * view;
153         };
154
155 private:
156         ///
157         mutable Buffer * owner;
158
159         ///
160         Holder holder;
161 };
162
163 #endif