xref: /aoo41x/main/sw/source/filter/ww8/ww8par.hxx (revision 41623124)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
24 
25 #ifndef _WW8PAR_HXX
26 #define _WW8PAR_HXX
27 
28 #include <tools/string.hxx>
29 #include <filter/msfilter/msdffimp.hxx>
30 #include <filter/msfilter/msocximex.hxx>
31 #include <editeng/frmdir.hxx>
32 #include <fltshell.hxx>         // fuer den Attribut Stack
33 
34 #include <vector>
35 #include <stack>
36 #include <deque>
37 #include <map>
38 #include <utility>
39 
40 #include "tracer.hxx"
41 #include "ww8struc.hxx"     // WW8_BRC
42 #include "ww8scan.hxx"  // WW8Fib
43 #include "ww8glsy.hxx"
44 #include "wrtww8.hxx"
45 #include "../inc/msfilter.hxx"
46 #include <xmloff/odffields.hxx>
47 #include <IMark.hxx>
48 
49 class SwDoc;
50 class SwPaM;
51 class SfxPoolItem;
52 class SwTxtFmtColl;
53 class SwPageDesc;
54 class SvxBoxItem;
55 class SwFmt;
56 class SwNodeIndex;
57 class SwFlyFrmFmt;
58 class SwAttrSet;
59 class SwNumRule;
60 class SwFrmFmt;
61 class Writer;
62 class SwFmtFld;
63 class SwWW8StyInf;
64 class WW8Fib;
65 class WW8PLCFMan;
66 struct WW8PLCFManResult;
67 class WW8RStyle;
68 class WW8PLCF_HdFt;
69 class WW8Dop;
70 class WW8ScannerBase;
71 struct WW8FieldDesc;
72 struct WW8FlyPara;
73 struct WW8SwFlyPara;
74 struct WW8_PIC;
75 class WW8TabDesc;
76 struct WW8_SHD;
77 struct WW8_OLST;
78 class SwNumFmt;
79 struct WW8_ANLD;
80 struct WW8_ANLV;
81 struct WW8_DO;
82 struct WW8_DPHEAD;
83 struct WW8_FSPA;
84 class SdrModel;
85 class SdrPage;
86 class SdrObject;
87 class SdrTextObj;
88 class Size;
89 class EditEngine;
90 struct SwPosition;
91 class WW8ReaderSave;
92 struct WW8PicDesc;
93 class Graphic;
94 class SwFieldType;
95 class SvStorage;
96 // alt: class SvStorageRef;
97 class SwAttrSet;
98 class GDIMetaFile;
99 struct ESelection;
100 class SfxItemSet;
101 class _ReadFieldParams;
102 class wwZOrderer;
103 class OutlinerParaObject;
104 
105 namespace com{namespace sun {namespace star{
106     namespace beans{ class XPropertySet;}
107     namespace form { class XFormComponent;}
108     namespace drawing{class XShape;}
109     namespace lang{class XMultiServiceFactory;}
110 }}}
111 
112 // defines nur fuer die WW8-variable der INI-Datei
113 #define WW8FL_NO_TEXT        1
114 #define WW8FL_NO_STYLES      2
115 #define WW8FL_NO_ZSTYLES     4  // keine Zeichenstyles importieren
116 #define WW8FL_NO_GRAF     0x80
117 
118 // falls gestetzt, werden fuer Writer-Def-Styles neue Styles mit den
119 // WW8-Def-Style-Eigenschaften erzeugt, statt die Writer-Standards zu
120 // ueberschreiben
121 #define WW8FL_NO_DEFSTYLES        0x400
122 
123 #define WW8FL_NO_OUTLINE         0x1000
124 #define WW8FL_NO_IMPLPASP        0x4000  // no implicit para space
125 #define WW8FL_NO_GRAFLAYER       0x8000
126 
127 // Zusatz-Filter-Flags, gueltig ab Winword 8
128 #define WW8FL_NO_FLY_FOR_TXBX         1
129 
130 //-----------------------------------------
131 //            Listen-Manager (ab Ver8)
132 //-----------------------------------------
133 
134 struct WW8LFOInfo;
135 typedef WW8LFOInfo* WW8LFOInfo_Ptr;
136 // Redlining: match WinWord author ids to StarWriter author ids
137 struct WW8OleMap;
138 typedef WW8OleMap* WW8OleMap_Ptr;
139 
140 SV_DECL_PTRARR_DEL(WW8LFOInfos,WW8LFOInfo_Ptr,16,16)
141 // SV_DECL_PTRARR_SORT_DEL(WW8AuthorInfos, WW8AuthorInfo_Ptr,16,16)
142 SV_DECL_PTRARR_SORT_DEL(WW8OleMaps, WW8OleMap_Ptr,16,16)
143 
144 class WW8Reader : public StgReader
145 {
146     virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &);
147 public:
148     virtual int GetReaderType();
149 
150     virtual sal_Bool HasGlossaries() const;
151     virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
152 };
153 
154 struct WW8OleMap
155 {
156     sal_uInt32 mnWWid;
157     String msStorageName;
158 
159     WW8OleMap(sal_uInt32 nWWid)
160         : mnWWid(nWWid) {}
161 
162      WW8OleMap(sal_uInt32 nWWid, String sStorageName)
163         : mnWWid(nWWid), msStorageName(sStorageName) {}
164 
165     bool operator==(const WW8OleMap & rEntry) const
166     {
167         return (mnWWid == rEntry.mnWWid);
168     }
169     bool operator<(const WW8OleMap & rEntry) const
170     {
171         return (mnWWid < rEntry.mnWWid);
172     }
173 };
174 
175 class SwWW8ImplReader;
176 struct WW8LSTInfo;
177 class WW8ListManager
178 {
179 public:
180     WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_);
181     //Min and Max possible List Levels in Word
182     enum ListLevel {nMinLevel=1, nMaxLevel=9};
183     //the rParaSprms returns back the original word paragraph indent
184     //sprms which were attached to the original numbering format
185     SwNumRule* GetNumRuleForActivation(sal_uInt16 nLFOPosition, const sal_uInt8 nLevel,
186         std::vector<sal_uInt8> &rParaSprms, SwTxtNode *pNode=0);
187     SwNumRule* CreateNextRule(bool bSimple);
188     ~WW8ListManager();
189 	SwNumRule* GetNumRule(int i);
190 	int GetWW8LSTInfoNum() const{return maLSTInfos.size();}
191 private:
192     wwSprmParser maSprmParser;
193     SwWW8ImplReader& rReader;
194     SwDoc&           rDoc;
195     const WW8Fib&    rFib;
196     SvStream&        rSt;
197     std::vector<WW8LSTInfo* > maLSTInfos;
198     WW8LFOInfos* pLFOInfos;// D. aus PLF LFO, sortiert genau wie im WW8 Stream
199     sal_uInt16       nUniqueList; // current number for creating unique list names
200     sal_uInt8* GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms, sal_uInt8 nLen);
201     WW8LSTInfo* GetLSTByListId(    sal_uInt32  nIdLst     ) const;
202     //the rParaSprms returns back the original word paragraph indent
203     //sprms which are attached to this numbering level
204     bool ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, sal_uInt16 nLevelStyle,
205         bool bSetStartNo, std::deque<bool> &rNotReallyThere, sal_uInt16 nLevel,
206         std::vector<sal_uInt8> &rParaSprms);
207 
208     // Zeichenattribute aus GrpprlChpx
209     typedef SfxItemSet* WW8aISet[nMaxLevel];
210     // Zeichen Style Pointer
211     typedef SwCharFmt* WW8aCFmt[nMaxLevel];
212 
213     void AdjustLVL(sal_uInt8 nLevel, SwNumRule& rNumRule, WW8aISet& rListItemSet,
214         WW8aCFmt& aCharFmt, bool& bNewCharFmtCreated,
215         String aPrefix = aEmptyStr);
216 
217     //No copying
218     WW8ListManager(const WW8ListManager&);
219     WW8ListManager& operator=(const WW8ListManager&);
220     sal_uInt16 nLastLFOPosition;
221 };
222 
223 //-----------------------------------------
224 //            Stack
225 //-----------------------------------------
226 class SwWW8FltControlStack : public SwFltControlStack
227 {
228 private:
229     SwWW8ImplReader& rReader;
230     sal_uInt16 nToggleAttrFlags;
231     sal_uInt16 nToggleBiDiAttrFlags;
232     //No copying
233     SwWW8FltControlStack(const SwWW8FltControlStack&);
234     SwWW8FltControlStack& operator=(const SwWW8FltControlStack&);
235     const SwNumFmt* GetNumFmtFromStack(const SwPosition &rPos,
236         const SwTxtNode &rTxtNode);
237 protected:
238     virtual void SetAttrInDoc(const SwPosition& rTmpPos,
239         SwFltStackEntry* pEntry);
240 	//Modify here for #119405, by easyfan, 2012-05-24
241 	virtual sal_Int32 GetCurrAttrCP() const;
242 	virtual bool IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD=true) const;
243 	//End of modification, by easyfan
244 	//Modify for #119405 by chengjh, 2012-08-16
245 	//Clear the para end position recorded in reader intermittently for the least impact on loading performance
246 	virtual void ClearParaEndPosition();
247 	virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd);
248 	//End
249 
250 public:
251     SwWW8FltControlStack(SwDoc* pDo, sal_uLong nFieldFl, SwWW8ImplReader& rReader_ )
252         : SwFltControlStack( pDo, nFieldFl ), rReader( rReader_ ),
253         nToggleAttrFlags(0), nToggleBiDiAttrFlags(0)
254     {}
255 
256     void NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr);
257 
258     virtual void SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand=LONG_MAX, sal_Bool consumedByField=sal_False);
259 
260 	void SetToggleAttr(sal_uInt8 nId, bool bOn)
261     {
262         if( bOn )
263             nToggleAttrFlags |= (1 << nId);
264         else
265             nToggleAttrFlags &= ~(1 << nId);
266     }
267 
268 	sal_uInt16 GetToggleAttrFlags() const { return nToggleAttrFlags; }
269 
270 	void SetToggleBiDiAttr(sal_uInt8 nId, bool bOn)
271     {
272         if( bOn )
273             nToggleBiDiAttrFlags |= (1 << nId);
274         else
275             nToggleBiDiAttrFlags &= ~(1 << nId);
276     }
277 
278 	sal_uInt16 GetToggleBiDiAttrFlags() const { return nToggleBiDiAttrFlags; }
279     void SetToggleAttrFlags(sal_uInt16 nFlags) { nToggleAttrFlags = nFlags; }
280     void SetToggleBiDiAttrFlags(sal_uInt16 nFlags) {nToggleBiDiAttrFlags = nFlags;}
281 
282     const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
283     const SfxPoolItem* GetStackAttr(const SwPosition& rPos, sal_uInt16 nWhich);
284 };
285 
286 //The only thing this is for is RES_FLTR_ANCHOR, anything else is an error.
287 //For graphics whose anchoring position would otherwise be automatically moved
288 //along by the insertion of text.
289 class SwWW8FltAnchorStack : public SwFltControlStack
290 {
291 public:
292     SwWW8FltAnchorStack(SwDoc* pDo, sal_uLong nFieldFl)
293         : SwFltControlStack( pDo, nFieldFl ) {}
294     void AddAnchor(const SwPosition& rPos,SwFrmFmt *pFmt);
295     void Flush();
296 private:
297     //No copying
298     SwWW8FltAnchorStack(const SwWW8FltAnchorStack&);
299     SwWW8FltAnchorStack& operator=(const SwWW8FltAnchorStack&);
300 };
301 
302 //For fields whose handling cannot be fully resolved until we hit the end of
303 //the document.
304 class Position
305 {
306 public:
307     SwNodeIndex maMkNode;
308     SwNodeIndex maPtNode;
309     xub_StrLen mnMkCntnt;
310     xub_StrLen mnPtCntnt;
311     Position(const SwPaM &rPaM);
312     Position(const Position &rEntry);
313 private:
314     //No assignment
315     Position& operator=(const Position&);
316 };
317 
318 namespace SwWW8
319 {
320     struct ltstr
321     {
322         bool operator()(const String &r1, const String &r2) const
323         {
324             return r1.CompareIgnoreCaseToAscii(r2) == COMPARE_LESS;
325         }
326     };
327 };
328 
329 class SwWW8ReferencedFltEndStack : public SwFltEndStack
330 {
331 public:
332     SwWW8ReferencedFltEndStack( SwDoc* pDo, sal_uLong nFieldFl )
333         : SwFltEndStack( pDo, nFieldFl )
334         , aReferencedTOCBookmarks()
335     {}
336 
337     // Keep track of referenced TOC bookmarks in order to suppress the import
338     // of unreferenced ones.
339     std::set<String, SwWW8::ltstr> aReferencedTOCBookmarks;
340 protected:
341     virtual void SetAttrInDoc( const SwPosition& rTmpPos,
342                                SwFltStackEntry* pEntry );
343 };
344 
345 class SwWW8FltRefStack : public SwFltEndStack
346 {
347 public:
348     SwWW8FltRefStack(SwDoc* pDo, sal_uLong nFieldFl)
349         : SwFltEndStack( pDo, nFieldFl )
350         , aFieldVarNames()
351     {}
352     bool IsFtnEdnBkmField(const SwFmtFld& rFmtFld, sal_uInt16& rBkmNo);
353 
354     //Keep track of variable names created with fields, and the bookmark
355     //mapped to their position, hopefully the same, but very possibly
356     //an additional pseudo bookmark
357     std::map<String, String, SwWW8::ltstr> aFieldVarNames;
358 protected:
359     SwFltStackEntry *RefToVar(const SwField* pFld,SwFltStackEntry *pEntry);
360     virtual void SetAttrInDoc(const SwPosition& rTmpPos,
361         SwFltStackEntry* pEntry);
362 private:
363     //No copying
364     SwWW8FltRefStack(const SwWW8FltRefStack&);
365     SwWW8FltRefStack& operator=(const SwWW8FltRefStack&);
366 };
367 
368 
369 namespace sw
370 {
371     namespace hack
372     {
373         class Position
374         {
375         private:
376             SwNodeIndex maPtNode;
377             xub_StrLen mnPtCntnt;
378         public:
379             Position(const SwPosition &rPos);
380             Position(const Position &rPos);
381             operator SwPosition() const;
382 	        SwNodeIndex GetPtNode() { return maPtNode; };
383 	        xub_StrLen GetPtCntnt() { return mnPtCntnt; };
384         };
385     }
386 }
387 
388 class FieldEntry
389 {
390     private:
391         ::rtl::OUString msBookmarkName;
392         ::rtl::OUString msMarkType;
393         ::sw::mark::IFieldmark::parameter_map_t maParams;
394 
395     public:
396         sw::hack::Position maStartPos;
397         sal_uInt16 mnFieldId;
398         FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw();
399         FieldEntry(const FieldEntry &rOther) throw();
400         FieldEntry &operator=(const FieldEntry &rOther) throw();
401         void Swap(FieldEntry &rOther) throw();
402 
403         SwNodeIndex GetPtNode() { return maStartPos.GetPtNode(); };
404         xub_StrLen GetPtCntnt() { return maStartPos.GetPtCntnt(); };
405 
406         ::rtl::OUString GetBookmarkName();
407         ::rtl::OUString GetBookmarkType();
408         void SetBookmarkName(::rtl::OUString bookmarkName);
409         void SetBookmarkType(::rtl::OUString bookmarkType);
410         ::sw::mark::IFieldmark::parameter_map_t& getParameters();
411 };
412 
413 
414 //-----------------------------------------
415 //    Mini-Merker fuer einige Flags
416 //-----------------------------------------
417 class WW8ReaderSave
418 {
419 private:
420     WW8PLCFxSaveAll maPLCFxSave;
421     SwPosition maTmpPos;
422     std::deque<bool> maOldApos;
423     std::deque<FieldEntry> maOldFieldStack;
424     SwWW8FltControlStack* mpOldStck;
425     SwWW8FltAnchorStack* mpOldAnchorStck;
426     sw::util::RedlineStack *mpOldRedlines;
427     WW8PLCFMan* mpOldPlcxMan;
428     WW8FlyPara* mpWFlyPara;
429     WW8SwFlyPara* mpSFlyPara;
430     SwPaM* mpPreviousNumPaM;
431     const SwNumRule* mpPrevNumRule;
432     WW8TabDesc* mpTableDesc;
433     int mnInTable;
434     sal_uInt16 mnAktColl;
435     sal_Unicode mcSymbol;
436     bool mbIgnoreText;
437     bool mbSymbol;
438     bool mbHdFtFtnEdn;
439     bool mbTxbxFlySection;
440     bool mbAnl;
441     bool mbInHyperlink;
442     bool mbPgSecBreak;
443     bool mbWasParaEnd;
444     bool mbHasBorder;
445     bool mbFirstPara;
446 public:
447     WW8ReaderSave(SwWW8ImplReader* pRdr, WW8_CP nStart=-1);
448     void Restore(SwWW8ImplReader* pRdr);
449     const SwPosition &GetStartPos() const { return maTmpPos; }
450 };
451 
452 enum eF_ResT{ FLD_OK, FLD_TEXT, FLD_TAGIGN, FLD_TAGTXT, FLD_READ_FSPA };
453 
454 class SwWW8Shade
455 {
456 public:
457     Color aColor;
458     SwWW8Shade(bool bVer67, const WW8_SHD& rSHD);
459     SwWW8Shade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex)
460     {
461         SetShade(nFore, nBack, nIndex);
462     }
463 private:
464     void SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex);
465 };
466 
467 
468 //-----------------------------------------
469 //    Formulas
470 //-----------------------------------------
471 enum SwWw8ControlType
472 {
473     WW8_CT_EDIT,
474     WW8_CT_CHECKBOX,
475     WW8_CT_DROPDOWN
476 };
477 
478 
479 class WW8FormulaControl : public OCX_Control
480 {
481 protected:
482     SwWW8ImplReader &rRdr;
483 public:
484     WW8FormulaControl(const String& rN, SwWW8ImplReader &rR)
485         : OCX_Control(rN), rRdr(rR), fUnknown(0), fDropdownIndex(0),
486         fToolTip(0), fNoMark(0), fUseSize(0), fNumbersOnly(0), fDateOnly(0),
487         fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0)
488     {
489     }
490     sal_uInt8 fUnknown:2;
491     sal_uInt8 fDropdownIndex:6;
492     sal_uInt8 fToolTip:1;
493     sal_uInt8 fNoMark:1;
494     sal_uInt8 fUseSize:1;
495     sal_uInt8 fNumbersOnly:1;
496     sal_uInt8 fDateOnly:1;
497     sal_uInt8 fUnused:3;
498     sal_uInt16 nSize;
499 
500     sal_uInt16 hpsCheckBox;
501     sal_uInt16 nChecked;
502     sal_uInt16 nDefaultChecked;
503 
504     String sTitle;
505     String sDefault;
506     String sFormatting;
507     String sHelp;
508     String sToolTip;
509     std::vector<String> maListEntries;
510     virtual ~WW8FormulaControl() {}
511     void FormulaRead(SwWw8ControlType nWhich,SvStream *pD);
512 private:
513     //No copying
514     WW8FormulaControl(const WW8FormulaControl&);
515     WW8FormulaControl& operator=(const WW8FormulaControl&);
516 };
517 
518 class WW8FormulaCheckBox : public WW8FormulaControl
519 {
520 private:
521     //No copying
522     WW8FormulaCheckBox(const WW8FormulaCheckBox&);
523     WW8FormulaCheckBox& operator=(const WW8FormulaCheckBox&);
524 
525     using OCX_Control::Import;
526 
527 public:
528     WW8FormulaCheckBox(SwWW8ImplReader &rR);
529 
530     virtual sal_Bool Import(const com::sun::star::uno::Reference <
531         com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
532         com::sun::star::uno::Reference <
533         com::sun::star::form::XFormComponent> &rFComp,
534         com::sun::star::awt::Size &rSz);
535 };
536 
537 class WW8FormulaListBox : public WW8FormulaControl
538 {
539 private:
540     //No copying
541     WW8FormulaListBox(const WW8FormulaListBox&);
542     WW8FormulaListBox& operator=(const WW8FormulaListBox&);
543 
544     using OCX_Control::Import;
545 
546 public:
547     WW8FormulaListBox(SwWW8ImplReader &rR);
548 
549     virtual sal_Bool Import(const com::sun::star::uno::Reference <
550         com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
551         com::sun::star::uno::Reference <
552         com::sun::star::form::XFormComponent> &rFComp,
553         com::sun::star::awt::Size &rSz);
554 };
555 
556 class WW8FormulaEditBox : public WW8FormulaControl
557 {
558 private:
559     //No copying
560     WW8FormulaEditBox(const WW8FormulaEditBox&);
561     WW8FormulaEditBox& operator=(const WW8FormulaEditBox&);
562 public:
563     WW8FormulaEditBox(SwWW8ImplReader &rR);
564 #if 0
565     //#i3029# we are no longer importing editboxes as uno textboxes, using
566     //input fields instead for superior layout.
567     virtual sal_Bool Import(const com::sun::star::uno::Reference <
568         com::sun::star::lang::XMultiServiceFactory> &rServiceFactory,
569         com::sun::star::uno::Reference <
570         com::sun::star::form::XFormComponent> &rFComp,
571         com::sun::star::awt::Size &rSz);
572 #endif
573 };
574 
575 class SwMSConvertControls: public SvxMSConvertOCXControls
576 {
577 public:
578     SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) :
579         SvxMSConvertOCXControls( pDSh,pP ) {}
580     virtual sal_Bool InsertFormula( WW8FormulaControl &rFormula);
581     virtual sal_Bool InsertControl(const com::sun::star::uno::Reference<
582         com::sun::star::form::XFormComponent >& rFComp,
583         const ::com::sun::star::awt::Size& rSize,
584         com::sun::star::uno::Reference <
585         com::sun::star::drawing::XShape > *pShape,sal_Bool bFloatingCtrl);
586     bool ExportControl(WW8Export &rWrt, const SdrObject *pObj);
587 };
588 
589 class SwMSDffManager : public SvxMSDffManager
590 {
591 private:
592     SwWW8ImplReader& rReader;
593     SvStream *pFallbackStream;
594     List *pOldEscherBlipCache;
595 
596     virtual sal_Bool GetOLEStorageName( long nOLEId, String& rStorageName,
597         SvStorageRef& rSrcStorage, com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rDestStorage ) const;
598     virtual sal_Bool ShapeHasText( sal_uLong nShapeId, sal_uLong nFilePos ) const;
599     // --> OD 2004-12-14 #i32596# - new parameter <_nCalledByGroup>, which
600     // indicates, if the OLE object is imported inside a group object
601     virtual SdrObject* ImportOLE( long nOLEId,
602                                   const Graphic& rGrf,
603                                   const Rectangle& rBoundRect,
604 								  const Rectangle& rVisArea,
605                                   const int _nCalledByGroup,
606                                   sal_Int64 nAspect ) const;
607     // <--
608 
609     //No copying
610     SwMSDffManager(const SwMSDffManager&);
611     SwMSDffManager& operator=(const SwMSDffManager&);
612 public:
613     static sal_uInt32 GetFilterFlags();
614     static sal_Int32 GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType,
615         sal_Int32 &rThick);
616     SwMSDffManager( SwWW8ImplReader& rRdr );
617     void DisableFallbackStream();
618     void EnableFallbackStream();
619 protected:
620     virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pObj );
621 };
622 
623 
624 class wwSection
625 {
626 public:
627     wwSection(const SwPosition &rPos);
628     SEPr maSep;
629     WW8_BRC brc[4];
630     SwNodeIndex maStart;
631     SwSection *mpSection;
632     SwPageDesc *mpTitlePage;
633     SwPageDesc *mpPage;
634     SvxFrameDirection meDir;
635     short mLinkId;
636 
637     sal_uInt32 nPgWidth;
638     sal_uInt32 nPgLeft;
639     sal_uInt32 nPgRight;
640 
641     sal_uInt8 mnBorders;
642     bool mbHasFootnote;
643     void SetDirection();
644     void SetLinkId(short sLinkId) { mLinkId = sLinkId; }
645     bool DoesContainFootnote() const { return mbHasFootnote; }
646     bool IsContinous() const { return maSep.bkc == 0; }
647     bool IsLinked() const { return mLinkId != 0; }
648     bool IsNotProtected() const { return maSep.fUnlocked != 0; }
649     bool IsVertical() const;
650     sal_Int16 NoCols() const { return maSep.ccolM1 + 1; }
651     sal_Int32 StandardColSeperation() const { return maSep.dxaColumns; }
652     bool HasTitlePage() const { return maSep.fTitlePage ? true : false; }
653     sal_uInt16 PageStartAt() const { return maSep.pgnStart; }
654     bool PageRestartNo() const { return maSep.fPgnRestart ? true : false; }
655     bool IsBiDi() const { return maSep.fBiDi ? true : false; }
656     sal_uInt32 GetPageWidth() const { return nPgWidth; }
657     sal_uInt32 GetTextAreaWidth() const
658         { return GetPageWidth() - GetPageLeft() - GetPageRight(); }
659     sal_uInt32 GetPageHeight() const { return maSep.yaPage; }
660     sal_uInt32 GetPageLeft() const { return nPgLeft; }
661     sal_uInt32 GetPageRight() const { return nPgRight; }
662     bool IsLandScape() const { return maSep.dmOrientPage ? true : false; }
663     bool IsFixedHeightHeader() const { return maSep.dyaTop < 0; }
664     bool IsFixedHeightFooter() const { return maSep.dyaBottom < 0; }
665 };
666 
667 class wwSectionManager
668 {
669 private:
670     /*
671     A queue of the ms sections in the document
672     */
673     SwWW8ImplReader& mrReader;
674     std::deque<wwSection> maSegments;
675     typedef ::std::deque<wwSection>::iterator mySegIter;
676     typedef ::std::deque<wwSection>::reverse_iterator mySegrIter;
677 
678     //Num of page desc's entered into the document
679     sal_uInt16 mnDesc;
680 
681     struct wwULSpaceData
682     {
683         bool bHasHeader, bHasFooter;
684         sal_uInt32 nSwHLo, nSwFUp, nSwUp,  nSwLo;
685         wwULSpaceData() : bHasHeader(false), bHasFooter(false) {}
686     };
687 
688     void SetSegmentToPageDesc(const wwSection &rSection, bool bTitlePage,
689         bool bIgnoreCols);
690 
691     void GetPageULData(const wwSection &rNewSection, bool bFirst,
692         wwULSpaceData& rData) const;
693     void SetPageULSpaceItems(SwFrmFmt &rFmt, wwULSpaceData& rData,
694         const wwSection &rSection) const;
695 
696     void SetPage(SwPageDesc &rPageDesc, SwFrmFmt &rFmt,
697         const wwSection &rSection, bool bIgnoreCols) const;
698 
699     void SetNumberingType(const wwSection &rNewSection, SwPageDesc &rPageDesc)
700         const;
701 
702     void SetUseOn(wwSection &rSection);
703     void SetHdFt(wwSection &rSection, int nSect, const wwSection *pPrevious);
704 
705     SwSectionFmt *InsertSection(SwPaM& rMyPaM, wwSection &rSection);
706     bool SetCols(SwFrmFmt &rFmt, const wwSection &rSection,
707         sal_uInt32 nNettoWidth) const;
708     bool SectionIsProtected(const wwSection &rSection) const;
709     void SetLeftRight(wwSection &rSection);
710     bool IsNewDoc() const;
711     /*
712      The segment we're inserting, the start of the segments container, and the
713      nodeindex of where we want the page break to (normally the segments start
714      position
715     */
716     SwFmtPageDesc SetSwFmtPageDesc(mySegIter &rIter, mySegIter &rStart,
717         bool bIgnoreCols);
718 
719     //No copying
720     wwSectionManager(const wwSectionManager&);
721     wwSectionManager& operator=(const wwSectionManager&);
722 public:
723     wwSectionManager(SwWW8ImplReader &rReader) : mrReader(rReader), mnDesc(0)
724         {};
725     void SetCurrentSectionHasFootnote();
726     bool CurrentSectionIsVertical() const;
727     bool CurrentSectionIsProtected() const;
728     void PrependedInlineNode(const SwPosition &rPos, const SwNode &rNode);
729     sal_uInt16 CurrentSectionColCount() const;
730     bool WillHavePageDescHere(SwNodeIndex aIdx) const;
731     void CreateSep(const long nTxtPos, bool bMustHaveBreak);
732     void InsertSegments();
733     void JoinNode(const SwPosition &rPos, const SwNode &rNode);
734     sal_uInt32 GetPageLeft() const;
735     sal_uInt32 GetPageRight() const;
736     sal_uInt32 GetPageWidth() const;
737     // --> OD 2007-07-03 #148498#
738     sal_uInt32 GetWWPageTopMargin() const;
739     // <--
740     bool empty() const { return maSegments.empty(); }
741     sal_uInt32 GetTextAreaWidth() const;
742 };
743 
744 class wwFrameNamer
745 {
746 private:
747     String msSeed;
748     int mnImportedGraphicsCount;
749     bool mbIsDisabled;
750     //No copying
751     wwFrameNamer(const wwFrameNamer&);
752     wwFrameNamer& operator=(const wwFrameNamer&);
753 public:
754     void SetUniqueGraphName(SwFrmFmt *pFrmFmt,const String &rFixedPart);
755     wwFrameNamer(bool bIsDisabled, const String &rSeed)
756         : msSeed(rSeed), mnImportedGraphicsCount(0), mbIsDisabled(bIsDisabled)
757         { }
758 };
759 
760 class wwSectionNamer
761 {
762 private:
763     const SwDoc &mrDoc;
764     String msFileLinkSeed;
765     int mnFileSectionNo;
766     //No copying
767     wwSectionNamer(const wwSectionNamer&);
768     wwSectionNamer& operator=(const wwSectionNamer&);
769 public:
770     String UniqueName();
771     wwSectionNamer(const SwDoc &rDoc, const String &rSeed)
772         : mrDoc(rDoc), msFileLinkSeed(rSeed), mnFileSectionNo(0)
773         { }
774 };
775 
776 class FtnDescriptor
777 {
778 public:
779     ManTypes meType;
780     bool mbAutoNum;
781     WW8_CP mnStartCp;
782     WW8_CP mnLen;
783 };
784 
785 struct ApoTestResults
786 {
787     bool mbStartApo;
788     bool mbStopApo;
789     const sal_uInt8* mpSprm37;
790     const sal_uInt8* mpSprm29;
791     WW8FlyPara* mpStyleApo;
792     ApoTestResults() :
793         mbStartApo(false), mbStopApo(false), mpSprm37(0), mpSprm29(0),
794         mpStyleApo(0) {}
795     bool HasStartStop() const { return (mbStartApo || mbStopApo); }
796     bool HasFrame() const { return (mpSprm29 || mpSprm37 || mpStyleApo); }
797 };
798 
799 struct ANLDRuleMap
800 {
801     SwNumRule* mpOutlineNumRule;    // WinWord 6 numbering, varient 1
802     SwNumRule* mpNumberingNumRule;  // WinWord 6 numbering, varient 2
803     SwNumRule* GetNumRule(sal_uInt8 nNumType);
804     void SetNumRule(SwNumRule*, sal_uInt8 nNumType);
805     ANLDRuleMap() : mpOutlineNumRule(0), mpNumberingNumRule(0) {}
806 };
807 
808 struct SprmReadInfo;
809 class SwDocShell;
810 struct WW8PostProcessAttrsInfo
811 {
812     bool mbCopy;
813     WW8_CP mnCpStart;
814     WW8_CP mnCpEnd;
815     SwPaM mPaM;
816     SfxItemSet mItemSet;
817 
818     WW8PostProcessAttrsInfo(WW8_CP nCpStart, WW8_CP nCpEnd, SwPaM & rPaM);
819 };
820 
821 //-----------------------------------------
822 //            Storage-Reader
823 //-----------------------------------------
824 typedef std::set<WW8_CP> cp_set;
825 
826 typedef std::vector<WW8_CP> cp_vector;
827 
828 class SwWW8ImplReader
829 {
830 private:
831     SwDocShell *mpDocShell;         // The Real DocShell
832 
833 friend class WW8RStyle;
834 friend class WW8TabDesc;
835 friend class WW8ReaderSave;
836 friend struct WW8FlyPara;
837 friend struct WW8SwFlyPara;
838 friend class WW8FlySet;
839 friend class SwMSDffManager;
840 friend class SwWW8FltControlStack;
841 friend class WW8FormulaControl;
842 friend class wwSectionManager;
843 
844 public:
845     /*
846     To log unimplemented features
847     */
848     sw::log::Tracer maTracer;
849 private:
850 
851     SvStorage* pStg;                // Input-Storage
852     SvStream* pStrm;                // Input-(Storage)Stream
853     SvStream* pTableStream;         // Input-(Storage)Stream
854     SvStream* pDataStream;          // Input-(Storage)Stream
855 
856 // allgemeines
857     SwDoc& rDoc;
858     SwPaM* pPaM;
859 
860     SwWW8FltControlStack* pCtrlStck;    // Stack fuer die Attribute
861 
862     /*
863     This stack is for redlines, because their sequence of discovery can
864     be out of order of their order of insertion into the document.
865     */
866     sw::util::RedlineStack *mpRedlineStack;
867 
868     /*
869     This stack is for fields that get referenced later, e.g. BookMarks and TOX.
870     They get inserted at the end of the document, it is the same stack for
871     headers/footers/main text/textboxes/tables etc...
872     */
873     SwWW8ReferencedFltEndStack *pReffedStck;
874 
875     /*
876     This stack is for fields whose true conversion cannot be determined until
877     the end of the document, it is the same stack for headers/footers/main
878     text/textboxes/tables etc... They are things that reference other things
879     e.g. NoteRef and Ref, they are processed after pReffedStck
880     */
881     SwWW8FltRefStack *pReffingStck;
882 
883     /*
884     For graphics anchors. Determines the graphics whose anchors are in the
885     current paragraph, and works around the difficulty in inserting a graphic
886     anchored to character before a character to be anchored to has been
887     inserted. Is emptied at the end of each paragraph.
888     */
889     SwWW8FltAnchorStack* pAnchorStck;
890 
891     /*
892     A stack of fields identifiers to keep track of any open fields that need
893     to be closed. Generally word fields are inserted as writer fields as soon
894     as they are encountered, and so their end point is normally unimportant.
895     But hyperlink fields need to be applied as attributes to text and it is
896     far easier and safer to set the end point of an attribute when we
897     encounter the end marker of the field instead of caculating in advance
898     where the end point will fall, to do so fully correctly duplicates the
899     main logic of the filter itself.
900     */
901     std::deque<FieldEntry> maFieldStack;
902     typedef std::deque<FieldEntry>::const_iterator mycFieldIter;
903 
904     /*
905     A stack of open footnotes. Should only be one in it at any time.
906     */
907     std::deque<FtnDescriptor> maFtnStack;
908 
909     /*
910     A queue of the ms sections in the document
911     */
912     wwSectionManager maSectionManager;
913 
914     /*
915     A map of of tables to their follow nodes for use in inserting tables into
916     already existing document, i.e. insert file
917     */
918     sw::util::InsertedTablesManager maInsertedTables;
919 
920     /*
921     Creates unique names to give to (file link) sections (WW1/WW2/...)
922     */
923     wwSectionNamer maSectionNameGenerator;
924 
925     /*
926     Knows how to split a series of bytes into sprms and their arguments
927     */
928     wwSprmParser *mpSprmParser;
929 
930     /*
931     Creates unique names to give to graphics
932     */
933     wwFrameNamer maGrfNameGenerator;
934 
935     /*
936     Knows which writer style a given word style should be imported as.
937     */
938     sw::util::ParaStyleMapper maParaStyleMapper;
939     sw::util::CharStyleMapper maCharStyleMapper;
940 
941     /*
942      Stack of textencoding being used as we progress through the document text
943     */
944     std::stack<rtl_TextEncoding> maFontSrcCharSets;
945     std::stack<rtl_TextEncoding> maFontSrcCJKCharSets;
946 
947     /*
948      Winword numbering gets imported as SwNumRules, there is a problem that
949      winword can have multiple outline numberings, only one gets chosen as
950      the writer outline numbering rule. The one that gets chosen is set here
951      as mpChosenOutlineNumRule
952     */
953     SwNumRule *mpChosenOutlineNumRule;
954 
955     SwMSConvertControls *pFormImpl; // Control-Implementierung
956 
957     SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic;
958     SwFrmFmt* pFmtOfJustInsertedApo;
959     SwPaM* pPreviousNumPaM;
960     const SwNumRule* pPrevNumRule;
961 
962     //Keep track of APO environments
963     std::deque<bool> maApos;
964     typedef std::deque<bool>::const_iterator mycApoIter;
965     /*
966     Keep track of generated Ruby character formats we we can minimize the
967     number of character formats created
968     */
969     std::vector<const SwCharFmt*> aRubyCharFmts;
970 
971     WW8PostProcessAttrsInfo * mpPostProcessAttrsInfo;
972 
973     WW8Fib* pWwFib;
974     WW8Fonts* pFonts;
975     WW8Dop* pWDop;
976     WW8ListManager* pLstManager;
977     WW8ScannerBase* pSBase;
978     WW8PLCFMan* pPlcxMan;
979     std::map<short, String> aLinkStringMap;
980 
981     // --> OD 2010-05-06 #i103711#
982     std::set<const SwNode*> maTxtNodesHavingFirstLineOfstSet;
983     // <--
984     // --> OD 2010-05-11 #i105414#
985     std::set<const SwNode*> maTxtNodesHavingLeftIndentSet;
986     // <--
987 
988     WW8RStyle* pStyles;     // Pointer auf die Style-Einleseklasse
989     SwFmt* pAktColl;        // gerade zu erzeugende Collection
990                             // ( ist ausserhalb einer Style-Def immer 0 )
991     SfxItemSet* pAktItemSet;// gerade einzulesende Zeichenattribute
992                             // (ausserhalb des WW8ListManager Ctor's immer 0)
993     SwWW8StyInf* pCollA;    // UEbersetzungs-Array der Styles
994     const SwTxtFmtColl* pDfltTxtFmtColl;    // Default
995     SwFmt* pStandardFmtColl;// "Standard"
996 
997     WW8PLCF_HdFt* pHdFt;        // Pointer auf Header / Footer - Scannerklasse
998 
999     WW8FlyPara* pWFlyPara;      // WW-Parameter
1000     WW8SwFlyPara* pSFlyPara;    // daraus erzeugte Sw-Parameter
1001 
1002     WW8TabDesc* pTableDesc;     // Beschreibung der Tabelleneigenschaften
1003     //Keep track of tables within tables
1004     std::stack<WW8TabDesc*> maTableStack;
1005 
1006     ANLDRuleMap maANLDRules;
1007     WW8_OLST* pNumOlst;         // Gliederung im Text
1008 
1009     SwNode* pNode_FLY_AT_PARA; // set: WW8SwFlyPara()   read: CreateSwTable()
1010 
1011     SdrModel* pDrawModel;
1012     SdrPage* pDrawPg;
1013     EditEngine* mpDrawEditEngine;
1014     wwZOrderer *pWWZOrder;
1015 
1016     SwFieldType* pNumFldType;   // fuer Nummernkreis
1017 
1018     SwMSDffManager* pMSDffManager;
1019 
1020     std::vector<String>* mpAtnNames;
1021 
1022     sw::util::AuthorInfos* pAuthorInfos;
1023     String sBaseURL;
1024 
1025                                 // Ini-Flags:
1026     sal_uLong nIniFlags;            // Flags aus der writer.ini
1027     sal_uLong nIniFlags1;           // dito ( zusaetzliche Flags )
1028     sal_uLong nFieldFlags;          // dito fuer Feldern
1029     sal_uLong nFieldTagAlways[3];   // dito fuers Taggen von Feldern
1030     sal_uLong nFieldTagBad[3];      // dito fuers Taggen von nicht importierbaren F.
1031     bool m_bRegardHindiDigits;  // import digits in CTL scripts as Hindi numbers
1032 
1033     WW8_CP nDrawCpO;            // Anfang der Txbx-SubDocs
1034 
1035     sal_uLong nPicLocFc;            // Picture Location in File (FC)
1036     sal_uLong nObjLocFc;            // Object Location in File (FC)
1037 
1038     sal_Int32 nIniFlyDx;            // X-Verschiebung von Flys
1039     sal_Int32 nIniFlyDy;            // Y-Verschiebung von Flys
1040 
1041     rtl_TextEncoding eTextCharSet;    // Default charset for Text
1042     rtl_TextEncoding eStructCharSet;  // rtl_TextEncoding for structures
1043     rtl_TextEncoding eHardCharSet;    // Hard rtl_TextEncoding-Attribute
1044     sal_uInt16 nProgress;           // %-Angabe fuer Progressbar
1045     sal_uInt16 nColls;              // Groesse des Arrays
1046     sal_uInt16 nAktColl;            // gemaess WW-Zaehlung
1047     sal_uInt16 nFldNum;             // laufende Nummer dafuer
1048     sal_uInt16 nLFOPosition;
1049 
1050     short nCharFmt;             // gemaess WW-Zaehlung, <0 fuer keine
1051 
1052     short nDrawXOfs, nDrawYOfs;
1053     short nDrawXOfs2, nDrawYOfs2;
1054 
1055     sal_Unicode cSymbol;        // aktuell einzulesendes Symbolzeichen
1056 
1057 
1058     sal_uInt8 nWantedVersion;        // urspruenglich vom Writer
1059                                 // angeforderte WW-Doc-Version
1060 
1061 
1062     sal_uInt8 nSwNumLevel;           // LevelNummer fuer Outline / Nummerierung
1063     sal_uInt8 nWwNumType;            // Gliederung / Nummerg / Aufzaehlg
1064     sal_uInt8 nListLevel;
1065 
1066     sal_uInt8 nPgChpDelim;           // ChapterDelim from PageNum
1067     sal_uInt8 nPgChpLevel;           // ChapterLevel of Heading from PageNum
1068 
1069     bool mbNewDoc;          // Neues Dokument ?
1070     bool bReadNoTbl;        // Keine Tabellen
1071     bool bPgSecBreak;       // Page- oder Sectionbreak ist noch einzufuegen
1072     bool bSpec;             // Special-Char im Text folgt
1073     bool bObj;              // Obj im Text
1074     bool bTxbxFlySection;   // FlyFrame, der als Ersatz fuer Winword Textbox eingefuegt wurde
1075     bool bHasBorder;        // fuer Buendelung der Border
1076     bool bSymbol;           // z.B. Symbol statt Times
1077     bool bIgnoreText;       // z.B. fuer FieldVanish
1078     int  nInTable;          // wird gerade eine Tabelle eingelesen
1079     bool bWasTabRowEnd;     // Tabelle : Row End Mark
1080     bool bWasTabCellEnd;    // table: Cell End Mark
1081 
1082     bool bShdTxtCol;        // Textfarbe indirekt gesetzt ( Hintergrund sw )
1083     bool bCharShdTxtCol;    // Textfarbe indirekt gesetzt ( Zeichenhintergrund sw )
1084     bool bAnl;              // Nummerierung in Bearbeitung
1085                                 // Anl heisst Autonumber level
1086 
1087     bool bHdFtFtnEdn;       // Spezialtext: Kopf- Fuss- usw.
1088     bool bFtnEdn;           // Fussnote oder Endnote
1089     bool bIsHeader;         // Text aus Header wird gelesen ( Zeilenhoehe )
1090     bool bIsFooter;         // Text aus Footer wird gelesen ( Zeilenhoehe )
1091 
1092     bool bIsUnicode;            // aktuelles Text-Stueck ist als 2-Bytiger-Unicode kodiert
1093                                 // bitte NICHT als Bitfeld kodieren!
1094 
1095     bool bCpxStyle;         // Style im Complex Part
1096     bool bStyNormal;        // Style mit Id 0 wird gelesen
1097     bool bWWBugNormal;      // WW-Version nit Bug Dya in Style Normal
1098     bool bNoAttrImport;     // Attribute ignorieren zum Ignorieren v. Styles
1099     bool bInHyperlink;      // Sonderfall zum einlesen eines 0x01
1100                                    // siehe: SwWW8ImplReader::Read_F_Hyperlink()
1101     bool bWasParaEnd;
1102 
1103     // praktische Hilfsvariablen:
1104     bool bVer67;            // ( (6 == nVersion) || (7 == nVersion) );
1105     bool bVer6;             //   (6 == nVersion);
1106     bool bVer7;             //   (7 == nVersion);
1107     bool bVer8;             //   (8 == nVersion);
1108 
1109     bool bPgChpLevel;       // ChapterLevel of Heading from PageNum
1110     bool bEmbeddObj;        // EmbeddField gelesen
1111 
1112     bool bAktAND_fNumberAcross; // current active Annotated List Deskriptor - ROW flag
1113 
1114     bool bNoLnNumYet;       // no Line Numbering has been activated yet (we import
1115                             //     the very 1st Line Numbering and ignore the rest)
1116 
1117     bool bFirstPara;        // first paragraph?
1118     bool bFirstParaOfPage;//cs2c--xushanchuan add for bug11210
1119     bool bParaAutoBefore;
1120     bool bParaAutoAfter;
1121 
1122     bool bDropCap;
1123     int nDropCap;
1124 
1125     int nIdctHint;
1126     bool bBidi;
1127     bool bReadTable;
1128     boost::shared_ptr<SwPaM> mpTableEndPaM;
1129     WW8PLCFx_Cp_FKP* pFirstTablePap;
1130 
1131     // Indicate that currently on loading a TOC, managed by Read_F_TOX() and End_Field()
1132     bool mbLoadingTOCCache;
1133     // Indicate that current on loading a hyperlink, which is inside a TOC; Managed by Read_F_Hyperlink() and End_Field()
1134     bool mbLoadingTOCHyperlink;
1135     // a document position recorded the after-position of TOC section, managed by Read_F_TOX() and End_Field()
1136     SwPaM* mpPosAfterTOC;
1137 
1138     bool mbCareFirstParaEndInToc;
1139     bool mbCareLastParaEndInToc;
1140     cp_set maTOXEndCps;
1141 
1142     cp_vector maEndParaPos;
1143     WW8_CP maCurrAttrCP;
1144     bool mbOnLoadingMain:1;
1145 //---------------------------------------------
1146 
1147     const SprmReadInfo& GetSprmReadInfo(sal_uInt16 nId) const;
1148 
1149     bool StyleExists(int nColl) const { return (nColl < nColls); }
1150     SwWW8StyInf *GetStyle(sal_uInt16 nColl) const;
1151     void AppendTxtNode(SwPosition& rPos);
1152 
1153     void Read_HdFt(bool bIsTitle, int nSect, const SwPageDesc *pPrev,
1154         const wwSection &rSection);
1155     void Read_HdFtText(long nStartCp, long nLen, SwFrmFmt* pHdFtFmt);
1156     void Read_HdFtTextAsHackedFrame(long nStart, long nLen,
1157         SwFrmFmt &rHdFtFmt, sal_uInt16 nPageWidth);
1158 
1159     bool isValid_HdFt_CP(WW8_CP nHeaderCP) const;
1160 
1161     bool HasOwnHeaderFooter(sal_uInt8 nWhichItems, sal_uInt8 grpfIhdt, int nSect);
1162 
1163     void HandleLineNumbering(const wwSection &rSection);
1164 
1165     void CopyPageDescHdFt( const SwPageDesc* pOrgPageDesc,
1166                            SwPageDesc* pNewPageDesc, sal_uInt8 nCode );
1167 
1168     void DeleteStk(SwFltControlStack* prStck);
1169     void DeleteCtrlStk()    { DeleteStk( pCtrlStck  ); pCtrlStck   = 0; }
1170     void DeleteRefStks()
1171     {
1172         DeleteStk( pReffedStck );
1173         pReffedStck = 0;
1174         DeleteStk( pReffingStck );
1175         pReffingStck = 0;
1176     }
1177     void DeleteAnchorStk()  { DeleteStk( pAnchorStck ); pAnchorStck = 0; }
1178     bool AddTextToParagraph(const String& sAddString);
1179     bool HandlePageBreakChar();
1180     bool ReadChar(long nPosCp, long nCpOfs);
1181     bool ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs);
1182     bool ReadChars(WW8_CP& rPos, WW8_CP nNextAttr, long nTextEnd, long nCpOfs);
1183 	bool LangUsesHindiNumbers(sal_uInt16 nLang);
1184     sal_Unicode TranslateToHindiNumbers(sal_Unicode);
1185 
1186     void SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection);
1187 
1188     void ProcessAktCollChange(WW8PLCFManResult& rRes, bool* pStartAttr,
1189         bool bCallProcessSpecial);
1190     long ReadTextAttr(WW8_CP& rTxtPos, bool& rbStartLine);
1191     void ReadAttrs(WW8_CP& rNext, WW8_CP& rTxtPos, bool& rbStartLine);
1192     void CloseAttrEnds();
1193     bool ReadText(long nStartCp, long nTextLen, ManTypes nType);
1194 
1195     void ReadRevMarkAuthorStrTabl( SvStream& rStrm, sal_Int32 nTblPos,
1196         sal_Int32 nTblSiz, SwDoc& rDoc );
1197 
1198     void Read_HdFtFtnText( const SwNodeIndex* pSttIdx, long nStartCp,
1199                            long nLen, ManTypes nType );
1200 
1201     void ImportTox( int nFldId, String aStr );
1202 
1203     void EndSprm( sal_uInt16 nId );
1204     // --> OD 2010-05-06 #i103711#
1205     // --> OD 2010-05-11 #i105414#
1206     void NewAttr( const SfxPoolItem& rAttr,
1207                   const bool bFirstLineOfStSet = false,
1208                   const bool bLeftIndentSet = false );
1209     // <--
1210 
1211     bool GetFontParams(sal_uInt16, FontFamily&, String&, FontPitch&,
1212         rtl_TextEncoding&);
1213     bool SetNewFontAttr(sal_uInt16 nFCode, bool bSetEnums, sal_uInt16 nWhich);
1214     sal_uInt16 CorrectResIdForCharset(CharSet nCharSet, sal_uInt16 nWhich);
1215     void ResetCharSetVars();
1216     void ResetCJKCharSetVars();
1217 
1218     const SfxPoolItem* GetFmtAttr( sal_uInt16 nWhich );
1219     bool JoinNode(SwPaM &rPam, bool bStealAttr = false);
1220 
1221     bool IsBorder(const WW8_BRC* pbrc, bool bChkBtwn = false) const;
1222 
1223     //Set closest writer border equivalent into rBox from pbrc, optionally
1224     //recording true winword dimensions in pSizeArray. nSetBorders to mark a
1225     //border which has been previously set to a value and for which becoming
1226     //empty is valid. Set bCheBtwn to work with paragraphs that have a special
1227     //between paragraphs border
1228 #if 0
1229     // #i20672# we can't properly support between lines so best to ignore
1230     // them for now
1231     bool SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc, short *pSizeArray=0,
1232         sal_uInt8 nSetBorders=0xFF, bool bChkBtwn = false) const;
1233 #endif
1234     bool SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc, short *pSizeArray=0,
1235         sal_uInt8 nSetBorders=0xFF) const;
1236     void GetBorderDistance(const WW8_BRC* pbrc, Rectangle& rInnerDist) const;
1237     sal_uInt16 GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing);
1238     bool SetShadow(SvxShadowItem& rShadow, const short *pSizeArray,
1239         const WW8_BRC *pbrc) const;
1240     //returns true is a shadow was set
1241     bool SetFlyBordersShadow(SfxItemSet& rFlySet, const WW8_BRC *pbrc,
1242         short *SizeArray=0) const;
1243     void SetPageBorder(SwFrmFmt &rFmt, const wwSection &rSection) const;
1244 
1245     sal_Int32 MatchSdrBoxIntoFlyBoxItem( const Color& rLineColor,
1246         MSO_LineStyle eLineStyle, MSO_SPT eShapeType, sal_Int32 &rLineWidth,
1247         SvxBoxItem& rBox );
1248     void MatchSdrItemsIntoFlySet( SdrObject*    pSdrObj, SfxItemSet &aFlySet,
1249         MSO_LineStyle eLineStyle, MSO_SPT eShapeType, Rectangle &rInnerDist );
1250     void AdjustLRWrapForWordMargins(const SvxMSDffImportRec &rRecord,
1251         SvxLRSpaceItem &rLR);
1252     void AdjustULWrapForWordMargins(const SvxMSDffImportRec &rRecord,
1253         SvxULSpaceItem &rUL);
1254     void MapWrapIntoFlyFmt(SvxMSDffImportRec* pRecord, SwFrmFmt* pFlyFmt);
1255 
1256     void SetAttributesAtGrfNode( SvxMSDffImportRec* pRecord, SwFrmFmt *pFlyFmt,
1257         WW8_FSPA *pF );
1258 
1259     bool IsDropCap();
1260     bool IsListOrDropcap() { return (!pAktItemSet  || bDropCap); };
1261 
1262     WW8FlyPara *ConstructApo(const ApoTestResults &rApo,
1263         const WW8_TablePos *pTabPos);
1264     bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
1265     void StopApo();
1266     bool TestSameApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
1267     ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd, const WW8_TablePos *pTabPos,
1268         bool bReadTablePos = true);
1269 
1270     void EndSpecial();
1271     bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp);
1272     sal_uInt16 TabRowSprm(int nLevel) const;
1273 
1274     bool ReadGrafFile(String& rFileName, Graphic*& rpGraphic,
1275        const WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos, bool* pDelIt);
1276 
1277     void ReplaceObj(const SdrObject &rReplaceTextObj,
1278         SdrObject &rSubObj);
1279 
1280     SwFlyFrmFmt* MakeGrafNotInCntnt(const WW8PicDesc& rPD,
1281         const Graphic* pGraph, const String& rFileName,
1282         const SfxItemSet& rGrfSet);
1283 
1284     SwFrmFmt* MakeGrafInCntnt(const WW8_PIC& rPic, const WW8PicDesc& rPD,
1285         const Graphic* pGraph, const String& rFileName,
1286         const SfxItemSet& rGrfSet);
1287 
1288     SwFrmFmt *AddAutoAnchor(SwFrmFmt *pFmt);
1289     SwFrmFmt* ImportGraf1(WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos);
1290     SwFrmFmt* ImportGraf(SdrTextObj* pTextObj = 0, SwFrmFmt* pFlyFmt = 0);
1291 
1292     SdrObject* ImportOleBase( Graphic& rGraph, const Graphic* pGrf=0,
1293         const SfxItemSet* pFlySet=0, const Rectangle& aVisArea = Rectangle() );
1294 
1295     SwFrmFmt* ImportOle( const Graphic* = 0, const SfxItemSet* pFlySet = 0,
1296         const SfxItemSet* pGrfSet = 0, const Rectangle& aVisArea = Rectangle() );
1297     SwFlyFrmFmt* InsertOle(SdrOle2Obj &rObject, const SfxItemSet &rFlySet,
1298         const SfxItemSet &rGrfSet);
1299 
1300     bool ImportFormulaControl(WW8FormulaControl &rBox,WW8_CP nStart,
1301         SwWw8ControlType nWhich);
1302 
1303     void ImportDop();
1304 
1305     //This converts MS Asian Typography information into OOo's
1306     void ImportDopTypography(const WW8DopTypography &rTypo);
1307 
1308     sal_uLong LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss);
1309     sal_uLong SetSubStreams(SvStorageStreamRef &rTableStream, SvStorageStreamRef &rDataStream);
1310     sal_uLong CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos);
1311 
1312 	void ReadDocVars();
1313 
1314     bool StartTable(WW8_CP nStartCp);
1315     bool InEqualApo(int nLvl) const;
1316     bool InLocalApo() const { return InEqualApo(nInTable); }
1317     bool InEqualOrHigherApo(int nLvl) const;
1318     bool InAnyApo() const { return InEqualOrHigherApo(1); }
1319     void TabCellEnd();
1320     void StopTable();
1321     short GetTableLeft();
1322     bool IsInvalidOrToBeMergedTabCell() const;
1323 
1324 // Nummerierungen / Aufzaehlungen ( Autonumbered List Data Descriptor )
1325 // Liste:        ANLD ( Autonumbered List Data Descriptor )
1326 //   eine Ebene: ANLV ( Autonumber Level Descriptor )
1327 //
1328 // Chg7-8:
1329 // Listen sind in WW8 eigene Strukturen, die ueber folgende drei Tabellen
1330 // verwaltet werden: rglst, hpllfo und hsttbListNames
1331 // die Strukturen hierfuer sind: LSTF, LVLF, LFO LFOLVL
1332 
1333     void SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, const sal_uInt8* pTxt,
1334         bool bOutline);
1335     void SetAnld(SwNumRule* pNumR, WW8_ANLD* pAD, sal_uInt8 nSwLevel, bool bOutLine);
1336     void SetNumOlst( SwNumRule* pNumR, WW8_OLST* pO, sal_uInt8 nSwLevel );
1337     SwNumRule* GetStyRule();
1338 
1339     void StartAnl(const sal_uInt8* pSprm13);
1340     void NextAnlLine(const sal_uInt8* pSprm13);
1341     void StopAllAnl(bool bGoBack = true);
1342     void StopAnlToRestart(sal_uInt8 nType, bool bGoBack = true);
1343 
1344 // GrafikLayer
1345 
1346     bool ReadGrafStart(void* pData, short nDataSiz, WW8_DPHEAD* pHd,
1347         const WW8_DO* pDo, SfxAllItemSet &rSet);
1348     SdrObject *ReadLine(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1349         SfxAllItemSet &rSet);
1350     SdrObject *ReadRect(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1351         SfxAllItemSet &rSet);
1352     SdrObject *ReadElipse(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1353         SfxAllItemSet &rSet);
1354     SdrObject *ReadArc(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1355         SfxAllItemSet &rSet);
1356     SdrObject *ReadPolyLine(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1357         SfxAllItemSet &rSet);
1358     ESelection GetESelection( long nCpStart, long nCpEnd );
1359     void InsertTxbxStyAttrs( SfxItemSet& rS, sal_uInt16 nColl );
1360     void InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp, ManTypes eType, bool bONLYnPicLocFc=false);
1361 
1362     bool GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, sal_uInt16 nTxBxS,
1363         sal_uInt16 nSequence);
1364     bool GetRangeAsDrawingString(String& rString, long StartCp, long nEndCp, ManTypes eType);
1365     OutlinerParaObject* ImportAsOutliner(String &rString, WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType);
1366     SwFrmFmt* InsertTxbxText(SdrTextObj* pTextObj, Size* pObjSiz,
1367         sal_uInt16 nTxBxS, sal_uInt16 nSequence, long nPosCp, SwFrmFmt* pFlyFmt,
1368         bool bMakeSdrGrafObj, bool& rbEraseTextObj,
1369         bool* pbTestTxbxContainsText = 0, long* pnStartCp = 0,
1370         long* pnEndCp = 0, bool* pbContainsGraphics = 0,
1371         SvxMSDffImportRec* pRecord = 0);
1372     bool TxbxChainContainsRealText( sal_uInt16 nTxBxS,
1373                                     long&  rStartCp,
1374                                     long&  rEndCp );
1375     SdrObject *ReadTxtBox(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1376         SfxAllItemSet &rSet);
1377     SdrObject *ReadCaptionBox(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1378         SfxAllItemSet &rSet);
1379     SdrObject *ReadGroup(WW8_DPHEAD* pHd, const WW8_DO* pDo,
1380         SfxAllItemSet &rSet);
1381     SdrObject *ReadGrafPrimitive(short& rLeft, const WW8_DO* pDo,
1382         SfxAllItemSet &rSet);
1383     void ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp );
1384     SdrObject* CreateContactObject(SwFrmFmt* pFlyFmt);
1385     RndStdIds ProcessEscherAlign(SvxMSDffImportRec* pRecord, WW8_FSPA *pFSPA,
1386         SfxItemSet &rFlySet, bool bOrgObjectWasReplace);
1387     bool MiserableRTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth,
1388         sal_Int16 eHoriOri, sal_Int16 eHoriRel);
1389     SwFrmFmt* Read_GrafLayer( long nGrafAnchorCp );
1390     SwFlyFrmFmt* ImportReplaceableDrawables( SdrObject* &rpObject,
1391         SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord, WW8_FSPA *pF,
1392         SfxItemSet &rFlySet );
1393     SwFlyFrmFmt *ConvertDrawTextToFly( SdrObject* &rpObject,
1394         SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord,
1395         RndStdIds eAnchor, WW8_FSPA *pF, SfxItemSet &rFlySet );
1396     SwFrmFmt* MungeTextIntoDrawBox(SdrObject* pTrueObject,
1397         SvxMSDffImportRec *pRecord, long nGrafAnchorCp, SwFrmFmt *pRetFrmFmt);
1398 
1399     void GrafikCtor();
1400     void GrafikDtor();
1401 
1402 // anderes
1403     String GetFieldResult( WW8FieldDesc* pF );
1404     void MakeTagString( String& rStr, const String& rOrg );
1405     void UpdateFields();
1406     void ConvertFFileName( String& rName, const String& rRaw );
1407     long Read_F_Tag( WW8FieldDesc* pF );
1408     void InsertTagField( const sal_uInt16 nId, const String& rTagText );
1409     long ImportExtSprm(WW8PLCFManResult* pRes);
1410     void EndExtSprm(sal_uInt16 nSprmId);
1411     void ReadDocInfo();
1412 
1413 // Ver8-Listen
1414 
1415     void RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO, sal_uInt8 nActLevel,
1416         bool bSetAttr = true);
1417     void RegisterNumFmtOnStyle(sal_uInt16 nStyle);
1418     void SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
1419         sal_uInt8 nActLevel);
1420     void RegisterNumFmt(sal_uInt16 nActLFO, sal_uInt8 nActLevel);
1421 
1422 // spaeter zu ersetzen durch Aufruf in entsprechend erweiterten SvxMSDffManager
1423 
1424     const String* GetAnnotationAuthor(sal_uInt16 nIdx);
1425 
1426     // Schnittstellen fuer die Toggle-Attribute
1427     void SetToggleAttr(sal_uInt8 nAttrId, bool bOn);
1428     void SetToggleBiDiAttr(sal_uInt8 nAttrId, bool bOn);
1429     void _ChkToggleAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask );
1430 
1431     void ChkToggleAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask )
1432     {
1433         if( nOldStyle81Mask != nNewStyle81Mask &&
1434             pCtrlStck->GetToggleAttrFlags() )
1435             _ChkToggleAttr( nOldStyle81Mask, nNewStyle81Mask );
1436     }
1437 
1438     void _ChkToggleBiDiAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask );
1439 
1440     void ChkToggleBiDiAttr( sal_uInt16 nOldStyle81Mask, sal_uInt16 nNewStyle81Mask )
1441     {
1442         if( nOldStyle81Mask != nNewStyle81Mask &&
1443             pCtrlStck->GetToggleBiDiAttrFlags() )
1444             _ChkToggleBiDiAttr( nOldStyle81Mask, nNewStyle81Mask );
1445     }
1446 
1447     void PopTableDesc();
1448     void MoveInsideFly(const SwFrmFmt *pFlyFmt);
1449     SwTwips MoveOutsideFly(SwFrmFmt *pFlyFmt, const SwPosition &rPos,
1450         bool bTableJoin = true);
1451 
1452     void SetOutLineStyles();
1453 
1454     bool SetSpacing(SwPaM &rMyPam, int nSpace, bool bIsUpper);
1455     bool SetUpperSpacing(SwPaM &pMyPam, int nSpace);
1456     bool SetLowerSpacing(SwPaM &rMyPam, int nSpace);
1457 
1458     bool IsInlineEscherHack() const
1459         {return !maFieldStack.empty() ? maFieldStack.back().mnFieldId == 95 : false; };
1460 
1461     void StoreMacroCmds();
1462 
1463     // --> OD 2008-04-10 #i84783#
1464     // determine object attribute "Layout in Table Cell"
1465     bool IsObjectLayoutInTableCell( const sal_uInt32 nLayoutInTableCell ) const;
1466     // <--
1467 
1468     //No copying
1469     SwWW8ImplReader(const SwWW8ImplReader &);
1470     SwWW8ImplReader& operator=(const SwWW8ImplReader&);
1471 public:     // eigentlich private, geht aber leider nur public
1472     sal_uInt16 GetToggleAttrFlags() const;
1473     sal_uInt16 GetToggleBiDiAttrFlags() const;
1474     void SetToggleAttrFlags(sal_uInt16 nFlags);
1475     void SetToggleBiDiAttrFlags(sal_uInt16 nFlags);
1476 	//Modify here for #119405, by easyfan, 2012-05-24
1477 	WW8_CP GetCurrAttrCP() const {return maCurrAttrCP;}
1478 	bool IsParaEndInCPs(sal_Int32 , sal_Int32,bool bSdOD=true) const;
1479 	//End of modification, by easyfan
1480 	//Modify for #119405 by chengjh, 2012-08-16
1481 	//Clear the para end position recorded in reader intermittently for the least impact on loading performance
1482 	void ClearParaEndPosition();
1483 	//End
1484 
1485     long Read_Ftn(WW8PLCFManResult* pRes);
1486     sal_uInt16 End_Ftn();
1487     long Read_Field(WW8PLCFManResult* pRes);
1488     sal_uInt16 End_Field();
1489     long Read_Book(WW8PLCFManResult*);
1490     long Read_And(WW8PLCFManResult* pRes);
1491 
1492     // Attribute
1493 
1494     void Read_Special(sal_uInt16, const sal_uInt8*, short nLen);
1495     void Read_Obj(sal_uInt16, const sal_uInt8*, short nLen);
1496     void Read_PicLoc(sal_uInt16, const sal_uInt8* pData, short nLen );
1497     void Read_BoldUsw(sal_uInt16 nId, const sal_uInt8*, short nLen);
1498     void Read_Bidi(sal_uInt16 nId, const sal_uInt8*, short nLen);
1499     void Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8*, short nLen);
1500     void Read_SubSuper(         sal_uInt16, const sal_uInt8*, short nLen );
1501     bool ConvertSubToGraphicPlacement();
1502     SwFrmFmt *ContainsSingleInlineGraphic(const SwPaM &rRegion);
1503     void Read_SubSuperProp(     sal_uInt16, const sal_uInt8*, short nLen );
1504     void Read_Underline(        sal_uInt16, const sal_uInt8*, short nLen );
1505     void Read_TxtColor(         sal_uInt16, const sal_uInt8*, short nLen );
1506     void Read_FontCode(         sal_uInt16, const sal_uInt8*, short nLen );
1507     void Read_FontSize(         sal_uInt16, const sal_uInt8*, short nLen );
1508     void Read_CharSet(sal_uInt16 , const sal_uInt8* pData, short nLen);
1509     void Read_Language(         sal_uInt16, const sal_uInt8*, short nLen );
1510     void Read_CColl(            sal_uInt16, const sal_uInt8*, short nLen );
1511     void Read_Kern(             sal_uInt16, const sal_uInt8* pData, short nLen );
1512     void Read_FontKern(         sal_uInt16, const sal_uInt8* pData, short nLen );
1513     void Read_Emphasis(         sal_uInt16, const sal_uInt8* pData, short nLen );
1514     void Read_ScaleWidth(       sal_uInt16, const sal_uInt8* pData, short nLen );
1515     void Read_Relief(           sal_uInt16, const sal_uInt8* pData, short nLen);
1516     void Read_TxtAnim(      sal_uInt16, const sal_uInt8* pData, short nLen);
1517 
1518     void Read_NoLineNumb(       sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1519 
1520     void Read_LR(               sal_uInt16 nId, const sal_uInt8*, short nLen );
1521     void Read_UL(               sal_uInt16 nId, const sal_uInt8*, short nLen );
1522     void Read_ParaAutoBefore(sal_uInt16 , const sal_uInt8 *pData, short nLen);
1523     void Read_ParaAutoAfter(sal_uInt16 , const sal_uInt8 *pData, short nLen);
1524     void Read_DontAddEqual(sal_uInt16 , const sal_uInt8 *pData, short nLen);
1525     void Read_LineSpace(        sal_uInt16, const sal_uInt8*, short nLen );
1526     void Read_Justify(sal_uInt16, const sal_uInt8*, short nLen);
1527     void Read_IdctHint(sal_uInt16, const sal_uInt8*, short nLen);
1528     bool IsRightToLeft();
1529     void Read_RTLJustify(sal_uInt16, const sal_uInt8*, short nLen);
1530     void Read_Hyphenation(      sal_uInt16, const sal_uInt8* pData, short nLen );
1531     void Read_WidowControl(     sal_uInt16, const sal_uInt8* pData, short nLen );
1532     void Read_AlignFont(        sal_uInt16, const sal_uInt8* pData, short nLen );
1533     void Read_UsePgsuSettings(  sal_uInt16, const sal_uInt8* pData, short nLen );
1534     void Read_KeepLines(        sal_uInt16, const sal_uInt8* pData, short nLen );
1535     void Read_KeepParas(        sal_uInt16, const sal_uInt8* pData, short nLen );
1536     void Read_BreakBefore(      sal_uInt16, const sal_uInt8* pData, short nLen );
1537     void Read_Apo(sal_uInt16 nId, const sal_uInt8* pData, short nLen);
1538     void Read_ApoPPC(sal_uInt16, const sal_uInt8* pData, short);
1539 
1540     void Read_BoolItem(         sal_uInt16 nId, const sal_uInt8*, short nLen );
1541 
1542     void Read_Border(           sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1543     void Read_Tab(              sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1544     void Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen);
1545     void Read_FldVanish(        sal_uInt16 nId, const sal_uInt8* pData, short nLen );
1546 
1547     // Revision Marks ( == Redlining )
1548 
1549     // insert or delete content (change char attributes resp.)
1550     void Read_CRevisionMark(RedlineType_t eType, const sal_uInt8* pData, short nLen);
1551     // insert new content
1552     void Read_CFRMark(sal_uInt16 , const sal_uInt8* pData, short nLen);
1553     // delete old content
1554     void Read_CFRMarkDel(sal_uInt16 , const sal_uInt8* pData, short nLen);
1555     // change properties of content (e.g. char formating)
1556     void Read_CPropRMark(sal_uInt16 , const sal_uInt8* pData, short nLen); // complex!
1557 
1558 
1559     void Read_TabRowEnd(        sal_uInt16, const sal_uInt8* pData, short nLen );
1560     void Read_TabCellEnd(        sal_uInt16, const sal_uInt8* pData, short nLen );
1561     static bool ParseTabPos(WW8_TablePos *aTabPos, WW8PLCFx_Cp_FKP* pPap);
1562     void Read_Shade(            sal_uInt16, const sal_uInt8* pData, short nLen );
1563     void Read_ANLevelNo(        sal_uInt16, const sal_uInt8* pData, short nLen );
1564     void Read_ANLevelDesc(      sal_uInt16, const sal_uInt8* pData, short nLen );
1565 
1566     // Gliederungsebene Ver8
1567     void Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLen);
1568 
1569     void Read_OLST(             sal_uInt16, const sal_uInt8* pData, short nLen );
1570 
1571     void Read_CharShadow(       sal_uInt16, const sal_uInt8* pData, short nLen );
1572     void Read_CharHighlight(    sal_uInt16, const sal_uInt8* pData, short nLen );
1573                                         // Ver8-Listen
1574 
1575     void Read_ListLevel(        sal_uInt16 nId, const sal_uInt8* pData, short nLen);
1576     void Read_LFOPosition(      sal_uInt16 nId, const sal_uInt8* pData, short nLen);
1577     bool SetTxtFmtCollAndListLevel(const SwPaM& rRg, SwWW8StyInf& rStyleInfo);
1578 
1579     void Read_StyleCode(sal_uInt16, const sal_uInt8* pData, short nLen);
1580     void Read_Majority(sal_uInt16, const sal_uInt8* , short );
1581     void Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pDATA, short nLen);
1582 
1583     void Read_TxtForeColor(sal_uInt16, const sal_uInt8* pData, short nLen);
1584     void Read_TxtBackColor(sal_uInt16, const sal_uInt8* pData, short nLen);
1585     void Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, short nLen);
1586     void Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nLen);
1587     static sal_uInt32 ExtractColour(const sal_uInt8* &rpData, bool bVer67);
1588 
1589 	void Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen);
1590     long MapBookmarkVariables(const WW8FieldDesc* pF,String &rOrigName,
1591         const String &rData);
1592     String GetMappedBookmark(const String &rOrigName);
1593 
1594     // Felder
1595     eF_ResT Read_F_Input(WW8FieldDesc*, String& rStr);
1596     eF_ResT Read_F_InputVar(WW8FieldDesc*, String& rStr);
1597     eF_ResT Read_F_ANumber( WW8FieldDesc*, String& );
1598     eF_ResT Read_F_DocInfo( WW8FieldDesc* pF, String& rStr );
1599     eF_ResT Read_F_Author( WW8FieldDesc*, String& );
1600     eF_ResT Read_F_TemplName( WW8FieldDesc*, String& );
1601     short GetTimeDatePara(String& rStr, sal_uInt32& rFormat, sal_uInt16 &rLang,
1602         int nWhichDefault, bool bHijri = false);
1603     bool ForceFieldLanguage(SwField &rFld, sal_uInt16 nLang);
1604     eF_ResT Read_F_DateTime( WW8FieldDesc*, String& rStr );
1605     eF_ResT Read_F_FileName( WW8FieldDesc*, String& rStr);
1606     eF_ResT Read_F_Anz( WW8FieldDesc* pF, String& );
1607     eF_ResT Read_F_CurPage( WW8FieldDesc*, String& );
1608     eF_ResT Read_F_Ref( WW8FieldDesc* pF, String& );
1609 
1610     eF_ResT Read_F_Set( WW8FieldDesc*, String& rStr );
1611     eF_ResT Read_F_PgRef( WW8FieldDesc*, String& rStr );
1612     eF_ResT Read_F_NoteReference( WW8FieldDesc* pF, String& rStr );
1613 
1614     eF_ResT Read_F_Tox( WW8FieldDesc* pF, String& rStr );
1615     bool AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase);
1616     eF_ResT Read_F_Symbol( WW8FieldDesc*, String& rStr );
1617     eF_ResT Read_F_Embedd( WW8FieldDesc*, String& rStr );
1618     eF_ResT Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr);
1619     eF_ResT Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr );
1620     eF_ResT Read_F_FormListBox( WW8FieldDesc* pF, String& rStr);
1621     com::sun::star::awt::Size MiserableDropDownFormHack(const String &rString,
1622         com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>&
1623         rPropSet);
1624 
1625     eF_ResT Read_F_Macro( WW8FieldDesc*, String& rStr);
1626     eF_ResT Read_F_DBField( WW8FieldDesc*, String& rStr );
1627     eF_ResT Read_F_DBNext( WW8FieldDesc*, String& );
1628     eF_ResT Read_F_DBNum( WW8FieldDesc*, String& );
1629     eF_ResT Read_F_Equation( WW8FieldDesc*, String& );
1630     void Read_SubF_Ruby( _ReadFieldParams& rReadParam);
1631     void Read_SubF_Combined( _ReadFieldParams& rReadParam);
1632     eF_ResT Read_F_IncludePicture( WW8FieldDesc*, String& rStr );
1633     eF_ResT Read_F_IncludeText(    WW8FieldDesc*, String& rStr );
1634     eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr );
1635 
1636     eF_ResT Read_F_OCX(WW8FieldDesc*, String&);
1637     eF_ResT Read_F_Hyperlink(WW8FieldDesc*, String& rStr);
1638         eF_ResT Read_F_Shape(WW8FieldDesc* pF, String& rStr);
1639 
1640     void DeleteFormImpl();
1641 
1642     short ImportSprm( const sal_uInt8* pPos, sal_uInt16 nId = 0 );
1643 
1644     bool SearchRowEnd(WW8PLCFx_Cp_FKP* pPap,WW8_CP &rStartCp, int nLevel) const;
1645 
1646     const WW8Fib& GetFib() const    { return *pWwFib; }
1647     SwDoc& GetDoc() const           { return rDoc; }
1648     sal_uInt16 GetNAktColl()  const     { return nAktColl; }
1649     void SetNAktColl( sal_uInt16 nColl ) { nAktColl = nColl;    }
1650     void SetAktItemSet( SfxItemSet* pItemSet ) { pAktItemSet = pItemSet; }
1651     sal_uInt16 StyleUsingLFO( sal_uInt16 nLFOIndex ) const ;
1652     const SwFmt* GetStyleWithOrgWWName( String& rName ) const ;
1653 
1654     static bool GetPictGrafFromStream(Graphic& rGraphic, SvStream& rSrc);
1655     static void PicRead( SvStream *pDataStream, WW8_PIC *pPic, bool bVer67);
1656     static bool ImportOleWMF( SvStorageRef xSrc1, GDIMetaFile &rWMF,
1657         long &rX, long &rY);
1658     static ColorData GetCol(sal_uInt8 nIco);
1659 
1660     SwWW8ImplReader( sal_uInt8 nVersionPara, SvStorage* pStorage, SvStream* pSt,
1661         SwDoc& rD, const String& rBaseURL, bool bNewDoc );
1662 
1663     const String& GetBaseURL() const { return sBaseURL; }
1664     // Laden eines kompletten DocFiles
1665     sal_uLong LoadDoc( SwPaM&,WW8Glossary *pGloss=0);
1666     CharSet GetCurrentCharSet();
1667     CharSet GetCurrentCJKCharSet();
1668 
1669     void PostProcessAttrs();
1670 };
1671 
1672 bool CanUseRemoteLink(const String &rGrfName);
1673 void UseListIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt);
1674 void SetStyleIndent(SwWW8StyInf &rStyleInfo, const SwNumFmt &rFmt);
1675 // --> OD 2010-05-06 #i103711#
1676 // --> OD 2010-05-11 #i105414#
1677 void SyncIndentWithList( SvxLRSpaceItem &rLR,
1678                          const SwNumFmt &rFmt,
1679                          const bool bFirstLineOfStSet,
1680                          const bool bLeftIndentSet );
1681 // <--
1682 long GetListFirstLineIndent(const SwNumFmt &rFmt);
1683 String BookmarkToWriter(const String &rBookmark);
1684 bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth,
1685     sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft,
1686     SwTwips nPageRight, SwTwips nPageSize);
1687 void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec &rRecord,
1688     SfxItemSet &rFlySet);
1689 bool RTLDrawingsHack(long &rLeft, long nWidth,
1690     sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft,
1691     SwTwips nPageRight, SwTwips nPageSize);
1692 #endif
1693 
1694 /* vi:set tabstop=4 shiftwidth=4 expandtab: */
1695