]> git.lyx.org Git - lyx.git/blob - src/insets/insetref.h
some using changes small changes in lyxfont and some other things, read the Changelog
[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 using std::ostream;
22
23 struct LaTeXFeatures;
24
25 /** The reference inset  
26  */
27 class InsetRef: public InsetCommand {
28 public:
29         ///
30         enum Ref_Flags {
31                 ///
32                 REF,
33                 ///
34                 PAGE_REF
35         };
36         
37         ///
38         InsetRef() : InsetCommand("ref") { flag = InsetRef::REF; }
39         ///
40         InsetRef(string const &, Buffer *);
41         ///
42         InsetRef(InsetCommand const &, Buffer *);
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(BufferView *, int, int, unsigned int);
51         ///
52         EDITABLE Editable() const {
53                 return IS_EDITABLE;
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(ostream &, signed char fragile, bool free_spc) const;
67         ///
68         int Linuxdoc(ostream &) const;
69         ///
70         int DocBook(ostream &) const;
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->getUser()->gotoLabel(getContents());
86     }
87 }
88 #endif