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