1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This is the bullet class definition file.
|
|
|
|
* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
1999-10-02 16:21:10 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-10-02 16:21:10 +00:00
|
|
|
* This file Copyright 1997-1999
|
|
|
|
* Allan Rae
|
1999-11-15 12:01:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
#ifndef BULLET_H
|
|
|
|
#define BULLET_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
///
|
|
|
|
class Bullet {
|
|
|
|
public:
|
|
|
|
///
|
2000-05-09 16:18:31 +00:00
|
|
|
Bullet(int f = -1, int c = -1, int s = -1);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit Bullet(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
void setCharacter(int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
void setFont(int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
void setSize(int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
void setText(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int getCharacter() const;
|
|
|
|
///
|
|
|
|
int getFont() const;
|
|
|
|
///
|
|
|
|
int getSize() const;
|
|
|
|
///
|
2000-05-24 19:02:41 +00:00
|
|
|
string const & getText() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
Bullet & operator=(Bullet const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
friend bool operator==(Bullet const &, Bullet const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
protected:
|
1999-12-16 14:16:42 +00:00
|
|
|
#ifdef ENABLE_ASSERTIONS
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2001-07-29 15:34:18 +00:00
|
|
|
void testInvariant() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|
|
|
|
private:
|
|
|
|
/**
|
2000-02-04 09:38:32 +00:00
|
|
|
This enum makes adding additional panels or changing panel sizes
|
|
|
|
easier. Since you only need change these values for all tests to
|
|
|
|
be correct for the new values.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-02-04 09:38:32 +00:00
|
|
|
Note: MAX means the size of the array so to test you need:
|
|
|
|
(x < MAX) *not* (x <= MAX)
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
enum {
|
|
|
|
///
|
|
|
|
MIN = -1,
|
|
|
|
///
|
|
|
|
FONTMAX = 6,
|
|
|
|
///
|
|
|
|
CHARMAX = 36,
|
|
|
|
///
|
|
|
|
SIZEMAX = 10
|
|
|
|
};
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-05-24 19:02:41 +00:00
|
|
|
void generateText() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-10-01 15:31:59 +00:00
|
|
|
static string const bulletSize(int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-10-01 15:31:59 +00:00
|
|
|
static string const bulletEntry(int, int);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-27 13:52:39 +00:00
|
|
|
int font;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-27 13:52:39 +00:00
|
|
|
int character;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-27 13:52:39 +00:00
|
|
|
int size;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
// size, character and font are array indices to access
|
1999-09-27 18:44:28 +00:00
|
|
|
// the predefined arrays of LaTeX equivalent strings.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** flag indicates if user has control of text (1)
|
2000-02-04 09:38:32 +00:00
|
|
|
or if I can use it to generate strings (0)
|
|
|
|
or have already (-1)
|
|
|
|
*/
|
2002-03-21 17:27:08 +00:00
|
|
|
mutable short user_text;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
//NOTE: Arranging these four shorts above to be together
|
|
|
|
// like this should ensure they are in a single cache line
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** text may contain a user-defined LaTeX symbol command
|
2000-02-04 09:38:32 +00:00
|
|
|
or one generated internally from the font, character
|
|
|
|
and size settings.
|
|
|
|
*/
|
2000-05-24 19:02:41 +00:00
|
|
|
mutable string text;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-03-07 01:14:37 +00:00
|
|
|
inline
|
2000-09-14 17:53:12 +00:00
|
|
|
bool operator!=(Bullet const & b1, Bullet const & b2)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2000-09-14 17:53:12 +00:00
|
|
|
return !(b1 == b2);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
extern
|
|
|
|
Bullet const ITEMIZE_DEFAULTS[];
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif /* BULLET_H_ */
|