]> git.lyx.org Git - lyx.git/blob - src/insets/insetgraphicsParams.h
Asymptotic approach to a well-designed graphics loader.
[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 namespace grfx {
26         class Params;
27 }
28
29 /// This struct holds all the parameters needed by insetGraphics.
30 struct InsetGraphicsParams
31 {
32         /// How do we display the image?
33         enum DisplayType {
34             DEFAULT,            // whatever is in lyxrc.display_graphics
35             COLOR,              // full color range
36             GRAYSCALE,          // 256 shades of gray
37             MONOCHROME,         // In black and white.
38             NONE                // only keep a frame in place.
39         };
40         ///
41         enum sizeType {         // for latex and/or lyx
42             DEFAULT_SIZE,       // like none
43             WH,                 // width/height values
44             SCALE               // percentage value
45         };
46         /// Image filename.
47         string filename;
48         /// Do we have a subcaption?
49         bool subcaption;
50         /// The text of the subcaption.
51         string subcaptionText;
52         /// Do we rotate?
53         bool rotate;
54         /// Origin point of rotation
55         string rotateOrigin;
56         /// Rotation angle.
57         float rotateAngle;
58         /// clip image
59         bool clip;
60         /// draft mode
61         bool draft;
62         /// what to do with zipped files
63         bool noUnzip;
64         /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
65         string bb;
66         /// Type of rescaling
67         sizeType size_type;
68         /// three possible values for rescaling (latex)
69         LyXLength width;
70         ///
71         LyXLength height;
72         ///
73         int scale;
74         /// Keep the ratio between height and width when resizing.
75         bool keepAspectRatio;
76         /// any userdefined special command
77         string special;
78         /// How to display the image inside lyx
79         DisplayType display;
80         /// Typ of the LyXView, same as for latex
81         sizeType lyxsize_type;
82         /// the size for the view inside lyx
83         LyXLength lyxwidth;
84         ///
85         LyXLength lyxheight;
86         /// Typ of rescaling the Screen inside lyx
87         int lyxscale;
88         ///
89         InsetGraphicsParams();
90         ///
91         InsetGraphicsParams(InsetGraphicsParams const &);
92         ///
93         InsetGraphicsParams & operator=(InsetGraphicsParams const &);
94         /// Save the parameters in the LyX format stream.
95         void Write(std::ostream & os) const;
96         /// If the token belongs to our parameters, read it.
97         bool Read(LyXLex & lex, string const & token);
98         /// convert
99   // Only a subset of InsetGraphicsParams is needed for display purposes.
100   // This function also interrogates lyxrc to ascertain whether
101   // to display or not.
102         grfx::Params as_grfxParams(string const & filepath) const;
103
104 private:
105         /// Initialize the object to a default status.
106         void init();
107         /// Copy the other objects content to us, used in copy c-tor and assignment
108         void copy(InsetGraphicsParams const & params);
109 };
110
111 ///
112 bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
113 ///
114 bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
115
116 #endif