Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
paper.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Inkscape Paper Sizes
4 *
5 * Authors:
6 *
7 * Copyright (C) 2013 AUTHORS
8 *
9 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
10 */
11
12#include <string>
13#include <vector>
14#include <2geom/point.h>
15
16#include "units.h"
17
18#ifndef INKSCAPE_UTIL_PAPER_H
19#define INKSCAPE_UTIL_PAPER_H
20
21namespace Inkscape {
22
27{
28public:
29 PaperSize();
30 PaperSize(std::string name, double width, double height, Inkscape::Util::Unit const *unit);
31 PaperSize(const PaperSize &other) { assign(other); }
32 PaperSize &operator=(const PaperSize &other) { assign(other); return *this; }
33
34 ~PaperSize() = default;
35
36 std::string name;
38 double width;
39 double height;
41
42 std::string getDescription(bool landscape) const;
43 static std::string toDimsString(double x, double y, Util::Unit const *unit);
44
45 static const std::vector<PaperSize>& getPageSizes();
46 static const PaperSize *findPaperSize(double width, double height, Inkscape::Util::Unit const *unit);
47
48 static std::string toDescription(std::string name, double x, double y, Inkscape::Util::Unit const *unit);
49private:
50 void assign(const PaperSize &other);
51 static std::string formatNumber(double val);
52};
53
54} // namespace Inkscape
55
56#endif // define INKSCAPE_UTIL_UNITS_H
57/*
58 Local Variables:
59 mode:c++
60 c-file-style:"stroustrup"
61 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
62 indent-tabs-mode:nil
63 fill-column:99
64 End:
65*/
66// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Cartesian point / 2D vector and related operations.
Two-dimensional point that doubles as a vector.
Definition point.h:66
Data class used to store common paper dimensions from pages.csv.
Definition paper.h:27
PaperSize(const PaperSize &other)
Definition paper.h:31
Inkscape::Util::Unit const * unit
Definition paper.h:40
Geom::Point size
Definition paper.h:37
static const std::vector< PaperSize > & getPageSizes()
Returns a list of page sizes.
Definition paper.cpp:26
static std::string toDescription(std::string name, double x, double y, Inkscape::Util::Unit const *unit)
Definition paper.cpp:87
static std::string toDimsString(double x, double y, Util::Unit const *unit)
Definition paper.cpp:82
std::string getDescription(bool landscape) const
pointer to object in UnitTable, do not delete
Definition paper.cpp:78
static const PaperSize * findPaperSize(double width, double height, Inkscape::Util::Unit const *unit)
Returns a matching paper size, if possible.
Definition paper.cpp:120
static std::string formatNumber(double val)
Definition paper.cpp:95
std::string name
Definition paper.h:36
void assign(const PaperSize &other)
Definition paper.cpp:107
PaperSize & operator=(const PaperSize &other)
Definition paper.h:32
Helper class to stream background task notifications as a series of messages.