]> git.lyx.org Git - lyx.git/blob - src/insets/insetref.h
Some more changes for updating text-insets.
[lyx.git] / src / insets / insetref.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1997 LyX Team (this file was created this year)
8  * 
9  * ====================================================== */
10
11 #ifndef INSET_REF_H
12 #define INSET_REF_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "insetcommand.h"
19 #include "buffer.h"
20
21 struct LaTeXFeatures;
22
23 /** The reference inset  
24  */
25 class InsetRef: public InsetCommand {
26 public:
27         ///
28         enum Ref_Flags {
29                 ///
30                 REF = 0,
31                 ///
32                 PAGE_REF,
33                 ///
34                 VREF,
35                 ///
36                 VPAGE_REF,
37                 ///
38                 PRETTY_REF,
39                 ///
40                 REF_LAST = PRETTY_REF,
41                 ///
42                 REF_FIRST = REF
43         };
44         
45         ///
46         InsetRef() : InsetCommand("ref") { flag = InsetRef::REF; }
47         ///
48         InsetRef(string const &, Buffer *);
49         ///
50         InsetRef(InsetCommand const &, Buffer *);
51         ///
52         Inset * Clone() const {
53                 return new InsetRef (getCommand(), master);
54         }
55         ///
56         Inset::Code LyxCode() const { return Inset::REF_CODE; }
57         ///
58         void Edit(BufferView *, int, int, unsigned int);
59         ///
60         EDITABLE Editable() const {
61                 return IS_EDITABLE;
62         }
63         ///
64         bool display() const { return false; }
65         ///
66         string getScreenLabel() const;
67         ///
68         void Toggle();
69         ///
70         void gotoLabel();
71         ///
72         int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
73         ///
74         int Ascii(Buffer const *, std::ostream &) const;
75         ///
76         int Linuxdoc(Buffer const *, std::ostream &) const;
77         ///
78         int DocBook(Buffer const *, std::ostream &) const;
79         ///
80         void Validate(LaTeXFeatures & features) const;
81 private:
82         ///
83         void GenerateFlag();
84         /// This function escapes 8-bit characters
85         string escape(string const &) const;
86         ///
87         Ref_Flags flag;
88         ///
89         Buffer * master;
90 };
91
92
93 inline
94 void InsetRef::gotoLabel()
95 {
96     if (master) {
97         master->getUser()->gotoLabel(getContents());
98     }
99 }
100 #endif