[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
klfstyle.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfstyle.h
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2010 by Philippe Faist
5  * philippe.faist at bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id: klfstyle.h 464 2010-08-28 22:48:32Z philippe $ */
23 
24 #ifndef KLFSTYLE_H
25 #define KLFSTYLE_H
26 
27 #include <QList>
28 #include <QDataStream>
29 
30 #include <klfbackend.h>
31 
32 
37 struct KLF_EXPORT KLFStyle {
49  struct KLF_EXPORT BBoxExpand {
50  BBoxExpand(double t = -1, double r = -1, double b = -1, double l = -1)
51  : top(t), right(r), bottom(b), left(l) { }
52  BBoxExpand(const BBoxExpand& c) : top(c.top), right(c.right), bottom(c.bottom), left(c.left) { }
53 
54  inline bool valid() const { return top >= 0 && right >= 0 && bottom >= 0 && left >= 0; }
55 
56  double top;
57  double right;
58  double bottom;
59  double left;
60  inline const BBoxExpand& operator=(const BBoxExpand& other)
61  { top = other.top; right = other.right; bottom = other.bottom; left = other.left; return *this; }
62  inline bool operator==(const BBoxExpand& x) const
63  { return top == x.top && right == x.right && bottom == x.bottom && left == x.left; }
64  };
65 
66  KLFStyle(QString nm = QString(), unsigned long fgcol = qRgba(0,0,0,255),
67  unsigned long bgcol = qRgba(255,255,255,0),
68  const QString& mmode = QString(),
69  const QString& pre = QString(),
70  int dotsperinch = -1)
71  : name(nm), fg_color(fgcol), bg_color(bgcol), mathmode(mmode), preamble(pre),
72  dpi(dotsperinch)
73  {
74  }
75 
77  : name(), fg_color(input.fg_color), bg_color(input.bg_color), mathmode(input.mathmode),
78  preamble(input.preamble), dpi(input.dpi), overrideBBoxExpand()
79  {
80  }
81 
82  KLFStyle(const KLFStyle& o)
83  : name(o.name), fg_color(o.fg_color), bg_color(o.bg_color), mathmode(o.mathmode),
84  preamble(o.preamble), dpi(o.dpi), overrideBBoxExpand(o.overrideBBoxExpand)
85  {
86  }
87 
89  unsigned long fg_color;
90  unsigned long bg_color;
93  int dpi;
95 
96  inline const KLFStyle& operator=(const KLFStyle& o) {
97  name = o.name; fg_color = o.fg_color; bg_color = o.bg_color; mathmode = o.mathmode;
98  preamble = o.preamble; dpi = o.dpi; overrideBBoxExpand = o.overrideBBoxExpand;
99  return *this;
100  }
101 };
102 
104  ;
105 
107 
108 KLF_EXPORT QDataStream& operator<<(QDataStream& stream, const KLFStyle& style);
109 KLF_EXPORT QDataStream& operator>>(QDataStream& stream, KLFStyle& style);
110 // exact matches
111 KLF_EXPORT bool operator==(const KLFStyle& a, const KLFStyle& b);
112 
113 
114 
115 
116 #endif
BBoxExpand(const BBoxExpand &c)
Definition: klfstyle.h:52
int dpi
Definition: klfstyle.h:93
Q_DECLARE_METATYPE(KLFUnitChooser::Unit)
const char * style
Definition: klfutil.cpp:211
QString name
this may not always be set, it's only important in saved style list.
Definition: klfstyle.h:88
QString mathmode
Definition: klfstyle.h:91
bool operator==(const BBoxExpand &x) const
Definition: klfstyle.h:62
const BBoxExpand & operator=(const BBoxExpand &other)
Definition: klfstyle.h:60
KLFStyle(QString nm=QString(), unsigned long fgcol=qRgba(0, 0, 0, 255), unsigned long bgcol=qRgba(255, 255, 255, 0), const QString &mmode=QString(), const QString &pre=QString(), int dotsperinch=-1)
Definition: klfstyle.h:66
const KLFStyle & operator=(const KLFStyle &o)
Definition: klfstyle.h:96
KLFStyle(const KLFStyle &o)
Definition: klfstyle.h:82
KLF_EXPORT QDataStream & operator<<(QDataStream &stream, const KLFStyle &style)
Definition: klfstyle.cpp:40
BBoxExpand(double t=-1, double r=-1, double b=-1, double l=-1)
Definition: klfstyle.h:50
a structure memorizing parameters for bbox expansion
Definition: klfstyle.h:49
QString preamble
Definition: klfstyle.h:92
A Formula Style (collection of properties)
Definition: klfstyle.h:37
BBoxExpand overrideBBoxExpand
Definition: klfstyle.h:94
KLF_EXPORT QDataStream & operator>>(QDataStream &stream, KLFStyle &style)
Definition: klfstyle.cpp:52
KLFStyle(const KLFBackend::klfInput &input)
Definition: klfstyle.h:76
bool valid() const
Definition: klfstyle.h:54
QList< KLFStyle > KLFStyleList
Definition: klfstyle.h:104
unsigned long bg_color
Definition: klfstyle.h:90
KLF_EXPORT bool operator==(const KLFStyle &a, const KLFStyle &b)
Definition: klfstyle.cpp:77
unsigned long fg_color
Definition: klfstyle.h:89

Generated by doxygen 1.8.8