]> git.lyx.org Git - lyx.git/blob - src/insets/insetgraphicsParams.h
A couple of fixes from Herbert.
[lyx.git] / src / insets / insetgraphicsParams.h
1 // -*- C++ -*-
2 /* This file is part of
3  * =================================================
4  * 
5  *          LyX, The Document Processor
6  *          Copyright 1995 Matthias Ettrich.
7  *          Copyright 1995-2002 The LyX Team.
8  *
9  * \author Baruch Even
10  * \author Herbert Voss <voss@lyx.org>
11  * ================================================= */
12
13 #ifndef INSETGRAPHICSPARAMS_H
14 #define INSETGRAPHICSPARAMS_H
15
16 #ifdef __GNUG__
17 #pragma interface
18 #endif 
19
20 #include "LString.h"
21
22 #include "buffer.h"
23 #include "lyxlex.h"
24
25 using std::ostream;
26
27 /// This struct holds all the parameters needed by insetGraphics.
28 struct InsetGraphicsParams
29 {
30         /// How do we display the image?
31         enum DisplayType {
32             COLOR,              // full color range
33             GRAYSCALE,          // 256 shades of gray
34             MONOCHROME,         // In black and white.
35             NONE                // only keep a frame in place.
36         };
37         enum sizeType {
38             DEFAULT_SIZE,       // like none
39             WH,                 // width/height values
40             SCALE               // percentage value
41         };
42         /// Image filename.
43         string filename;
44         /// Do we have a subcaption?
45         bool subcaption;
46         /// The text of the subcaption.
47         string subcaptionText;
48         /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
49         string bb;
50         /// clip image 
51         bool clip;
52         /// draft mode
53         bool draft;
54         /// How to display the image
55         DisplayType display;
56         /// any userdefined special command
57         string special;
58         /// three possible values for rescaling
59         LyXLength width;
60         ///
61         LyXLength height;
62         ///
63         int scale;
64         /// Type of rescaling
65         sizeType size_type;
66         /// Keep the ratio between height and width when resizing.
67         bool keepAspectRatio;
68         /// the size for the view inside lyx
69         LyXLength lyxwidth;
70         ///
71         LyXLength lyxheight;
72         /// Origin point of rotation
73         string rotateOrigin;
74         /// Rotation angle.
75         float rotateAngle;
76         ///
77         InsetGraphicsParams();
78         ///
79         InsetGraphicsParams(InsetGraphicsParams const &);
80         ///
81         InsetGraphicsParams & operator=(InsetGraphicsParams const &);
82         /// Save the parameters in the LyX format stream.
83         void Write(Buffer const * buf, ostream & os) const;
84         /// If the token belongs to our parameters, read it.
85         bool Read(Buffer const * buf, LyXLex & lex, string const & token);
86         /// Test the struct to make sure that all the options have legal values.
87         void testInvariant() const;
88
89 private:
90         /// Initialize the object to a default status.
91         void init();
92         /// Copy the other objects content to us, used in copy c-tor and assignment
93         void copy(InsetGraphicsParams const & params);
94 };
95
96 ///
97 bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
98 ///
99 bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
100
101 #endif