]> git.lyx.org Git - lyx.git/blob - src/insets/insetref.h
a64e02d27e64a008f8e6d0b91f403c934f06de6f
[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() { return new InsetRef (getCommand(), master); }
45         ///
46         Inset::Code LyxCode() const { return Inset::REF_CODE; }
47         ///
48         void Edit(int, int);
49         ///
50         unsigned char Editable() const {
51                 return 1;
52         }
53         ///
54         bool Display() const { return false; }
55         ///
56         string getScreenLabel() const;
57         ///
58         InsetRef::Ref_Flags getFlag() { return flag; }
59         ///
60         void setFlag(InsetRef::Ref_Flags f) { flag = f; }
61         ///
62         void gotoLabel();
63         ///
64         int Latex(FILE *file, signed char fragile);
65         ///
66         int Latex(string &file, signed char fragile);
67         ///
68         int Linuxdoc(string &file);
69         ///
70         int DocBook(string &file);
71 private:
72         /// This function escapes 8-bit characters
73         string escape(string const &) const;
74         ///
75         Ref_Flags flag;
76         ///
77         Buffer *master;
78 };
79
80
81 inline
82 void InsetRef::gotoLabel()
83 {
84     if (master) {
85         master->gotoLabel(getContents());
86     }
87 }
88
89 #endif