Diffstat (limited to 'noncore/apps/opie-reader/StyleConsts.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/StyleConsts.h | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/noncore/apps/opie-reader/StyleConsts.h b/noncore/apps/opie-reader/StyleConsts.h index 9701d19..29d7501 100644 --- a/noncore/apps/opie-reader/StyleConsts.h +++ b/noncore/apps/opie-reader/StyleConsts.h | |||
@@ -1,31 +1,34 @@ | |||
1 | #ifndef __STYLECONSTS_H | 1 | #ifndef __STYLECONSTS_H |
2 | #define __STYLECONSTS_H | 2 | #define __STYLECONSTS_H |
3 | 3 | ||
4 | typedef unsigned short StyleType; | 4 | typedef unsigned short StyleType; |
5 | 5 | ||
6 | #include <stdlib.h> | 6 | #ifdef _WINDOWS |
7 | #include <string.h> | 7 | #include <string.h> |
8 | #endif | ||
9 | #include <stdlib.h> | ||
8 | #include <qglobal.h> | 10 | #include <qglobal.h> |
9 | class QPixmap; | 11 | class QImage; |
10 | 12 | ||
11 | struct GraphicLink | 13 | struct GraphicLink |
12 | { | 14 | { |
13 | QPixmap* graphic; | 15 | QImage* graphic; |
14 | bool isLink; | 16 | bool isLink; |
15 | unsigned long link; | 17 | unsigned long link; |
16 | GraphicLink(QPixmap* p, bool isLnk, unsigned long tgt) : | 18 | GraphicLink(QImage* p, bool isLnk, unsigned long tgt) : |
17 | graphic(p), isLink(isLnk), link(tgt) {} | 19 | graphic(p), isLink(isLnk), link(tgt) {} |
18 | ~GraphicLink(); | 20 | ~GraphicLink(); |
19 | }; | 21 | }; |
20 | 22 | ||
21 | struct pmstore | 23 | struct pmstore |
22 | { | 24 | { |
23 | unsigned int count; | 25 | unsigned int count; |
26 | bool m_isScaleable; | ||
24 | GraphicLink* graphic; | 27 | GraphicLink* graphic; |
25 | pmstore(QPixmap* p, bool isLnk, unsigned long tgt) : count(1) | 28 | pmstore(bool _canScale, QImage* p, bool isLnk, unsigned long tgt) : count(1), m_isScaleable(_canScale) |
26 | { | 29 | { |
27 | graphic = new GraphicLink(p, isLnk, tgt); | 30 | graphic = new GraphicLink(p, isLnk, tgt); |
28 | } | 31 | } |
29 | ~pmstore(); | 32 | ~pmstore(); |
30 | }; | 33 | }; |
31 | 34 | ||
@@ -48,12 +51,14 @@ class CBasicStyle | |||
48 | unsigned long data; | 51 | unsigned long data; |
49 | bool isLink; | 52 | bool isLink; |
50 | bool m_underline; | 53 | bool m_underline; |
51 | bool m_strikethru; | 54 | bool m_strikethru; |
52 | bool m_monospaced; | 55 | bool m_monospaced; |
53 | unsigned char m_leftmargin, m_rightmargin; | 56 | unsigned char m_leftmargin, m_rightmargin; |
57 | signed char m_extraspace; | ||
58 | signed char m_voffset; | ||
54 | CBasicStyle() | 59 | CBasicStyle() |
55 | { | 60 | { |
56 | unset(); | 61 | unset(); |
57 | } | 62 | } |
58 | bool operator!=(const CBasicStyle& rhs) | 63 | bool operator!=(const CBasicStyle& rhs) |
59 | { | 64 | { |
@@ -70,20 +75,26 @@ class CBasicStyle | |||
70 | isLink = false; | 75 | isLink = false; |
71 | m_underline = false; | 76 | m_underline = false; |
72 | m_strikethru = false; | 77 | m_strikethru = false; |
73 | m_leftmargin = 0; | 78 | m_leftmargin = 0; |
74 | m_rightmargin = 0; | 79 | m_rightmargin = 0; |
75 | m_monospaced = false; | 80 | m_monospaced = false; |
81 | m_extraspace = 0; | ||
82 | m_voffset = 0; | ||
76 | } | 83 | } |
77 | }; | 84 | }; |
78 | 85 | ||
79 | class CStyle | 86 | class CStyle |
80 | { | 87 | { |
81 | CBasicStyle sty; | 88 | CBasicStyle sty; |
82 | pmstore* graphic; | 89 | pmstore* graphic; |
83 | public: | 90 | public: |
91 | signed char getVOffset() { return sty.m_voffset; } | ||
92 | void setVOffset(signed char sp) { sty.m_voffset = sp; } | ||
93 | signed char getExtraSpace() { return sty.m_extraspace; } | ||
94 | void setExtraSpace(signed char sp) { sty.m_extraspace = sp; } | ||
84 | bool getPictureLink() | 95 | bool getPictureLink() |
85 | { | 96 | { |
86 | return (graphic != NULL && graphic->graphic->isLink); | 97 | return (graphic != NULL && graphic->graphic->isLink); |
87 | } | 98 | } |
88 | unsigned long getPictureLinkData() | 99 | unsigned long getPictureLinkData() |
89 | { | 100 | { |
@@ -101,22 +112,23 @@ class CStyle | |||
101 | sty.red = r; | 112 | sty.red = r; |
102 | sty.green = g; | 113 | sty.green = g; |
103 | sty.blue = b; | 114 | sty.blue = b; |
104 | } | 115 | } |
105 | CStyle() : graphic(NULL) {} | 116 | CStyle() : graphic(NULL) {} |
106 | ~CStyle(); | 117 | ~CStyle(); |
107 | CStyle(CStyle&); | 118 | // CStyle(CStyle&); |
108 | CStyle(const CStyle&); | 119 | CStyle(const CStyle&); |
109 | CStyle& operator=(const CStyle&); | 120 | CStyle& operator=(const CStyle&); |
110 | void unset(); | 121 | void unset(); |
111 | bool isPicture() { return (graphic != NULL); } | 122 | bool isPicture() { return (graphic != NULL); } |
123 | bool canScale() { return graphic->m_isScaleable; } | ||
112 | void clearPicture(); | 124 | void clearPicture(); |
113 | void setPicture(QPixmap* _g, bool il=false, unsigned long tgt=0); | 125 | void setPicture(bool canScale, QImage* _g, bool il=false, unsigned long tgt=0); |
114 | QPixmap* getPicture() | 126 | QImage* getPicture() |
115 | { | 127 | { |
116 | QPixmap* pm = ((graphic != NULL) ? graphic->graphic->graphic : NULL); | 128 | QImage* pm = ((graphic != NULL) ? graphic->graphic->graphic : NULL); |
117 | return pm; | 129 | return pm; |
118 | } | 130 | } |
119 | void setUnderline() { sty.m_underline = true; } | 131 | void setUnderline() { sty.m_underline = true; } |
120 | void unsetUnderline() { sty.m_underline = false; } | 132 | void unsetUnderline() { sty.m_underline = false; } |
121 | bool isUnderline() { return sty.m_underline; } | 133 | bool isUnderline() { return sty.m_underline; } |
122 | void setStrikethru() { sty.m_strikethru = true; } | 134 | void setStrikethru() { sty.m_strikethru = true; } |
@@ -154,13 +166,13 @@ class CStyle | |||
154 | } | 166 | } |
155 | 167 | ||
156 | void setFontSize(int _fs) | 168 | void setFontSize(int _fs) |
157 | { | 169 | { |
158 | sty.m_fontsize = _fs; | 170 | sty.m_fontsize = _fs; |
159 | } | 171 | } |
160 | int getFontSize() | 172 | int getFontSize() const |
161 | { | 173 | { |
162 | return sty.m_fontsize; | 174 | return sty.m_fontsize; |
163 | } | 175 | } |
164 | bool operator!=(const CStyle& rhs) | 176 | bool operator!=(const CStyle& rhs) |
165 | { | 177 | { |
166 | return | 178 | return |