]> git.lyx.org Git - lyx.git/blob - src/insets/insetref.h
5bc8b0437bb0d30ced6be95a1da451e54bc9c69a
[lyx.git] / src / insets / insetref.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *       
7  *          Copyright (C) 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,
31                 ///
32                 PAGE_REF
33         };
34         
35         ///
36         InsetRef() : InsetCommand("ref") { flag = InsetRef::REF; }
37         ///
38         InsetRef(string const &, Buffer *);
39         ///
40         InsetRef(InsetCommand const &, Buffer *);
41         ///
42         ~InsetRef();
43         ///
44         Inset * Clone() const {
45                 return new InsetRef (getCommand(), master);
46         }
47         ///
48         Inset::Code LyxCode() const { return Inset::REF_CODE; }
49         ///
50         void Edit(int, int);
51         ///
52         unsigned char Editable() const {
53                 return 1;
54         }
55         ///
56         bool display() const { return false; }
57         ///
58         string getScreenLabel() const;
59         ///
60         InsetRef::Ref_Flags getFlag() { return flag; }
61         ///
62         void setFlag(InsetRef::Ref_Flags f) { flag = f; }
63         ///
64         void gotoLabel();
65         ///
66         int Latex(FILE * file, signed char fragile);
67         ///
68         int Latex(string & file, signed char fragile);
69         ///
70         int Linuxdoc(string & file);
71         ///
72         int DocBook(string & file);
73 private:
74         /// This function escapes 8-bit characters
75         string escape(string const &) const;
76         ///
77         Ref_Flags flag;
78         ///
79         Buffer * master;
80 };
81
82
83 inline
84 void InsetRef::gotoLabel()
85 {
86     if (master) {
87         master->gotoLabel(getContents());
88     }
89 }
90 #endif