]> git.lyx.org Git - lyx.git/blob - src/insets/insetbib.h
Various updates for insets mostly regarding fixes for text-insets.
[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         InsetCitation(string const & key, string const & note = string());
31         ///
32         ~InsetCitation();
33         ///
34         Inset * Clone() const {
35                 return new InsetCitation(contents, options);
36         }
37         ///
38         string getScreenLabel()const;
39         ///
40         void Edit(BufferView *, int x, int y, unsigned int button);
41         ///
42         EDITABLE Editable() const {
43                 return IS_EDITABLE;
44         }
45         ///
46         struct Holder {
47                 InsetCitation * inset;
48                 BufferView * view;
49         };
50
51 private:
52         ///
53         Holder holder;
54 };
55
56
57 /** Used to insert bibitem's information (key and label)
58   
59   Must be automatically inserted as the first object in a
60   bibliography paragraph. 
61   */
62 class InsetBibKey: public InsetCommand {
63 public:
64         ///
65         InsetBibKey() : InsetCommand("bibitem") { counter = 1; }
66         ///
67         InsetBibKey(string const & key, string const & label = string());
68         ///
69         InsetBibKey(InsetBibKey const *);
70         ///
71         ~InsetBibKey();
72         ///
73         Inset * Clone() const { return new InsetBibKey(this); }
74         /// Currently \bibitem is used as a LyX2.x command, so we need this method.
75         void Write(ostream &) const;
76         ///
77         virtual string getScreenLabel() const;
78         ///
79         void Edit(BufferView *, int x, int y, unsigned int button);
80         ///
81         EDITABLE Editable() const {
82                 return IS_EDITABLE;
83         }
84         /// A user can't neither insert nor delete this inset
85         bool Deletable() const {
86                 return false;
87         }
88         ///
89         void setCounter(int);
90         ///
91         int  getCounter() const { return counter; }
92         ///
93         struct Holder {
94                 InsetBibKey * inset;
95                 BufferView * view;
96         };
97
98  private:
99         ///
100         int counter;
101
102         ///
103         Holder holder;
104 };
105
106
107 /** Used to insert BibTeX's information 
108   */
109 class InsetBibtex: public InsetCommand {
110 public:
111         /// 
112         InsetBibtex() : InsetCommand("BibTeX") { owner = 0; }
113         ///
114         InsetBibtex(string const & dbase, string const & style,
115                     Buffer *);
116         ///
117         Inset * Clone() const {
118                 return new InsetBibtex(contents, options, 0);
119         }
120         ///  
121         Inset::Code LyxCode() const
122         {
123                 return Inset::BIBTEX_CODE;
124         }
125         ///
126         string getScreenLabel() const;
127         ///
128         void Edit(BufferView *, int x, int y, unsigned int button);
129         /// 
130         int Latex(ostream &, signed char) const;
131 #ifndef USE_OSTREAM_ONLY
132         ///
133         int Latex(string & file, signed char fragile) const;
134 #endif
135         ///
136         string getKeys(char delim);
137         ///
138         EDITABLE Editable() const {
139                 return IS_EDITABLE;
140         }
141         ///
142         bool addDatabase(string const &);
143         ///
144         bool delDatabase(string const &);
145         ///
146         bool display() const { return true; }    
147 private:
148         ///
149         mutable Buffer * owner;
150 };
151
152 #endif