]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsParams.h
1f633e768560c795f93652f42cf28a43deb163a7
[lyx.git] / src / graphics / GraphicsParams.h
1 // -*- C++ -*-
2 /**
3  * \file GraphicsParams.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  *
11  * Used internally by the lyx::graphics::Image.
12  */
13
14 #ifndef GRAPHICSPARAMS_H
15 #define GRAPHICSPARAMS_H
16
17 #include "GraphicsTypes.h"
18
19 #include <string>
20 #include <iosfwd>
21
22
23 namespace lyx {
24 namespace graphics {
25
26 /** Parse a string of the form "200pt 500pt 300mm 5in" into a
27  *  usable bounding box.
28  */
29 class BoundingBox {
30 public:
31         ///
32         BoundingBox();
33         ///
34         BoundingBox(std::string const &);
35
36         /// 0 0 0 0 is empty!
37         bool empty() const;
38
39         unsigned int xl;
40         unsigned int yb;
41         unsigned int xr;
42         unsigned int yt;
43 };
44
45 bool operator==(BoundingBox const &, BoundingBox const &);
46 bool operator!=(BoundingBox const &, BoundingBox const &);
47
48 std::ostream & operator<<(std::ostream &, BoundingBox const &);
49
50
51 class Params
52 {
53 public:
54         Params();
55
56         DisplayType display;
57         unsigned int scale;
58
59         /// The image filename.
60         std::string filename;
61
62         /** Note that the BoundingBox is always relative to the BoundingBox
63          *  as stored in the EPS file.
64          *  Ie, bb.xl and bb.yb == 0 if that corner is not moved.
65          */
66         BoundingBox bb;
67
68         /** The size of the view inside lyx in pixels or the scaling of the
69          *  image.
70          */
71         /// Rotation angle.
72         float angle;
73 };
74
75 bool operator==(Params const &, Params const &);
76 bool operator!=(Params const &, Params const &);
77
78 } // namespace graphics
79 } // namespace lyx
80
81 #endif // GRAPHICSPARAMS_H