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