1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
|
/*************************************************************************
*
* $RCSfile: global.hxx,v $
*
* $Revision: 1.22 $
*
* last change: $Author: hr $ $Date: 2003-03-26 18:03:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef SC_SCGLOB_HXX
#define SC_SCGLOB_HXX
#ifndef _LANG_HXX //autogen
#include <tools/lang.hxx>
#endif
#ifndef _STREAM_HXX //autogen
#include <tools/stream.hxx>
#endif
class ImageList;
class Bitmap;
class SfxItemSet;
class Color;
#ifdef WIN
// auf Windows 16 muessen die Zeilen weiter auf 8192 begrenzt werden
// (zum Testen per Hand definieren)
#define SC_LIMIT_ROWS
#endif
// Macro fuer den Call-Profiler unter WinNT
// mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden
#if defined( WNT ) && defined( PROFILE )
extern "C" {
void StartCAP();
void StopCAP();
void DumpCAP();
};
#define S_CAP StartCAP();
#define E_CAP StopCAP(); DumpCAP();
#endif
#if 0
// I18N doesn't get this right, can't specify more than one to ignore
#define SC_COLLATOR_IGNORES ( \
::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \
::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \
::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH )
#else
#define SC_COLLATOR_IGNORES ( \
::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
#endif
#define SC_TRANSLITERATION_IGNORECASE ( \
::com::sun::star::i18n::TransliterationModules_IGNORE_CASE | \
::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \
::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH )
#define SC_TRANSLITERATION_CASESENSE ( \
::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \
::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH )
//------------------------------------------------------------------------
struct LabelData;
//------------------------------------------------------------------------
// die 1000 Namen des Calc...
// Clipboard-Namen sind jetzt in so3/soapp.hxx
// STRING_SCAPP war "scalc3", "scalc4", jetzt nur noch "scalc"
#define STRING_SCAPP "scalc"
#define STRING_SCSTREAM "StarCalcDocument"
#define STRING_STANDARD "Standard"
// '\r' geht auf'm Mac nicht...
#define CHAR_CR char(13)
#define MINDOUBLE 1.7e-307
#define MAXDOUBLE 1.7e307
#define MAXROW_30 8191
#define MAXROW_40 31999
#ifdef SC_LIMIT_ROWS
#define MAXROW 8191
#else
#define MAXROW 31999
#endif
#define MAXCOL 255
#define MAXTAB 255
#define MINZOOM 20
#define MAXZOOM 400
#define MAXSUBTOTAL 3
#define MAXQUERY 8
#define PIVOT_MAXFIELD 8
#define SC_START_INDEX_DB_COLL 50000
// Oberhalb dieser Grenze liegen
// die Indizes fuer DBBereiche
#define VALIDROW(nRow) (nRow>=0 && nRow<=MAXROW)
#define VALIDCOL(nCol) (nCol>=0 && nCol<=MAXCOL)
#define VALIDTAB(nTab) (nTab>=0 && nTab<=MAXTAB)
#define VALIDCOLROW(nCol,nRow) (VALIDCOL(nCol) && VALIDROW(nRow))
#define VALIDCOLROWTAB(nCol,nRow,nTab) (VALIDCOL(nCol) && VALIDROW(nRow) && VALIDTAB(nTab))
inline BOOL ValidColRow(USHORT nCol, USHORT nRow)
{
return nCol <= MAXCOL && nRow <= MAXROW;
}
inline BOOL ValidColRowTab(USHORT nCol, USHORT nRow, USHORT nTab)
{
return nCol <= MAXCOL && nRow <= MAXROW && nTab <= MAXTAB;
}
/*
#ifdef OS2
#define PIXEL_PER_INCH 72.0
#else
#define PIXEL_PER_INCH 96.0
#endif
*/
#define PIXEL_PER_INCH 96.0
#define CM_PER_INCH 2.54
#define POINTS_PER_INCH 72.27
#define PIXEL_PER_POINT (PIXEL_PER_INCH / POINTS_PER_INCH)
#define INCHT_PER_CM (1.0 / CM_PER_INCH)
#define POINTS_PER_CM (POINTS_PER_INCH / CM_PER_INCH)
#define TWIPS_PER_POINT 20.0
#define TWIPS_PER_INCH (TWIPS_PER_POINT * POINTS_PER_INCH)
#define TWIPS_PER_CM (TWIPS_PER_INCH / CM_PER_INCH)
#define CM_PER_TWIPS (CM_PER_INCH / TWIPS_PER_INCH)
#define TWIPS_PER_PIXEL (TWIPS_PER_INCH / PIXEL_PER_INCH)
#define TWIPS_PER_CHAR (TWIPS_PER_INCH / 13.6)
#define PIXEL_PER_TWIPS (PIXEL_PER_INCH / TWIPS_PER_INCH)
#define HMM_PER_TWIPS (CM_PER_TWIPS * 1000.0)
#define STD_COL_WIDTH 1285
#define STD_EXTRA_WIDTH 113 // 2mm Extra fuer optimale Breite
// Standard Zeilenhoehe: Text + Rand - STD_ROWHEIGHT_DIFF
#define MAX_EXTRA_WIDTH 23811 // 42cm in TWIPS
#define MAX_EXTRA_HEIGHT 23811
#define MAX_COL_WIDTH 56693 // 1m in TWIPS
#define MAX_COL_HEIGHT 56693
#ifdef MAC
#define STD_ROWHEIGHT_DIFF 3
#else
#define STD_ROWHEIGHT_DIFF 23
#endif
#define STD_FONT_HEIGHT 200 // entspricht 10 Punkt
//! statt STD_ROW_HEIGHT ScGlobal::nStdRowHeight benutzen !
#ifdef MAC // Mac braucht mehr Platz
#define STD_ROW_HEIGHT (14.8 * TWIPS_PER_POINT) //
#else
#define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) // 256 Twips, 0.45 cm
#endif
// Standardgroesse als Ole-Server (Zellen)
#define OLE_STD_CELLS_X 4
#define OLE_STD_CELLS_Y 5
#define SC_SIZE_OPTIMUM 0xFFFF
// Update-Flags
#define UF_SCROLL_LEFT 1
#define UF_SCROLL_RIGHT 2
#define UF_SCROLL_UP 4
#define UF_SCROLL_DOWN 8
#define UF_ROW 16
#define UF_VIEW 32
// Repaint-Flags (fuer Messages)
#define PAINT_GRID 1
#define PAINT_TOP 2
#define PAINT_LEFT 4
#define PAINT_EXTRAS 8
#define PAINT_INVERT 16
#define PAINT_MARKS 32
#define PAINT_OBJECTS 64
#define PAINT_SIZE 128
#define PAINT_ALL ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE )
// Flags fuer Spalten / Zeilen
// FILTERED immer zusammen mit HIDDEN
// FILTERED und MANUALSIZE nur fuer Zeilen moeglich
#define CR_HIDDEN 1
//#define CR_MARKED 2
#define CR_PAGEBREAK 4
#define CR_MANUALBREAK 8
#define CR_FILTERED 16
#define CR_MANUALSIZE 32
// was davon kommt in die Datei:
#define CR_SAVEMASK ( ~CR_PAGEBREAK )
// Insert-/Delete-Flags
#define IDF_VALUE 0x0001
#define IDF_DATETIME 0x0002
#define IDF_STRING 0x0004
#define IDF_NOTE 0x0008
#define IDF_FORMULA 0x0010
#define IDF_HARDATTR 0x0020
#define IDF_STYLES 0x0040
#define IDF_OBJECTS 0x0080
#define IDF_EDITATTR 0x0100
#define IDF_ATTRIB ( IDF_HARDATTR | IDF_STYLES )
#define IDF_CONTENTS ( IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA )
#define IDF_ALL ( IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS )
#define IDF_NONE 0x0000
#define PASTE_NOFUNC 0
#define PASTE_ADD 1
#define PASTE_SUB 2
#define PASTE_MUL 3
#define PASTE_DIV 4
#define PASTE_NONEMPTY 5
// Bits fuer HasAttr
#define HASATTR_LINES 1
#define HASATTR_MERGED 2
#define HASATTR_OVERLAPPED 4
#define HASATTR_PROTECTED 8
#define HASATTR_SHADOW 16
#define HASATTR_NEEDHEIGHT 32
#define HASATTR_SHADOW_RIGHT 64
#define HASATTR_SHADOW_DOWN 128
#define HASATTR_AUTOFILTER 256
#define HASATTR_CONDITIONAL 512
#define HASATTR_ROTATE 1024
#define HASATTR_NOTOVERLAPPED 2048
#define HASATTR_RTL 4096
#define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL )
#define EMPTY_STRING ScGlobal::GetEmptyString()
// Layer-ID's fuer Drawing
#define SC_LAYER_FRONT 0
#define SC_LAYER_BACK 1
#define SC_LAYER_INTERN 2
#define SC_LAYER_CONTROLS 3
// Tabellen linken
#define SC_LINK_NONE 0
#define SC_LINK_NORMAL 1
#define SC_LINK_VALUE 2
// Eingabe
#define SC_ENTER_NORMAL 0
#define SC_ENTER_BLOCK 1
#define SC_ENTER_MATRIX 2
// Step = 10pt, max. Einzug = 100 Schritte
#define SC_INDENT_STEP 200
#define SC_MAX_INDENT 20000
// Szenario-Flags
#define SC_SCENARIO_COPYALL 1
#define SC_SCENARIO_SHOWFRAME 2
#define SC_SCENARIO_PRINTFRAME 4
#define SC_SCENARIO_TWOWAY 8
#define SC_SCENARIO_ATTRIB 16
#define SC_SCENARIO_VALUE 32
#ifndef DELETEZ
#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
#endif
// Ist Bit in Set gesetzt?
#define IS_SET(bit,set)(((set)&(bit))==(bit))
#define MAX_FUNCCAT 12 // max. Kategorien fuer Funktionen
#define SEL_ALL -1 // Eingabezeile: alles Selektieren
#define RES_CANCEL 0 // Resultate der Funk.AutoPilot-Seiten
#define RES_BACKWARD 1
#define RES_END 2
enum CellType
{
CELLTYPE_NONE,
CELLTYPE_VALUE,
CELLTYPE_STRING,
CELLTYPE_FORMULA,
CELLTYPE_NOTE,
CELLTYPE_EDIT,
CELLTYPE_SYMBOLS, // fuer Laden/Speichern
CELLTYPE_DESTROYED
};
enum DelCellCmd
{
DEL_CELLSUP,
DEL_CELLSLEFT,
DEL_DELROWS,
DEL_DELCOLS,
DEL_NONE
};
enum InsCellCmd
{
INS_CELLSDOWN,
INS_CELLSRIGHT,
INS_INSROWS,
INS_INSCOLS,
INS_NONE
};
enum UpdateRefMode
{
URM_INSDEL,
URM_COPY,
URM_MOVE,
URM_REORDER
};
enum FillDir
{
FILL_TO_BOTTOM,
FILL_TO_RIGHT,
FILL_TO_TOP,
FILL_TO_LEFT
};
enum FillCmd
{
FILL_SIMPLE,
FILL_LINEAR,
FILL_GROWTH,
FILL_DATE,
FILL_AUTO
};
enum FillDateCmd
{
FILL_DAY,
FILL_WEEKDAY,
FILL_MONTH,
FILL_YEAR
};
enum ScDirection
{
DIR_BOTTOM,
DIR_RIGHT,
DIR_TOP,
DIR_LEFT
};
enum ScSizeMode
{
SC_SIZE_DIRECT, // set size or hide if value is 0
SC_SIZE_OPTIMAL, // set optimal size for everything
SC_SIZE_SHOW, // show with original size
SC_SIZE_VISOPT, // set optimal size only if visible
SC_SIZE_ORIGINAL // only set size, don't change visible flag
};
enum ScInputMode
{
SC_INPUT_NONE,
SC_INPUT_TYPE, // Eingabe, ohne im Inplace-Modus zu sein
SC_INPUT_TABLE, // Textcursor in der Tabelle
SC_INPUT_TOP // Textcursor in der Eingabezeile
};
enum ScVObjMode // Ausgabemodi von Objekten auf einer Seite
{
VOBJ_MODE_SHOW,
VOBJ_MODE_HIDE,
VOBJ_MODE_DUMMY
};
enum ScAnchorType // Verankerung eines Zeichenobjekts
{
SCA_CELL,
SCA_PAGE,
SCA_DONTKNOW // bei Mehrfachselektion
};
enum ScGetDBMode
{
SC_DB_MAKE, // wenn noetig, "unbenannt" anlegen
SC_DB_IMPORT, // wenn noetig, "Importx" anlegen
SC_DB_OLD // nicht neu anlegen
};
enum ScLkUpdMode
{ //Verknuepfungen
LM_ALWAYS, //immer aktualisieren
LM_NEVER, //niemals
LM_ON_DEMAND, //auf nachfrage
LM_UNKNOWN //Shit happens
};
// -----------------------------------------------------------------------
//==================================================================
// -----------------------------------------------------------------------
// enum with values equal to old DBObject enum from sdb
enum ScDBObject
{
ScDbTable,
ScDbQuery
};
struct ScImportParam
{
USHORT nCol1;
USHORT nRow1;
USHORT nCol2;
USHORT nRow2;
BOOL bImport;
String aDBName; // Alias der Datenbank
String aStatement;
BOOL bNative;
BOOL bSql; // Statement oder Name?
BYTE nType; // enum DBObject
ScImportParam();
ScImportParam( const ScImportParam& r );
~ScImportParam();
ScImportParam& operator= ( const ScImportParam& r );
BOOL operator== ( const ScImportParam& r ) const;
void Clear ();
};
// -----------------------------------------------------------------------
class ScDocument;
class ScDocShell;
class ScDocShellRef;
class SvxSearchItem;
class ScAutoFormat;
class FuncCollection;
class ScUnoAddInCollection;
class ScUserList;
class SvxBrushItem;
class ScFunctionList;
class ScFunctionMgr;
class SfxItemPool;
class SdrModel;
class EditTextObject;
class SfxObjectShell;
class SvNumberFormatter;
class ScUnitConverter;
class CharClass;
class LocaleDataWrapper;
class SvtSysLocale;
class CalendarWrapper;
class CollatorWrapper;
class IntlWrapper;
class OutputDevice;
namespace com { namespace sun { namespace star { namespace lang {
struct Locale;
}}}}
namespace utl {
class TransliterationWrapper;
}
#ifndef _SCALC_EXE
class ScGlobal
{
static SvxSearchItem* pSearchItem;
static ScAutoFormat* pAutoFormat;
static FuncCollection* pFuncCollection;
static ScUnoAddInCollection* pAddInCollection;
static ScUserList* pUserList;
static String** ppRscString;
static String* pStrScDoc;
static String* pEmptyString;
static String* pStrClipDocName;
static SvxBrushItem* pEmptyBrushItem;
static SvxBrushItem* pButtonBrushItem;
static SvxBrushItem* pEmbeddedBrushItem;
static SvxBrushItem* pProtectedBrushItem;
static ImageList* pOutlineBitmaps;
static ImageList* pOutlineBitmapsHC;
// static Bitmap* pAnchorBitmap;
// static Bitmap* pGrayAnchorBitmap;
static ScFunctionList* pStarCalcFunctionList;
static ScFunctionMgr* pStarCalcFunctionMgr;
static ScUnitConverter* pUnitConverter;
static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export
public:
static ::com::sun::star::lang::Locale* pLocale;
static SvtSysLocale* pSysLocale;
// for faster access a pointer to the single instance provided by SvtSysLocale
static const CharClass* pCharClass;
// for faster access a pointer to the single instance provided by SvtSysLocale
static const LocaleDataWrapper* pLocaleData;
static CalendarWrapper* pCalendar;
static CollatorWrapper* pCollator;
static CollatorWrapper* pCaseCollator;
static ::utl::TransliterationWrapper* pTransliteration;
static ::utl::TransliterationWrapper* pCaseTransliteration;
static IntlWrapper* pScIntlWrapper;
static LanguageType eLnge;
static sal_Unicode cListDelimiter;
static const String& GetClipDocName();
static void SetClipDocName( const String& rNew );
static const SvxSearchItem& GetSearchItem();
static void SetSearchItem( const SvxSearchItem& rNew );
static ScAutoFormat* GetAutoFormat();
static void ClearAutoFormat(); //BugId 54209
static FuncCollection* GetFuncCollection();
static ScUnoAddInCollection* GetAddInCollection();
static ScUserList* GetUserList();
static void SetUserList( const ScUserList* pNewList );
static const String& GetRscString( USHORT nIndex );
static void OpenURL( const String& rURL, const String& rTarget );
static String GetAbsDocName( const String& rFileName,
SfxObjectShell* pShell );
static String GetDocTabName( const String& rFileName,
const String& rTabName );
static ULONG GetStandardFormat( SvNumberFormatter&,
ULONG nFormat, short nType );
static ULONG GetStandardFormat( double, SvNumberFormatter&,
ULONG nFormat, short nType );
static double nScreenPPTX;
static double nScreenPPTY;
static ScDocShellRef* pDrawClipDocShellRef;
static USHORT nDefFontHeight;
static USHORT nStdRowHeight;
static long nLastRowHeightExtra;
static long nLastColWidthExtra;
static void Init(); // am Anfang
static void InitAddIns();
static void Clear(); // bei Programmende
static void UpdatePPT(OutputDevice* pDev);
static void InitTextHeight(SfxItemPool* pPool);
static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; }
static SvxBrushItem* GetButtonBrushItem();
static SvxBrushItem* GetEmbeddedBrushItem() { return pEmbeddedBrushItem; }
static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; }
static const String& GetEmptyString();
static const String& GetScDocString();
/** Returns the specified image list with outline symbols.
@param bHC false = standard symbols; true = high contrast symbols. */
static ImageList* GetOutlineSymbols( bool bHC );
// static const Bitmap& GetAnchorBitmap();
// static const Bitmap& GetGrayAnchorBitmap();
static ScFunctionList* GetStarCalcFunctionList();
static ScFunctionMgr* GetStarCalcFunctionMgr();
static String GetErrorString(USHORT nErrNumber);
static String GetLongErrorString(USHORT nErrNumber);
static BOOL EETextObjEqual( const EditTextObject* pObj1,
const EditTextObject* pObj2 );
static BOOL CheckWidthInvalidate( BOOL& bNumFormatChanged,
const SfxItemSet& rNewAttrs,
const SfxItemSet& rOldAttrs );
static BOOL HasAttrChanged( const SfxItemSet& rNewAttrs,
const SfxItemSet& rOldAttrs,
const USHORT nWhich );
static ScUnitConverter* GetUnitConverter();
/// strchr() functionality on unicode, as long as we need it for ScToken etc.
static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c );
static inline sal_Unicode ToUpperAlpha( sal_Unicode c )
{ return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; }
static CharSet GetCharsetValue( const String& rCharSet );
static String GetCharsetString( CharSet eVal );
/// a "ReadOnly" formatter for UNO/XML export
static SvNumberFormatter* GetEnglishFormatter();
static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage
static BYTE GetDefaultScriptType(); // for all WEAK characters
/** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
If more than one SCRIPTTYPE_... values are or'ed together, prefers
first COMPLEX, then ASIAN */
static USHORT GetScriptedWhichID( BYTE nScriptType, USHORT nWhich );
/** Adds a language item to the item set, if the number format item contains
a language that differs from its parent's language. */
static void AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter );
};
#endif
class ScTripel
{
public:
USHORT nCol;
USHORT nRow;
USHORT nTab;
public:
ScTripel();
ScTripel( USHORT nNewCol, USHORT nNewRow, USHORT nNewTab );
ScTripel( const ScTripel& rRef );
~ScTripel();
USHORT GetCol() const { return nCol; }
USHORT GetRow() const { return nRow; }
USHORT GetTab() const { return nTab; }
void SetCol(USHORT nNewCol) { nCol = nNewCol; }
void SetRow(USHORT nNewRow) { nRow = nNewRow; }
void SetTab(USHORT nNewTab) { nTab = nNewTab; }
void Put(USHORT nNewCol, USHORT nNewRow, USHORT nNewTab)
{ nCol=nNewCol; nRow=nNewRow; nTab=nNewTab; }
inline int operator == ( const ScTripel& rTripel ) const;
int operator != ( const ScTripel& rTripel ) const { return !(operator==(rTripel)); }
String GetText() const; // "(1,2,3)"
String GetColRowString( BOOL bAbolute = FALSE ) const; // "A1"||"$A$1"
};
inline ScTripel::ScTripel() :
nCol(0), nRow(0), nTab(0)
{}
inline ScTripel::ScTripel( USHORT nNewCol, USHORT nNewRow, USHORT nNewTab ) :
nCol(nNewCol), nRow(nNewRow), nTab(nNewTab)
{}
inline ScTripel::ScTripel( const ScTripel& rRef ) :
nCol(rRef.nCol), nRow(rRef.nRow), nTab(rRef.nTab)
{}
inline ScTripel::~ScTripel()
{}
inline int ScTripel::operator==( const ScTripel& rTripel ) const
{
return nCol==rTripel.nCol && nRow==rTripel.nRow && nTab==rTripel.nTab;
}
class ScRefTripel : public ScTripel
{
BOOL bRelCol;
BOOL bRelRow;
BOOL bRelTab;
public:
ScRefTripel() :
ScTripel(), bRelCol(FALSE), bRelRow(FALSE), bRelTab(FALSE) {}
ScRefTripel( USHORT nNewCol, USHORT nNewRow, USHORT nNewTab, BOOL bNewRelCol, BOOL bNewRelRow, BOOL bNewRelTab ) :
ScTripel(nNewCol, nNewRow, nNewTab), bRelCol(bNewRelCol), bRelRow(bNewRelRow), bRelTab(bNewRelTab) {}
ScRefTripel( const ScRefTripel& rRef ) :
ScTripel(rRef.nCol, rRef.nRow, rRef.nTab), bRelCol(rRef.bRelCol), bRelRow(rRef.bRelRow), bRelTab(rRef.bRelTab) {}
BOOL GetRelCol() const { return bRelCol; }
BOOL GetRelRow() const { return bRelRow; }
BOOL GetRelTab() const { return bRelTab; }
void SetRelCol(BOOL bNewRelCol) { bRelCol = bNewRelCol; }
void SetRelRow(BOOL bNewRelRow) { bRelRow = bNewRelRow; }
void SetRelTab(BOOL bNewRelTab) { bRelTab = bNewRelTab; }
void Put(USHORT nNewCol, USHORT nNewRow, USHORT nNewTab, BOOL bNewRelCol, BOOL bNewRelRow, BOOL bNewRelTab )
{ nCol = nNewCol; nRow = nNewRow; nTab = nNewTab;
bRelCol = bNewRelCol; bRelRow = bNewRelRow; bRelTab = bNewRelTab;}
inline int operator == ( const ScRefTripel& rRefTripel ) const;
int operator != ( const ScRefTripel& rRefTripel ) const { return !(operator==(rRefTripel)); }
String GetRefString(ScDocument* pDoc, USHORT nActTab) const;
};
inline int ScRefTripel::operator==( const ScRefTripel& rRefTripel ) const
{
return nCol == rRefTripel.nCol && nRow==rRefTripel.nRow && nTab==rRefTripel.nTab &&
bRelCol == rRefTripel.bRelCol && bRelRow == rRefTripel.bRelRow && bRelTab == rRefTripel.bRelTab;
}
//==================================================================
// Die neue Zelladressierung ist in einem UINT32 untergebracht:
// +---+---+-------+
// |Tab|Col| Row |
// +---+---+-------+
// Der Schnelligkeit halber wird beim Zugriff nicht geshiftet,
// sondern plattformabhaengig gecastet.
// Das Ergebnis von ConvertRef() ist eine Bitgruppe folgender Bits:
#define SCA_COL_ABSOLUTE 0x01
#define SCA_ROW_ABSOLUTE 0x02
#define SCA_TAB_ABSOLUTE 0x04
#define SCA_TAB_3D 0x08
#define SCA_COL2_ABSOLUTE 0x10
#define SCA_ROW2_ABSOLUTE 0x20
#define SCA_TAB2_ABSOLUTE 0x40
#define SCA_TAB2_3D 0x80
#define SCA_VALID_ROW 0x0100
#define SCA_VALID_COL 0x0200
#define SCA_VALID_TAB 0x0400
#define SCA_VALID_ROW2 0x1000
#define SCA_VALID_COL2 0x2000
#define SCA_VALID_TAB2 0x4000
#define SCA_VALID 0x8000
#define SCA_ABS SCA_VALID \
| SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE
#define SCR_ABS SCA_ABS \
| SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE
#define SCA_ABS_3D SCA_ABS | SCA_TAB_3D
#define SCR_ABS_3D SCR_ABS | SCA_TAB_3D
class ScAddress
{
private:
UINT32 nAddress;
inline UINT16* RowPos();
inline BYTE* ColPos();
inline BYTE* TabPos();
inline const UINT16* RowPos() const;
inline const BYTE* ColPos() const;
inline const BYTE* TabPos() const;
public:
inline ScAddress() { nAddress = 0; }
inline ScAddress( USHORT nCol, USHORT nRow, USHORT nTab )
{ Set( nCol, nRow, nTab ); }
inline ScAddress( const ScAddress& r ) { nAddress = r.nAddress; }
inline ScAddress( UINT32 nNewAddress ) { nAddress = nNewAddress; }
// TO BE REMOVED
inline ScAddress( const ScTripel& r ) { Set( r.nCol, r.nRow, r.nTab ); }
inline ScAddress& operator=( const ScAddress& r )
{ nAddress = r.nAddress; return *this; }
inline void Set( USHORT nCol, USHORT nRow, USHORT nTab );
inline USHORT Row() const { return *RowPos(); }
inline USHORT Col() const { return *ColPos(); }
inline USHORT Tab() const { return *TabPos(); }
inline USHORT SetRow( USHORT nRow ) { return *RowPos() = nRow; }
inline USHORT SetCol( USHORT nCol ) { return *ColPos() = (BYTE) nCol; }
inline USHORT SetTab( USHORT nTab ) { return *TabPos() = (BYTE) nTab; }
inline operator UINT32() const { return nAddress; }
inline void PutInOrder( ScAddress& r );
inline USHORT IncRow( short n=1 ) { return *RowPos() = (*RowPos() + n ) % (MAXROW+1); }
inline USHORT IncCol( short n=1 ) { return *ColPos() = (BYTE) (*ColPos() + n ); }
inline USHORT IncTab( short n=1 ) { return *TabPos() = (BYTE) (*TabPos() + n ); }
inline void GetVars( USHORT& nCol, USHORT& nRow, USHORT& nTab ) const;
USHORT Parse( const String&, ScDocument* = NULL );
void Format( String&, USHORT = 0, ScDocument* = NULL ) const;
// Das Doc fuer die maximal defineirte Tabelle
BOOL Move( short dx, short dy, short dz, ScDocument* =NULL );
inline int operator==( const ScAddress& r ) const;
inline int operator!=( const ScAddress& r ) const;
inline int operator<( const ScAddress& r ) const;
inline int operator<=( const ScAddress& r ) const;
inline int operator>( const ScAddress& r ) const;
inline int operator>=( const ScAddress& r ) const;
friend inline SvStream& operator<< ( SvStream& rStream, const ScAddress& rAdr );
friend inline SvStream& operator>> ( SvStream& rStream, ScAddress& rAdr );
};
inline void ScAddress::Set( USHORT nCol, USHORT nRow, USHORT nTab )
{
// nAddress = ((UINT32) ((((BYTE) nTab) << 8 ) + (BYTE) nCol ) << 16 )
// | (UINT32) (UINT16) nRow;
// Shifterei: 5 mov, 2 xor, 2 shl, 1 add, 1 and, 1 or
// Casterei: 7 mov, ist weniger Code und schneller
*ColPos() = (BYTE) nCol;
*RowPos() = (UINT16) nRow;
*TabPos() = (BYTE) nTab;
}
inline void ScAddress::PutInOrder( ScAddress& r )
{
if( r.nAddress < nAddress )
{
UINT32 nTemp;
nTemp = nAddress;
nAddress = r.nAddress;
r.nAddress = nTemp;
}
USHORT nTmp;
if ( (nTmp = r.Col()) < Col() )
{
r.SetCol( Col() );
SetCol( nTmp );
}
if ( (nTmp = r.Row()) < Row() )
{
r.SetRow( Row() );
SetRow( nTmp );
}
}
inline void ScAddress::GetVars( USHORT& nCol, USHORT& nRow, USHORT& nTab ) const
{
nCol = Col();
nRow = Row();
nTab = Tab();
}
inline int ScAddress::operator==( const ScAddress& r ) const
{
return ( nAddress == r.nAddress );
}
inline int ScAddress::operator!=( const ScAddress& r ) const
{
return !operator==( r );
}
inline int ScAddress::operator<( const ScAddress& r ) const
{
return ( nAddress < r.nAddress );
}
inline int ScAddress::operator<=( const ScAddress& r ) const
{
return operator<( r ) || operator==( r );
}
inline int ScAddress::operator>( const ScAddress& r ) const
{
return !operator<=( r );
}
inline int ScAddress::operator>=( const ScAddress& r ) const
{
return !operator<( r );
}
#ifdef __LITTLEENDIAN
inline USHORT* ScAddress::RowPos() { return (USHORT*) &nAddress; }
inline BYTE* ScAddress::ColPos() { return (BYTE*) &nAddress + 2; }
inline BYTE* ScAddress::TabPos() { return (BYTE*) &nAddress + 3; }
inline const USHORT* ScAddress::RowPos() const { return (USHORT*) &nAddress; }
inline const BYTE* ScAddress::ColPos() const { return (BYTE*) &nAddress + 2; }
inline const BYTE* ScAddress::TabPos() const { return (BYTE*) &nAddress + 3; }
#else
inline USHORT* ScAddress::RowPos() { return (USHORT*) ((BYTE*) &nAddress + 2 ); }
inline BYTE* ScAddress::ColPos() { return (BYTE*) &nAddress + 1; }
inline BYTE* ScAddress::TabPos() { return (BYTE*) &nAddress; }
inline const USHORT* ScAddress::RowPos() const { return (USHORT*) ((BYTE*) &nAddress + 2 ); }
inline const BYTE* ScAddress::ColPos() const { return (BYTE*) &nAddress + 1; }
inline const BYTE* ScAddress::TabPos() const { return (BYTE*) &nAddress; }
#endif
inline SvStream& operator<< ( SvStream& rStream, const ScAddress& rAdr )
{
rStream << rAdr.nAddress;
return rStream;
}
inline SvStream& operator>> ( SvStream& rStream, ScAddress& rAdr )
{
rStream >> rAdr.nAddress;
return rStream;
}
class ScRange
{
public:
ScAddress aStart, aEnd;
ScRange() : aStart(), aEnd() {}
ScRange( const ScAddress& s, const ScAddress& e )
: aStart( s ), aEnd( e ) { aStart.PutInOrder( aEnd ); }
ScRange( const ScRange& r ) : aStart( r.aStart ), aEnd( r.aEnd ) {}
ScRange( const ScAddress& r ) : aStart( r ), aEnd( r ) {}
ScRange( USHORT nCol, USHORT nRow, USHORT nTab )
: aStart( nCol, nRow, nTab ), aEnd( aStart ) {}
ScRange( USHORT nCol1, USHORT nRow1, USHORT nTab1,
USHORT nCol2, USHORT nRow2, USHORT nTab2 )
: aStart( nCol1, nRow1, nTab1 ), aEnd( nCol2, nRow2, nTab2 ) {}
// TO BE REMOVED
ScRange( const ScTripel& r )
: aStart( r.nCol, r.nRow, r.nTab ), aEnd( aStart ) {}
ScRange( const ScTripel& r1, const ScTripel& r2 )
: aStart( r1.nCol, r1.nRow, r1.nTab ),
aEnd( r2.nCol, r2.nRow, r2.nTab ) {}
ScRange& operator=( const ScRange& r )
{ aStart = r.aStart; aEnd = r.aEnd; return *this; }
inline BOOL In( const ScAddress& ) const; // ist Address& in Range?
inline BOOL In( const ScRange& ) const; // ist Range& in Range?
USHORT Parse( const String&, ScDocument* = NULL );
USHORT ParseAny( const String&, ScDocument* = NULL );
inline void GetVars( USHORT& nCol1, USHORT& nRow1, USHORT& nTab1,
USHORT& nCol2, USHORT& nRow2, USHORT& nTab2 ) const;
void Format( String&, USHORT = 0, ScDocument* = NULL ) const;
// Das Doc fuer die maximal definierte Tabelle
BOOL Move( short dx, short dy, short dz, ScDocument* =NULL );
void Justify();
void ExtendOne();
BOOL Intersects( const ScRange& ) const; // ueberschneiden sich zwei Ranges?
inline int operator==( const ScRange& r ) const;
inline int operator!=( const ScRange& r ) const;
inline int operator<( const ScRange& r ) const;
inline int operator<=( const ScRange& r ) const;
inline int operator>( const ScRange& r ) const;
inline int operator>=( const ScRange& r ) const;
friend inline SvStream& operator<< ( SvStream& rStream, const ScRange& rRange );
friend inline SvStream& operator>> ( SvStream& rStream, ScRange& rRange );
};
inline void ScRange::GetVars( USHORT& nCol1, USHORT& nRow1, USHORT& nTab1,
USHORT& nCol2, USHORT& nRow2, USHORT& nTab2 ) const
{
aStart.GetVars( nCol1, nRow1, nTab1 );
aEnd.GetVars( nCol2, nRow2, nTab2 );
}
inline int ScRange::operator==( const ScRange& r ) const
{
return ( (aStart == r.aStart) && (aEnd == r.aEnd) );
}
inline int ScRange::operator!=( const ScRange& r ) const
{
return !operator==( r );
}
// Sortierung auf linke obere Ecke, wenn die gleich dann auch rechte untere
inline int ScRange::operator<( const ScRange& r ) const
{
return aStart < r.aStart || (aStart == r.aStart && aEnd < r.aEnd) ;
}
inline int ScRange::operator<=( const ScRange& r ) const
{
return operator<( r ) || operator==( r );
}
inline int ScRange::operator>( const ScRange& r ) const
{
return !operator<=( r );
}
inline int ScRange::operator>=( const ScRange& r ) const
{
return !operator<( r );
}
// damit das inlinig funkt die Address reference lassen!
inline BOOL ScRange::In( const ScAddress& rAddr ) const
{
return
aStart.Col() <= rAddr.Col() && rAddr.Col() <= aEnd.Col() &&
aStart.Row() <= rAddr.Row() && rAddr.Row() <= aEnd.Row() &&
aStart.Tab() <= rAddr.Tab() && rAddr.Tab() <= aEnd.Tab();
}
inline BOOL ScRange::In( const ScRange& r ) const
{
return
aStart.Col() <= r.aStart.Col() && r.aEnd.Col() <= aEnd.Col() &&
aStart.Row() <= r.aStart.Row() && r.aEnd.Row() <= aEnd.Row() &&
aStart.Tab() <= r.aStart.Tab() && r.aEnd.Tab() <= aEnd.Tab();
}
inline SvStream& operator<< ( SvStream& rStream, const ScRange& rRange )
{
rStream << rRange.aStart;
rStream << rRange.aEnd;
return rStream;
}
inline SvStream& operator>> ( SvStream& rStream, ScRange& rRange )
{
rStream >> rRange.aStart;
rStream >> rRange.aEnd;
return rStream;
}
class ScRangePair
{
private:
ScRange aRange[2];
public:
ScRangePair() {}
ScRangePair( const ScRangePair& r )
{ aRange[0] = r.aRange[0]; aRange[1] = r.aRange[1]; }
ScRangePair( const ScRange& r1, const ScRange& r2 )
{ aRange[0] = r1; aRange[1] = r2; }
inline ScRangePair& operator= ( const ScRangePair& r );
const ScRange& GetRange( USHORT n ) const { return aRange[n]; }
ScRange& GetRange( USHORT n ) { return aRange[n]; }
inline int operator==( const ScRangePair& ) const;
inline int operator!=( const ScRangePair& ) const;
friend inline SvStream& operator<< ( SvStream&, const ScRangePair& );
friend inline SvStream& operator>> ( SvStream&, ScRange& );
};
inline ScRangePair& ScRangePair::operator= ( const ScRangePair& r )
{
aRange[0] = r.aRange[0];
aRange[1] = r.aRange[1];
return *this;
}
inline int ScRangePair::operator==( const ScRangePair& r ) const
{
return ( (aRange[0] == r.aRange[0]) && (aRange[1] == r.aRange[1]) );
}
inline int ScRangePair::operator!=( const ScRangePair& r ) const
{
return !operator==( r );
}
inline SvStream& operator<< ( SvStream& rStream, const ScRangePair& rPair )
{
rStream << rPair.GetRange(0);
rStream << rPair.GetRange(1);
return rStream;
}
inline SvStream& operator>> ( SvStream& rStream, ScRangePair& rPair )
{
rStream >> rPair.GetRange(0);
rStream >> rPair.GetRange(1);
return rStream;
}
//==================================================================
inline void PutInOrder( USHORT& nStart, USHORT& nEnd )
{
if (nEnd < nStart)
{
USHORT nTemp;
nTemp = nEnd;
nEnd = nStart;
nStart = nTemp;
}
}
//===================================================================
// Globale Funktionen
//===================================================================
BOOL ConvertSingleRef(ScDocument* pDoc, const String& rRefString, USHORT nDefTab, ScRefTripel& rRefTripel);
BOOL ConvertDoubleRef(ScDocument* pDoc, const String& rRefString, USHORT nDefTab, ScRefTripel& rStartRefTripel, ScRefTripel& rEndRefTripel);
String ColToAlpha( const USHORT nCol );
//===================================================================
// Funktionsautopilot: Klassen zur Verwaltung der StarCalc-Funktionen
//===================================================================
class ScFuncDesc
{
public:
ScFuncDesc();
~ScFuncDesc();
String GetSignature () const;
String GetFormulaString ( String** aArgArr ) const;
USHORT nFIndex; // eindeutiger Funktionsindex
USHORT nCategory; // Kategorie
String* pFuncName; // Funktionsname
String* pFuncDesc; // Funktionsbeschreibung
USHORT nArgCount; // Parameteranzahl
String** aDefArgNames; // Parametername(n)
String** aDefArgDescs; // Parameterbeschreibung(en)
BOOL* aDefArgOpt; // Flags ob Parameter optional ist
USHORT nHelpId; // HilfeId der Funktion
};
//==================================================================
class ScFunctionMgr
{
public:
ScFunctionMgr();
~ScFunctionMgr();
ScFuncDesc* Get( const String& rFName );
ScFuncDesc* Get( USHORT nFIndex );
ScFuncDesc* First( USHORT nCategory = 0 );
ScFuncDesc* Next();
private:
ScFunctionList* pFuncList;
List* aCatLists[MAX_FUNCCAT];
List* pCurCatList;
};
//==================================================================
class ScFunctionList
{
public:
ScFunctionList();
~ScFunctionList();
ULONG GetCount() const
{ return aFunctionList.Count(); }
ScFuncDesc* GetFunction( ULONG nIndex ) const
{ return (ScFuncDesc*)aFunctionList.GetObject( nIndex ); }
xub_StrLen GetMaxFuncNameLen() const
{ return nMaxFuncNameLen; }
private:
List aFunctionList;
xub_StrLen nMaxFuncNameLen;
};
//==================================================================
#define FUNC_NOTFOUND 0xffff
class ScFormulaUtil
{
public:
static BOOL GetNextFunc( const String& rFormula,
BOOL bBack,
xub_StrLen& rFStart, // Ein- und Ausgabe
xub_StrLen* pFEnd = NULL,
ScFuncDesc** ppFDesc = NULL,
String*** pppArgs = NULL );
static const ScFuncDesc* GetDefaultFuncDesc();
static xub_StrLen GetFunctionStart( const String& rFormula, xub_StrLen nStart,
BOOL bBack, String* pFuncName = NULL );
static xub_StrLen GetFunctionEnd ( const String& rFormula, xub_StrLen nStart );
static xub_StrLen GetArgStart ( const String& rFormula, xub_StrLen nStart,
USHORT nArg );
static String** GetArgStrings ( const String& rFormula,
xub_StrLen nFuncPos,
USHORT nArgs );
static void FillArgStrings ( const String& rFormula,
xub_StrLen nFuncPos,
USHORT nArgs,
String** pArgs );
};
//==================================================================
// Notiz
//==================================================================
class ScPostIt
{
private:
String aStrText;
String aStrDate;
String aStrAuthor;
BOOL bShown;
public:
ScPostIt();
ScPostIt( const String& rText );
ScPostIt( const String& rText, const String& rDate, const String& rAuthor );
ScPostIt( const ScPostIt& rCpy );
~ScPostIt();
const String& GetText() const { return aStrText; }
const String& GetDate() const { return aStrDate; }
const String& GetAuthor() const { return aStrAuthor; }
BOOL IsShown() const { return bShown; }
void SetText( const String& rNew ) { aStrText = rNew; }
void SetDate( const String& rNew ) { aStrDate = rNew; }
void SetAuthor( const String& rNew ) { aStrAuthor = rNew; }
void SetShown( BOOL bNew ) { bShown = bNew; }
void Clear() { aStrText.Erase(); aStrDate.Erase();
aStrAuthor.Erase(); bShown = FALSE; }
void AutoSetText( const String& rNewText );
inline const ScPostIt& operator= ( const ScPostIt& rCpy );
inline int operator==( const ScPostIt& rPostIt ) const;
int operator!=( const ScPostIt& rPostIt ) const { return !(operator==(rPostIt)); }
friend inline SvStream& operator>>( SvStream& rStream, ScPostIt& rPostIt );
friend inline SvStream& operator<<( SvStream& rStream, const ScPostIt& rPostIt );
};
inline const ScPostIt& ScPostIt::operator=( const ScPostIt& rCpy )
{
aStrText = rCpy.aStrText;
aStrDate = rCpy.aStrDate;
aStrAuthor = rCpy.aStrAuthor;
bShown = rCpy.bShown;
return *this;
}
inline int ScPostIt::operator==( const ScPostIt& rPostIt ) const
{
return ( aStrText == rPostIt.aStrText
&& aStrDate == rPostIt.aStrDate
&& aStrAuthor == rPostIt.aStrAuthor
&& bShown == rPostIt.bShown );
}
inline SvStream& operator>>( SvStream& rStream, ScPostIt& rPostIt )
{
// ohne bShown !!!
CharSet eSet = rStream.GetStreamCharSet();
rStream.ReadByteString( rPostIt.aStrText, eSet );
rStream.ReadByteString( rPostIt.aStrDate, eSet );
rStream.ReadByteString( rPostIt.aStrAuthor, eSet );
return rStream;
}
inline SvStream& operator<<( SvStream& rStream, const ScPostIt& rPostIt )
{
// ohne bShown !!!
CharSet eSet = rStream.GetStreamCharSet();
rStream.WriteByteString( rPostIt.aStrText, eSet );
rStream.WriteByteString( rPostIt.aStrDate, eSet );
rStream.WriteByteString( rPostIt.aStrAuthor, eSet );
return rStream;
}
//==================================================================
// evtl. in dbdata.hxx auslagern (?):
enum ScQueryOp
{
SC_EQUAL,
SC_LESS,
SC_GREATER,
SC_LESS_EQUAL,
SC_GREATER_EQUAL,
SC_NOT_EQUAL,
SC_TOPVAL,
SC_BOTVAL,
SC_TOPPERC,
SC_BOTPERC
};
// -----------------------------------------------------------------------
enum ScQueryConnect
{
SC_AND,
SC_OR
};
// -----------------------------------------------------------------------
enum ScSubTotalFunc
{
SUBTOTAL_FUNC_NONE = 0,
SUBTOTAL_FUNC_AVE = 1,
SUBTOTAL_FUNC_CNT = 2,
SUBTOTAL_FUNC_CNT2 = 3,
SUBTOTAL_FUNC_MAX = 4,
SUBTOTAL_FUNC_MIN = 5,
SUBTOTAL_FUNC_PROD = 6,
SUBTOTAL_FUNC_STD = 7,
SUBTOTAL_FUNC_STDP = 8,
SUBTOTAL_FUNC_SUM = 9,
SUBTOTAL_FUNC_VAR = 10,
SUBTOTAL_FUNC_VARP = 11
};
#define PIVOT_MAXFUNC 11
#define PIVOT_FUNC_NONE 0x0000
#define PIVOT_FUNC_SUM 0x0001
#define PIVOT_FUNC_COUNT 0x0002
#define PIVOT_FUNC_AVERAGE 0x0004
#define PIVOT_FUNC_MAX 0x0008
#define PIVOT_FUNC_MIN 0x0010
#define PIVOT_FUNC_PRODUCT 0x0020
#define PIVOT_FUNC_COUNT_NUM 0x0040
#define PIVOT_FUNC_STD_DEV 0x0080
#define PIVOT_FUNC_STD_DEVP 0x0100
#define PIVOT_FUNC_STD_VAR 0x0200
#define PIVOT_FUNC_STD_VARP 0x0400
#define PIVOT_FUNC_AUTO 0x1000
// -----------------------------------------------------------------------
/*
* Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer"
* als Konstanten SC_EMPTYFIELDS bzw. SC_NONEMPTYFIELDS in nVal in
* Verbindung mit dem Schalter bQueryByString auf FALSE.
*/
#define SC_EMPTYFIELDS ((double)0x0042)
#define SC_NONEMPTYFIELDS ((double)0x0043)
namespace utl
{
class SearchParam;
class TextSearch;
}
struct ScQueryEntry
{
BOOL bDoQuery;
BOOL bQueryByString;
USHORT nField;
ScQueryOp eOp;
ScQueryConnect eConnect;
String* pStr;
double nVal;
utl::SearchParam* pSearchParam; // falls RegExp, nicht gespeichert
utl::TextSearch* pSearchText; // falls RegExp, nicht gespeichert
ScQueryEntry();
ScQueryEntry(const ScQueryEntry& r);
~ScQueryEntry();
// legt ggbf. pSearchParam und pSearchText an, immer RegExp!
utl::TextSearch* GetSearchTextPtr( BOOL bCaseSens );
void Clear();
ScQueryEntry& operator=( const ScQueryEntry& r );
BOOL operator==( const ScQueryEntry& r ) const;
void Load(SvStream& rStream);
void Store(SvStream& rStream) const;
};
struct ScQueryParam
{
USHORT nCol1;
USHORT nRow1;
USHORT nCol2;
USHORT nRow2;
USHORT nTab;
BOOL bHasHeader;
BOOL bByRow;
BOOL bInplace;
BOOL bCaseSens;
BOOL bRegExp;
BOOL bDuplicate;
BOOL bDestPers; // nicht gespeichert
USHORT nDestTab;
USHORT nDestCol;
USHORT nDestRow;
private:
USHORT nEntryCount;
ScQueryEntry* pEntries;
public:
ScQueryParam();
ScQueryParam( const ScQueryParam& r );
~ScQueryParam();
USHORT GetEntryCount() const { return nEntryCount; }
ScQueryEntry& GetEntry(USHORT n) const { return pEntries[n]; }
void Resize(USHORT nNew);
ScQueryParam& operator= ( const ScQueryParam& r );
BOOL operator== ( const ScQueryParam& rOther ) const;
void Clear ();
void DeleteQuery( USHORT nPos );
void MoveToDest();
void FillInExcelSyntax(String& aCellStr, USHORT nIndex);
void Load(SvStream& rStream);
void Store(SvStream& rStream) const;
};
// -----------------------------------------------------------------------
struct ScSubTotalParam
{
USHORT nCol1; // Selektierter Bereich
USHORT nRow1;
USHORT nCol2;
USHORT nRow2;
BOOL bRemoveOnly;
BOOL bReplace; // vorhandene Ergebnisse ersetzen
BOOL bPagebreak; // Seitenumbruch bei Gruppenwechsel
BOOL bCaseSens; // Gross-/Kleinschreibung
BOOL bDoSort; // vorher sortieren
BOOL bAscending; // aufsteigend sortieren
BOOL bUserDef; // Benutzer-def. Sort.Reihenfolge
USHORT nUserIndex; // Index auf Liste
BOOL bIncludePattern; // Formate mit sortieren
BOOL bGroupActive[MAXSUBTOTAL]; // aktive Gruppen
USHORT nField[MAXSUBTOTAL]; // zugehoeriges Feld
USHORT nSubTotals[MAXSUBTOTAL]; // Anzahl der SubTotals
USHORT* pSubTotals[MAXSUBTOTAL]; // Array der zu berechnenden Spalten
ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; // Array der zugehoerige Funktionen
ScSubTotalParam();
ScSubTotalParam( const ScSubTotalParam& r );
ScSubTotalParam& operator= ( const ScSubTotalParam& r );
BOOL operator== ( const ScSubTotalParam& r ) const;
void Clear ();
void SetSubTotals ( USHORT nGroup,
const USHORT* ptrSubTotals,
const ScSubTotalFunc* ptrFuncions,
USHORT nCount );
};
// -----------------------------------------------------------------------
class ScArea;
struct ScConsolidateParam
{
USHORT nCol; // Cursor Position /
USHORT nRow; // bzw. Anfang des Zielbereiches
USHORT nTab;
ScSubTotalFunc eFunction; // Berechnungsvorschrift
USHORT nDataAreaCount; // Anzahl der Datenbereiche
ScArea** ppDataAreas; // Zeiger-Array auf Datenbereiche
BOOL bByCol; // nach Spalten
BOOL bByRow; // nach Zeilen
BOOL bReferenceData; // Quelldaten referenzieren
ScConsolidateParam();
ScConsolidateParam( const ScConsolidateParam& r );
~ScConsolidateParam();
ScConsolidateParam& operator= ( const ScConsolidateParam& r );
BOOL operator== ( const ScConsolidateParam& r ) const;
void Clear (); // = ClearDataAreas()+Members
void ClearDataAreas ();
void SetAreas ( ScArea* const* ppAreas, USHORT nCount );
void Load( SvStream& rStream );
void Store( SvStream& rStream ) const;
};
// -----------------------------------------------------------------------
struct PivotField
{
short nCol;
USHORT nFuncMask;
USHORT nFuncCount;
PivotField() :
nCol(0),nFuncMask(0),nFuncCount(0) {}
PivotField( const PivotField& rCpy ) :
nCol(rCpy.nCol),nFuncMask(rCpy.nFuncMask),nFuncCount(rCpy.nFuncCount) {}
PivotField(short nNewCol, USHORT nNewFuncMask = 0) :
nCol(nNewCol),nFuncMask(nNewFuncMask),nFuncCount(0) {}
PivotField operator = (const PivotField& r)
{
nCol = r.nCol;
nFuncMask = r.nFuncMask;
nFuncCount = r.nFuncCount;
return *this;
}
BOOL operator == (const PivotField& r) const
{
return ( (nCol == r.nCol)
&& (nFuncMask == r.nFuncMask)
&& (nFuncCount == r.nFuncCount));
}
};
// -----------------------------------------------------------------------
struct ScPivotParam
{
USHORT nCol; // Cursor Position /
USHORT nRow; // bzw. Anfang des Zielbereiches
USHORT nTab;
LabelData** ppLabelArr;
USHORT nLabels;
PivotField aColArr[PIVOT_MAXFIELD];
PivotField aRowArr[PIVOT_MAXFIELD];
PivotField aDataArr[PIVOT_MAXFIELD];
USHORT nColCount;
USHORT nRowCount;
USHORT nDataCount;
BOOL bIgnoreEmptyRows;
BOOL bDetectCategories;
BOOL bMakeTotalCol;
BOOL bMakeTotalRow;
ScPivotParam();
ScPivotParam( const ScPivotParam& r );
~ScPivotParam();
ScPivotParam& operator= ( const ScPivotParam& r );
BOOL operator== ( const ScPivotParam& r ) const;
void Clear ();
void ClearLabelData ();
void ClearPivotArrays();
void SetLabelData ( LabelData** ppLabArr,
USHORT nLab );
void SetPivotArrays ( const PivotField* pColArr,
const PivotField* pRowArr,
const PivotField* pDataArr,
USHORT nColCnt,
USHORT nRowCnt,
USHORT nDataCnt );
};
//-----------------------------------------------------------------------
struct ScSolveParam
{
ScAddress aRefFormulaCell;
ScAddress aRefVariableCell;
String* pStrTargetVal;
ScSolveParam();
ScSolveParam( const ScSolveParam& r );
ScSolveParam( const ScAddress& rFormulaCell,
const ScAddress& rVariableCell,
const String& rTargetValStr );
~ScSolveParam();
ScSolveParam& operator= ( const ScSolveParam& r );
BOOL operator== ( const ScSolveParam& r ) const;
};
struct ScTabOpParam
{
ScRefTripel aRefFormulaCell;
ScRefTripel aRefFormulaEnd;
ScRefTripel aRefRowCell;
ScRefTripel aRefColCell;
BYTE nMode;
ScTabOpParam() {};
ScTabOpParam( const ScTabOpParam& r );
ScTabOpParam( const ScRefTripel& rFormulaCell,
const ScRefTripel& rFormulaEnd,
const ScRefTripel& rRowCell,
const ScRefTripel& rColCell,
BYTE nMd);
~ScTabOpParam() {};
ScTabOpParam& operator= ( const ScTabOpParam& r );
BOOL operator== ( const ScTabOpParam& r ) const;
};
#endif
|