]> git.lyx.org Git - features.git/blob - src/insets/insetbib.h
continue the crusade to get rid of current_view
[features.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 // Created by Alejandro 970222
22
23
24 /** Used to insert citations  
25  */
26 class InsetCitation: public InsetCommand {
27 public:
28         ///
29         InsetCitation() : InsetCommand("cite") {}
30         ///
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, int);
42         ///
43         unsigned char Editable() const {
44                 return 1;
45         }
46 private:
47         ///
48         struct Holder {
49                 InsetCitation * inset;
50                 BufferView * view;
51         };
52
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         InsetBibKey(string const & key, string const & label = string());
69         ///
70         InsetBibKey(InsetBibKey const *);
71         ///
72         ~InsetBibKey();
73         ///
74         Inset * Clone() const { return new InsetBibKey(this); }
75         /// Currently \bibitem is used as a LyX2.x command, so we need this method.
76         void Write(ostream &) const;
77         ///
78         virtual string getScreenLabel() const;
79         ///
80         void Edit(BufferView *, int, int);
81         ///
82         unsigned char Editable() const {
83                 return 1;
84         }
85         /// A user can't neither insert nor delete this inset
86         bool Deletable() const {
87                 return false;
88         }
89         ///
90         void setCounter(int);
91         ///
92         int  getCounter() const { return counter; }
93
94  private:
95         ///
96         int counter;
97         ///
98         struct Holder {
99                 InsetBibKey * inset;
100                 BufferView * view;
101         };
102
103         ///
104         Holder holder;
105 };
106
107
108 /** Used to insert BibTeX's information 
109   */
110 class InsetBibtex: public InsetCommand {
111 public:
112         /// 
113         InsetBibtex() : InsetCommand("BibTeX") { owner = 0; }
114         ///
115         InsetBibtex(string const & dbase, string const & style,
116                     Buffer *);
117         ///
118         Inset * Clone() const {
119                 return new InsetBibtex(contents, options, 0);
120         }
121         ///  
122         Inset::Code LyxCode() const
123         {
124                 return Inset::BIBTEX_CODE;
125         }
126         ///
127         string getScreenLabel() const;
128         ///
129         void Edit(BufferView *, int, int);
130         /// 
131         int Latex(ostream &, signed char) const;
132         ///
133         int Latex(string & file, signed char fragile) const;
134         ///
135         string getKeys(char delim);
136         ///
137         unsigned char Editable() const {
138                 return 1;
139         }
140         ///
141         bool addDatabase(string const &);
142         ///
143         bool delDatabase(string const &);
144         ///
145         bool display() const { return true; }    
146 private:
147         ///
148         mutable Buffer * owner;
149 };
150
151 #endif