summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/StyleConsts.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/apps/opie-reader/StyleConsts.h b/noncore/apps/opie-reader/StyleConsts.h
index 29d7501..5817b54 100644
--- a/noncore/apps/opie-reader/StyleConsts.h
+++ b/noncore/apps/opie-reader/StyleConsts.h
@@ -1,190 +1,188 @@
1#ifndef __STYLECONSTS_H 1#ifndef __STYLECONSTS_H
2#define __STYLECONSTS_H 2#define __STYLECONSTS_H
3 3
4typedef unsigned short StyleType; 4typedef unsigned short StyleType;
5 5
6#ifdef _WINDOWS
7#include <string.h> 6#include <string.h>
8#endif
9#include <stdlib.h> 7#include <stdlib.h>
10#include <qglobal.h> 8#include <qglobal.h>
11class QImage; 9class QImage;
12 10
13struct GraphicLink 11struct GraphicLink
14{ 12{
15 QImage* graphic; 13 QImage* graphic;
16 bool isLink; 14 bool isLink;
17 unsigned long link; 15 unsigned long link;
18 GraphicLink(QImage* p, bool isLnk, unsigned long tgt) : 16 GraphicLink(QImage* p, bool isLnk, unsigned long tgt) :
19 graphic(p), isLink(isLnk), link(tgt) {} 17 graphic(p), isLink(isLnk), link(tgt) {}
20 ~GraphicLink(); 18 ~GraphicLink();
21}; 19};
22 20
23struct pmstore 21struct pmstore
24{ 22{
25 unsigned int count; 23 unsigned int count;
26 bool m_isScaleable; 24 bool m_isScaleable;
27 GraphicLink* graphic; 25 GraphicLink* graphic;
28 pmstore(bool _canScale, QImage* p, bool isLnk, unsigned long tgt) : count(1), m_isScaleable(_canScale) 26 pmstore(bool _canScale, QImage* p, bool isLnk, unsigned long tgt) : count(1), m_isScaleable(_canScale)
29 { 27 {
30 graphic = new GraphicLink(p, isLnk, tgt); 28 graphic = new GraphicLink(p, isLnk, tgt);
31 } 29 }
32 ~pmstore(); 30 ~pmstore();
33}; 31};
34 32
35enum EalignmentType 33enum EalignmentType
36{ 34{
37 m_AlignLeft, 35 m_AlignLeft,
38 m_AlignRight, 36 m_AlignRight,
39 m_AlignCentre, 37 m_AlignCentre,
40 m_AlignJustify 38 m_AlignJustify
41}; 39};
42 40
43class CBasicStyle 41class CBasicStyle
44{ 42{
45 friend class CStyle; 43 friend class CStyle;
46 bool m_bold, 44 bool m_bold,
47 m_italic; 45 m_italic;
48 int m_fontsize; 46 int m_fontsize;
49 EalignmentType m_align; 47 EalignmentType m_align;
50 unsigned char red, green, blue; 48 unsigned char red, green, blue;
51 unsigned long data; 49 unsigned long data;
52 bool isLink; 50 bool isLink;
53 bool m_underline; 51 bool m_underline;
54 bool m_strikethru; 52 bool m_strikethru;
55 bool m_monospaced; 53 bool m_monospaced;
56 unsigned char m_leftmargin, m_rightmargin; 54 unsigned char m_leftmargin, m_rightmargin;
57 signed char m_extraspace; 55 signed char m_extraspace;
58 signed char m_voffset; 56 signed char m_voffset;
59 CBasicStyle() 57 CBasicStyle()
60 { 58 {
61 unset(); 59 unset();
62 } 60 }
63 bool operator!=(const CBasicStyle& rhs) 61 bool operator!=(const CBasicStyle& rhs)
64 { 62 {
65 return (memcmp(this, &rhs, sizeof(CBasicStyle)) != 0); 63 return (memcmp(this, &rhs, sizeof(CBasicStyle)) != 0);
66 } 64 }
67 void unset() 65 void unset()
68 { 66 {
69 m_bold = false; 67 m_bold = false;
70 m_italic = false; 68 m_italic = false;
71 m_fontsize = 0; 69 m_fontsize = 0;
72 m_align = m_AlignLeft; 70 m_align = m_AlignLeft;
73 red = green = blue = 0; 71 red = green = blue = 0;
74 data = 0; 72 data = 0;
75 isLink = false; 73 isLink = false;
76 m_underline = false; 74 m_underline = false;
77 m_strikethru = false; 75 m_strikethru = false;
78 m_leftmargin = 0; 76 m_leftmargin = 0;
79 m_rightmargin = 0; 77 m_rightmargin = 0;
80 m_monospaced = false; 78 m_monospaced = false;
81 m_extraspace = 0; 79 m_extraspace = 0;
82 m_voffset = 0; 80 m_voffset = 0;
83 } 81 }
84}; 82};
85 83
86class CStyle 84class CStyle
87{ 85{
88 CBasicStyle sty; 86 CBasicStyle sty;
89 pmstore* graphic; 87 pmstore* graphic;
90 public: 88 public:
91 signed char getVOffset() { return sty.m_voffset; } 89 signed char getVOffset() { return sty.m_voffset; }
92 void setVOffset(signed char sp) { sty.m_voffset = sp; } 90 void setVOffset(signed char sp) { sty.m_voffset = sp; }
93 signed char getExtraSpace() { return sty.m_extraspace; } 91 signed char getExtraSpace() { return sty.m_extraspace; }
94 void setExtraSpace(signed char sp) { sty.m_extraspace = sp; } 92 void setExtraSpace(signed char sp) { sty.m_extraspace = sp; }
95 bool getPictureLink() 93 bool getPictureLink()
96 { 94 {
97 return (graphic != NULL && graphic->graphic->isLink); 95 return (graphic != NULL && graphic->graphic->isLink);
98 } 96 }
99 unsigned long getPictureLinkData() 97 unsigned long getPictureLinkData()
100 { 98 {
101 return graphic->graphic->link; 99 return graphic->graphic->link;
102 } 100 }
103 void setLeftMargin(unsigned char m) { sty.m_leftmargin = m; } 101 void setLeftMargin(unsigned char m) { sty.m_leftmargin = m; }
104 unsigned char getLeftMargin() { return sty.m_leftmargin; } 102 unsigned char getLeftMargin() { return sty.m_leftmargin; }
105 void setRightMargin(unsigned char m) { sty.m_rightmargin = m; } 103 void setRightMargin(unsigned char m) { sty.m_rightmargin = m; }
106 unsigned char getRightMargin() { return sty.m_rightmargin; } 104 unsigned char getRightMargin() { return sty.m_rightmargin; }
107 unsigned char Red() { return sty.red; } 105 unsigned char Red() { return sty.red; }
108 unsigned char Green() { return sty.green; } 106 unsigned char Green() { return sty.green; }
109 unsigned char Blue() { return sty.blue; } 107 unsigned char Blue() { return sty.blue; }
110 void setColour(unsigned char r, unsigned char g, unsigned char b) 108 void setColour(unsigned char r, unsigned char g, unsigned char b)
111 { 109 {
112 sty.red = r; 110 sty.red = r;
113 sty.green = g; 111 sty.green = g;
114 sty.blue = b; 112 sty.blue = b;
115 } 113 }
116 CStyle() : graphic(NULL) {} 114 CStyle() : graphic(NULL) {}
117 ~CStyle(); 115 ~CStyle();
118// CStyle(CStyle&); 116// CStyle(CStyle&);
119 CStyle(const CStyle&); 117 CStyle(const CStyle&);
120 CStyle& operator=(const CStyle&); 118 CStyle& operator=(const CStyle&);
121 void unset(); 119 void unset();
122 bool isPicture() { return (graphic != NULL); } 120 bool isPicture() { return (graphic != NULL); }
123 bool canScale() { return graphic->m_isScaleable; } 121 bool canScale() { return graphic->m_isScaleable; }
124 void clearPicture(); 122 void clearPicture();
125 void setPicture(bool canScale, QImage* _g, bool il=false, unsigned long tgt=0); 123 void setPicture(bool canScale, QImage* _g, bool il=false, unsigned long tgt=0);
126 QImage* getPicture() 124 QImage* getPicture()
127 { 125 {
128 QImage* pm = ((graphic != NULL) ? graphic->graphic->graphic : NULL); 126 QImage* pm = ((graphic != NULL) ? graphic->graphic->graphic : NULL);
129 return pm; 127 return pm;
130 } 128 }
131 void setUnderline() { sty.m_underline = true; } 129 void setUnderline() { sty.m_underline = true; }
132 void unsetUnderline() { sty.m_underline = false; } 130 void unsetUnderline() { sty.m_underline = false; }
133 bool isUnderline() { return sty.m_underline; } 131 bool isUnderline() { return sty.m_underline; }
134 void setStrikethru() { sty.m_strikethru = true; } 132 void setStrikethru() { sty.m_strikethru = true; }
135 void unsetStrikethru() { sty.m_strikethru = false; } 133 void unsetStrikethru() { sty.m_strikethru = false; }
136 bool isStrikethru() { return sty.m_strikethru; } 134 bool isStrikethru() { return sty.m_strikethru; }
137 void setBold() { sty.m_bold = true; } 135 void setBold() { sty.m_bold = true; }
138 void unsetBold() { sty.m_bold = false; } 136 void unsetBold() { sty.m_bold = false; }
139 bool isBold() { return sty.m_bold; } 137 bool isBold() { return sty.m_bold; }
140 void setItalic() { sty.m_italic = true; } 138 void setItalic() { sty.m_italic = true; }
141 void unsetItalic() { sty.m_italic = false; } 139 void unsetItalic() { sty.m_italic = false; }
142 bool isItalic() { return sty.m_italic; } 140 bool isItalic() { return sty.m_italic; }
143 void setMono() { sty.m_monospaced = true; } 141 void setMono() { sty.m_monospaced = true; }
144 void unsetMono() { sty.m_monospaced = false; } 142 void unsetMono() { sty.m_monospaced = false; }
145 bool isMono() { return sty.m_monospaced; } 143 bool isMono() { return sty.m_monospaced; }
146 144
147 void setLeftJustify() 145 void setLeftJustify()
148 { 146 {
149 sty.m_align = m_AlignLeft; 147 sty.m_align = m_AlignLeft;
150 } 148 }
151 void setRightJustify() 149 void setRightJustify()
152 { 150 {
153 sty.m_align = m_AlignRight; 151 sty.m_align = m_AlignRight;
154 } 152 }
155 void setCentreJustify() 153 void setCentreJustify()
156 { 154 {
157 sty.m_align = m_AlignCentre; 155 sty.m_align = m_AlignCentre;
158 } 156 }
159 void setFullJustify() 157 void setFullJustify()
160 { 158 {
161 sty.m_align = m_AlignJustify; 159 sty.m_align = m_AlignJustify;
162 } 160 }
163 StyleType getJustify() 161 StyleType getJustify()
164 { 162 {
165 return sty.m_align; 163 return sty.m_align;
166 } 164 }
167 165
168 void setFontSize(int _fs) 166 void setFontSize(int _fs)
169 { 167 {
170 sty.m_fontsize = _fs; 168 sty.m_fontsize = _fs;
171 } 169 }
172 int getFontSize() const 170 int getFontSize() const
173 { 171 {
174 return sty.m_fontsize; 172 return sty.m_fontsize;
175 } 173 }
176 bool operator!=(const CStyle& rhs) 174 bool operator!=(const CStyle& rhs)
177 { 175 {
178 return 176 return
179 ( 177 (
180 (sty != rhs.sty) || 178 (sty != rhs.sty) ||
181 (graphic != rhs.graphic) 179 (graphic != rhs.graphic)
182 ); 180 );
183 } 181 }
184 void setLink(bool _l) { sty.isLink = _l; } 182 void setLink(bool _l) { sty.isLink = _l; }
185 bool getLink() { return sty.isLink; } 183 bool getLink() { return sty.isLink; }
186 void setData(unsigned long _d) { sty.data = _d; } 184 void setData(unsigned long _d) { sty.data = _d; }
187 unsigned long getData() { return sty.data; } 185 unsigned long getData() { return sty.data; }
188}; 186};
189 187
190#endif 188#endif