]> git.lyx.org Git - lyx.git/blob - src/insets/InsetGraphicsParams.h
Move Lexer to support/ directory (and lyx::support namespace)
[lyx.git] / src / insets / InsetGraphicsParams.h
1 // -*- C++ -*-
2 /**
3  * \file InsetGraphicsParams.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Baruch Even
8  * \author Herbert Voß
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSETGRAPHICSPARAMS_H
14 #define INSETGRAPHICSPARAMS_H
15
16
17 #include "graphics/GraphicsParams.h"
18
19 #include "support/FileName.h"
20
21 #include <string>
22
23 namespace lyx {
24
25 namespace graphics { class Params; }
26 namespace support { class Lexer; }
27
28 class Buffer;
29
30
31 /// This class holds all the parameters needed by insetGraphics.
32 class InsetGraphicsParams
33 {
34 public:
35         /// Image filename.
36         support::DocFileName filename;
37         /// Scaling the Screen inside Lyx
38         unsigned int lyxscale;
39         /// If to display the image inside LyX
40         bool display;
41         /// Scaling for output (LaTeX)
42         std::string scale;
43         /// sizes for output (LaTeX)
44         Length width;
45         ///
46         Length height;
47         /// Keep the ratio between height and width when resizing.
48         bool keepAspectRatio;
49         /// draft mode
50         bool draft;
51         /// scale image before rotating
52         bool scaleBeforeRotation;
53
54         /// The bounding box
55         graphics::BoundingBox bbox;
56         /// clip image
57         bool clip;
58
59         /// Rotation angle.
60         std::string rotateAngle;
61         /// Origin point of rotation
62         std::string rotateOrigin;
63         /// any userdefined special command
64         std::string special;
65
66         /// Does this need to be handled specifically
67         /// in dark mode? (use by InsetInfo)
68         bool darkModeSensitive;
69
70         ///
71         InsetGraphicsParams();
72         ///
73         InsetGraphicsParams(InsetGraphicsParams const &);
74         ///
75         InsetGraphicsParams & operator=(InsetGraphicsParams const &);
76         /// Save the parameters in the LyX format stream.
77         /// Buffer is needed to figure out if a figure is embedded.
78         void Write(std::ostream & os, Buffer const & buf) const;
79         /// If the token belongs to our parameters, read it.
80         bool Read(support::Lexer & lex, std::string const & token, Buffer const & buf,
81                   bool allowOrigin);
82         /// convert
83         // Only a subset of InsetGraphicsParams is needed for display purposes.
84         // This function also interrogates lyxrc to ascertain whether
85         // to display or not.
86         graphics::Params as_grfxParams() const;
87
88         // FIXME UNICODE. Write functions need to use odostream instead of ostream firstly.
89         /// Identification of the graphics template. No template equals empty string.
90         std::string groupId;
91 private:
92         /// Initialize the object to a default status.
93         void init();
94         /// Copy the other objects content to us, used in copy c-tor and assignment
95         void copy(InsetGraphicsParams const & params);
96 };
97
98 ///
99 bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
100 ///
101 bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
102
103 } // namespace lyx
104
105 #endif