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