]> git.lyx.org Git - lyx.git/blob - src/insets/insetgraphicsParams.h
Forgot to add this files.
[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-2000 The LyX Team.
8  *
9  *          This file Copyright 2000 Baruch Even
10  * ================================================= */
11
12 #ifndef INSETGRAPHICSPARAMS_H
13 #define INSETGRAPHICSPARAMS_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <config.h>
20
21 #include "LString.h"
22
23 #include "buffer.h"
24 #include "lyxlex.h"
25
26 using std::ostream;
27
28 /// This struct holds all the parameters needed by insetGraphics.
29 struct InsetGraphicsParams {
30     /// Image filename.
31     string filename;
32     
33     /// How do we display the image?
34     enum DisplayType {
35         /// In full color range (if it's not in color we show it as it is)
36         COLOR,
37         /// In Grayscale (256 shades of gray).
38         GRAYSCALE,
39         /// In black and white.
40         MONOCHROME,
41         /// Don't display it on screen, only keep a frame in place.
42         NONE
43     };
44
45     /// How to display the image
46     DisplayType display;
47
48     /// Is the figure inlined? (not in a paragraph of its own).
49     bool inlineFigure;
50
51     /// Do we have a subcaption?
52     bool subcaption;
53
54     /// The text of the subcaption.
55     string subcaptionText;
56     
57         /// This is the different origins that the graphicx package support.
58         enum Origin {
59                 DEFAULT,
60                 LEFTTOP,
61                 LEFTCENTER,
62                 LEFTBASELINE,
63                 LEFTBOTTOM,
64                 CENTERTOP,
65                 CENTER,
66                 CENTERBASELINE,
67                 CENTERBOTTOM,
68                 RIGHTTOP,
69                 RIGHTCENTER,
70                 RIGHTBASELINE,
71                 RIGHTBOTTOM,
72                 REFERENCE_POINT = LEFTBASELINE
73         };
74
75     /// The resize of the image, is it the default size, in cm, inch or
76     /// percentage of the page/column width/height
77     enum Resize {
78         DEFAULT_SIZE,
79         CM,
80         INCH,
81         PERCENT_PAGE,
82         PERCENT_COLUMN
83     };
84
85     
86     /// Keep the ratio between height and width when resizing.
87     bool keepAspectRatio;
88
89     // What width resize to do?
90     Resize widthResize;
91     // Value of width resize
92     float widthSize;
93     // What height resize to do?
94     Resize heightResize;
95     // Value of height resize
96     float heightSize;
97
98     // Origin point of rotation
99     Origin rotateOrigin;
100     // Rotation angle.
101     int rotateAngle;
102
103     InsetGraphicsParams();
104
105     InsetGraphicsParams(InsetGraphicsParams const &);
106     InsetGraphicsParams const & operator=(InsetGraphicsParams const &);
107
108     /// Save the parameters in the LyX format stream.
109     void Write(Buffer const * buf, ostream & os) const;
110     
111     /// If the token belongs to our parameters, read it.
112     bool Read(Buffer const * buf, LyXLex & lex, string const & token);
113     
114     /// Test the struct to make sure that all the options have legal values.
115     void testInvariant() const;
116
117 private:
118     /// Initialize the object to a default status.
119     void init();
120
121     /// Copy the other objects content to us, used in copy c-tor and assignment
122     void copy(InsetGraphicsParams const & params);
123 };
124
125 bool operator==(InsetGraphicsParams const&, InsetGraphicsParams const &);
126
127 #endif