author | hayzel <hayzel> | 2004-01-08 18:37:03 (UTC) |
---|---|---|
committer | hayzel <hayzel> | 2004-01-08 18:37:03 (UTC) |
commit | 44443aec5d4b8f974b30b1e9b4ea920d6582add1 (patch) (unidiff) | |
tree | c8abd765a49f7679f13cf1417b29aa04ef92866f | |
parent | bb961821c44ea2447288ce74537439eb8f97ed9a (diff) | |
download | opie-44443aec5d4b8f974b30b1e9b4ea920d6582add1.zip opie-44443aec5d4b8f974b30b1e9b4ea920d6582add1.tar.gz opie-44443aec5d4b8f974b30b1e9b4ea920d6582add1.tar.bz2 |
modified mainwindow.cpp to use icons from resource folder pics
-rw-r--r-- | noncore/apps/opie-sheet/cell-select.xpm | 25 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/excel16.xpm | 187 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-comma.xpm | 24 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-cross.xpm | 23 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-divide.xpm | 23 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-equal.xpm | 23 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-func.xpm | 23 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-minus.xpm | 23 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-paran-close.xpm | 24 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-paran-open.xpm | 24 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/func-plus.xpm | 23 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.cpp | 35 |
12 files changed, 11 insertions, 446 deletions
diff --git a/noncore/apps/opie-sheet/cell-select.xpm b/noncore/apps/opie-sheet/cell-select.xpm deleted file mode 100644 index 4836c02..0000000 --- a/noncore/apps/opie-sheet/cell-select.xpm +++ b/dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *cell_select_xpm[]={ | ||
3 | "16 16 6 1", | ||
4 | "# c None", | ||
5 | "c c #0058c0", | ||
6 | ". c #585858", | ||
7 | "b c #58a8ff", | ||
8 | "a c #a8dcff", | ||
9 | "d c #c0ffff", | ||
10 | ".###############", | ||
11 | ".#####...#######", | ||
12 | "#...#.aab.######", | ||
13 | "###..acaaa.#####", | ||
14 | "###.aaacabc.####", | ||
15 | "##.acaaaccab.###", | ||
16 | "#.caacabbaaa.###", | ||
17 | "#.ccaacbaaaaa.##", | ||
18 | "#.bacbcaaaadaa.#", | ||
19 | "##.bacbaaaddda.#", | ||
20 | "###.bacaaaadaa.#", | ||
21 | "####.bacaaaaac.#", | ||
22 | "#####.bacaaacb.#", | ||
23 | "######.bacccb.##", | ||
24 | "#######.babb.###", | ||
25 | "########....####"}; | ||
diff --git a/noncore/apps/opie-sheet/excel16.xpm b/noncore/apps/opie-sheet/excel16.xpm deleted file mode 100644 index 45dd96d..0000000 --- a/noncore/apps/opie-sheet/excel16.xpm +++ b/dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *excel16_xpm[]={ | ||
3 | "16 16 168 2", | ||
4 | "aL c None", | ||
5 | "Qt c None", | ||
6 | "aK c #24440a", | ||
7 | "#y c #247d21", | ||
8 | "#B c #276d1e", | ||
9 | "aw c #284a0d", | ||
10 | "au c #2b4e10", | ||
11 | "#P c #2c6e1a", | ||
12 | "ag c #2d5114", | ||
13 | "ad c #2e541a", | ||
14 | "af c #304326", | ||
15 | "#2 c #317a1c", | ||
16 | "ae c #334f25", | ||
17 | "#5 c #335919", | ||
18 | "#F c #375d1f", | ||
19 | "#O c #3a872f", | ||
20 | "#t c #3d6324", | ||
21 | "ac c #3d7939", | ||
22 | "#Y c #3e7132", | ||
23 | "#p c #407f39", | ||
24 | "#Z c #42903e", | ||
25 | "#i c #436d28", | ||
26 | ".9 c #446e2a", | ||
27 | "aJ c #466628", | ||
28 | "av c #476430", | ||
29 | "aI c #476829", | ||
30 | ".W c #47732d", | ||
31 | "#K c #479643", | ||
32 | "#1 c #48872e", | ||
33 | "aH c #496b2d", | ||
34 | ".6 c #4a8a49", | ||
35 | "aG c #4b6e31", | ||
36 | ".z c #4b7832", | ||
37 | "#L c #4d9647", | ||
38 | "aF c #4e7336", | ||
39 | "aE c #52783b", | ||
40 | ".m c #527a3e", | ||
41 | "#x c #529c4f", | ||
42 | "#N c #549c4b", | ||
43 | "aD c #567a3f", | ||
44 | "#V c #579342", | ||
45 | "#X c #588649", | ||
46 | "aC c #598041", | ||
47 | ".T c #598955", | ||
48 | "#A c #59a354", | ||
49 | "#W c #5a8f48", | ||
50 | "aB c #5d8745", | ||
51 | "ax c #5d914d", | ||
52 | "#o c #5ea657", | ||
53 | "#C c #5f8755", | ||
54 | "aA c #5f8947", | ||
55 | ".5 c #5f9f5a", | ||
56 | "#e c #60965b", | ||
57 | "#f c #609c5b", | ||
58 | "az c #618b4a", | ||
59 | ".l c #629450", | ||
60 | "ay c #679350", | ||
61 | ".k c #689854", | ||
62 | "#U c #69a15f", | ||
63 | "ah c #6c9c59", | ||
64 | "#d c #6cae66", | ||
65 | ".R c #6da767", | ||
66 | ".S c #6ea564", | ||
67 | "#n c #6eaf67", | ||
68 | ".3 c #6fad69", | ||
69 | "#0 c #6fb067", | ||
70 | ".j c #719f5f", | ||
71 | "ab c #729a6b", | ||
72 | "#6 c #72a161", | ||
73 | ".2 c #74a270", | ||
74 | "#J c #75b56d", | ||
75 | ".i c #76a366", | ||
76 | "#l c #77ae74", | ||
77 | "#M c #78b570", | ||
78 | "#I c #79b176", | ||
79 | ".4 c #79b870", | ||
80 | "#S c #7ba66b", | ||
81 | ".N c #7bb374", | ||
82 | ".h c #7da970", | ||
83 | ".1 c #7fbd76", | ||
84 | "#G c #81ab74", | ||
85 | "#c c #81bb78", | ||
86 | ".M c #83bb7b", | ||
87 | "aa c #869782", | ||
88 | ".g c #86b079", | ||
89 | "a# c #879783", | ||
90 | "a. c #889885", | ||
91 | "#u c #88b279", | ||
92 | "#9 c #899886", | ||
93 | ".U c #89b188", | ||
94 | ".L c #89c081", | ||
95 | ".O c #8ab485", | ||
96 | ".0 c #8ac381", | ||
97 | ".f c #8eb580", | ||
98 | "#j c #8eb680", | ||
99 | ".y c #91a483", | ||
100 | "#m c #91c28a", | ||
101 | "#. c #92b885", | ||
102 | "#8 c #93ae91", | ||
103 | ".e c #93ba87", | ||
104 | "#3 c #93be91", | ||
105 | "at c #94a089", | ||
106 | "#4 c #96a18b", | ||
107 | "#z c #96c78d", | ||
108 | ".# c #97bc8a", | ||
109 | "#D c #99b598", | ||
110 | "#Q c #9abb99", | ||
111 | "#R c #9ba890", | ||
112 | ".d c #9bbf90", | ||
113 | "#E c #9ca991", | ||
114 | "#s c #9ca992", | ||
115 | "#b c #9dc895", | ||
116 | "#h c #9fac95", | ||
117 | ".c c #9fc294", | ||
118 | "#a c #a0c99b", | ||
119 | ".8 c #a2b198", | ||
120 | ".V c #a3b199", | ||
121 | ".b c #a4c699", | ||
122 | ".K c #a5b29b", | ||
123 | ".Z c #a6cf9f", | ||
124 | ".Y c #a7cda1", | ||
125 | ".a c #a9c99e", | ||
126 | ".n c #acc4a3", | ||
127 | ".x c #b2c3aa", | ||
128 | "ai c #b4c4ab", | ||
129 | ".w c #b6c7ad", | ||
130 | "#7 c #b7c7ae", | ||
131 | ".v c #b9cab1", | ||
132 | "#T c #bbcab3", | ||
133 | ".u c #bbcbb3", | ||
134 | ".Q c #bbd0ba", | ||
135 | "#H c #bccbb4", | ||
136 | ".t c #beceb7", | ||
137 | ".s c #c0d1ba", | ||
138 | "#k c #c1d1bb", | ||
139 | ".r c #c2d1bc", | ||
140 | "## c #c2d2bc", | ||
141 | ".X c #c4d5be", | ||
142 | ".q c #c6d9c1", | ||
143 | ".p c #c8d9c2", | ||
144 | ".o c #c9dac3", | ||
145 | "#q c #cdddcd", | ||
146 | "as c #d3e3d3", | ||
147 | "ar c #d4e4d4", | ||
148 | "aq c #d7e6d7", | ||
149 | "ap c #d8e7d9", | ||
150 | "ao c #dae9db", | ||
151 | ".7 c #dce8db", | ||
152 | "#r c #dce9dc", | ||
153 | "an c #ddebdd", | ||
154 | "#g c #dfecdf", | ||
155 | "am c #e1ede0", | ||
156 | "al c #e3ede3", | ||
157 | "#w c #e5efe5", | ||
158 | "ak c #e6efe6", | ||
159 | ".J c #e7f0e7", | ||
160 | "aj c #e8f0e8", | ||
161 | ".I c #eaf2ea", | ||
162 | ".P c #ebf3eb", | ||
163 | ".H c #ecf4ec", | ||
164 | ".G c #f0f5f0", | ||
165 | ".F c #f2f7f2", | ||
166 | "#v c #f3f7f3", | ||
167 | ".E c #f4f8f4", | ||
168 | ".D c #f7f9f6", | ||
169 | ".C c #f9fbf8", | ||
170 | ".B c #fafcfa", | ||
171 | ".A c #fcfdfc", | ||
172 | "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", | ||
173 | "Qt.#.a.b.c.d.e.f.g.h.i.j.k.l.mQt", | ||
174 | "Qt.a.n.o.p.q.r.s.t.u.v.w.x.y.zQt", | ||
175 | "Qt.b.o.A.B.C.D.E.F.G.H.I.J.K.zQt", | ||
176 | "Qt.c.p.L.M.N.O.P.Q.R.S.T.U.V.WQt", | ||
177 | "Qt.d.X.Y.Z.0.1.2.3.4.5.6.7.8.9Qt", | ||
178 | "Qt#.##.D#a#b#c#d#e#f.6.7#g#h#iQt", | ||
179 | "Qt#j#k.E.F#l#m#n#o#p#q#g#r#s#tQt", | ||
180 | "Qt#u.s#v#w#x#y#z#A#A#B#C#D#E#FQt", | ||
181 | "Qt#G#H.P#I#J#K#L#M#N#O#P#Q#R#FQt", | ||
182 | "Qt#S#T#U#V#W#X#Y#Z#0#1#2#3#4#5Qt", | ||
183 | "Qt#6#7#8#9a.a#aaabacadaeaf#4agQt", | ||
184 | "QtahaiajakalamanaoapaqarasatauQt", | ||
185 | "Qt.kavavavavavavavavavavavavawQt", | ||
186 | "QtaxayazaAaBaCaDaEaFaGaHaIaJaKQt", | ||
187 | "aLaLaLaLaLaLaLaLaLaLaLaLaLaLaLaL"}; | ||
diff --git a/noncore/apps/opie-sheet/func-comma.xpm b/noncore/apps/opie-sheet/func-comma.xpm deleted file mode 100644 index 2e680d2..0000000 --- a/noncore/apps/opie-sheet/func-comma.xpm +++ b/dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_comma_xpm[]={ | ||
3 | "16 16 5 1", | ||
4 | ". c None", | ||
5 | "# c #000000", | ||
6 | "a c #0000ff", | ||
7 | "b c #0058c0", | ||
8 | "c c #0080ff", | ||
9 | "................", | ||
10 | "................", | ||
11 | "................", | ||
12 | "......###.......", | ||
13 | ".....#aaa#......", | ||
14 | ".....#bcca#.....", | ||
15 | ".....#bbaa#.....", | ||
16 | "......##ba#.....", | ||
17 | "........#b#.....", | ||
18 | "........#b#.....", | ||
19 | ".......#b#......", | ||
20 | "......#b#.......", | ||
21 | "......##........", | ||
22 | "................", | ||
23 | "................", | ||
24 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/func-cross.xpm b/noncore/apps/opie-sheet/func-cross.xpm deleted file mode 100644 index 3b3f3d5..0000000 --- a/noncore/apps/opie-sheet/func-cross.xpm +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_cross_xpm[]={ | ||
3 | "16 16 4 1", | ||
4 | ". c None", | ||
5 | "b c #0000ff", | ||
6 | "a c #0058c0", | ||
7 | "# c #585858", | ||
8 | "................", | ||
9 | "................", | ||
10 | "....#......##...", | ||
11 | "...#a#....#ab#..", | ||
12 | "..#bba#..#abb#..", | ||
13 | "...#bba##abb#...", | ||
14 | "....#bbaabb#....", | ||
15 | ".....#bbbb#.....", | ||
16 | ".....#bbbb#.....", | ||
17 | "....#bbaabb#....", | ||
18 | "...#bba##abb#...", | ||
19 | "..#bba#..#abb#..", | ||
20 | "..#ba#....#a#...", | ||
21 | "...##......#....", | ||
22 | "................", | ||
23 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/func-divide.xpm b/noncore/apps/opie-sheet/func-divide.xpm deleted file mode 100644 index beb3473..0000000 --- a/noncore/apps/opie-sheet/func-divide.xpm +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_divide_xpm[]={ | ||
3 | "16 16 4 1", | ||
4 | ". c None", | ||
5 | "# c #000000", | ||
6 | "b c #0000ff", | ||
7 | "a c #0058c0", | ||
8 | "................", | ||
9 | "................", | ||
10 | "...........##...", | ||
11 | "..........#ab#..", | ||
12 | ".........#aba#..", | ||
13 | "........#bba#...", | ||
14 | ".......#bba#....", | ||
15 | "......#bba#.....", | ||
16 | ".....#abb#......", | ||
17 | "....#abb#.......", | ||
18 | "...#abb#........", | ||
19 | "..#aba#.........", | ||
20 | "..#ba#..........", | ||
21 | "...##...........", | ||
22 | "................", | ||
23 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/func-equal.xpm b/noncore/apps/opie-sheet/func-equal.xpm deleted file mode 100644 index 8f34895..0000000 --- a/noncore/apps/opie-sheet/func-equal.xpm +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_equal_xpm[]={ | ||
3 | "16 16 4 1", | ||
4 | ". c None", | ||
5 | "b c #0000ff", | ||
6 | "a c #0058c0", | ||
7 | "# c #585858", | ||
8 | "................", | ||
9 | "................", | ||
10 | "................", | ||
11 | "...##########...", | ||
12 | "..#aaabbbbaaa#..", | ||
13 | "..#bbbbbbbbbb#..", | ||
14 | "..############..", | ||
15 | "................", | ||
16 | "................", | ||
17 | "..############..", | ||
18 | "..#bbbbbbbbbb#..", | ||
19 | "..#aaabbbbaaa#..", | ||
20 | "...##########...", | ||
21 | "................", | ||
22 | "................", | ||
23 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/func-func.xpm b/noncore/apps/opie-sheet/func-func.xpm deleted file mode 100644 index b9ec747..0000000 --- a/noncore/apps/opie-sheet/func-func.xpm +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_func_xpm[]={ | ||
3 | "16 16 4 1", | ||
4 | ". c None", | ||
5 | "a c #0000ff", | ||
6 | "b c #0058c0", | ||
7 | "# c #585858", | ||
8 | "................", | ||
9 | ".........#ab....", | ||
10 | ".......#aa##....", | ||
11 | ".......ab#......", | ||
12 | ".......ab#......", | ||
13 | "......#a#.......", | ||
14 | "....#aaaa#......", | ||
15 | "....bbabbb......", | ||
16 | "....##ab#a#.ba..", | ||
17 | ".....aa##baba#..", | ||
18 | ".....ab#.#ba#...", | ||
19 | ".....ab#.baba...", | ||
20 | "....#a#.ba##ba..", | ||
21 | "....ab#..#..#b..", | ||
22 | "...#a#..........", | ||
23 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/func-minus.xpm b/noncore/apps/opie-sheet/func-minus.xpm deleted file mode 100644 index b747bd7..0000000 --- a/noncore/apps/opie-sheet/func-minus.xpm +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_minus_xpm[]={ | ||
3 | "16 16 4 1", | ||
4 | ". c None", | ||
5 | "a c #0000ff", | ||
6 | "b c #0058c0", | ||
7 | "# c #585858", | ||
8 | "................", | ||
9 | "................", | ||
10 | "................", | ||
11 | "................", | ||
12 | "................", | ||
13 | "................", | ||
14 | "...##########...", | ||
15 | "...#aaaaaabb#...", | ||
16 | "...#bbaaaaaa#...", | ||
17 | "...##########...", | ||
18 | "................", | ||
19 | "................", | ||
20 | "................", | ||
21 | "................", | ||
22 | "................", | ||
23 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/func-paran-close.xpm b/noncore/apps/opie-sheet/func-paran-close.xpm deleted file mode 100644 index 1e9994c..0000000 --- a/noncore/apps/opie-sheet/func-paran-close.xpm +++ b/dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_paran_close_xpm[]={ | ||
3 | "16 16 5 1", | ||
4 | "c c None", | ||
5 | ". c None", | ||
6 | "b c #0000ff", | ||
7 | "# c #0058c0", | ||
8 | "a c #585858", | ||
9 | "......#a........", | ||
10 | "......#baa......", | ||
11 | ".......#bba.....", | ||
12 | "........#b#.....", | ||
13 | "........c##a....", | ||
14 | "........c#ba....", | ||
15 | "........c#ba....", | ||
16 | "........c#ba....", | ||
17 | "........c#ba....", | ||
18 | "........c#ba....", | ||
19 | "........#b#a....", | ||
20 | ".......abb#.....", | ||
21 | ".......#bba.....", | ||
22 | "......#baa......", | ||
23 | "......#a........", | ||
24 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/func-paran-open.xpm b/noncore/apps/opie-sheet/func-paran-open.xpm deleted file mode 100644 index ace24b0..0000000 --- a/noncore/apps/opie-sheet/func-paran-open.xpm +++ b/dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_paran_open_xpm[]={ | ||
3 | "16 16 5 1", | ||
4 | "c c None", | ||
5 | ". c None", | ||
6 | "b c #0000ff", | ||
7 | "a c #0058c0", | ||
8 | "# c #585858", | ||
9 | "........#a......", | ||
10 | "......##ba......", | ||
11 | ".....#bba.......", | ||
12 | ".....aba........", | ||
13 | "....#aacc.......", | ||
14 | "....#bacc.......", | ||
15 | "....#bacc.......", | ||
16 | "....#bacc.......", | ||
17 | "....#bac........", | ||
18 | "....#bac........", | ||
19 | "....#aac........", | ||
20 | ".....abbc.......", | ||
21 | ".....#bba.......", | ||
22 | "......##bac.....", | ||
23 | "........#ac.....", | ||
24 | "..........c....."}; | ||
diff --git a/noncore/apps/opie-sheet/func-plus.xpm b/noncore/apps/opie-sheet/func-plus.xpm deleted file mode 100644 index c779f23..0000000 --- a/noncore/apps/opie-sheet/func-plus.xpm +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static const char *func_plus_xpm[]={ | ||
3 | "16 16 4 1", | ||
4 | ". c None", | ||
5 | "a c #0000ff", | ||
6 | "b c #0058c0", | ||
7 | "# c #585858", | ||
8 | "................", | ||
9 | "................", | ||
10 | "......####......", | ||
11 | "......#ab#......", | ||
12 | "......#ab#......", | ||
13 | "......#ab#......", | ||
14 | "..####babb####..", | ||
15 | "..#aaaaaabbbb#..", | ||
16 | "..#bbbbaaaaaa#..", | ||
17 | "..####bbab####..", | ||
18 | "......#ba#......", | ||
19 | "......#ba#......", | ||
20 | "......#ba#......", | ||
21 | "......####......", | ||
22 | "................", | ||
23 | "................"}; | ||
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index a725e31..d47a570 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp | |||
@@ -1,1021 +1,1008 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Opie Sheet (formerly Sheet/Qt) | 11 | * Opie Sheet (formerly Sheet/Qt) |
12 | * by Serdar Ozler <sozler@sitebest.com> | 12 | * by Serdar Ozler <sozler@sitebest.com> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "mainwindow.h" | 15 | #include "mainwindow.h" |
16 | 16 | ||
17 | #include <qpe/filemanager.h> | 17 | #include <qpe/filemanager.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
19 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qtranslator.h> | 22 | #include <qtranslator.h> |
23 | #include <qradiobutton.h> | 23 | #include <qradiobutton.h> |
24 | #include "cellformat.h" | 24 | #include "cellformat.h" |
25 | #include "numberdlg.h" | 25 | #include "numberdlg.h" |
26 | #include "textdlg.h" | 26 | #include "textdlg.h" |
27 | #include "sortdlg.h" | 27 | #include "sortdlg.h" |
28 | #include "finddlg.h" | 28 | #include "finddlg.h" |
29 | 29 | ||
30 | |||
31 | #include "func-plus.xpm" | ||
32 | #include "func-minus.xpm" | ||
33 | #include "func-cross.xpm" | ||
34 | #include "func-divide.xpm" | ||
35 | #include "func-paran-open.xpm" | ||
36 | #include "func-paran-close.xpm" | ||
37 | #include "func-comma.xpm" | ||
38 | #include "func-func.xpm" | ||
39 | #include "func-equal.xpm" | ||
40 | #include "cell-select.xpm" | ||
41 | #include "excel16.xpm" | ||
42 | |||
43 | #define DEFAULT_NUM_ROWS 300 | 30 | #define DEFAULT_NUM_ROWS 300 |
44 | #define DEFAULT_NUM_COLS (26*3) | 31 | #define DEFAULT_NUM_COLS (26*3) |
45 | #define DEFAULT_NUM_SHEETS 3 | 32 | #define DEFAULT_NUM_SHEETS 3 |
46 | 33 | ||
47 | MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) | 34 | MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) |
48 | :QMainWindow(parent, n, fl) | 35 | :QMainWindow(parent, n, fl) |
49 | { | 36 | { |
50 | // initialize variables | 37 | // initialize variables |
51 | documentModified=FALSE; | 38 | documentModified=FALSE; |
52 | 39 | ||
53 | // construct objects | 40 | // construct objects |
54 | currentDoc=0; | 41 | currentDoc=0; |
55 | fileSelector=new FileSelector("application/sheet-qt", this, QString::null); | 42 | fileSelector=new FileSelector("application/sheet-qt", this, QString::null); |
56 | ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); | 43 | ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); |
57 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); | 44 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); |
58 | connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); | 45 | connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); |
59 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); | 46 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); |
60 | connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &))); | 47 | connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &))); |
61 | connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); | 48 | connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); |
62 | 49 | ||
63 | 50 | ||
64 | listSheets.setAutoDelete(TRUE); | 51 | listSheets.setAutoDelete(TRUE); |
65 | 52 | ||
66 | initActions(); | 53 | initActions(); |
67 | initMenu(); | 54 | initMenu(); |
68 | initEditToolbar(); | 55 | initEditToolbar(); |
69 | initFunctionsToolbar(); | 56 | initFunctionsToolbar(); |
70 | initStandardToolbar(); | 57 | initStandardToolbar(); |
71 | initSheet(); | 58 | initSheet(); |
72 | 59 | ||
73 | // set window title | 60 | // set window title |
74 | setCaption(tr("Opie Sheet")); | 61 | setCaption(tr("Opie Sheet")); |
75 | 62 | ||
76 | // create sheets | 63 | // create sheets |
77 | selectorFileNew(DocLnk()); | 64 | selectorFileNew(DocLnk()); |
78 | } | 65 | } |
79 | 66 | ||
80 | MainWindow::~MainWindow() | 67 | MainWindow::~MainWindow() |
81 | { | 68 | { |
82 | if (currentDoc) delete currentDoc; | 69 | if (currentDoc) delete currentDoc; |
83 | } | 70 | } |
84 | 71 | ||
85 | void MainWindow::documentSave(DocLnk *lnkDoc) | 72 | void MainWindow::documentSave(DocLnk *lnkDoc) |
86 | { | 73 | { |
87 | FileManager fm; | 74 | FileManager fm; |
88 | QByteArray streamBuffer; | 75 | QByteArray streamBuffer; |
89 | QDataStream stream(streamBuffer, IO_WriteOnly); | 76 | QDataStream stream(streamBuffer, IO_WriteOnly); |
90 | 77 | ||
91 | typeSheet *currentSheet=findSheet(sheet->getName()); | 78 | typeSheet *currentSheet=findSheet(sheet->getName()); |
92 | if (!currentSheet) | 79 | if (!currentSheet) |
93 | { | 80 | { |
94 | QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); | 81 | QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); |
95 | return; | 82 | return; |
96 | } | 83 | } |
97 | sheet->copySheetData(¤tSheet->data); | 84 | sheet->copySheetData(¤tSheet->data); |
98 | stream.writeRawBytes("SQT100", 6); | 85 | stream.writeRawBytes("SQT100", 6); |
99 | stream << (Q_UINT32)listSheets.count(); | 86 | stream << (Q_UINT32)listSheets.count(); |
100 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 87 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
101 | { | 88 | { |
102 | stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); | 89 | stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); |
103 | for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) | 90 | for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) |
104 | stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; | 91 | stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; |
105 | } | 92 | } |
106 | 93 | ||
107 | lnkDoc->setType("application/sheet-qt"); | 94 | lnkDoc->setType("application/sheet-qt"); |
108 | if (!fm.saveFile(*lnkDoc, streamBuffer)) | 95 | if (!fm.saveFile(*lnkDoc, streamBuffer)) |
109 | { | 96 | { |
110 | QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!")); | 97 | QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!")); |
111 | return; | 98 | return; |
112 | } | 99 | } |
113 | documentModified=FALSE; | 100 | documentModified=FALSE; |
114 | } | 101 | } |
115 | 102 | ||
116 | void MainWindow::documentOpen(const DocLnk &lnkDoc) | 103 | void MainWindow::documentOpen(const DocLnk &lnkDoc) |
117 | { | 104 | { |
118 | FileManager fm; | 105 | FileManager fm; |
119 | QByteArray streamBuffer; | 106 | QByteArray streamBuffer; |
120 | if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer)) | 107 | if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer)) |
121 | { | 108 | { |
122 | QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!")); | 109 | QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!")); |
123 | documentModified=FALSE; | 110 | documentModified=FALSE; |
124 | selectorFileNew(DocLnk()); | 111 | selectorFileNew(DocLnk()); |
125 | return; | 112 | return; |
126 | } | 113 | } |
127 | QDataStream stream(streamBuffer, IO_ReadOnly); | 114 | QDataStream stream(streamBuffer, IO_ReadOnly); |
128 | 115 | ||
129 | Q_UINT32 countSheet, countCell, i, j, row, col, alignment; | 116 | Q_UINT32 countSheet, countCell, i, j, row, col, alignment; |
130 | typeSheet *newSheet; | 117 | typeSheet *newSheet; |
131 | typeCellData *newCell; | 118 | typeCellData *newCell; |
132 | 119 | ||
133 | char fileFormat[7]; | 120 | char fileFormat[7]; |
134 | stream.readRawBytes(fileFormat, 6); | 121 | stream.readRawBytes(fileFormat, 6); |
135 | fileFormat[6]=0; | 122 | fileFormat[6]=0; |
136 | if ((QString)fileFormat!="SQT100") | 123 | if ((QString)fileFormat!="SQT100") |
137 | { | 124 | { |
138 | QMessageBox::critical(this, tr("Error"), tr("Invalid file format!")); | 125 | QMessageBox::critical(this, tr("Error"), tr("Invalid file format!")); |
139 | documentModified=FALSE; | 126 | documentModified=FALSE; |
140 | selectorFileNew(DocLnk()); | 127 | selectorFileNew(DocLnk()); |
141 | return; | 128 | return; |
142 | } | 129 | } |
143 | 130 | ||
144 | stream >> countSheet; | 131 | stream >> countSheet; |
145 | for (i=0; i<countSheet; ++i) | 132 | for (i=0; i<countSheet; ++i) |
146 | { | 133 | { |
147 | newSheet=new typeSheet; | 134 | newSheet=new typeSheet; |
148 | newSheet->data.setAutoDelete(TRUE); | 135 | newSheet->data.setAutoDelete(TRUE); |
149 | stream >> newSheet->name >> countCell; | 136 | stream >> newSheet->name >> countCell; |
150 | comboSheets->insertItem(newSheet->name); | 137 | comboSheets->insertItem(newSheet->name); |
151 | 138 | ||
152 | for (j=0; j<countCell; ++j) | 139 | for (j=0; j<countCell; ++j) |
153 | { | 140 | { |
154 | newCell=new typeCellData; | 141 | newCell=new typeCellData; |
155 | stream >> col >> row >> newCell->borders.right >> newCell->borders.bottom >> newCell->background >> alignment >> newCell->fontColor >> newCell->font >> newCell->data; | 142 | stream >> col >> row >> newCell->borders.right >> newCell->borders.bottom >> newCell->background >> alignment >> newCell->fontColor >> newCell->font >> newCell->data; |
156 | newCell->col=col; | 143 | newCell->col=col; |
157 | newCell->row=row; | 144 | newCell->row=row; |
158 | newCell->alignment=(Qt::AlignmentFlags)alignment; | 145 | newCell->alignment=(Qt::AlignmentFlags)alignment; |
159 | newSheet->data.append(newCell); | 146 | newSheet->data.append(newCell); |
160 | } | 147 | } |
161 | listSheets.append(newSheet); | 148 | listSheets.append(newSheet); |
162 | 149 | ||
163 | if (i==0) | 150 | if (i==0) |
164 | { | 151 | { |
165 | sheet->setName(newSheet->name); | 152 | sheet->setName(newSheet->name); |
166 | sheet->setSheetData(&newSheet->data); | 153 | sheet->setSheetData(&newSheet->data); |
167 | } | 154 | } |
168 | } | 155 | } |
169 | } | 156 | } |
170 | 157 | ||
171 | int MainWindow::saveCurrentFile(bool ask) | 158 | int MainWindow::saveCurrentFile(bool ask) |
172 | { | 159 | { |
173 | if (ask) | 160 | if (ask) |
174 | { | 161 | { |
175 | int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); | 162 | int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); |
176 | if (result!=QMessageBox::Yes) return result; | 163 | if (result!=QMessageBox::Yes) return result; |
177 | } | 164 | } |
178 | 165 | ||
179 | if (!currentDoc->isValid()) | 166 | if (!currentDoc->isValid()) |
180 | { | 167 | { |
181 | TextDialog dialogText(this); | 168 | TextDialog dialogText(this); |
182 | if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel; | 169 | if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel; |
183 | 170 | ||
184 | currentDoc->setName(dialogText.getValue()); | 171 | currentDoc->setName(dialogText.getValue()); |
185 | currentDoc->setFile(QString::null); | 172 | currentDoc->setFile(QString::null); |
186 | currentDoc->setLinkFile(QString::null); | 173 | currentDoc->setLinkFile(QString::null); |
187 | } | 174 | } |
188 | 175 | ||
189 | documentSave(currentDoc); | 176 | documentSave(currentDoc); |
190 | return QMessageBox::Yes; | 177 | return QMessageBox::Yes; |
191 | } | 178 | } |
192 | 179 | ||
193 | void MainWindow::selectorFileNew(const DocLnk &lnkDoc) | 180 | void MainWindow::selectorFileNew(const DocLnk &lnkDoc) |
194 | { | 181 | { |
195 | selectorHide(); | 182 | selectorHide(); |
196 | 183 | ||
197 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; | 184 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; |
198 | if (currentDoc) delete currentDoc; | 185 | if (currentDoc) delete currentDoc; |
199 | currentDoc = new DocLnk(lnkDoc); | 186 | currentDoc = new DocLnk(lnkDoc); |
200 | editData->clear(); | 187 | editData->clear(); |
201 | listSheets.clear(); | 188 | listSheets.clear(); |
202 | comboSheets->clear(); | 189 | comboSheets->clear(); |
203 | 190 | ||
204 | typeSheet *newSheet=createNewSheet(); | 191 | typeSheet *newSheet=createNewSheet(); |
205 | newSheet->data.setAutoDelete(TRUE); | 192 | newSheet->data.setAutoDelete(TRUE); |
206 | sheet->setName(newSheet->name); | 193 | sheet->setName(newSheet->name); |
207 | sheet->setSheetData(&newSheet->data); | 194 | sheet->setSheetData(&newSheet->data); |
208 | for (int i=1; i<DEFAULT_NUM_SHEETS; ++i) | 195 | for (int i=1; i<DEFAULT_NUM_SHEETS; ++i) |
209 | createNewSheet(); | 196 | createNewSheet(); |
210 | documentModified=FALSE; | 197 | documentModified=FALSE; |
211 | } | 198 | } |
212 | 199 | ||
213 | void MainWindow::closeEvent(QCloseEvent *e) | 200 | void MainWindow::closeEvent(QCloseEvent *e) |
214 | { | 201 | { |
215 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore(); | 202 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore(); |
216 | else e->accept(); | 203 | else e->accept(); |
217 | } | 204 | } |
218 | 205 | ||
219 | void MainWindow::selectorFileOpen(const DocLnk &lnkDoc) | 206 | void MainWindow::selectorFileOpen(const DocLnk &lnkDoc) |
220 | { | 207 | { |
221 | selectorHide(); | 208 | selectorHide(); |
222 | 209 | ||
223 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; | 210 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; |
224 | if (currentDoc) delete currentDoc; | 211 | if (currentDoc) delete currentDoc; |
225 | currentDoc = new DocLnk(); | 212 | currentDoc = new DocLnk(); |
226 | listSheets.clear(); | 213 | listSheets.clear(); |
227 | comboSheets->clear(); | 214 | comboSheets->clear(); |
228 | 215 | ||
229 | documentOpen(lnkDoc); | 216 | documentOpen(lnkDoc); |
230 | documentModified=FALSE; | 217 | documentModified=FALSE; |
231 | } | 218 | } |
232 | 219 | ||
233 | void MainWindow::selectorShow() | 220 | void MainWindow::selectorShow() |
234 | { | 221 | { |
235 | sheet->hide(); | 222 | sheet->hide(); |
236 | setCentralWidget(fileSelector); | 223 | setCentralWidget(fileSelector); |
237 | fileSelector->show(); | 224 | fileSelector->show(); |
238 | fileSelector->reread(); | 225 | fileSelector->reread(); |
239 | } | 226 | } |
240 | 227 | ||
241 | void MainWindow::selectorHide() | 228 | void MainWindow::selectorHide() |
242 | { | 229 | { |
243 | fileSelector->hide(); | 230 | fileSelector->hide(); |
244 | setCentralWidget(sheet); | 231 | setCentralWidget(sheet); |
245 | sheet->show(); | 232 | sheet->show(); |
246 | } | 233 | } |
247 | 234 | ||
248 | void MainWindow::slotFileNew() | 235 | void MainWindow::slotFileNew() |
249 | { | 236 | { |
250 | selectorFileNew(DocLnk()); | 237 | selectorFileNew(DocLnk()); |
251 | } | 238 | } |
252 | 239 | ||
253 | void MainWindow::slotFileOpen() | 240 | void MainWindow::slotFileOpen() |
254 | { | 241 | { |
255 | selectorShow(); | 242 | selectorShow(); |
256 | } | 243 | } |
257 | 244 | ||
258 | void MainWindow::slotImportExcelOpen() | 245 | void MainWindow::slotImportExcelOpen() |
259 | { | 246 | { |
260 | sheet->hide(); | 247 | sheet->hide(); |
261 | setCentralWidget(ExcelSelector); | 248 | setCentralWidget(ExcelSelector); |
262 | ExcelSelector->show(); | 249 | ExcelSelector->show(); |
263 | ExcelSelector->reread(); | 250 | ExcelSelector->reread(); |
264 | } | 251 | } |
265 | 252 | ||
266 | void MainWindow::ExcelSelectorHide() | 253 | void MainWindow::ExcelSelectorHide() |
267 | { | 254 | { |
268 | ExcelSelector->hide(); | 255 | ExcelSelector->hide(); |
269 | setCentralWidget(sheet); | 256 | setCentralWidget(sheet); |
270 | sheet->show(); | 257 | sheet->show(); |
271 | } | 258 | } |
272 | 259 | ||
273 | void MainWindow::slotFileSave() | 260 | void MainWindow::slotFileSave() |
274 | { | 261 | { |
275 | saveCurrentFile(FALSE); | 262 | saveCurrentFile(FALSE); |
276 | } | 263 | } |
277 | 264 | ||
278 | void MainWindow::setDocument(const QString &applnk_filename) | 265 | void MainWindow::setDocument(const QString &applnk_filename) |
279 | { | 266 | { |
280 | selectorFileOpen(DocLnk(applnk_filename)); | 267 | selectorFileOpen(DocLnk(applnk_filename)); |
281 | } | 268 | } |
282 | 269 | ||
283 | void MainWindow::initActions() | 270 | void MainWindow::initActions() |
284 | { | 271 | { |
285 | fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this); | 272 | fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this); |
286 | connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); | 273 | connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); |
287 | fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this); | 274 | fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this); |
288 | connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); | 275 | connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); |
289 | fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this); | 276 | fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this); |
290 | connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); | 277 | connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); |
291 | fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this); | 278 | fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this); |
292 | connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); | 279 | connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); |
293 | 280 | ||
294 | //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); | 281 | //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); |
295 | //connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); | 282 | //connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); |
296 | fileExcelImport=new QAction(tr("Import Excel file"),QPixmap(excel16_xpm),tr("Import E&xcel file"),0,this); | 283 | fileExcelImport=new QAction(tr("Import Excel file"),Resource::loadPixmap( "/opie-sheet/excel16" ),tr("Import E&xcel file"),0,this); |
297 | connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen())); | 284 | connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen())); |
298 | 285 | ||
299 | // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this); | 286 | // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this); |
300 | //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); | 287 | //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); |
301 | //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); | 288 | //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); |
302 | //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); | 289 | //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); |
303 | 290 | ||
304 | editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this); | 291 | editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this); |
305 | connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); | 292 | connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); |
306 | editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this); | 293 | editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this); |
307 | connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); | 294 | connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); |
308 | editCellSelect=new QAction(tr("Cell Selector"), QPixmap(cell_select_xpm), tr("Cell &Selector"), 0, this); | 295 | editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell_select" ), tr("Cell &Selector"), 0, this); |
309 | editCellSelect->setToggleAction(TRUE); | 296 | editCellSelect->setToggleAction(TRUE); |
310 | connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); | 297 | connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); |
311 | editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); | 298 | editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); |
312 | editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); | 299 | editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); |
313 | editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); | 300 | editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); |
314 | connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); | 301 | connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); |
315 | editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this); | 302 | editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this); |
316 | connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); | 303 | connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); |
317 | editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); | 304 | editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); |
318 | 305 | ||
319 | insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); | 306 | insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); |
320 | connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); | 307 | connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); |
321 | insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this); | 308 | insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this); |
322 | connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows())); | 309 | connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows())); |
323 | insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this); | 310 | insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this); |
324 | connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols())); | 311 | connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols())); |
325 | insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this); | 312 | insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this); |
326 | connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets())); | 313 | connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets())); |
327 | 314 | ||
328 | formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this); | 315 | formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this); |
329 | connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells())); | 316 | connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells())); |
330 | 317 | ||
331 | rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this); | 318 | rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this); |
332 | connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight())); | 319 | connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight())); |
333 | rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this); | 320 | rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this); |
334 | connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust())); | 321 | connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust())); |
335 | rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this); | 322 | rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this); |
336 | connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow())); | 323 | connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow())); |
337 | rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this); | 324 | rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this); |
338 | connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide())); | 325 | connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide())); |
339 | 326 | ||
340 | colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this); | 327 | colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this); |
341 | connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth())); | 328 | connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth())); |
342 | colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this); | 329 | colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this); |
343 | connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust())); | 330 | connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust())); |
344 | colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this); | 331 | colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this); |
345 | connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow())); | 332 | connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow())); |
346 | colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this); | 333 | colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this); |
347 | connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); | 334 | connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); |
348 | 335 | ||
349 | sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); | 336 | sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); |
350 | connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); | 337 | connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); |
351 | sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); | 338 | sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); |
352 | connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); | 339 | connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); |
353 | 340 | ||
354 | dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); | 341 | dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); |
355 | connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); | 342 | connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); |
356 | dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); | 343 | dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); |
357 | connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); | 344 | connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); |
358 | 345 | ||
359 | funcEqual=new QAction(tr("Equal To"), QPixmap(func_equal_xpm), tr("&Equal To"), 0, this); | 346 | funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func_equal" ), tr("&Equal To"), 0, this); |
360 | funcEqual->setToolTip("="); | 347 | funcEqual->setToolTip("="); |
361 | connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 348 | connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
362 | funcPlus=new QAction(tr("Addition"), QPixmap(func_plus_xpm), tr("&Addition"), 0, this); | 349 | funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func_plus" ), tr("&Addition"), 0, this); |
363 | funcPlus->setToolTip("+"); | 350 | funcPlus->setToolTip("+"); |
364 | connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 351 | connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
365 | funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this); | 352 | funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func_minus" ), tr("&Subtraction"), 0, this); |
366 | funcMinus->setToolTip("-"); | 353 | funcMinus->setToolTip("-"); |
367 | connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 354 | connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
368 | funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this); | 355 | funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func_cross" ), tr("&Multiplication"), 0, this); |
369 | funcCross->setToolTip("*"); | 356 | funcCross->setToolTip("*"); |
370 | connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 357 | connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
371 | funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this); | 358 | funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func_divide" ), tr("&Division"), 0, this); |
372 | funcDivide->setToolTip("/"); | 359 | funcDivide->setToolTip("/"); |
373 | connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 360 | connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
374 | funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this); | 361 | funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), Resource::loadPixmap( "opie-sheet/func_paran_open" ), tr("&Open Paranthesis"), 0, this); |
375 | funcParanOpen->setToolTip("("); | 362 | funcParanOpen->setToolTip("("); |
376 | connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 363 | connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
377 | funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this); | 364 | funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func_paran_close" ), tr("&Close Paranthesis"), 0, this); |
378 | funcParanClose->setToolTip(")"); | 365 | funcParanClose->setToolTip(")"); |
379 | connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 366 | connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
380 | funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this); | 367 | funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func_comma" ), tr("&Comma"), 0, this); |
381 | funcComma->setToolTip(","); | 368 | funcComma->setToolTip(","); |
382 | connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 369 | connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
383 | } | 370 | } |
384 | 371 | ||
385 | void MainWindow::initMenu() | 372 | void MainWindow::initMenu() |
386 | { | 373 | { |
387 | menu=new QMenuBar(this); | 374 | menu=new QMenuBar(this); |
388 | 375 | ||
389 | menuFile=new QPopupMenu; | 376 | menuFile=new QPopupMenu; |
390 | fileNew->addTo(menuFile); | 377 | fileNew->addTo(menuFile); |
391 | fileOpen->addTo(menuFile); | 378 | fileOpen->addTo(menuFile); |
392 | fileSave->addTo(menuFile); | 379 | fileSave->addTo(menuFile); |
393 | fileSaveAs->addTo(menuFile); | 380 | fileSaveAs->addTo(menuFile); |
394 | // menuFile->insertSeparator(); | 381 | // menuFile->insertSeparator(); |
395 | // fileQuit->addTo(menuFile); | 382 | // fileQuit->addTo(menuFile); |
396 | menuFile->insertSeparator(); | 383 | menuFile->insertSeparator(); |
397 | fileExcelImport->addTo(menuFile); | 384 | fileExcelImport->addTo(menuFile); |
398 | menu->insertItem(tr("&File"), menuFile); | 385 | menu->insertItem(tr("&File"), menuFile); |
399 | 386 | ||
400 | menuEdit=new QPopupMenu; | 387 | menuEdit=new QPopupMenu; |
401 | editAccept->addTo(menuEdit); | 388 | editAccept->addTo(menuEdit); |
402 | editCancel->addTo(menuEdit); | 389 | editCancel->addTo(menuEdit); |
403 | editCellSelect->addTo(menuEdit); | 390 | editCellSelect->addTo(menuEdit); |
404 | menuEdit->insertSeparator(); | 391 | menuEdit->insertSeparator(); |
405 | editCut->addTo(menuEdit); | 392 | editCut->addTo(menuEdit); |
406 | editCopy->addTo(menuEdit); | 393 | editCopy->addTo(menuEdit); |
407 | editPaste->addTo(menuEdit); | 394 | editPaste->addTo(menuEdit); |
408 | editPasteContents->addTo(menuEdit); | 395 | editPasteContents->addTo(menuEdit); |
409 | editClear->addTo(menuEdit); | 396 | editClear->addTo(menuEdit); |
410 | menu->insertItem(tr("&Edit"), menuEdit); | 397 | menu->insertItem(tr("&Edit"), menuEdit); |
411 | 398 | ||
412 | menuInsert=new QPopupMenu; | 399 | menuInsert=new QPopupMenu; |
413 | menu->insertItem(tr("&Insert"), menuInsert); | 400 | menu->insertItem(tr("&Insert"), menuInsert); |
414 | 401 | ||
415 | menuFormat=new QPopupMenu; | 402 | menuFormat=new QPopupMenu; |
416 | formatCells->addTo(menuFormat); | 403 | formatCells->addTo(menuFormat); |
417 | menu->insertItem(tr("&Format"), menuFormat); | 404 | menu->insertItem(tr("&Format"), menuFormat); |
418 | 405 | ||
419 | menuData=new QPopupMenu; | 406 | menuData=new QPopupMenu; |
420 | dataSort->addTo(menuData); | 407 | dataSort->addTo(menuData); |
421 | dataFindReplace->addTo(menuData); | 408 | dataFindReplace->addTo(menuData); |
422 | menu->insertItem(tr("&Data"), menuData); | 409 | menu->insertItem(tr("&Data"), menuData); |
423 | 410 | ||
424 | // menuHelp=new QPopupMenu; | 411 | // menuHelp=new QPopupMenu; |
425 | // helpGeneral->addTo(menuHelp); | 412 | // helpGeneral->addTo(menuHelp); |
426 | // helpAbout->addTo(menuHelp); | 413 | // helpAbout->addTo(menuHelp); |
427 | // menu->insertItem(tr("&Help"), menuHelp); | 414 | // menu->insertItem(tr("&Help"), menuHelp); |
428 | 415 | ||
429 | submenuRow=new QPopupMenu; | 416 | submenuRow=new QPopupMenu; |
430 | rowHeight->addTo(submenuRow); | 417 | rowHeight->addTo(submenuRow); |
431 | rowAdjust->addTo(submenuRow); | 418 | rowAdjust->addTo(submenuRow); |
432 | rowShow->addTo(submenuRow); | 419 | rowShow->addTo(submenuRow); |
433 | rowHide->addTo(submenuRow); | 420 | rowHide->addTo(submenuRow); |
434 | menuFormat->insertItem(tr("&Row"), submenuRow); | 421 | menuFormat->insertItem(tr("&Row"), submenuRow); |
435 | 422 | ||
436 | submenuCol=new QPopupMenu; | 423 | submenuCol=new QPopupMenu; |
437 | colWidth->addTo(submenuCol); | 424 | colWidth->addTo(submenuCol); |
438 | colAdjust->addTo(submenuCol); | 425 | colAdjust->addTo(submenuCol); |
439 | colShow->addTo(submenuCol); | 426 | colShow->addTo(submenuCol); |
440 | colHide->addTo(submenuCol); | 427 | colHide->addTo(submenuCol); |
441 | menuFormat->insertItem(tr("Colum&n"), submenuCol); | 428 | menuFormat->insertItem(tr("Colum&n"), submenuCol); |
442 | 429 | ||
443 | submenuSheet=new QPopupMenu; | 430 | submenuSheet=new QPopupMenu; |
444 | sheetRename->addTo(submenuSheet); | 431 | sheetRename->addTo(submenuSheet); |
445 | sheetRemove->addTo(submenuSheet); | 432 | sheetRemove->addTo(submenuSheet); |
446 | menuFormat->insertItem(tr("&Sheet"), submenuSheet); | 433 | menuFormat->insertItem(tr("&Sheet"), submenuSheet); |
447 | 434 | ||
448 | submenuFunc=new QPopupMenu; | 435 | submenuFunc=new QPopupMenu; |
449 | menuInsert->insertItem(tr("&Function"), submenuFunc); | 436 | menuInsert->insertItem(tr("&Function"), submenuFunc); |
450 | 437 | ||
451 | submenuFuncStd=new QPopupMenu; | 438 | submenuFuncStd=new QPopupMenu; |
452 | funcPlus->addTo(submenuFuncStd); | 439 | funcPlus->addTo(submenuFuncStd); |
453 | funcMinus->addTo(submenuFuncStd); | 440 | funcMinus->addTo(submenuFuncStd); |
454 | funcCross->addTo(submenuFuncStd); | 441 | funcCross->addTo(submenuFuncStd); |
455 | funcDivide->addTo(submenuFuncStd); | 442 | funcDivide->addTo(submenuFuncStd); |
456 | submenuFunc->insertItem(tr("&Simple"), submenuFuncStd); | 443 | submenuFunc->insertItem(tr("&Simple"), submenuFuncStd); |
457 | 444 | ||
458 | 445 | ||
459 | 446 | ||
460 | submenuFuncStandard=new QPopupMenu; | 447 | submenuFuncStandard=new QPopupMenu; |
461 | addFlyAction(tr("ABS(x)"), tr("ABS(x)"), "ABS(", submenuFuncStandard); | 448 | addFlyAction(tr("ABS(x)"), tr("ABS(x)"), "ABS(", submenuFuncStandard); |
462 | addFlyAction(tr("CEILING(x,acc)"), tr("CEILING(x,acc)"), "CEILING(", submenuFuncStandard); | 449 | addFlyAction(tr("CEILING(x,acc)"), tr("CEILING(x,acc)"), "CEILING(", submenuFuncStandard); |
463 | addFlyAction(tr("FACT(x)"), tr("FACT(x)"), "FACT(", submenuFuncStandard); | 450 | addFlyAction(tr("FACT(x)"), tr("FACT(x)"), "FACT(", submenuFuncStandard); |
464 | addFlyAction(tr("FLOOR(x,acc)"), tr("FLOOR(x,acc)"), "FLOOR(", submenuFuncStandard); | 451 | addFlyAction(tr("FLOOR(x,acc)"), tr("FLOOR(x,acc)"), "FLOOR(", submenuFuncStandard); |
465 | addFlyAction(tr("INT(x)"), tr("INT(x)"), "INT(", submenuFuncStandard); | 452 | addFlyAction(tr("INT(x)"), tr("INT(x)"), "INT(", submenuFuncStandard); |
466 | addFlyAction(tr("MOD(x,y)"), tr("MOD(x,y)"), "MOD(", submenuFuncStandard); | 453 | addFlyAction(tr("MOD(x,y)"), tr("MOD(x,y)"), "MOD(", submenuFuncStandard); |
467 | addFlyAction(tr("ROUND(x,digits)"), tr("ROUND(x,digits)"), "ROUND(", submenuFuncStandard); | 454 | addFlyAction(tr("ROUND(x,digits)"), tr("ROUND(x,digits)"), "ROUND(", submenuFuncStandard); |
468 | addFlyAction(tr("SIGN(x)"), tr("SIGN(x)"), "SIGN(", submenuFuncStandard); | 455 | addFlyAction(tr("SIGN(x)"), tr("SIGN(x)"), "SIGN(", submenuFuncStandard); |
469 | submenuFuncStandard->insertSeparator(); | 456 | submenuFuncStandard->insertSeparator(); |
470 | addFlyAction(tr("EXP(x)"), tr("EXP(x)"), "EXP(", submenuFuncStandard); | 457 | addFlyAction(tr("EXP(x)"), tr("EXP(x)"), "EXP(", submenuFuncStandard); |
471 | addFlyAction(tr("LN(x)"), tr("LN(x)"), "LN(", submenuFuncStandard); | 458 | addFlyAction(tr("LN(x)"), tr("LN(x)"), "LN(", submenuFuncStandard); |
472 | addFlyAction(tr("LOG(x,b)"), tr("LOG(x,b)"), "LOG(", submenuFuncStandard); | 459 | addFlyAction(tr("LOG(x,b)"), tr("LOG(x,b)"), "LOG(", submenuFuncStandard); |
473 | addFlyAction(tr("LOG10(x)"), tr("LOG10(x)"), "LOG10(", submenuFuncStandard); | 460 | addFlyAction(tr("LOG10(x)"), tr("LOG10(x)"), "LOG10(", submenuFuncStandard); |
474 | addFlyAction(tr("POWER(x,y)"), tr("POWER(x,y)"), "POWER(", submenuFuncStandard); | 461 | addFlyAction(tr("POWER(x,y)"), tr("POWER(x,y)"), "POWER(", submenuFuncStandard); |
475 | addFlyAction(tr("SQRT(x)"), tr("SQRT(x)"), "SQRT(", submenuFuncStandard); | 462 | addFlyAction(tr("SQRT(x)"), tr("SQRT(x)"), "SQRT(", submenuFuncStandard); |
476 | submenuFuncStandard->insertSeparator(); | 463 | submenuFuncStandard->insertSeparator(); |
477 | addFlyAction(tr("DEGREES(x)"), tr("DEGREES(x)"), "DEGREES(", submenuFuncStandard); | 464 | addFlyAction(tr("DEGREES(x)"), tr("DEGREES(x)"), "DEGREES(", submenuFuncStandard); |
478 | addFlyAction(tr("RADIANS(x)"), tr("RADIANS(x)"), "RADIANS(", submenuFuncStandard); | 465 | addFlyAction(tr("RADIANS(x)"), tr("RADIANS(x)"), "RADIANS(", submenuFuncStandard); |
479 | addFlyAction(tr("PI()"), tr("PI()"), "PI()", submenuFuncStandard); | 466 | addFlyAction(tr("PI()"), tr("PI()"), "PI()", submenuFuncStandard); |
480 | addFlyAction(tr("RAND()"), tr("RAND()"), "RAND(", submenuFuncStandard); | 467 | addFlyAction(tr("RAND()"), tr("RAND()"), "RAND(", submenuFuncStandard); |
481 | addFlyAction(tr("RANDBETWEEN(a,b)"), tr("RANDBETWEEN(a,b)"), "RANDBETWEEN(", submenuFuncStandard); | 468 | addFlyAction(tr("RANDBETWEEN(a,b)"), tr("RANDBETWEEN(a,b)"), "RANDBETWEEN(", submenuFuncStandard); |
482 | submenuFunc->insertItem(tr("S&tandard"), submenuFuncStandard); | 469 | submenuFunc->insertItem(tr("S&tandard"), submenuFuncStandard); |
483 | 470 | ||
484 | submenuFuncLogic=new QPopupMenu; | 471 | submenuFuncLogic=new QPopupMenu; |
485 | addFlyAction(tr("AND(x1,x2)"), tr("AND(x1,x2)"), "AND(", submenuFuncLogic); | 472 | addFlyAction(tr("AND(x1,x2)"), tr("AND(x1,x2)"), "AND(", submenuFuncLogic); |
486 | addFlyAction(tr("NOT(x)"), tr("NOT(x)"), "NOT(", submenuFuncLogic); | 473 | addFlyAction(tr("NOT(x)"), tr("NOT(x)"), "NOT(", submenuFuncLogic); |
487 | addFlyAction(tr("OR(x1,x2)"), tr("OR(x1,x2)"), "OR(", submenuFuncLogic); | 474 | addFlyAction(tr("OR(x1,x2)"), tr("OR(x1,x2)"), "OR(", submenuFuncLogic); |
488 | submenuFuncLogic->insertSeparator(); | 475 | submenuFuncLogic->insertSeparator(); |
489 | addFlyAction(tr("IF(compare,val1,val2)"), tr("IF(compare,val1,val2)"), "IF(", submenuFuncLogic); | 476 | addFlyAction(tr("IF(compare,val1,val2)"), tr("IF(compare,val1,val2)"), "IF(", submenuFuncLogic); |
490 | addFlyAction(tr("INDEX(range,index)"),tr("INDEX(range,index)"), "INDEX(", submenuFuncLogic); | 477 | addFlyAction(tr("INDEX(range,index)"),tr("INDEX(range,index)"), "INDEX(", submenuFuncLogic); |
491 | addFlyAction(tr("ISBLANK(x)"), tr("ISBLANK(x)"), "ISBLANK(", submenuFuncLogic); | 478 | addFlyAction(tr("ISBLANK(x)"), tr("ISBLANK(x)"), "ISBLANK(", submenuFuncLogic); |
492 | addFlyAction(tr("ISNUMBER(x)"), tr("ISNUMBER(x)"), "ISNUMBER(", submenuFuncLogic); | 479 | addFlyAction(tr("ISNUMBER(x)"), tr("ISNUMBER(x)"), "ISNUMBER(", submenuFuncLogic); |
493 | addFlyAction(tr("EVEN(x)"), tr("EVEN(x)"), "EVEN(", submenuFuncLogic); | 480 | addFlyAction(tr("EVEN(x)"), tr("EVEN(x)"), "EVEN(", submenuFuncLogic); |
494 | addFlyAction(tr("ISEVEN(x)"), tr("ISEVEN(x)"), "ISEVEN(", submenuFuncLogic); | 481 | addFlyAction(tr("ISEVEN(x)"), tr("ISEVEN(x)"), "ISEVEN(", submenuFuncLogic); |
495 | addFlyAction(tr("ODD(x)"), tr("ODD(x)"), "ODD(", submenuFuncLogic); | 482 | addFlyAction(tr("ODD(x)"), tr("ODD(x)"), "ODD(", submenuFuncLogic); |
496 | addFlyAction(tr("ISODD(x)"), tr("ISODD(x)"), "ISODD(", submenuFuncLogic); | 483 | addFlyAction(tr("ISODD(x)"), tr("ISODD(x)"), "ISODD(", submenuFuncLogic); |
497 | submenuFunc->insertItem(tr("Logical-&Information"), submenuFuncLogic); | 484 | submenuFunc->insertItem(tr("Logical-&Information"), submenuFuncLogic); |
498 | 485 | ||
499 | submenuFuncTrig=new QPopupMenu; | 486 | submenuFuncTrig=new QPopupMenu; |
500 | addFlyAction(tr("SIN(x)"), tr("SIN(x)"), "SIN(", submenuFuncTrig); | 487 | addFlyAction(tr("SIN(x)"), tr("SIN(x)"), "SIN(", submenuFuncTrig); |
501 | addFlyAction(tr("COS(x)"), tr("COS(x)"), "COS(", submenuFuncTrig); | 488 | addFlyAction(tr("COS(x)"), tr("COS(x)"), "COS(", submenuFuncTrig); |
502 | addFlyAction(tr("TAN(x)"), tr("TAN(x)"), "TAN(", submenuFuncTrig); | 489 | addFlyAction(tr("TAN(x)"), tr("TAN(x)"), "TAN(", submenuFuncTrig); |
503 | addFlyAction(tr("ASIN(x)"), tr("ASIN(x)"), "ASIN(", submenuFuncTrig); | 490 | addFlyAction(tr("ASIN(x)"), tr("ASIN(x)"), "ASIN(", submenuFuncTrig); |
504 | addFlyAction(tr("ACOS(x)"), tr("ACOS(x)"), "ACOS(", submenuFuncTrig); | 491 | addFlyAction(tr("ACOS(x)"), tr("ACOS(x)"), "ACOS(", submenuFuncTrig); |
505 | addFlyAction(tr("ATAN(x)"), tr("ATAN(x)"), "ATAN(", submenuFuncTrig); | 492 | addFlyAction(tr("ATAN(x)"), tr("ATAN(x)"), "ATAN(", submenuFuncTrig); |
506 | addFlyAction(tr("ATAN2(x,y)"), tr("ATAN2(x,y)"), "ATAN2(", submenuFuncTrig); | 493 | addFlyAction(tr("ATAN2(x,y)"), tr("ATAN2(x,y)"), "ATAN2(", submenuFuncTrig); |
507 | submenuFuncTrig->insertSeparator(); | 494 | submenuFuncTrig->insertSeparator(); |
508 | addFlyAction(tr("SINH(x)"), tr("SINH(x)"), "SINH(", submenuFuncTrig); | 495 | addFlyAction(tr("SINH(x)"), tr("SINH(x)"), "SINH(", submenuFuncTrig); |
509 | addFlyAction(tr("COSH(x)"), tr("COSH(x)"), "COSH(", submenuFuncTrig); | 496 | addFlyAction(tr("COSH(x)"), tr("COSH(x)"), "COSH(", submenuFuncTrig); |
510 | addFlyAction(tr("TANH(x)"), tr("TANH(x)"), "TANH(", submenuFuncTrig); | 497 | addFlyAction(tr("TANH(x)"), tr("TANH(x)"), "TANH(", submenuFuncTrig); |
511 | addFlyAction(tr("ACOSH(x)"), tr("ACOSH(x)"), "ACOSH(", submenuFuncTrig); | 498 | addFlyAction(tr("ACOSH(x)"), tr("ACOSH(x)"), "ACOSH(", submenuFuncTrig); |
512 | addFlyAction(tr("ASINH(x)"), tr("ASINH(x)"), "ASINH(", submenuFuncTrig); | 499 | addFlyAction(tr("ASINH(x)"), tr("ASINH(x)"), "ASINH(", submenuFuncTrig); |
513 | addFlyAction(tr("ATANH(x)"), tr("ATANH(x)"), "ATANH(", submenuFuncTrig); | 500 | addFlyAction(tr("ATANH(x)"), tr("ATANH(x)"), "ATANH(", submenuFuncTrig); |
514 | submenuFunc->insertItem(tr("&Trigonometric"), submenuFuncTrig); | 501 | submenuFunc->insertItem(tr("&Trigonometric"), submenuFuncTrig); |
515 | 502 | ||
516 | submenuFuncString=new QPopupMenu; | 503 | submenuFuncString=new QPopupMenu; |
517 | addFlyAction(tr("LEN(s)"), tr("LEN(s)"), "LEN(",submenuFuncString); | 504 | addFlyAction(tr("LEN(s)"), tr("LEN(s)"), "LEN(",submenuFuncString); |
518 | addFlyAction(tr("LEFT(s,num)"), tr("LEFT(s,num)"), "LEFT(",submenuFuncString); | 505 | addFlyAction(tr("LEFT(s,num)"), tr("LEFT(s,num)"), "LEFT(",submenuFuncString); |
519 | addFlyAction(tr("RIGHT(s,num)"), tr("RIGHT(s,num)"), "RIGHT(",submenuFuncString); | 506 | addFlyAction(tr("RIGHT(s,num)"), tr("RIGHT(s,num)"), "RIGHT(",submenuFuncString); |
520 | addFlyAction(tr("MID(s,pos,len)"), tr("MID(s,pos,len)"), "MID(",submenuFuncString); | 507 | addFlyAction(tr("MID(s,pos,len)"), tr("MID(s,pos,len)"), "MID(",submenuFuncString); |
521 | submenuFuncString->insertSeparator(); | 508 | submenuFuncString->insertSeparator(); |
522 | addFlyAction(tr("CONCATENATE(s1,s2..)"), tr("CONCATENATE(s1,s2..)"), "CONCATENATE(",submenuFuncString); | 509 | addFlyAction(tr("CONCATENATE(s1,s2..)"), tr("CONCATENATE(s1,s2..)"), "CONCATENATE(",submenuFuncString); |
523 | addFlyAction(tr("EXACT(s1,s2)"), tr("EXACT(s1,s2)"), "EXACT(",submenuFuncString); | 510 | addFlyAction(tr("EXACT(s1,s2)"), tr("EXACT(s1,s2)"), "EXACT(",submenuFuncString); |
524 | addFlyAction(tr("FIND(what,where,pos)"), | 511 | addFlyAction(tr("FIND(what,where,pos)"), |
525 | tr("FIND(what,where,pos)"), "FIND(",submenuFuncString); | 512 | tr("FIND(what,where,pos)"), "FIND(",submenuFuncString); |
526 | addFlyAction(tr("REPLACE(s,pos,len,ns)"), tr("REPLACE(s,pos,len,ns)"), "REPLACE(",submenuFuncString); | 513 | addFlyAction(tr("REPLACE(s,pos,len,ns)"), tr("REPLACE(s,pos,len,ns)"), "REPLACE(",submenuFuncString); |
527 | addFlyAction(tr("REPT(s,n)"), tr("REPT(s,n)"), "REPT(",submenuFuncString); | 514 | addFlyAction(tr("REPT(s,n)"), tr("REPT(s,n)"), "REPT(",submenuFuncString); |
528 | submenuFuncString->insertSeparator(); | 515 | submenuFuncString->insertSeparator(); |
529 | addFlyAction(tr("UPPER(s)"), tr("UPPER(s)"), "UPPER(",submenuFuncString); | 516 | addFlyAction(tr("UPPER(s)"), tr("UPPER(s)"), "UPPER(",submenuFuncString); |
530 | addFlyAction(tr("LOWER(s)"), tr("LOWER(s)"), "LOWER(",submenuFuncString); | 517 | addFlyAction(tr("LOWER(s)"), tr("LOWER(s)"), "LOWER(",submenuFuncString); |
531 | submenuFunc->insertItem(tr("&Strings"), submenuFuncString); | 518 | submenuFunc->insertItem(tr("&Strings"), submenuFuncString); |
532 | 519 | ||
533 | submenuFuncStat=new QPopupMenu; | 520 | submenuFuncStat=new QPopupMenu; |
534 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); | 521 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); |
535 | addFlyAction(tr("COUNT(range)"), tr("COUNT(range)"), "COUNT(",submenuFuncStat); | 522 | addFlyAction(tr("COUNT(range)"), tr("COUNT(range)"), "COUNT(",submenuFuncStat); |
536 | addFlyAction(tr("COUNTIF(range,eqls)"), tr("COUNTIF(range,eqls)"), "COUNTIF(",submenuFuncStat); | 523 | addFlyAction(tr("COUNTIF(range,eqls)"), tr("COUNTIF(range,eqls)"), "COUNTIF(",submenuFuncStat); |
537 | addFlyAction(tr("MAX(range)"), tr("MAX(range)"), "MAX(",submenuFuncStat); | 524 | addFlyAction(tr("MAX(range)"), tr("MAX(range)"), "MAX(",submenuFuncStat); |
538 | addFlyAction(tr("MIN(range)"), tr("MIN(range)"), "MIN(",submenuFuncStat); | 525 | addFlyAction(tr("MIN(range)"), tr("MIN(range)"), "MIN(",submenuFuncStat); |
539 | addFlyAction(tr("SUM(range)"), tr("SUM(range)"), "SUM(",submenuFuncStat); | 526 | addFlyAction(tr("SUM(range)"), tr("SUM(range)"), "SUM(",submenuFuncStat); |
540 | addFlyAction(tr("SUMSQ(range)"), tr("SUMSQ(range)"), "SUMSQ(",submenuFuncStat); | 527 | addFlyAction(tr("SUMSQ(range)"), tr("SUMSQ(range)"), "SUMSQ(",submenuFuncStat); |
541 | submenuFuncStat->insertSeparator(); | 528 | submenuFuncStat->insertSeparator(); |
542 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); | 529 | addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); |
543 | addFlyAction(tr("VAR(range)"), tr("VAR(range)"), "VAR(",submenuFuncStat); | 530 | addFlyAction(tr("VAR(range)"), tr("VAR(range)"), "VAR(",submenuFuncStat); |
544 | addFlyAction(tr("VARP(range)"), tr("VARP(range)"), "VARP(",submenuFuncStat); | 531 | addFlyAction(tr("VARP(range)"), tr("VARP(range)"), "VARP(",submenuFuncStat); |
545 | addFlyAction(tr("STDEV(range)"), tr("STDEV(range)"), "STDEV(",submenuFuncStat); | 532 | addFlyAction(tr("STDEV(range)"), tr("STDEV(range)"), "STDEV(",submenuFuncStat); |
546 | addFlyAction(tr("STDEVP(range)"), tr("STDEVP(range)"), "STDEVP(",submenuFuncStat); | 533 | addFlyAction(tr("STDEVP(range)"), tr("STDEVP(range)"), "STDEVP(",submenuFuncStat); |
547 | addFlyAction(tr("SKEW(range)"), tr("SKEW(range)"), "SKEW(",submenuFuncStat); | 534 | addFlyAction(tr("SKEW(range)"), tr("SKEW(range)"), "SKEW(",submenuFuncStat); |
548 | addFlyAction(tr("KURT(range)"), tr("KURT(range)"), "KURT(",submenuFuncStat); | 535 | addFlyAction(tr("KURT(range)"), tr("KURT(range)"), "KURT(",submenuFuncStat); |
549 | submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); | 536 | submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); |
550 | 537 | ||
551 | submenuFuncScientific=new QPopupMenu; | 538 | submenuFuncScientific=new QPopupMenu; |
552 | addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); | 539 | addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); |
553 | addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); | 540 | addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); |
554 | addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); | 541 | addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); |
555 | addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); | 542 | addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); |
556 | submenuFuncScientific->insertSeparator(); | 543 | submenuFuncScientific->insertSeparator(); |
557 | addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); | 544 | addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); |
558 | addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); | 545 | addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); |
559 | addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); | 546 | addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); |
560 | addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); | 547 | addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); |
561 | addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); | 548 | addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); |
562 | addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); | 549 | addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); |
563 | submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); | 550 | submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); |
564 | 551 | ||
565 | submenuFuncDistr=new QPopupMenu; | 552 | submenuFuncDistr=new QPopupMenu; |
566 | addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); | 553 | addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); |
567 | addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); | 554 | addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); |
568 | addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); | 555 | addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); |
569 | addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); | 556 | addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); |
570 | addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); | 557 | addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); |
571 | addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); | 558 | addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); |
572 | addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); | 559 | addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); |
573 | addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr); | 560 | addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr); |
574 | submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr); | 561 | submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr); |
575 | 562 | ||
576 | 563 | ||
577 | 564 | ||
578 | menuInsert->insertSeparator(); | 565 | menuInsert->insertSeparator(); |
579 | insertCells->addTo(menuInsert); | 566 | insertCells->addTo(menuInsert); |
580 | insertRows->addTo(menuInsert); | 567 | insertRows->addTo(menuInsert); |
581 | insertCols->addTo(menuInsert); | 568 | insertCols->addTo(menuInsert); |
582 | insertSheets->addTo(menuInsert); | 569 | insertSheets->addTo(menuInsert); |
583 | } | 570 | } |
584 | 571 | ||
585 | void MainWindow::initStandardToolbar() | 572 | void MainWindow::initStandardToolbar() |
586 | { | 573 | { |
587 | toolbarStandard=new QToolBar(this); | 574 | toolbarStandard=new QToolBar(this); |
588 | toolbarStandard->setHorizontalStretchable(TRUE); | 575 | toolbarStandard->setHorizontalStretchable(TRUE); |
589 | moveToolBar(toolbarStandard, Top); | 576 | moveToolBar(toolbarStandard, Top); |
590 | 577 | ||
591 | fileNew->addTo(toolbarStandard); | 578 | fileNew->addTo(toolbarStandard); |
592 | fileOpen->addTo(toolbarStandard); | 579 | fileOpen->addTo(toolbarStandard); |
593 | fileSave->addTo(toolbarStandard); | 580 | fileSave->addTo(toolbarStandard); |
594 | 581 | ||
595 | comboSheets=new QComboBox(toolbarStandard); | 582 | comboSheets=new QComboBox(toolbarStandard); |
596 | toolbarStandard->setStretchableWidget(comboSheets); | 583 | toolbarStandard->setStretchableWidget(comboSheets); |
597 | connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); | 584 | connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); |
598 | } | 585 | } |
599 | 586 | ||
600 | void MainWindow::initFunctionsToolbar() | 587 | void MainWindow::initFunctionsToolbar() |
601 | { | 588 | { |
602 | toolbarFunctions=new QToolBar(this); | 589 | toolbarFunctions=new QToolBar(this); |
603 | toolbarFunctions->setHorizontalStretchable(TRUE); | 590 | toolbarFunctions->setHorizontalStretchable(TRUE); |
604 | moveToolBar(toolbarFunctions, Bottom); | 591 | moveToolBar(toolbarFunctions, Bottom); |
605 | 592 | ||
606 | funcEqual->addTo(toolbarFunctions); | 593 | funcEqual->addTo(toolbarFunctions); |
607 | funcPlus->addTo(toolbarFunctions); | 594 | funcPlus->addTo(toolbarFunctions); |
608 | funcMinus->addTo(toolbarFunctions); | 595 | funcMinus->addTo(toolbarFunctions); |
609 | funcCross->addTo(toolbarFunctions); | 596 | funcCross->addTo(toolbarFunctions); |
610 | funcDivide->addTo(toolbarFunctions); | 597 | funcDivide->addTo(toolbarFunctions); |
611 | funcParanOpen->addTo(toolbarFunctions); | 598 | funcParanOpen->addTo(toolbarFunctions); |
612 | funcParanClose->addTo(toolbarFunctions); | 599 | funcParanClose->addTo(toolbarFunctions); |
613 | funcComma->addTo(toolbarFunctions); | 600 | funcComma->addTo(toolbarFunctions); |
614 | 601 | ||
615 | toolFunction=new QToolButton(toolbarFunctions); | 602 | toolFunction=new QToolButton(toolbarFunctions); |
616 | toolFunction->setPixmap(func_func_xpm); | 603 | toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func_func" )); |
617 | toolFunction->setTextLabel(tr("Functions")); | 604 | toolFunction->setTextLabel(tr("Functions")); |
618 | toolFunction->setPopup(submenuFunc); | 605 | toolFunction->setPopup(submenuFunc); |
619 | toolFunction->setPopupDelay(0); | 606 | toolFunction->setPopupDelay(0); |
620 | } | 607 | } |
621 | 608 | ||
622 | void MainWindow::initEditToolbar() | 609 | void MainWindow::initEditToolbar() |
623 | { | 610 | { |
624 | toolbarEdit=new QToolBar(this); | 611 | toolbarEdit=new QToolBar(this); |
625 | toolbarEdit->setHorizontalStretchable(TRUE); | 612 | toolbarEdit->setHorizontalStretchable(TRUE); |
626 | moveToolBar(toolbarEdit, Bottom); | 613 | moveToolBar(toolbarEdit, Bottom); |
627 | 614 | ||
628 | editAccept->addTo(toolbarEdit); | 615 | editAccept->addTo(toolbarEdit); |
629 | editCancel->addTo(toolbarEdit); | 616 | editCancel->addTo(toolbarEdit); |
630 | 617 | ||
631 | editData=new QLineEdit(toolbarEdit); | 618 | editData=new QLineEdit(toolbarEdit); |
632 | toolbarEdit->setStretchableWidget(editData); | 619 | toolbarEdit->setStretchableWidget(editData); |
633 | connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); | 620 | connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); |
634 | 621 | ||
635 | editCellSelect->addTo(toolbarEdit); | 622 | editCellSelect->addTo(toolbarEdit); |
636 | } | 623 | } |
637 | 624 | ||
638 | void MainWindow::slotHelpAbout() | 625 | void MainWindow::slotHelpAbout() |
639 | { | 626 | { |
640 | QDialog dialogAbout(this, 0, TRUE); | 627 | QDialog dialogAbout(this, 0, TRUE); |
641 | dialogAbout.resize(width()-40, height()-80); | 628 | dialogAbout.resize(width()-40, height()-80); |
642 | dialogAbout.setCaption(tr("About Opie Sheet")); | 629 | dialogAbout.setCaption(tr("About Opie Sheet")); |
643 | 630 | ||
644 | QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); | 631 | QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); |
645 | label.setGeometry(dialogAbout.rect()); | 632 | label.setGeometry(dialogAbout.rect()); |
646 | label.setAlignment(Qt::AlignCenter | Qt::WordBreak); | 633 | label.setAlignment(Qt::AlignCenter | Qt::WordBreak); |
647 | 634 | ||
648 | dialogAbout.exec(); | 635 | dialogAbout.exec(); |
649 | } | 636 | } |
650 | 637 | ||
651 | void MainWindow::initSheet() | 638 | void MainWindow::initSheet() |
652 | { | 639 | { |
653 | sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); | 640 | sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); |
654 | setCentralWidget(sheet); | 641 | setCentralWidget(sheet); |
655 | 642 | ||
656 | connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); | 643 | connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); |
657 | connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); | 644 | connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); |
658 | connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); | 645 | connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); |
659 | 646 | ||
660 | connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); | 647 | connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); |
661 | connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); | 648 | connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); |
662 | connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); | 649 | connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); |
663 | } | 650 | } |
664 | 651 | ||
665 | void MainWindow::slotEditAccept() | 652 | void MainWindow::slotEditAccept() |
666 | { | 653 | { |
667 | sheet->setData(editData->text()); | 654 | sheet->setData(editData->text()); |
668 | } | 655 | } |
669 | 656 | ||
670 | void MainWindow::slotEditCancel() | 657 | void MainWindow::slotEditCancel() |
671 | { | 658 | { |
672 | editData->setText(sheet->getData()); | 659 | editData->setText(sheet->getData()); |
673 | } | 660 | } |
674 | 661 | ||
675 | void MainWindow::slotCellSelect(bool lock) | 662 | void MainWindow::slotCellSelect(bool lock) |
676 | { | 663 | { |
677 | sheet->lockClicks(lock); | 664 | sheet->lockClicks(lock); |
678 | } | 665 | } |
679 | 666 | ||
680 | void MainWindow::addToData(const QString &data) | 667 | void MainWindow::addToData(const QString &data) |
681 | { | 668 | { |
682 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); | 669 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); |
683 | } | 670 | } |
684 | 671 | ||
685 | void MainWindow::slotFuncOutput() | 672 | void MainWindow::slotFuncOutput() |
686 | { | 673 | { |
687 | if (sender()->isA("QAction")) | 674 | if (sender()->isA("QAction")) |
688 | addToData(((QAction *)sender())->toolTip()); | 675 | addToData(((QAction *)sender())->toolTip()); |
689 | } | 676 | } |
690 | 677 | ||
691 | void MainWindow::slotInsertRows() | 678 | void MainWindow::slotInsertRows() |
692 | { | 679 | { |
693 | NumberDialog dialogNumber(this); | 680 | NumberDialog dialogNumber(this); |
694 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) | 681 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) |
695 | sheet->insertRows(dialogNumber.getValue()); | 682 | sheet->insertRows(dialogNumber.getValue()); |
696 | } | 683 | } |
697 | 684 | ||
698 | void MainWindow::slotInsertCols() | 685 | void MainWindow::slotInsertCols() |
699 | { | 686 | { |
700 | NumberDialog dialogNumber(this); | 687 | NumberDialog dialogNumber(this); |
701 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) | 688 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) |
702 | sheet->insertColumns(dialogNumber.getValue()); | 689 | sheet->insertColumns(dialogNumber.getValue()); |
703 | } | 690 | } |
704 | 691 | ||
705 | void MainWindow::slotInsertSheets() | 692 | void MainWindow::slotInsertSheets() |
706 | { | 693 | { |
707 | NumberDialog dialogNumber(this); | 694 | NumberDialog dialogNumber(this); |
708 | if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) | 695 | if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) |
709 | for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); | 696 | for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); |
710 | } | 697 | } |
711 | 698 | ||
712 | void MainWindow::slotCellClicked(const QString &cell) | 699 | void MainWindow::slotCellClicked(const QString &cell) |
713 | { | 700 | { |
714 | editCellSelect->setOn(FALSE); | 701 | editCellSelect->setOn(FALSE); |
715 | addToData(cell); | 702 | addToData(cell); |
716 | } | 703 | } |
717 | 704 | ||
718 | typeSheet *MainWindow::createNewSheet() | 705 | typeSheet *MainWindow::createNewSheet() |
719 | { | 706 | { |
720 | typeSheet *newSheet=new typeSheet; | 707 | typeSheet *newSheet=new typeSheet; |
721 | int currentNo=1, tempNo=0; | 708 | int currentNo=1, tempNo=0; |
722 | bool ok; | 709 | bool ok; |
723 | 710 | ||
724 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 711 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
725 | if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) | 712 | if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) |
726 | currentNo=tempNo+1; | 713 | currentNo=tempNo+1; |
727 | 714 | ||
728 | newSheet->name=tr("Sheet")+QString::number(currentNo); | 715 | newSheet->name=tr("Sheet")+QString::number(currentNo); |
729 | newSheet->data.setAutoDelete(TRUE); | 716 | newSheet->data.setAutoDelete(TRUE); |
730 | 717 | ||
731 | comboSheets->insertItem(newSheet->name); | 718 | comboSheets->insertItem(newSheet->name); |
732 | listSheets.append(newSheet); | 719 | listSheets.append(newSheet); |
733 | return newSheet; | 720 | return newSheet; |
734 | } | 721 | } |
735 | 722 | ||
736 | typeSheet *MainWindow::findSheet(const QString &name) | 723 | typeSheet *MainWindow::findSheet(const QString &name) |
737 | { | 724 | { |
738 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 725 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
739 | if (tempSheet->name==name) | 726 | if (tempSheet->name==name) |
740 | return tempSheet; | 727 | return tempSheet; |
741 | return NULL; | 728 | return NULL; |
742 | } | 729 | } |
743 | 730 | ||
744 | void MainWindow::slotSheetChanged(const QString &name) | 731 | void MainWindow::slotSheetChanged(const QString &name) |
745 | { | 732 | { |
746 | sheet->copySheetData(&findSheet(sheet->getName())->data); | 733 | sheet->copySheetData(&findSheet(sheet->getName())->data); |
747 | sheet->setName(name); | 734 | sheet->setName(name); |
748 | sheet->setSheetData(&findSheet(name)->data); | 735 | sheet->setSheetData(&findSheet(name)->data); |
749 | sheet->ReCalc(); | 736 | sheet->ReCalc(); |
750 | } | 737 | } |
751 | 738 | ||
752 | void MainWindow::addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w) | 739 | void MainWindow::addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w) |
753 | { | 740 | { |
754 | QAction *action=new QAction(text, menuText, 0, this); | 741 | QAction *action=new QAction(text, menuText, 0, this); |
755 | action->setToolTip(tip); | 742 | action->setToolTip(tip); |
756 | connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 743 | connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
757 | action->addTo(w); | 744 | action->addTo(w); |
758 | } | 745 | } |
759 | 746 | ||
760 | void MainWindow::slotFormatCells() | 747 | void MainWindow::slotFormatCells() |
761 | { | 748 | { |
762 | CellFormat dialogCellFormat(this); | 749 | CellFormat dialogCellFormat(this); |
763 | dialogCellFormat.showMaximized(); | 750 | dialogCellFormat.showMaximized(); |
764 | dialogCellFormat.exec(sheet); | 751 | dialogCellFormat.exec(sheet); |
765 | } | 752 | } |
766 | 753 | ||
767 | void MainWindow::slotEditPaste() | 754 | void MainWindow::slotEditPaste() |
768 | { | 755 | { |
769 | sheet->editPaste(); | 756 | sheet->editPaste(); |
770 | } | 757 | } |
771 | 758 | ||
772 | void MainWindow::slotEditPasteContents() | 759 | void MainWindow::slotEditPasteContents() |
773 | { | 760 | { |
774 | sheet->editPaste(TRUE); | 761 | sheet->editPaste(TRUE); |
775 | } | 762 | } |
776 | 763 | ||
777 | void MainWindow::slotRowHeight() | 764 | void MainWindow::slotRowHeight() |
778 | { | 765 | { |
779 | int row1, row2, col1, col2; | 766 | int row1, row2, col1, col2; |
780 | sheet->getSelection(&row1, &col1, &row2, &col2); | 767 | sheet->getSelection(&row1, &col1, &row2, &col2); |
781 | 768 | ||
782 | NumberDialog dialogNumber(this); | 769 | NumberDialog dialogNumber(this); |
783 | if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted) | 770 | if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted) |
784 | { | 771 | { |
785 | int newHeight=dialogNumber.getValue(), row; | 772 | int newHeight=dialogNumber.getValue(), row; |
786 | for (row=row1; row<=row2; ++row) | 773 | for (row=row1; row<=row2; ++row) |
787 | sheet->setRowHeight(row, newHeight); | 774 | sheet->setRowHeight(row, newHeight); |
788 | } | 775 | } |
789 | } | 776 | } |
790 | 777 | ||
791 | void MainWindow::slotRowAdjust() | 778 | void MainWindow::slotRowAdjust() |
792 | { | 779 | { |
793 | int row1, row2, col1, col2; | 780 | int row1, row2, col1, col2; |
794 | sheet->getSelection(&row1, &col1, &row2, &col2); | 781 | sheet->getSelection(&row1, &col1, &row2, &col2); |
795 | 782 | ||
796 | for (int row=row1; row<=row2; ++row) | 783 | for (int row=row1; row<=row2; ++row) |
797 | sheet->adjustRow(row); | 784 | sheet->adjustRow(row); |
798 | } | 785 | } |
799 | 786 | ||
800 | void MainWindow::slotRowShow() | 787 | void MainWindow::slotRowShow() |
801 | { | 788 | { |
802 | int row1, row2, col1, col2; | 789 | int row1, row2, col1, col2; |
803 | sheet->getSelection(&row1, &col1, &row2, &col2); | 790 | sheet->getSelection(&row1, &col1, &row2, &col2); |
804 | 791 | ||
805 | for (int row=row1; row<=row2; ++row) | 792 | for (int row=row1; row<=row2; ++row) |
806 | sheet->showRow(row); | 793 | sheet->showRow(row); |
807 | } | 794 | } |
808 | 795 | ||
809 | void MainWindow::slotRowHide() | 796 | void MainWindow::slotRowHide() |
810 | { | 797 | { |
811 | int row1, row2, col1, col2; | 798 | int row1, row2, col1, col2; |
812 | sheet->getSelection(&row1, &col1, &row2, &col2); | 799 | sheet->getSelection(&row1, &col1, &row2, &col2); |
813 | 800 | ||
814 | for (int row=row1; row<=row2; ++row) | 801 | for (int row=row1; row<=row2; ++row) |
815 | sheet->hideRow(row); | 802 | sheet->hideRow(row); |
816 | } | 803 | } |
817 | 804 | ||
818 | void MainWindow::slotColumnWidth() | 805 | void MainWindow::slotColumnWidth() |
819 | { | 806 | { |
820 | int row1, row2, col1, col2; | 807 | int row1, row2, col1, col2; |
821 | sheet->getSelection(&row1, &col1, &row2, &col2); | 808 | sheet->getSelection(&row1, &col1, &row2, &col2); |
822 | 809 | ||
823 | NumberDialog dialogNumber(this); | 810 | NumberDialog dialogNumber(this); |
824 | if (dialogNumber.exec(tr("Column Width"), tr("&Width of each column:"), sheet->columnWidth(col1))==QDialog::Accepted) | 811 | if (dialogNumber.exec(tr("Column Width"), tr("&Width of each column:"), sheet->columnWidth(col1))==QDialog::Accepted) |
825 | { | 812 | { |
826 | int newWidth=dialogNumber.getValue(), col; | 813 | int newWidth=dialogNumber.getValue(), col; |
827 | for (col=col1; col<=col2; ++col) | 814 | for (col=col1; col<=col2; ++col) |
828 | sheet->setColumnWidth(col, newWidth); | 815 | sheet->setColumnWidth(col, newWidth); |
829 | } | 816 | } |
830 | } | 817 | } |
831 | 818 | ||
832 | void MainWindow::slotColumnAdjust() | 819 | void MainWindow::slotColumnAdjust() |
833 | { | 820 | { |
834 | int row1, row2, col1, col2; | 821 | int row1, row2, col1, col2; |
835 | sheet->getSelection(&row1, &col1, &row2, &col2); | 822 | sheet->getSelection(&row1, &col1, &row2, &col2); |
836 | 823 | ||
837 | for (int col=col1; col<=col2; ++col) | 824 | for (int col=col1; col<=col2; ++col) |
838 | sheet->adjustColumn(col); | 825 | sheet->adjustColumn(col); |
839 | } | 826 | } |
840 | 827 | ||
841 | void MainWindow::slotColumnShow() | 828 | void MainWindow::slotColumnShow() |
842 | { | 829 | { |
843 | int row1, row2, col1, col2; | 830 | int row1, row2, col1, col2; |
844 | sheet->getSelection(&row1, &col1, &row2, &col2); | 831 | sheet->getSelection(&row1, &col1, &row2, &col2); |
845 | 832 | ||
846 | for (int col=col1; col<=col2; ++col) | 833 | for (int col=col1; col<=col2; ++col) |
847 | sheet->showColumn(col); | 834 | sheet->showColumn(col); |
848 | } | 835 | } |
849 | 836 | ||
850 | void MainWindow::slotColumnHide() | 837 | void MainWindow::slotColumnHide() |
851 | { | 838 | { |
852 | int row1, row2, col1, col2; | 839 | int row1, row2, col1, col2; |
853 | sheet->getSelection(&row1, &col1, &row2, &col2); | 840 | sheet->getSelection(&row1, &col1, &row2, &col2); |
854 | 841 | ||
855 | for (int col=col1; col<=col2; ++col) | 842 | for (int col=col1; col<=col2; ++col) |
856 | sheet->hideColumn(col); | 843 | sheet->hideColumn(col); |
857 | } | 844 | } |
858 | 845 | ||
859 | void MainWindow::slotFileSaveAs() | 846 | void MainWindow::slotFileSaveAs() |
860 | { | 847 | { |
861 | TextDialog dialogText(this); | 848 | TextDialog dialogText(this); |
862 | if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc->name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; | 849 | if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc->name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; |
863 | 850 | ||
864 | currentDoc->setName(dialogText.getValue()); | 851 | currentDoc->setName(dialogText.getValue()); |
865 | currentDoc->setFile(QString::null); | 852 | currentDoc->setFile(QString::null); |
866 | currentDoc->setLinkFile(QString::null); | 853 | currentDoc->setLinkFile(QString::null); |
867 | documentSave(currentDoc); | 854 | documentSave(currentDoc); |
868 | } | 855 | } |
869 | 856 | ||
870 | void MainWindow::slotImportExcel(const DocLnk &lnkDoc) | 857 | void MainWindow::slotImportExcel(const DocLnk &lnkDoc) |
871 | { | 858 | { |
872 | ExcelBook file1; | 859 | ExcelBook file1; |
873 | file1.ParseBook((char *)lnkDoc.file().ascii()); | 860 | file1.ParseBook((char *)lnkDoc.file().ascii()); |
874 | int NumOfSheets=file1.Sheets.count(); | 861 | int NumOfSheets=file1.Sheets.count(); |
875 | printf("OpieSheet::NumberOfSheets:%d\r\n",NumOfSheets); | 862 | printf("OpieSheet::NumberOfSheets:%d\r\n",NumOfSheets); |
876 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; | 863 | if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; |
877 | if (currentDoc) delete currentDoc; | 864 | if (currentDoc) delete currentDoc; |
878 | currentDoc = new DocLnk(); | 865 | currentDoc = new DocLnk(); |
879 | listSheets.clear(); | 866 | listSheets.clear(); |
880 | comboSheets->clear(); | 867 | comboSheets->clear(); |
881 | int w1,r,c; | 868 | int w1,r,c; |
882 | ExcelSheet* sh1; | 869 | ExcelSheet* sh1; |
883 | typeSheet* newSheet; | 870 | typeSheet* newSheet; |
884 | QString* str; | 871 | QString* str; |
885 | typeCellData* newCell; | 872 | typeCellData* newCell; |
886 | for(w1=1;w1<=NumOfSheets;w1++) | 873 | for(w1=1;w1<=NumOfSheets;w1++) |
887 | { | 874 | { |
888 | sh1=file1.Sheets[w1-1]; | 875 | sh1=file1.Sheets[w1-1]; |
889 | printf("OpieSheet:newSheet:%x,r=%d,c=%d\r\n",sh1,sh1->rows,sh1->cols); | 876 | printf("OpieSheet:newSheet:%x,r=%d,c=%d\r\n",sh1,sh1->rows,sh1->cols); |
890 | newSheet=new typeSheet; | 877 | newSheet=new typeSheet; |
891 | newSheet->data.setAutoDelete(TRUE); | 878 | newSheet->data.setAutoDelete(TRUE); |
892 | newSheet->name=sh1->name; | 879 | newSheet->name=sh1->name; |
893 | printf("OpieSheet:Sheetname:%s\r\n",sh1->name.ascii()); | 880 | printf("OpieSheet:Sheetname:%s\r\n",sh1->name.ascii()); |
894 | comboSheets->insertItem(newSheet->name); | 881 | comboSheets->insertItem(newSheet->name); |
895 | for(r=1; r <= sh1->rows; r++) | 882 | for(r=1; r <= sh1->rows; r++) |
896 | { | 883 | { |
897 | for(c=1;c <= sh1->cols; c++) | 884 | for(c=1;c <= sh1->cols; c++) |
898 | { | 885 | { |
899 | str=file1.CellDataString(sh1,r-1,c-1); | 886 | str=file1.CellDataString(sh1,r-1,c-1); |
900 | if(str!=NULL && r<DEFAULT_NUM_ROWS && c<DEFAULT_NUM_COLS) | 887 | if(str!=NULL && r<DEFAULT_NUM_ROWS && c<DEFAULT_NUM_COLS) |
901 | { | 888 | { |
902 | newCell=new typeCellData; | 889 | newCell=new typeCellData; |
903 | newCell->row=r-1; | 890 | newCell->row=r-1; |
904 | newCell->col=c-1; | 891 | newCell->col=c-1; |
905 | if(str!=NULL) newCell->data=QString(*str); else newCell->data=QString(""); | 892 | if(str!=NULL) newCell->data=QString(*str); else newCell->data=QString(""); |
906 | newCell->background=QBrush(Qt::white, Qt::SolidPattern); | 893 | newCell->background=QBrush(Qt::white, Qt::SolidPattern); |
907 | newCell->alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); | 894 | newCell->alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); |
908 | newCell->fontColor=Qt::black; | 895 | newCell->fontColor=Qt::black; |
909 | newCell->font=font(); | 896 | newCell->font=font(); |
910 | newCell->borders.right=QPen(Qt::gray, 1, Qt::SolidLine); | 897 | newCell->borders.right=QPen(Qt::gray, 1, Qt::SolidLine); |
911 | newCell->borders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); | 898 | newCell->borders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); |
912 | newSheet->data.append(newCell); | 899 | newSheet->data.append(newCell); |
913 | //there is no format parsing at the moment or style parsing | 900 | //there is no format parsing at the moment or style parsing |
914 | //printf("OpieSheetNumber:row=%d,col=%d,val=%s\r\n",r,c,str->latin1()); | 901 | //printf("OpieSheetNumber:row=%d,col=%d,val=%s\r\n",r,c,str->latin1()); |
915 | }; | 902 | }; |
916 | }; | 903 | }; |
917 | }; | 904 | }; |
918 | listSheets.append(newSheet); | 905 | listSheets.append(newSheet); |
919 | if (w1==1)//if i==0 link sheet1 with sheetview | 906 | if (w1==1)//if i==0 link sheet1 with sheetview |
920 | { | 907 | { |
921 | sheet->setName(newSheet->name); | 908 | sheet->setName(newSheet->name); |
922 | sheet->setSheetData(&newSheet->data); | 909 | sheet->setSheetData(&newSheet->data); |
923 | sheet->ReCalc(); | 910 | sheet->ReCalc(); |
924 | }; | 911 | }; |
925 | 912 | ||
926 | }; | 913 | }; |
927 | file1.CloseFile(); | 914 | file1.CloseFile(); |
928 | printf("Excel FILE read OK\r\n"); | 915 | printf("Excel FILE read OK\r\n"); |
929 | documentModified=TRUE; | 916 | documentModified=TRUE; |
930 | 917 | ||
931 | 918 | ||
932 | } | 919 | } |
933 | 920 | ||
934 | void MainWindow::slotSheetRename() | 921 | void MainWindow::slotSheetRename() |
935 | { | 922 | { |
936 | TextDialog dialogText(this); | 923 | TextDialog dialogText(this); |
937 | if (dialogText.exec(tr("Rename Sheet"), tr("&Sheet Name:"), sheet->getName())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; | 924 | if (dialogText.exec(tr("Rename Sheet"), tr("&Sheet Name:"), sheet->getName())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; |
938 | QString newName=dialogText.getValue(); | 925 | QString newName=dialogText.getValue(); |
939 | 926 | ||
940 | typeSheet *tempSheet=findSheet(newName); | 927 | typeSheet *tempSheet=findSheet(newName); |
941 | if (tempSheet) | 928 | if (tempSheet) |
942 | { | 929 | { |
943 | QMessageBox::critical(this, tr("Error"), tr("There is already a sheet named '"+newName+'\'')); | 930 | QMessageBox::critical(this, tr("Error"), tr("There is already a sheet named '"+newName+'\'')); |
944 | return; | 931 | return; |
945 | } | 932 | } |
946 | 933 | ||
947 | tempSheet=findSheet(sheet->getName()); | 934 | tempSheet=findSheet(sheet->getName()); |
948 | for (int i=0; i<comboSheets->count(); ++i) | 935 | for (int i=0; i<comboSheets->count(); ++i) |
949 | if (comboSheets->text(i)==tempSheet->name) | 936 | if (comboSheets->text(i)==tempSheet->name) |
950 | { | 937 | { |
951 | comboSheets->changeItem(newName, i); | 938 | comboSheets->changeItem(newName, i); |
952 | break; | 939 | break; |
953 | } | 940 | } |
954 | tempSheet->name=newName; | 941 | tempSheet->name=newName; |
955 | sheet->setName(newName); | 942 | sheet->setName(newName); |
956 | } | 943 | } |
957 | 944 | ||
958 | void MainWindow::slotSheetRemove() | 945 | void MainWindow::slotSheetRemove() |
959 | { | 946 | { |
960 | if (comboSheets->count()<2) | 947 | if (comboSheets->count()<2) |
961 | { | 948 | { |
962 | QMessageBox::warning(this, tr("Error"), tr("There is only one sheet!")); | 949 | QMessageBox::warning(this, tr("Error"), tr("There is only one sheet!")); |
963 | return; | 950 | return; |
964 | } | 951 | } |
965 | if (QMessageBox::information(this, tr("Remove Sheet"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes) | 952 | if (QMessageBox::information(this, tr("Remove Sheet"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes) |
966 | { | 953 | { |
967 | typeSheet *tempSheet=findSheet(sheet->getName()); | 954 | typeSheet *tempSheet=findSheet(sheet->getName()); |
968 | for (int i=0; i<comboSheets->count(); ++i) | 955 | for (int i=0; i<comboSheets->count(); ++i) |
969 | if (comboSheets->text(i)==tempSheet->name) | 956 | if (comboSheets->text(i)==tempSheet->name) |
970 | { | 957 | { |
971 | comboSheets->removeItem(i); | 958 | comboSheets->removeItem(i); |
972 | break; | 959 | break; |
973 | } | 960 | } |
974 | comboSheets->setCurrentItem(0); | 961 | comboSheets->setCurrentItem(0); |
975 | slotSheetChanged(comboSheets->currentText()); | 962 | slotSheetChanged(comboSheets->currentText()); |
976 | listSheets.remove(tempSheet); | 963 | listSheets.remove(tempSheet); |
977 | } | 964 | } |
978 | } | 965 | } |
979 | 966 | ||
980 | void MainWindow::slotDataSort() | 967 | void MainWindow::slotDataSort() |
981 | { | 968 | { |
982 | SortDialog dialogSort(this); | 969 | SortDialog dialogSort(this); |
983 | dialogSort.showMaximized(); | 970 | dialogSort.showMaximized(); |
984 | dialogSort.exec(sheet); | 971 | dialogSort.exec(sheet); |
985 | } | 972 | } |
986 | 973 | ||
987 | void MainWindow::slotDocModified() | 974 | void MainWindow::slotDocModified() |
988 | { | 975 | { |
989 | documentModified=TRUE; | 976 | documentModified=TRUE; |
990 | } | 977 | } |
991 | 978 | ||
992 | void MainWindow::slotInsertCells() | 979 | void MainWindow::slotInsertCells() |
993 | { | 980 | { |
994 | QDialog dialogInsert(this, 0, TRUE); | 981 | QDialog dialogInsert(this, 0, TRUE); |
995 | dialogInsert.resize(180, 130); | 982 | dialogInsert.resize(180, 130); |
996 | dialogInsert.setCaption(tr("Insert Cells")); | 983 | dialogInsert.setCaption(tr("Insert Cells")); |
997 | 984 | ||
998 | QVButtonGroup *group=new QVButtonGroup(tr("&Type"), &dialogInsert); | 985 | QVButtonGroup *group=new QVButtonGroup(tr("&Type"), &dialogInsert); |
999 | group->setGeometry(10, 10, 160, 110); | 986 | group->setGeometry(10, 10, 160, 110); |
1000 | QRadioButton *radio=new QRadioButton(tr("Shift cells &down"), group); | 987 | QRadioButton *radio=new QRadioButton(tr("Shift cells &down"), group); |
1001 | radio=new QRadioButton(tr("Shift cells &right"), group); | 988 | radio=new QRadioButton(tr("Shift cells &right"), group); |
1002 | radio=new QRadioButton(tr("Entire ro&w"), group); | 989 | radio=new QRadioButton(tr("Entire ro&w"), group); |
1003 | radio=new QRadioButton(tr("Entire &column"), group); | 990 | radio=new QRadioButton(tr("Entire &column"), group); |
1004 | group->setButton(0); | 991 | group->setButton(0); |
1005 | 992 | ||
1006 | if (dialogInsert.exec()==QDialog::Accepted) | 993 | if (dialogInsert.exec()==QDialog::Accepted) |
1007 | switch (group->id(group->selected())) | 994 | switch (group->id(group->selected())) |
1008 | { | 995 | { |
1009 | case 0: sheet->insertRows(1, FALSE); break; | 996 | case 0: sheet->insertRows(1, FALSE); break; |
1010 | case 1: sheet->insertColumns(1, FALSE); break; | 997 | case 1: sheet->insertColumns(1, FALSE); break; |
1011 | case 2: sheet->insertRows(1, TRUE); break; | 998 | case 2: sheet->insertRows(1, TRUE); break; |
1012 | case 3: sheet->insertColumns(1, TRUE); break; | 999 | case 3: sheet->insertColumns(1, TRUE); break; |
1013 | } | 1000 | } |
1014 | } | 1001 | } |
1015 | 1002 | ||
1016 | void MainWindow::slotDataFindReplace() | 1003 | void MainWindow::slotDataFindReplace() |
1017 | { | 1004 | { |
1018 | FindDialog dialogFind(this); | 1005 | FindDialog dialogFind(this); |
1019 | dialogFind.showMaximized(); | 1006 | dialogFind.showMaximized(); |
1020 | dialogFind.exec(sheet); | 1007 | dialogFind.exec(sheet); |
1021 | } | 1008 | } |