]> git.lyx.org Git - lyx.git/blob - src/insets/InsetGraphicsParams.h
172215dd2263cc3293f35c52e00607b78ea5a0dc
[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/GraphicsTypes.h"
18 #include "Length.h"
19 #include "support/FileName.h"
20
21 namespace lyx {
22
23 namespace graphics { class Params; }
24
25 class Lexer;
26 class Buffer;
27
28
29 /// This class holds all the parameters needed by insetGraphics.
30 class InsetGraphicsParams
31 {
32 public:
33         /// Image filename.
34         support::DocFileName filename;
35         /// Scaling the Screen inside Lyx
36         unsigned int lyxscale;
37         /// How to display the image inside LyX
38         graphics::DisplayType display;
39         /// Scaling for output (LaTeX)
40         std::string scale;
41         /// sizes for output (LaTeX)
42         Length width;
43         ///
44         Length height;
45         /// Keep the ratio between height and width when resizing.
46         bool keepAspectRatio;
47         /// draft mode
48         bool draft;
49         /// what to do with zipped files
50         bool noUnzip;
51         /// scale image before rotating
52         bool scaleBeforeRotation;
53
54         /// The bounding box with "xLB yLB yRT yRT ", divided by a space!
55         std::string bb;
56         /// clip image
57         bool clip;
58
59         /// Rotation angle.
60         std::string rotateAngle;
61         /// Origin point of rotation
62         std::string rotateOrigin;
63         /// Do we have a subcaption?
64         bool subcaption;
65         /// The text of the subcaption.
66         std::string subcaptionText;
67         /// any userdefined special command
68         std::string special;
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(Lexer & lex, std::string const & token, std::string const & bufpath);
81         /// convert
82   // Only a subset of InsetGraphicsParams is needed for display purposes.
83   // This function also interrogates lyxrc to ascertain whether
84   // to display or not.
85         graphics::Params as_grfxParams() const;
86
87 private:
88         /// Initialize the object to a default status.
89         void init();
90         /// Copy the other objects content to us, used in copy c-tor and assignment
91         void copy(InsetGraphicsParams const & params);
92 };
93
94 ///
95 bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
96 ///
97 bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
98
99 } // namespace lyx
100
101 #endif