1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright (C) 1997 LyX Team (this file was created this year)
|
|
|
|
*
|
1999-11-15 10:58:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef INSET_REF_H
|
|
|
|
#define INSET_REF_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "insetcommand.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
|
|
|
|
struct LaTeXFeatures;
|
|
|
|
|
|
|
|
/** The reference inset
|
|
|
|
*/
|
|
|
|
class InsetRef: public InsetCommand {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
enum Ref_Flags {
|
|
|
|
///
|
|
|
|
REF,
|
|
|
|
///
|
|
|
|
PAGE_REF
|
|
|
|
};
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
InsetRef() : InsetCommand("ref") { flag = InsetRef::REF; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
InsetRef(string const &, Buffer *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
InsetRef(InsetCommand const &, Buffer *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
Inset * Clone() const {
|
1999-11-22 16:19:48 +00:00
|
|
|
return new InsetRef (getCommand(), master);
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
Inset::Code LyxCode() const { return Inset::REF_CODE; }
|
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void Edit(BufferView *, int, int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
unsigned char Editable() const {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
bool display() const { return false; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string getScreenLabel() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
InsetRef::Ref_Flags getFlag() { return flag; }
|
|
|
|
///
|
|
|
|
void setFlag(InsetRef::Ref_Flags f) { flag = f; }
|
|
|
|
///
|
|
|
|
void gotoLabel();
|
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int Latex(ostream &, signed char fragile) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int Latex(string & file, signed char fragile) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int Linuxdoc(string & file) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int DocBook(string & file) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
|
|
|
/// This function escapes 8-bit characters
|
1999-10-02 16:21:10 +00:00
|
|
|
string escape(string const &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
Ref_Flags flag;
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Buffer * master;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
void InsetRef::gotoLabel()
|
|
|
|
{
|
|
|
|
if (master) {
|
2000-01-08 21:02:58 +00:00
|
|
|
master->getUser()->gotoLabel(getContents());
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|