summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8par.hxx
blob: 15818ddb4c628f0f2990315f462cf4ffc1cd5ffd (plain)
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
/*************************************************************************
 *
 *  $RCSfile: ww8par.hxx,v $
 *
 *  $Revision: 1.105 $
 *
 *  last change: $Author: cmc $ $Date: 2002-12-10 12:41:16 $
 *
 *  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 WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRUNTIES 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): _______________________________________
 *
 *
 ************************************************************************/

/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */

#ifndef _WW8PAR_HXX
#define _WW8PAR_HXX

#ifndef _STRING_HXX //autogen
#include <tools/string.hxx>
#endif

#ifndef _MSDFFIMP_HXX
#include <svx/msdffimp.hxx>
#endif
#ifndef _MSOCXIMEX_HXX
#include <svx/msocximex.hxx>
#endif

#ifndef _FLTSHELL_HXX
#include <fltshell.hxx>         // fuer den Attribut Stack
#endif

#ifndef __SGI_STL_VECTOR
#include <vector>
#endif
#ifndef __SGI_STLSTACK
#include <stack>
#endif
#ifndef __SGI_STLDEQUE
#include <deque>
#endif
#ifndef __SGI_STL_MAP
#include <map>
#endif

#ifndef _WW8STRUC_HXX
#include "ww8struc.hxx"     // WW8_BRC
#endif
#ifndef _WW8SCAN_HXX
#include "ww8scan.hxx"  // WW8Fib
#endif
#ifndef _WW8GLSY_HXX
#include "ww8glsy.hxx"
#endif

class SwDoc;
class SwPaM;
class SfxPoolItem;
class SwTxtFmtColl;
class SwPageDesc;
class SvxBoxItem;
class SwFmt;
class SwNodeIndex;
class SwFlyFrmFmt;
class SvxTabStopItem;
class SwAttrSet;
class SwNumRule;
class SwFrmFmt;
class Writer;

class SwWW8StyInf;
class WW8Fib;
class WW8PLCFMan;
struct WW8PLCFManResult;
class WW8RStyle;
class WW8PLCF_HdFt;
class Plcx_Fkp;
class WW8PLCFx_SEPX;
class WW8Dop;
class WW8ScannerBase;
struct WW8FieldDesc;
struct WW8FlyPara;
struct WW8SwFlyPara;
struct WmfFileHd;
struct WW8_PIC;
class WW8TabDesc;
struct WW8_SHD;
struct WW8_OLST;
class SwNumFmt;
struct WW8_ANLD;
struct WW8_ANLV;
struct WW8_DO;
struct WW8_DPHEAD;
struct WW8_FSPA;
class Plc1;
class SwDrawFrmFmt;
class SdrModel;
class SdrPage;
class SdrObjList;
class SdrObject;
class SdrTextObj;
class Size;
class EditEngine;
struct SwPosition;
class WW8ReaderSave;
struct WW8PicDesc;
class Graphic;
class SwFieldType;
class SvStorage;
// alt: class SvStorageRef;
class SwAttrSet;
class GDIMetaFile;
struct ESelection;
class SfxItemSet;
struct WW8PLCFxDesc;

class SdrAttrObj;
struct WW8ULSpaceData;
class _ReadFieldParams;
class wwZOrderer;

namespace com{namespace sun {namespace star{
    namespace beans{ class XPropertySet;}
    namespace form { class XFormComponent;}
    namespace drawing{class XShape;}
    namespace lang{class XMultiServiceFactory;}
}}}

// defines nur fuer die WW8-variable der INI-Datei
#define WW8FL_NO_TEXT        1
#define WW8FL_NO_STYLES      2
#define WW8FL_NO_ZSTYLES     4  // keine Zeichenstyles importieren
#define WW8FL_NO_FTN      0x20
#define WW8FL_NO_FLD      0x40  // keine Felder
#define WW8FL_NO_GRAF     0x80
#define WW8FL_NO_LRUL    0x200

// falls gestetzt, werden fuer Writer-Def-Styles neue Styles mit den
// WW8-Def-Style-Eigenschaften erzeugt, statt die Writer-Standards zu
// ueberschreiben
#define WW8FL_NO_DEFSTYLES        0x400

#define WW8FL_NO_OUTLINE         0x1000
#define WW8FL_NO_NUMRULE         0x2000
#define WW8FL_NO_IMPLPASP        0x4000  // no implicit para space
#define WW8FL_NO_GRAFLAYER       0x8000
#define WW8FL_NO_OLE            0x20000
#define WW8FL_NO_COLS          0x200000
#define WW8FL_NO_TOX           0x400000

// Zusatz-Filter-Flags, gueltig ab Winword 8
#define WW8FL_NO_FLY_FOR_TXBX         1

//-----------------------------------------
//            Listen-Manager (ab Ver8)
//-----------------------------------------

struct WW8LFOInfo;
typedef WW8LFOInfo* WW8LFOInfo_Ptr;
// Redlining: match WinWord author ids to StarWriter author ids
struct WW8AuthorInfo;
typedef WW8AuthorInfo* WW8AuthorInfo_Ptr;
struct WW8OleMap;
typedef WW8OleMap* WW8OleMap_Ptr;

SV_DECL_PTRARR_DEL(WW8LFOInfos,WW8LFOInfo_Ptr,16,16)
SV_DECL_PTRARR_SORT_DEL(WW8AuthorInfos, WW8AuthorInfo_Ptr,16,16)
SV_DECL_PTRARR_SORT_DEL(WW8OleMaps, WW8OleMap_Ptr,16,16)

struct WW8OleMap
{
    UINT32 mnWWid;
    SvInPlaceObject *mpWriterRef;

    WW8OleMap(UINT32 nWWid, SvInPlaceObject *pWriterRef = 0) :
        mnWWid(nWWid), mpWriterRef(pWriterRef) {}

    bool operator==(const WW8OleMap & rEntry) const
    {
        return (mnWWid == rEntry.mnWWid);
    }
    bool operator<(const WW8OleMap & rEntry) const
    {
        return (mnWWid < rEntry.mnWWid);
    }
};

class SwWW8ImplReader;
struct WW8LSTInfo;
class WW8ListManager
{
public:
    WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_);
    //Min and Max possible List Levels in Word
    enum ListLevel {nMinLevel=1, nMaxLevel=9};
    SwNumRule* GetNumRuleForActivation(USHORT nLFOPosition, BYTE nLevel) const;
    SwNumRule* CreateNextRule(bool bSimple);
    ~WW8ListManager();
private:
    wwSprmParser maSprmParser;
    SwWW8ImplReader& rReader;
    SwDoc&           rDoc;
    const WW8Fib&    rFib;
    SvStream&        rSt;
    std::vector<WW8LSTInfo* > maLSTInfos;
    WW8LFOInfos* pLFOInfos;// D. aus PLF LFO, sortiert genau wie im WW8 Stream
    USHORT       nUniqueList; // current number for creating unique list names
    BYTE* GrpprlHasSprm(USHORT nId, BYTE& rSprms, BYTE nLen);
    WW8LSTInfo* GetLSTByListId(    ULONG  nIdLst     ) const;
    bool ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, USHORT nLevelStyle,
        bool bSetStartNo);

    // Zeichenattribute aus GrpprlChpx
    typedef SfxItemSet* WW8aISet[nMaxLevel];
    // Zeichen Style Pointer
    typedef SwCharFmt* WW8aCFmt[nMaxLevel];

    void AdjustLVL(BYTE nLevel, SwNumRule& rNumRule, WW8aISet& rListItemSet,
        WW8aCFmt& aCharFmt, bool& bNewCharFmtCreated,
        String aPrefix = aEmptyStr);
    bool LFOequaltoLST(WW8LFOInfo& rLFOInfo);

    //No copying
    WW8ListManager(const WW8ListManager&);
    WW8ListManager& operator=(const WW8ListManager&);
};

//-----------------------------------------
//            Stack
//-----------------------------------------
class SwWW8FltControlStack : public SwFltControlStack
{
private:
    SwWW8ImplReader& rReader;
    USHORT nToggleAttrFlags;
    USHORT nToggleBiDiAttrFlags;
    //No copying
    SwWW8FltControlStack(const SwWW8FltControlStack&);
    SwWW8FltControlStack& operator=(const SwWW8FltControlStack&);
protected:
    virtual void SetAttrInDoc(const SwPosition& rTmpPos,
        SwFltStackEntry* pEntry);
public:
    SwWW8FltControlStack(SwDoc* pDo, ULONG nFieldFl, SwWW8ImplReader& rReader_ )
        : SwFltControlStack( pDo, nFieldFl ), rReader( rReader_ ),
        nToggleAttrFlags(0), nToggleBiDiAttrFlags(0)
    {}

    void NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr);
    void SetAttr(const SwPosition& rPos, USHORT nAttrId=0, bool bTstEnde=true,
        long nHand=LONG_MAX);
    void SetToggleAttr(BYTE nId, bool bOn)
    {
        if( bOn )
            nToggleAttrFlags |= (1 << nId);
        else
            nToggleAttrFlags &= ~(1 << nId);
    }
    USHORT GetToggleAttrFlags() const { return nToggleAttrFlags; }
    void SetToggleBiDiAttr(BYTE nId, bool bOn)
    {
        if( bOn )
            nToggleBiDiAttrFlags |= (1 << nId);
        else
            nToggleBiDiAttrFlags &= ~(1 << nId);
    }
    USHORT GetToggleBiDiAttrFlags() const { return nToggleBiDiAttrFlags; }


    const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, USHORT nWhich);
    const SfxPoolItem* GetStackAttr(const SwPosition& rPos, USHORT nWhich);
    void Delete(const SwPaM &rPam);
};

class wwRedlineStack
{
private:
    std::vector<SwFltStackEntry *> maStack;
    typedef std::vector<SwFltStackEntry *>::reverse_iterator myriter;
    SwDoc &mrDoc;
public:
    explicit wwRedlineStack(SwDoc &rDoc) : mrDoc(rDoc) {}
    void open(const SwPosition& rPos, const SfxPoolItem& rAttr);
    void close(const SwPosition& rPos, SwRedlineType eType);
    void closeall(const SwPosition& rPos);
    ~wwRedlineStack();
private:
    //No copying
    wwRedlineStack(const wwRedlineStack&);
    wwRedlineStack& operator=(const wwRedlineStack&);
};

//The only thing this is for is RES_FLTR_ANCHOR, anything else is an error.
//For graphics whose anchoring position would otherwise be automatically moved
//along by the insertion of text.
class SwWW8FltAnchorStack : public SwFltControlStack
{
public:
    SwWW8FltAnchorStack(SwDoc* pDo, ULONG nFieldFl)
        : SwFltControlStack( pDo, nFieldFl ) {}
    void AddAnchor(const SwPosition& rPos,SwFrmFmt *pFmt);
    void RemoveAnchor(const SwFrmFmt *pFmt);
    void Flush();
private:
    //No copying
    SwWW8FltAnchorStack(const SwWW8FltAnchorStack&);
    SwWW8FltAnchorStack& operator=(const SwWW8FltAnchorStack&);
};

//For fields whose handling cannot be fully resolved until we hit the end of
//the document.
class SwWW8FltRefStack : public SwFltEndStack
{
public:
    SwWW8FltRefStack(SwDoc* pDo, ULONG nFieldFl)
        : SwFltEndStack( pDo, nFieldFl )
    {}
    bool IsFtnEdnBkmField(const SwFmtFld& rFmtFld, USHORT& rBkmNo);

    struct ltstr
    {
        bool operator()(const String &r1, const String &r2) const
        {
            return r1.CompareIgnoreCaseToAscii(r2) == COMPARE_LESS;
        }
    };

    //Keep track of variable names created with fields, and the bookmark
    //mapped to their position, hopefully the same, but very possibly
    //an additional pseudo bookmark
    std::map<String, String, ltstr> aFieldVarNames;
protected:
    SwFltStackEntry *RefToVar(const SwField* pFld,SwFltStackEntry *pEntry);
    virtual void SetAttrInDoc(const SwPosition& rTmpPos,
        SwFltStackEntry* pEntry);
private:
    //No copying
    SwWW8FltRefStack(const SwWW8FltRefStack&);
    SwWW8FltRefStack& operator=(const SwWW8FltRefStack&);
};

//-----------------------------------------
//     Redlining Authors
//-----------------------------------------
struct WW8AuthorInfo
{
    USHORT nWWAuthorId;
    USHORT nOurId;

    WW8AuthorInfo(USHORT nWWAuthorId_, USHORT nOurId_ = 0):
        nWWAuthorId( nWWAuthorId_ ),
        nOurId(      nOurId_ )
        {}
    bool operator==(const WW8AuthorInfo& rEntry) const
    {
        return (nWWAuthorId == rEntry.nWWAuthorId);
    }
    bool operator<(const WW8AuthorInfo& rEntry) const
    {
        return (nWWAuthorId < rEntry.nWWAuthorId);
    }
};



//-----------------------------------------
//    Mini-Merker fuer einige Flags
//-----------------------------------------
class WW8ReaderSave
{
private:
    WW8PLCFxSaveAll maPLCFxSave;
    SwPosition maTmpPos;
    SwWW8FltControlStack* mpOldStck;
    SwWW8FltAnchorStack* mpOldAnchorStck;
    wwRedlineStack *mpOldRedlines;
    WW8PLCFMan* mpOldPlcxMan;
    WW8FlyPara* mpWFlyPara;
    WW8SwFlyPara* mpSFlyPara;
    WW8TabDesc* mpTableDesc;
    int mnInTable;
    USHORT mnAktColl;
    sal_Unicode mcSymbol;
    bool mbIgnoreText;
    bool mbDontCreateSep;
    bool mbSymbol;
    bool mbHdFtFtnEdn;
    bool mbTxbxFlySection;
    bool mbAnl;
    bool mbInHyperlink;
    bool mbPgSecBreak;
    bool mbVerticalEnviron;
    bool mbWasParaEnd;
    bool mbHasBorder;
public:
    WW8ReaderSave(SwWW8ImplReader* pRdr, WW8_CP nStart=-1);
    void Restore(SwWW8ImplReader* pRdr);
    const SwPosition &GetStartPos() const { return maTmpPos; }
};

enum eF_ResT{ FLD_OK, FLD_TEXT, FLD_TAGIGN, FLD_TAGTXT, FLD_READ_FSPA };

class SwWW8Shade
{
public:
    Color aColor;
    SwWW8Shade(bool bVer67, const WW8_SHD& rSHD);
    SwWW8Shade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex)
    {
        SetShade(nFore, nBack, nIndex);
    }
private:
    void SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex);
};


//-----------------------------------------
//    Formulas
//-----------------------------------------
enum SwWw8ControlType
{
    WW8_CT_EDIT,
    WW8_CT_CHECKBOX,
    WW8_CT_COMBOBOX
};


class WW8FormulaControl : public OCX_Control
{
public:
    WW8FormulaControl(const String& sN,SwWW8ImplReader &rR)
        : OCX_Control(sN), rRdr(rR) {}
    void WW8FormulaControl::SetOthersFromDoc(com::sun::star::awt::Size &rSz,
        com::sun::star::uno::Reference <
        com::sun::star::beans::XPropertySet> &rPropSet);

    UINT8   fToolTip:1;
    UINT8   fNoMark:1;
    UINT8   fUseSize:1;
    UINT8   fNumbersOnly:1;
    UINT8   fDateOnly:1;
    UINT8   fUnused:3;
    UINT16  nSize;

    UINT16  hpsCheckBox;
    UINT16 nChecked;

    String sTitle;
    String sDefault;
    String sFormatting;
    String sHelp;
    String sToolTip;

    void FormulaRead(SwWw8ControlType nWhich,SvStream *pD);
private:
    //No copying
    WW8FormulaControl(const WW8FormulaControl&);
    WW8FormulaControl& operator=(const WW8FormulaControl&);

    SwWW8ImplReader &rRdr;
};

class WW8FormulaCheckBox : public WW8FormulaControl
{
private:
    //No copying
    WW8FormulaCheckBox(const WW8FormulaCheckBox&);
    WW8FormulaCheckBox& operator=(const WW8FormulaCheckBox&);
public:
    WW8FormulaCheckBox(SwWW8ImplReader &rR);
    virtual sal_Bool Import(const com::sun::star::uno::Reference <
        com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
        com::sun::star::uno::Reference <
        com::sun::star::form::XFormComponent> &rFComp,
        com::sun::star::awt::Size &rSz);
};

class WW8FormulaEditBox : public WW8FormulaControl
{
private:
    //No copying
    WW8FormulaEditBox(const WW8FormulaEditBox&);
    WW8FormulaEditBox& operator=(const WW8FormulaEditBox&);
public:
    WW8FormulaEditBox(SwWW8ImplReader &rR);
#if 0
    //#i3029# we are no longer importing editboxes as uno textboxes, using
    //input fields instead for superior layout.
    virtual sal_Bool Import(const com::sun::star::uno::Reference <
        com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
        com::sun::star::uno::Reference <
        com::sun::star::form::XFormComponent> &rFComp,
        com::sun::star::awt::Size &rSz);
#endif
};

class SwMSConvertControls: public SvxMSConvertOCXControls
{
public:
    SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) :
        SvxMSConvertOCXControls( pDSh,pP ) {}
    virtual sal_Bool InsertFormula( WW8FormulaControl &rFormula);
    virtual sal_Bool InsertControl(const com::sun::star::uno::Reference<
        com::sun::star::form::XFormComponent >& rFComp,
        const ::com::sun::star::awt::Size& rSize,
        com::sun::star::uno::Reference <
        com::sun::star::drawing::XShape > *pShape,BOOL bFloatingCtrl);
    bool ExportControl(Writer &rWrt, const SdrObject *pObj);
};

class SwMSDffManager : public SvxMSDffManager
{
private:
    SwWW8ImplReader& rReader;
    SvStream *pFallbackStream;
    List *pOldEscherBlipCache;

    virtual BOOL GetOLEStorageName( long nOLEId, String& rStorageName,
        SvStorageRef& rSrcStorage, SvStorageRef& rDestStorage ) const;
    virtual BOOL ShapeHasText( ULONG nShapeId, ULONG nFilePos ) const;
    virtual SdrObject* ImportOLE( long nOLEId, const Graphic& rGrf,
        const Rectangle& rBoundRect ) const;

    //No copying
    SwMSDffManager(const SwMSDffManager&);
    SwMSDffManager& operator=(const SwMSDffManager&);
public:
    static UINT32 GetFilterFlags();
    static INT32 GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType,
        INT32 &rThick);
    SwMSDffManager( SwWW8ImplReader& rRdr );
    void DisableFallbackStream();
    void EnableFallbackStream();
};

class wwFrameNamer
{
private:
    String msSeed;
    int mnImportedGraphicsCount;
    bool mbIsDisabled;
    //No copying
    wwFrameNamer(const wwFrameNamer&);
    wwFrameNamer& operator=(const wwFrameNamer&);
public:
    void SetUniqueGraphName(SwFrmFmt *pFrmFmt,const String &rFixedPart);
    wwFrameNamer(bool bIsDisabled, const String &rSeed)
        : msSeed(rSeed), mnImportedGraphicsCount(0), mbIsDisabled(bIsDisabled)
        { }
};

//-----------------------------------------
//            Storage-Reader
//-----------------------------------------
class SwWW8ImplReader
{
private:
friend class WW8RStyle;
friend class WW8TabDesc;
friend class WW8ReaderSave;
friend struct WW8FlyPara;
friend struct WW8SwFlyPara;
friend class WW8FlySet;
friend class SwMSDffManager;
friend class SwWW8FltControlStack;
friend class WW8FormulaControl;

    SvStorage* pStg;                // Input-Storage
    SvStream* pStrm;                // Input-(Storage)Stream
    SvStream* pTableStream;         // Input-(Storage)Stream
    SvStream* pDataStream;          // Input-(Storage)Stream

// allgemeines
    SwDoc& rDoc;
    SwPaM* pPaM;

    SwWW8FltControlStack* pCtrlStck;    // Stack fuer die Attribute

    /*
    This stack is for redlines, because their sequence of discovery can
    be out of order of their order of insertion into the document.
    */
    wwRedlineStack *mpRedlineStack;

    /*
    This stack is for fields whose true conversion cannot be determined until
    the end of the document, it is the same stack for headers/footers/main
    text/textboxes/tables etc...
    */
    SwWW8FltRefStack *pRefStck;

    /*
    For graphics anchors. Determines the graphics whose anchors are in the
    current paragraph, and works around the difficulty in inserting a graphic
    anchored to character before a character to be anchored to has been
    inserted. Is emptied at the end of each paragraph.
    */
    SwWW8FltAnchorStack* pAnchorStck;

    /*
    A stack of fields identifiers to keep track of any open fields that need
    to be closed. Generally word fields are inserted as writer fields as soon
    as they are encountered, and so their end point is normally unimportant.
    But hyperlink fields need to be applied as attributes to text and it is
    far easier and safer to set the end point of an attribute when we
    encounter the end marker of the field instead of caculating in advance
    where the end point will fall, to do so fully correctly duplicates the
    main logic of the filter itself.
    */
    std::deque<USHORT> maFieldStack;
    typedef std::deque<USHORT>::const_iterator mycFieldIter;

    /*
    Knows how to split a series of bytes into sprms and their arguments
    */
    wwSprmParser *mpSprmParser;

    /*
    Creates unique names to give to graphics
    */
    wwFrameNamer aGrfNameGenerator;

    /*
     Stack of textencoding being used as we progress through the document text
    */
    std::stack<rtl_TextEncoding> maFontSrcCharSets;

    SwMSConvertControls *pFormImpl; // Control-Implementierung

    SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic;
    SwFrmFmt* pFmtOfJustInsertedApo;

    //Keep track of APO environments
    std::deque<bool> maApos;
    typedef std::deque<bool>::const_iterator mycApoIter;
    /*
    Keep track of generated Ruby character formats we we can minimize the
    number of character formats created
    */
    std::vector<const SwCharFmt*> aRubyCharFmts;

    WW8Fib* pWwFib;
    WW8Fonts* pFonts;
    WW8Dop* pWDop;
    WW8ListManager* pLstManager;
    WW8ScannerBase* pSBase;
    WW8PLCFMan* pPlcxMan;

    WW8RStyle* pStyles;     // Pointer auf die Style-Einleseklasse
    SwFmt* pAktColl;        // gerade zu erzeugende Collection
                            // ( ist ausserhalb einer Style-Def immer 0 )
    SfxItemSet* pAktItemSet;// gerade einzulesende Zeichenattribute
                            // (ausserhalb des WW8ListManager Ctor's immer 0)
    SwWW8StyInf* pCollA;    // UEbersetzungs-Array der Styles
    const SwTxtFmtColl* pDfltTxtFmtColl;    // Default
    SwFmt* pStandardFmtColl;// "Standard"

    SwPageDesc* pPageDesc;      // fuer uebernommene KF-Zeilen
    WW8PLCF_HdFt* pHdFt;        // Pointer auf Header / Footer - Scannerklasse

    WW8FlyPara* pWFlyPara;      // WW-Parameter
    WW8SwFlyPara* pSFlyPara;    // daraus erzeugte Sw-Parameter

    WW8TabDesc* pTableDesc;     // Beschreibung der Tabelleneigenschaften
    //Keep track of tables within tables
    std::stack<WW8TabDesc*> aTableStack;

    SwNumRule* pNumRule;        // fuer Nummerierung / Aufzaehlungen im Text
    WW8_OLST* pNumOlst;         // Gliederung im Text
    SwNodeIndex* pAfterSection;
    SwSection*   pLastInsertedSection;  // last Section that was inserted into the doc

    SwNode* pNode_FLY_AT_CNTNT; // set: WW8SwFlyPara()   read: CreateSwTable()

    SdrModel* pDrawModel;
    SdrPage* pDrawPg;
    EditEngine* pDrawEditEngine;
    wwZOrderer *pWWZOrder;

    SwFieldType* pNumFldType;   // fuer Nummernkreis

    SwMSDffManager* pMSDffManager;

    std::vector<String>* mpAtnNames;

    WW8AuthorInfos* pAuthorInfos;
    WW8OleMaps* pOleMap;

    /*
    Tabstops on a paragraph need to be adjusted when the lrspace has been
    changed. To safely collect all lrchanges we process them at the closing of
    the lr attribute, and store the start pos for the newly modified tabstop
    here.
    */
    SwNodeIndex *pTabNode;
    xub_StrLen nTabCntnt;

    SwNodeIndex* pLastPgDeskIdx;// for inserting a section when Ft-/End-Note
                                // with flag 'on end of section' set

                                // Ini-Flags:
    ULONG nIniFlags;            // Flags aus der writer.ini
    ULONG nIniFlags1;           // dito ( zusaetzliche Flags )
    ULONG nFieldFlags;          // dito fuer Feldern
    ULONG nFieldTagAlways[3];   // dito fuers Taggen von Feldern
    ULONG nFieldTagBad[3];      // dito fuers Taggen von nicht importierbaren F.

    ULONG nLastFlyNode;         // Node number of last imported Fly

    ULONG nDrawObjOfs;
    WW8_CP nDrawCpO;            // Anfang der Txbx-SubDocs

    ULONG nPicLocFc;            // Picture Location in File (FC)
    ULONG nObjLocFc;            // Object Location in File (FC)

    INT32 nIniFlyDx;            // X-Verschiebung von Flys
    INT32 nIniFlyDy;            // Y-Verschiebung von Flys

    rtl_TextEncoding eTextCharSet;    // Default charset for Text
    rtl_TextEncoding eStructCharSet;  // rtl_TextEncoding for structures
    rtl_TextEncoding eHardCharSet;    // Hard rtl_TextEncoding-Attribute
    USHORT nProgress;           // %-Angabe fuer Progressbar
    USHORT nColls;              // Groesse des Arrays
    USHORT nAktColl;            // gemaess WW-Zaehlung
    USHORT nPageDescOffset;     // fuer UpdatePageDescs
    USHORT nDrawTxbx;           // Nummer der Textbox ( noetig ?? )
    USHORT nFldNum;             // laufende Nummer dafuer
    USHORT nLFOPosition;

    short nActSectionNo;        // aktuelle Abschnitts-Nummer (in CreateSep() gesetzt)
    short nCharFmt;             // gemaess WW-Zaehlung, <0 fuer keine
    short nAlign2;
    short nPgWidth;
    short nPgTop;               // fuer APOs
    short nPgLeft;              // Seitenraender, z.B. fuer APOs, Tabellen
    short nPgRight;             // dito

    short nLeftParaMgn;         // Absatz L-Space
    short nTxtFirstLineOfst;    // Absatz 1st line ofset

    short nDrawXOfs, nDrawYOfs;
    short nDrawXOfs2, nDrawYOfs2;

    sal_Unicode cSymbol;        // aktuell einzulesendes Symbolzeichen


    BYTE nWantedVersion;        // urspruenglich vom Writer
                                // angeforderte WW-Doc-Version


    BYTE nSwNumLevel;           // LevelNummer fuer Outline / Nummerierung
    BYTE nWwNumType;            // Gliederung / Nummerg / Aufzaehlg
    sal_Int8 nDrawHeaven, nDrawHell;
    BYTE nListLevel;

    BYTE nNfcPgn;               // Formatting of PageNum
    bool mbRTLPgn;              // Direction of page
    BYTE nPgChpDelim;           // ChapterDelim from PageNum
    BYTE nPgChpLevel;           // ChapterLevel of Heading from PageNum

    BYTE nCorrIhdt;             // used in CreateSep()
    bool bSectionHasATitlePage; // used in CreateSep()

    bool mbNewDoc;          // Neues Dokument ?
    bool bReadNoTbl;        // Keine Tabellen
    bool bPgSecBreak;       // Page- oder Sectionbreak ist noch einzufuegen
    bool bSpec;             // Special-Char im Text folgt
    bool bObj;              // Obj im Text
    bool bTxbxFlySection;   // FlyFrame, der als Ersatz fuer Winword Textbox eingefuegt wurde
    bool bHasBorder;        // fuer Buendelung der Border
    bool bSymbol;           // z.B. Symbol statt Times
    bool bIgnoreText;       // z.B. fuer FieldVanish
    bool bDontCreateSep;    // e.g. when skipping result of multi-column index-field
     int  nInTable;         // wird gerade eine Tabelle eingelesen
    bool bWasTabRowEnd;     // Tabelle : Row End Mark

    bool bShdTxtCol;        // Textfarbe indirekt gesetzt ( Hintergrund sw )
    bool bCharShdTxtCol;    // Textfarbe indirekt gesetzt ( Zeichenhintergrund sw )
    bool bAnl;              // Nummerierung in Bearbeitung
                                // Anl heisst Autonumber level

    bool bHdFtFtnEdn;       // Spezialtext: Kopf- Fuss- usw.
    bool bFtnEdn;           // Fussnote oder Endnote
    bool bIsHeader;         // Text aus Header wird gelesen ( Zeilenhoehe )
    bool bIsFooter;         // Text aus Footer wird gelesen ( Zeilenhoehe )

    bool bIsUnicode;            // aktuelles Text-Stueck ist als 2-Bytiger-Unicode kodiert
                                // bitte NICHT als Bitfeld kodieren!

    bool bCpxStyle;         // Style im Complex Part
    bool bStyNormal;        // Style mit Id 0 wird gelesen
    bool bWWBugNormal;      // WW-Version nit Bug Dya in Style Normal
    bool bNoAttrImport;     // Attribute ignorieren zum Ignorieren v. Styles
    bool bInHyperlink;      // Sonderfall zum einlesen eines 0x01
                                   // siehe: SwWW8ImplReader::Read_F_Hyperlink()
    bool bVerticalEnviron;
    bool bWasParaEnd;

    // praktische Hilfsvariablen:
    bool bVer67;            // ( (6 == nVersion) || (7 == nVersion) );
    bool bVer6;             //   (6 == nVersion);
    bool bVer7;             //   (7 == nVersion);
    bool bVer8;             //   (8 == nVersion);

    bool bPgChpLevel;       // ChapterLevel of Heading from PageNum
    bool bEmbeddObj;        // EmbeddField gelesen

    bool bAktAND_fNumberAcross; // current active Annotated List Deskriptor - ROW flag

    bool bNoLnNumYet;       // no Line Numbering has been activated yet (we import
                            //     the very 1st Line Numbering and ignore the rest)
    bool bRestartLnNumPerSection;




//---------------------------------------------

    void AppendTxtNode(SwPosition& rPos);
    void GetNoninlineNodeAttribs(const SwTxtNode *pNode,
        std::vector<const xub_StrLen*> &rPositions);
    void SetLastPgDeskIdx();

    SwPageDesc* CreatePageDesc( SwPageDesc* pFirstPageDesc,
                                SwPaM** ppPaMWanted = 0 );
    void RemoveCols( SwPageDesc& rPageDesc, SwFmtCol*& rpCol );
    bool SetCols(SwFrmFmt* pFmt, const WW8PLCFx_SEPX* pSep, USHORT nNettoWidth,
        bool bTestOnly = false);
    void SetPage1(SwPageDesc* pPageDesc, SwFrmFmt &rFmt,
        const WW8PLCFx_SEPX* pSep, USHORT nLIdx, bool bIgnoreCols);
    void SetHdFt(SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1, BYTE nIPara);
    void GetPageULData(const  WW8PLCFx_SEPX* pSep, USHORT nLIdx, bool bFirst,
        WW8ULSpaceData& rData);
    void SetPageULSpaceItems(SwFrmFmt &rFmt, WW8ULSpaceData& rData);
    void SetDocumentGrid(SwFrmFmt &rFmt,const WW8PLCFx_SEPX* pSep);

    void SetPageBorder( SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1,
                        const WW8PLCFx_SEPX* pSep, USHORT nLIdx );
    void SetUseOn(SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1, BYTE nHdFt);
    void InsertSectionWithWithoutCols( SwPaM& rMyPaM, const SwFmtCol* pCol );
    void CreateSep(const long nTxtPos, bool bMustHaveBreak);
    bool MustCloseSection(long nTxtPos);

    void CopyPageDescHdFt( const SwPageDesc* pOrgPageDesc,
                           SwPageDesc* pNewPageDesc, BYTE nCode );

    void UpdatePageDescs( USHORT nPageDescOffset );

    void DeleteStk(SwFltControlStack* prStck);
    void DeleteCtrlStk()    { DeleteStk( pCtrlStck  ); pCtrlStck   = 0; }
    void DeleteRefStk()     { DeleteStk( pRefStck ); pRefStck = 0; }
    void DeleteAnchorStk()  { DeleteStk( pAnchorStck ); pAnchorStck = 0; }

    bool ReadChar(long nPosCp, long nCpOfs);
    bool ReadPlainChars(long& rPos, long nEnd, long nCpOfs);
    bool ReadChars(long& rPos, long nNextAttr, long nTextEnd, long nCpOfs);


    void ReadPlainText( long nStartCp, long nTextLen );
    void ProcessAktCollChange(WW8PLCFManResult& rRes, bool* pStartAttr,
        bool bCallProcessSpecial);
    long ReadTextAttr(long& rTxtPos, bool& rbStartLine);
    void ReadAttrs(long& rNext, long& rTxtPos, bool& rbStartLine);
    void CloseAttrEnds();
    bool ReadText(long nStartCp, long nTextLen, short nType);

    void ReadRevMarkAuthorStrTabl( SvStream& rStrm, INT32 nTblPos,
        INT32 nTblSiz, SwDoc& rDoc );

    void Read_HdFtFtnText( const SwNodeIndex* pSttIdx, long nStartCp,
                           long nLen, short nType );
    void Read_HdFt1( BYTE nPara, BYTE nWhichItems, SwPageDesc* pPD );
    void Read_HdFtText(long nStartCp, long nLen, SwPageDesc* pPD,
            bool bUseLeft, bool bFooter);

    BYTE* ReadUntilToken( USHORT& rStrLen, USHORT nMaxLen, BYTE nToken );
    void ImportTox( int nFldId, String aStr );

    void EndSprm( USHORT nId );
    void NewAttr( const SfxPoolItem& rAttr );

    bool GetFontParams(USHORT, FontFamily&, String&, FontPitch&,
        rtl_TextEncoding&);
    bool SetNewFontAttr(USHORT nFCode, bool bSetEnums, USHORT nWhich);
    void ResetCharSetVars();

    const SfxPoolItem* GetFmtAttr( USHORT nWhich );
    BYTE HdFtCorrectPara( BYTE nPara );
    bool JoinNode(SwPaM &rPam, bool bStealAttr = false);

    bool IsBorder(const WW8_BRC* pbrc, bool bChkBtwn = false);

    //Set closest writer border equivalent into rBox from pbrc, optionally
    //recording true winword dimensions in pSizeArray. nSetBorders to mark a
    //border which has been previously set to a value and for which becoming
    //empty is valid. Set bCheBtwn to work with paragraphs that have a special
    //between paragraphs border
    bool SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc, short *pSizeArray=0,
        BYTE nSetBorders=0xFF, bool bChkBtwn = false);

    void GetBorderDistance( WW8_BRC* pbrc, Rectangle& rInnerDist );

    bool SetShadow(SvxShadowItem& rShadow, const SvxBoxItem& rBox,
        const WW8_BRC pbrc[4]);

    //returns true is a shadow was set
    bool SetFlyBordersShadow(SfxItemSet& rFlySet, const WW8_BRC pbrc[4],
        short *SizeArray=0);

    INT32 MatchSdrBoxIntoFlyBoxItem( const Color& rLineColor,
        MSO_LineStyle eLineStyle, MSO_SPT eShapeType, INT32 &rLineWidth,
        SvxBoxItem& rBox );
    void MatchSdrItemsIntoFlySet( SdrObject*    pSdrObj, SfxItemSet &aFlySet,
        MSO_LineStyle eLineStyle, MSO_SPT eShapeType, Rectangle &rInnerDist );
    void AdjustLRWrapForWordMargins(SvxMSDffImportRec* pRecord,
        SvxLRSpaceItem *pLR);
    void AdjustULWrapForWordMargins(SvxMSDffImportRec* pRecord,
        SvxULSpaceItem *pUL);
    void MatchWrapDistancesIntoFlyFmt( SvxMSDffImportRec* pRecord,
                                       SwFrmFmt*          pFlyFmt );

    void SetAttributesAtGrfNode( SvxMSDffImportRec* pRecord, SwFrmFmt *pFlyFmt,
        WW8_FSPA *pF );

    bool StartApo(const BYTE* pSprm29, const WW8FlyPara *pNowStyleApo,
        WW8_TablePos *pTabPos);
    void StopApo();
    bool TestSameApo(const BYTE* pSprm29, const WW8FlyPara *pNowStyleApo,
        WW8_TablePos *pTabPos);
    const BYTE* TestApo(bool& rbStartApo, bool& rbStopApo,
        WW8FlyPara* &pbNowStyleApo, int nCellLevel, bool bTableRowEnd,
        WW8_TablePos *pTabPos);

    bool ProcessSpecial(bool bAllEnd, bool* pbReSync, WW8_CP nStartCp );
    USHORT TabRowSprm(int nLevel) const;

    ULONG ReadWmfHeader( WmfFileHd* pHd, long nPos );
    bool ReadGrafFile(String& rFileName, Graphic*& rpGraphic,
       const WW8_PIC& rPic, SvStream* pSt, ULONG nFilePos, bool* pDelIt);

    void ReplaceObjWithGraphicLink(const SdrObject &rReplaceTextObj,
        const String& rFileName);

    SwFlyFrmFmt* MakeGrafNotInCntnt(const WW8PicDesc& rPD,
        const Graphic* pGraph, const String& rFileName,
        const SfxItemSet& rGrfSet);

    SwFrmFmt* MakeGrafInCntnt(const WW8_PIC& rPic, const WW8PicDesc& rPD,
        const Graphic* pGraph, const String& rFileName,
        const SfxItemSet& rGrfSet);

    SwFrmFmt *AddAutoAnchor(SwFrmFmt *pFmt);
    void RemoveAutoAnchor(const SwFrmFmt *pFmt);
    SwFrmFmt* ImportGraf1(WW8_PIC& rPic, SvStream* pSt, ULONG nFilePos);
    SwFrmFmt* ImportGraf(SdrTextObj* pTextObj = 0, SwFrmFmt* pFlyFmt = 0);
    bool ImportURL(String &sURL,String &sMark,WW8_CP nStart);

    SdrObject* ImportOleBase( Graphic& rGraph, const Graphic* pGrf=0,
        const SfxItemSet* pFlySet=0 );

    SwFrmFmt* ImportOle( const Graphic* = 0, const SfxItemSet* pFlySet = 0 );
    SwFlyFrmFmt* InsertOle(SdrOle2Obj &rObject, const SfxItemSet &rFlySet);

    bool ImportFormulaControl(WW8FormulaControl &rBox,WW8_CP nStart,
        SwWw8ControlType nWhich);

    void ImportDop();

    //This converts MS Asian Typography information into OOo's
    void ImportDopTypography(const WW8DopTypography &rTypo);

    ULONG LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss);

    bool StartTable(WW8_CP nStartCp);
    bool InEqualApo(int nLvl) const;
    bool InLocalApo() const { return InEqualApo(nInTable); }
    bool InEqualOrHigherApo(int nLvl) const;
    bool InAnyApo() const { return InEqualOrHigherApo(0); }
    void TabCellEnd();
    void StopTable();
    short GetTableLeft();
    bool IsInvalidOrToBeMergedTabCell() const;

// Nummerierungen / Aufzaehlungen ( Autonumbered List Data Descriptor )
// Liste:        ANLD ( Autonumbered List Data Descriptor )
//   eine Ebene: ANLV ( Autonumber Level Descriptor )
//
// Chg7-8:
// Listen sind in WW8 eigene Strukturen, die ueber folgende drei Tabellen
// verwaltet werden: rglst, hpllfo und hsttbListNames
// die Strukturen hierfuer sind: LSTF, LVLF, LFO LFOLVL

    void SetAnlvStrings(SwNumFmt* pNum, WW8_ANLV* pAV, const BYTE* pTxt,
        bool bOutline);
    void SetAnld(SwNumRule* pNumR, WW8_ANLD* pAD, BYTE nSwLevel, bool bOutLine);
    void SetNumOlst( SwNumRule* pNumR, WW8_OLST* pO, BYTE nSwLevel );
    SwNumRule* GetStyRule();

    void StartAnl(const BYTE* pSprm13);
    void NextAnlLine(const BYTE* pSprm13);
    void StopAnl(bool bGoBack = true);

// GrafikLayer

    bool ReadGrafStart(void* pData, short nDataSiz, WW8_DPHEAD* pHd,
        const WW8_DO* pDo, SfxAllItemSet &rSet);
    SdrObject *ReadLine(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    SdrObject *ReadRect(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    SdrObject *ReadElipse(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    SdrObject *ReadArc(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    SdrObject *ReadPolyLine(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    ESelection GetESelection( long nCpStart, long nCpEnd );
    void InsertTxbxStyAttrs( SfxItemSet& rS, USHORT nColl );
    void InsertTxbxAttrs(long nStartCp, long nEndCp, bool bONLYnPicLocFc);

    bool GetTxbxTextSttEndCp(long& rStartCp, long& rEndCp, USHORT nTxBxS,
        USHORT nSequence);
    bool GetTxbxText(String& rString, long StartCp, long nEndCp);
    SwFrmFmt* InsertTxbxText(SdrTextObj* pTextObj, Size* pObjSiz,
        USHORT nTxBxS, USHORT nSequence, long nPosCp, SwFrmFmt* pFlyFmt,
        bool bMakeSdrGrafObj, bool& rbEraseTextObj,
        bool* pbTestTxbxContainsText = 0, long* pnStartCp = 0,
        long* pnEndCp = 0, bool* pbContainsGraphics = 0,
        SvxMSDffImportRec* pRecord = 0);
    bool TxbxChainContainsRealText( USHORT nTxBxS,
                                    long&  rStartCp,
                                    long&  rEndCp );
    SdrObject *ReadTxtBox(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    SdrObject *ReadCaptionBox(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    SdrObject *ReadGroup(WW8_DPHEAD* pHd, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    SdrObject *ReadGrafPrimitive(short& rLeft, const WW8_DO* pDo,
        SfxAllItemSet &rSet);
    void ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp );
    SdrObject* CreateContactObject(SwFrmFmt* pFlyFmt);
    RndStdIds ProcessEscherAlign(SvxMSDffImportRec* pRecord, WW8_FSPA *pFSPA,
        SfxItemSet &rFlySet, bool bOrgObjectWasReplace);
    SwFrmFmt* Read_GrafLayer( long nGrafAnchorCp );
    SwFlyFrmFmt* ImportReplaceableDrawables( SdrObject* &rpObject,
        SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord, WW8_FSPA *pF,
        SfxItemSet &rFlySet );
    SwFlyFrmFmt *ConvertDrawTextToFly( SdrObject* &rpObject,
        SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord,
        RndStdIds eAnchor, WW8_FSPA *pF, SfxItemSet &rFlySet );
    void MungeTextIntoDrawBox(SdrObject* pTrueObject,
        SvxMSDffImportRec *pRecord, long nGrafAnchorCp, SwFrmFmt *pRetFrmFmt);

    void GrafikCtor();
    void GrafikDtor();

// anderes
    String GetFieldResult( WW8FieldDesc* pF );
    void MakeTagString( String& rStr, const String& rOrg );
    void UpdateFields();
    void ConvertFFileName( String& rName, const String& rRaw );
    long Read_F_Tag( WW8FieldDesc* pF );
    void InsertTagField( const USHORT nId, const String& rTagText );
    long ImportExtSprm(WW8PLCFManResult* pRes);
    void EndExtSprm(USHORT nSprmId);
    void ReadDocInfo();

// Ver8-Listen

    void RegisterNumFmtOnTxtNode(USHORT nActLFO, BYTE nActLevel,
        bool bSetAttr = true);
    void RegisterNumFmtOnStyle(USHORT nStyle, USHORT nActLFO   = USHRT_MAX,
        BYTE nActLevel = WW8ListManager::nMaxLevel);
    void RegisterNumFmt(USHORT nActLFO, BYTE nActLevel);

    SwNumRule* SyncStyleIndentWithList(SwWW8StyInf &rStyleInfo,
        SwNumRule* pRule, BYTE nLevel);

// spaeter zu ersetzen durch Aufruf in entsprechend erweiterten SvxMSDffManager

    const String* GetAnnotationAuthor(sal_uInt16 nIdx);

    // Schnittstellen fuer die Toggle-Attribute
    void SetToggleAttr(BYTE nAttrId, bool bOn);
    void SetToggleBiDiAttr(BYTE nAttrId, bool bOn);
    void _ChkToggleAttr( USHORT nOldStyle81Mask, USHORT nNewStyle81Mask );

    void ChkToggleAttr( USHORT nOldStyle81Mask, USHORT nNewStyle81Mask )
    {
        if( nOldStyle81Mask != nNewStyle81Mask &&
            pCtrlStck->GetToggleAttrFlags() )
            _ChkToggleAttr( nOldStyle81Mask, nNewStyle81Mask );
    }

    void _ChkToggleBiDiAttr( USHORT nOldStyle81Mask, USHORT nNewStyle81Mask );

    void ChkToggleBiDiAttr( USHORT nOldStyle81Mask, USHORT nNewStyle81Mask )
    {
        if( nOldStyle81Mask != nNewStyle81Mask &&
            pCtrlStck->GetToggleBiDiAttrFlags() )
            _ChkToggleBiDiAttr( nOldStyle81Mask, nNewStyle81Mask );
    }

    void PopTableDesc();
    void MoveInsideFly(const SwFrmFmt *pFlyFmt);
    void MoveOutsideFly(const SwFrmFmt *pFlyFmt, const SwPosition &rPos,
        bool bTableJoin = true);

    void SetOutLineStyles();

    //No copying
    SwWW8ImplReader(const SwWW8ImplReader &);
    SwWW8ImplReader& operator=(const SwWW8ImplReader&);
public:     // eigentlich private, geht aber leider nur public
    void ConvertUFName( String& rName );

    long Read_Ftn(WW8PLCFManResult* pRes);
    long Read_Field(WW8PLCFManResult* pRes);
    void End_Field();
    long Read_Book(WW8PLCFManResult*);
    long Read_And(WW8PLCFManResult* pRes);

    // Attribute

    void Read_Special(USHORT, const BYTE*, short nLen);
    void Read_Obj(USHORT, const BYTE*, short nLen);
    void Read_PicLoc(USHORT, const BYTE* pData, short nLen );
    void Read_BoldUsw(USHORT nId, const BYTE*, short nLen);
    void Read_BoldBiDiUsw(USHORT nId, const BYTE*, short nLen);
    void Read_SubSuper(         USHORT, const BYTE*, short nLen );
    bool ConvertSubToGraphicPlacement();
    SwFrmFmt *ContainsSingleInlineGraphic(const SwPaM &rRegion);
    void Read_SubSuperProp(     USHORT, const BYTE*, short nLen );
    void Read_Underline(        USHORT, const BYTE*, short nLen );
    void Read_TxtColor(         USHORT, const BYTE*, short nLen );
    void Read_FontCode(         USHORT, const BYTE*, short nLen );
    void Read_FontSize(         USHORT, const BYTE*, short nLen );
    void Read_CharSet(USHORT , const BYTE* pData, short nLen);
    void Read_Language(         USHORT, const BYTE*, short nLen );
    void Read_CColl(            USHORT, const BYTE*, short nLen );
    void Read_Kern(             USHORT, const BYTE* pData, short nLen );
    void Read_FontKern(         USHORT, const BYTE* pData, short nLen );
    void Read_Invisible(USHORT, const BYTE*, short nLen);
    void Read_Emphasis(         USHORT, const BYTE* pData, short nLen );
    void Read_ScaleWidth(       USHORT, const BYTE* pData, short nLen );
    void Read_Relief(           USHORT, const BYTE* pData, short nLen);

    void Read_NoLineNumb(       USHORT nId, const BYTE* pData, short nLen );

    void Read_LR(               USHORT nId, const BYTE*, short nLen );
    void NeedAdjustStyleTabStops(short nLeft, short nFirstLineOfst,
        SwWW8StyInf *pSty);
    void NeedAdjustTextTabStops(short nLeft, short nFirstLineOfst,
        SwNodeIndex *pPos,xub_StrLen nIndex);
    void Read_UL(               USHORT nId, const BYTE*, short nLen );
    void Read_ParaAutoBefore(USHORT , const BYTE *pData, short nLen);
    void Read_ParaAutoAfter(USHORT , const BYTE *pData, short nLen);
    void Read_LineSpace(        USHORT, const BYTE*, short nLen );
    void Read_Justify(          USHORT, const BYTE*, short nLen );
    void Read_Hyphenation(      USHORT, const BYTE* pData, short nLen );
    void Read_WidowControl(     USHORT, const BYTE* pData, short nLen );
    void Read_AlignFont(        USHORT, const BYTE* pData, short nLen );
    void Read_UsePgsuSettings(  USHORT, const BYTE* pData, short nLen );
    void Read_KeepLines(        USHORT, const BYTE* pData, short nLen );
    void Read_KeepParas(        USHORT, const BYTE* pData, short nLen );
    void Read_BreakBefore(      USHORT, const BYTE* pData, short nLen );
    void Read_ApoPPC(           USHORT, const BYTE* pData, short nLen );

    void Read_BoolItem(         USHORT nId, const BYTE*, short nLen );

    void Read_Border(           USHORT nId, const BYTE* pData, short nLen );
    void Read_Tab(              USHORT nId, const BYTE* pData, short nLen );
    void Read_Symbol(USHORT, const BYTE* pData, short nLen);
    void Read_FldVanish(        USHORT nId, const BYTE* pData, short nLen );

    // Revision Marks ( == Redlining )

    // insert or delete content (change char attributes resp.)
    void Read_CRevisionMark(SwRedlineType eType, const BYTE* pData, short nLen);
    // insert new content
    void Read_CFRMark(USHORT , const BYTE* pData, short nLen);
    // delete old content
    void Read_CFRMarkDel(USHORT , const BYTE* pData, short nLen);
    // change properties of content (e.g. char formating)
    void Read_CPropRMark(USHORT , const BYTE* pData, short nLen); // complex!


    void Read_TabRowEnd(        USHORT, const BYTE* pData, short nLen );
    static bool ParseTabPos(WW8_TablePos *aTabPos, WW8PLCFx_Cp_FKP* pPap);
    void Read_Shade(            USHORT, const BYTE* pData, short nLen );
    void Read_ANLevelNo(        USHORT, const BYTE* pData, short nLen );
    void Read_ANLevelDesc(      USHORT, const BYTE* pData, short nLen );

    // Gliederungsebene Ver8
    void Read_POutLvl(USHORT, const BYTE* pData, short nLen);

    void Read_OLST(             USHORT, const BYTE* pData, short nLen );

    void Read_CharShadow(       USHORT, const BYTE* pData, short nLen );
    void Read_CharHighlight(    USHORT, const BYTE* pData, short nLen );
                                        // Ver8-Listen

    void Read_ListLevel(        USHORT nId, const sal_uInt8* pData, short nLen);
    void Read_LFOPosition(      USHORT nId, const sal_uInt8* pData, short nLen);
    bool SetTxtFmtCollAndListLevel(const SwPaM& rRg, SwWW8StyInf& rStyleInfo);

    void Read_StyleCode(USHORT, const BYTE* pData, short nLen);
    void Read_Majority(USHORT, const BYTE* , short );
    void Read_DoubleLine_Rotate( USHORT, const BYTE* pDATA, short nLen);

    void Read_TxtForeColor(USHORT, const BYTE* pData, short nLen);
    void Read_TxtBackColor(USHORT, const BYTE* pData, short nLen);
    void Read_ParaBackColor(USHORT, const BYTE* pData, short nLen);
    void Read_ParaBiDi(USHORT, const BYTE* pData, short nLen);
    static sal_uInt32 ExtractColour(const BYTE* &rpData, bool bVer67);

    long MapBookmarkVariables(const WW8FieldDesc* pF,String &rOrigName,
        const String &rData);
    const String &GetMappedBookmark(String &rOrigName);

    // Felder
    eF_ResT Read_F_Nul(WW8FieldDesc*, String& );
    eF_ResT Read_F_Input(WW8FieldDesc*, String& rStr);
    eF_ResT Read_F_InputVar(WW8FieldDesc*, String& rStr);
    eF_ResT Read_F_ANumber( WW8FieldDesc*, String& );
    eF_ResT Read_F_DocInfo( WW8FieldDesc* pF, String& rStr );
    eF_ResT Read_F_Author( WW8FieldDesc*, String& );
    eF_ResT Read_F_TemplName( WW8FieldDesc*, String& );
    short GetTimeDatePara(String& rStr, ULONG& rFormat, bool &rbForceJapanese);
    eF_ResT Read_F_DateTime( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_FileName( WW8FieldDesc*, String& rStr);
    eF_ResT Read_F_Anz( WW8FieldDesc* pF, String& );
    eF_ResT Read_F_CurPage( WW8FieldDesc*, String& );
    eF_ResT Read_F_Ref( WW8FieldDesc* pF, String& );

    eF_ResT Read_F_Set( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_PgRef( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_NoteReference( WW8FieldDesc* pF, String& rStr );

    eF_ResT Read_F_Tox( WW8FieldDesc* pF, String& rStr );
    eF_ResT Read_F_Symbol( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_Embedd( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr);
    eF_ResT Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr );
    eF_ResT Read_F_FormListBox( WW8FieldDesc* pF, String& );
    eF_ResT Read_F_Macro( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_DBField( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_DBNext( WW8FieldDesc*, String& );
    eF_ResT Read_F_DBNum( WW8FieldDesc*, String& );
    eF_ResT Read_F_Equation( WW8FieldDesc*, String& );
    void Read_SubF_Ruby( _ReadFieldParams& rReadParam);
    void Read_SubF_Combined( _ReadFieldParams& rReadParam);
    eF_ResT Read_F_IncludePicture( WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_IncludeText(    WW8FieldDesc*, String& rStr );
    eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr );

    eF_ResT Read_F_OCX( WW8FieldDesc*, String& );
    eF_ResT Read_F_Hyperlink( WW8FieldDesc*, String& rStr );

    void DeleteFormImpl();

    short ImportSprm( const BYTE* pPos, USHORT nId = 0 );

    bool SearchRowEnd(WW8PLCFx_Cp_FKP* pPap,WW8_CP &rStartCp, int nLevel) const;

    const WW8Fib& GetFib() const    { return *pWwFib; }
    SwDoc& GetDoc() const           { return rDoc; }
    USHORT GetNAktColl()  const     { return nAktColl; }
    void SetNAktColl( USHORT nColl ) { nAktColl = nColl;    }
    void SetAktItemSet( SfxItemSet* pItemSet ) { pAktItemSet = pItemSet; }
    const USHORT StyleUsingLFO( USHORT nLFOIndex ) const ;
    const SwFmt* GetStyleWithOrgWWName( String& rName ) const ;

    static bool GetPictGrafFromStream(Graphic& rGraphic, SvStream& rSrc);
    static void PicRead( SvStream *pDataStream, WW8_PIC *pPic, bool bVer67);
    static bool ImportOleWMF( SvStorageRef xSrc1, GDIMetaFile &rWMF,
        long &rX, long &rY);
    static ColorData GetCol(BYTE nIco);

    SwWW8ImplReader( BYTE nVersionPara, SvStorage* pStorage, SvStream* pSt,
        SwDoc& rD, bool bNewDoc );

    const ULONG GetFieldFlags() const{ return nFieldFlags; }
    const ULONG GetIniFlags()   const{ return nIniFlags; }
    const ULONG GetIniFlags1()  const{ return nIniFlags1; }

    // Laden eines kompletten DocFiles
    ULONG LoadDoc( SwPaM&,WW8Glossary *pGloss=0);
    CharSet SwWW8ImplReader::GetCurrentCharSet();
};

#endif